Removed CBOR and moved to JSON for Communication
This commit is contained in:
@@ -1,17 +1,31 @@
|
||||
{% extends "base.html" %}
|
||||
{% load static %}
|
||||
{% block head %}
|
||||
<script type="application/javascript" src="{% static 'mfa/js/cbor.js'%}"></script>
|
||||
<script type="application/javascript" src="{% static 'mfa/js/ua-parser.min.js'%}"></script>
|
||||
<script type="application/javascript" src="{% static 'mfa/js/base64url.js'%}"></script>
|
||||
<script type="application/javascript" src="{% static 'mfa/js/helpers.js'%}"></script>
|
||||
<script type="application/javascript">
|
||||
var MakeCredReq = (makeCredReq) => {
|
||||
makeCredReq.publicKey.challenge = base64url.decode(makeCredReq.publicKey.challenge);
|
||||
makeCredReq.publicKey.user.id = base64url.decode(makeCredReq.publicKey.user.id);
|
||||
|
||||
for(let excludeCred of makeCredReq.publicKey.excludeCredentials) {
|
||||
excludeCred.id = base64url.decode(excludeCred.id);
|
||||
}
|
||||
|
||||
return makeCredReq
|
||||
}
|
||||
function begin_reg(){
|
||||
fetch('{% url 'fido2_begin_reg' %}',{}).then(function(response) {
|
||||
if(response.ok)
|
||||
{
|
||||
return response.arrayBuffer();
|
||||
return response.json().then(function (req){
|
||||
return MakeCredReq(req)
|
||||
});
|
||||
}
|
||||
throw new Error('Error getting registration data!');
|
||||
}).then(CBOR.decode).then(function(options) {
|
||||
}).then(function(options) {
|
||||
|
||||
//options.publicKey.attestation="direct"
|
||||
console.log(options)
|
||||
|
||||
@@ -19,11 +33,7 @@
|
||||
}).then(function(attestation) {
|
||||
return fetch('{% url 'fido2_complete_reg' %}', {
|
||||
method: 'POST',
|
||||
headers: {'Content-Type': 'application/cbor'},
|
||||
body: CBOR.encode({
|
||||
"attestationObject": new Uint8Array(attestation.response.attestationObject),
|
||||
"clientDataJSON": new Uint8Array(attestation.response.clientDataJSON),
|
||||
})
|
||||
body: JSON.stringify(publicKeyCredentialToJSON(attestation))
|
||||
});
|
||||
}).then(function(response) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user