Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passkeys #28

Merged
merged 7 commits into from
May 16, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add useBrowserAutofill option
  • Loading branch information
hwhmeikle committed May 15, 2023
commit c80ead560b8a81d328920177a9e99db679c26651
2 changes: 1 addition & 1 deletion src/api/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export type AuthenticationOptsResponse = {
export type AddAuthenticatorRequest = {
token: string;
challengeId: string;
authenticationCredential: RegistrationResponseJSON;
registrationCredential: RegistrationResponseJSON;
};

export type AddAuthenticatorResponse = {
Expand Down
14 changes: 11 additions & 3 deletions src/passkey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class Passkey {

const addAuthenticatorResponse = await this.api.addAuthenticator({
challengeId: optsResponse.challengeId,
authenticationCredential: attReponse,
registrationCredential: attReponse,
token,
});

Expand All @@ -32,11 +32,19 @@ export class Passkey {
}
}

async signIn({userName, token}: {userName?: string; token?: string}) {
async signIn({
userName,
token,
useBrowserAutofill,
}: {
userName?: string;
token?: string;
useBrowserAutofill?: boolean;
}) {
const optsResponse = await this.api.authenticationOptions({userName, token});

try {
const asseReponse = await startAuthentication(optsResponse.options);
const asseReponse = await startAuthentication(optsResponse.options, useBrowserAutofill);

const verifyResponse = await this.api.verify({
challengeId: optsResponse.challengeId,
Expand Down