MCPcopy
hub / github.com/slopus/happy / deriveSecretKeyTreeChild

Function deriveSecretKeyTreeChild

packages/happy-agent/src/encryption.ts:57–64  ·  view source on GitHub ↗
(chainCode: Uint8Array, index: string)

Source from the content-addressed store, hash-verified

55}
56
57export function deriveSecretKeyTreeChild(chainCode: Uint8Array, index: string): KeyTreeState {
58 const data = new Uint8Array([0x00, ...new TextEncoder().encode(index)]);
59 const I = hmac_sha512(chainCode, data);
60 return {
61 key: I.slice(0, 32),
62 chainCode: I.slice(32),
63 };
64}
65
66export function deriveKey(master: Uint8Array, usage: string, path: string[]): Uint8Array {
67 let state = deriveSecretKeyTreeRoot(master, usage);

Callers 2

encryption.test.tsFile · 0.90
deriveKeyFunction · 0.70

Calls 1

hmac_sha512Function · 0.70

Tested by

no test coverage detected