MCPcopy Create free account
hub / github.com/OpenAnonymity/oa-chat / generateRecoveryCode

Function generateRecoveryCode

chat/services/recoveryCode.js:39–47  ·  view source on GitHub ↗
(wordCount = WORD_COUNT_DEFAULT)

Source from the content-addressed store, hash-verified

37}
38
39export function generateRecoveryCode(wordCount = WORD_COUNT_DEFAULT) {
40 const bytes = new Uint8Array(wordCount * 2);
41 crypto.getRandomValues(bytes);
42 const words = [];
43 for (let i = 0; i < wordCount; i++) {
44 words.push(bytesToWord(bytes[i * 2], bytes[i * 2 + 1]));
45 }
46 return words.join('-');
47}
48
49export function normalizeRecoveryCode(input) {
50 if (!input) return '';

Callers 2

createAccountMethod · 0.90

Calls 2

bytesToWordFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected