|
|
|
@ -46,12 +46,10 @@ export class WebAuthnService {
|
|
|
|
|
switchMap((attOps) => {
|
|
|
|
|
return startRegistration(attOps);
|
|
|
|
|
}),
|
|
|
|
|
switchMap((attResp) => {
|
|
|
|
|
switchMap((credential) => {
|
|
|
|
|
return this.http.post<AuthDeviceDto>(
|
|
|
|
|
`/api/v1/auth/webauthn/verify-attestation`,
|
|
|
|
|
{
|
|
|
|
|
credential: attResp
|
|
|
|
|
}
|
|
|
|
|
{ credential }
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
tap((authDevice) =>
|
|
|
|
@ -65,6 +63,7 @@ export class WebAuthnService {
|
|
|
|
|
|
|
|
|
|
public deregister() {
|
|
|
|
|
const deviceId = this.getDeviceId();
|
|
|
|
|
|
|
|
|
|
return this.http
|
|
|
|
|
.delete<AuthDeviceDto>(`/api/v1/auth-device/${deviceId}`)
|
|
|
|
|
.pipe(
|
|
|
|
@ -82,20 +81,21 @@ export class WebAuthnService {
|
|
|
|
|
|
|
|
|
|
public login() {
|
|
|
|
|
const deviceId = this.getDeviceId();
|
|
|
|
|
|
|
|
|
|
return this.http
|
|
|
|
|
.post<PublicKeyCredentialRequestOptionsJSON>(
|
|
|
|
|
`/api/v1/auth/webauthn/generate-assertion-options`,
|
|
|
|
|
{ deviceId }
|
|
|
|
|
)
|
|
|
|
|
.pipe(
|
|
|
|
|
switchMap((requestOptionsJSON) =>
|
|
|
|
|
startAuthentication(requestOptionsJSON, true)
|
|
|
|
|
),
|
|
|
|
|
switchMap((assertionResponse) => {
|
|
|
|
|
switchMap((requestOptionsJSON) => {
|
|
|
|
|
return startAuthentication(requestOptionsJSON);
|
|
|
|
|
}),
|
|
|
|
|
switchMap((credential) => {
|
|
|
|
|
return this.http.post<{ authToken: string }>(
|
|
|
|
|
`/api/v1/auth/webauthn/verify-assertion`,
|
|
|
|
|
{
|
|
|
|
|
credential: assertionResponse,
|
|
|
|
|
credential,
|
|
|
|
|
deviceId
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|