mirror of
https://github.com/nbd-wtf/nostr-tools.git
synced 2026-01-31 14:38:51 +00:00
migrate to jsr dependencies for @noble and @scure.
This commit is contained in:
2
nip06.ts
2
nip06.ts
@@ -1,5 +1,5 @@
|
||||
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 { HDKey } from '@scure/bip32'
|
||||
|
||||
|
||||
2
nip19.ts
2
nip19.ts
@@ -110,7 +110,7 @@ export function decode(nip19: NPub): DecodedNpub
|
||||
export function decode(nip19: Note): DecodedNote
|
||||
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))
|
||||
|
||||
switch (prefix) {
|
||||
|
||||
2
nip49.ts
2
nip49.ts
@@ -22,7 +22,7 @@ export function encrypt(
|
||||
}
|
||||
|
||||
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') {
|
||||
throw new Error(`invalid prefix ${prefix}, expected 'ncryptsec'`)
|
||||
}
|
||||
|
||||
12
package.json
12
package.json
@@ -236,12 +236,12 @@
|
||||
},
|
||||
"license": "Unlicense",
|
||||
"dependencies": {
|
||||
"@noble/ciphers": "^2.1.1",
|
||||
"@noble/curves": "^2.0.1",
|
||||
"@noble/hashes": "^2.0.1",
|
||||
"@scure/base": "^2.0.0",
|
||||
"@scure/bip32": "^2.0.1",
|
||||
"@scure/bip39": "^2.0.1",
|
||||
"@noble/ciphers": "npm:@jsr/noble__ciphers@2.1.1",
|
||||
"@noble/curves": "npm:@jsr/noble__curves@2.0.1",
|
||||
"@noble/hashes": "npm:@jsr/noble__hashes@2.0.1",
|
||||
"@scure/base": "npm:@jsr/scure__base@2.0.0",
|
||||
"@scure/bip32": "npm:@jsr/scure__bip32@2.0.1",
|
||||
"@scure/bip39": "npm:@jsr/scure__bip39@2.0.1",
|
||||
"nostr-wasm": "0.1.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
||||
Reference in New Issue
Block a user