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

Function deriveSecretKeyTreeRoot

packages/happy-app/sources/encryption/deriveKey.ts:8–14  ·  view source on GitHub ↗
(seed: Uint8Array, usage: string)

Source from the content-addressed store, hash-verified

6};
7
8export async function deriveSecretKeyTreeRoot(seed: Uint8Array, usage: string): Promise<KeyTreeState> {
9 const I = await hmac_sha512(new TextEncoder().encode(usage + ' Master Seed'), seed);
10 return {
11 key: I.slice(0, 32),
12 chainCode: I.slice(32)
13 };
14}
15
16export async function deriveSecretKeyTreeChild(chainCode: Uint8Array, index: string): Promise<KeyTreeState> {
17

Callers 2

deriveKeyFunction · 0.70

Calls 1

hmac_sha512Function · 0.90

Tested by

no test coverage detected