decord/source/modules/webauthn/WebAuthnUtils.tsx
2026-07-20 17:37:48 +00:00

22 lines
883 B
TypeScript

// Module ID: 5592
// Function ID: 47480
// Name: encodeUserIdForWebAuthn
// Dependencies: []
// Exports: encodeUserIdForWebAuthn
// Module 5592 (encodeUserIdForWebAuthn)
const _module = require(dependencyMap[0]);
const result = _module.fileFinishedImporting("modules/webauthn/WebAuthnUtils.tsx");
export const encodeUserIdForWebAuthn = function encodeUserIdForWebAuthn(id) {
const uint8Array = new Uint8Array(16);
const dataView = new DataView(uint8Array.buffer);
dataView.setUint32(0, 821232635);
dataView.setUint16(4, 35878);
dataView.setUint16(6, 20307);
dataView.setBigUint64(8, BigInt(id));
const items = [...uint8Array];
const str = btoa(String.fromCharCode.apply(items));
const str2 = btoa(String.fromCharCode.apply(items)).replace(/\+/g, "-");
return btoa(String.fromCharCode.apply(items)).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
};