1
0
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:
Kyle Spearrin
2018-06-26 15:17:14 -04:00
parent 32a636e5a5
commit c3b6baf726
19 changed files with 268 additions and 8 deletions

View File

@@ -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;
}
}

View File

@@ -0,0 +1,7 @@
import { PasswordVerificationRequest } from './passwordVerificationRequest';
import { TwoFactorProviderType } from '../../enums/twoFactorProviderType';
export class TwoFactorProviderRequest extends PasswordVerificationRequest {
type: TwoFactorProviderType;
}

View File

@@ -0,0 +1,6 @@
import { PasswordVerificationRequest } from './passwordVerificationRequest';
export class TwoFactorRecoveryRequest extends PasswordVerificationRequest {
recoveryCode: string;
email: string;
}

View File

@@ -0,0 +1,6 @@
import { PasswordVerificationRequest } from './passwordVerificationRequest';
export class UpdateTwoFactorAuthenticatorRequest extends PasswordVerificationRequest {
token: string;
key: string;
}

View File

@@ -0,0 +1,7 @@
import { PasswordVerificationRequest } from './passwordVerificationRequest';
export class UpdateTwoFactorDuoRequest extends PasswordVerificationRequest {
integrationKey: string;
secretKey: string;
host: string;
}

View File

@@ -0,0 +1,6 @@
import { PasswordVerificationRequest } from './passwordVerificationRequest';
export class UpdateTwoFactorEmailRequest extends PasswordVerificationRequest {
token: string;
email: string;
}

View File

@@ -0,0 +1,5 @@
import { PasswordVerificationRequest } from './passwordVerificationRequest';
export class UpdateTwoFactorU2fRequest extends PasswordVerificationRequest {
deviceResponse: string;
}

View 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;
}

View File

@@ -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;
}
}

View File

@@ -0,0 +1,9 @@
export class TwoFactorAuthenticatorResponse {
enabled: boolean;
key: string;
constructor(response: any) {
this.enabled = response.Enabled;
this.key = response.Key;
}
}

View 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;
}
}

View File

@@ -0,0 +1,9 @@
export class TwoFactorEmailResponse {
enabled: boolean;
email: string;
constructor(response: any) {
this.enabled = response.Enabled;
this.email = response.Email;
}
}

View 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;
}
}

View File

@@ -0,0 +1,7 @@
export class TwoFactorRecoverResponse {
code: string;
constructor(response: any) {
this.code = response.Code;
}
}

View 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;
}
}

View 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;
}
}