Skip to content

Commit

Permalink
added comments
Browse files Browse the repository at this point in the history
  • Loading branch information
BurntVal committed May 3, 2024
1 parent 561ce96 commit 719f06d
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,10 @@ export function AddAuthenticatorsForm({
setIsLoading(true);
const encoder = new TextEncoder();

const challenge = Buffer.from(
Buffer.from(abstractAccount?.id).toString("base64"),
);
console.log("account address: ", abstractAccount?.id);
const challenge = Buffer.from(abstractAccount?.id);

console.log(challenge);
console.log("challenge: ", challenge);

const rpUrl =
"https://xion-js-abstraxion-dashboard-git-feat-webauthn-burntfinance.vercel.app/";
Expand All @@ -251,7 +250,7 @@ export function AddAuthenticatorsForm({
user: {
name: abstractAccount.id,
displayName: abstractAccount.id,
id: Buffer.from(abstractAccount?.id), // "user id exceeds 64 bytes"
id: challenge,
},
pubKeyCredParams: [{ type: "public-key", alg: -7 }],
challenge,
Expand All @@ -261,6 +260,8 @@ export function AddAuthenticatorsForm({
},
};

console.log("options: ", options);

// What happens on a failed addAuthenticator tx, do we just delete the registered browser key or just leave it and let them try again?

const publicKeyCredential = await create(options);
Expand All @@ -270,13 +271,13 @@ export function AddAuthenticatorsForm({
}
console.log("publicKeyCredential: ", publicKeyCredential);
const publicKeyCredentialJSON = JSON.stringify(publicKeyCredential);
console.log(publicKeyCredentialJSON);
console.log("publicKeyCredentialJSON: ", publicKeyCredentialJSON);
// Encode Uint8Array as base64
const base64EncodedCredential = Buffer.from(
encoder.encode(publicKeyCredentialJSON),
).toString("base64");

console.log(base64EncodedCredential);
console.log("base64EncodedCredential: ", base64EncodedCredential);

const accountIndex = abstractAccount?.authenticators.nodes.length; // TODO: Be careful here, if indexer returns wrong number this can overwrite accounts

Expand Down

0 comments on commit 719f06d

Please sign in to comment.