1
0
mirror of https://github.com/bitwarden/jslib synced 2026-01-02 16:43:39 +00:00
Files
jslib/src/models/domain/sendText.ts
Kyle Spearrin 0e9e73ce95 Some groundwork for Send (#192)
* send work

* New method to update the last used index (#184)

Instead of updating it every time you call getNext(), it will be updated in a separate call, to avoid updating the index when the cipher did not auto-fill correctly (e.g wrong frame)
Fixes #1392

* added OnlyOrg to PolicyType enum (#183)

* [Require SSO] Add policy type enumeration (#186)

* Added SsoAuthentication policy type

* Updated policy type name // added comments for clarification of what each type controls

* [SSO] New user provision flow (#173)

* Initial commit of new user sso flow

* Adjusted stateSplit conditional per review

* Add logging to lowdb storage service (#188)

* Fix lint errors/warnings (#187)

* remove password api

* access id

* makeSendKey

Co-authored-by: Josep Marí <xusoo@users.noreply.github.com>
Co-authored-by: Addison Beck <abeck@bitwarden.com>
Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com>
Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com>
2020-11-02 15:58:18 -05:00

40 lines
1012 B
TypeScript

import { CipherString } from './cipherString';
import Domain from './domainBase';
import { SymmetricCryptoKey } from './symmetricCryptoKey';
import { SendTextData } from '../data/sendTextData';
import { SendTextView } from '../view/sendTextView';
export class SendText extends Domain {
text: CipherString;
hidden: boolean;
constructor(obj?: SendTextData, alreadyEncrypted: boolean = false) {
super();
if (obj == null) {
return;
}
this.hidden = obj.hidden;
this.buildDomainModel(this, obj, {
text: null,
}, alreadyEncrypted, []);
}
decrypt(key: SymmetricCryptoKey): Promise<SendTextView> {
return this.decryptObj(new SendTextView(this), {
text: null,
}, null, key);
}
toSendTextData(): SendTextData {
const t = new SendTextData();
this.buildDataModel(this, t, {
text: null,
hidden: null,
}, ['hidden']);
return t;
}
}