@@ -2,14 +2,27 @@ module BW.Types where
22
33import Prelude
44
5+import Bridge as Bridge
56import Data.Argonaut (class DecodeJson, class EncodeJson)
7+import Data.Either (Either)
8+import Data.Either as Either
9+import Data.Int as Int
610import Data.JNullable (JNullable)
711import Data.JOpt (JOpt)
12+import Data.Maybe (Maybe(..))
13+import Data.Nullable (Nullable)
814import Data.ShowableJson (ShowableJson)
915import Data.Timestamp (Timestamp)
16+import Data.Traversable (for)
17+import Data.Tuple.Nested ((/\))
18+import Foreign as Foreign
19+import Literals.Undefined (Undefined)
20+import Type.Prelude (Proxy(..))
21+import Untagged.TypeCheck (class HasRuntimeType)
22+import Untagged.Union (type (|+|))
23+import Untagged.Union as Union
1024
11−newtype EncryptedString
12− = EncryptedString String
25+newtype EncryptedString = EncryptedString String
1326
1427derive newtype instance Show EncryptedString
1528derive newtype instance Ord EncryptedString
@@ -18,78 +31,86 @@ derive newtype instance EncodeJson EncryptedString
1831derive newtype instance DecodeJson EncryptedString
1932
2033kdfPBKDF2_SHA256 = 0 :: KDF
34+kdfArgon2id = 1 :: KDF
2135
22−type KDF
23− = Int
24−
25−type PreloginResponse
26− = { kdf :: KDF
27− , kdfIterations :: Int
28− }
29−
30−type PreloginRequest
31− = { email :: String
32− }
33−
34−type ProfileResponse
35− = { id :: String
36− , name :: JNullable String
37− , email :: String
38− , emailVerified :: Boolean
39− , masterPasswordHint :: JNullable String
40− , premiumPersonally :: Boolean
41− -- , premiumFromOrganization :: Boolean
42− , culture :: JNullable String
43− , twoFactorEnabled :: Boolean
44− , key :: EncryptedString
45− , privateKey :: EncryptedString
46− , securityStamp :: JNullable String
47− , forcePasswordReset :: Boolean
48− , usesKeyConnector :: Boolean
49− , organizations :: Array ProfileOrganizationResponse
50− , providers :: Array ProfileProviderResponse
51− , providerOrganizations :: Array ProfileProviderOrganizationResponse
52− }
53−
54−type ProfileOrganizationResponse
55− = { id :: String
56− , name :: JNullable String
57− , usePolicies :: JNullable Boolean
58− , useGroups :: JNullable Boolean
59− , useDirectory :: JNullable Boolean
60− , useEvents :: JNullable Boolean
61− , useTotp :: JNullable Boolean
62− , use2fa :: JNullable Boolean
63− , useApi :: JNullable Boolean
64− , useSso :: JNullable Boolean
65− , useKeyConnector :: JNullable Boolean
66− , useResetPassword :: JNullable Boolean
67− , selfHost :: JNullable Boolean
68− , usersGetPremium :: JNullable Boolean
69− , seats :: JNullable Int
70− , maxCollections :: JNullable Int
71− , maxStorageGb :: JNullable Int
72− , key :: JNullable String
73− , hasPublicAndPrivateKeys :: JNullable Boolean
74− , status :: JNullable OrganizationUserStatusType
75− , type :: JNullable OrganizationUserType
76− , enabled :: JNullable Boolean
77− , ssoBound :: JNullable Boolean
78− , identifier :: JNullable String
79− , permissions :: JNullable PermissionsApi
80− , resetPasswordEnrolled :: JNullable Boolean
81− , userId :: JNullable String
82− , providerId :: JNullable String
83− , providerName :: JNullable String
84− , familySponsorshipFriendlyName :: JNullable String
85− , familySponsorshipAvailable :: JNullable Boolean
86− , planProductType :: JNullable ProductType
87− , keyConnectorEnabled :: JNullable Boolean
88− , keyConnectorUrl :: JNullable String
89− , familySponsorshipLastSyncDate :: JNullable Timestamp
90− , familySponsorshipValidUntil :: JNullable Timestamp
91− , familySponsorshipToDelete :: JNullable Boolean
92− }
36+type KDF = Int
37+
38+type PreloginResponse =
39+ { kdf :: KDF
40+ , kdfIterations :: Int
41+ , kdfMemory :: JNullable Int
42+ , kdfParallelism :: JNullable Int
43+ }
44+
45+type KdfConfig =
46+ { iterations :: Int
47+ , memory :: JNullable Int
48+ , parallelism :: JNullable Int
49+ }
50+
51+type PreloginRequest =
52+ { email :: Email
53+ }
54+
55+type ProfileResponse =
56+ { id :: String
57+ , name :: JNullable String
58+ , email :: String
59+ , emailVerified :: Boolean
60+ , masterPasswordHint :: JNullable String
61+ -- , premiumPersonally :: Boolean
62+ -- , premiumFromOrganization :: Boolean
63+ , culture :: JNullable String
64+ , twoFactorEnabled :: Boolean
65+ , key :: EncryptedString
66+ , privateKey :: EncryptedString
67+ , securityStamp :: JNullable String
68+ , forcePasswordReset :: Boolean
69+ , usesKeyConnector :: Boolean
70+ -- , organizations :: Array ProfileOrganizationResponse
71+ , providers :: Array ProfileProviderResponse
72+ , providerOrganizations :: Array ProfileProviderOrganizationResponse
73+ }
74+
75+type ProfileOrganizationResponse =
76+ { id :: String
77+ , name :: JNullable String
78+ , usePolicies :: JNullable Boolean
79+ , useGroups :: JNullable Boolean
80+ , useDirectory :: JNullable Boolean
81+ , useEvents :: JNullable Boolean
82+ , useTotp :: JNullable Boolean
83+ , use2fa :: JNullable Boolean
84+ , useApi :: JNullable Boolean
85+ , useSso :: JNullable Boolean
86+ , useKeyConnector :: JNullable Boolean
87+ , useResetPassword :: JNullable Boolean
88+ , selfHost :: JNullable Boolean
89+ , usersGetPremium :: JNullable Boolean
90+ , seats :: JNullable Int
91+ , maxCollections :: JNullable Int
92+ , maxStorageGb :: JNullable Int
93+ , key :: JNullable String
94+ , hasPublicAndPrivateKeys :: JNullable Boolean
95+ , status :: JNullable OrganizationUserStatusType
96+ , type :: JNullable OrganizationUserType
97+ , enabled :: JNullable Boolean
98+ , ssoBound :: JNullable Boolean
99+ , identifier :: JNullable String
100+ , permissions :: JNullable PermissionsApi
101+ , resetPasswordEnrolled :: JNullable Boolean
102+ , userId :: JNullable String
103+ , providerId :: JNullable String
104+ , providerName :: JNullable String
105+ , familySponsorshipFriendlyName :: JNullable String
106+ , familySponsorshipAvailable :: JNullable Boolean
107+ , planProductType :: JNullable ProductType
108+ , keyConnectorEnabled :: JNullable Boolean
109+ , keyConnectorUrl :: JNullable String
110+ , familySponsorshipLastSyncDate :: JNullable Timestamp
111+ , familySponsorshipValidUntil :: JNullable Timestamp
112+ , familySponsorshipToDelete :: JNullable Boolean
113+ }
93114
94115organizationUserStatusTypeInvited = 0 :: OrganizationUserStatusType
95116
@@ -97,8 +118,7 @@ organizationUserStatusTypeAccepted = 0 :: OrganizationUserStatusType
97118
98119organizationUserStatusTypeConfirmed = 0 :: OrganizationUserStatusType
99120
100−type OrganizationUserStatusType
101− = Int
121+type OrganizationUserStatusType = Int
102122
103123organizationUserTypeOwner = 0 :: OrganizationUserType
104124
@@ -110,27 +130,26 @@ organizationUserTypeManager = 3 :: OrganizationUserType
110130
111131organizationUserTypeCustom = 4 :: OrganizationUserType
112132
113−type OrganizationUserType
114− = Int
115−
116−type PermissionsApi
117− = { accessEventLogs :: Boolean
118− , accessImportExport :: Boolean
119− , accessReports :: Boolean
120− , manageAllCollections :: Boolean
121− , createNewCollections :: Boolean
122− , editAnyCollection :: Boolean
123− , deleteAnyCollection :: Boolean
124− , manageAssignedCollections :: Boolean
125− , editAssignedCollections :: Boolean
126− , deleteAssignedCollections :: Boolean
127− , manageCiphers :: Boolean
128− , manageGroups :: Boolean
129− , manageSso :: Boolean
130− , managePolicies :: Boolean
131− , manageUsers :: Boolean
132− , manageResetPassword :: Boolean
133− }
133+type OrganizationUserType = Int
134+
135+type PermissionsApi =
136+ { accessEventLogs :: Boolean
137+ , accessImportExport :: Boolean
138+ , accessReports :: Boolean
139+ , manageAllCollections :: Boolean
140+ , createNewCollections :: Boolean
141+ , editAnyCollection :: Boolean
142+ , deleteAnyCollection :: Boolean
143+ , manageAssignedCollections :: Boolean
144+ , editAssignedCollections :: Boolean
145+ , deleteAssignedCollections :: Boolean
146+ , manageCiphers :: Boolean
147+ , manageGroups :: Boolean
148+ , manageSso :: Boolean
149+ , managePolicies :: Boolean
150+ , manageUsers :: Boolean
151+ , manageResetPassword :: Boolean
152+ }
134153
135154productTypeFree = 0 :: ProductType
136155
@@ -140,20 +159,19 @@ productTypeTeams = 2 :: ProductType
140159
141160productTypeEnterprise = 3 :: ProductType
142161
143−type ProductType
144− = Int
145−
146−type ProfileProviderResponse
147− = { id :: String
148− , name :: JNullable String
149− , key :: JNullable String
150− , status :: JNullable ProviderUserStatusType
151− , type :: JNullable ProviderUserType
152− , enabled :: Boolean
153− , permissions :: PermissionsApi
154− , userId :: JNullable String
155− , useEvents :: Boolean
156− }
162+type ProductType = Int
163+
164+type ProfileProviderResponse =
165+ { id :: String
166+ , name :: JNullable String
167+ , key :: JNullable String
168+ , status :: JNullable ProviderUserStatusType
169+ , type :: JNullable ProviderUserType
170+ , enabled :: Boolean
171+ , permissions :: PermissionsApi
172+ , userId :: JNullable String
173+ , useEvents :: Boolean
174+ }
157175
158176providerUserStatusTypeInvited = 0 :: ProviderUserStatusType
159177
@@ -161,81 +179,79 @@ providerUserStatusTypeAccepted = 1 :: ProviderUserStatusType
161179
162180providerUserStatusTypeConfirmed = 2 :: ProviderUserStatusType
163181
164−type ProviderUserStatusType
165− = Int
182+type ProviderUserStatusType = Int
166183
167184providerUserTypeProviderAdmin = 0 :: ProviderUserType
168185
169186providerUserTypeServiceUser = 1 :: ProviderUserType
170187
171−type ProviderUserType
172− = Int
173−
174−type ProfileProviderOrganizationResponse
175− = { id :: String
176− , name :: JNullable String
177− , usePolicies :: Boolean
178− , useGroups :: Boolean
179− , useDirectory :: Boolean
180− , useEvents :: Boolean
181− , useTotp :: Boolean
182− , use2fa :: Boolean
183− , useApi :: Boolean
184− , useSso :: Boolean
185− , useKeyConnector :: Boolean
186− , useResetPassword :: Boolean
187− , selfHost :: Boolean
188− , usersGetPremium :: Boolean
189− , seats :: Int
190− , maxCollections :: Int
191− , maxStorageGb :: JNullable Int
192− , key :: JNullable String
193− , hasPublicAndPrivateKeys :: Boolean
194− , status :: OrganizationUserStatusType
195− , type :: OrganizationUserType
196− , enabled :: Boolean
197− , ssoBound :: Boolean
198− , identifier :: JNullable String
199− , permissions :: PermissionsApi
200− , resetPasswordEnrolled :: Boolean
201− , userId :: JNullable String
202− , providerId :: JNullable String
203− , providerName :: JNullable String
204− , familySponsorshipFriendlyName :: JNullable String
205− , familySponsorshipAvailable :: Boolean
206− , planProductType :: ProductType
207− , keyConnectorEnabled :: Boolean
208− , keyConnectorUrl :: JNullable String
209− , familySponsorshipLastSyncDate :: JNullable Timestamp
210− , familySponsorshipValidUntil :: JNullable Timestamp
211− , familySponsorshipToDelete :: JNullable Boolean
212− }
213−
214−type Urls
215− = { base :: JNullable String
216− , webVault :: JNullable String
217− , api :: JNullable String
218− , identity :: JNullable String
219− , icons :: JNullable String
220− , notifications :: JNullable String
221− , events :: JNullable String
222− , keyConnector :: JNullable String
223− }
224−
225−type PasswordTokenRequest
226− = { email :: Email
227− , masterPasswordHash :: String
228− , captchaResponse :: String
229− , twoFactor :: TokenRequestTwoFactor
230− , device :: DeviceRequest
231− }
232−
233−type DeviceRequest
234− = { type :: DeviceType
235− , name :: String
236− , identifier :: String
237− , pushToken :: JNullable String
238− }
188+type ProviderUserType = Int
189+
190+type ProfileProviderOrganizationResponse =
191+ { id :: String
192+ , name :: JNullable String
193+ , usePolicies :: Boolean
194+ , useGroups :: Boolean
195+ , useDirectory :: Boolean
196+ , useEvents :: Boolean
197+ , useTotp :: Boolean
198+ , use2fa :: Boolean
199+ , useApi :: Boolean
200+ , useSso :: Boolean
201+ , useKeyConnector :: Boolean
202+ , useResetPassword :: Boolean
203+ , selfHost :: Boolean
204+ , usersGetPremium :: Boolean
205+ , seats :: Int
206+ , maxCollections :: Int
207+ , maxStorageGb :: JNullable Int
208+ , key :: JNullable String
209+ , hasPublicAndPrivateKeys :: Boolean
210+ , status :: OrganizationUserStatusType
211+ , type :: OrganizationUserType
212+ , enabled :: Boolean
213+ , ssoBound :: Boolean
214+ , identifier :: JNullable String
215+ , permissions :: PermissionsApi
216+ , resetPasswordEnrolled :: Boolean
217+ , userId :: JNullable String
218+ , providerId :: JNullable String
219+ , providerName :: JNullable String
220+ , familySponsorshipFriendlyName :: JNullable String
221+ , familySponsorshipAvailable :: Boolean
222+ , planProductType :: ProductType
223+ , keyConnectorEnabled :: Boolean
224+ , keyConnectorUrl :: JNullable String
225+ , familySponsorshipLastSyncDate :: JNullable Timestamp
226+ , familySponsorshipValidUntil :: JNullable Timestamp
227+ , familySponsorshipToDelete :: JNullable Boolean
228+ }
229+
230+type Urls =
231+ { base :: JNullable String
232+ , webVault :: JNullable String
233+ , api :: JNullable String
234+ , identity :: JNullable String
235+ , icons :: JNullable String
236+ , notifications :: JNullable String
237+ , events :: JNullable String
238+ , keyConnector :: JNullable String
239+ }
240+
241+type PasswordTokenRequest =
242+ { email :: Email
243+ , masterPasswordHash :: String
244+ , captchaResponse :: String
245+ , twoFactor :: TokenRequestTwoFactor
246+ , device :: DeviceRequest
247+ }
248+
249+type DeviceRequest =
250+ { type :: DeviceType
251+ , name :: String
252+ , identifier :: String
253+ , pushToken :: JNullable String
254+ }
239255
240256deviceTypeAndroid = 0 :: DeviceType
241257
@@ -279,14 +295,13 @@ deviceTypeVivaldiExtension = 19 :: DeviceType
279295
280296deviceTypeSafariExtension = 20 :: DeviceType
281297
282−type DeviceType
283− = Int
298+type DeviceType = Int
284299
285−type TokenRequestTwoFactor
286− = { provider :: TwoFactorProviderType
287− , token :: String
288− , remember :: Boolean
289− }
300+type TokenRequestTwoFactor =
301+ { provider :: TwoFactorProviderType
302+ , token :: String
303+ , remember :: Boolean
304+ }
290305
291306twoFactorProviderTypeAuthenticator = 0 :: TwoFactorProviderType
292307
@@ -304,24 +319,51 @@ twoFactorProviderTypeOrganizationDuo = 6 :: TwoFactorProviderType
304319
305320twoFactorProviderTypeWebAuthn = 7 :: TwoFactorProviderType
306321
307−type TwoFactorProviderType
308− = Int
309−
310−newtype Password
311− = Password String
322+type TwoFactorProviderType = Int
323+
324+secondFactorTypeToBridge
325+ :: TwoFactorProviderType
326+ -> Maybe Bridge.TwoFactorProviderType
327+secondFactorTypeToBridge x = case x of
328+ n
329+ | n == twoFactorProviderTypeAuthenticator -> Just Bridge.Authenticator
330+ n
331+ | n == twoFactorProviderTypeEmail -> Just Bridge.Email
332+ n
333+ | n == twoFactorProviderTypeDuo -> Just Bridge.Duo
334+ n
335+ | n == twoFactorProviderTypeYubikey -> Just Bridge.Yubikey
336+ n
337+ | n == twoFactorProviderTypeU2f -> Just Bridge.U2f
338+ n
339+ | n == twoFactorProviderTypeRemember -> Just Bridge.Remember
340+ n
341+ | n == twoFactorProviderTypeOrganizationDuo -> Just Bridge.OrganizationDuo
342+ n
343+ | n == twoFactorProviderTypeWebAuthn -> Just Bridge.WebAuthn
344+ _ -> Nothing
345+
346+bridgeToSecondFactorType :: Bridge.TwoFactorProviderType -> TwoFactorProviderType
347+bridgeToSecondFactorType Bridge.Authenticator = twoFactorProviderTypeAuthenticator
348+bridgeToSecondFactorType Bridge.Email = twoFactorProviderTypeEmail
349+bridgeToSecondFactorType Bridge.Duo = twoFactorProviderTypeDuo
350+bridgeToSecondFactorType Bridge.Yubikey = twoFactorProviderTypeYubikey
351+bridgeToSecondFactorType Bridge.U2f = twoFactorProviderTypeU2f
352+bridgeToSecondFactorType Bridge.Remember = twoFactorProviderTypeRemember
353+bridgeToSecondFactorType Bridge.OrganizationDuo = twoFactorProviderTypeOrganizationDuo
354+bridgeToSecondFactorType Bridge.WebAuthn = twoFactorProviderTypeWebAuthn
355+
356+newtype Password = Password String
312357
313358hashPurposeServerAuthorization = 1 :: HashPurpose
314359
315360hashPurposeLocalAuthorization = 2 :: HashPurpose
316361
317−type HashPurpose
318− = Int
362+type HashPurpose = Int
319363
320−newtype StringHash
321− = StringHash String
364+newtype StringHash = StringHash String
322365
323−newtype AccessToken
324− = AccessToken String
366+newtype AccessToken = AccessToken String
325367
326368derive newtype instance Show AccessToken
327369derive newtype instance Eq AccessToken
@@ -329,8 +371,7 @@ derive newtype instance Ord AccessToken
329371derive newtype instance EncodeJson AccessToken
330372derive newtype instance DecodeJson AccessToken
331373
332−newtype RefreshToken
333− = RefreshToken String
374+newtype RefreshToken = RefreshToken String
334375
335376derive newtype instance Show RefreshToken
336377derive newtype instance Eq RefreshToken
@@ -342,75 +383,91 @@ type IdentityCaptchaResponse =
342383 { siteKey :: String
343384 }
344385
345−type IdentityTokenResponse
346− = { accessToken :: AccessToken
347− , expiresIn :: Int
348− , refreshToken :: RefreshToken
349− , tokenType :: String
350− , resetMasterPassword :: Boolean
351− , privateKey :: EncryptedString
352− , key :: EncryptedString
353− , twoFactorToken :: JNullable String
354− , kdf :: KDF
355− , kdfIterations :: Int
356− , forcePasswordReset :: JNullable Boolean
357− , apiUseKeyConnector :: JNullable Boolean
358− , keyConnectorUrl :: JNullable String
359− }
360−
361−newtype Email
362− = Email String
363−
364−type SyncResponse
365− = { profile :: ProfileResponse
366− , folders :: Array FolderResponse
367− , collections :: Array CollectionDetailsResponse
368− , ciphers :: Array CipherResponse
369− , domains :: JNullable DomainsResponse
370− , policies :: JNullable (Array PolicyResponse)
371− , sends :: Array SendResponse
372− }
373−
374−type FolderResponse
375− = { id :: String
376− , name :: JNullable String
377− , revisionDate :: JNullable String
378− }
379−
380−type CollectionDetailsResponse
381− = { id :: String
382− , organizationId :: JNullable String
383− , name :: JNullable String
384− , externalId :: JNullable String
385− , readOnly :: Boolean
386− }
386+type IdentityTokenResponse =
387+ { accessToken :: AccessToken
388+ , expiresIn :: Int
389+ , refreshToken :: RefreshToken
390+ , tokenType :: String
391+ , resetMasterPassword :: Boolean
392+ , privateKey :: EncryptedString
393+ , key :: EncryptedString
394+ , twoFactorToken :: JNullable String
395+ , kdf :: KDF
396+ , kdfIterations :: Int
397+ , forcePasswordReset :: JNullable Boolean
398+ , apiUseKeyConnector :: JNullable Boolean
399+ , keyConnectorUrl :: JNullable String
400+ }
401+
402+newtype TwoFactorProviderTypes = TwoFactorProviderTypes (Array (Int |+| String))
403+
404+instance HasRuntimeType TwoFactorProviderTypes where
405+ hasRuntimeType Proxy = Foreign.isArray
406+
407+fromTwoFactorProviderType :: TwoFactorProviderTypes -> Either String (Array Bridge.TwoFactorProviderType)
408+fromTwoFactorProviderType (TwoFactorProviderTypes xs) =
409+ for xs $ \rawProvider -> do
410+ providerInt <- Union.reduce (Either.Right /\ (\x -> Either.note x $ Int.fromString x)) rawProvider
411+ Either.note (show providerInt) $ secondFactorTypeToBridge providerInt
412+
413+type IdentityTwoFactorResponse =
414+ { twoFactorProviders :: TwoFactorProviderTypes
415+ -- it is a Map type and untaged unions gets confused
416+ -- , twoFactorProviders2 :: Object (Object String)
417+ , captchaToken :: String |+| Undefined
418+ }
419+
420+newtype Email = Email String
421+
422+type SyncResponse =
423+ { profile :: ProfileResponse
424+ , folders :: Array FolderResponse
425+ , collections :: Array CollectionDetailsResponse
426+ , ciphers :: Array CipherResponse
427+ , domains :: JNullable DomainsResponse
428+ , policies :: JNullable (Array PolicyResponse)
429+ , sends :: Array SendResponse
430+ }
387431
432+type FolderResponse =
433+ { id :: String
434+ , name :: JNullable String
435+ , revisionDate :: JNullable String
436+ }
437+
438+type CollectionDetailsResponse =
439+ { id :: String
440+ , organizationId :: JNullable String
441+ , name :: JNullable String
442+ , externalId :: JNullable String
443+ , readOnly :: Boolean
444+ }
388445
389446type CipherId = String
390447
391−type CipherResponse
392− = { id :: CipherId
393− , organizationId :: JNullable String
394− , folderId :: JNullable String
395− , type :: CipherType
396− , name :: EncryptedString
397− , notes :: JNullable EncryptedString
398− , fields :: JNullable (Array FieldApi)
399− , login :: JNullable LoginApi
400− , card :: JNullable CardApi
401− , identity :: JNullable IdentityApi
402− , secureNote :: JNullable SecureNoteApi
403− , favorite :: Boolean
404− , edit :: JNullable Boolean
405− , viewPassword :: JNullable Boolean
406− , organizationUseTotp :: JNullable Boolean
407− , revisionDate :: JNullable Timestamp
408− , attachments :: JNullable (Array AttachmentResponse)
409− , passwordHistory :: JNullable (Array PasswordHistoryResponse)
410− , collectionIds :: JNullable (Array String)
411− , deletedDate :: JNullable String
412− , reprompt :: CipherRepromptType
413− }
448+type CipherResponse =
449+ { id :: CipherId
450+ , organizationId :: JNullable String
451+ , folderId :: JNullable String
452+ , type :: CipherType
453+ , name :: EncryptedString
454+ , notes :: JNullable EncryptedString
455+ , fields :: JNullable (Array FieldApi)
456+ , login :: JNullable LoginApi
457+ , card :: JNullable CardApi
458+ , identity :: JNullable IdentityApi
459+ , secureNote :: JNullable SecureNoteApi
460+ , favorite :: Boolean
461+ , edit :: JNullable Boolean
462+ , viewPassword :: JNullable Boolean
463+ , organizationUseTotp :: JNullable Boolean
464+ , revisionDate :: JNullable Timestamp
465+ , attachments :: JNullable (Array AttachmentResponse)
466+ , passwordHistory :: JNullable (Array PasswordHistoryResponse)
467+ , collectionIds :: JNullable (Array String)
468+ , deletedDate :: JNullable String
469+ , reprompt :: CipherRepromptType
470+ }
414471
415472cipherTypeLogin = 1 :: CipherType
416473
@@ -420,15 +477,14 @@ cipherTypeCard = 3 :: CipherType
420477
421478cipherTypeIdentity = 4 :: CipherType
422479
423−type CipherType
424− = Int
480+type CipherType = Int
425481
426−type FieldApi
427− = { name :: JNullable String
428− , value :: JNullable String
429− , type :: FieldType
430− , linkedId :: JNullable LinkedIdType
431− }
482+type FieldApi =
483+ { name :: JNullable String
484+ , value :: JNullable String
485+ , type :: FieldType
486+ , linkedId :: JNullable LinkedIdType
487+ }
432488
433489fieldTypeText = 0 :: FieldType
434490
@@ -438,8 +494,7 @@ fieldTypeBoolean = 2 :: FieldType
438494
439495fieldTypeLinked = 3 :: FieldType
440496
441−type FieldType
442− = Int
497+type FieldType = Int
443498
444499linkedIdTypeLoginLinkedIdUsername = 100 :: LinkedIdType
445500
@@ -495,23 +550,22 @@ linkedIdTypeIdentityLinkedIdLastName = 417 :: LinkedIdType
495550
496551linkedIdTypeIdentityLinkedIdFullName = 418 :: LinkedIdType
497552
498−type LinkedIdType
499− = Int
553+type LinkedIdType = Int
500554
501−type LoginApi
502− = { uris :: JOpt (Array LoginUriApi)
503− , username :: JNullable EncryptedString
504− , password :: JNullable EncryptedString
505− , passwordRevisionDate :: JNullable String
506− , totp :: JNullable EncryptedString
507− -- This thing is undefined in some cases for some reson. Just ignoring it
508− , autofillOnPageLoad :: JOpt (JNullable Boolean)
509− }
555+type LoginApi =
556+ { uris :: JOpt (Array LoginUriApi)
557+ , username :: JNullable EncryptedString
558+ , password :: JNullable EncryptedString
559+ , passwordRevisionDate :: JNullable String
560+ , totp :: JNullable EncryptedString
561+ -- This thing is undefined in some cases for some reson. Just ignoring it
562+ , autofillOnPageLoad :: JOpt (JNullable Boolean)
563+ }
510564
511−type LoginUriApi
512− = { uri :: EncryptedString
513− , match :: JNullable UriMatchType
514− }
565+type LoginUriApi =
566+ { uri :: JNullable EncryptedString
567+ , match :: JNullable UriMatchType
568+ }
515569
516570uriMatchTypeDomain = 0 :: UriMatchType
517571
@@ -525,87 +579,85 @@ uriMatchTypeRegularExpression = 4 :: UriMatchType
525579
526580uriMatchTypeNever = 5 :: UriMatchType
527581
528−type UriMatchType
529− = Int
530−
531−type CardApi
532− = { cardholderName :: JNullable EncryptedString
533− , brand :: JNullable EncryptedString
534− , number :: JNullable EncryptedString
535− , expMonth :: JNullable EncryptedString
536− , expYear :: JNullable EncryptedString
537− , code :: JNullable EncryptedString
538− }
539−
540−type IdentityApi
541− = { title :: JNullable EncryptedString
542− , firstName :: JNullable EncryptedString
543− , middleName :: JNullable EncryptedString
544− , lastName :: JNullable EncryptedString
545− , address1 :: JNullable EncryptedString
546− , address2 :: JNullable EncryptedString
547− , address3 :: JNullable EncryptedString
548− , city :: JNullable EncryptedString
549− , state :: JNullable EncryptedString
550− , postalCode :: JNullable EncryptedString
551− , country :: JNullable EncryptedString
552− , company :: JNullable EncryptedString
553− , email :: JNullable EncryptedString
554− , phone :: JNullable EncryptedString
555− , ssn :: JNullable EncryptedString
556− , username :: JNullable EncryptedString
557− , passportNumber :: JNullable EncryptedString
558− , licenseNumber :: JNullable EncryptedString
559− }
582+type UriMatchType = Int
583+
584+type CardApi =
585+ { cardholderName :: JNullable EncryptedString
586+ , brand :: JNullable EncryptedString
587+ , number :: JNullable EncryptedString
588+ , expMonth :: JNullable EncryptedString
589+ , expYear :: JNullable EncryptedString
590+ , code :: JNullable EncryptedString
591+ }
592+
593+type IdentityApi =
594+ { title :: JNullable EncryptedString
595+ , firstName :: JNullable EncryptedString
596+ , middleName :: JNullable EncryptedString
597+ , lastName :: JNullable EncryptedString
598+ , address1 :: JNullable EncryptedString
599+ , address2 :: JNullable EncryptedString
600+ , address3 :: JNullable EncryptedString
601+ , city :: JNullable EncryptedString
602+ , state :: JNullable EncryptedString
603+ , postalCode :: JNullable EncryptedString
604+ , country :: JNullable EncryptedString
605+ , company :: JNullable EncryptedString
606+ , email :: JNullable EncryptedString
607+ , phone :: JNullable EncryptedString
608+ , ssn :: JNullable EncryptedString
609+ , username :: JNullable EncryptedString
610+ , passportNumber :: JNullable EncryptedString
611+ , licenseNumber :: JNullable EncryptedString
612+ }
560613
561614secureNoteTypeGeneric = 0 :: SecureNoteType
562615
563−type SecureNoteType
564− = Int
616+type SecureNoteType = Int
565617
566−type SecureNoteApi = {
567− type :: SecureNoteType
568−}
618+type SecureNoteApi =
619+ {
620+ -- type :: SecureNoteType
621+ }
569622
570−type AttachmentResponse
571− = { id :: String
572− , url :: JNullable String
573− , fileName :: JNullable String
574− , key :: JNullable String
575− , size :: JNullable String
576− , sizeName :: JNullable String
577− }
623+type AttachmentResponse =
624+ { id :: String
625+ , url :: JNullable String
626+ , fileName :: JNullable String
627+ , key :: JNullable String
628+ , size :: JNullable String
629+ , sizeName :: JNullable String
630+ }
578631
579−type PasswordHistoryResponse
580− = { password :: String
581− , lastUsedDate :: JNullable String
582− }
632+type PasswordHistoryResponse =
633+ { password :: String
634+ , lastUsedDate :: JNullable String
635+ }
583636
584637cipherRepromptTypeNone = 0 :: CipherRepromptType
585638
586639cipherRepromptTypePassword = 1 :: CipherRepromptType
587640
588−type CipherRepromptType
589− = Int
641+type CipherRepromptType = Int
590642
591−type DomainsResponse
592− = { equivalentDomains :: Array (Array String)
593− , globalEquivalentDomains :: Array GlobalDomainResponse
594− }
643+type DomainsResponse =
644+ { equivalentDomains :: Array (Array String)
645+ , globalEquivalentDomains :: Array GlobalDomainResponse
646+ }
595647
596−type GlobalDomainResponse
597− = { type :: Int
598− , domains :: Array String
599− , excluded :: Boolean
600− }
648+type GlobalDomainResponse =
649+ { type :: Int
650+ , domains :: Array String
651+ , excluded :: Boolean
652+ }
601653
602−type PolicyResponse
603− = { id :: String
604− , organizationId :: JNullable String
605− , type :: PolicyType
606− , data :: ShowableJson
607− , enabled :: Boolean
608− }
654+type PolicyResponse =
655+ { id :: String
656+ , organizationId :: JNullable String
657+ , type :: PolicyType
658+ , data :: ShowableJson
659+ , enabled :: Boolean
660+ }
609661
610662policyTypeTwoFactorAuthentication = 0 :: PolicyType -- Requires users to have 2fa enabled
611663
@@ -629,43 +681,46 @@ policyTypeMaximumVaultTimeout = 9 :: PolicyType -- Sets the maximum allowed vaul
629681
630682policyTypeDisablePersonalVaultExport = 10 :: PolicyType -- Disable personal vault export
631683
632−type PolicyType
633− = Int
634−
635−type SendResponse
636− = { id :: String
637− , accessId :: JNullable String
638− , type :: SendType
639− , name :: JNullable String
640− , notes :: JNullable String
641− , file :: JNullable SendFileApi
642− , text :: JNullable SendTextApi
643− , key :: JNullable String
644− , maxAccessCount :: JNullable Int
645− , accessCount :: JNullable Int
646− , revisionDate :: JNullable String
647− , expirationDate :: JNullable String
648− , deletionDate :: JNullable String
649− , password :: JNullable String
650− , disable :: Boolean
651− , hideEmail :: Boolean
652− }
684+type PolicyType = Int
685+
686+type SendResponse =
687+ { id :: String
688+ , accessId :: JNullable String
689+ , type :: SendType
690+ , name :: JNullable String
691+ , notes :: JNullable String
692+ , file :: JNullable SendFileApi
693+ , text :: JNullable SendTextApi
694+ , key :: JNullable String
695+ , maxAccessCount :: JNullable Int
696+ , accessCount :: JNullable Int
697+ , revisionDate :: JNullable String
698+ , expirationDate :: JNullable String
699+ , deletionDate :: JNullable String
700+ , password :: JNullable String
701+ , disable :: Boolean
702+ , hideEmail :: Boolean
703+ }
653704
654705sendTypeText = 0 :: SendType
655706
656707sendTypeFile = 1 :: SendType
657708
658−type SendType
659− = Int
709+type SendType = Int
710+
711+type SendFileApi =
712+ { id :: String
713+ , fileName :: JNullable String
714+ , size :: JNullable String
715+ , sizeName :: JNullable String
716+ }
660717
661−type SendFileApi
662− = { id :: String
663− , fileName :: JNullable String
664− , size :: JNullable String
665− , sizeName :: JNullable String
666− }
718+type SendTextApi =
719+ { text :: JNullable String
720+ , hidden :: Boolean
721+ }
667722
668−type SendTextApi
669− = { text :: JNullable String
670− , hidden :: Boolean
671− }
723+type TwoFactorEmailRequest =
724+ { email :: Email
725+ , masterPasswordHash :: StringHash
726+ }