fix: when decrypting file, have better error messages #17
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "issue-11"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #11 #9 #2
fix: when decrypting file, have better error messagesto WIP: fix: when decrypting file, have better error messagesWIP: fix: when decrypting file, have better error messagesto fix: when decrypting file, have better error messages@ -110,0 +126,4 @@
let lud16 = ''
if (npub) {
if (npub) lud16 = `${npub}@npub.cash`
second if is uncessary
@ -362,0 +362,4 @@
/**
* Creates Nostr HTTP Auth token
* @param npub npub in hex format
createNostrHttpAuthToken
method has only one param@ -362,0 +376,4 @@
authEvent.content = `sigit-${createdAt}`
authEvent.created_at = createdAt
await this.signEvent(authEvent.rawEvent() as UnsignedEvent)
signEvent
method returns a promise that resolves into signed event, and I think you should assign it tosignedAuthEvent
constant@ -362,0 +391,4 @@
const token = btoa(authEventSerialized)
return token
} catch (error) {
throw new Error('An error occurred in JSON.stringy of signedAuthEvent')
I would change the error message to
An error occurred while encoding signed auth event.
@ -64,2 +64,3 @@
console.log('err in decryption:>> ', err)
toast.error(err.message || 'An error occurred while decrypting file.')
if (err.message.toLowerCase().includes('expected')) {
I would say that a more convenient and reliable approach to handle errors is to have dedicated errors of custom type
@ -65,1 +65,3 @@
toast.error(err.message || 'An error occurred while decrypting file.')
if (err.message.toLowerCase().includes('expected')) {
toast.error(`The Key seems to be invalid length or format`)
The message should be
The decryption key length or format is invalid.
@ -66,0 +66,4 @@
if (err.message.toLowerCase().includes('expected')) {
toast.error(`The Key seems to be invalid length or format`)
} else if (err.message.includes('The JWK "alg" member was inconsistent')) {
toast.error(`The Key seems to be invalid.`)
The message should be
The decryption key is invalid.