migrate to jsr dependencies for @noble and @scure.

This commit is contained in:
fiatjaf
2026-01-27 23:54:50 -03:00
parent 3588d30044
commit 42c9c7554d
6 changed files with 10 additions and 9 deletions

1
.npmrc Normal file
View File

@@ -0,0 +1 @@
@jsr:registry=https://npm.jsr.io

BIN
bun.lockb

Binary file not shown.

View File

@@ -1,5 +1,5 @@
import { bytesToHex } from '@noble/hashes/utils.js' import { bytesToHex } from '@noble/hashes/utils.js'
import { wordlist } from '@scure/bip39/wordlists/english' import { wordlist } from '@scure/bip39/wordlists/english.js'
import { generateMnemonic, mnemonicToSeedSync, validateMnemonic } from '@scure/bip39' import { generateMnemonic, mnemonicToSeedSync, validateMnemonic } from '@scure/bip39'
import { HDKey } from '@scure/bip32' import { HDKey } from '@scure/bip32'

View File

@@ -110,7 +110,7 @@ export function decode(nip19: NPub): DecodedNpub
export function decode(nip19: Note): DecodedNote export function decode(nip19: Note): DecodedNote
export function decode(code: string): DecodedResult export function decode(code: string): DecodedResult
export function decode(code: string): DecodedResult { export function decode(code: string): DecodedResult {
let { prefix, words } = bech32.decode(code, Bech32MaxSize) let { prefix, words } = bech32.decode(code as `${string}1${string}`, Bech32MaxSize)
let data = new Uint8Array(bech32.fromWords(words)) let data = new Uint8Array(bech32.fromWords(words))
switch (prefix) { switch (prefix) {

View File

@@ -22,7 +22,7 @@ export function encrypt(
} }
export function decrypt(ncryptsec: string, password: string): Uint8Array { export function decrypt(ncryptsec: string, password: string): Uint8Array {
let { prefix, words } = bech32.decode(ncryptsec, Bech32MaxSize) let { prefix, words } = bech32.decode(ncryptsec as `${string}1${string}`, Bech32MaxSize)
if (prefix !== 'ncryptsec') { if (prefix !== 'ncryptsec') {
throw new Error(`invalid prefix ${prefix}, expected 'ncryptsec'`) throw new Error(`invalid prefix ${prefix}, expected 'ncryptsec'`)
} }

View File

@@ -236,12 +236,12 @@
}, },
"license": "Unlicense", "license": "Unlicense",
"dependencies": { "dependencies": {
"@noble/ciphers": "^2.1.1", "@noble/ciphers": "npm:@jsr/noble__ciphers@2.1.1",
"@noble/curves": "^2.0.1", "@noble/curves": "npm:@jsr/noble__curves@2.0.1",
"@noble/hashes": "^2.0.1", "@noble/hashes": "npm:@jsr/noble__hashes@2.0.1",
"@scure/base": "^2.0.0", "@scure/base": "npm:@jsr/scure__base@2.0.0",
"@scure/bip32": "^2.0.1", "@scure/bip32": "npm:@jsr/scure__bip32@2.0.1",
"@scure/bip39": "^2.0.1", "@scure/bip39": "npm:@jsr/scure__bip39@2.0.1",
"nostr-wasm": "0.1.0" "nostr-wasm": "0.1.0"
}, },
"peerDependencies": { "peerDependencies": {