[PM-44526] docs: Add SDK sync comments to vault domain and view models

Points engineers to the mirrored sdk-internal structs so model changes are also made in the SDK.
This commit is contained in:
jaasen-livefront
2026-10-09 17:39:35 -07:00
parent d139a66db5
commit 3d9239222e
29 changed files with 58 additions and 0 deletions

View File

@@ -3,6 +3,8 @@ import {
LocalData as SdkLocalData,
} from "@bitwarden/sdk-internal";
// Mirrored in the SDK (bitwarden/sdk-internal: crates/bitwarden-vault/src/cipher/local_data.rs).
// Field changes here must also be made there, along with fromSdkLocalData/toSdkLocalData.
export type LocalData = {
lastUsedDate?: number;
lastLaunched?: number;

View File

@@ -10,6 +10,8 @@ import { conditionalEncString, encStringFrom } from "../../utils/domain-utils";
import { AttachmentData } from "../data/attachment.data";
import { AttachmentView } from "../view/attachment.view";
// Mirrored in the SDK (bitwarden/sdk-internal: crates/bitwarden-vault/src/cipher/attachment.rs).
// Field changes here must also be made there, along with the toSdk/fromSdk mappings.
export class Attachment extends Domain {
id?: string;
url?: string;

View File

@@ -9,6 +9,8 @@ import { conditionalEncString, encStringFrom } from "../../utils/domain-utils";
import { BankAccountData } from "../data/bank-account.data";
import { BankAccountView } from "../view/bank-account.view";
// Mirrored in the SDK (bitwarden/sdk-internal: crates/bitwarden-vault/src/cipher/bank_account.rs).
// Field changes here must also be made there, along with the toSdk/fromSdk mappings.
export class BankAccount extends Domain {
bankName?: EncString;
nameOnAccount?: EncString;

View File

@@ -9,6 +9,8 @@ import { conditionalEncString, encStringFrom } from "../../utils/domain-utils";
import { CardData } from "../data/card.data";
import { CardView } from "../view/card.view";
// Mirrored in the SDK (bitwarden/sdk-internal: crates/bitwarden-vault/src/cipher/card.rs).
// Field changes here must also be made there, along with the toSdk/fromSdk mappings.
export class Card extends Domain {
cardholderName?: EncString;
brand?: EncString;

View File

@@ -35,6 +35,8 @@ import { Password } from "./password";
import { SecureNote } from "./secure-note";
import { SshKey } from "./ssh-key";
// Mirrored in the SDK (bitwarden/sdk-internal: crates/bitwarden-vault/src/cipher/cipher.rs).
// Field changes here must also be made there, along with the toSdk/fromSdk mappings.
/**
* Encrypted cipher, as stored and synced.
*

View File

@@ -9,6 +9,8 @@ import { conditionalEncString, encStringFrom } from "../../utils/domain-utils";
import { DriversLicenseData } from "../data/drivers-license.data";
import { DriversLicenseView } from "../view/drivers-license.view";
// Mirrored in the SDK (bitwarden/sdk-internal: crates/bitwarden-vault/src/cipher/drivers_license.rs).
// Field changes here must also be made there, along with the toSdk/fromSdk mappings.
export class DriversLicense extends Domain {
firstName?: EncString;
middleName?: EncString;

View File

@@ -9,6 +9,8 @@ import { conditionalEncString, encStringFrom } from "../../utils/domain-utils";
import { Fido2CredentialData } from "../data/fido2-credential.data";
import { Fido2CredentialView } from "../view/fido2-credential.view";
// Mirrored in the SDK (bitwarden/sdk-internal: crates/bitwarden-vault/src/cipher/login.rs).
// Field changes here must also be made there, along with the toSdk/fromSdk mappings.
export class Fido2Credential extends Domain {
credentialId!: EncString;
keyType!: EncString;

View File

@@ -15,6 +15,8 @@ import { conditionalEncString, encStringFrom } from "../../utils/domain-utils";
import { FieldData } from "../data/field.data";
import { FieldView } from "../view/field.view";
// Mirrored in the SDK (bitwarden/sdk-internal: crates/bitwarden-vault/src/cipher/field.rs).
// Field changes here must also be made there, along with the toSdk/fromSdk mappings.
export class Field extends Domain {
name?: EncString;
value?: EncString;

View File

@@ -9,6 +9,8 @@ import { conditionalEncString, encStringFrom } from "../../utils/domain-utils";
import { IdentityData } from "../data/identity.data";
import { IdentityView } from "../view/identity.view";
// Mirrored in the SDK (bitwarden/sdk-internal: crates/bitwarden-vault/src/cipher/identity.rs).
// Field changes here must also be made there, along with the toSdk/fromSdk mappings.
export class Identity extends Domain {
title?: EncString;
firstName?: EncString;

View File

@@ -14,6 +14,8 @@ import { conditionalEncString, encStringFrom } from "../../utils/domain-utils";
import { LoginUriData } from "../data/login-uri.data";
import { LoginUriView } from "../view/login-uri.view";
// Mirrored in the SDK (bitwarden/sdk-internal: crates/bitwarden-vault/src/cipher/login.rs).
// Field changes here must also be made there, along with the toSdk/fromSdk mappings.
export class LoginUri extends Domain {
uri?: EncString;
uriChecksum?: EncString;

View File

@@ -12,6 +12,8 @@ import { LoginView } from "../view/login.view";
import { Fido2Credential } from "./fido2-credential";
import { LoginUri } from "./login-uri";
// Mirrored in the SDK (bitwarden/sdk-internal: crates/bitwarden-vault/src/cipher/login.rs).
// Field changes here must also be made there, along with the toSdk/fromSdk mappings.
export class Login extends Domain {
uris?: LoginUri[];
username?: EncString;

View File

@@ -9,6 +9,8 @@ import { conditionalEncString, encStringFrom } from "../../utils/domain-utils";
import { PassportData } from "../data/passport.data";
import { PassportView } from "../view/passport.view";
// Mirrored in the SDK (bitwarden/sdk-internal: crates/bitwarden-vault/src/cipher/passport.rs).
// Field changes here must also be made there, along with the toSdk/fromSdk mappings.
export class Passport extends Domain {
surname?: EncString;
givenName?: EncString;

View File

@@ -8,6 +8,8 @@ import Domain from "../../../platform/models/domain/domain-base";
import { PasswordHistoryData } from "../data/password-history.data";
import { PasswordHistoryView } from "../view/password-history.view";
// Mirrored in the SDK (bitwarden/sdk-internal: crates/bitwarden-vault/src/password_history.rs).
// Field changes here must also be made there, along with the toSdk/fromSdk mappings.
export class Password extends Domain {
password!: EncString;
lastUsedDate!: Date;

View File

@@ -7,6 +7,8 @@ import { normalizeSecureNoteTypeForSdk, SecureNoteType } from "../../enums";
import { SecureNoteData } from "../data/secure-note.data";
import { SecureNoteView } from "../view/secure-note.view";
// Mirrored in the SDK (bitwarden/sdk-internal: crates/bitwarden-vault/src/cipher/secure_note.rs).
// Field changes here must also be made there, along with the toSdk/fromSdk mappings.
export class SecureNote extends Domain {
type: SecureNoteType = SecureNoteType.Generic;

View File

@@ -8,6 +8,8 @@ import Domain from "../../../platform/models/domain/domain-base";
import { SshKeyData } from "../data/ssh-key.data";
import { SshKeyView } from "../view/ssh-key.view";
// Mirrored in the SDK (bitwarden/sdk-internal: crates/bitwarden-vault/src/cipher/ssh_key.rs).
// Field changes here must also be made there, along with the toSdk/fromSdk mappings.
export class SshKey extends Domain {
privateKey!: EncString;
/** Derivable from the private key, so may be absent at rest. */

View File

@@ -7,6 +7,8 @@ import { AttachmentView as SdkAttachmentView } from "@bitwarden/sdk-internal";
import { View } from "../../../models/view/view";
import { Attachment } from "../domain/attachment";
// Mirrored in the SDK (bitwarden/sdk-internal: crates/bitwarden-vault/src/cipher/attachment.rs).
// Field changes here must also be made there, along with the toSdk/fromSdk mappings.
export class AttachmentView implements View {
id?: string;
url?: string;

View File

@@ -4,6 +4,8 @@ import { BankAccountView as SdkBankAccountView } from "@bitwarden/sdk-internal";
import { ItemView } from "./item.view";
// Mirrored in the SDK (bitwarden/sdk-internal: crates/bitwarden-vault/src/cipher/bank_account.rs).
// Field changes here must also be made there, along with the toSdk/fromSdk mappings.
export class BankAccountView extends ItemView implements SdkBankAccountView {
bankName: string | undefined;
nameOnAccount: string | undefined;

View File

@@ -8,6 +8,8 @@ import { linkedFieldOption } from "../../linked-field-option.decorator";
import { ItemView } from "./item.view";
// Mirrored in the SDK (bitwarden/sdk-internal: crates/bitwarden-vault/src/cipher/card.rs).
// Field changes here must also be made there, along with the toSdk/fromSdk mappings.
export class CardView extends ItemView implements SdkCardView {
@linkedFieldOption(LinkedId.CardholderName, { sortPosition: 0 })
cardholderName: string | undefined;

View File

@@ -32,6 +32,8 @@ import { PasswordHistoryView } from "./password-history.view";
import { SecureNoteView } from "./secure-note.view";
import { SshKeyView } from "./ssh-key.view";
// Mirrored in the SDK (bitwarden/sdk-internal: crates/bitwarden-vault/src/cipher/cipher.rs).
// Field changes here must also be made there, along with the toSdk/fromSdk mappings.
export class CipherView implements View, InitializerMetadata {
readonly initializerKey = InitializerKey.CipherView;

View File

@@ -4,6 +4,8 @@ import { DriversLicenseView as SdkDriversLicenseView } from "@bitwarden/sdk-inte
import { ItemView } from "./item.view";
// Mirrored in the SDK (bitwarden/sdk-internal: crates/bitwarden-vault/src/cipher/drivers_license.rs).
// Field changes here must also be made there, along with the toSdk/fromSdk mappings.
export class DriversLicenseView extends ItemView implements SdkDriversLicenseView {
firstName: string | undefined;
middleName: string | undefined;

View File

@@ -7,6 +7,8 @@ import {
import { ItemView } from "./item.view";
// Mirrored in the SDK (bitwarden/sdk-internal: crates/bitwarden-vault/src/cipher/login.rs).
// Field changes here must also be made there, along with the toSdk/fromSdk mappings.
export class Fido2CredentialView extends ItemView {
credentialId!: string;
keyType!: "public-key";

View File

@@ -6,6 +6,8 @@ import { View } from "../../../models/view/view";
import { FieldType, LinkedIdType } from "../../enums";
import { Field } from "../domain/field";
// Mirrored in the SDK (bitwarden/sdk-internal: crates/bitwarden-vault/src/cipher/field.rs).
// Field changes here must also be made there, along with the toSdk/fromSdk mappings.
export class FieldView implements View {
name?: string;
value?: string;

View File

@@ -8,6 +8,8 @@ import { linkedFieldOption } from "../../linked-field-option.decorator";
import { ItemView } from "./item.view";
// Mirrored in the SDK (bitwarden/sdk-internal: crates/bitwarden-vault/src/cipher/identity.rs).
// Field changes here must also be made there, along with the toSdk/fromSdk mappings.
export class IdentityView extends ItemView implements SdkIdentityView {
@linkedFieldOption(LinkedId.Title, { sortPosition: 0 })
title: string | undefined;

View File

@@ -9,6 +9,8 @@ import { SafeUrls, UrlType } from "../../../platform/misc/safe-urls";
import { Utils } from "../../../platform/misc/utils";
import { LoginUri } from "../domain/login-uri";
// Mirrored in the SDK (bitwarden/sdk-internal: crates/bitwarden-vault/src/cipher/login.rs).
// Field changes here must also be made there, along with the toSdk/fromSdk mappings.
export class LoginUriView implements View {
match?: UriMatchStrategySetting;

View File

@@ -11,6 +11,8 @@ import { Fido2CredentialView } from "./fido2-credential.view";
import { ItemView } from "./item.view";
import { LoginUriView } from "./login-uri.view";
// Mirrored in the SDK (bitwarden/sdk-internal: crates/bitwarden-vault/src/cipher/login.rs).
// Field changes here must also be made there, along with the toSdk/fromSdk mappings.
export class LoginView extends ItemView {
@linkedFieldOption(LinkedId.Username, { sortPosition: 0 })
username: string | undefined;

View File

@@ -4,6 +4,8 @@ import { PassportView as SdkPassportView } from "@bitwarden/sdk-internal";
import { ItemView } from "./item.view";
// Mirrored in the SDK (bitwarden/sdk-internal: crates/bitwarden-vault/src/cipher/passport.rs).
// Field changes here must also be made there, along with the toSdk/fromSdk mappings.
export class PassportView extends ItemView implements SdkPassportView {
surname: string | undefined;
givenName: string | undefined;

View File

@@ -7,6 +7,8 @@ import { PasswordHistoryView as SdkPasswordHistoryView } from "@bitwarden/sdk-in
import { View } from "../../../models/view/view";
import { Password } from "../domain/password";
// Mirrored in the SDK (bitwarden/sdk-internal: crates/bitwarden-vault/src/password_history.rs).
// Field changes here must also be made there, along with the toSdk/fromSdk mappings.
export class PasswordHistoryView implements View {
password: string = null;
lastUsedDate: Date = null;

View File

@@ -7,6 +7,8 @@ import { SecureNote } from "../domain/secure-note";
import { ItemView } from "./item.view";
// Mirrored in the SDK (bitwarden/sdk-internal: crates/bitwarden-vault/src/cipher/secure_note.rs).
// Field changes here must also be made there, along with the toSdk/fromSdk mappings.
export class SecureNoteView extends ItemView implements SdkSecureNoteView {
type: SecureNoteType = SecureNoteType.Generic;

View File

@@ -4,6 +4,8 @@ import { SshKeyView as SdkSshKeyView } from "@bitwarden/sdk-internal";
import { ItemView } from "./item.view";
// Mirrored in the SDK (bitwarden/sdk-internal: crates/bitwarden-vault/src/cipher/ssh_key.rs).
// Field changes here must also be made there, along with the toSdk/fromSdk mappings.
export class SshKeyView extends ItemView {
privateKey!: string;
publicKey!: string;