feat: add deriveBlakeChildKeyInt
This commit is contained in:
parent
68cb638086
commit
282c431021
|
@ -2,6 +2,7 @@ import { blake3 } from "@noble/hashes/blake3";
|
||||||
import { concatBytes } from "@noble/hashes/utils";
|
import { concatBytes } from "@noble/hashes/utils";
|
||||||
import { hkdf } from "@noble/hashes/hkdf";
|
import { hkdf } from "@noble/hashes/hkdf";
|
||||||
import { sha256 } from "@noble/hashes/sha256";
|
import { sha256 } from "@noble/hashes/sha256";
|
||||||
|
import { encodeEndian } from "@lumeweb/libs5";
|
||||||
|
|
||||||
export function deriveChildKey(
|
export function deriveChildKey(
|
||||||
parentKey: Uint8Array,
|
parentKey: Uint8Array,
|
||||||
|
@ -18,3 +19,10 @@ export function deriveBlakeChildKey(
|
||||||
|
|
||||||
return blake3(concatBytes(parentKey, tweakHash));
|
return blake3(concatBytes(parentKey, tweakHash));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function deriveBlakeChildKeyInt(
|
||||||
|
parentKey: Uint8Array,
|
||||||
|
tweak: number,
|
||||||
|
): Uint8Array {
|
||||||
|
return blake3(concatBytes(parentKey, encodeEndian(tweak, 32)));
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue