refactor: Update register handler to use protocol.CredentialDescriptor struct

This commit is contained in:
Prad Nukala (aider)
2024-12-09 14:59:25 -05:00
parent d030dbcfde
commit 3d9264dae4
+3 -7
View File
@@ -107,13 +107,9 @@ navigator.credentials
.then((newCredentialInfo) => { .then((newCredentialInfo) => {
// Convert credential to base64 string // Convert credential to base64 string
const credentialJSON = JSON.stringify({ const credentialJSON = JSON.stringify({
id: newCredentialInfo.id, CredentialID: Array.from(new Uint8Array(newCredentialInfo.rawId)),
rawId: Array.from(new Uint8Array(newCredentialInfo.rawId)), Type: newCredentialInfo.type,
response: { Transport: newCredentialInfo.response.getTransports ? newCredentialInfo.response.getTransports() : []
attestationObject: Array.from(new Uint8Array(newCredentialInfo.response.attestationObject)),
clientDataJSON: Array.from(new Uint8Array(newCredentialInfo.response.clientDataJSON))
},
type: newCredentialInfo.type
}); });
document.getElementById('credential-data').value = btoa(credentialJSON); document.getElementById('credential-data').value = btoa(credentialJSON);
// Show credential details // Show credential details