@@ -2,17 +2,21 @@ module BW.Types where
3import Prelude
3import Prelude
5−import Data.ArrayBuffer.Types (ArrayBuffer)
5+import Data.Argonaut (class DecodeJson, class EncodeJson)
6import Data.Date (Date)
6import Data.Date (Date)
7−import Data.Nullable (Nullable)
7+import Data.JNullable (JNullable)
8+import Data.JOpt (JOpt)
8import Data.ShowableJson (ShowableJson)
9import Data.ShowableJson (ShowableJson)
9import Data.Timestamp (Timestamp(..))
10import Data.Timestamp (Timestamp(..))
10−import Data.Undefined.NoProblem (Opt)
12newtype EncryptedString
12newtype EncryptedString
13 = EncryptedString String
13 = EncryptedString String
15derive newtype instance Show EncryptedString
15derive newtype instance Show EncryptedString
16+derive newtype instance Ord EncryptedString
17+derive newtype instance Eq EncryptedString
18+derive newtype instance EncodeJson EncryptedString
19+derive newtype instance DecodeJson EncryptedString
17kdfPBKDF2_SHA256 = 0 :: KDF
21kdfPBKDF2_SHA256 = 0 :: KDF
@@ -35,7 +39,7 @@ type ProfileResponse
35 , emailVerified :: Boolean
39 , emailVerified :: Boolean
36 , masterPasswordHint :: String
40 , masterPasswordHint :: String
37 , premiumPersonally :: Boolean
41 , premiumPersonally :: Boolean
38− , premiumFromOrganization :: Boolean
42+ -- , premiumFromOrganization :: Boolean
39 , culture :: String
43 , culture :: String
40 , twoFactorEnabled :: Boolean
44 , twoFactorEnabled :: Boolean
41 , key :: EncryptedString
45 , key :: EncryptedString
@@ -65,7 +69,7 @@ type ProfileOrganizationResponse
65 , usersGetPremium :: Boolean
69 , usersGetPremium :: Boolean
66 , seats :: Int
70 , seats :: Int
67 , maxCollections :: Int
71 , maxCollections :: Int
68− , maxStorageGb :: Nullable Int
72+ , maxStorageGb :: JNullable Int
69 , key :: String
73 , key :: String
70 , hasPublicAndPrivateKeys :: Boolean
74 , hasPublicAndPrivateKeys :: Boolean
71 , status :: OrganizationUserStatusType
75 , status :: OrganizationUserStatusType
@@ -83,9 +87,9 @@ type ProfileOrganizationResponse
83 , planProductType :: ProductType
87 , planProductType :: ProductType
84 , keyConnectorEnabled :: Boolean
88 , keyConnectorEnabled :: Boolean
85 , keyConnectorUrl :: String
89 , keyConnectorUrl :: String
86− , familySponsorshipLastSyncDate :: Nullable Date
90+ , familySponsorshipLastSyncDate :: JNullable Timestamp
87− , familySponsorshipValidUntil :: Nullable Date
91+ , familySponsorshipValidUntil :: JNullable Timestamp
88− , familySponsorshipToDelete :: Nullable Boolean
92+ , familySponsorshipToDelete :: JNullable Boolean
91organizationUserStatusTypeInvited = 0 :: OrganizationUserStatusType
95organizationUserStatusTypeInvited = 0 :: OrganizationUserStatusType
@@ -185,7 +189,7 @@ type ProfileProviderOrganizationResponse
185 , usersGetPremium :: Boolean
189 , usersGetPremium :: Boolean
186 , seats :: Int
190 , seats :: Int
187 , maxCollections :: Int
191 , maxCollections :: Int
188− , maxStorageGb :: Nullable Int
192+ , maxStorageGb :: JNullable Int
189 , key :: String
193 , key :: String
190 , hasPublicAndPrivateKeys :: Boolean
194 , hasPublicAndPrivateKeys :: Boolean
191 , status :: OrganizationUserStatusType
195 , status :: OrganizationUserStatusType
@@ -203,20 +207,20 @@ type ProfileProviderOrganizationResponse
203 , planProductType :: ProductType
207 , planProductType :: ProductType
204 , keyConnectorEnabled :: Boolean
208 , keyConnectorEnabled :: Boolean
205 , keyConnectorUrl :: String
209 , keyConnectorUrl :: String
206− , familySponsorshipLastSyncDate :: Nullable Date
210+ , familySponsorshipLastSyncDate :: JNullable Timestamp
207− , familySponsorshipValidUntil :: Nullable Date
211+ , familySponsorshipValidUntil :: JNullable Timestamp
208− , familySponsorshipToDelete :: Nullable Boolean
212+ , familySponsorshipToDelete :: JNullable Boolean
212− = { base :: Nullable String
216+ = { base :: JNullable String
213− , webVault :: Nullable String
217+ , webVault :: JNullable String
214− , api :: Nullable String
218+ , api :: JNullable String
215− , identity :: Nullable String
219+ , identity :: JNullable String
216− , icons :: Nullable String
220+ , icons :: JNullable String
217− , notifications :: Nullable String
221+ , notifications :: JNullable String
218− , events :: Nullable String
222+ , events :: JNullable String
219− , keyConnector :: Nullable String
223+ , keyConnector :: JNullable String
222type PasswordTokenRequest
226type PasswordTokenRequest
@@ -231,7 +235,7 @@ type DeviceRequest
231 = { type :: DeviceType
235 = { type :: DeviceType
232 , name :: String
236 , name :: String
233 , identifier :: String
237 , identifier :: String
234− , pushToken :: Nullable String
238+ , pushToken :: JNullable String
237deviceTypeAndroid = 0 :: DeviceType
241deviceTypeAndroid = 0 :: DeviceType
@@ -314,18 +318,26 @@ hashPurposeLocalAuthorization = 2 :: HashPurpose
314type HashPurpose
318type HashPurpose
317−newtype Hash
321+newtype StringHash
318− = Hash String
322+ = StringHash String
320newtype AccessToken
324newtype AccessToken
321 = AccessToken String
325 = AccessToken String
323derive newtype instance Show AccessToken
327derive newtype instance Show AccessToken
328+derive newtype instance Eq AccessToken
329+derive newtype instance Ord AccessToken
330+derive newtype instance EncodeJson AccessToken
331+derive newtype instance DecodeJson AccessToken
325newtype RefreshToken
333newtype RefreshToken
326 = RefreshToken String
334 = RefreshToken String
328derive newtype instance Show RefreshToken
336derive newtype instance Show RefreshToken
337+derive newtype instance Eq RefreshToken
338+derive newtype instance Ord RefreshToken
339+derive newtype instance EncodeJson RefreshToken
340+derive newtype instance DecodeJson RefreshToken
331type IdentityTokenResponse
343type IdentityTokenResponse
@@ -336,12 +348,12 @@ type IdentityTokenResponse
336 , resetMasterPassword :: Boolean
348 , resetMasterPassword :: Boolean
337 , privateKey :: EncryptedString
349 , privateKey :: EncryptedString
338 , key :: EncryptedString
350 , key :: EncryptedString
339− , twoFactorToken :: Nullable String
351+ , twoFactorToken :: JNullable String
340 , kdf :: KDF
352 , kdf :: KDF
341 , kdfIterations :: Int
353 , kdfIterations :: Int
342− , forcePasswordReset :: Nullable Boolean
354+ , forcePasswordReset :: JNullable Boolean
343− , apiUseKeyConnector :: Nullable Boolean
355+ , apiUseKeyConnector :: JNullable Boolean
344− , keyConnectorUrl :: Nullable String
356+ , keyConnectorUrl :: JNullable String
347newtype Email
359newtype Email
@@ -352,8 +364,8 @@ type SyncResponse
352 , folders :: Array FolderResponse
364 , folders :: Array FolderResponse
353 , collections :: Array CollectionDetailsResponse
365 , collections :: Array CollectionDetailsResponse
354 , ciphers :: Array CipherResponse
366 , ciphers :: Array CipherResponse
355− , domains :: Nullable DomainsResponse
367+ , domains :: JNullable DomainsResponse
356− , policies :: Nullable (Array PolicyResponse)
368+ , policies :: JNullable (Array PolicyResponse)
357 , sends :: Array SendResponse
369 , sends :: Array SendResponse
@@ -365,33 +377,33 @@ type FolderResponse
366type CollectionDetailsResponse
378type CollectionDetailsResponse
367 = { id :: String
379 = { id :: String
368− , organizationId :: Nullable String
380+ , organizationId :: JNullable String
369 , name :: String
381 , name :: String
370− , externalId :: Nullable String
382+ , externalId :: JNullable String
371 , readOnly :: Boolean
383 , readOnly :: Boolean
374type CipherResponse
386type CipherResponse
375 = { id :: String
387 = { id :: String
376− , organizationId :: Nullable String
388+ , organizationId :: JNullable String
377− , folderId :: Nullable String
389+ , folderId :: JNullable String
378 , type :: CipherType
390 , type :: CipherType
379 , name :: EncryptedString
391 , name :: EncryptedString
380− , notes :: Nullable EncryptedString
392+ , notes :: JNullable EncryptedString
381− , fields :: Nullable (Array FieldApi)
393+ , fields :: JNullable (Array FieldApi)
382− , login :: Nullable LoginApi
394+ , login :: JNullable LoginApi
383− , card :: Nullable CardApi
395+ , card :: JNullable CardApi
384− , identity :: Nullable IdentityApi
396+ , identity :: JNullable IdentityApi
385− , secureNote :: Nullable SecureNoteApi
397+ , secureNote :: JNullable SecureNoteApi
386 , favorite :: Boolean
398 , favorite :: Boolean
387 , edit :: Boolean
399 , edit :: Boolean
388 , viewPassword :: Boolean
400 , viewPassword :: Boolean
389 , organizationUseTotp :: Boolean
401 , organizationUseTotp :: Boolean
390 , revisionDate :: Timestamp
402 , revisionDate :: Timestamp
391− , attachments :: Nullable (Array AttachmentResponse)
403+ , attachments :: JNullable (Array AttachmentResponse)
392− , passwordHistory :: Nullable (Array PasswordHistoryResponse)
404+ , passwordHistory :: JNullable (Array PasswordHistoryResponse)
393− , collectionIds :: Nullable (Array String)
405+ , collectionIds :: JNullable (Array String)
394− , deletedDate :: Nullable String
406+ , deletedDate :: JNullable String
395 , reprompt :: CipherRepromptType
407 , reprompt :: CipherRepromptType
@@ -410,7 +422,7 @@ type FieldApi
410 = { name :: String
422 = { name :: String
411 , value :: String
423 , value :: String
412 , type :: FieldType
424 , type :: FieldType
413− , linkedId :: Nullable LinkedIdType
425+ , linkedId :: JNullable LinkedIdType
416fieldTypeText = 0 :: FieldType
428fieldTypeText = 0 :: FieldType
@@ -482,18 +494,18 @@ type LinkedIdType
484type LoginApi
496type LoginApi
485− = { uris :: Opt (Array LoginUriApi)
497+ = { uris :: JOpt (Array LoginUriApi)
486− , username :: Nullable EncryptedString
498+ , username :: JNullable EncryptedString
487− , password :: Nullable EncryptedString
499+ , password :: JNullable EncryptedString
488− , passwordRevisionDate :: Nullable String
500+ , passwordRevisionDate :: JNullable String
489− , totp :: Nullable EncryptedString
501+ , totp :: JNullable EncryptedString
490 -- This thing is undefined in some cases for some reson. Just ignoring it
502 -- This thing is undefined in some cases for some reson. Just ignoring it
491− , autofillOnPageLoad :: Opt (Nullable Boolean)
503+ , autofillOnPageLoad :: JOpt (JNullable Boolean)
494type LoginUriApi
506type LoginUriApi
495 = { uri :: String
507 = { uri :: String
496− , match :: Nullable UriMatchType
508+ , match :: JNullable UriMatchType
499uriMatchTypeDomain = 0 :: UriMatchType
511uriMatchTypeDomain = 0 :: UriMatchType
@@ -512,12 +524,12 @@ type UriMatchType
514type CardApi
526type CardApi
515− = { cardholderName :: Nullable String
527+ = { cardholderName :: JNullable String
516− , brand :: Nullable String
528+ , brand :: JNullable String
517− , number :: Nullable String
529+ , number :: JNullable String
518− , expMonth :: Nullable String
530+ , expMonth :: JNullable String
519− , expYear :: Nullable String
531+ , expYear :: JNullable String
520− , code :: Nullable String
532+ , code :: JNullable String
523type IdentityApi
535type IdentityApi
@@ -580,7 +592,7 @@ type GlobalDomainResponse
581type PolicyResponse
593type PolicyResponse
582 = { id :: String
594 = { id :: String
583− , organizationId :: Nullable String
595+ , organizationId :: JNullable String
584 , type :: PolicyType
596 , type :: PolicyType
585 , data :: ShowableJson
597 , data :: ShowableJson
586 , enabled :: Boolean
598 , enabled :: Boolean
@@ -616,15 +628,15 @@ type SendResponse
616 , accessId :: String
628 , accessId :: String
617 , type :: SendType
629 , type :: SendType
618 , name :: String
630 , name :: String
619− , notes :: Nullable String
631+ , notes :: JNullable String
620− , file :: Nullable SendFileApi
632+ , file :: JNullable SendFileApi
621− , text :: Nullable SendTextApi
633+ , text :: JNullable SendTextApi
622 , key :: String
634 , key :: String
623− , maxAccessCount :: Nullable Int
635+ , maxAccessCount :: JNullable Int
624 , accessCount :: Int
636 , accessCount :: Int
625 , revisionDate :: String
637 , revisionDate :: String
626 , expirationDate :: String
638 , expirationDate :: String
627− , deletionDate :: Nullable String
639+ , deletionDate :: JNullable String
628 , password :: String
640 , password :: String
629 , disable :: Boolean
641 , disable :: Boolean
630 , hideEmail :: Boolean
642 , hideEmail :: Boolean