mirror of
https://github.com/bitwarden/browser
synced 2025-12-22 19:23:52 +00:00
typescript models
This commit is contained in:
@@ -68,72 +68,3 @@ window.CipherRequest = function (cipher) {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
window.FolderRequest = function (folder) {
|
||||
this.name = folder.name ? folder.name.encryptedString : null;
|
||||
};
|
||||
|
||||
window.TokenRequest = function (email, masterPasswordHash, provider, token, remember, device) {
|
||||
this.email = email;
|
||||
this.masterPasswordHash = masterPasswordHash;
|
||||
this.token = token;
|
||||
this.provider = provider;
|
||||
this.remember = remember === true;
|
||||
this.device = null;
|
||||
if (device) {
|
||||
this.device = device;
|
||||
}
|
||||
};
|
||||
|
||||
window.TokenRequest.prototype.toIdentityToken = function () {
|
||||
var obj = {
|
||||
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;
|
||||
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;
|
||||
};
|
||||
|
||||
window.RegisterRequest = function (email, masterPasswordHash, masterPasswordHint, key) {
|
||||
this.name = null;
|
||||
this.email = email;
|
||||
this.masterPasswordHash = masterPasswordHash;
|
||||
this.masterPasswordHint = masterPasswordHint ? masterPasswordHint : null;
|
||||
this.key = key;
|
||||
};
|
||||
|
||||
window.PasswordHintRequest = function (email) {
|
||||
this.email = email;
|
||||
};
|
||||
|
||||
window.TwoFactorEmailRequest = function (email, masterPasswordHash) {
|
||||
this.email = email;
|
||||
this.masterPasswordHash = masterPasswordHash;
|
||||
};
|
||||
|
||||
window.DeviceTokenRequest = function () {
|
||||
this.pushToken = null;
|
||||
};
|
||||
|
||||
window.DeviceRequest = function (appId, utilsService) {
|
||||
this.type = utilsService.getDeviceType();
|
||||
this.name = utilsService.getBrowser();
|
||||
this.identifier = appId;
|
||||
this.pushToken = null;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user