MCPcopy Create free account
hub / github.com/ConsortiumAI/Consortium / decryptWithEphemeralKey

Function decryptWithEphemeralKey

packages/consortium-cli/src/ui/auth.ts:130–138  ·  view source on GitHub ↗
(encryptedBundle: Uint8Array, recipientSecretKey: Uint8Array)

Source from the content-addressed store, hash-verified

128}
129
130function decryptWithEphemeralKey(encryptedBundle: Uint8Array, recipientSecretKey: Uint8Array): Uint8Array | null {
131 const ephemeralPublicKey = encryptedBundle.slice(0, 32);
132 const nonce = encryptedBundle.slice(32, 32 + tweetnacl.box.nonceLength);
133 const encrypted = encryptedBundle.slice(32 + tweetnacl.box.nonceLength);
134
135 const decrypted = tweetnacl.box.open(encrypted, nonce, ephemeralPublicKey, recipientSecretKey);
136 if (!decrypted) return null;
137 return decrypted;
138}
139
140/**
141 * Ensure authentication and machine setup

Callers 1

waitForAuthenticationFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected