mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 16:53:34 +00:00
add two factor apis
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
export class TwoFactorEmailRequest {
|
||||
import { PasswordVerificationRequest } from './passwordVerificationRequest';
|
||||
|
||||
export class TwoFactorEmailRequest extends PasswordVerificationRequest {
|
||||
email: string;
|
||||
masterPasswordHash: string;
|
||||
|
||||
constructor(email: string, masterPasswordHash: string) {
|
||||
this.email = email;
|
||||
super();
|
||||
this.masterPasswordHash = masterPasswordHash;
|
||||
this.email = email;
|
||||
}
|
||||
}
|
||||
|
||||
7
src/models/request/twoFactorProviderRequest.ts
Normal file
7
src/models/request/twoFactorProviderRequest.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { PasswordVerificationRequest } from './passwordVerificationRequest';
|
||||
|
||||
import { TwoFactorProviderType } from '../../enums/twoFactorProviderType';
|
||||
|
||||
export class TwoFactorProviderRequest extends PasswordVerificationRequest {
|
||||
type: TwoFactorProviderType;
|
||||
}
|
||||
6
src/models/request/twoFactorRecoveryRequest.ts
Normal file
6
src/models/request/twoFactorRecoveryRequest.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { PasswordVerificationRequest } from './passwordVerificationRequest';
|
||||
|
||||
export class TwoFactorRecoveryRequest extends PasswordVerificationRequest {
|
||||
recoveryCode: string;
|
||||
email: string;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import { PasswordVerificationRequest } from './passwordVerificationRequest';
|
||||
|
||||
export class UpdateTwoFactorAuthenticatorRequest extends PasswordVerificationRequest {
|
||||
token: string;
|
||||
key: string;
|
||||
}
|
||||
7
src/models/request/updateTwoFactorDuoRequest.ts
Normal file
7
src/models/request/updateTwoFactorDuoRequest.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { PasswordVerificationRequest } from './passwordVerificationRequest';
|
||||
|
||||
export class UpdateTwoFactorDuoRequest extends PasswordVerificationRequest {
|
||||
integrationKey: string;
|
||||
secretKey: string;
|
||||
host: string;
|
||||
}
|
||||
6
src/models/request/updateTwoFactorEmailRequest.ts
Normal file
6
src/models/request/updateTwoFactorEmailRequest.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { PasswordVerificationRequest } from './passwordVerificationRequest';
|
||||
|
||||
export class UpdateTwoFactorEmailRequest extends PasswordVerificationRequest {
|
||||
token: string;
|
||||
email: string;
|
||||
}
|
||||
5
src/models/request/updateTwoFactorU2fRequest.ts
Normal file
5
src/models/request/updateTwoFactorU2fRequest.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import { PasswordVerificationRequest } from './passwordVerificationRequest';
|
||||
|
||||
export class UpdateTwoFactorU2fRequest extends PasswordVerificationRequest {
|
||||
deviceResponse: string;
|
||||
}
|
||||
10
src/models/request/updateTwoFactorYubioOtpRequest.ts
Normal file
10
src/models/request/updateTwoFactorYubioOtpRequest.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { PasswordVerificationRequest } from './passwordVerificationRequest';
|
||||
|
||||
export class UpdateTwoFactorYubioOtpRequest extends PasswordVerificationRequest {
|
||||
key1: string;
|
||||
key2: string;
|
||||
key3: string;
|
||||
key4: string;
|
||||
key5: string;
|
||||
nfc: boolean;
|
||||
}
|
||||
@@ -1,7 +1,9 @@
|
||||
export class ListResponse {
|
||||
data: any;
|
||||
export class ListResponse<T> {
|
||||
data: T[];
|
||||
continuationToken: string;
|
||||
|
||||
constructor(data: any) {
|
||||
this.data = data;
|
||||
constructor(response: any, t: new (dataResponse: any) => T) {
|
||||
this.data = response.Data.map((dr) => new t(dr));
|
||||
this.continuationToken = response.ContinuationToken;
|
||||
}
|
||||
}
|
||||
|
||||
9
src/models/response/twoFactorAuthenticatorResponse.ts
Normal file
9
src/models/response/twoFactorAuthenticatorResponse.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
export class TwoFactorAuthenticatorResponse {
|
||||
enabled: boolean;
|
||||
key: string;
|
||||
|
||||
constructor(response: any) {
|
||||
this.enabled = response.Enabled;
|
||||
this.key = response.Key;
|
||||
}
|
||||
}
|
||||
13
src/models/response/twoFactorDuoResponse.ts
Normal file
13
src/models/response/twoFactorDuoResponse.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
export class TwoFactorDuoResponse {
|
||||
enabled: boolean;
|
||||
host: string;
|
||||
secretKey: string;
|
||||
integrationKey: string;
|
||||
|
||||
constructor(response: any) {
|
||||
this.enabled = response.Enabled;
|
||||
this.host = response.Host;
|
||||
this.secretKey = response.SecretKey;
|
||||
this.integrationKey = response.IntegrationKey;
|
||||
}
|
||||
}
|
||||
9
src/models/response/twoFactorEmailResponse.ts
Normal file
9
src/models/response/twoFactorEmailResponse.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
export class TwoFactorEmailResponse {
|
||||
enabled: boolean;
|
||||
email: string;
|
||||
|
||||
constructor(response: any) {
|
||||
this.enabled = response.Enabled;
|
||||
this.email = response.Email;
|
||||
}
|
||||
}
|
||||
11
src/models/response/twoFactorProviderResponse.ts
Normal file
11
src/models/response/twoFactorProviderResponse.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { TwoFactorProviderType } from '../../enums/twoFactorProviderType';
|
||||
|
||||
export class TwoFactorProviderResponse {
|
||||
enabled: boolean;
|
||||
type: TwoFactorProviderType;
|
||||
|
||||
constructor(response: any) {
|
||||
this.enabled = response.Enabled;
|
||||
this.type = response.Type;
|
||||
}
|
||||
}
|
||||
7
src/models/response/twoFactorRescoverResponse.ts
Normal file
7
src/models/response/twoFactorRescoverResponse.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
export class TwoFactorRecoverResponse {
|
||||
code: string;
|
||||
|
||||
constructor(response: any) {
|
||||
this.code = response.Code;
|
||||
}
|
||||
}
|
||||
23
src/models/response/twoFactorU2fResponse.ts
Normal file
23
src/models/response/twoFactorU2fResponse.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
export class TwoFactorU2fResponse {
|
||||
enabled: boolean;
|
||||
challenge: Challenge;
|
||||
|
||||
constructor(response: any) {
|
||||
this.enabled = response.Enabled;
|
||||
this.challenge = new Challenge(response.Challenge);
|
||||
}
|
||||
}
|
||||
|
||||
class Challenge {
|
||||
userId: string;
|
||||
appId: string;
|
||||
challenge: string;
|
||||
version: string;
|
||||
|
||||
constructor(response: any) {
|
||||
this.userId = response.UserId;
|
||||
this.appId = response.AppId;
|
||||
this.challenge = response.Challenge;
|
||||
this.version = response.Version;
|
||||
}
|
||||
}
|
||||
19
src/models/response/twoFactorYubiKeyResponse.ts
Normal file
19
src/models/response/twoFactorYubiKeyResponse.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
export class TwoFactorYubiKeyResponse {
|
||||
enabled: boolean;
|
||||
key1: string;
|
||||
key2: string;
|
||||
key3: string;
|
||||
key4: string;
|
||||
key5: string;
|
||||
nfc: boolean;
|
||||
|
||||
constructor(response: any) {
|
||||
this.enabled = response.Enabled;
|
||||
this.key1 = response.Key1;
|
||||
this.key2 = response.Key2;
|
||||
this.key3 = response.Key3;
|
||||
this.key4 = response.Key4;
|
||||
this.key5 = response.Key5;
|
||||
this.nfc = response.Nfc;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user