-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Autostart the registration/authentication
The gesture (buttonpress) is no longer required to start the WebAuthn session with the browser. This is a revert of the original behavior. But the button remained on the page for users of an old unsupportive browser. See https://www.pivotaltracker.com/story/show/184695105
- Loading branch information
Showing
5 changed files
with
67 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { Observable } from 'rxjs'; | ||
import { reloadPage } from '../function'; | ||
import { PublicKeyResponseValidator } from '../function/http'; | ||
import { ApplicationAction, SerializedPublicKeyCredentialRequestOptions } from '../model'; | ||
import { authenticationObservable } from './index'; | ||
import { retryWith } from '../operator'; | ||
|
||
export const startAuthentication = (dispatch: (action: ApplicationAction) => void, publicKeyOptions: SerializedPublicKeyCredentialRequestOptions, send: PublicKeyResponseValidator, whenClicked: Observable<unknown>) => { | ||
const time = () => (new Date()).toISOString(); | ||
return authenticationObservable( | ||
send, | ||
publicKeyOptions, | ||
(options) => navigator.credentials.get(options), | ||
time, | ||
) | ||
.pipe(retryWith((type) => (value) => dispatch({ type, value, timestamp: time() }), whenClicked)) | ||
.subscribe({ | ||
next: dispatch, | ||
complete: reloadPage, | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { Observable } from 'rxjs'; | ||
import { reloadPage } from '../function'; | ||
import { PublicKeyResponseValidator } from '../function/http'; | ||
import { ApplicationAction, SerializedPublicKeyCredentialCreationOptions } from '../model'; | ||
import { registrationObservable } from './index'; | ||
import { retryWith } from '../operator'; | ||
|
||
export const startRegistration = (dispatch: (action: ApplicationAction) => void, publicKeyOptions: SerializedPublicKeyCredentialCreationOptions, send: PublicKeyResponseValidator, whenClicked: Observable<unknown>) => { | ||
const time = () => (new Date()).toISOString(); | ||
return registrationObservable( | ||
send, | ||
publicKeyOptions, | ||
(options) => navigator.credentials.create(options), | ||
time, | ||
) | ||
.pipe(retryWith((type) => (value) => dispatch({ type, value, timestamp: time() }), whenClicked)) | ||
.subscribe({ | ||
next: dispatch, | ||
complete: reloadPage, | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters