mirror of
https://github.com/nbd-wtf/nostr-tools.git
synced 2025-12-09 16:48:50 +00:00
nip44: get rid of ensureBytes() since it was removed from upstream library.
This commit is contained in:
4
nip44.ts
4
nip44.ts
@@ -1,5 +1,5 @@
|
|||||||
import { chacha20 } from '@noble/ciphers/chacha'
|
import { chacha20 } from '@noble/ciphers/chacha'
|
||||||
import { ensureBytes, equalBytes } from '@noble/ciphers/utils'
|
import { equalBytes } from '@noble/ciphers/utils'
|
||||||
import { secp256k1 } from '@noble/curves/secp256k1'
|
import { secp256k1 } from '@noble/curves/secp256k1'
|
||||||
import { extract as hkdf_extract, expand as hkdf_expand } from '@noble/hashes/hkdf'
|
import { extract as hkdf_extract, expand as hkdf_expand } from '@noble/hashes/hkdf'
|
||||||
import { hmac } from '@noble/hashes/hmac'
|
import { hmac } from '@noble/hashes/hmac'
|
||||||
@@ -23,8 +23,6 @@ const u = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
getMessageKeys(conversationKey: Uint8Array, nonce: Uint8Array) {
|
getMessageKeys(conversationKey: Uint8Array, nonce: Uint8Array) {
|
||||||
ensureBytes(conversationKey, 32)
|
|
||||||
ensureBytes(nonce, 32)
|
|
||||||
const keys = hkdf_expand(sha256, conversationKey, nonce, 76)
|
const keys = hkdf_expand(sha256, conversationKey, nonce, 76)
|
||||||
return {
|
return {
|
||||||
chacha_key: keys.subarray(0, 32),
|
chacha_key: keys.subarray(0, 32),
|
||||||
|
|||||||
Reference in New Issue
Block a user