1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-13 15:03:26 +00:00

Add mapping code to support importing SSH keys from 1password 1pux

This commit is contained in:
Daniel James Smith
2024-08-29 10:39:35 +02:00
committed by Bernd Schoolmann
parent 09aa962819
commit 5bda3d1d14

View File

@@ -6,6 +6,7 @@ import { IdentityView } from "@bitwarden/common/vault/models/view/identity.view"
import { LoginView } from "@bitwarden/common/vault/models/view/login.view";
import { PasswordHistoryView } from "@bitwarden/common/vault/models/view/password-history.view";
import { SecureNoteView } from "@bitwarden/common/vault/models/view/secure-note.view";
import { SSHKeyView } from "@bitwarden/common/vault/models/view/ssh-key.view";
import { ImportResult } from "../../models/import-result";
import { BaseImporter } from "../base-importer";
@@ -78,6 +79,10 @@ export class OnePassword1PuxImporter extends BaseImporter implements Importer {
cipher.type = CipherType.Identity;
cipher.identity = new IdentityView();
break;
case CategoryEnum.SSH_Key:
cipher.type = CipherType.SSHKey;
cipher.sshKey = new SSHKeyView();
break;
default:
break;
}
@@ -314,6 +319,14 @@ export class OnePassword1PuxImporter extends BaseImporter implements Importer {
default:
break;
}
} else if (cipher.type === CipherType.SSHKey) {
if (valueKey === "sshKey") {
const { privateKey, metadata } = field.value.sshKey;
cipher.sshKey.privateKey = privateKey;
cipher.sshKey.publicKey = metadata.publicKey;
cipher.sshKey.keyFingerprint = metadata.fingerprint;
return;
}
}
if (valueKey === "email") {