mirror of
https://github.com/bitwarden/browser
synced 2025-12-19 09:43:23 +00:00
Move to libs
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { KdfType } from "../../../enums/kdfType";
|
||||
import { KeysRequest } from "../keysRequest";
|
||||
|
||||
export class SetKeyConnectorKeyRequest {
|
||||
key: string;
|
||||
keys: KeysRequest;
|
||||
kdf: KdfType;
|
||||
kdfIterations: number;
|
||||
orgIdentifier: string;
|
||||
|
||||
constructor(
|
||||
key: string,
|
||||
kdf: KdfType,
|
||||
kdfIterations: number,
|
||||
orgIdentifier: string,
|
||||
keys: KeysRequest
|
||||
) {
|
||||
this.key = key;
|
||||
this.kdf = kdf;
|
||||
this.kdfIterations = kdfIterations;
|
||||
this.orgIdentifier = orgIdentifier;
|
||||
this.keys = keys;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
export class VerifyOTPRequest {
|
||||
OTP: string;
|
||||
|
||||
constructor(OTP: string) {
|
||||
this.OTP = OTP;
|
||||
}
|
||||
}
|
||||
6
libs/common/src/models/request/attachmentRequest.ts
Normal file
6
libs/common/src/models/request/attachmentRequest.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
export class AttachmentRequest {
|
||||
fileName: string;
|
||||
key: string;
|
||||
fileSize: number;
|
||||
adminRequest: boolean;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export class BillingSyncConfigRequest {
|
||||
constructor(private billingSyncKey: string) {}
|
||||
}
|
||||
9
libs/common/src/models/request/bitPayInvoiceRequest.ts
Normal file
9
libs/common/src/models/request/bitPayInvoiceRequest.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
export class BitPayInvoiceRequest {
|
||||
userId: string;
|
||||
organizationId: string;
|
||||
credit: boolean;
|
||||
amount: number;
|
||||
returnUrl: string;
|
||||
name: string;
|
||||
email: string;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export abstract class CaptchaProtectedRequest {
|
||||
captchaResponse: string = null;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
export class CipherBulkDeleteRequest {
|
||||
ids: string[];
|
||||
organizationId: string;
|
||||
|
||||
constructor(ids: string[], organizationId?: string) {
|
||||
this.ids = ids == null ? [] : ids;
|
||||
this.organizationId = organizationId;
|
||||
}
|
||||
}
|
||||
9
libs/common/src/models/request/cipherBulkMoveRequest.ts
Normal file
9
libs/common/src/models/request/cipherBulkMoveRequest.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
export class CipherBulkMoveRequest {
|
||||
ids: string[];
|
||||
folderId: string;
|
||||
|
||||
constructor(ids: string[], folderId: string) {
|
||||
this.ids = ids == null ? [] : ids;
|
||||
this.folderId = folderId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
export class CipherBulkRestoreRequest {
|
||||
ids: string[];
|
||||
|
||||
constructor(ids: string[]) {
|
||||
this.ids = ids == null ? [] : ids;
|
||||
}
|
||||
}
|
||||
18
libs/common/src/models/request/cipherBulkShareRequest.ts
Normal file
18
libs/common/src/models/request/cipherBulkShareRequest.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Cipher } from "../domain/cipher";
|
||||
|
||||
import { CipherWithIdRequest } from "./cipherWithIdRequest";
|
||||
|
||||
export class CipherBulkShareRequest {
|
||||
ciphers: CipherWithIdRequest[];
|
||||
collectionIds: string[];
|
||||
|
||||
constructor(ciphers: Cipher[], collectionIds: string[]) {
|
||||
if (ciphers != null) {
|
||||
this.ciphers = [];
|
||||
ciphers.forEach((c) => {
|
||||
this.ciphers.push(new CipherWithIdRequest(c));
|
||||
});
|
||||
}
|
||||
this.collectionIds = collectionIds;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
export class CipherCollectionsRequest {
|
||||
collectionIds: string[];
|
||||
|
||||
constructor(collectionIds: string[]) {
|
||||
this.collectionIds = collectionIds == null ? [] : collectionIds;
|
||||
}
|
||||
}
|
||||
13
libs/common/src/models/request/cipherCreateRequest.ts
Normal file
13
libs/common/src/models/request/cipherCreateRequest.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { Cipher } from "../domain/cipher";
|
||||
|
||||
import { CipherRequest } from "./cipherRequest";
|
||||
|
||||
export class CipherCreateRequest {
|
||||
cipher: CipherRequest;
|
||||
collectionIds: string[];
|
||||
|
||||
constructor(cipher: Cipher) {
|
||||
this.cipher = new CipherRequest(cipher);
|
||||
this.collectionIds = cipher.collectionIds;
|
||||
}
|
||||
}
|
||||
164
libs/common/src/models/request/cipherRequest.ts
Normal file
164
libs/common/src/models/request/cipherRequest.ts
Normal file
@@ -0,0 +1,164 @@
|
||||
import { CipherRepromptType } from "../../enums/cipherRepromptType";
|
||||
import { CipherType } from "../../enums/cipherType";
|
||||
import { CardApi } from "../api/cardApi";
|
||||
import { FieldApi } from "../api/fieldApi";
|
||||
import { IdentityApi } from "../api/identityApi";
|
||||
import { LoginApi } from "../api/loginApi";
|
||||
import { LoginUriApi } from "../api/loginUriApi";
|
||||
import { SecureNoteApi } from "../api/secureNoteApi";
|
||||
import { Cipher } from "../domain/cipher";
|
||||
|
||||
import { AttachmentRequest } from "./attachmentRequest";
|
||||
import { PasswordHistoryRequest } from "./passwordHistoryRequest";
|
||||
|
||||
export class CipherRequest {
|
||||
type: CipherType;
|
||||
folderId: string;
|
||||
organizationId: string;
|
||||
name: string;
|
||||
notes: string;
|
||||
favorite: boolean;
|
||||
login: LoginApi;
|
||||
secureNote: SecureNoteApi;
|
||||
card: CardApi;
|
||||
identity: IdentityApi;
|
||||
fields: FieldApi[];
|
||||
passwordHistory: PasswordHistoryRequest[];
|
||||
// Deprecated, remove at some point and rename attachments2 to attachments
|
||||
attachments: { [id: string]: string };
|
||||
attachments2: { [id: string]: AttachmentRequest };
|
||||
lastKnownRevisionDate: Date;
|
||||
reprompt: CipherRepromptType;
|
||||
|
||||
constructor(cipher: Cipher) {
|
||||
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;
|
||||
this.lastKnownRevisionDate = cipher.revisionDate;
|
||||
this.reprompt = cipher.reprompt;
|
||||
|
||||
switch (this.type) {
|
||||
case CipherType.Login:
|
||||
this.login = new LoginApi();
|
||||
this.login.uris = null;
|
||||
this.login.username = cipher.login.username ? cipher.login.username.encryptedString : null;
|
||||
this.login.password = cipher.login.password ? cipher.login.password.encryptedString : null;
|
||||
this.login.passwordRevisionDate =
|
||||
cipher.login.passwordRevisionDate != null
|
||||
? cipher.login.passwordRevisionDate.toISOString()
|
||||
: null;
|
||||
this.login.totp = cipher.login.totp ? cipher.login.totp.encryptedString : null;
|
||||
this.login.autofillOnPageLoad = cipher.login.autofillOnPageLoad;
|
||||
|
||||
if (cipher.login.uris != null) {
|
||||
this.login.uris = cipher.login.uris.map((u) => {
|
||||
const uri = new LoginUriApi();
|
||||
uri.uri = u.uri != null ? u.uri.encryptedString : null;
|
||||
uri.match = u.match != null ? u.match : null;
|
||||
return uri;
|
||||
});
|
||||
}
|
||||
break;
|
||||
case CipherType.SecureNote:
|
||||
this.secureNote = new SecureNoteApi();
|
||||
this.secureNote.type = cipher.secureNote.type;
|
||||
break;
|
||||
case CipherType.Card:
|
||||
this.card = new CardApi();
|
||||
this.card.cardholderName =
|
||||
cipher.card.cardholderName != null ? cipher.card.cardholderName.encryptedString : null;
|
||||
this.card.brand = cipher.card.brand != null ? cipher.card.brand.encryptedString : null;
|
||||
this.card.number = cipher.card.number != null ? cipher.card.number.encryptedString : null;
|
||||
this.card.expMonth =
|
||||
cipher.card.expMonth != null ? cipher.card.expMonth.encryptedString : null;
|
||||
this.card.expYear =
|
||||
cipher.card.expYear != null ? cipher.card.expYear.encryptedString : null;
|
||||
this.card.code = cipher.card.code != null ? cipher.card.code.encryptedString : null;
|
||||
break;
|
||||
case CipherType.Identity:
|
||||
this.identity = new IdentityApi();
|
||||
this.identity.title =
|
||||
cipher.identity.title != null ? cipher.identity.title.encryptedString : null;
|
||||
this.identity.firstName =
|
||||
cipher.identity.firstName != null ? cipher.identity.firstName.encryptedString : null;
|
||||
this.identity.middleName =
|
||||
cipher.identity.middleName != null ? cipher.identity.middleName.encryptedString : null;
|
||||
this.identity.lastName =
|
||||
cipher.identity.lastName != null ? cipher.identity.lastName.encryptedString : null;
|
||||
this.identity.address1 =
|
||||
cipher.identity.address1 != null ? cipher.identity.address1.encryptedString : null;
|
||||
this.identity.address2 =
|
||||
cipher.identity.address2 != null ? cipher.identity.address2.encryptedString : null;
|
||||
this.identity.address3 =
|
||||
cipher.identity.address3 != null ? cipher.identity.address3.encryptedString : null;
|
||||
this.identity.city =
|
||||
cipher.identity.city != null ? cipher.identity.city.encryptedString : null;
|
||||
this.identity.state =
|
||||
cipher.identity.state != null ? cipher.identity.state.encryptedString : null;
|
||||
this.identity.postalCode =
|
||||
cipher.identity.postalCode != null ? cipher.identity.postalCode.encryptedString : null;
|
||||
this.identity.country =
|
||||
cipher.identity.country != null ? cipher.identity.country.encryptedString : null;
|
||||
this.identity.company =
|
||||
cipher.identity.company != null ? cipher.identity.company.encryptedString : null;
|
||||
this.identity.email =
|
||||
cipher.identity.email != null ? cipher.identity.email.encryptedString : null;
|
||||
this.identity.phone =
|
||||
cipher.identity.phone != null ? cipher.identity.phone.encryptedString : null;
|
||||
this.identity.ssn =
|
||||
cipher.identity.ssn != null ? cipher.identity.ssn.encryptedString : null;
|
||||
this.identity.username =
|
||||
cipher.identity.username != null ? cipher.identity.username.encryptedString : null;
|
||||
this.identity.passportNumber =
|
||||
cipher.identity.passportNumber != null
|
||||
? cipher.identity.passportNumber.encryptedString
|
||||
: null;
|
||||
this.identity.licenseNumber =
|
||||
cipher.identity.licenseNumber != null
|
||||
? cipher.identity.licenseNumber.encryptedString
|
||||
: null;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (cipher.fields != null) {
|
||||
this.fields = cipher.fields.map((f) => {
|
||||
const field = new FieldApi();
|
||||
field.type = f.type;
|
||||
field.name = f.name ? f.name.encryptedString : null;
|
||||
field.value = f.value ? f.value.encryptedString : null;
|
||||
field.linkedId = f.linkedId;
|
||||
return field;
|
||||
});
|
||||
}
|
||||
|
||||
if (cipher.passwordHistory != null) {
|
||||
this.passwordHistory = [];
|
||||
cipher.passwordHistory.forEach((ph) => {
|
||||
this.passwordHistory.push({
|
||||
lastUsedDate: ph.lastUsedDate,
|
||||
password: ph.password ? ph.password.encryptedString : null,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (cipher.attachments != null) {
|
||||
this.attachments = {};
|
||||
this.attachments2 = {};
|
||||
cipher.attachments.forEach((attachment) => {
|
||||
const fileName = attachment.fileName ? attachment.fileName.encryptedString : null;
|
||||
this.attachments[attachment.id] = fileName;
|
||||
const attachmentRequest = new AttachmentRequest();
|
||||
attachmentRequest.fileName = fileName;
|
||||
if (attachment.key != null) {
|
||||
attachmentRequest.key = attachment.key.encryptedString;
|
||||
}
|
||||
this.attachments2[attachment.id] = attachmentRequest;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
13
libs/common/src/models/request/cipherShareRequest.ts
Normal file
13
libs/common/src/models/request/cipherShareRequest.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { Cipher } from "../domain/cipher";
|
||||
|
||||
import { CipherRequest } from "./cipherRequest";
|
||||
|
||||
export class CipherShareRequest {
|
||||
cipher: CipherRequest;
|
||||
collectionIds: string[];
|
||||
|
||||
constructor(cipher: Cipher) {
|
||||
this.cipher = new CipherRequest(cipher);
|
||||
this.collectionIds = cipher.collectionIds;
|
||||
}
|
||||
}
|
||||
12
libs/common/src/models/request/cipherWithIdRequest.ts
Normal file
12
libs/common/src/models/request/cipherWithIdRequest.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { Cipher } from "../domain/cipher";
|
||||
|
||||
import { CipherRequest } from "./cipherRequest";
|
||||
|
||||
export class CipherWithIdRequest extends CipherRequest {
|
||||
id: string;
|
||||
|
||||
constructor(cipher: Cipher) {
|
||||
super(cipher);
|
||||
this.id = cipher.id;
|
||||
}
|
||||
}
|
||||
17
libs/common/src/models/request/collectionRequest.ts
Normal file
17
libs/common/src/models/request/collectionRequest.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { Collection } from "../domain/collection";
|
||||
|
||||
import { SelectionReadOnlyRequest } from "./selectionReadOnlyRequest";
|
||||
|
||||
export class CollectionRequest {
|
||||
name: string;
|
||||
externalId: string;
|
||||
groups: SelectionReadOnlyRequest[] = [];
|
||||
|
||||
constructor(collection?: Collection) {
|
||||
if (collection == null) {
|
||||
return;
|
||||
}
|
||||
this.name = collection.name ? collection.name.encryptedString : null;
|
||||
this.externalId = collection.externalId;
|
||||
}
|
||||
}
|
||||
3
libs/common/src/models/request/deleteRecoverRequest.ts
Normal file
3
libs/common/src/models/request/deleteRecoverRequest.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export class DeleteRecoverRequest {
|
||||
email: string;
|
||||
}
|
||||
16
libs/common/src/models/request/deviceRequest.ts
Normal file
16
libs/common/src/models/request/deviceRequest.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { PlatformUtilsService } from "../../abstractions/platformUtils.service";
|
||||
import { DeviceType } from "../../enums/deviceType";
|
||||
|
||||
export class DeviceRequest {
|
||||
type: DeviceType;
|
||||
name: string;
|
||||
identifier: string;
|
||||
pushToken?: string;
|
||||
|
||||
constructor(appId: string, platformUtilsService: PlatformUtilsService) {
|
||||
this.type = platformUtilsService.getDevice();
|
||||
this.name = platformUtilsService.getDeviceString();
|
||||
this.identifier = appId;
|
||||
this.pushToken = null;
|
||||
}
|
||||
}
|
||||
7
libs/common/src/models/request/deviceTokenRequest.ts
Normal file
7
libs/common/src/models/request/deviceTokenRequest.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
export class DeviceTokenRequest {
|
||||
pushToken: string;
|
||||
|
||||
constructor() {
|
||||
this.pushToken = null;
|
||||
}
|
||||
}
|
||||
7
libs/common/src/models/request/emailRequest.ts
Normal file
7
libs/common/src/models/request/emailRequest.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { EmailTokenRequest } from "./emailTokenRequest";
|
||||
|
||||
export class EmailRequest extends EmailTokenRequest {
|
||||
newMasterPasswordHash: string;
|
||||
token: string;
|
||||
key: string;
|
||||
}
|
||||
6
libs/common/src/models/request/emailTokenRequest.ts
Normal file
6
libs/common/src/models/request/emailTokenRequest.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { SecretVerificationRequest } from "./secretVerificationRequest";
|
||||
|
||||
export class EmailTokenRequest extends SecretVerificationRequest {
|
||||
newEmail: string;
|
||||
masterPasswordHash: string;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export class EmergencyAccessAcceptRequest {
|
||||
token: string;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export class EmergencyAccessConfirmRequest {
|
||||
key: string;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import { EmergencyAccessType } from "../../enums/emergencyAccessType";
|
||||
|
||||
export class EmergencyAccessInviteRequest {
|
||||
email: string;
|
||||
type: EmergencyAccessType;
|
||||
waitTimeDays: number;
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
export class EmergencyAccessPasswordRequest {
|
||||
newMasterPasswordHash: string;
|
||||
key: string;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import { EmergencyAccessType } from "../../enums/emergencyAccessType";
|
||||
|
||||
export class EmergencyAccessUpdateRequest {
|
||||
type: EmergencyAccessType;
|
||||
waitTimeDays: number;
|
||||
keyEncrypted?: string;
|
||||
}
|
||||
7
libs/common/src/models/request/eventRequest.ts
Normal file
7
libs/common/src/models/request/eventRequest.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { EventType } from "../../enums/eventType";
|
||||
|
||||
export class EventRequest {
|
||||
type: EventType;
|
||||
cipherId: string;
|
||||
date: string;
|
||||
}
|
||||
9
libs/common/src/models/request/folderRequest.ts
Normal file
9
libs/common/src/models/request/folderRequest.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { Folder } from "../domain/folder";
|
||||
|
||||
export class FolderRequest {
|
||||
name: string;
|
||||
|
||||
constructor(folder: Folder) {
|
||||
this.name = folder.name ? folder.name.encryptedString : null;
|
||||
}
|
||||
}
|
||||
12
libs/common/src/models/request/folderWithIdRequest.ts
Normal file
12
libs/common/src/models/request/folderWithIdRequest.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { Folder } from "../domain/folder";
|
||||
|
||||
import { FolderRequest } from "./folderRequest";
|
||||
|
||||
export class FolderWithIdRequest extends FolderRequest {
|
||||
id: string;
|
||||
|
||||
constructor(folder: Folder) {
|
||||
super(folder);
|
||||
this.id = folder.id;
|
||||
}
|
||||
}
|
||||
8
libs/common/src/models/request/groupRequest.ts
Normal file
8
libs/common/src/models/request/groupRequest.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { SelectionReadOnlyRequest } from "./selectionReadOnlyRequest";
|
||||
|
||||
export class GroupRequest {
|
||||
name: string;
|
||||
accessAll: boolean;
|
||||
externalId: string;
|
||||
collections: SelectionReadOnlyRequest[] = [];
|
||||
}
|
||||
5
libs/common/src/models/request/iapCheckRequest.ts
Normal file
5
libs/common/src/models/request/iapCheckRequest.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import { PaymentMethodType } from "../../enums/paymentMethodType";
|
||||
|
||||
export class IapCheckRequest {
|
||||
paymentMethodType: PaymentMethodType;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { DeviceRequest } from "../deviceRequest";
|
||||
|
||||
import { TokenRequest } from "./tokenRequest";
|
||||
import { TokenRequestTwoFactor } from "./tokenRequestTwoFactor";
|
||||
|
||||
export class ApiTokenRequest extends TokenRequest {
|
||||
constructor(
|
||||
public clientId: string,
|
||||
public clientSecret: string,
|
||||
protected twoFactor: TokenRequestTwoFactor,
|
||||
device?: DeviceRequest
|
||||
) {
|
||||
super(twoFactor, device);
|
||||
}
|
||||
|
||||
toIdentityToken() {
|
||||
const obj = super.toIdentityToken(this.clientId);
|
||||
|
||||
obj.scope = this.clientId.startsWith("organization") ? "api.organization" : "api";
|
||||
obj.grant_type = "client_credentials";
|
||||
obj.client_secret = this.clientSecret;
|
||||
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
import { ClientType } from "../../../enums/clientType";
|
||||
import { Utils } from "../../../misc/utils";
|
||||
import { CaptchaProtectedRequest } from "../captchaProtectedRequest";
|
||||
import { DeviceRequest } from "../deviceRequest";
|
||||
|
||||
import { TokenRequest } from "./tokenRequest";
|
||||
import { TokenRequestTwoFactor } from "./tokenRequestTwoFactor";
|
||||
|
||||
export class PasswordTokenRequest extends TokenRequest implements CaptchaProtectedRequest {
|
||||
constructor(
|
||||
public email: string,
|
||||
public masterPasswordHash: string,
|
||||
public captchaResponse: string,
|
||||
protected twoFactor: TokenRequestTwoFactor,
|
||||
device?: DeviceRequest
|
||||
) {
|
||||
super(twoFactor, device);
|
||||
}
|
||||
|
||||
toIdentityToken(clientId: ClientType) {
|
||||
const obj = super.toIdentityToken(clientId);
|
||||
|
||||
obj.grant_type = "password";
|
||||
obj.username = this.email;
|
||||
obj.password = this.masterPasswordHash;
|
||||
|
||||
if (this.captchaResponse != null) {
|
||||
obj.captchaResponse = this.captchaResponse;
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
alterIdentityTokenHeaders(headers: Headers) {
|
||||
headers.set("Auth-Email", Utils.fromUtf8ToUrlB64(this.email));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
import { DeviceRequest } from "../deviceRequest";
|
||||
|
||||
import { TokenRequest } from "./tokenRequest";
|
||||
import { TokenRequestTwoFactor } from "./tokenRequestTwoFactor";
|
||||
|
||||
export class SsoTokenRequest extends TokenRequest {
|
||||
constructor(
|
||||
public code: string,
|
||||
public codeVerifier: string,
|
||||
public redirectUri: string,
|
||||
protected twoFactor: TokenRequestTwoFactor,
|
||||
device?: DeviceRequest
|
||||
) {
|
||||
super(twoFactor, device);
|
||||
}
|
||||
|
||||
toIdentityToken(clientId: string) {
|
||||
const obj = super.toIdentityToken(clientId);
|
||||
|
||||
obj.grant_type = "authorization_code";
|
||||
obj.code = this.code;
|
||||
obj.code_verifier = this.codeVerifier;
|
||||
obj.redirect_uri = this.redirectUri;
|
||||
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
43
libs/common/src/models/request/identityToken/tokenRequest.ts
Normal file
43
libs/common/src/models/request/identityToken/tokenRequest.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
import { DeviceRequest } from "../deviceRequest";
|
||||
|
||||
import { TokenRequestTwoFactor } from "./tokenRequestTwoFactor";
|
||||
|
||||
export abstract class TokenRequest {
|
||||
protected device?: DeviceRequest;
|
||||
|
||||
constructor(protected twoFactor: TokenRequestTwoFactor, device?: DeviceRequest) {
|
||||
this.device = device != null ? device : null;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line
|
||||
alterIdentityTokenHeaders(headers: Headers) {
|
||||
// Implemented in subclass if required
|
||||
}
|
||||
|
||||
setTwoFactor(twoFactor: TokenRequestTwoFactor) {
|
||||
this.twoFactor = twoFactor;
|
||||
}
|
||||
|
||||
protected toIdentityToken(clientId: string) {
|
||||
const obj: any = {
|
||||
scope: "api offline_access",
|
||||
client_id: clientId,
|
||||
};
|
||||
|
||||
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.twoFactor.token && this.twoFactor.provider != null) {
|
||||
obj.twoFactorToken = this.twoFactor.token;
|
||||
obj.twoFactorProvider = this.twoFactor.provider;
|
||||
obj.twoFactorRemember = this.twoFactor.remember ? "1" : "0";
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import { TwoFactorProviderType } from "jslib-common/enums/twoFactorProviderType";
|
||||
|
||||
export class TokenRequestTwoFactor {
|
||||
constructor(
|
||||
public provider: TwoFactorProviderType = null,
|
||||
public token: string = null,
|
||||
public remember: boolean = false
|
||||
) {}
|
||||
}
|
||||
9
libs/common/src/models/request/importCiphersRequest.ts
Normal file
9
libs/common/src/models/request/importCiphersRequest.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { CipherRequest } from "./cipherRequest";
|
||||
import { FolderRequest } from "./folderRequest";
|
||||
import { KvpRequest } from "./kvpRequest";
|
||||
|
||||
export class ImportCiphersRequest {
|
||||
ciphers: CipherRequest[] = [];
|
||||
folders: FolderRequest[] = [];
|
||||
folderRelationships: KvpRequest<number, number>[] = [];
|
||||
}
|
||||
9
libs/common/src/models/request/importDirectoryRequest.ts
Normal file
9
libs/common/src/models/request/importDirectoryRequest.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { ImportDirectoryRequestGroup } from "./importDirectoryRequestGroup";
|
||||
import { ImportDirectoryRequestUser } from "./importDirectoryRequestUser";
|
||||
|
||||
export class ImportDirectoryRequest {
|
||||
groups: ImportDirectoryRequestGroup[] = [];
|
||||
users: ImportDirectoryRequestUser[] = [];
|
||||
overwriteExisting = false;
|
||||
largeImport = false;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
export class ImportDirectoryRequestGroup {
|
||||
name: string;
|
||||
externalId: string;
|
||||
users: string[];
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
export class ImportDirectoryRequestUser {
|
||||
externalId: string;
|
||||
email: string;
|
||||
deleted: boolean;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import { CipherRequest } from "./cipherRequest";
|
||||
import { CollectionRequest } from "./collectionRequest";
|
||||
import { KvpRequest } from "./kvpRequest";
|
||||
|
||||
export class ImportOrganizationCiphersRequest {
|
||||
ciphers: CipherRequest[] = [];
|
||||
collections: CollectionRequest[] = [];
|
||||
collectionRelationships: KvpRequest<number, number>[] = [];
|
||||
}
|
||||
8
libs/common/src/models/request/kdfRequest.ts
Normal file
8
libs/common/src/models/request/kdfRequest.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { KdfType } from "../../enums/kdfType";
|
||||
|
||||
import { PasswordRequest } from "./passwordRequest";
|
||||
|
||||
export class KdfRequest extends PasswordRequest {
|
||||
kdf: KdfType;
|
||||
kdfIterations: number;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
export class KeyConnectorUserKeyRequest {
|
||||
key: string;
|
||||
|
||||
constructor(key: string) {
|
||||
this.key = key;
|
||||
}
|
||||
}
|
||||
9
libs/common/src/models/request/keysRequest.ts
Normal file
9
libs/common/src/models/request/keysRequest.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
export class KeysRequest {
|
||||
publicKey: string;
|
||||
encryptedPrivateKey: string;
|
||||
|
||||
constructor(publicKey: string, encryptedPrivateKey: string) {
|
||||
this.publicKey = publicKey;
|
||||
this.encryptedPrivateKey = encryptedPrivateKey;
|
||||
}
|
||||
}
|
||||
9
libs/common/src/models/request/kvpRequest.ts
Normal file
9
libs/common/src/models/request/kvpRequest.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
export class KvpRequest<TK, TV> {
|
||||
key: TK;
|
||||
value: TV;
|
||||
|
||||
constructor(key: TK, value: TV) {
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import { PlanSponsorshipType } from "../../../enums/planSponsorshipType";
|
||||
|
||||
export class OrganizationSponsorshipCreateRequest {
|
||||
sponsoredEmail: string;
|
||||
planSponsorshipType: PlanSponsorshipType;
|
||||
friendlyName: string;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import { PlanSponsorshipType } from "../../../enums/planSponsorshipType";
|
||||
|
||||
export class OrganizationSponsorshipRedeemRequest {
|
||||
planSponsorshipType: PlanSponsorshipType;
|
||||
sponsoredOrganizationId: string;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import { SsoConfigApi } from "../../api/ssoConfigApi";
|
||||
|
||||
export class OrganizationSsoRequest {
|
||||
enabled = false;
|
||||
data: SsoConfigApi;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import { OrganizationApiKeyType } from "../../enums/organizationApiKeyType";
|
||||
|
||||
import { SecretVerificationRequest } from "./secretVerificationRequest";
|
||||
|
||||
export class OrganizationApiKeyRequest extends SecretVerificationRequest {
|
||||
type: OrganizationApiKeyType = OrganizationApiKeyType.Default;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import { OrganizationConnectionType } from "jslib-common/enums/organizationConnectionType";
|
||||
|
||||
import { BillingSyncConfigRequest } from "./billingSyncConfigRequest";
|
||||
|
||||
/**API request config types for OrganizationConnectionRequest */
|
||||
export type OrganizationConnectionRequestConfigs = BillingSyncConfigRequest;
|
||||
|
||||
export class OrganizationConnectionRequest {
|
||||
constructor(
|
||||
public organizationId: string,
|
||||
public type: OrganizationConnectionType,
|
||||
public enabled: boolean,
|
||||
public config: OrganizationConnectionRequestConfigs
|
||||
) {}
|
||||
}
|
||||
27
libs/common/src/models/request/organizationCreateRequest.ts
Normal file
27
libs/common/src/models/request/organizationCreateRequest.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { PaymentMethodType } from "../../enums/paymentMethodType";
|
||||
import { PlanType } from "../../enums/planType";
|
||||
|
||||
import { OrganizationKeysRequest } from "./organizationKeysRequest";
|
||||
|
||||
export class OrganizationCreateRequest {
|
||||
name: string;
|
||||
businessName: string;
|
||||
billingEmail: string;
|
||||
planType: PlanType;
|
||||
key: string;
|
||||
keys: OrganizationKeysRequest;
|
||||
paymentMethodType: PaymentMethodType;
|
||||
paymentToken: string;
|
||||
additionalSeats: number;
|
||||
maxAutoscaleSeats: number;
|
||||
additionalStorageGb: number;
|
||||
premiumAccessAddon: boolean;
|
||||
collectionName: string;
|
||||
taxIdNumber: string;
|
||||
billingAddressLine1: string;
|
||||
billingAddressLine2: string;
|
||||
billingAddressCity: string;
|
||||
billingAddressState: string;
|
||||
billingAddressPostalCode: string;
|
||||
billingAddressCountry: string;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { ImportDirectoryRequestGroup } from "./importDirectoryRequestGroup";
|
||||
|
||||
export class OrganizationImportGroupRequest {
|
||||
name: string;
|
||||
externalId: string;
|
||||
memberExternalIds: string[];
|
||||
|
||||
constructor(model: Required<OrganizationImportGroupRequest> | ImportDirectoryRequestGroup) {
|
||||
this.name = model.name;
|
||||
this.externalId = model.externalId;
|
||||
|
||||
if (model instanceof ImportDirectoryRequestGroup) {
|
||||
this.memberExternalIds = model.users;
|
||||
} else {
|
||||
this.memberExternalIds = model.memberExternalIds;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { ImportDirectoryRequestUser } from "./importDirectoryRequestUser";
|
||||
|
||||
export class OrganizationImportMemberRequest {
|
||||
email: string;
|
||||
externalId: string;
|
||||
deleted: boolean;
|
||||
|
||||
constructor(model: Required<OrganizationImportMemberRequest> | ImportDirectoryRequestUser) {
|
||||
this.email = model.email;
|
||||
this.externalId = model.externalId;
|
||||
this.deleted = model.deleted;
|
||||
}
|
||||
}
|
||||
31
libs/common/src/models/request/organizationImportRequest.ts
Normal file
31
libs/common/src/models/request/organizationImportRequest.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { ImportDirectoryRequest } from "./importDirectoryRequest";
|
||||
import { OrganizationImportGroupRequest } from "./organizationImportGroupRequest";
|
||||
import { OrganizationImportMemberRequest } from "./organizationImportMemberRequest";
|
||||
|
||||
export class OrganizationImportRequest {
|
||||
groups: OrganizationImportGroupRequest[] = [];
|
||||
members: OrganizationImportMemberRequest[] = [];
|
||||
overwriteExisting = false;
|
||||
largeImport = false;
|
||||
|
||||
constructor(
|
||||
model:
|
||||
| {
|
||||
groups: Required<OrganizationImportGroupRequest>[];
|
||||
users: Required<OrganizationImportMemberRequest>[];
|
||||
overwriteExisting: boolean;
|
||||
largeImport: boolean;
|
||||
}
|
||||
| ImportDirectoryRequest
|
||||
) {
|
||||
if (model instanceof ImportDirectoryRequest) {
|
||||
this.groups = model.groups.map((g) => new OrganizationImportGroupRequest(g));
|
||||
this.members = model.users.map((u) => new OrganizationImportMemberRequest(u));
|
||||
} else {
|
||||
this.groups = model.groups.map((g) => new OrganizationImportGroupRequest(g));
|
||||
this.members = model.users.map((u) => new OrganizationImportMemberRequest(u));
|
||||
}
|
||||
this.overwriteExisting = model.overwriteExisting;
|
||||
this.largeImport = model.largeImport;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import { KeysRequest } from "./keysRequest";
|
||||
|
||||
export class OrganizationKeysRequest extends KeysRequest {
|
||||
constructor(publicKey: string, encryptedPrivateKey: string) {
|
||||
super(publicKey, encryptedPrivateKey);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export class OrganizationSubscriptionUpdateRequest {
|
||||
constructor(public seatAdjustment: number, public maxAutoscaleSeats?: number) {}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import { TaxInfoUpdateRequest } from "./taxInfoUpdateRequest";
|
||||
|
||||
export class OrganizationTaxInfoUpdateRequest extends TaxInfoUpdateRequest {
|
||||
taxId: string;
|
||||
line1: string;
|
||||
line2: string;
|
||||
city: string;
|
||||
state: string;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import { OrganizationKeysRequest } from "./organizationKeysRequest";
|
||||
|
||||
export class OrganizationUpdateRequest {
|
||||
name: string;
|
||||
identifier: string;
|
||||
businessName: string;
|
||||
billingEmail: string;
|
||||
keys: OrganizationKeysRequest;
|
||||
}
|
||||
14
libs/common/src/models/request/organizationUpgradeRequest.ts
Normal file
14
libs/common/src/models/request/organizationUpgradeRequest.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { PlanType } from "../../enums/planType";
|
||||
|
||||
import { OrganizationKeysRequest } from "./organizationKeysRequest";
|
||||
|
||||
export class OrganizationUpgradeRequest {
|
||||
businessName: string;
|
||||
planType: PlanType;
|
||||
additionalSeats: number;
|
||||
additionalStorageGb: number;
|
||||
premiumAccessAddon: boolean;
|
||||
billingAddressCountry: string;
|
||||
billingAddressPostalCode: string;
|
||||
keys: OrganizationKeysRequest;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export class OrganizationUserAcceptRequest {
|
||||
token: string;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
type OrganizationUserBulkRequestEntry = {
|
||||
id: string;
|
||||
key: string;
|
||||
};
|
||||
|
||||
export class OrganizationUserBulkConfirmRequest {
|
||||
keys: OrganizationUserBulkRequestEntry[];
|
||||
|
||||
constructor(keys: OrganizationUserBulkRequestEntry[]) {
|
||||
this.keys = keys;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
export class OrganizationUserBulkRequest {
|
||||
ids: string[];
|
||||
|
||||
constructor(ids: string[]) {
|
||||
this.ids = ids == null ? [] : ids;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export class OrganizationUserConfirmRequest {
|
||||
key: string;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { OrganizationUserType } from "../../enums/organizationUserType";
|
||||
import { PermissionsApi } from "../api/permissionsApi";
|
||||
|
||||
import { SelectionReadOnlyRequest } from "./selectionReadOnlyRequest";
|
||||
|
||||
export class OrganizationUserInviteRequest {
|
||||
emails: string[] = [];
|
||||
type: OrganizationUserType;
|
||||
accessAll: boolean;
|
||||
collections: SelectionReadOnlyRequest[] = [];
|
||||
permissions: PermissionsApi;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import { SecretVerificationRequest } from "./secretVerificationRequest";
|
||||
|
||||
export class OrganizationUserResetPasswordEnrollmentRequest extends SecretVerificationRequest {
|
||||
resetPasswordKey: string;
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
export class OrganizationUserResetPasswordRequest {
|
||||
newMasterPasswordHash: string;
|
||||
key: string;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export class OrganizationUserUpdateGroupsRequest {
|
||||
groupIds: string[] = [];
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import { OrganizationUserType } from "../../enums/organizationUserType";
|
||||
import { PermissionsApi } from "../api/permissionsApi";
|
||||
|
||||
import { SelectionReadOnlyRequest } from "./selectionReadOnlyRequest";
|
||||
|
||||
export class OrganizationUserUpdateRequest {
|
||||
type: OrganizationUserType;
|
||||
accessAll: boolean;
|
||||
collections: SelectionReadOnlyRequest[] = [];
|
||||
permissions: PermissionsApi;
|
||||
}
|
||||
7
libs/common/src/models/request/passwordHintRequest.ts
Normal file
7
libs/common/src/models/request/passwordHintRequest.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
export class PasswordHintRequest {
|
||||
email: string;
|
||||
|
||||
constructor(email: string) {
|
||||
this.email = email;
|
||||
}
|
||||
}
|
||||
4
libs/common/src/models/request/passwordHistoryRequest.ts
Normal file
4
libs/common/src/models/request/passwordHistoryRequest.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export class PasswordHistoryRequest {
|
||||
password: string;
|
||||
lastUsedDate: Date;
|
||||
}
|
||||
6
libs/common/src/models/request/passwordRequest.ts
Normal file
6
libs/common/src/models/request/passwordRequest.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { SecretVerificationRequest } from "./secretVerificationRequest";
|
||||
|
||||
export class PasswordRequest extends SecretVerificationRequest {
|
||||
newMasterPasswordHash: string;
|
||||
key: string;
|
||||
}
|
||||
7
libs/common/src/models/request/paymentRequest.ts
Normal file
7
libs/common/src/models/request/paymentRequest.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { PaymentMethodType } from "../../enums/paymentMethodType";
|
||||
import { OrganizationTaxInfoUpdateRequest } from "../request/organizationTaxInfoUpdateRequest";
|
||||
|
||||
export class PaymentRequest extends OrganizationTaxInfoUpdateRequest {
|
||||
paymentMethodType: PaymentMethodType;
|
||||
paymentToken: string;
|
||||
}
|
||||
7
libs/common/src/models/request/policyRequest.ts
Normal file
7
libs/common/src/models/request/policyRequest.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { PolicyType } from "../../enums/policyType";
|
||||
|
||||
export class PolicyRequest {
|
||||
type: PolicyType;
|
||||
enabled: boolean;
|
||||
data: any;
|
||||
}
|
||||
7
libs/common/src/models/request/preloginRequest.ts
Normal file
7
libs/common/src/models/request/preloginRequest.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
export class PreloginRequest {
|
||||
email: string;
|
||||
|
||||
constructor(email: string) {
|
||||
this.email = email;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
export class ProviderAddOrganizationRequest {
|
||||
organizationId: string;
|
||||
key: string;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import { OrganizationCreateRequest } from "../organizationCreateRequest";
|
||||
|
||||
export class ProviderOrganizationCreateRequest {
|
||||
constructor(
|
||||
public clientOwnerEmail: string,
|
||||
public organizationCreateRequest: OrganizationCreateRequest
|
||||
) {}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
export class ProviderSetupRequest {
|
||||
name: string;
|
||||
businessName: string;
|
||||
billingEmail: string;
|
||||
token: string;
|
||||
key: string;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
export class ProviderUpdateRequest {
|
||||
name: string;
|
||||
businessName: string;
|
||||
billingEmail: string;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export class ProviderUserAcceptRequest {
|
||||
token: string;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
type ProviderUserBulkRequestEntry = {
|
||||
id: string;
|
||||
key: string;
|
||||
};
|
||||
|
||||
export class ProviderUserBulkConfirmRequest {
|
||||
keys: ProviderUserBulkRequestEntry[];
|
||||
|
||||
constructor(keys: ProviderUserBulkRequestEntry[]) {
|
||||
this.keys = keys;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
export class ProviderUserBulkRequest {
|
||||
ids: string[];
|
||||
|
||||
constructor(ids: string[]) {
|
||||
this.ids = ids == null ? [] : ids;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export class ProviderUserConfirmRequest {
|
||||
key: string;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import { ProviderUserType } from "../../../enums/providerUserType";
|
||||
|
||||
export class ProviderUserInviteRequest {
|
||||
emails: string[] = [];
|
||||
type: ProviderUserType;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import { ProviderUserType } from "../../../enums/providerUserType";
|
||||
|
||||
export class ProviderUserUpdateRequest {
|
||||
type: ProviderUserType;
|
||||
}
|
||||
5
libs/common/src/models/request/referenceEventRequest.ts
Normal file
5
libs/common/src/models/request/referenceEventRequest.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
export class ReferenceEventRequest {
|
||||
id: string;
|
||||
layout: string;
|
||||
flow: string;
|
||||
}
|
||||
26
libs/common/src/models/request/registerRequest.ts
Normal file
26
libs/common/src/models/request/registerRequest.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { KdfType } from "../../enums/kdfType";
|
||||
|
||||
import { CaptchaProtectedRequest } from "./captchaProtectedRequest";
|
||||
import { KeysRequest } from "./keysRequest";
|
||||
import { ReferenceEventRequest } from "./referenceEventRequest";
|
||||
|
||||
export class RegisterRequest implements CaptchaProtectedRequest {
|
||||
masterPasswordHint: string;
|
||||
keys: KeysRequest;
|
||||
token: string;
|
||||
organizationUserId: string;
|
||||
|
||||
constructor(
|
||||
public email: string,
|
||||
public name: string,
|
||||
public masterPasswordHash: string,
|
||||
masterPasswordHint: string,
|
||||
public key: string,
|
||||
public kdf: KdfType,
|
||||
public kdfIterations: number,
|
||||
public referenceData: ReferenceEventRequest,
|
||||
public captchaResponse: string
|
||||
) {
|
||||
this.masterPasswordHint = masterPasswordHint ? masterPasswordHint : null;
|
||||
}
|
||||
}
|
||||
3
libs/common/src/models/request/seatRequest.ts
Normal file
3
libs/common/src/models/request/seatRequest.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export class SeatRequest {
|
||||
seatAdjustment: number;
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
export class SecretVerificationRequest {
|
||||
masterPasswordHash: string;
|
||||
otp: string;
|
||||
}
|
||||
11
libs/common/src/models/request/selectionReadOnlyRequest.ts
Normal file
11
libs/common/src/models/request/selectionReadOnlyRequest.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
export class SelectionReadOnlyRequest {
|
||||
id: string;
|
||||
readOnly: boolean;
|
||||
hidePasswords: boolean;
|
||||
|
||||
constructor(id: string, readOnly: boolean, hidePasswords: boolean) {
|
||||
this.id = id;
|
||||
this.readOnly = readOnly;
|
||||
this.hidePasswords = hidePasswords;
|
||||
}
|
||||
}
|
||||
3
libs/common/src/models/request/sendAccessRequest.ts
Normal file
3
libs/common/src/models/request/sendAccessRequest.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export class SendAccessRequest {
|
||||
password: string;
|
||||
}
|
||||
48
libs/common/src/models/request/sendRequest.ts
Normal file
48
libs/common/src/models/request/sendRequest.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
import { SendType } from "../../enums/sendType";
|
||||
import { SendFileApi } from "../api/sendFileApi";
|
||||
import { SendTextApi } from "../api/sendTextApi";
|
||||
import { Send } from "../domain/send";
|
||||
|
||||
export class SendRequest {
|
||||
type: SendType;
|
||||
fileLength?: number;
|
||||
name: string;
|
||||
notes: string;
|
||||
key: string;
|
||||
maxAccessCount?: number;
|
||||
expirationDate: string;
|
||||
deletionDate: string;
|
||||
text: SendTextApi;
|
||||
file: SendFileApi;
|
||||
password: string;
|
||||
disabled: boolean;
|
||||
hideEmail: boolean;
|
||||
|
||||
constructor(send: Send, fileLength?: number) {
|
||||
this.type = send.type;
|
||||
this.fileLength = fileLength;
|
||||
this.name = send.name ? send.name.encryptedString : null;
|
||||
this.notes = send.notes ? send.notes.encryptedString : null;
|
||||
this.maxAccessCount = send.maxAccessCount;
|
||||
this.expirationDate = send.expirationDate != null ? send.expirationDate.toISOString() : null;
|
||||
this.deletionDate = send.deletionDate != null ? send.deletionDate.toISOString() : null;
|
||||
this.key = send.key != null ? send.key.encryptedString : null;
|
||||
this.password = send.password;
|
||||
this.disabled = send.disabled;
|
||||
this.hideEmail = send.hideEmail;
|
||||
|
||||
switch (this.type) {
|
||||
case SendType.Text:
|
||||
this.text = new SendTextApi();
|
||||
this.text.text = send.text.text != null ? send.text.text.encryptedString : null;
|
||||
this.text.hidden = send.text.hidden;
|
||||
break;
|
||||
case SendType.File:
|
||||
this.file = new SendFileApi();
|
||||
this.file.fileName = send.file.fileName != null ? send.file.fileName.encryptedString : null;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
12
libs/common/src/models/request/sendWithIdRequest.ts
Normal file
12
libs/common/src/models/request/sendWithIdRequest.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { Send } from "../domain/send";
|
||||
|
||||
import { SendRequest } from "./sendRequest";
|
||||
|
||||
export class SendWithIdRequest extends SendRequest {
|
||||
id: string;
|
||||
|
||||
constructor(send: Send) {
|
||||
super(send);
|
||||
this.id = send.id;
|
||||
}
|
||||
}
|
||||
31
libs/common/src/models/request/setPasswordRequest.ts
Normal file
31
libs/common/src/models/request/setPasswordRequest.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { KdfType } from "../../enums/kdfType";
|
||||
|
||||
import { KeysRequest } from "./keysRequest";
|
||||
|
||||
export class SetPasswordRequest {
|
||||
masterPasswordHash: string;
|
||||
key: string;
|
||||
masterPasswordHint: string;
|
||||
keys: KeysRequest;
|
||||
kdf: KdfType;
|
||||
kdfIterations: number;
|
||||
orgIdentifier: string;
|
||||
|
||||
constructor(
|
||||
masterPasswordHash: string,
|
||||
key: string,
|
||||
masterPasswordHint: string,
|
||||
kdf: KdfType,
|
||||
kdfIterations: number,
|
||||
orgIdentifier: string,
|
||||
keys: KeysRequest
|
||||
) {
|
||||
this.masterPasswordHash = masterPasswordHash;
|
||||
this.key = key;
|
||||
this.masterPasswordHint = masterPasswordHint;
|
||||
this.kdf = kdf;
|
||||
this.kdfIterations = kdfIterations;
|
||||
this.orgIdentifier = orgIdentifier;
|
||||
this.keys = keys;
|
||||
}
|
||||
}
|
||||
3
libs/common/src/models/request/storageRequest.ts
Normal file
3
libs/common/src/models/request/storageRequest.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export class StorageRequest {
|
||||
storageGbAdjustment: number;
|
||||
}
|
||||
4
libs/common/src/models/request/taxInfoUpdateRequest.ts
Normal file
4
libs/common/src/models/request/taxInfoUpdateRequest.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export class TaxInfoUpdateRequest {
|
||||
country: string;
|
||||
postalCode: string;
|
||||
}
|
||||
6
libs/common/src/models/request/twoFactorEmailRequest.ts
Normal file
6
libs/common/src/models/request/twoFactorEmailRequest.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { SecretVerificationRequest } from "./secretVerificationRequest";
|
||||
|
||||
export class TwoFactorEmailRequest extends SecretVerificationRequest {
|
||||
email: string;
|
||||
deviceIdentifier: string;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import { TwoFactorProviderType } from "../../enums/twoFactorProviderType";
|
||||
|
||||
import { SecretVerificationRequest } from "./secretVerificationRequest";
|
||||
|
||||
export class TwoFactorProviderRequest extends SecretVerificationRequest {
|
||||
type: TwoFactorProviderType;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import { SecretVerificationRequest } from "./secretVerificationRequest";
|
||||
|
||||
export class TwoFactorRecoveryRequest extends SecretVerificationRequest {
|
||||
recoveryCode: string;
|
||||
email: string;
|
||||
}
|
||||
4
libs/common/src/models/request/updateDomainsRequest.ts
Normal file
4
libs/common/src/models/request/updateDomainsRequest.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export class UpdateDomainsRequest {
|
||||
equivalentDomains: string[][];
|
||||
excludedGlobalEquivalentDomains: number[];
|
||||
}
|
||||
12
libs/common/src/models/request/updateKeyRequest.ts
Normal file
12
libs/common/src/models/request/updateKeyRequest.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { CipherWithIdRequest } from "./cipherWithIdRequest";
|
||||
import { FolderWithIdRequest } from "./folderWithIdRequest";
|
||||
import { SendWithIdRequest } from "./sendWithIdRequest";
|
||||
|
||||
export class UpdateKeyRequest {
|
||||
ciphers: CipherWithIdRequest[] = [];
|
||||
folders: FolderWithIdRequest[] = [];
|
||||
sends: SendWithIdRequest[] = [];
|
||||
masterPasswordHash: string;
|
||||
privateKey: string;
|
||||
key: string;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user