mirror of
https://github.com/bitwarden/jslib
synced 2025-12-17 16:53:20 +00:00
support for encrypted json export (#216)
* support for encrypted json export * adjust filename prefix for encrypted formats * flip if logic * remove format param from encrypted export * encryptedFormat getter
This commit is contained in:
@@ -2,6 +2,8 @@ import { CipherType } from '../../enums/cipherType';
|
||||
|
||||
import { CipherView } from '../view/cipherView';
|
||||
|
||||
import { Cipher as CipherDomain } from '../domain/cipher';
|
||||
|
||||
import { Card } from './card';
|
||||
import { Field } from './field';
|
||||
import { Identity } from './identity';
|
||||
@@ -70,16 +72,27 @@ export class Cipher {
|
||||
identity: Identity;
|
||||
|
||||
// Use build method instead of ctor so that we can control order of JSON stringify for pretty print
|
||||
build(o: CipherView) {
|
||||
build(o: CipherView | CipherDomain) {
|
||||
this.organizationId = o.organizationId;
|
||||
this.folderId = o.folderId;
|
||||
this.type = o.type;
|
||||
this.name = o.name;
|
||||
this.notes = o.notes;
|
||||
|
||||
if (o instanceof CipherView) {
|
||||
this.name = o.name;
|
||||
this.notes = o.notes;
|
||||
} else {
|
||||
this.name = o.name?.encryptedString;
|
||||
this.notes = o.notes?.encryptedString;
|
||||
}
|
||||
|
||||
this.favorite = o.favorite;
|
||||
|
||||
if (o.fields != null) {
|
||||
this.fields = o.fields.map((f) => new Field(f));
|
||||
if (o instanceof CipherView) {
|
||||
this.fields = o.fields.map((f) => new Field(f));
|
||||
} else {
|
||||
this.fields = o.fields.map((f) => new Field(f));
|
||||
}
|
||||
}
|
||||
|
||||
switch (o.type) {
|
||||
|
||||
Reference in New Issue
Block a user