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

Function authChallenge

packages/consortium-cli/src/api/encryption.ts:165–179  ·  view source on GitHub ↗
(secret: Uint8Array)

Source from the content-addressed store, hash-verified

163 * Generate authentication challenge response
164 */
165export function authChallenge(secret: Uint8Array): {
166 challenge: Uint8Array
167 publicKey: Uint8Array
168 signature: Uint8Array
169} {
170 const keypair = tweetnacl.sign.keyPair.fromSeed(secret);
171 const challenge = getRandomBytes(32);
172 const signature = tweetnacl.sign.detached(challenge, keypair.secretKey);
173
174 return {
175 challenge,
176 publicKey: keypair.publicKey,
177 signature
178 };
179}

Callers 1

authGetTokenFunction · 0.90

Calls 1

getRandomBytesFunction · 0.70

Tested by

no test coverage detected