common-inputs.js (769B)
1 const ES256_ID = -7; 2 const CHALLENGE = "climb the mountain"; 3 4 const PUBLIC_KEY_RP = { 5 id: window.location.hostname, 6 name: "Example RP", 7 }; 8 9 const PUBLIC_KEY_USER = { 10 id: new TextEncoder().encode("123456789"), 11 name: "madeline@example.com", 12 displayName: "Madeline", 13 }; 14 15 // ES256. 16 const PUBLIC_KEY_PARAMETERS = [{ 17 type: "public-key", 18 alg: ES256_ID, 19 }]; 20 21 const AUTHENTICATOR_SELECTION_CRITERIA = { 22 requireResidentKey: false, 23 userVerification: "discouraged", 24 }; 25 26 const MAKE_CREDENTIAL_OPTIONS = { 27 challenge: new TextEncoder().encode(CHALLENGE), 28 rp: PUBLIC_KEY_RP, 29 user: PUBLIC_KEY_USER, 30 pubKeyCredParams: PUBLIC_KEY_PARAMETERS, 31 authenticatorSelection: AUTHENTICATOR_SELECTION_CRITERIA, 32 excludeCredentials: [], 33 };