import * as secp from '@noble/secp256k1'
import { hkdf } from '@noble/hashes/hkdf'
import { sha256 } from '@noble/hashes/sha256'
function makeSharedSecret(priv: Uint8Array, pub: Uint8Array, i: number) : Uint8Array {
const secretNumber = secp.getSharedSecret(priv, pub, true).slice(1,33)
const salt = ""
const keyInfo = String(i)
const keyLength = 64
const derivedKey = hkdf(sha256, String(secretNumber), salt, info, keyLength)
return derivedKey
}
Last active
February 3, 2023 17:15
-
-
Save shea256/e0b09f82f8b4408fdf9ee74f7a5febbd to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment