Skip to content

Commit

Permalink
Add mapping code to support importing SSH keys from 1password 1pux
Browse files Browse the repository at this point in the history
  • Loading branch information
djsmith85 authored and quexten committed Aug 30, 2024
1 parent 09aa962 commit 5bda3d1
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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") {
Expand Down

0 comments on commit 5bda3d1

Please sign in to comment.