mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-23 11:56:00 +01:00
convert request/response models to jslib
This commit is contained in:
parent
5de4aad525
commit
a78b8ec79c
@ -1,4 +1,4 @@
|
|||||||
import { AttachmentResponse } from '../response/attachmentResponse';
|
import { Response } from '@bitwarden/jslib';
|
||||||
|
|
||||||
class AttachmentData {
|
class AttachmentData {
|
||||||
id: string;
|
id: string;
|
||||||
@ -7,7 +7,7 @@ class AttachmentData {
|
|||||||
size: number;
|
size: number;
|
||||||
sizeName: string;
|
sizeName: string;
|
||||||
|
|
||||||
constructor(response: AttachmentResponse) {
|
constructor(response: Response.Attachment) {
|
||||||
this.id = response.id;
|
this.id = response.id;
|
||||||
this.url = response.url;
|
this.url = response.url;
|
||||||
this.fileName = response.fileName;
|
this.fileName = response.fileName;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Enums } from '@bitwarden/jslib';
|
import { Data, Enums, Response } from '@bitwarden/jslib';
|
||||||
|
|
||||||
import { AttachmentData } from './attachmentData';
|
import { AttachmentData } from './attachmentData';
|
||||||
import { CardData } from './cardData';
|
import { CardData } from './cardData';
|
||||||
@ -7,8 +7,6 @@ import { IdentityData } from './identityData';
|
|||||||
import { LoginData } from './loginData';
|
import { LoginData } from './loginData';
|
||||||
import { SecureNoteData } from './secureNoteData';
|
import { SecureNoteData } from './secureNoteData';
|
||||||
|
|
||||||
import { CipherResponse } from '../response/cipherResponse';
|
|
||||||
|
|
||||||
class CipherData {
|
class CipherData {
|
||||||
id: string;
|
id: string;
|
||||||
organizationId: string;
|
organizationId: string;
|
||||||
@ -30,7 +28,7 @@ class CipherData {
|
|||||||
attachments?: AttachmentData[];
|
attachments?: AttachmentData[];
|
||||||
collectionIds?: string[];
|
collectionIds?: string[];
|
||||||
|
|
||||||
constructor(response: CipherResponse, userId: string, collectionIds?: string[]) {
|
constructor(response: Response.Cipher, userId: string, collectionIds?: string[]) {
|
||||||
this.id = response.id;
|
this.id = response.id;
|
||||||
this.organizationId = response.organizationId;
|
this.organizationId = response.organizationId;
|
||||||
this.folderId = response.folderId;
|
this.folderId = response.folderId;
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import { CollectionResponse } from '../response/collectionResponse';
|
import { Response } from '@bitwarden/jslib';
|
||||||
|
|
||||||
class CollectionData {
|
class CollectionData {
|
||||||
id: string;
|
id: string;
|
||||||
organizationId: string;
|
organizationId: string;
|
||||||
name: string;
|
name: string;
|
||||||
|
|
||||||
constructor(response: CollectionResponse) {
|
constructor(response: Response.Collection) {
|
||||||
this.id = response.id;
|
this.id = response.id;
|
||||||
this.organizationId = response.organizationId;
|
this.organizationId = response.organizationId;
|
||||||
this.name = response.name;
|
this.name = response.name;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { FolderResponse } from '../response/folderResponse';
|
import { Response } from '@bitwarden/jslib';
|
||||||
|
|
||||||
class FolderData {
|
class FolderData {
|
||||||
id: string;
|
id: string;
|
||||||
@ -6,7 +6,7 @@ class FolderData {
|
|||||||
name: string;
|
name: string;
|
||||||
revisionDate: string;
|
revisionDate: string;
|
||||||
|
|
||||||
constructor(response: FolderResponse, userId: string) {
|
constructor(response: Response.Folder, userId: string) {
|
||||||
this.userId = userId;
|
this.userId = userId;
|
||||||
this.name = response.name;
|
this.name = response.name;
|
||||||
this.id = response.id;
|
this.id = response.id;
|
||||||
|
@ -1,34 +0,0 @@
|
|||||||
import { FolderData } from '../data/folderData';
|
|
||||||
|
|
||||||
import { CipherString } from './cipherString';
|
|
||||||
import Domain from './domain';
|
|
||||||
|
|
||||||
class Folder extends Domain {
|
|
||||||
id: string;
|
|
||||||
name: CipherString;
|
|
||||||
|
|
||||||
constructor(obj?: FolderData, alreadyEncrypted: boolean = false) {
|
|
||||||
super();
|
|
||||||
if (obj == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.buildDomainModel(this, obj, {
|
|
||||||
id: null,
|
|
||||||
name: null,
|
|
||||||
}, alreadyEncrypted, ['id']);
|
|
||||||
}
|
|
||||||
|
|
||||||
decrypt(): Promise<any> {
|
|
||||||
const model = {
|
|
||||||
id: this.id,
|
|
||||||
};
|
|
||||||
|
|
||||||
return this.decryptObj(model, {
|
|
||||||
name: null,
|
|
||||||
}, null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export { Folder };
|
|
||||||
(window as any).Folder = Folder;
|
|
@ -1,89 +0,0 @@
|
|||||||
import { Enums } from '@bitwarden/jslib';
|
|
||||||
|
|
||||||
class CipherRequest {
|
|
||||||
type: Enums.CipherType;
|
|
||||||
folderId: string;
|
|
||||||
organizationId: string;
|
|
||||||
name: string;
|
|
||||||
notes: string;
|
|
||||||
favorite: boolean;
|
|
||||||
login: any;
|
|
||||||
secureNote: any;
|
|
||||||
card: any;
|
|
||||||
identity: any;
|
|
||||||
fields: any[];
|
|
||||||
|
|
||||||
constructor(cipher: any) {
|
|
||||||
this.type = cipher.type;
|
|
||||||
this.folderId = cipher.folderId;
|
|
||||||
this.organizationId = cipher.organizationId;
|
|
||||||
this.name = cipher.name ? cipher.name.encryptedString : null;
|
|
||||||
this.notes = cipher.notes ? cipher.notes.encryptedString : null;
|
|
||||||
this.favorite = cipher.favorite;
|
|
||||||
|
|
||||||
switch (this.type) {
|
|
||||||
case Enums.CipherType.Login:
|
|
||||||
this.login = {
|
|
||||||
uri: cipher.login.uri ? cipher.login.uri.encryptedString : null,
|
|
||||||
username: cipher.login.username ? cipher.login.username.encryptedString : null,
|
|
||||||
password: cipher.login.password ? cipher.login.password.encryptedString : null,
|
|
||||||
totp: cipher.login.totp ? cipher.login.totp.encryptedString : null,
|
|
||||||
};
|
|
||||||
break;
|
|
||||||
case Enums.CipherType.SecureNote:
|
|
||||||
this.secureNote = {
|
|
||||||
type: cipher.secureNote.type,
|
|
||||||
};
|
|
||||||
break;
|
|
||||||
case Enums.CipherType.Card:
|
|
||||||
this.card = {
|
|
||||||
cardholderName: cipher.card.cardholderName ? cipher.card.cardholderName.encryptedString : null,
|
|
||||||
brand: cipher.card.brand ? cipher.card.brand.encryptedString : null,
|
|
||||||
number: cipher.card.number ? cipher.card.number.encryptedString : null,
|
|
||||||
expMonth: cipher.card.expMonth ? cipher.card.expMonth.encryptedString : null,
|
|
||||||
expYear: cipher.card.expYear ? cipher.card.expYear.encryptedString : null,
|
|
||||||
code: cipher.card.code ? cipher.card.code.encryptedString : null,
|
|
||||||
};
|
|
||||||
break;
|
|
||||||
case Enums.CipherType.Identity:
|
|
||||||
this.identity = {
|
|
||||||
title: cipher.identity.title ? cipher.identity.title.encryptedString : null,
|
|
||||||
firstName: cipher.identity.firstName ? cipher.identity.firstName.encryptedString : null,
|
|
||||||
middleName: cipher.identity.middleName ? cipher.identity.middleName.encryptedString : null,
|
|
||||||
lastName: cipher.identity.lastName ? cipher.identity.lastName.encryptedString : null,
|
|
||||||
address1: cipher.identity.address1 ? cipher.identity.address1.encryptedString : null,
|
|
||||||
address2: cipher.identity.address2 ? cipher.identity.address2.encryptedString : null,
|
|
||||||
address3: cipher.identity.address3 ? cipher.identity.address3.encryptedString : null,
|
|
||||||
city: cipher.identity.city ? cipher.identity.city.encryptedString : null,
|
|
||||||
state: cipher.identity.state ? cipher.identity.state.encryptedString : null,
|
|
||||||
postalCode: cipher.identity.postalCode ? cipher.identity.postalCode.encryptedString : null,
|
|
||||||
country: cipher.identity.country ? cipher.identity.country.encryptedString : null,
|
|
||||||
company: cipher.identity.company ? cipher.identity.company.encryptedString : null,
|
|
||||||
email: cipher.identity.email ? cipher.identity.email.encryptedString : null,
|
|
||||||
phone: cipher.identity.phone ? cipher.identity.phone.encryptedString : null,
|
|
||||||
ssn: cipher.identity.ssn ? cipher.identity.ssn.encryptedString : null,
|
|
||||||
username: cipher.identity.username ? cipher.identity.username.encryptedString : null,
|
|
||||||
passportNumber: cipher.identity.passportNumber ?
|
|
||||||
cipher.identity.passportNumber.encryptedString : null,
|
|
||||||
licenseNumber: cipher.identity.licenseNumber ? cipher.identity.licenseNumber.encryptedString : null,
|
|
||||||
};
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cipher.fields) {
|
|
||||||
this.fields = [];
|
|
||||||
cipher.fields.forEach((field: any) => {
|
|
||||||
this.fields.push({
|
|
||||||
type: field.type,
|
|
||||||
name: field.name ? field.name.encryptedString : null,
|
|
||||||
value: field.value ? field.value.encryptedString : null,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export { CipherRequest };
|
|
||||||
(window as any).CipherRequest = CipherRequest;
|
|
@ -1,18 +0,0 @@
|
|||||||
import { Abstractions, Enums } from '@bitwarden/jslib';
|
|
||||||
|
|
||||||
class DeviceRequest {
|
|
||||||
type: Enums.DeviceType;
|
|
||||||
name: string;
|
|
||||||
identifier: string;
|
|
||||||
pushToken?: string;
|
|
||||||
|
|
||||||
constructor(appId: string, platformUtilsService: Abstractions.PlatformUtilsService) {
|
|
||||||
this.type = platformUtilsService.getDevice();
|
|
||||||
this.name = platformUtilsService.getDeviceString();
|
|
||||||
this.identifier = appId;
|
|
||||||
this.pushToken = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export { DeviceRequest };
|
|
||||||
(window as any).DeviceRequest = DeviceRequest;
|
|
@ -1,10 +0,0 @@
|
|||||||
class DeviceTokenRequest {
|
|
||||||
pushToken: string;
|
|
||||||
|
|
||||||
constructor() {
|
|
||||||
this.pushToken = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export { DeviceTokenRequest };
|
|
||||||
(window as any).DeviceTokenRequest = DeviceTokenRequest;
|
|
@ -1,12 +0,0 @@
|
|||||||
import { Folder } from '../domain/folder';
|
|
||||||
|
|
||||||
class FolderRequest {
|
|
||||||
name: string;
|
|
||||||
|
|
||||||
constructor(folder: Folder) {
|
|
||||||
this.name = folder.name ? folder.name.encryptedString : null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export { FolderRequest };
|
|
||||||
(window as any).FolderRequest = FolderRequest;
|
|
@ -1,10 +0,0 @@
|
|||||||
class PasswordHintRequest {
|
|
||||||
email: string;
|
|
||||||
|
|
||||||
constructor(email: string) {
|
|
||||||
this.email = email;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export { PasswordHintRequest };
|
|
||||||
(window as any).PasswordHintRequest = PasswordHintRequest;
|
|
@ -1,18 +0,0 @@
|
|||||||
class RegisterRequest {
|
|
||||||
name: string;
|
|
||||||
email: string;
|
|
||||||
masterPasswordHash: string;
|
|
||||||
masterPasswordHint: string;
|
|
||||||
key: string;
|
|
||||||
|
|
||||||
constructor(email: string, masterPasswordHash: string, masterPasswordHint: string, key: string) {
|
|
||||||
this.name = null;
|
|
||||||
this.email = email;
|
|
||||||
this.masterPasswordHash = masterPasswordHash;
|
|
||||||
this.masterPasswordHint = masterPasswordHint ? masterPasswordHint : null;
|
|
||||||
this.key = key;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export { RegisterRequest };
|
|
||||||
(window as any).RegisterRequest = RegisterRequest;
|
|
@ -1,49 +0,0 @@
|
|||||||
import { DeviceRequest } from './deviceRequest';
|
|
||||||
|
|
||||||
class TokenRequest {
|
|
||||||
email: string;
|
|
||||||
masterPasswordHash: string;
|
|
||||||
token: string;
|
|
||||||
provider: number;
|
|
||||||
remember: boolean;
|
|
||||||
device?: DeviceRequest;
|
|
||||||
|
|
||||||
constructor(email: string, masterPasswordHash: string, provider: number,
|
|
||||||
token: string, remember: boolean, device?: DeviceRequest) {
|
|
||||||
this.email = email;
|
|
||||||
this.masterPasswordHash = masterPasswordHash;
|
|
||||||
this.token = token;
|
|
||||||
this.provider = provider;
|
|
||||||
this.remember = remember;
|
|
||||||
this.device = device != null ? device : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
toIdentityToken() {
|
|
||||||
const obj: any = {
|
|
||||||
grant_type: 'password',
|
|
||||||
username: this.email,
|
|
||||||
password: this.masterPasswordHash,
|
|
||||||
scope: 'api offline_access',
|
|
||||||
client_id: 'browser',
|
|
||||||
};
|
|
||||||
|
|
||||||
if (this.device) {
|
|
||||||
obj.deviceType = this.device.type;
|
|
||||||
obj.deviceIdentifier = this.device.identifier;
|
|
||||||
obj.deviceName = this.device.name;
|
|
||||||
// no push tokens for browser apps yet
|
|
||||||
// obj.devicePushToken = this.device.pushToken;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.token && this.provider !== null && (typeof this.provider !== 'undefined')) {
|
|
||||||
obj.twoFactorToken = this.token;
|
|
||||||
obj.twoFactorProvider = this.provider;
|
|
||||||
obj.twoFactorRemember = this.remember ? '1' : '0';
|
|
||||||
}
|
|
||||||
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export { TokenRequest };
|
|
||||||
(window as any).TokenRequest = TokenRequest;
|
|
@ -1,12 +0,0 @@
|
|||||||
class TwoFactorEmailRequest {
|
|
||||||
email: string;
|
|
||||||
masterPasswordHash: string;
|
|
||||||
|
|
||||||
constructor(email: string, masterPasswordHash: string) {
|
|
||||||
this.email = email;
|
|
||||||
this.masterPasswordHash = masterPasswordHash;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export { TwoFactorEmailRequest };
|
|
||||||
(window as any).TwoFactorEmailRequest = TwoFactorEmailRequest;
|
|
@ -1,18 +0,0 @@
|
|||||||
class AttachmentResponse {
|
|
||||||
id: string;
|
|
||||||
url: string;
|
|
||||||
fileName: string;
|
|
||||||
size: number;
|
|
||||||
sizeName: string;
|
|
||||||
|
|
||||||
constructor(response: any) {
|
|
||||||
this.id = response.Id;
|
|
||||||
this.url = response.Url;
|
|
||||||
this.fileName = response.FileName;
|
|
||||||
this.size = response.Size;
|
|
||||||
this.sizeName = response.SizeName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export { AttachmentResponse };
|
|
||||||
(window as any).AttachmentResponse = AttachmentResponse;
|
|
@ -1,44 +0,0 @@
|
|||||||
import { AttachmentResponse } from './attachmentResponse';
|
|
||||||
|
|
||||||
class CipherResponse {
|
|
||||||
id: string;
|
|
||||||
organizationId: string;
|
|
||||||
folderId: string;
|
|
||||||
type: number;
|
|
||||||
favorite: boolean;
|
|
||||||
edit: boolean;
|
|
||||||
organizationUseTotp: boolean;
|
|
||||||
data: any;
|
|
||||||
revisionDate: string;
|
|
||||||
attachments: AttachmentResponse[];
|
|
||||||
collectionIds: string[];
|
|
||||||
|
|
||||||
constructor(response: any) {
|
|
||||||
this.id = response.Id;
|
|
||||||
this.organizationId = response.OrganizationId;
|
|
||||||
this.folderId = response.FolderId;
|
|
||||||
this.type = response.Type;
|
|
||||||
this.favorite = response.Favorite;
|
|
||||||
this.edit = response.Edit;
|
|
||||||
this.organizationUseTotp = response.OrganizationUseTotp;
|
|
||||||
this.data = response.Data;
|
|
||||||
this.revisionDate = response.RevisionDate;
|
|
||||||
|
|
||||||
if (response.Attachments != null) {
|
|
||||||
this.attachments = [];
|
|
||||||
response.Attachments.forEach((attachment: any) => {
|
|
||||||
this.attachments.push(new AttachmentResponse(attachment));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (response.CollectionIds) {
|
|
||||||
this.collectionIds = [];
|
|
||||||
response.CollectionIds.forEach((id: string) => {
|
|
||||||
this.collectionIds.push(id);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export { CipherResponse };
|
|
||||||
(window as any).CipherResponse = CipherResponse;
|
|
@ -1,14 +0,0 @@
|
|||||||
class CollectionResponse {
|
|
||||||
id: string;
|
|
||||||
organizationId: string;
|
|
||||||
name: string;
|
|
||||||
|
|
||||||
constructor(response: any) {
|
|
||||||
this.id = response.Id;
|
|
||||||
this.organizationId = response.OrganizationId;
|
|
||||||
this.name = response.Name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export { CollectionResponse };
|
|
||||||
(window as any).CollectionResponse = CollectionResponse;
|
|
@ -1,20 +0,0 @@
|
|||||||
import { Enums } from '@bitwarden/jslib';
|
|
||||||
|
|
||||||
class DeviceResponse {
|
|
||||||
id: string;
|
|
||||||
name: number;
|
|
||||||
identifier: string;
|
|
||||||
type: Enums.DeviceType;
|
|
||||||
creationDate: string;
|
|
||||||
|
|
||||||
constructor(response: any) {
|
|
||||||
this.id = response.Id;
|
|
||||||
this.name = response.Name;
|
|
||||||
this.identifier = response.Identifier;
|
|
||||||
this.type = response.Type;
|
|
||||||
this.creationDate = response.CreationDate;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export { DeviceResponse };
|
|
||||||
(window as any).DeviceResponse = DeviceResponse;
|
|
@ -1,20 +0,0 @@
|
|||||||
import { GlobalDomainResponse } from './globalDomainResponse';
|
|
||||||
|
|
||||||
class DomainsResponse {
|
|
||||||
equivalentDomains: string[][];
|
|
||||||
globalEquivalentDomains: GlobalDomainResponse[] = [];
|
|
||||||
|
|
||||||
constructor(response: any) {
|
|
||||||
this.equivalentDomains = response.EquivalentDomains;
|
|
||||||
|
|
||||||
this.globalEquivalentDomains = [];
|
|
||||||
if (response.GlobalEquivalentDomains) {
|
|
||||||
response.GlobalEquivalentDomains.forEach((domain: any) => {
|
|
||||||
this.globalEquivalentDomains.push(new GlobalDomainResponse(domain));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export { DomainsResponse };
|
|
||||||
(window as any).DomainsResponse = DomainsResponse;
|
|
@ -1,37 +0,0 @@
|
|||||||
class ErrorResponse {
|
|
||||||
message: string;
|
|
||||||
validationErrors: { [key: string]: string[]; };
|
|
||||||
statusCode: number;
|
|
||||||
|
|
||||||
constructor(response: any, status: number, identityResponse?: boolean) {
|
|
||||||
let errorModel = null;
|
|
||||||
if (identityResponse && response && response.ErrorModel) {
|
|
||||||
errorModel = response.ErrorModel;
|
|
||||||
} else if (response) {
|
|
||||||
errorModel = response;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (errorModel) {
|
|
||||||
this.message = errorModel.Message;
|
|
||||||
this.validationErrors = errorModel.ValidationErrors;
|
|
||||||
}
|
|
||||||
this.statusCode = status;
|
|
||||||
}
|
|
||||||
|
|
||||||
getSingleMessage(): string {
|
|
||||||
if (this.validationErrors) {
|
|
||||||
for (const key in this.validationErrors) {
|
|
||||||
if (!this.validationErrors.hasOwnProperty(key)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (this.validationErrors[key].length) {
|
|
||||||
return this.validationErrors[key][0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return this.message;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export { ErrorResponse };
|
|
||||||
(window as any).ErrorResponse = ErrorResponse;
|
|
@ -1,14 +0,0 @@
|
|||||||
class FolderResponse {
|
|
||||||
id: string;
|
|
||||||
name: string;
|
|
||||||
revisionDate: string;
|
|
||||||
|
|
||||||
constructor(response: any) {
|
|
||||||
this.id = response.Id;
|
|
||||||
this.name = response.Name;
|
|
||||||
this.revisionDate = response.RevisionDate;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export { FolderResponse };
|
|
||||||
(window as any).FolderResponse = FolderResponse;
|
|
@ -1,14 +0,0 @@
|
|||||||
class GlobalDomainResponse {
|
|
||||||
type: number;
|
|
||||||
domains: string[];
|
|
||||||
excluded: number[];
|
|
||||||
|
|
||||||
constructor(response: any) {
|
|
||||||
this.type = response.Type;
|
|
||||||
this.domains = response.Domains;
|
|
||||||
this.excluded = response.Excluded;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export { GlobalDomainResponse };
|
|
||||||
(window as any).GlobalDomainResponse = GlobalDomainResponse;
|
|
@ -1,24 +0,0 @@
|
|||||||
class IdentityTokenResponse {
|
|
||||||
accessToken: string;
|
|
||||||
expiresIn: number;
|
|
||||||
refreshToken: string;
|
|
||||||
tokenType: string;
|
|
||||||
|
|
||||||
privateKey: string;
|
|
||||||
key: string;
|
|
||||||
twoFactorToken: string;
|
|
||||||
|
|
||||||
constructor(response: any) {
|
|
||||||
this.accessToken = response.access_token;
|
|
||||||
this.expiresIn = response.expires_in;
|
|
||||||
this.refreshToken = response.refresh_token;
|
|
||||||
this.tokenType = response.token_type;
|
|
||||||
|
|
||||||
this.privateKey = response.PrivateKey;
|
|
||||||
this.key = response.Key;
|
|
||||||
this.twoFactorToken = response.TwoFactorToken;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export { IdentityTokenResponse };
|
|
||||||
(window as any).IdentityTokenResponse = IdentityTokenResponse;
|
|
@ -1,12 +0,0 @@
|
|||||||
class KeysResponse {
|
|
||||||
privateKey: string;
|
|
||||||
publicKey: string;
|
|
||||||
|
|
||||||
constructor(response: any) {
|
|
||||||
this.privateKey = response.PrivateKey;
|
|
||||||
this.publicKey = response.PublicKey;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export { KeysResponse };
|
|
||||||
(window as any).KeysResponse = KeysResponse;
|
|
@ -1,10 +0,0 @@
|
|||||||
class ListResponse {
|
|
||||||
data: any;
|
|
||||||
|
|
||||||
constructor(data: any) {
|
|
||||||
this.data = data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export { ListResponse };
|
|
||||||
(window as any).ListResponse = ListResponse;
|
|
@ -1,30 +0,0 @@
|
|||||||
class ProfileOrganizationResponse {
|
|
||||||
id: string;
|
|
||||||
name: string;
|
|
||||||
useGroups: boolean;
|
|
||||||
useDirectory: boolean;
|
|
||||||
useTotp: boolean;
|
|
||||||
seats: number;
|
|
||||||
maxCollections: number;
|
|
||||||
maxStorageGb?: number;
|
|
||||||
key: string;
|
|
||||||
status: number; // TODO: map to enum
|
|
||||||
type: number; // TODO: map to enum
|
|
||||||
|
|
||||||
constructor(response: any) {
|
|
||||||
this.id = response.Id;
|
|
||||||
this.name = response.Name;
|
|
||||||
this.useGroups = response.UseGroups;
|
|
||||||
this.useDirectory = response.UseDirectory;
|
|
||||||
this.useTotp = response.UseTotp;
|
|
||||||
this.seats = response.Seats;
|
|
||||||
this.maxCollections = response.MaxCollections;
|
|
||||||
this.maxStorageGb = response.MaxStorageGb;
|
|
||||||
this.key = response.Key;
|
|
||||||
this.status = response.Status;
|
|
||||||
this.type = response.Type;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export { ProfileOrganizationResponse };
|
|
||||||
(window as any).ProfileOrganizationResponse = ProfileOrganizationResponse;
|
|
@ -1,39 +0,0 @@
|
|||||||
import { ProfileOrganizationResponse } from './profileOrganizationResponse';
|
|
||||||
|
|
||||||
class ProfileResponse {
|
|
||||||
id: string;
|
|
||||||
name: string;
|
|
||||||
email: string;
|
|
||||||
emailVerified: boolean;
|
|
||||||
masterPasswordHint: string;
|
|
||||||
premium: boolean;
|
|
||||||
culture: string;
|
|
||||||
twoFactorEnabled: boolean;
|
|
||||||
key: string;
|
|
||||||
privateKey: string;
|
|
||||||
securityStamp: string;
|
|
||||||
organizations: ProfileOrganizationResponse[] = [];
|
|
||||||
|
|
||||||
constructor(response: any) {
|
|
||||||
this.id = response.Id;
|
|
||||||
this.name = response.Name;
|
|
||||||
this.email = response.Email;
|
|
||||||
this.emailVerified = response.EmailVerified;
|
|
||||||
this.masterPasswordHint = response.MasterPasswordHint;
|
|
||||||
this.premium = response.Premium;
|
|
||||||
this.culture = response.Culture;
|
|
||||||
this.twoFactorEnabled = response.TwoFactorEnabled;
|
|
||||||
this.key = response.Key;
|
|
||||||
this.privateKey = response.PrivateKey;
|
|
||||||
this.securityStamp = response.SecurityStamp;
|
|
||||||
|
|
||||||
if (response.Organizations) {
|
|
||||||
response.Organizations.forEach((org: any) => {
|
|
||||||
this.organizations.push(new ProfileOrganizationResponse(org));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export { ProfileResponse };
|
|
||||||
(window as any).ProfileResponse = ProfileResponse;
|
|
@ -1,44 +0,0 @@
|
|||||||
import { CipherResponse } from './cipherResponse';
|
|
||||||
import { CollectionResponse } from './collectionResponse';
|
|
||||||
import { DomainsResponse } from './domainsResponse';
|
|
||||||
import { FolderResponse } from './folderResponse';
|
|
||||||
import { ProfileResponse } from './profileResponse';
|
|
||||||
|
|
||||||
class SyncResponse {
|
|
||||||
profile?: ProfileResponse;
|
|
||||||
folders: FolderResponse[] = [];
|
|
||||||
collections: CollectionResponse[] = [];
|
|
||||||
ciphers: CipherResponse[] = [];
|
|
||||||
domains?: DomainsResponse;
|
|
||||||
|
|
||||||
constructor(response: any) {
|
|
||||||
if (response.Profile) {
|
|
||||||
this.profile = new ProfileResponse(response.Profile);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (response.Folders) {
|
|
||||||
response.Folders.forEach((folder: any) => {
|
|
||||||
this.folders.push(new FolderResponse(folder));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (response.Collections) {
|
|
||||||
response.Collections.forEach((collection: any) => {
|
|
||||||
this.collections.push(new CollectionResponse(collection));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (response.Ciphers) {
|
|
||||||
response.Ciphers.forEach((cipher: any) => {
|
|
||||||
this.ciphers.push(new CipherResponse(cipher));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (response.Domains) {
|
|
||||||
this.domains = new DomainsResponse(response.Domains);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export { SyncResponse };
|
|
||||||
(window as any).SyncResponse = SyncResponse;
|
|
@ -34,7 +34,6 @@ import { Attachment } from '../../models/domain/attachment';
|
|||||||
import { Card } from '../../models/domain/card';
|
import { Card } from '../../models/domain/card';
|
||||||
import { Cipher } from '../../models/domain/cipher';
|
import { Cipher } from '../../models/domain/cipher';
|
||||||
import { Field } from '../../models/domain/field';
|
import { Field } from '../../models/domain/field';
|
||||||
import { Folder } from '../../models/domain/folder';
|
|
||||||
import { Identity } from '../../models/domain/identity';
|
import { Identity } from '../../models/domain/identity';
|
||||||
import { Login } from '../../models/domain/login';
|
import { Login } from '../../models/domain/login';
|
||||||
import { SecureNote } from '../../models/domain/secureNote';
|
import { SecureNote } from '../../models/domain/secureNote';
|
||||||
@ -50,28 +49,7 @@ import { SecureNoteData } from '../../models/data/secureNoteData';
|
|||||||
|
|
||||||
import { CipherString } from '../../models/domain/cipherString';
|
import { CipherString } from '../../models/domain/cipherString';
|
||||||
|
|
||||||
import { CipherRequest } from '../../models/request/cipherRequest';
|
import { Domain, Request, Response } from '@bitwarden/jslib';
|
||||||
import { DeviceRequest } from '../../models/request/deviceRequest';
|
|
||||||
import { DeviceTokenRequest } from '../../models/request/deviceTokenRequest';
|
|
||||||
import { FolderRequest } from '../../models/request/folderRequest';
|
|
||||||
import { PasswordHintRequest } from '../../models/request/passwordHintRequest';
|
|
||||||
import { RegisterRequest } from '../../models/request/registerRequest';
|
|
||||||
import { TokenRequest } from '../../models/request/tokenRequest';
|
|
||||||
import { TwoFactorEmailRequest } from '../../models/request/twoFactorEmailRequest';
|
|
||||||
|
|
||||||
import { AttachmentResponse } from '../../models/response/attachmentResponse';
|
|
||||||
import { CipherResponse } from '../../models/response/cipherResponse';
|
|
||||||
import { DeviceResponse } from '../../models/response/deviceResponse';
|
|
||||||
import { DomainsResponse } from '../../models/response/domainsResponse';
|
|
||||||
import { ErrorResponse } from '../../models/response/errorResponse';
|
|
||||||
import { FolderResponse } from '../../models/response/folderResponse';
|
|
||||||
import { GlobalDomainResponse } from '../../models/response/globalDomainResponse';
|
|
||||||
import { IdentityTokenResponse } from '../../models/response/identityTokenResponse';
|
|
||||||
import { KeysResponse } from '../../models/response/keysResponse';
|
|
||||||
import { ListResponse } from '../../models/response/listResponse';
|
|
||||||
import { ProfileOrganizationResponse } from '../../models/response/profileOrganizationResponse';
|
|
||||||
import { ProfileResponse } from '../../models/response/profileResponse';
|
|
||||||
import { SyncResponse } from '../../models/response/syncResponse';
|
|
||||||
|
|
||||||
angular
|
angular
|
||||||
.module('bit', [
|
.module('bit', [
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
import { DeviceRequest } from '../../../models/request/deviceRequest';
|
|
||||||
import { TokenRequest } from '../../../models/request/tokenRequest';
|
|
||||||
|
|
||||||
import { CryptoService } from '../../../services/abstractions/crypto.service';
|
import { CryptoService } from '../../../services/abstractions/crypto.service';
|
||||||
|
|
||||||
import { Abstractions } from '@bitwarden/jslib';
|
import { Abstractions, Request } from '@bitwarden/jslib';
|
||||||
|
|
||||||
class AuthService {
|
class AuthService {
|
||||||
constructor(public cryptoService: CryptoService, public apiService: any, public userService: any,
|
constructor(public cryptoService: CryptoService, public apiService: any, public userService: any,
|
||||||
@ -21,18 +18,18 @@ class AuthService {
|
|||||||
const storedTwoFactorToken = await this.tokenService.getTwoFactorToken(email);
|
const storedTwoFactorToken = await this.tokenService.getTwoFactorToken(email);
|
||||||
const hashedPassword = await this.cryptoService.hashPassword(masterPassword, key);
|
const hashedPassword = await this.cryptoService.hashPassword(masterPassword, key);
|
||||||
|
|
||||||
const deviceRequest = new DeviceRequest(appId, this.platformUtilsService);
|
const deviceRequest = new Request.Device(appId, this.platformUtilsService);
|
||||||
|
|
||||||
let request: TokenRequest;
|
let request: Request.Token;
|
||||||
|
|
||||||
if (twoFactorToken != null && twoFactorProvider != null) {
|
if (twoFactorToken != null && twoFactorProvider != null) {
|
||||||
request = new TokenRequest(email, hashedPassword, twoFactorProvider, twoFactorToken, remember,
|
request = new Request.Token(email, hashedPassword, twoFactorProvider, twoFactorToken, remember,
|
||||||
deviceRequest);
|
deviceRequest);
|
||||||
} else if (storedTwoFactorToken) {
|
} else if (storedTwoFactorToken) {
|
||||||
request = new TokenRequest(email, hashedPassword, this.constantsService.twoFactorProvider.remember,
|
request = new Request.Token(email, hashedPassword, this.constantsService.twoFactorProvider.remember,
|
||||||
storedTwoFactorToken, false, deviceRequest);
|
storedTwoFactorToken, false, deviceRequest);
|
||||||
} else {
|
} else {
|
||||||
request = new TokenRequest(email, hashedPassword, null, null, false, deviceRequest);
|
request = new Request.Token(email, hashedPassword, null, null, false, deviceRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
const response = await this.apiService.postIdentityToken(request);
|
const response = await this.apiService.postIdentityToken(request);
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
import * as angular from 'angular';
|
import * as angular from 'angular';
|
||||||
import { Folder } from '../../../../models/domain/folder';
|
|
||||||
import * as template from './add-folder.component.html';
|
import * as template from './add-folder.component.html';
|
||||||
|
|
||||||
import { Abstractions } from '@bitwarden/jslib';
|
import { Abstractions, Domain } from '@bitwarden/jslib';
|
||||||
|
|
||||||
export class AddFolderController {
|
export class AddFolderController {
|
||||||
savePromise: any;
|
savePromise: any;
|
||||||
@ -29,7 +28,7 @@ export class AddFolderController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.savePromise = this.folderService.encrypt(model).then((folderModel: any) => {
|
this.savePromise = this.folderService.encrypt(model).then((folderModel: any) => {
|
||||||
const folder = new Folder(folderModel, true);
|
const folder = new Domain.Folder(folderModel, true);
|
||||||
return this.folderService.saveWithServer(folder);
|
return this.folderService.saveWithServer(folder);
|
||||||
}).then((folder: any) => {
|
}).then((folder: any) => {
|
||||||
this.$analytics.eventTrack('Added Folder');
|
this.$analytics.eventTrack('Added Folder');
|
||||||
|
@ -1,15 +1,14 @@
|
|||||||
import * as angular from 'angular';
|
import * as angular from 'angular';
|
||||||
import { Folder } from '../../../../models/domain/folder';
|
|
||||||
import * as template from './edit-folder.component.html';
|
import * as template from './edit-folder.component.html';
|
||||||
|
|
||||||
import { Abstractions } from '@bitwarden/jslib';
|
import { Abstractions, Domain } from '@bitwarden/jslib';
|
||||||
|
|
||||||
export class EditFolderController {
|
export class EditFolderController {
|
||||||
$transition$: any;
|
$transition$: any;
|
||||||
folderId: any;
|
folderId: any;
|
||||||
savePromise: any = null;
|
savePromise: any = null;
|
||||||
i18n: any;
|
i18n: any;
|
||||||
folder: Folder;
|
folder: Domain.Folder;
|
||||||
|
|
||||||
constructor($scope: any, $stateParams: any, private folderService: any, private toastr: any, private $state: any,
|
constructor($scope: any, $stateParams: any, private folderService: any, private toastr: any, private $state: any,
|
||||||
private SweetAlert: any, platformUtilsService: Abstractions.PlatformUtilsService, private $analytics: any,
|
private SweetAlert: any, platformUtilsService: Abstractions.PlatformUtilsService, private $analytics: any,
|
||||||
@ -28,7 +27,7 @@ export class EditFolderController {
|
|||||||
this.folderId = this.$transition$.params('to').folderId;
|
this.folderId = this.$transition$.params('to').folderId;
|
||||||
this.folderService.get(this.folderId).then((folder: any) => {
|
this.folderService.get(this.folderId).then((folder: any) => {
|
||||||
return folder.decrypt();
|
return folder.decrypt();
|
||||||
}).then((model: Folder) => {
|
}).then((model: Domain.Folder) => {
|
||||||
this.folder = model;
|
this.folder = model;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -40,7 +39,7 @@ export class EditFolderController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.savePromise = this.folderService.encrypt(model).then((folderModel: any) => {
|
this.savePromise = this.folderService.encrypt(model).then((folderModel: any) => {
|
||||||
const folder = new Folder(folderModel, true);
|
const folder = new Domain.Folder(folderModel, true);
|
||||||
return this.folderService.saveWithServer(folder);
|
return this.folderService.saveWithServer(folder);
|
||||||
}).then((folder: any) => {
|
}).then((folder: any) => {
|
||||||
this.$analytics.eventTrack('Edited Folder');
|
this.$analytics.eventTrack('Edited Folder');
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
import { Folder } from '../../../../models/domain/folder';
|
|
||||||
import * as template from './folders.component.html';
|
import * as template from './folders.component.html';
|
||||||
|
|
||||||
|
import { Domain } from '@bitwarden/jslib';
|
||||||
|
|
||||||
export class FoldersController {
|
export class FoldersController {
|
||||||
folders: Folder[] = [];
|
folders: Domain.Folder[] = [];
|
||||||
i18n: any;
|
i18n: any;
|
||||||
loaded = false;
|
loaded = false;
|
||||||
|
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
import { CipherString } from '../../models/domain/cipherString';
|
import { CipherString } from '../../models/domain/cipherString';
|
||||||
import SymmetricCryptoKey from '../../models/domain/symmetricCryptoKey';
|
import SymmetricCryptoKey from '../../models/domain/symmetricCryptoKey';
|
||||||
|
|
||||||
import { ProfileOrganizationResponse } from '../../models/response/profileOrganizationResponse';
|
import { Response } from '@bitwarden/jslib';
|
||||||
|
|
||||||
export interface CryptoService {
|
export interface CryptoService {
|
||||||
setKey(key: SymmetricCryptoKey): Promise<any>;
|
setKey(key: SymmetricCryptoKey): Promise<any>;
|
||||||
setKeyHash(keyHash: string): Promise<{}>;
|
setKeyHash(keyHash: string): Promise<{}>;
|
||||||
setEncKey(encKey: string): Promise<{}>;
|
setEncKey(encKey: string): Promise<{}>;
|
||||||
setEncPrivateKey(encPrivateKey: string): Promise<{}>;
|
setEncPrivateKey(encPrivateKey: string): Promise<{}>;
|
||||||
setOrgKeys(orgs: ProfileOrganizationResponse[]): Promise<{}>;
|
setOrgKeys(orgs: Response.ProfileOrganization[]): Promise<{}>;
|
||||||
getKey(): Promise<SymmetricCryptoKey>;
|
getKey(): Promise<SymmetricCryptoKey>;
|
||||||
getKeyHash(): Promise<string>;
|
getKeyHash(): Promise<string>;
|
||||||
getEncKey(): Promise<SymmetricCryptoKey>;
|
getEncKey(): Promise<SymmetricCryptoKey>;
|
||||||
|
@ -2,33 +2,10 @@ import AppIdService from './appId.service';
|
|||||||
import ConstantsService from './constants.service';
|
import ConstantsService from './constants.service';
|
||||||
import TokenService from './token.service';
|
import TokenService from './token.service';
|
||||||
|
|
||||||
import { Abstractions } from '@bitwarden/jslib';
|
import { Abstractions, Request as Req, Response as Res } from '@bitwarden/jslib';
|
||||||
|
|
||||||
import EnvironmentUrls from '../models/domain/environmentUrls';
|
import EnvironmentUrls from '../models/domain/environmentUrls';
|
||||||
|
|
||||||
import { CipherRequest } from '../models/request/cipherRequest';
|
|
||||||
import { DeviceRequest } from '../models/request/deviceRequest';
|
|
||||||
import { DeviceTokenRequest } from '../models/request/deviceTokenRequest';
|
|
||||||
import { FolderRequest } from '../models/request/folderRequest';
|
|
||||||
import { PasswordHintRequest } from '../models/request/passwordHintRequest';
|
|
||||||
import { RegisterRequest } from '../models/request/registerRequest';
|
|
||||||
import { TokenRequest } from '../models/request/tokenRequest';
|
|
||||||
import { TwoFactorEmailRequest } from '../models/request/twoFactorEmailRequest';
|
|
||||||
|
|
||||||
import { AttachmentResponse } from '../models/response/attachmentResponse';
|
|
||||||
import { CipherResponse } from '../models/response/cipherResponse';
|
|
||||||
import { DeviceResponse } from '../models/response/deviceResponse';
|
|
||||||
import { DomainsResponse } from '../models/response/domainsResponse';
|
|
||||||
import { ErrorResponse } from '../models/response/errorResponse';
|
|
||||||
import { FolderResponse } from '../models/response/folderResponse';
|
|
||||||
import { GlobalDomainResponse } from '../models/response/globalDomainResponse';
|
|
||||||
import { IdentityTokenResponse } from '../models/response/identityTokenResponse';
|
|
||||||
import { KeysResponse } from '../models/response/keysResponse';
|
|
||||||
import { ListResponse } from '../models/response/listResponse';
|
|
||||||
import { ProfileOrganizationResponse } from '../models/response/profileOrganizationResponse';
|
|
||||||
import { ProfileResponse } from '../models/response/profileResponse';
|
|
||||||
import { SyncResponse } from '../models/response/syncResponse';
|
|
||||||
|
|
||||||
export default class ApiService {
|
export default class ApiService {
|
||||||
urlsSet: boolean = false;
|
urlsSet: boolean = false;
|
||||||
baseUrl: string;
|
baseUrl: string;
|
||||||
@ -82,7 +59,7 @@ export default class ApiService {
|
|||||||
|
|
||||||
// Auth APIs
|
// Auth APIs
|
||||||
|
|
||||||
async postIdentityToken(request: TokenRequest): Promise<IdentityTokenResponse | any> {
|
async postIdentityToken(request: Req.Token): Promise<Res.IdentityToken | any> {
|
||||||
const response = await fetch(new Request(this.identityBaseUrl + '/connect/token', {
|
const response = await fetch(new Request(this.identityBaseUrl + '/connect/token', {
|
||||||
body: this.qsStringify(request.toIdentityToken()),
|
body: this.qsStringify(request.toIdentityToken()),
|
||||||
cache: 'no-cache',
|
cache: 'no-cache',
|
||||||
@ -102,7 +79,7 @@ export default class ApiService {
|
|||||||
|
|
||||||
if (responseJson != null) {
|
if (responseJson != null) {
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
return new IdentityTokenResponse(responseJson);
|
return new Res.IdentityToken(responseJson);
|
||||||
} else if (response.status === 400 && responseJson.TwoFactorProviders2 &&
|
} else if (response.status === 400 && responseJson.TwoFactorProviders2 &&
|
||||||
Object.keys(responseJson.TwoFactorProviders2).length) {
|
Object.keys(responseJson.TwoFactorProviders2).length) {
|
||||||
await this.tokenService.clearTwoFactorToken(request.email);
|
await this.tokenService.clearTwoFactorToken(request.email);
|
||||||
@ -110,7 +87,7 @@ export default class ApiService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Promise.reject(new ErrorResponse(responseJson, response.status, true));
|
return Promise.reject(new Res.Error(responseJson, response.status, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
async refreshIdentityToken(): Promise<any> {
|
async refreshIdentityToken(): Promise<any> {
|
||||||
@ -123,7 +100,7 @@ export default class ApiService {
|
|||||||
|
|
||||||
// Two Factor APIs
|
// Two Factor APIs
|
||||||
|
|
||||||
async postTwoFactorEmail(request: TwoFactorEmailRequest): Promise<any> {
|
async postTwoFactorEmail(request: Req.TwoFactorEmail): Promise<any> {
|
||||||
const response = await fetch(new Request(this.baseUrl + '/two-factor/send-email-login', {
|
const response = await fetch(new Request(this.baseUrl + '/two-factor/send-email-login', {
|
||||||
body: JSON.stringify(request),
|
body: JSON.stringify(request),
|
||||||
cache: 'no-cache',
|
cache: 'no-cache',
|
||||||
@ -161,7 +138,7 @@ export default class ApiService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async postPasswordHint(request: PasswordHintRequest): Promise<any> {
|
async postPasswordHint(request: Req.PasswordHint): Promise<any> {
|
||||||
const response = await fetch(new Request(this.baseUrl + '/accounts/password-hint', {
|
const response = await fetch(new Request(this.baseUrl + '/accounts/password-hint', {
|
||||||
body: JSON.stringify(request),
|
body: JSON.stringify(request),
|
||||||
cache: 'no-cache',
|
cache: 'no-cache',
|
||||||
@ -178,7 +155,7 @@ export default class ApiService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async postRegister(request: RegisterRequest): Promise<any> {
|
async postRegister(request: Req.Register): Promise<any> {
|
||||||
const response = await fetch(new Request(this.baseUrl + '/accounts/register', {
|
const response = await fetch(new Request(this.baseUrl + '/accounts/register', {
|
||||||
body: JSON.stringify(request),
|
body: JSON.stringify(request),
|
||||||
cache: 'no-cache',
|
cache: 'no-cache',
|
||||||
@ -197,7 +174,7 @@ export default class ApiService {
|
|||||||
|
|
||||||
// Folder APIs
|
// Folder APIs
|
||||||
|
|
||||||
async postFolder(request: FolderRequest): Promise<FolderResponse> {
|
async postFolder(request: Req.Folder): Promise<Res.Folder> {
|
||||||
const authHeader = await this.handleTokenState();
|
const authHeader = await this.handleTokenState();
|
||||||
const response = await fetch(new Request(this.baseUrl + '/folders', {
|
const response = await fetch(new Request(this.baseUrl + '/folders', {
|
||||||
body: JSON.stringify(request),
|
body: JSON.stringify(request),
|
||||||
@ -213,14 +190,14 @@ export default class ApiService {
|
|||||||
|
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
const responseJson = await response.json();
|
const responseJson = await response.json();
|
||||||
return new FolderResponse(responseJson);
|
return new Res.Folder(responseJson);
|
||||||
} else {
|
} else {
|
||||||
const error = await this.handleError(response, false);
|
const error = await this.handleError(response, false);
|
||||||
return Promise.reject(error);
|
return Promise.reject(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async putFolder(id: string, request: FolderRequest): Promise<FolderResponse> {
|
async putFolder(id: string, request: Req.Folder): Promise<Res.Folder> {
|
||||||
const authHeader = await this.handleTokenState();
|
const authHeader = await this.handleTokenState();
|
||||||
const response = await fetch(new Request(this.baseUrl + '/folders/' + id, {
|
const response = await fetch(new Request(this.baseUrl + '/folders/' + id, {
|
||||||
body: JSON.stringify(request),
|
body: JSON.stringify(request),
|
||||||
@ -236,7 +213,7 @@ export default class ApiService {
|
|||||||
|
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
const responseJson = await response.json();
|
const responseJson = await response.json();
|
||||||
return new FolderResponse(responseJson);
|
return new Res.Folder(responseJson);
|
||||||
} else {
|
} else {
|
||||||
const error = await this.handleError(response, false);
|
const error = await this.handleError(response, false);
|
||||||
return Promise.reject(error);
|
return Promise.reject(error);
|
||||||
@ -262,7 +239,7 @@ export default class ApiService {
|
|||||||
|
|
||||||
// Cipher APIs
|
// Cipher APIs
|
||||||
|
|
||||||
async postCipher(request: CipherRequest): Promise<CipherResponse> {
|
async postCipher(request: Req.Cipher): Promise<Res.Cipher> {
|
||||||
const authHeader = await this.handleTokenState();
|
const authHeader = await this.handleTokenState();
|
||||||
const response = await fetch(new Request(this.baseUrl + '/ciphers', {
|
const response = await fetch(new Request(this.baseUrl + '/ciphers', {
|
||||||
body: JSON.stringify(request),
|
body: JSON.stringify(request),
|
||||||
@ -278,14 +255,14 @@ export default class ApiService {
|
|||||||
|
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
const responseJson = await response.json();
|
const responseJson = await response.json();
|
||||||
return new CipherResponse(responseJson);
|
return new Res.Cipher(responseJson);
|
||||||
} else {
|
} else {
|
||||||
const error = await this.handleError(response, false);
|
const error = await this.handleError(response, false);
|
||||||
return Promise.reject(error);
|
return Promise.reject(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async putCipher(id: string, request: CipherRequest): Promise<CipherResponse> {
|
async putCipher(id: string, request: Req.Cipher): Promise<Res.Cipher> {
|
||||||
const authHeader = await this.handleTokenState();
|
const authHeader = await this.handleTokenState();
|
||||||
const response = await fetch(new Request(this.baseUrl + '/ciphers/' + id, {
|
const response = await fetch(new Request(this.baseUrl + '/ciphers/' + id, {
|
||||||
body: JSON.stringify(request),
|
body: JSON.stringify(request),
|
||||||
@ -301,7 +278,7 @@ export default class ApiService {
|
|||||||
|
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
const responseJson = await response.json();
|
const responseJson = await response.json();
|
||||||
return new CipherResponse(responseJson);
|
return new Res.Cipher(responseJson);
|
||||||
} else {
|
} else {
|
||||||
const error = await this.handleError(response, false);
|
const error = await this.handleError(response, false);
|
||||||
return Promise.reject(error);
|
return Promise.reject(error);
|
||||||
@ -327,7 +304,7 @@ export default class ApiService {
|
|||||||
|
|
||||||
// Attachments APIs
|
// Attachments APIs
|
||||||
|
|
||||||
async postCipherAttachment(id: string, data: FormData): Promise<CipherResponse> {
|
async postCipherAttachment(id: string, data: FormData): Promise<Res.Cipher> {
|
||||||
const authHeader = await this.handleTokenState();
|
const authHeader = await this.handleTokenState();
|
||||||
const response = await fetch(new Request(this.baseUrl + '/ciphers/' + id + '/attachment', {
|
const response = await fetch(new Request(this.baseUrl + '/ciphers/' + id + '/attachment', {
|
||||||
body: data,
|
body: data,
|
||||||
@ -342,7 +319,7 @@ export default class ApiService {
|
|||||||
|
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
const responseJson = await response.json();
|
const responseJson = await response.json();
|
||||||
return new CipherResponse(responseJson);
|
return new Res.Cipher(responseJson);
|
||||||
} else {
|
} else {
|
||||||
const error = await this.handleError(response, false);
|
const error = await this.handleError(response, false);
|
||||||
return Promise.reject(error);
|
return Promise.reject(error);
|
||||||
@ -368,7 +345,7 @@ export default class ApiService {
|
|||||||
|
|
||||||
// Sync APIs
|
// Sync APIs
|
||||||
|
|
||||||
async getSync(): Promise<SyncResponse> {
|
async getSync(): Promise<Res.Sync> {
|
||||||
const authHeader = await this.handleTokenState();
|
const authHeader = await this.handleTokenState();
|
||||||
const response = await fetch(new Request(this.baseUrl + '/sync', {
|
const response = await fetch(new Request(this.baseUrl + '/sync', {
|
||||||
cache: 'no-cache',
|
cache: 'no-cache',
|
||||||
@ -381,7 +358,7 @@ export default class ApiService {
|
|||||||
|
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
const responseJson = await response.json();
|
const responseJson = await response.json();
|
||||||
return new SyncResponse(responseJson);
|
return new Res.Sync(responseJson);
|
||||||
} else {
|
} else {
|
||||||
const error = await this.handleError(response, false);
|
const error = await this.handleError(response, false);
|
||||||
return Promise.reject(error);
|
return Promise.reject(error);
|
||||||
@ -390,7 +367,7 @@ export default class ApiService {
|
|||||||
|
|
||||||
// Helpers
|
// Helpers
|
||||||
|
|
||||||
private async handleError(response: Response, tokenError: boolean): Promise<ErrorResponse> {
|
private async handleError(response: Response, tokenError: boolean): Promise<Res.Error> {
|
||||||
if ((tokenError && response.status === 400) || response.status === 401 || response.status === 403) {
|
if ((tokenError && response.status === 400) || response.status === 401 || response.status === 403) {
|
||||||
this.logoutCallback(true);
|
this.logoutCallback(true);
|
||||||
return null;
|
return null;
|
||||||
@ -402,7 +379,7 @@ export default class ApiService {
|
|||||||
responseJson = await response.json();
|
responseJson = await response.json();
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ErrorResponse(responseJson, response.status, tokenError);
|
return new Res.Error(responseJson, response.status, tokenError);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async handleTokenState(): Promise<string> {
|
private async handleTokenState(): Promise<string> {
|
||||||
@ -417,7 +394,7 @@ export default class ApiService {
|
|||||||
return 'Bearer ' + accessToken;
|
return 'Bearer ' + accessToken;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async doRefreshToken(): Promise<IdentityTokenResponse> {
|
private async doRefreshToken(): Promise<Res.IdentityToken> {
|
||||||
const refreshToken = await this.tokenService.getRefreshToken();
|
const refreshToken = await this.tokenService.getRefreshToken();
|
||||||
if (refreshToken == null || refreshToken === '') {
|
if (refreshToken == null || refreshToken === '') {
|
||||||
throw new Error();
|
throw new Error();
|
||||||
@ -440,7 +417,7 @@ export default class ApiService {
|
|||||||
|
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
const responseJson = await response.json();
|
const responseJson = await response.json();
|
||||||
const tokenResponse = new IdentityTokenResponse(responseJson);
|
const tokenResponse = new Res.IdentityToken(responseJson);
|
||||||
await this.tokenService.setTokens(tokenResponse.accessToken, tokenResponse.refreshToken);
|
await this.tokenService.setTokens(tokenResponse.accessToken, tokenResponse.refreshToken);
|
||||||
return tokenResponse;
|
return tokenResponse;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Abstractions, Enums } from '@bitwarden/jslib';
|
import { Abstractions, Enums, Request, Response } from '@bitwarden/jslib';
|
||||||
|
|
||||||
import { Cipher } from '../models/domain/cipher';
|
import { Cipher } from '../models/domain/cipher';
|
||||||
import { CipherString } from '../models/domain/cipherString';
|
import { CipherString } from '../models/domain/cipherString';
|
||||||
@ -7,10 +7,6 @@ import SymmetricCryptoKey from '../models/domain/symmetricCryptoKey';
|
|||||||
|
|
||||||
import { CipherData } from '../models/data/cipherData';
|
import { CipherData } from '../models/data/cipherData';
|
||||||
|
|
||||||
import { CipherRequest } from '../models/request/cipherRequest';
|
|
||||||
import { CipherResponse } from '../models/response/cipherResponse';
|
|
||||||
import { ErrorResponse } from '../models/response/errorResponse';
|
|
||||||
|
|
||||||
import ApiService from './api.service';
|
import ApiService from './api.service';
|
||||||
import ConstantsService from './constants.service';
|
import ConstantsService from './constants.service';
|
||||||
import CryptoService from './crypto.service';
|
import CryptoService from './crypto.service';
|
||||||
@ -285,9 +281,9 @@ export default class CipherService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async saveWithServer(cipher: Cipher): Promise<any> {
|
async saveWithServer(cipher: Cipher): Promise<any> {
|
||||||
const request = new CipherRequest(cipher);
|
const request = new Request.Cipher(cipher);
|
||||||
|
|
||||||
let response: CipherResponse;
|
let response: Response.Cipher;
|
||||||
if (cipher.id == null) {
|
if (cipher.id == null) {
|
||||||
response = await this.apiService.postCipher(request);
|
response = await this.apiService.postCipher(request);
|
||||||
cipher.id = response.id;
|
cipher.id = response.id;
|
||||||
@ -316,11 +312,11 @@ export default class CipherService {
|
|||||||
const blob = new Blob([encData], { type: 'application/octet-stream' });
|
const blob = new Blob([encData], { type: 'application/octet-stream' });
|
||||||
fd.append('data', blob, encFileName.encryptedString);
|
fd.append('data', blob, encFileName.encryptedString);
|
||||||
|
|
||||||
let response: CipherResponse;
|
let response: Response.Cipher;
|
||||||
try {
|
try {
|
||||||
response = await self.apiService.postCipherAttachment(cipher.id, fd);
|
response = await self.apiService.postCipherAttachment(cipher.id, fd);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
reject((e as ErrorResponse).getSingleMessage());
|
reject((e as Response.Error).getSingleMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -418,7 +414,7 @@ export default class CipherService {
|
|||||||
try {
|
try {
|
||||||
await this.apiService.deleteCipherAttachment(id, attachmentId);
|
await this.apiService.deleteCipherAttachment(id, attachmentId);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return Promise.reject((e as ErrorResponse).getSingleMessage());
|
return Promise.reject((e as Response.Error).getSingleMessage());
|
||||||
}
|
}
|
||||||
await this.deleteAttachment(id, attachmentId);
|
await this.deleteAttachment(id, attachmentId);
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
import * as forge from 'node-forge';
|
import * as forge from 'node-forge';
|
||||||
|
|
||||||
import { Abstractions, Enums, Services } from '@bitwarden/jslib';
|
import { Abstractions, Enums, Response, Services } from '@bitwarden/jslib';
|
||||||
|
|
||||||
import { CipherString } from '../models/domain/cipherString';
|
import { CipherString } from '../models/domain/cipherString';
|
||||||
import EncryptedObject from '../models/domain/encryptedObject';
|
import EncryptedObject from '../models/domain/encryptedObject';
|
||||||
import SymmetricCryptoKey from '../models/domain/symmetricCryptoKey';
|
import SymmetricCryptoKey from '../models/domain/symmetricCryptoKey';
|
||||||
import { ProfileOrganizationResponse } from '../models/response/profileOrganizationResponse';
|
|
||||||
|
|
||||||
import ConstantsService from './constants.service';
|
import ConstantsService from './constants.service';
|
||||||
|
|
||||||
@ -77,7 +76,7 @@ export default class CryptoService implements CryptoServiceInterface {
|
|||||||
this.privateKey = null;
|
this.privateKey = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
setOrgKeys(orgs: ProfileOrganizationResponse[]): Promise<{}> {
|
setOrgKeys(orgs: Response.ProfileOrganization[]): Promise<{}> {
|
||||||
const orgKeys: any = {};
|
const orgKeys: any = {};
|
||||||
orgs.forEach((org) => {
|
orgs.forEach((org) => {
|
||||||
orgKeys[org.id] = org.key;
|
orgKeys[org.id] = org.key;
|
||||||
|
@ -1,16 +1,12 @@
|
|||||||
import { CipherString } from '../models/domain/cipherString';
|
import { CipherString } from '../models/domain/cipherString';
|
||||||
import { Folder } from '../models/domain/folder';
|
|
||||||
|
|
||||||
import { FolderData } from '../models/data/folderData';
|
import { FolderData } from '../models/data/folderData';
|
||||||
|
|
||||||
import { FolderRequest } from '../models/request/folderRequest';
|
|
||||||
import { FolderResponse } from '../models/response/folderResponse';
|
|
||||||
|
|
||||||
import ApiService from './api.service';
|
import ApiService from './api.service';
|
||||||
import CryptoService from './crypto.service';
|
import CryptoService from './crypto.service';
|
||||||
import UserService from './user.service';
|
import UserService from './user.service';
|
||||||
|
|
||||||
import { Abstractions } from '@bitwarden/jslib';
|
import { Abstractions, Domain, Request, Response } from '@bitwarden/jslib';
|
||||||
|
|
||||||
const Keys = {
|
const Keys = {
|
||||||
foldersPrefix: 'folders_',
|
foldersPrefix: 'folders_',
|
||||||
@ -28,14 +24,14 @@ export default class FolderService {
|
|||||||
this.decryptedFolderCache = null;
|
this.decryptedFolderCache = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
async encrypt(model: any): Promise<Folder> {
|
async encrypt(model: any): Promise<Domain.Folder> {
|
||||||
const folder = new Folder();
|
const folder = new Domain.Folder();
|
||||||
folder.id = model.id;
|
folder.id = model.id;
|
||||||
folder.name = await this.cryptoService.encrypt(model.name);
|
folder.name = await this.cryptoService.encrypt(model.name);
|
||||||
return folder;
|
return folder;
|
||||||
}
|
}
|
||||||
|
|
||||||
async get(id: string): Promise<Folder> {
|
async get(id: string): Promise<Domain.Folder> {
|
||||||
const userId = await this.userService.getUserId();
|
const userId = await this.userService.getUserId();
|
||||||
const folders = await this.storageService.get<{ [id: string]: FolderData; }>(
|
const folders = await this.storageService.get<{ [id: string]: FolderData; }>(
|
||||||
Keys.foldersPrefix + userId);
|
Keys.foldersPrefix + userId);
|
||||||
@ -43,17 +39,17 @@ export default class FolderService {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Folder(folders[id]);
|
return new Domain.Folder(folders[id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getAll(): Promise<Folder[]> {
|
async getAll(): Promise<Domain.Folder[]> {
|
||||||
const userId = await this.userService.getUserId();
|
const userId = await this.userService.getUserId();
|
||||||
const folders = await this.storageService.get<{ [id: string]: FolderData; }>(
|
const folders = await this.storageService.get<{ [id: string]: FolderData; }>(
|
||||||
Keys.foldersPrefix + userId);
|
Keys.foldersPrefix + userId);
|
||||||
const response: Folder[] = [];
|
const response: Domain.Folder[] = [];
|
||||||
for (const id in folders) {
|
for (const id in folders) {
|
||||||
if (folders.hasOwnProperty(id)) {
|
if (folders.hasOwnProperty(id)) {
|
||||||
response.push(new Folder(folders[id]));
|
response.push(new Domain.Folder(folders[id]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return response;
|
return response;
|
||||||
@ -87,10 +83,10 @@ export default class FolderService {
|
|||||||
return this.decryptedFolderCache;
|
return this.decryptedFolderCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
async saveWithServer(folder: Folder): Promise<any> {
|
async saveWithServer(folder: Domain.Folder): Promise<any> {
|
||||||
const request = new FolderRequest(folder);
|
const request = new Request.Folder(folder);
|
||||||
|
|
||||||
let response: FolderResponse;
|
let response: Response.Folder;
|
||||||
if (folder.id == null) {
|
if (folder.id == null) {
|
||||||
response = await this.apiService.postFolder(request);
|
response = await this.apiService.postFolder(request);
|
||||||
folder.id = response.id;
|
folder.id = response.id;
|
||||||
|
@ -2,13 +2,6 @@ import { CipherData } from '../models/data/cipherData';
|
|||||||
import { CollectionData } from '../models/data/collectionData';
|
import { CollectionData } from '../models/data/collectionData';
|
||||||
import { FolderData } from '../models/data/folderData';
|
import { FolderData } from '../models/data/folderData';
|
||||||
|
|
||||||
import { CipherResponse } from '../models/response/cipherResponse';
|
|
||||||
import { CollectionResponse } from '../models/response/collectionResponse';
|
|
||||||
import { DomainsResponse } from '../models/response/domainsResponse';
|
|
||||||
import { FolderResponse } from '../models/response/folderResponse';
|
|
||||||
import { ProfileResponse } from '../models/response/profileResponse';
|
|
||||||
import { SyncResponse } from '../models/response/syncResponse';
|
|
||||||
|
|
||||||
import ApiService from './api.service';
|
import ApiService from './api.service';
|
||||||
import CipherService from './cipher.service';
|
import CipherService from './cipher.service';
|
||||||
import CollectionService from './collection.service';
|
import CollectionService from './collection.service';
|
||||||
@ -17,7 +10,7 @@ import FolderService from './folder.service';
|
|||||||
import SettingsService from './settings.service';
|
import SettingsService from './settings.service';
|
||||||
import UserService from './user.service';
|
import UserService from './user.service';
|
||||||
|
|
||||||
import { Abstractions } from '@bitwarden/jslib';
|
import { Abstractions, Response } from '@bitwarden/jslib';
|
||||||
|
|
||||||
const Keys = {
|
const Keys = {
|
||||||
lastSyncPrefix: 'lastSync_',
|
lastSyncPrefix: 'lastSync_',
|
||||||
@ -122,7 +115,7 @@ export default class SyncService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async syncProfile(response: ProfileResponse) {
|
private async syncProfile(response: Response.Profile) {
|
||||||
const stamp = await this.userService.getSecurityStamp();
|
const stamp = await this.userService.getSecurityStamp();
|
||||||
if (stamp != null && stamp !== response.securityStamp) {
|
if (stamp != null && stamp !== response.securityStamp) {
|
||||||
if (this.logoutCallback != null) {
|
if (this.logoutCallback != null) {
|
||||||
@ -138,7 +131,7 @@ export default class SyncService {
|
|||||||
await this.userService.setSecurityStamp(response.securityStamp);
|
await this.userService.setSecurityStamp(response.securityStamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async syncFolders(userId: string, response: FolderResponse[]) {
|
private async syncFolders(userId: string, response: Response.Folder[]) {
|
||||||
const folders: { [id: string]: FolderData; } = {};
|
const folders: { [id: string]: FolderData; } = {};
|
||||||
response.forEach((f) => {
|
response.forEach((f) => {
|
||||||
folders[f.id] = new FolderData(f, userId);
|
folders[f.id] = new FolderData(f, userId);
|
||||||
@ -146,7 +139,7 @@ export default class SyncService {
|
|||||||
return await this.folderService.replace(folders);
|
return await this.folderService.replace(folders);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async syncCollections(response: CollectionResponse[]) {
|
private async syncCollections(response: Response.Collection[]) {
|
||||||
const collections: { [id: string]: CollectionData; } = {};
|
const collections: { [id: string]: CollectionData; } = {};
|
||||||
response.forEach((c) => {
|
response.forEach((c) => {
|
||||||
collections[c.id] = new CollectionData(c);
|
collections[c.id] = new CollectionData(c);
|
||||||
@ -154,7 +147,7 @@ export default class SyncService {
|
|||||||
return await this.collectionService.replace(collections);
|
return await this.collectionService.replace(collections);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async syncCiphers(userId: string, response: CipherResponse[]) {
|
private async syncCiphers(userId: string, response: Response.Cipher[]) {
|
||||||
const ciphers: { [id: string]: CipherData; } = {};
|
const ciphers: { [id: string]: CipherData; } = {};
|
||||||
response.forEach((c) => {
|
response.forEach((c) => {
|
||||||
ciphers[c.id] = new CipherData(c, userId);
|
ciphers[c.id] = new CipherData(c, userId);
|
||||||
@ -162,7 +155,7 @@ export default class SyncService {
|
|||||||
return await this.cipherService.replace(ciphers);
|
return await this.cipherService.replace(ciphers);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async syncSettings(userId: string, response: DomainsResponse) {
|
private async syncSettings(userId: string, response: Response.Domains) {
|
||||||
let eqDomains: string[][] = [];
|
let eqDomains: string[][] = [];
|
||||||
if (response != null && response.equivalentDomains != null) {
|
if (response != null && response.equivalentDomains != null) {
|
||||||
eqDomains = eqDomains.concat(response.equivalentDomains);
|
eqDomains = eqDomains.concat(response.equivalentDomains);
|
||||||
|
Loading…
Reference in New Issue
Block a user