mirror of
https://github.com/bitwarden/browser
synced 2025-12-22 11:13:46 +00:00
[deps] Autofill: Update prettier to v3 (#7014)
* [deps] Autofill: Update prettier to v3 * prettier formatting updates --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Jonathan Prusik <jprusik@classynemesis.com>
This commit is contained in:
@@ -16,7 +16,7 @@ export class AviraCsvImporter extends BaseImporter implements Importer {
|
||||
const cipher = this.initLoginCipher();
|
||||
cipher.name = this.getValueOrDefault(
|
||||
value.name,
|
||||
this.getValueOrDefault(this.nameFromUrl(value.website), "--")
|
||||
this.getValueOrDefault(this.nameFromUrl(value.website), "--"),
|
||||
);
|
||||
cipher.login.uris = this.makeUriArray(value.website);
|
||||
cipher.login.password = this.getValueOrDefault(value.password);
|
||||
|
||||
@@ -146,7 +146,7 @@ export abstract class BaseImporter {
|
||||
const parseOptions: papa.ParseConfig<string> = Object.assign(
|
||||
{ header: header },
|
||||
this.parseCsvOptions,
|
||||
options
|
||||
options,
|
||||
);
|
||||
data = this.splitNewLine(data).join("\n").trim();
|
||||
const result = papa.parse(data, parseOptions);
|
||||
@@ -321,7 +321,7 @@ export abstract class BaseImporter {
|
||||
cipher: CipherView,
|
||||
key: string,
|
||||
value: string,
|
||||
type: FieldType = FieldType.Text
|
||||
type: FieldType = FieldType.Text,
|
||||
) {
|
||||
if (this.isNullOrWhitespace(value)) {
|
||||
return;
|
||||
|
||||
@@ -55,7 +55,7 @@ export class BitwardenCsvImporter extends BaseImporter implements Importer {
|
||||
try {
|
||||
cipher.reprompt = parseInt(
|
||||
this.getValueOrDefault(value.reprompt, CipherRepromptType.None.toString()),
|
||||
10
|
||||
10,
|
||||
);
|
||||
} catch (e) {
|
||||
// eslint-disable-next-line
|
||||
|
||||
@@ -27,7 +27,7 @@ export class BitwardenJsonImporter extends BaseImporter implements Importer {
|
||||
protected constructor(
|
||||
protected cryptoService: CryptoService,
|
||||
protected i18nService: I18nService,
|
||||
protected cipherService: CipherService
|
||||
protected cipherService: CipherService,
|
||||
) {
|
||||
super();
|
||||
}
|
||||
@@ -50,14 +50,14 @@ export class BitwardenJsonImporter extends BaseImporter implements Importer {
|
||||
}
|
||||
|
||||
private async parseEncrypted(
|
||||
results: BitwardenEncryptedIndividualJsonExport | BitwardenEncryptedOrgJsonExport
|
||||
results: BitwardenEncryptedIndividualJsonExport | BitwardenEncryptedOrgJsonExport,
|
||||
) {
|
||||
if (results.encKeyValidation_DO_NOT_EDIT != null) {
|
||||
const orgKey = await this.cryptoService.getOrgKey(this.organizationId);
|
||||
const encKeyValidation = new EncString(results.encKeyValidation_DO_NOT_EDIT);
|
||||
const encKeyValidationDecrypt = await this.cryptoService.decryptToUtf8(
|
||||
encKeyValidation,
|
||||
orgKey
|
||||
orgKey,
|
||||
);
|
||||
if (encKeyValidationDecrypt === null) {
|
||||
this.result.success = false;
|
||||
@@ -99,7 +99,7 @@ export class BitwardenJsonImporter extends BaseImporter implements Importer {
|
||||
}
|
||||
|
||||
const view = await cipher.decrypt(
|
||||
await this.cipherService.getKeyForCipherKeyDecryption(cipher)
|
||||
await this.cipherService.getKeyForCipherKeyDecryption(cipher),
|
||||
);
|
||||
this.cleanupCipher(view);
|
||||
this.result.ciphers.push(view);
|
||||
@@ -109,7 +109,7 @@ export class BitwardenJsonImporter extends BaseImporter implements Importer {
|
||||
}
|
||||
|
||||
private async parseDecrypted(
|
||||
results: BitwardenUnEncryptedIndividualJsonExport | BitwardenUnEncryptedOrgJsonExport
|
||||
results: BitwardenUnEncryptedIndividualJsonExport | BitwardenUnEncryptedOrgJsonExport,
|
||||
) {
|
||||
const groupingsMap = this.organization
|
||||
? await this.parseCollections(results as BitwardenUnEncryptedOrgJsonExport)
|
||||
@@ -151,7 +151,7 @@ export class BitwardenJsonImporter extends BaseImporter implements Importer {
|
||||
}
|
||||
|
||||
private async parseFolders(
|
||||
data: BitwardenUnEncryptedIndividualJsonExport | BitwardenEncryptedIndividualJsonExport
|
||||
data: BitwardenUnEncryptedIndividualJsonExport | BitwardenEncryptedIndividualJsonExport,
|
||||
): Promise<Map<string, number>> | null {
|
||||
if (data.folders == null) {
|
||||
return null;
|
||||
@@ -179,7 +179,7 @@ export class BitwardenJsonImporter extends BaseImporter implements Importer {
|
||||
}
|
||||
|
||||
private async parseCollections(
|
||||
data: BitwardenUnEncryptedOrgJsonExport | BitwardenEncryptedOrgJsonExport
|
||||
data: BitwardenUnEncryptedOrgJsonExport | BitwardenEncryptedOrgJsonExport,
|
||||
): Promise<Map<string, number>> | null {
|
||||
if (data.collections == null) {
|
||||
return null;
|
||||
|
||||
@@ -19,7 +19,7 @@ export class BitwardenPasswordProtectedImporter extends BitwardenJsonImporter im
|
||||
cryptoService: CryptoService,
|
||||
i18nService: I18nService,
|
||||
cipherService: CipherService,
|
||||
private promptForPassword_callback: () => Promise<string>
|
||||
private promptForPassword_callback: () => Promise<string>,
|
||||
) {
|
||||
super(cryptoService, i18nService, cipherService);
|
||||
}
|
||||
@@ -63,7 +63,7 @@ export class BitwardenPasswordProtectedImporter extends BitwardenJsonImporter im
|
||||
|
||||
private async checkPassword(
|
||||
jdoc: BitwardenPasswordProtectedFileFormat,
|
||||
password: string
|
||||
password: string,
|
||||
): Promise<boolean> {
|
||||
if (this.isNullOrWhitespace(password)) {
|
||||
return false;
|
||||
@@ -73,14 +73,14 @@ export class BitwardenPasswordProtectedImporter extends BitwardenJsonImporter im
|
||||
password,
|
||||
jdoc.salt,
|
||||
jdoc.kdfType,
|
||||
new KdfConfig(jdoc.kdfIterations, jdoc.kdfMemory, jdoc.kdfParallelism)
|
||||
new KdfConfig(jdoc.kdfIterations, jdoc.kdfMemory, jdoc.kdfParallelism),
|
||||
);
|
||||
|
||||
const encKeyValidation = new EncString(jdoc.encKeyValidation_DO_NOT_EDIT);
|
||||
|
||||
const encKeyValidationDecrypt = await this.cryptoService.decryptToUtf8(
|
||||
encKeyValidation,
|
||||
this.key
|
||||
this.key,
|
||||
);
|
||||
if (encKeyValidationDecrypt === null) {
|
||||
return false;
|
||||
|
||||
@@ -19,7 +19,7 @@ export class BlurCsvImporter extends BaseImporter implements Importer {
|
||||
const cipher = this.initLoginCipher();
|
||||
cipher.name = this.getValueOrDefault(
|
||||
value.label,
|
||||
this.getValueOrDefault(this.nameFromUrl(value.domain), "--")
|
||||
this.getValueOrDefault(this.nameFromUrl(value.domain), "--"),
|
||||
);
|
||||
cipher.login.uris = this.makeUriArray(value.domain);
|
||||
cipher.login.password = this.getValueOrDefault(value.password);
|
||||
|
||||
@@ -67,7 +67,7 @@ export class DashlaneJsonImporter extends BaseImporter implements Importer {
|
||||
|
||||
cipher.login.username = this.getValueOrDefault(
|
||||
credential.login,
|
||||
this.getValueOrDefault(credential.secondaryLogin)
|
||||
this.getValueOrDefault(credential.secondaryLogin),
|
||||
);
|
||||
if (this.isNullOrWhitespace(cipher.login.username)) {
|
||||
cipher.login.username = this.getValueOrDefault(credential.email);
|
||||
|
||||
@@ -102,7 +102,7 @@ export class EnpassJsonImporter extends BaseImporter implements Importer {
|
||||
cipher,
|
||||
field.label,
|
||||
field.value,
|
||||
field.sensitive === 1 ? FieldType.Hidden : FieldType.Text
|
||||
field.sensitive === 1 ? FieldType.Hidden : FieldType.Text,
|
||||
);
|
||||
}
|
||||
});
|
||||
@@ -134,7 +134,7 @@ export class EnpassJsonImporter extends BaseImporter implements Importer {
|
||||
cipher,
|
||||
field.label,
|
||||
field.value,
|
||||
field.sensitive === 1 ? FieldType.Hidden : FieldType.Text
|
||||
field.sensitive === 1 ? FieldType.Hidden : FieldType.Text,
|
||||
);
|
||||
}
|
||||
} else {
|
||||
@@ -142,7 +142,7 @@ export class EnpassJsonImporter extends BaseImporter implements Importer {
|
||||
cipher,
|
||||
field.label,
|
||||
field.value,
|
||||
field.sensitive === 1 ? FieldType.Hidden : FieldType.Text
|
||||
field.sensitive === 1 ? FieldType.Hidden : FieldType.Text,
|
||||
);
|
||||
}
|
||||
});
|
||||
@@ -157,7 +157,7 @@ export class EnpassJsonImporter extends BaseImporter implements Importer {
|
||||
cipher,
|
||||
field.label,
|
||||
field.value,
|
||||
field.sensitive === 1 ? FieldType.Hidden : FieldType.Text
|
||||
field.sensitive === 1 ? FieldType.Hidden : FieldType.Text,
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -185,7 +185,7 @@ export class EnpassJsonImporter extends BaseImporter implements Importer {
|
||||
private flattenFolderTree(
|
||||
titlePrefix: string,
|
||||
tree: EnpassFolderTreeItem[],
|
||||
map: Map<string, string>
|
||||
map: Map<string, string>,
|
||||
) {
|
||||
if (tree == null) {
|
||||
return;
|
||||
|
||||
@@ -4,7 +4,7 @@ export class OobResult {
|
||||
constructor(
|
||||
public waitForOutOfBand: boolean,
|
||||
public passcode: string,
|
||||
public rememberMe: boolean
|
||||
public rememberMe: boolean,
|
||||
) {}
|
||||
|
||||
waitForApproval(rememberMe: boolean) {
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
export class OtpResult {
|
||||
static cancel = new OtpResult("cancel", false);
|
||||
|
||||
constructor(public passcode: string, public rememberMe: boolean) {}
|
||||
constructor(
|
||||
public passcode: string,
|
||||
public rememberMe: boolean,
|
||||
) {}
|
||||
}
|
||||
|
||||
@@ -31,14 +31,17 @@ const KnownOtpMethods = new Map<string, OtpMethod>([
|
||||
]);
|
||||
|
||||
export class Client {
|
||||
constructor(private parser: Parser, private cryptoUtils: CryptoUtils) {}
|
||||
constructor(
|
||||
private parser: Parser,
|
||||
private cryptoUtils: CryptoUtils,
|
||||
) {}
|
||||
|
||||
async openVault(
|
||||
username: string,
|
||||
password: string,
|
||||
clientInfo: ClientInfo,
|
||||
ui: Ui,
|
||||
options: ParserOptions
|
||||
options: ParserOptions,
|
||||
): Promise<Account[]> {
|
||||
const lowercaseUsername = username.toLowerCase();
|
||||
const [session, rest] = await this.login(lowercaseUsername, password, clientInfo, ui);
|
||||
@@ -47,7 +50,7 @@ export class Client {
|
||||
const key = await this.cryptoUtils.deriveKey(
|
||||
lowercaseUsername,
|
||||
password,
|
||||
session.keyIterationCount
|
||||
session.keyIterationCount,
|
||||
);
|
||||
|
||||
let privateKey: Uint8Array = null;
|
||||
@@ -65,7 +68,7 @@ export class Client {
|
||||
blob: Uint8Array,
|
||||
encryptionKey: Uint8Array,
|
||||
privateKey: Uint8Array,
|
||||
options: ParserOptions
|
||||
options: ParserOptions,
|
||||
): Promise<Account[]> {
|
||||
const reader = new BinaryReader(blob);
|
||||
const chunks = this.parser.extractChunks(reader);
|
||||
@@ -79,7 +82,7 @@ export class Client {
|
||||
chunks: Chunk[],
|
||||
encryptionKey: Uint8Array,
|
||||
privateKey: Uint8Array,
|
||||
options: ParserOptions
|
||||
options: ParserOptions,
|
||||
): Promise<Account[]> {
|
||||
const accounts = new Array<Account>();
|
||||
let folder: SharedFolder = null;
|
||||
@@ -109,7 +112,7 @@ export class Client {
|
||||
username: string,
|
||||
password: string,
|
||||
clientInfo: ClientInfo,
|
||||
ui: Ui
|
||||
ui: Ui,
|
||||
): Promise<[Session, RestClient]> {
|
||||
const rest = new RestClient();
|
||||
rest.baseUrl = "https://lastpass.com";
|
||||
@@ -142,7 +145,7 @@ export class Client {
|
||||
keyIterationCount,
|
||||
new Map<string, any>(),
|
||||
clientInfo,
|
||||
rest
|
||||
rest,
|
||||
);
|
||||
|
||||
session = this.extractSessionFromLoginResponse(response, keyIterationCount, clientInfo);
|
||||
@@ -192,7 +195,7 @@ export class Client {
|
||||
optMethod,
|
||||
clientInfo,
|
||||
ui,
|
||||
rest
|
||||
rest,
|
||||
);
|
||||
} else if (cause === "outofbandrequired") {
|
||||
// 3.2. Some out-of-bound authentication is enabled. This does not require any
|
||||
@@ -204,7 +207,7 @@ export class Client {
|
||||
this.getAllErrorAttributes(response),
|
||||
clientInfo,
|
||||
ui,
|
||||
rest
|
||||
rest,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -224,7 +227,7 @@ export class Client {
|
||||
method: OtpMethod,
|
||||
clientInfo: ClientInfo,
|
||||
ui: Ui,
|
||||
rest: RestClient
|
||||
rest: RestClient,
|
||||
): Promise<Session> {
|
||||
let passcode: OtpResult = null;
|
||||
switch (method) {
|
||||
@@ -251,7 +254,7 @@ export class Client {
|
||||
keyIterationCount,
|
||||
new Map<string, string>([["otp", passcode.passcode]]),
|
||||
clientInfo,
|
||||
rest
|
||||
rest,
|
||||
);
|
||||
|
||||
const session = this.extractSessionFromLoginResponse(response, keyIterationCount, clientInfo);
|
||||
@@ -271,7 +274,7 @@ export class Client {
|
||||
parameters: Map<string, string>,
|
||||
clientInfo: ClientInfo,
|
||||
ui: Ui,
|
||||
rest: RestClient
|
||||
rest: RestClient,
|
||||
): Promise<Session> {
|
||||
// In case of the OOB auth the server doesn't respond instantly. This works more like a long poll.
|
||||
// The server times out in about 10 seconds so there's no need to back off.
|
||||
@@ -282,7 +285,7 @@ export class Client {
|
||||
keyIterationCount,
|
||||
extraParameters,
|
||||
clientInfo,
|
||||
rest
|
||||
rest,
|
||||
);
|
||||
|
||||
const session = this.extractSessionFromLoginResponse(response, keyIterationCount, clientInfo);
|
||||
@@ -335,7 +338,7 @@ export class Client {
|
||||
username: string,
|
||||
parameters: Map<string, string>,
|
||||
ui: Ui,
|
||||
rest: RestClient
|
||||
rest: RestClient,
|
||||
): Promise<OobResult> {
|
||||
const method = parameters.get("outofbandtype");
|
||||
if (method == null) {
|
||||
@@ -357,7 +360,7 @@ export class Client {
|
||||
username: string,
|
||||
parameters: Map<string, string>,
|
||||
ui: Ui,
|
||||
rest: RestClient
|
||||
rest: RestClient,
|
||||
): Promise<OobResult> {
|
||||
return parameters.get("preferduowebsdk") == "1"
|
||||
? this.approveDuoWebSdk(username, parameters, ui, rest)
|
||||
@@ -368,7 +371,7 @@ export class Client {
|
||||
username: string,
|
||||
parameters: Map<string, string>,
|
||||
ui: Ui,
|
||||
rest: RestClient
|
||||
rest: RestClient,
|
||||
): Promise<OobResult> {
|
||||
// TODO: implement this instead of calling `approveDuo`
|
||||
return ui.approveDuo();
|
||||
@@ -384,7 +387,7 @@ export class Client {
|
||||
"trust.php",
|
||||
parameters,
|
||||
null,
|
||||
this.getSessionCookies(session)
|
||||
this.getSessionCookies(session),
|
||||
);
|
||||
if (response.status == HttpStatusCode.Ok) {
|
||||
return;
|
||||
@@ -401,7 +404,7 @@ export class Client {
|
||||
"logout.php",
|
||||
parameters,
|
||||
null,
|
||||
this.getSessionCookies(session)
|
||||
this.getSessionCookies(session),
|
||||
);
|
||||
if (response.status == HttpStatusCode.Ok) {
|
||||
return;
|
||||
@@ -460,7 +463,7 @@ export class Client {
|
||||
private extractSessionFromLoginResponse(
|
||||
response: Document,
|
||||
keyIterationCount: number,
|
||||
clientInfo: ClientInfo
|
||||
clientInfo: ClientInfo,
|
||||
): Session {
|
||||
const ok = response.querySelector("response > ok");
|
||||
if (ok == null) {
|
||||
@@ -494,7 +497,7 @@ export class Client {
|
||||
keyIterationCount: number,
|
||||
extraParameters: Map<string, any>,
|
||||
clientInfo: ClientInfo,
|
||||
rest: RestClient
|
||||
rest: RestClient,
|
||||
) {
|
||||
const hash = await this.cryptoUtils.deriveKeyHash(username, password, keyIterationCount);
|
||||
|
||||
@@ -526,7 +529,7 @@ export class Client {
|
||||
private makeError(response: Response) {
|
||||
// TODO: error parsing
|
||||
throw new Error(
|
||||
"HTTP request to " + response.url + " failed with status " + response.status + "."
|
||||
"HTTP request to " + response.url + " failed with status " + response.status + ".",
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ export class CryptoUtils {
|
||||
if (iterationCount == 1) {
|
||||
return await this.cryptoFunctionService.hash(
|
||||
Utils.fromBufferToHex(key.buffer) + password,
|
||||
"sha256"
|
||||
"sha256",
|
||||
);
|
||||
}
|
||||
return await this.cryptoFunctionService.pbkdf2(key, password, "sha256", 1);
|
||||
@@ -39,7 +39,7 @@ export class CryptoUtils {
|
||||
async decryptAes256PlainWithDefault(
|
||||
data: Uint8Array,
|
||||
encryptionKey: Uint8Array,
|
||||
defaultValue: string
|
||||
defaultValue: string,
|
||||
) {
|
||||
try {
|
||||
return this.decryptAes256Plain(data, encryptionKey);
|
||||
@@ -51,7 +51,7 @@ export class CryptoUtils {
|
||||
async decryptAes256Base64WithDefault(
|
||||
data: Uint8Array,
|
||||
encryptionKey: Uint8Array,
|
||||
defaultValue: string
|
||||
defaultValue: string,
|
||||
) {
|
||||
try {
|
||||
return this.decryptAes256Base64(data, encryptionKey);
|
||||
@@ -86,7 +86,7 @@ export class CryptoUtils {
|
||||
data: Uint8Array,
|
||||
encryptionKey: Uint8Array,
|
||||
mode: "cbc" | "ecb",
|
||||
iv: Uint8Array = new Uint8Array(16)
|
||||
iv: Uint8Array = new Uint8Array(16),
|
||||
): Promise<string> {
|
||||
if (data.length === 0) {
|
||||
return "";
|
||||
|
||||
@@ -16,7 +16,7 @@ const AllowedSecureNoteTypes = new Set<string>([
|
||||
export class Parser {
|
||||
constructor(
|
||||
private cryptoFunctionService: CryptoFunctionService,
|
||||
private cryptoUtils: CryptoUtils
|
||||
private cryptoUtils: CryptoUtils,
|
||||
) {}
|
||||
|
||||
/*
|
||||
@@ -30,7 +30,7 @@ export class Parser {
|
||||
chunk: Chunk,
|
||||
encryptionKey: Uint8Array,
|
||||
folder: SharedFolder,
|
||||
options: ParserOptions
|
||||
options: ParserOptions,
|
||||
): Promise<Account> {
|
||||
const placeholder = "decryption failed";
|
||||
const reader = new BinaryReader(chunk.payload);
|
||||
@@ -43,19 +43,19 @@ export class Parser {
|
||||
const name = await this.cryptoUtils.decryptAes256PlainWithDefault(
|
||||
this.readItem(reader),
|
||||
encryptionKey,
|
||||
placeholder
|
||||
placeholder,
|
||||
);
|
||||
|
||||
// 2: group
|
||||
const group = await this.cryptoUtils.decryptAes256PlainWithDefault(
|
||||
this.readItem(reader),
|
||||
encryptionKey,
|
||||
placeholder
|
||||
placeholder,
|
||||
);
|
||||
|
||||
// 3: url
|
||||
let url = Utils.fromBufferToUtf8(
|
||||
Utils.fromHexToArray(Utils.fromBufferToUtf8(this.readItem(reader)))
|
||||
Utils.fromHexToArray(Utils.fromBufferToUtf8(this.readItem(reader))),
|
||||
);
|
||||
|
||||
// Ignore "group" accounts. They have no credentials.
|
||||
@@ -67,7 +67,7 @@ export class Parser {
|
||||
const notes = await this.cryptoUtils.decryptAes256PlainWithDefault(
|
||||
this.readItem(reader),
|
||||
encryptionKey,
|
||||
placeholder
|
||||
placeholder,
|
||||
);
|
||||
|
||||
// 5: fav (is favorite)
|
||||
@@ -80,14 +80,14 @@ export class Parser {
|
||||
let username = await this.cryptoUtils.decryptAes256PlainWithDefault(
|
||||
this.readItem(reader),
|
||||
encryptionKey,
|
||||
placeholder
|
||||
placeholder,
|
||||
);
|
||||
|
||||
// 8: password
|
||||
let password = await this.cryptoUtils.decryptAes256PlainWithDefault(
|
||||
this.readItem(reader),
|
||||
encryptionKey,
|
||||
placeholder
|
||||
placeholder,
|
||||
);
|
||||
|
||||
// 9: pwprotect (?)
|
||||
@@ -215,7 +215,7 @@ export class Parser {
|
||||
const totp = await this.cryptoUtils.decryptAes256PlainWithDefault(
|
||||
this.readItem(reader),
|
||||
encryptionKey,
|
||||
placeholder
|
||||
placeholder,
|
||||
);
|
||||
|
||||
// 3 more left. Don't even bother skipping them.
|
||||
@@ -244,7 +244,7 @@ export class Parser {
|
||||
async parseShar(
|
||||
chunk: Chunk,
|
||||
encryptionKey: Uint8Array,
|
||||
rsaKey: Uint8Array
|
||||
rsaKey: Uint8Array,
|
||||
): Promise<SharedFolder> {
|
||||
const reader = new BinaryReader(chunk.payload);
|
||||
|
||||
@@ -257,7 +257,7 @@ export class Parser {
|
||||
const decFolderKey = await this.cryptoFunctionService.rsaDecrypt(
|
||||
rsaEncryptedFolderKey,
|
||||
rsaKey,
|
||||
"sha1"
|
||||
"sha1",
|
||||
);
|
||||
const key = Utils.fromHexToArray(Utils.fromBufferToUtf8(decFolderKey));
|
||||
|
||||
@@ -277,7 +277,7 @@ export class Parser {
|
||||
Utils.fromHexToArray(encryptedPrivateKey),
|
||||
encryptionKey,
|
||||
"cbc",
|
||||
encryptionKey.subarray(0, 16)
|
||||
encryptionKey.subarray(0, 16),
|
||||
);
|
||||
|
||||
const header = "LastPassPrivateKey<";
|
||||
|
||||
@@ -5,7 +5,7 @@ export class RestClient {
|
||||
async get(
|
||||
endpoint: string,
|
||||
headers: Map<string, string> = null,
|
||||
cookies: Map<string, string> = null
|
||||
cookies: Map<string, string> = null,
|
||||
): Promise<Response> {
|
||||
const requestInit: RequestInit = {
|
||||
method: "GET",
|
||||
@@ -21,7 +21,7 @@ export class RestClient {
|
||||
endpoint: string,
|
||||
parameters: Map<string, any> = null,
|
||||
headers: Map<string, string> = null,
|
||||
cookies: Map<string, string> = null
|
||||
cookies: Map<string, string> = null,
|
||||
): Promise<Response> {
|
||||
const setBody = (requestInit: RequestInit, headerMap: Map<string, string>) => {
|
||||
if (parameters != null && parameters.size > 0) {
|
||||
@@ -39,7 +39,7 @@ export class RestClient {
|
||||
endpoint: string,
|
||||
body: any,
|
||||
headers: Map<string, string> = null,
|
||||
cookies: Map<string, string> = null
|
||||
cookies: Map<string, string> = null,
|
||||
): Promise<Response> {
|
||||
const setBody = (requestInit: RequestInit, headerMap: Map<string, string>) => {
|
||||
if (body != null) {
|
||||
@@ -54,7 +54,7 @@ export class RestClient {
|
||||
endpoint: string,
|
||||
setBody: (requestInit: RequestInit, headers: Map<string, string>) => void,
|
||||
headers: Map<string, string> = null,
|
||||
cookies: Map<string, string> = null
|
||||
cookies: Map<string, string> = null,
|
||||
) {
|
||||
const requestInit: RequestInit = {
|
||||
method: "POST",
|
||||
@@ -73,7 +73,7 @@ export class RestClient {
|
||||
private setHeaders(
|
||||
requestInit: RequestInit,
|
||||
headers: Map<string, string> = null,
|
||||
cookies: Map<string, string> = null
|
||||
cookies: Map<string, string> = null,
|
||||
) {
|
||||
const requestHeaders = new Headers();
|
||||
let setHeaders = false;
|
||||
|
||||
@@ -26,7 +26,7 @@ export class Vault {
|
||||
|
||||
constructor(
|
||||
private cryptoFunctionService: CryptoFunctionService,
|
||||
private tokenService: TokenService
|
||||
private tokenService: TokenService,
|
||||
) {
|
||||
this.cryptoUtils = new CryptoUtils(cryptoFunctionService);
|
||||
const parser = new Parser(cryptoFunctionService, this.cryptoUtils);
|
||||
@@ -38,7 +38,7 @@ export class Vault {
|
||||
password: string,
|
||||
clientInfo: ClientInfo,
|
||||
ui: Ui,
|
||||
parserOptions: ParserOptions = ParserOptions.default
|
||||
parserOptions: ParserOptions = ParserOptions.default,
|
||||
): Promise<void> {
|
||||
this.accounts = await this.client.openVault(username, password, clientInfo, ui, parserOptions);
|
||||
}
|
||||
@@ -47,7 +47,7 @@ export class Vault {
|
||||
federatedUser: FederatedUserContext,
|
||||
clientInfo: ClientInfo,
|
||||
ui: Ui,
|
||||
parserOptions: ParserOptions = ParserOptions.default
|
||||
parserOptions: ParserOptions = ParserOptions.default,
|
||||
): Promise<void> {
|
||||
if (federatedUser == null) {
|
||||
throw new Error("Federated user context is not set.");
|
||||
@@ -56,7 +56,7 @@ export class Vault {
|
||||
const k2 = await this.getK2(federatedUser);
|
||||
const hiddenPasswordArr = await this.cryptoFunctionService.hash(
|
||||
this.cryptoUtils.ExclusiveOr(k1, k2),
|
||||
"sha256"
|
||||
"sha256",
|
||||
);
|
||||
const hiddenPassword = Utils.fromBufferToB64(hiddenPasswordArr);
|
||||
await this.open(federatedUser.username, hiddenPassword, clientInfo, ui, parserOptions);
|
||||
@@ -138,7 +138,7 @@ export class Vault {
|
||||
rest.baseUrl = "https://graph.microsoft.com";
|
||||
const response = await rest.get(
|
||||
"v1.0/me?$select=id,displayName,mail&$expand=extensions",
|
||||
new Map([["Authorization", "Bearer " + federatedUser.accessToken]])
|
||||
new Map([["Authorization", "Bearer " + federatedUser.accessToken]]),
|
||||
);
|
||||
if (response.status === HttpStatusCode.Ok) {
|
||||
const json = await response.json();
|
||||
@@ -164,7 +164,7 @@ export class Vault {
|
||||
"&q=name%20%3D%20%27k1.lp%27" +
|
||||
"&spaces=appDataFolder" +
|
||||
"&fields=nextPageToken%2C%20files(id%2C%20name)",
|
||||
accessTokenAuthHeader
|
||||
accessTokenAuthHeader,
|
||||
);
|
||||
if (response.status === HttpStatusCode.Ok) {
|
||||
const json = await response.json();
|
||||
@@ -174,7 +174,7 @@ export class Vault {
|
||||
rest.baseUrl = "https://www.googleapis.com";
|
||||
const response = await rest.get(
|
||||
"drive/v3/files/" + files[0].id + "?alt=media",
|
||||
accessTokenAuthHeader
|
||||
accessTokenAuthHeader,
|
||||
);
|
||||
if (response.status === HttpStatusCode.Ok) {
|
||||
const k1 = await response.text();
|
||||
|
||||
@@ -11,10 +11,10 @@ import { Importer } from "./importer";
|
||||
|
||||
const mappedBaseColumns = ["nickname", "additionalInfo"];
|
||||
const _mappedUserAccountColumns = new Set(
|
||||
mappedBaseColumns.concat(["url", "username", "password", "twofaSecret"])
|
||||
mappedBaseColumns.concat(["url", "username", "password", "twofaSecret"]),
|
||||
);
|
||||
const _mappedCreditCardColumns = new Set(
|
||||
mappedBaseColumns.concat(["cardNumber", "cardName", "exp_month", "exp_year", "cvv"])
|
||||
mappedBaseColumns.concat(["cardNumber", "cardName", "exp_month", "exp_year", "cvv"]),
|
||||
);
|
||||
|
||||
const _mappedIdentityColumns = new Set(
|
||||
@@ -29,7 +29,7 @@ const _mappedIdentityColumns = new Set(
|
||||
"city",
|
||||
"country",
|
||||
"zipCode",
|
||||
])
|
||||
]),
|
||||
);
|
||||
|
||||
const _mappedIdCardColumns = new Set(mappedBaseColumns.concat(["idName", "idNumber", "idCountry"]));
|
||||
|
||||
@@ -2,7 +2,11 @@ import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
|
||||
|
||||
export class CipherImportContext {
|
||||
lowerProperty: string;
|
||||
constructor(public importRecord: any, public property: string, public cipher: CipherView) {
|
||||
constructor(
|
||||
public importRecord: any,
|
||||
public property: string,
|
||||
public cipher: CipherView,
|
||||
) {
|
||||
this.lowerProperty = property.toLowerCase();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ export class OnePassword1PifImporter extends BaseImporter implements Importer {
|
||||
cipher: CipherView,
|
||||
designationKey: string,
|
||||
valueKey: string,
|
||||
nameKey: string
|
||||
nameKey: string,
|
||||
) {
|
||||
fields.forEach((field: any) => {
|
||||
if (field[valueKey] == null || field[valueKey].toString().trim() === "") {
|
||||
|
||||
@@ -451,7 +451,7 @@ export class OnePassword1PuxImporter extends BaseImporter implements Importer {
|
||||
field: FieldsEntity,
|
||||
fieldValue: string,
|
||||
cipher: CipherView,
|
||||
valueKey: string
|
||||
valueKey: string,
|
||||
): boolean {
|
||||
if (this.isNullOrWhitespace(cipher.identity.firstName) && field.id === "firstname") {
|
||||
cipher.identity.firstName = fieldValue;
|
||||
|
||||
@@ -189,7 +189,7 @@ export abstract class OnePasswordCsvImporter extends BaseImporter implements Imp
|
||||
context.lowerProperty === "modified date"
|
||||
) {
|
||||
const readableDate = new Date(
|
||||
parseInt(context.importRecord[context.property], 10) * 1000
|
||||
parseInt(context.importRecord[context.property], 10) * 1000,
|
||||
).toUTCString();
|
||||
this.processKvp(context.cipher, "1Password " + context.property, readableDate);
|
||||
return null;
|
||||
@@ -203,7 +203,7 @@ export abstract class OnePasswordCsvImporter extends BaseImporter implements Imp
|
||||
context.cipher,
|
||||
context.property,
|
||||
context.importRecord[context.property],
|
||||
FieldType.Hidden
|
||||
FieldType.Hidden,
|
||||
);
|
||||
} else {
|
||||
this.processKvp(context.cipher, context.property, context.importRecord[context.property]);
|
||||
@@ -331,7 +331,7 @@ export abstract class OnePasswordCsvImporter extends BaseImporter implements Imp
|
||||
) {
|
||||
context.cipher.card.expMonth = (context.importRecord[context.property] as string).substr(
|
||||
0,
|
||||
2
|
||||
2,
|
||||
);
|
||||
if (context.cipher.card.expMonth[0] === "0") {
|
||||
context.cipher.card.expMonth = context.cipher.card.expMonth.substr(1, 1);
|
||||
|
||||
@@ -56,7 +56,7 @@ export class ProtonPassJsonImporter extends BaseImporter implements Importer {
|
||||
cipher,
|
||||
extraField.fieldName,
|
||||
extraField.type == "totp" ? extraField.data.totpUri : extraField.data.content,
|
||||
extraField.type == "text" ? FieldType.Text : FieldType.Hidden
|
||||
extraField.type == "text" ? FieldType.Text : FieldType.Hidden,
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -131,7 +131,7 @@ export class PsonoJsonImporter extends BaseImporter implements Importer {
|
||||
cipher,
|
||||
"website_password_auto_submit",
|
||||
entry.website_password_auto_submit?.toString(),
|
||||
FieldType.Boolean
|
||||
FieldType.Boolean,
|
||||
);
|
||||
|
||||
this.processKvp(cipher, "website_password_url_filter", entry.website_password_url_filter);
|
||||
@@ -260,7 +260,7 @@ export class PsonoJsonImporter extends BaseImporter implements Importer {
|
||||
cipher,
|
||||
"mail_gpg_own_key_private",
|
||||
entry.mail_gpg_own_key_private,
|
||||
FieldType.Hidden
|
||||
FieldType.Hidden,
|
||||
);
|
||||
|
||||
this.importUnmappedFields(cipher, entry, this.GPG_mappedValues);
|
||||
@@ -269,7 +269,7 @@ export class PsonoJsonImporter extends BaseImporter implements Importer {
|
||||
private importUnmappedFields(
|
||||
cipher: CipherView,
|
||||
entry: PsonoItemTypes,
|
||||
mappedValues: Set<string>
|
||||
mappedValues: Set<string>,
|
||||
) {
|
||||
const unmappedFields = Object.keys(entry).filter((x) => !mappedValues.has(x));
|
||||
unmappedFields.forEach((key) => {
|
||||
|
||||
@@ -31,7 +31,7 @@ export class StickyPasswordXmlImporter extends BaseImporter implements Importer
|
||||
"root > Database > Accounts > Account > " +
|
||||
'LoginLinks > Login[SourceLoginID="' +
|
||||
accountId +
|
||||
'"]'
|
||||
'"]',
|
||||
);
|
||||
if (accountLogin != null) {
|
||||
const account = accountLogin.parentElement.parentElement;
|
||||
|
||||
@@ -27,10 +27,10 @@ export class ZohoVaultCsvImporter extends BaseImporter implements Importer {
|
||||
cipher.notes = this.getValueOrDefault(value.Notes);
|
||||
cipher.name = this.getValueOrDefault(
|
||||
value["Password Name"],
|
||||
this.getValueOrDefault(value["Secret Name"], "--")
|
||||
this.getValueOrDefault(value["Secret Name"], "--"),
|
||||
);
|
||||
cipher.login.uris = this.makeUriArray(
|
||||
this.getValueOrDefault(value["Password URL"], this.getValueOrDefault(value["Secret URL"]))
|
||||
this.getValueOrDefault(value["Password URL"], this.getValueOrDefault(value["Secret URL"])),
|
||||
);
|
||||
this.parseData(cipher, value.SecretData);
|
||||
this.parseData(cipher, value.CustomData);
|
||||
|
||||
Reference in New Issue
Block a user