Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Add Proton Pass zip archive import scaffolding (#1959)

Leendert de Borstdf6ab49af759
diff --git a/apps/server/Utilities/AliasVault.ImportExport/Importers/ProtonPassZipImporter.cs b/apps/server/Utilities/AliasVault.ImportExport/Importers/ProtonPassZipImporter.cs
new file mode 100644
index 000000000..2012fd6a5
--- /dev/null
+++ b/apps/server/Utilities/AliasVault.ImportExport/Importers/ProtonPassZipImporter.cs
@@ -0,0 +1,439 @@
+//-----------------------------------------------------------------------
+// <copyright file="ProtonPassZipImporter.cs" company="aliasvault">
+// Copyright (c) aliasvault. All rights reserved.
+// Licensed under the AGPLv3 license. See LICENSE.md file in the project root for full license information.
+// </copyright>
+//-----------------------------------------------------------------------
+
+namespace AliasVault.ImportExport.Importers;
+
+using System.IO.Compression;
+using AliasVault.ImportExport.Models;
+using AliasVault.ImportExport.Models.Imports;
+
+/// <summary>
+/// Imports credentials from a Proton Pass .zip export.
+/// The archive contains a "Proton Pass/data.json" file with all vaults and items.
+/// When the user has the premium file-attachments feature enabled, item blobs are
+/// placed under a "Proton Pass/files/" directory and referenced by item.files[].fileID.
+/// </summary>
+public class ProtonPassZipImporter : BaseArchiveImporter
+{
+ private const string DataJsonPath = "Proton Pass/data.json";
+ private const string FilesPath = "Proton Pass/files/";
+
+ /// <summary>
+ /// Default Proton Pass vault name. When an export contains only this vault,
+ /// its items are promoted to the root folder to avoid an unnecessary "Personal" folder.
+ /// </summary>
+ private const string DefaultVaultName = "Personal";
+
+ /// <inheritdoc/>
+ protected override string? GetAttachmentPathPattern() => FilesPath;
+
+ /// <inheritdoc/>
+ protected override async Task<List<ImportedCredential>> ProcessArchiveAsync(
+ ZipArchive archive,
+ Dictionary<string, byte[]> attachmentMap,
+ Dictionary<string, byte[]> logoMap)
+ {
+ var exportData = await ReadJsonFromArchiveAsync<ProtonPassJsonExport>(archive, DataJsonPath);
+ if (exportData == null)
+ {
+ throw new InvalidOperationException("Invalid Proton Pass ZIP file: \"Proton Pass/data.json\" not found or could not be parsed.");
+ }
+
+ if (exportData.Encrypted)
+ {
+ throw new InvalidOperationException("Encrypted Proton Pass exports are not supported. Please export without a password.");
+ }
+
+ var rootVaultId = DetermineRootVaultId(exportData);
+
+ var credentials = new List<ImportedCredential>();
+
+ foreach (var (vaultId, vault) in exportData.Vaults)
+ {
+ var folderPath = vaultId == rootVaultId ? null : vault.Name;
+
+ foreach (var item in vault.Items)
+ {
+ // Skip trashed items (state != 1).
+ if (item.State != 1)
+ {
+ continue;
+ }
+
+ var credential = ConvertItemToCredential(item, folderPath, attachmentMap);
+ if (credential != null)
+ {
+ credentials.Add(credential);
+ }
+ }
+ }
+
+ return credentials;
+ }
+
+ /// <summary>
+ /// Picks a vault to promote to the root folder. Only the single default "Personal" vault
+ /// is promoted; custom vaults are always preserved as folders so users keep their structure.
+ /// </summary>
+ /// <param name="exportData">The Proton Pass export data.</param>
+ /// <returns>The vault ID to promote, or null if none should be promoted.</returns>
+ private static string? DetermineRootVaultId(ProtonPassJsonExport exportData)
+ {
+ foreach (var (vaultId, vault) in exportData.Vaults)
+ {
+ if (!string.IsNullOrWhiteSpace(vault.Name) &&
+ vault.Name.Equals(DefaultVaultName, StringComparison.OrdinalIgnoreCase))
+ {
+ return vaultId;
+ }
+ }
+
+ return null;
+ }
+
+ /// <summary>
+ /// Converts a Proton Pass item to an ImportedCredential.
+ /// </summary>
+ /// <param name="item">The Proton Pass item.</param>
+ /// <param name="folderPath">The folder path to assign (vault name or null for root).</param>
+ /// <param name="attachmentMap">Dictionary mapping attachment paths to file data.</param>
+ /// <returns>The imported credential, or null if the item has no data payload.</returns>
+ private static ImportedCredential? ConvertItemToCredential(
+ ProtonPassItem item,
+ string? folderPath,
+ Dictionary<string, byte[]> attachmentMap)
+ {
+ if (item.Data == null)
+ {
+ return null;
+ }
+
+ var credential = new ImportedCredential
+ {
+ ServiceName = item.Data.Metadata?.Name,
+ Notes = item.Data.Metadata?.Note,
+ FolderPath = folderPath,
+ };
+
+ if (item.CreateTime.HasValue)
+ {
+ credential.CreatedAt = DateTimeOffset.FromUnixTimeSeconds(item.CreateTime.Value).UtcDateTime;
+ }
+
+ if (item.ModifyTime.HasValue)
+ {
+ credential.UpdatedAt = DateTimeOffset.FromUnixTimeSeconds(item.ModifyTime.Value).UtcDateTime;
+ }
+
+ credential.ItemType = MapItemType(item.Data.Type);
+
+ ExtractTypeSpecificData(credential, item);
+ ExtractExtraFields(credential, item.Data.ExtraFields);
+ ExtractAttachments(credential, item.Files, attachmentMap);
+
+ return credential;
+ }
+
+ /// <summary>
+ /// Maps a Proton Pass item type to an ImportedItemType.
+ /// Proton Pass aliases are email aliases (not identity aliases) so they are mapped to Login
+ /// to remain consistent with the existing Proton Pass CSV importer.
+ /// </summary>
+ /// <param name="type">The Proton Pass type string.</param>
+ /// <returns>The corresponding ImportedItemType.</returns>
+ private static ImportedItemType MapItemType(string? type)
+ {
+ if (string.IsNullOrWhiteSpace(type))
+ {
+ return ImportedItemType.Login;
+ }
+
+ return type.ToLowerInvariant() switch
+ {
+ "login" => ImportedItemType.Login,
+ "note" => ImportedItemType.Note,
+ "alias" => ImportedItemType.Login,
+ "creditcard" => ImportedItemType.Creditcard,
+ "identity" => ImportedItemType.Alias,
+ _ => ImportedItemType.Login,
+ };
+ }
+
+ /// <summary>
+ /// Extracts type-specific data into the credential.
+ /// </summary>
+ /// <param name="credential">The credential to populate.</param>
+ /// <param name="item">The source Proton Pass item.</param>
+ private static void ExtractTypeSpecificData(ImportedCredential credential, ProtonPassItem item)
+ {
+ var type = item.Data?.Type?.ToLowerInvariant();
+ var content = item.Data?.Content;
+
+ switch (type)
+ {
+ case "login":
+ ExtractLoginContent(credential, content);
+ break;
+
+ case "alias":
+ // Proton Pass alias items keep the generated email at the envelope level.
+ credential.Email = item.AliasEmail;
+ credential.Username = item.AliasEmail;
+ break;
+
+ case "creditcard":
+ ExtractCreditCardContent(credential, content);
+ break;
+
+ case "identity":
+ ExtractIdentityContent(credential, content);
+ break;
+
+ case "note":
+ default:
+ // Secure notes and unknown types only use metadata (name + note).
+ break;
+ }
+ }
+
+ /// <summary>
+ /// Extracts login-specific content.
+ /// </summary>
+ /// <param name="credential">The credential to populate.</param>
+ /// <param name="content">The login content payload.</param>
+ private static void ExtractLoginContent(ImportedCredential credential, ProtonPassContent? content)
+ {
+ if (content == null)
+ {
+ return;
+ }
+
+ credential.Username = string.IsNullOrWhiteSpace(content.ItemUsername) ? null : content.ItemUsername;
+ credential.Email = string.IsNullOrWhiteSpace(content.ItemEmail) ? null : content.ItemEmail;
+ credential.Password = string.IsNullOrWhiteSpace(content.Password) ? null : content.Password;
+ credential.TwoFactorSecret = string.IsNullOrWhiteSpace(content.TotpUri) ? null : content.TotpUri;
+
+ if (content.Urls != null && content.Urls.Count > 0)
+ {
+ credential.ServiceUrls = content.Urls
+ .Where(u => !string.IsNullOrWhiteSpace(u))
+ .ToList();
+ }
+ }
+
+ /// <summary>
+ /// Extracts credit-card-specific content.
+ /// </summary>
+ /// <param name="credential">The credential to populate.</param>
+ /// <param name="content">The credit card content payload.</param>
+ private static void ExtractCreditCardContent(ImportedCredential credential, ProtonPassContent? content)
+ {
+ if (content == null)
+ {
+ return;
+ }
+
+ var card = new ImportedCreditcard
+ {
+ CardholderName = string.IsNullOrWhiteSpace(content.CardholderName) ? null : content.CardholderName,
+ Number = string.IsNullOrWhiteSpace(content.Number) ? null : content.Number,
+ Cvv = string.IsNullOrWhiteSpace(content.VerificationNumber) ? null : content.VerificationNumber,
+ Pin = string.IsNullOrWhiteSpace(content.Pin) ? null : content.Pin,
+ };
+
+ // Proton Pass stores the expiration as "YYYY-MM" (seen in the JSON export).
+ if (!string.IsNullOrWhiteSpace(content.ExpirationDate))
+ {
+ ParseExpirationDate(content.ExpirationDate, card);
+ }
+
+ credential.Creditcard = card;
+ }
+
+ /// <summary>
+ /// Parses a Proton Pass credit card expiration string into month/year fields.
+ /// Supports "YYYY-MM" and "MMYY" formats.
+ /// </summary>
+ /// <param name="expirationDate">The expiration string.</param>
+ /// <param name="card">The target credit card to populate.</param>
+ private static void ParseExpirationDate(string expirationDate, ImportedCreditcard card)
+ {
+ var value = expirationDate.Trim();
+
+ if (value.Contains('-'))
+ {
+ // "YYYY-MM"
+ var parts = value.Split('-');
+ if (parts.Length == 2 && parts[0].Length == 4 && parts[1].Length is 1 or 2)
+ {
+ card.ExpiryYear = parts[0];
+ card.ExpiryMonth = parts[1].PadLeft(2, '0');
+ }
+
+ return;
+ }
+
+ // "MMYY" (4 digits, no separator)
+ if (value.Length == 4 && value.All(char.IsDigit))
+ {
+ card.ExpiryMonth = value.Substring(0, 2);
+ card.ExpiryYear = "20" + value.Substring(2, 2);
+ }
+ }
+
+ /// <summary>
+ /// Extracts identity-specific content (Proton Pass "identity" item type).
+ /// </summary>
+ /// <param name="credential">The credential to populate.</param>
+ /// <param name="content">The identity content payload.</param>
+ private static void ExtractIdentityContent(ImportedCredential credential, ProtonPassContent? content)
+ {
+ if (content == null)
+ {
+ return;
+ }
+
+ var firstName = content.FirstName;
+ var lastName = content.LastName;
+
+ // If firstName/lastName aren't set but fullName is, split on the first space.
+ if (string.IsNullOrWhiteSpace(firstName) && string.IsNullOrWhiteSpace(lastName) &&
+ !string.IsNullOrWhiteSpace(content.FullName))
+ {
+ var parts = content.FullName.Split(' ', 2, StringSplitOptions.RemoveEmptyEntries);
+ firstName = parts.Length > 0 ? parts[0] : null;
+ lastName = parts.Length > 1 ? parts[1] : null;
+ }
+
+ credential.Alias = new ImportedAlias
+ {
+ FirstName = string.IsNullOrWhiteSpace(firstName) ? null : firstName,
+ LastName = string.IsNullOrWhiteSpace(lastName) ? null : lastName,
+ };
+
+ if (!string.IsNullOrWhiteSpace(content.Email))
+ {
+ credential.Email = content.Email;
+ }
+ }
+
+ /// <summary>
+ /// Extracts Proton Pass custom fields (extraFields) into the credential.
+ /// Known types:
+ /// - "text": plaintext value, stored in data.content.
+ /// - "hidden": sensitive value, stored in data.content.
+ /// - "totp": TOTP URI or secret, promoted to credential.TwoFactorSecret when absent,
+ /// otherwise appended as a custom field.
+ /// </summary>
+ /// <param name="credential">The credential to populate.</param>
+ /// <param name="extraFields">The list of extra fields from the item data.</param>
+ private static void ExtractExtraFields(ImportedCredential credential, List<ProtonPassExtraField>? extraFields)
+ {
+ if (extraFields == null || extraFields.Count == 0)
+ {
+ return;
+ }
+
+ foreach (var field in extraFields)
+ {
+ if (string.IsNullOrWhiteSpace(field.FieldName))
+ {
+ continue;
+ }
+
+ var type = field.Type?.ToLowerInvariant();
+ var value = field.Data?.Content;
+
+ if (type == "totp")
+ {
+ var totpValue = !string.IsNullOrWhiteSpace(field.Data?.TotpUri) ? field.Data.TotpUri : value;
+ if (string.IsNullOrWhiteSpace(totpValue))
+ {
+ continue;
+ }
+
+ if (string.IsNullOrWhiteSpace(credential.TwoFactorSecret))
+ {
+ credential.TwoFactorSecret = totpValue;
+ }
+ else
+ {
+ AddCustomField(credential, field.FieldName, totpValue);
+ }
+
+ continue;
+ }
+
+ if (!string.IsNullOrWhiteSpace(value))
+ {
+ AddCustomField(credential, field.FieldName, value);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Adds a key/value pair to the credential's CustomFields dictionary,
+ /// initialising it if necessary.
+ /// </summary>
+ /// <param name="credential">The credential to modify.</param>
+ /// <param name="name">The custom field name.</param>
+ /// <param name="value">The custom field value.</param>
+ private static void AddCustomField(ImportedCredential credential, string name, string value)
+ {
+ credential.CustomFields ??= new Dictionary<string, string>();
+ credential.CustomFields[name] = value;
+ }
+
+ /// <summary>
+ /// Extracts attachments referenced by an item's files array. Proton Pass stores
+ /// file blobs under "Proton Pass/files/&lt;fileId&gt;" within the archive.
+ /// </summary>
+ /// <param name="credential">The credential to populate.</param>
+ /// <param name="files">The item's referenced files.</param>
+ /// <param name="attachmentMap">Dictionary mapping archive paths to file data.</param>
+ private static void ExtractAttachments(
+ ImportedCredential credential,
+ List<ProtonPassFile>? files,
+ Dictionary<string, byte[]> attachmentMap)
+ {
+ if (files == null || files.Count == 0 || attachmentMap.Count == 0)
+ {
+ return;
+ }
+
+ foreach (var file in files)
+ {
+ if (string.IsNullOrWhiteSpace(file.FileId))
+ {
+ continue;
+ }
+
+ // Match either an exact path (files/<id>) or a path that starts with the id
+ // (files/<id>/<filename>, files/<id>.<ext>, etc.) — the exact layout isn't
+ // publicly documented, so we handle both.
+ var match = attachmentMap.FirstOrDefault(kvp =>
+ {
+ var relative = kvp.Key.Substring(FilesPath.Length);
+ return relative.Equals(file.FileId, StringComparison.OrdinalIgnoreCase) ||
+ relative.StartsWith(file.FileId + "/", StringComparison.OrdinalIgnoreCase) ||
+ relative.StartsWith(file.FileId + ".", StringComparison.OrdinalIgnoreCase);
+ });
+
+ if (match.Value == null)
+ {
+ continue;
+ }
+
+ credential.Attachments ??= new List<ImportedAttachment>();
+ credential.Attachments.Add(new ImportedAttachment
+ {
+ Filename = !string.IsNullOrWhiteSpace(file.Name) ? file.Name : file.FileId,
+ Blob = match.Value,
+ });
+ }
+ }
+}
diff --git a/apps/server/Utilities/AliasVault.ImportExport/Models/Imports/ProtonPassJson.cs b/apps/server/Utilities/AliasVault.ImportExport/Models/Imports/ProtonPassJson.cs
new file mode 100644
index 000000000..859b786fc
--- /dev/null
+++ b/apps/server/Utilities/AliasVault.ImportExport/Models/Imports/ProtonPassJson.cs
@@ -0,0 +1,424 @@
+//-----------------------------------------------------------------------
+// <copyright file="ProtonPassJson.cs" company="aliasvault">
+// Copyright (c) aliasvault. All rights reserved.
+// Licensed under the AGPLv3 license. See LICENSE.md file in the project root for full license information.
+// </copyright>
+//-----------------------------------------------------------------------
+
+namespace AliasVault.ImportExport.Models.Imports;
+
+using System.Text.Json.Serialization;
+
+/// <summary>
+/// Root structure of a Proton Pass JSON export (data.json file inside a "Proton Pass/" folder in the ZIP).
+/// </summary>
+public class ProtonPassJsonExport
+{
+ /// <summary>
+ /// Gets or sets the user ID.
+ /// </summary>
+ [JsonPropertyName("userId")]
+ public string? UserId { get; set; }
+
+ /// <summary>
+ /// Gets or sets the exporter version.
+ /// </summary>
+ [JsonPropertyName("version")]
+ public string? Version { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether the export payload is encrypted.
+ /// When true, the export contains an encrypted PGP payload which is not supported.
+ /// </summary>
+ [JsonPropertyName("encrypted")]
+ public bool Encrypted { get; set; }
+
+ /// <summary>
+ /// Gets or sets the vaults, keyed by vault ID.
+ /// </summary>
+ [JsonPropertyName("vaults")]
+ public Dictionary<string, ProtonPassVault> Vaults { get; set; } = new();
+}
+
+/// <summary>
+/// Represents a Proton Pass vault.
+/// </summary>
+public class ProtonPassVault
+{
+ /// <summary>
+ /// Gets or sets the vault name.
+ /// </summary>
+ [JsonPropertyName("name")]
+ public string? Name { get; set; }
+
+ /// <summary>
+ /// Gets or sets the vault description.
+ /// </summary>
+ [JsonPropertyName("description")]
+ public string? Description { get; set; }
+
+ /// <summary>
+ /// Gets or sets the display settings (color, icon).
+ /// </summary>
+ [JsonPropertyName("display")]
+ public ProtonPassDisplay? Display { get; set; }
+
+ /// <summary>
+ /// Gets or sets the items in this vault.
+ /// </summary>
+ [JsonPropertyName("items")]
+ public List<ProtonPassItem> Items { get; set; } = new();
+}
+
+/// <summary>
+/// Represents vault display settings.
+/// </summary>
+public class ProtonPassDisplay
+{
+ /// <summary>
+ /// Gets or sets the color index.
+ /// </summary>
+ [JsonPropertyName("color")]
+ public int Color { get; set; }
+
+ /// <summary>
+ /// Gets or sets the icon index.
+ /// </summary>
+ [JsonPropertyName("icon")]
+ public int Icon { get; set; }
+}
+
+/// <summary>
+/// Represents an item envelope in a Proton Pass vault.
+/// </summary>
+public class ProtonPassItem
+{
+ /// <summary>
+ /// Gets or sets the item ID.
+ /// </summary>
+ [JsonPropertyName("itemId")]
+ public string? ItemId { get; set; }
+
+ /// <summary>
+ /// Gets or sets the share ID.
+ /// </summary>
+ [JsonPropertyName("shareId")]
+ public string? ShareId { get; set; }
+
+ /// <summary>
+ /// Gets or sets the item data payload.
+ /// </summary>
+ [JsonPropertyName("data")]
+ public ProtonPassItemData? Data { get; set; }
+
+ /// <summary>
+ /// Gets or sets the item state (1 = active, 2 = trashed).
+ /// </summary>
+ [JsonPropertyName("state")]
+ public int State { get; set; }
+
+ /// <summary>
+ /// Gets or sets the alias email (populated for items of type "alias").
+ /// </summary>
+ [JsonPropertyName("aliasEmail")]
+ public string? AliasEmail { get; set; }
+
+ /// <summary>
+ /// Gets or sets the content format version.
+ /// </summary>
+ [JsonPropertyName("contentFormatVersion")]
+ public int ContentFormatVersion { get; set; }
+
+ /// <summary>
+ /// Gets or sets the creation timestamp (Unix seconds).
+ /// </summary>
+ [JsonPropertyName("createTime")]
+ public long? CreateTime { get; set; }
+
+ /// <summary>
+ /// Gets or sets the last modification timestamp (Unix seconds).
+ /// </summary>
+ [JsonPropertyName("modifyTime")]
+ public long? ModifyTime { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether the item is pinned.
+ /// </summary>
+ [JsonPropertyName("pinned")]
+ public bool Pinned { get; set; }
+
+ /// <summary>
+ /// Gets or sets the number of shares for this item.
+ /// </summary>
+ [JsonPropertyName("shareCount")]
+ public int ShareCount { get; set; }
+
+ /// <summary>
+ /// Gets or sets the attached files.
+ /// </summary>
+ [JsonPropertyName("files")]
+ public List<ProtonPassFile>? Files { get; set; }
+}
+
+/// <summary>
+/// Represents the typed data payload of a Proton Pass item.
+/// </summary>
+public class ProtonPassItemData
+{
+ /// <summary>
+ /// Gets or sets the item metadata (name, note, uuid).
+ /// </summary>
+ [JsonPropertyName("metadata")]
+ public ProtonPassMetadata? Metadata { get; set; }
+
+ /// <summary>
+ /// Gets or sets the custom fields defined on the item.
+ /// </summary>
+ [JsonPropertyName("extraFields")]
+ public List<ProtonPassExtraField>? ExtraFields { get; set; }
+
+ /// <summary>
+ /// Gets or sets the item type (e.g., "login", "note", "alias", "creditCard", "identity").
+ /// </summary>
+ [JsonPropertyName("type")]
+ public string? Type { get; set; }
+
+ /// <summary>
+ /// Gets or sets the type-specific content payload.
+ /// </summary>
+ [JsonPropertyName("content")]
+ public ProtonPassContent? Content { get; set; }
+}
+
+/// <summary>
+/// Represents Proton Pass item metadata.
+/// </summary>
+public class ProtonPassMetadata
+{
+ /// <summary>
+ /// Gets or sets the display name.
+ /// </summary>
+ [JsonPropertyName("name")]
+ public string? Name { get; set; }
+
+ /// <summary>
+ /// Gets or sets the note.
+ /// </summary>
+ [JsonPropertyName("note")]
+ public string? Note { get; set; }
+
+ /// <summary>
+ /// Gets or sets the item UUID.
+ /// </summary>
+ [JsonPropertyName("itemUuid")]
+ public string? ItemUuid { get; set; }
+}
+
+/// <summary>
+/// Represents the content payload of a Proton Pass item.
+/// Fields are a union across item types; only a subset will be populated for any given item.
+/// </summary>
+public class ProtonPassContent
+{
+ /// <summary>
+ /// Gets or sets the username (login items).
+ /// </summary>
+ [JsonPropertyName("itemUsername")]
+ public string? ItemUsername { get; set; }
+
+ /// <summary>
+ /// Gets or sets the email address stored on the login (login items).
+ /// </summary>
+ [JsonPropertyName("itemEmail")]
+ public string? ItemEmail { get; set; }
+
+ /// <summary>
+ /// Gets or sets the password (login items).
+ /// </summary>
+ [JsonPropertyName("password")]
+ public string? Password { get; set; }
+
+ /// <summary>
+ /// Gets or sets the URLs (login items).
+ /// </summary>
+ [JsonPropertyName("urls")]
+ public List<string>? Urls { get; set; }
+
+ /// <summary>
+ /// Gets or sets the TOTP URI (login items).
+ /// </summary>
+ [JsonPropertyName("totpUri")]
+ public string? TotpUri { get; set; }
+
+ /// <summary>
+ /// Gets or sets the passkeys (login items).
+ /// </summary>
+ [JsonPropertyName("passkeys")]
+ public List<ProtonPassPasskey>? Passkeys { get; set; }
+
+ /// <summary>
+ /// Gets or sets the cardholder name (credit card items).
+ /// </summary>
+ [JsonPropertyName("cardholderName")]
+ public string? CardholderName { get; set; }
+
+ /// <summary>
+ /// Gets or sets the card number (credit card items).
+ /// </summary>
+ [JsonPropertyName("number")]
+ public string? Number { get; set; }
+
+ /// <summary>
+ /// Gets or sets the verification number / CVV (credit card items).
+ /// </summary>
+ [JsonPropertyName("verificationNumber")]
+ public string? VerificationNumber { get; set; }
+
+ /// <summary>
+ /// Gets or sets the card PIN (credit card items).
+ /// </summary>
+ [JsonPropertyName("pin")]
+ public string? Pin { get; set; }
+
+ /// <summary>
+ /// Gets or sets the expiration date (credit card items, usually "YYYY-MM" or "MMYY").
+ /// </summary>
+ [JsonPropertyName("expirationDate")]
+ public string? ExpirationDate { get; set; }
+
+ /// <summary>
+ /// Gets or sets the card type (credit card items).
+ /// </summary>
+ [JsonPropertyName("cardType")]
+ public int? CardType { get; set; }
+
+ /// <summary>
+ /// Gets or sets the identity's first name (identity items).
+ /// </summary>
+ [JsonPropertyName("firstName")]
+ public string? FirstName { get; set; }
+
+ /// <summary>
+ /// Gets or sets the identity's last name (identity items).
+ /// </summary>
+ [JsonPropertyName("lastName")]
+ public string? LastName { get; set; }
+
+ /// <summary>
+ /// Gets or sets the identity's full name (identity items).
+ /// </summary>
+ [JsonPropertyName("fullName")]
+ public string? FullName { get; set; }
+
+ /// <summary>
+ /// Gets or sets the identity's primary email (identity items).
+ /// </summary>
+ [JsonPropertyName("email")]
+ public string? Email { get; set; }
+}
+
+/// <summary>
+/// Represents a passkey associated with a Proton Pass login item.
+/// </summary>
+public class ProtonPassPasskey
+{
+ /// <summary>
+ /// Gets or sets the credential ID.
+ /// </summary>
+ [JsonPropertyName("credentialId")]
+ public string? CredentialId { get; set; }
+
+ /// <summary>
+ /// Gets or sets the relying party ID (domain).
+ /// </summary>
+ [JsonPropertyName("rpId")]
+ public string? RpId { get; set; }
+
+ /// <summary>
+ /// Gets or sets the relying party name.
+ /// </summary>
+ [JsonPropertyName("rpName")]
+ public string? RpName { get; set; }
+
+ /// <summary>
+ /// Gets or sets the username associated with the passkey.
+ /// </summary>
+ [JsonPropertyName("userName")]
+ public string? UserName { get; set; }
+}
+
+/// <summary>
+/// Represents a Proton Pass custom field entry.
+/// Types observed in public Proton Pass exports: "text", "hidden", "totp".
+/// </summary>
+public class ProtonPassExtraField
+{
+ /// <summary>
+ /// Gets or sets the label/name of the custom field.
+ /// </summary>
+ [JsonPropertyName("fieldName")]
+ public string? FieldName { get; set; }
+
+ /// <summary>
+ /// Gets or sets the field type (e.g., "text", "hidden", "totp").
+ /// </summary>
+ [JsonPropertyName("type")]
+ public string? Type { get; set; }
+
+ /// <summary>
+ /// Gets or sets the field data (content wrapper keyed by type).
+ /// </summary>
+ [JsonPropertyName("data")]
+ public ProtonPassExtraFieldData? Data { get; set; }
+}
+
+/// <summary>
+/// Represents the inner data payload of a Proton Pass custom field.
+/// For text/hidden/totp the value lives under "content".
+/// </summary>
+public class ProtonPassExtraFieldData
+{
+ /// <summary>
+ /// Gets or sets the field value.
+ /// </summary>
+ [JsonPropertyName("content")]
+ public string? Content { get; set; }
+
+ /// <summary>
+ /// Gets or sets the TOTP URI when the field is of type "totp".
+ /// Some exporter versions nest the secret under "totpUri" instead of "content".
+ /// </summary>
+ [JsonPropertyName("totpUri")]
+ public string? TotpUri { get; set; }
+}
+
+/// <summary>
+/// Represents a reference to a file attached to a Proton Pass item.
+/// The binary payload is stored elsewhere in the ZIP archive.
+/// </summary>
+public class ProtonPassFile
+{
+ /// <summary>
+ /// Gets or sets the file ID.
+ /// </summary>
+ [JsonPropertyName("fileID")]
+ public string? FileId { get; set; }
+
+ /// <summary>
+ /// Gets or sets the file name.
+ /// </summary>
+ [JsonPropertyName("name")]
+ public string? Name { get; set; }
+
+ /// <summary>
+ /// Gets or sets the MIME type.
+ /// </summary>
+ [JsonPropertyName("mimeType")]
+ public string? MimeType { get; set; }
+
+ /// <summary>
+ /// Gets or sets the file size in bytes.
+ /// </summary>
+ [JsonPropertyName("size")]
+ public long? Size { get; set; }
+}