diff --git a/src/keys.ts b/src/keys.ts index 83e3e25..e5f30ad 100644 --- a/src/keys.ts +++ b/src/keys.ts @@ -1,9 +1,18 @@ import { blake3 } from "@noble/hashes/blake3"; import { concatBytes } from "@noble/hashes/utils"; +import { hkdf } from "@noble/hashes/hkdf"; +import { sha256 } from "@noble/hashes/sha256"; export function deriveChildKey( parentKey: Uint8Array, tweak: string, +): Uint8Array { + return hkdf(sha256, parentKey, undefined, tweak, 32); +} + +export function deriveBlakeChildKey( + parentKey: Uint8Array, + tweak: string, ): Uint8Array { const tweakHash = blake3(tweak);