mirror of
https://github.com/bitwarden/browser
synced 2025-12-19 01:33:33 +00:00
add two factor apis
This commit is contained in:
@@ -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