feat: add deriveChildKey function
This commit is contained in:
parent
0aff93d064
commit
d7cdaaf316
|
@ -9,4 +9,5 @@ export * from "./stringifyJSON.js";
|
|||
export * from "./types.js";
|
||||
export * from "./cid.js";
|
||||
export * from "./encoding.js";
|
||||
export * from "./keys.js";
|
||||
export { ed25519, sha512 };
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
import { blake3 } from "@noble/hashes/blake3";
|
||||
import { concatBytes } from "@noble/hashes/utils";
|
||||
|
||||
export function deriveChildKey(
|
||||
parentKey: Uint8Array,
|
||||
tweak: string,
|
||||
): Uint8Array {
|
||||
const tweakHash = blake3(tweak);
|
||||
|
||||
return blake3(concatBytes(parentKey, tweakHash));
|
||||
}
|
Loading…
Reference in New Issue