-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOnePuxJsonContext.cs
More file actions
113 lines (96 loc) · 2.93 KB
/
Copy pathOnePuxJsonContext.cs
File metadata and controls
113 lines (96 loc) · 2.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
using System.Text.Json.Serialization;
namespace PassKey.Core.Services;
// --- 1Password 1PUX Export DTOs ---
public sealed class OnePuxExport
{
public OnePuxAccount[]? Accounts { get; set; }
}
public sealed class OnePuxAccount
{
public OnePuxVault[]? Vaults { get; set; }
}
public sealed class OnePuxVault
{
public OnePuxItem[]? Items { get; set; }
}
public sealed class OnePuxItem
{
public string? Uuid { get; set; }
public OnePuxOverview? Overview { get; set; }
public OnePuxDetails? Details { get; set; }
}
public sealed class OnePuxOverview
{
public string? Title { get; set; }
public string? Url { get; set; }
public OnePuxUrl[]? Urls { get; set; }
public string[]? Tags { get; set; }
}
public sealed class OnePuxUrl
{
public string? Url { get; set; }
}
public sealed class OnePuxDetails
{
public string? NotesPlain { get; set; }
public OnePuxLoginField[]? LoginFields { get; set; }
public OnePuxSection[]? Sections { get; set; }
}
public sealed class OnePuxLoginField
{
public string? Designation { get; set; }
public string? Value { get; set; }
public string? Name { get; set; }
public string? Type { get; set; }
}
public sealed class OnePuxSection
{
public string? Title { get; set; }
public OnePuxSectionField[]? Fields { get; set; }
}
public sealed class OnePuxSectionField
{
public string? Title { get; set; }
public OnePuxFieldValue? Value { get; set; }
}
public sealed class OnePuxFieldValue
{
// Different field types store values in different properties
public string? String { get; set; }
public string? CreditCardNumber { get; set; }
public string? CreditCardType { get; set; }
public int? MonthYear { get; set; }
public string? Phone { get; set; }
public string? Email { get; set; }
public string? Concealed { get; set; }
public OnePuxAddress? Address { get; set; }
public OnePuxDate? Date { get; set; }
/// <summary>
/// Some 1Password 1pux exports use a dedicated <c>totp</c> field for one-time
/// password URIs (full <c>otpauth://...</c> form). Older exports embed the URI
/// in <see cref="String"/> or <see cref="Concealed"/> with the field title set
/// to "one-time password" — the importer handles both shapes.
/// </summary>
public string? Totp { get; set; }
}
public sealed class OnePuxAddress
{
public string? Street { get; set; }
public string? City { get; set; }
public string? State { get; set; }
public string? Zip { get; set; }
public string? Country { get; set; }
}
public sealed class OnePuxDate
{
public int? Year { get; set; }
public int? Month { get; set; }
public int? Day { get; set; }
}
[JsonSourceGenerationOptions(
PropertyNamingPolicy = JsonKnownNamingPolicy.CamelCase,
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)]
[JsonSerializable(typeof(OnePuxExport))]
public partial class OnePuxJsonContext : JsonSerializerContext
{
}