@@ -34,6 +34,38 @@ public struct User: Sendable {
3434 public let untrustedMetadata : JSON ?
3535 /// The user's trusted metadata
3636 public let trustedMetadata : JSON ?
37+
38+ public init (
39+ createdAt: Date ,
40+ cryptoWallets: [ CryptoWallet ] ,
41+ emails: [ Email ] ,
42+ userId: Self . ID ,
43+ name: Name ,
44+ password: Password ? ,
45+ phoneNumbers: [ PhoneNumber ] ,
46+ providers: [ Provider ] ,
47+ status: UserStatus ,
48+ totps: [ TOTP ] ,
49+ webauthnRegistrations: [ WebAuthNRegistration ] ,
50+ biometricRegistrations: [ BiometricRegistration ] ,
51+ untrustedMetadata: JSON ? ,
52+ trustedMetadata: JSON ?
53+ ) {
54+ self . createdAt = createdAt
55+ self . cryptoWallets = cryptoWallets
56+ self . emails = emails
57+ self . userId = userId
58+ self . name = name
59+ self . password = password
60+ self . phoneNumbers = phoneNumbers
61+ self . providers = providers
62+ self . status = status
63+ self . totps = totps
64+ self . webauthnRegistrations = webauthnRegistrations
65+ self . biometricRegistrations = biometricRegistrations
66+ self . untrustedMetadata = untrustedMetadata
67+ self . trustedMetadata = trustedMetadata
68+ }
3769}
3870
3971extension User : Equatable {
@@ -83,6 +115,11 @@ public extension User {
83115 let passwordId : ID
84116 let requiresReset : Bool
85117
118+ public init ( passwordId: Self . ID , requiresReset: Bool ) {
119+ self . passwordId = passwordId
120+ self . requiresReset = requiresReset
121+ }
122+
86123 public static func == ( lhs: Self , rhs: Self ) -> Bool {
87124 lhs. passwordId == rhs. passwordId &&
88125 lhs. requiresReset == rhs. requiresReset
@@ -103,6 +140,13 @@ public extension User {
103140 /// The verification status of the cryptowallet.
104141 public let verified : Bool
105142
143+ public init ( cryptoWalletId: Self . ID , cryptoWalletAddress: String , cryptoWalletType: String , verified: Bool ) {
144+ self . cryptoWalletId = cryptoWalletId
145+ self . cryptoWalletAddress = cryptoWalletAddress
146+ self . cryptoWalletType = cryptoWalletType
147+ self . verified = verified
148+ }
149+
106150 public static func == ( lhs: Self , rhs: Self ) -> Bool {
107151 lhs. cryptoWalletId == rhs. cryptoWalletId &&
108152 lhs. cryptoWalletAddress == rhs. cryptoWalletAddress &&
@@ -121,6 +165,12 @@ public extension User {
121165 /// The verification status of the email.
122166 public let verified : Bool
123167
168+ public init ( email: String , emailId: Self . ID , verified: Bool ) {
169+ self . email = email
170+ self . emailId = emailId
171+ self . verified = verified
172+ }
173+
124174 public static func == ( lhs: Self , rhs: Self ) -> Bool {
125175 lhs. email == rhs. email &&
126176 lhs. emailId == rhs. emailId &&
@@ -161,6 +211,13 @@ public extension User {
161211 public var id : ID { oauthUserRegistrationId }
162212 let oauthUserRegistrationId : ID
163213
214+ public init ( providerSubject: String , providerType: String , profilePictureUrl: String ? , oauthUserRegistrationId: Self . ID ) {
215+ self . providerSubject = providerSubject
216+ self . providerType = providerType
217+ self . profilePictureUrl = profilePictureUrl
218+ self . oauthUserRegistrationId = oauthUserRegistrationId
219+ }
220+
164221 public static func == ( lhs: Self , rhs: Self ) -> Bool {
165222 lhs. providerSubject == rhs. providerSubject &&
166223 lhs. providerType == rhs. providerType &&
@@ -179,6 +236,12 @@ public extension User {
179236 /// The verification status of the phone number.
180237 public let verified : Bool
181238
239+ public init ( phoneNumber: String , phoneId: Self . ID , verified: Bool ) {
240+ self . phoneNumber = phoneNumber
241+ self . phoneId = phoneId
242+ self . verified = verified
243+ }
244+
182245 public static func == ( lhs: Self , rhs: Self ) -> Bool {
183246 lhs. phoneNumber == rhs. phoneNumber &&
184247 lhs. phoneId == rhs. phoneId &&
@@ -201,6 +264,11 @@ public extension User {
201264 /// The verification status of the TOTP.
202265 public let verified : Bool
203266
267+ public init ( totpId: Self . ID , verified: Bool ) {
268+ self . totpId = totpId
269+ self . verified = verified
270+ }
271+
204272 public static func == ( lhs: Self , rhs: Self ) -> Bool {
205273 lhs. totpId == rhs. totpId &&
206274 lhs. verified == rhs. verified
@@ -219,6 +287,13 @@ public extension User {
219287 public var id : ID { webauthnRegistrationId }
220288 let webauthnRegistrationId : ID
221289
290+ public init ( domain: String , userAgent: String , verified: Bool , webauthnRegistrationId: Self . ID ) {
291+ self . domain = domain
292+ self . userAgent = userAgent
293+ self . verified = verified
294+ self . webauthnRegistrationId = webauthnRegistrationId
295+ }
296+
222297 public static func == ( lhs: Self , rhs: Self ) -> Bool {
223298 lhs. domain == rhs. domain &&
224299 lhs. userAgent == rhs. userAgent &&
@@ -235,6 +310,11 @@ public extension User {
235310 public var id : ID { biometricRegistrationId }
236311 let biometricRegistrationId : ID
237312
313+ public init ( verified: Bool , biometricRegistrationId: Self . ID ) {
314+ self . verified = verified
315+ self . biometricRegistrationId = biometricRegistrationId
316+ }
317+
238318 public static func == ( lhs: Self , rhs: Self ) -> Bool {
239319 lhs. verified == rhs. verified &&
240320 lhs. biometricRegistrationId == rhs. biometricRegistrationId
0 commit comments