Skip to content

Commit

Permalink
feat: handling null response from navigator.credentials.create
Browse files Browse the repository at this point in the history
  • Loading branch information
hcho112 committed Oct 12, 2023
1 parent 53ba3f2 commit eca1621
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/biometric-ed25519/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@near-js/biometric-ed25519",
"description": "JavaScript library to handle webauthn and biometric keys",
"version": "0.3.0",
"version": "0.4.0",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"scripts": {
Expand Down
5 changes: 5 additions & 0 deletions packages/biometric-ed25519/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ export const createKey = async (username: string): Promise<KeyPair> => {
setBufferIfUndefined();
return navigator.credentials.create({ publicKey })
.then(async (res) => {
if (!res) {
alert('Passkey process was cancelled, retry to continue account setup.');
throw new Error('Fail to retrieve respnose from navigator.credentials.create');
}

const result = await f2l.attestation({
clientAttestationResponse: res,
origin,
Expand Down

0 comments on commit eca1621

Please sign in to comment.