mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-30 13:03:53 +01:00
add support for u2f setup apis
This commit is contained in:
parent
c3f67dbe26
commit
4b7962dc8f
@ -42,6 +42,7 @@ import { UpdateProfileRequest } from '../models/request/updateProfileRequest';
|
||||
import { UpdateTwoFactorAuthenticatorRequest } from '../models/request/updateTwoFactorAuthenticatorRequest';
|
||||
import { UpdateTwoFactorDuoRequest } from '../models/request/updateTwoFactorDuoRequest';
|
||||
import { UpdateTwoFactorEmailRequest } from '../models/request/updateTwoFactorEmailRequest';
|
||||
import { UpdateTwoFactorU2fDeleteRequest } from '../models/request/updateTwoFactorU2fDeleteRequest';
|
||||
import { UpdateTwoFactorU2fRequest } from '../models/request/updateTwoFactorU2fRequest';
|
||||
import { UpdateTwoFactorYubioOtpRequest } from '../models/request/updateTwoFactorYubioOtpRequest';
|
||||
import { VerifyBankRequest } from '../models/request/verifyBankRequest';
|
||||
@ -80,7 +81,10 @@ import { TwoFactorDuoResponse } from '../models/response/twoFactorDuoResponse';
|
||||
import { TwoFactorEmailResponse } from '../models/response/twoFactorEmailResponse';
|
||||
import { TwoFactorProviderResponse } from '../models/response/twoFactorProviderResponse';
|
||||
import { TwoFactorRecoverResponse } from '../models/response/twoFactorRescoverResponse';
|
||||
import { TwoFactorU2fResponse } from '../models/response/twoFactorU2fResponse';
|
||||
import {
|
||||
ChallengeResponse,
|
||||
TwoFactorU2fResponse,
|
||||
} from '../models/response/twoFactorU2fResponse';
|
||||
import { TwoFactorYubiKeyResponse } from '../models/response/twoFactorYubiKeyResponse';
|
||||
import { UserKeyResponse } from '../models/response/userKeyResponse';
|
||||
|
||||
@ -195,6 +199,7 @@ export abstract class ApiService {
|
||||
request: PasswordVerificationRequest) => Promise<TwoFactorDuoResponse>;
|
||||
getTwoFactorYubiKey: (request: PasswordVerificationRequest) => Promise<TwoFactorYubiKeyResponse>;
|
||||
getTwoFactorU2f: (request: PasswordVerificationRequest) => Promise<TwoFactorU2fResponse>;
|
||||
getTwoFactorU2fChallenge: (request: PasswordVerificationRequest) => Promise<ChallengeResponse>;
|
||||
getTwoFactorRecover: (request: PasswordVerificationRequest) => Promise<TwoFactorRecoverResponse>;
|
||||
putTwoFactorAuthenticator: (
|
||||
request: UpdateTwoFactorAuthenticatorRequest) => Promise<TwoFactorAuthenticatorResponse>;
|
||||
@ -204,6 +209,7 @@ export abstract class ApiService {
|
||||
request: UpdateTwoFactorDuoRequest) => Promise<TwoFactorDuoResponse>;
|
||||
putTwoFactorYubiKey: (request: UpdateTwoFactorYubioOtpRequest) => Promise<TwoFactorYubiKeyResponse>;
|
||||
putTwoFactorU2f: (request: UpdateTwoFactorU2fRequest) => Promise<TwoFactorU2fResponse>;
|
||||
deleteTwoFactorU2f: (request: UpdateTwoFactorU2fDeleteRequest) => Promise<TwoFactorU2fResponse>;
|
||||
putTwoFactorDisable: (request: TwoFactorProviderRequest) => Promise<TwoFactorProviderResponse>;
|
||||
putTwoFactorOrganizationDisable: (organizationId: string,
|
||||
request: TwoFactorProviderRequest) => Promise<TwoFactorProviderResponse>;
|
||||
|
5
src/models/request/updateTwoFactorU2fDeleteRequest.ts
Normal file
5
src/models/request/updateTwoFactorU2fDeleteRequest.ts
Normal file
@ -0,0 +1,5 @@
|
||||
import { PasswordVerificationRequest } from './passwordVerificationRequest';
|
||||
|
||||
export class UpdateTwoFactorU2fDeleteRequest extends PasswordVerificationRequest {
|
||||
id: number;
|
||||
}
|
@ -2,4 +2,6 @@ import { PasswordVerificationRequest } from './passwordVerificationRequest';
|
||||
|
||||
export class UpdateTwoFactorU2fRequest extends PasswordVerificationRequest {
|
||||
deviceResponse: string;
|
||||
name: string;
|
||||
id: number;
|
||||
}
|
||||
|
@ -1,10 +1,22 @@
|
||||
export class TwoFactorU2fResponse {
|
||||
enabled: boolean;
|
||||
challenge: ChallengeResponse;
|
||||
keys: KeyResponse[];
|
||||
|
||||
constructor(response: any) {
|
||||
this.enabled = response.Enabled;
|
||||
this.challenge = response.Challenge == null ? null : new ChallengeResponse(response.Challenge);
|
||||
this.keys = response.Keys == null ? null : response.Keys.map((k: any) => new KeyResponse(k));
|
||||
}
|
||||
}
|
||||
|
||||
export class KeyResponse {
|
||||
name: string;
|
||||
id: number;
|
||||
compromised: boolean;
|
||||
|
||||
constructor(response: any) {
|
||||
this.name = response.Name;
|
||||
this.id = response.Id;
|
||||
this.compromised = response.Compromised;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,6 +48,7 @@ import { UpdateProfileRequest } from '../models/request/updateProfileRequest';
|
||||
import { UpdateTwoFactorAuthenticatorRequest } from '../models/request/updateTwoFactorAuthenticatorRequest';
|
||||
import { UpdateTwoFactorDuoRequest } from '../models/request/updateTwoFactorDuoRequest';
|
||||
import { UpdateTwoFactorEmailRequest } from '../models/request/updateTwoFactorEmailRequest';
|
||||
import { UpdateTwoFactorU2fDeleteRequest } from '../models/request/updateTwoFactorU2fDeleteRequest';
|
||||
import { UpdateTwoFactorU2fRequest } from '../models/request/updateTwoFactorU2fRequest';
|
||||
import { UpdateTwoFactorYubioOtpRequest } from '../models/request/updateTwoFactorYubioOtpRequest';
|
||||
import { VerifyBankRequest } from '../models/request/verifyBankRequest';
|
||||
@ -87,7 +88,10 @@ import { TwoFactorDuoResponse } from '../models/response/twoFactorDuoResponse';
|
||||
import { TwoFactorEmailResponse } from '../models/response/twoFactorEmailResponse';
|
||||
import { TwoFactorProviderResponse } from '../models/response/twoFactorProviderResponse';
|
||||
import { TwoFactorRecoverResponse } from '../models/response/twoFactorRescoverResponse';
|
||||
import { TwoFactorU2fResponse } from '../models/response/twoFactorU2fResponse';
|
||||
import {
|
||||
ChallengeResponse,
|
||||
TwoFactorU2fResponse,
|
||||
} from '../models/response/twoFactorU2fResponse';
|
||||
import { TwoFactorYubiKeyResponse } from '../models/response/twoFactorYubiKeyResponse';
|
||||
import { UserKeyResponse } from '../models/response/userKeyResponse';
|
||||
|
||||
@ -618,6 +622,11 @@ export class ApiService implements ApiServiceAbstraction {
|
||||
return new TwoFactorU2fResponse(r);
|
||||
}
|
||||
|
||||
async getTwoFactorU2fChallenge(request: PasswordVerificationRequest): Promise<ChallengeResponse> {
|
||||
const r = await this.send('POST', '/two-factor/get-u2f-challenge', request, true, true);
|
||||
return new ChallengeResponse(r);
|
||||
}
|
||||
|
||||
async getTwoFactorRecover(request: PasswordVerificationRequest): Promise<TwoFactorRecoverResponse> {
|
||||
const r = await this.send('POST', '/two-factor/get-recover', request, true, true);
|
||||
return new TwoFactorRecoverResponse(r);
|
||||
@ -655,6 +664,11 @@ export class ApiService implements ApiServiceAbstraction {
|
||||
return new TwoFactorU2fResponse(r);
|
||||
}
|
||||
|
||||
async deleteTwoFactorU2f(request: UpdateTwoFactorU2fDeleteRequest): Promise<TwoFactorU2fResponse> {
|
||||
const r = await this.send('DELETE', '/two-factor/u2f', request, true, true);
|
||||
return new TwoFactorU2fResponse(r);
|
||||
}
|
||||
|
||||
async putTwoFactorDisable(request: TwoFactorProviderRequest): Promise<TwoFactorProviderResponse> {
|
||||
const r = await this.send('PUT', '/two-factor/disable', request, true, true);
|
||||
return new TwoFactorProviderResponse(r);
|
||||
|
Loading…
Reference in New Issue
Block a user