diff --git a/src/keys.ts b/src/keys.ts index e5f30ad..5650db7 100644 --- a/src/keys.ts +++ b/src/keys.ts @@ -2,6 +2,7 @@ import { blake3 } from "@noble/hashes/blake3"; import { concatBytes } from "@noble/hashes/utils"; import { hkdf } from "@noble/hashes/hkdf"; import { sha256 } from "@noble/hashes/sha256"; +import { encodeEndian } from "@lumeweb/libs5"; export function deriveChildKey( parentKey: Uint8Array, @@ -18,3 +19,10 @@ export function deriveBlakeChildKey( return blake3(concatBytes(parentKey, tweakHash)); } + +export function deriveBlakeChildKeyInt( + parentKey: Uint8Array, + tweak: number, +): Uint8Array { + return blake3(concatBytes(parentKey, encodeEndian(tweak, 32))); +}