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

Function deriveKey

packages/happy-agent/src/encryption.ts:66–72  ·  view source on GitHub ↗
(master: Uint8Array, usage: string, path: string[])

Source from the content-addressed store, hash-verified

64}
65
66export function deriveKey(master: Uint8Array, usage: string, path: string[]): Uint8Array {
67 let state = deriveSecretKeyTreeRoot(master, usage);
68 for (const index of path) {
69 state = deriveSecretKeyTreeChild(state.chainCode, index);
70 }
71 return state.key;
72}
73
74export function deriveContentKeyPair(secret: Uint8Array): { publicKey: Uint8Array; secretKey: Uint8Array } {
75 const seed = deriveKey(secret, 'Happy EnCoder', ['content']);

Callers 3

cli-smoke.test.tsFile · 0.90
encryption.test.tsFile · 0.90
deriveContentKeyPairFunction · 0.70

Calls 2

deriveSecretKeyTreeRootFunction · 0.70
deriveSecretKeyTreeChildFunction · 0.70

Tested by

no test coverage detected