mirror of
https://github.com/nbd-wtf/nostr-tools.git
synced 2025-12-08 16:28:49 +00:00
let it throw.
This commit is contained in:
8
nip44.ts
8
nip44.ts
@@ -27,13 +27,7 @@ export function encrypt(key: Uint8Array, text: string, v = 1) {
|
||||
}
|
||||
|
||||
export function decrypt(key: Uint8Array, payload: string) {
|
||||
let data
|
||||
try {
|
||||
data = base64.decode(payload)
|
||||
} catch (e) {
|
||||
throw new Error(`NIP44: failed to base64 decode payload: ${e}`)
|
||||
}
|
||||
|
||||
let data = base64.decode(payload)
|
||||
if (data[0] !== 1) {
|
||||
throw new Error(`NIP44: unknown encryption version: ${data[0]}`)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user