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

Function deriveSecretKeyTreeRoot

packages/happy-agent/src/encryption.ts:49–55  ·  view source on GitHub ↗
(seed: Uint8Array, usage: string)

Source from the content-addressed store, hash-verified

47};
48
49export function deriveSecretKeyTreeRoot(seed: Uint8Array, usage: string): KeyTreeState {
50 const I = hmac_sha512(new TextEncoder().encode(usage + ' Master Seed'), seed);
51 return {
52 key: I.slice(0, 32),
53 chainCode: I.slice(32),
54 };
55}
56
57export function deriveSecretKeyTreeChild(chainCode: Uint8Array, index: string): KeyTreeState {
58 const data = new Uint8Array([0x00, ...new TextEncoder().encode(index)]);

Callers 2

encryption.test.tsFile · 0.90
deriveKeyFunction · 0.70

Calls 1

hmac_sha512Function · 0.70

Tested by

no test coverage detected