File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ export const isEventMatchingFilter = (filter: SubscriptionFilter) => (event: Eve
105105}
106106
107107export const getEventHash = async ( event : Event | UnidentifiedEvent | UnsignedEvent ) : Promise < string > => {
108- const id = await secp256k1 . utils . sha256 ( Buffer . from ( JSON . stringify ( serializeEvent ( event ) ) ) )
108+ const id = await secp256k1 . utils . sha256 ( new Uint8Array ( Buffer . from ( JSON . stringify ( serializeEvent ( event ) ) ) ) )
109109
110110 return Buffer . from ( id ) . toString ( 'hex' )
111111}
@@ -162,15 +162,15 @@ export const encryptKind4Event = (
162162 receiverPubkey : Pubkey ,
163163) => ( event : UnsignedEvent ) : UnsignedEvent => {
164164 const key = secp256k1
165- . getSharedSecret ( senderPrivkey , `02${ receiverPubkey } ` , true )
165+ . getSharedSecret ( typeof senderPrivkey === 'string' ? senderPrivkey : new Uint8Array ( senderPrivkey ) , `02${ receiverPubkey } ` , true )
166166 . subarray ( 1 )
167167
168168 const iv = getRandomValues ( new Uint8Array ( 16 ) )
169169
170170 // deepcode ignore InsecureCipherNoIntegrity: NIP-04 Encrypted Direct Message uses aes-256-cbc
171171 const cipher = createCipheriv (
172172 'aes-256-cbc' ,
173- Buffer . from ( key ) ,
173+ new Uint8Array ( key ) ,
174174 iv ,
175175 )
176176
You can’t perform that action at this time.
0 commit comments