fix: when decrypting file, have better error messages #17

Merged
b merged 11 commits from issue-11 into main 2024-05-14 15:09:01 +00:00
Owner

Closes #11 #9 #2

Closes #11 #9 #2
m added 1 commit 2024-05-09 13:48:14 +00:00
m changed title from fix: when decrypting file, have better error messages to WIP: fix: when decrypting file, have better error messages 2024-05-09 13:48:18 +00:00
m added 2 commits 2024-05-13 06:00:55 +00:00
m added 1 commit 2024-05-13 06:02:42 +00:00
m added 1 commit 2024-05-13 06:24:59 +00:00
m changed title from WIP: fix: when decrypting file, have better error messages to fix: when decrypting file, have better error messages 2024-05-13 06:25:04 +00:00
s requested changes 2024-05-13 07:32:54 +00:00
@ -110,0 +126,4 @@
let lud16 = ''
if (npub) {
if (npub) lud16 = `${npub}@npub.cash`
Owner

second if is uncessary

second if is uncessary
m marked this conversation as resolved
m added 1 commit 2024-05-13 07:52:12 +00:00
m added 1 commit 2024-05-13 08:11:46 +00:00
m added 1 commit 2024-05-14 12:39:13 +00:00
y requested changes 2024-05-14 13:16:41 +00:00
Dismissed
@ -362,0 +362,4 @@
/**
* Creates Nostr HTTP Auth token
* @param npub npub in hex format
Owner

createNostrHttpAuthToken method has only one param

`createNostrHttpAuthToken` method has only one param
m marked this conversation as resolved
@ -362,0 +376,4 @@
authEvent.content = `sigit-${createdAt}`
authEvent.created_at = createdAt
await this.signEvent(authEvent.rawEvent() as UnsignedEvent)
Owner

signEvent method returns a promise that resolves into signed event, and I think you should assign it to signedAuthEvent constant

`signEvent` method returns a promise that resolves into signed event, and I think you should assign it to `signedAuthEvent` constant
m marked this conversation as resolved
@ -362,0 +391,4 @@
const token = btoa(authEventSerialized)
return token
} catch (error) {
throw new Error('An error occurred in JSON.stringy of signedAuthEvent')
Owner

I would change the error message to An error occurred while encoding signed auth event.

I would change the error message to `An error occurred while encoding signed auth event.`
m marked this conversation as resolved
@ -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')) {
Owner

I would say that a more convenient and reliable approach to handle errors is to have dedicated errors of custom type

I would say that a more convenient and reliable approach to handle errors is to have dedicated errors of custom type
m marked this conversation as resolved
@ -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`)
Owner

The message should be The decryption key length or format is invalid.

The message should be `The decryption key length or format is invalid.`
m marked this conversation as resolved
@ -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.`)
Owner

The message should be The decryption key is invalid.

The message should be `The decryption key is invalid.`
m marked this conversation as resolved
m added 1 commit 2024-05-14 14:48:16 +00:00
y approved these changes 2024-05-14 14:51:50 +00:00
m added 1 commit 2024-05-14 14:59:18 +00:00
b added 1 commit 2024-05-14 15:08:55 +00:00
b merged commit a99c16a3a7 into main 2024-05-14 15:09:01 +00:00
Sign in to join this conversation.
No reviewers
s
y
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: sigit/sigit.io#17
No description provided.