MCPcopy Index your code
hub / github.com/DeepNotesApp/DeepNotes / hashRecoveryCode

Function hashRecoveryCode

apps/app-server/src/utils/crypto.ts:159–171  ·  view source on GitHub ↗
(
  recoveryCode: string,
  salt?: Uint8Array,
)

Source from the content-addressed store, hash-verified

157}
158
159export function hashRecoveryCode(
160 recoveryCode: string,
161 salt?: Uint8Array,
162): Uint8Array {
163 salt ??= sodium.randombytes_buf(16);
164
165 return concatUint8Arrays(
166 salt,
167 cryptoJsWordArrayToUint8Array(
168 CryptoJS.SHA256(sodium.to_hex(salt) + recoveryCode),
169 ),
170 );
171}
172export function verifyRecoveryCode(
173 recoveryCode: string,
174 hashedRecoveryCode: Uint8Array,

Callers 3

generateRecoveryCodesFunction · 0.90
finishFunction · 0.90
verifyRecoveryCodeFunction · 0.85

Calls 2

concatUint8ArraysFunction · 0.90

Tested by

no test coverage detected