Skip to content

Commit

Permalink
debug webauthn
Browse files Browse the repository at this point in the history
  • Loading branch information
kevodwyer committed Jun 20, 2023
1 parent 584b376 commit 78f8c80
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
8 changes: 4 additions & 4 deletions src/components/auth/MultiFactorAuth.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ module.exports = {
let resp = peergos.client.JsUtil.generateAuthResponse(credentialId, this.mfaCode);
this.consumer_func(credentialId, resp);
} else {
confirmWebAuth(this.mfaOptions[this.preferredAuthMethod]);
this.confirmWebAuth(this.mfaOptions[this.preferredAuthMethod]);
}
},
confirmWebAuth: function(webAuthMethod) {
Expand All @@ -109,11 +109,11 @@ module.exports = {
}
};
navigator.credentials.get(data).then(credential => {
let rawAttestation = convertToByteArray(new Int8Array(credential.response.attestationObject));
let authenticatorData = convertToByteArray(new Int8Array(credential.response.authenticatorData));
let clientDataJson = convertToByteArray(new Int8Array(credential.response.clientDataJSON));
let signature = convertToByteArray(new Int8Array(credential.response.signature));
let resp = peergos.client.JsUtil.generateWebAuthnResponse(credential.rawId, rawAttestation, clientDataJson, signature);
that.consumer_func(credential.rawId, resp);
let resp = peergos.client.JsUtil.generateWebAuthnResponse(webAuthMethod.credentialId, authenticatorData, clientDataJson, signature);
that.consumer_func(webAuthMethod.credentialId, resp);
});
}
}
Expand Down
8 changes: 1 addition & 7 deletions src/components/auth/WebAuth.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,7 @@ module.exports = {
let rawId = convertToByteArray(new Int8Array(credential.rawId));
let resp = peergos.client.JsUtil.generateWebAuthnResponse(rawId, rawAttestation, clientDataJson, signature);
that.context.network.account.registerSecurityKeyComplete(that.context.username, that.webAuthName, resp, that.context.signer).thenApply(done => {
//let res = await fetch(\"/registerComplete\", {'method':'POST','body':JSON.stringify({
// 'attestationObject':toHexString(credential.response.attestationObject),
// 'clientDataJSON': toHexString(credential.response.clientDataJSON)
// })
//}).then(response=>response.json());
//document.getElementById(\"register\").textContent = res.status;
//}
that.$toast('Web Auth Key has been enabled');
that.close(true);
});
});
Expand Down

0 comments on commit 78f8c80

Please sign in to comment.