@@ -0,0 +1,212 @@
1+module BW.Types where
2+
3+import Prelude
4+
5+import Data.Date (Date)
6+import Data.List (List)
7+import Data.Nullable (Nullable)
8+
9+kdfPBKDF2_SHA256 = 0 :: KDF
10+type KDF = Int
11+
12+type PreloginResponse = {
13+ kdf :: KDF,
14+ kdfIterations :: Int
15+}
16+
17+type PreloginRequest = {
18+ email :: String
19+}
20+
21+type ProfileResponse = {
22+ id :: String,
23+ name :: String,
24+ email :: String,
25+ emailVerified :: Boolean,
26+ masterPasswordHint :: String,
27+ premiumPersonally :: Boolean,
28+ premiumFromOrganization :: Boolean,
29+ culture :: String,
30+ twoFactorEnabled :: Boolean,
31+ key :: String,
32+ privateKey :: String,
33+ securityStamp :: String,
34+ forcePasswordReset :: Boolean,
35+ usesKeyConnector :: Boolean,
36+ organizations :: List ProfileOrganizationResponse,
37+ providers :: List ProfileProviderResponse,
38+ providerOrganizations :: List ProfileProviderOrganizationResponse
39+}
40+
41+type ProfileOrganizationResponse = {
42+ id :: String,
43+ name :: String,
44+ usePolicies :: Boolean,
45+ useGroups :: Boolean,
46+ useDirectory :: Boolean,
47+ useEvents :: Boolean,
48+ useTotp :: Boolean,
49+ use2fa :: Boolean,
50+ useApi :: Boolean,
51+ useSso :: Boolean,
52+ useKeyConnector :: Boolean,
53+ useResetPassword :: Boolean,
54+ selfHost :: Boolean,
55+ usersGetPremium :: Boolean,
56+ seats :: Int,
57+ maxCollections :: Int,
58+ maxStorageGb :: Nullable Int,
59+ key :: String,
60+ hasPublicAndPrivateKeys :: Boolean,
61+ status :: OrganizationUserStatusType,
62+ type :: OrganizationUserType,
63+ enabled :: Boolean,
64+ ssoBound :: Boolean,
65+ identifier :: String,
66+ permissions :: PermissionsApi,
67+ resetPasswordEnrolled :: Boolean,
68+ userId :: String,
69+ providerId :: String,
70+ providerName :: String,
71+ familySponsorshipFriendlyName :: String,
72+ familySponsorshipAvailable :: Boolean,
73+ planProductType :: ProductType,
74+ keyConnectorEnabled :: Boolean,
75+ keyConnectorUrl :: String,
76+ familySponsorshipLastSyncDate :: Nullable Date,
77+ familySponsorshipValidUntil :: Nullable Date,
78+ familySponsorshipToDelete :: Nullable Boolean
79+ }
80+
81+organizationUserStatusTypeInvited = 0 :: OrganizationUserStatusType
82+organizationUserStatusTypeAccepted = 0 :: OrganizationUserStatusType
83+organizationUserStatusTypeConfirmed = 0 :: OrganizationUserStatusType
84+type OrganizationUserStatusType = Int
85+
86+organizationUserTypeOwner = 0 :: OrganizationUserType
87+organizationUserTypeAdmin = 1 :: OrganizationUserType
88+organizationUserTypeUser = 2 :: OrganizationUserType
89+organizationUserTypeManager = 3 :: OrganizationUserType
90+organizationUserTypeCustom = 4 :: OrganizationUserType
91+type OrganizationUserType = Int
92+
93+type PermissionsApi = {
94+ accessEventLogs :: Boolean,
95+ accessImportExport :: Boolean,
96+ accessReports :: Boolean,
97+ manageAllCollections :: Boolean,
98+ createNewCollections :: Boolean,
99+ editAnyCollection :: Boolean,
100+ deleteAnyCollection :: Boolean,
101+ manageAssignedCollections :: Boolean,
102+ editAssignedCollections :: Boolean,
103+ deleteAssignedCollections :: Boolean,
104+ manageCiphers :: Boolean,
105+ manageGroups :: Boolean,
106+ manageSso :: Boolean,
107+ managePolicies :: Boolean,
108+ manageUsers :: Boolean,
109+ manageResetPassword :: Boolean
110+}
111+
112+productTypeFree = 0 :: ProductType
113+productTypeFamilies = 1 :: ProductType
114+productTypeTeams = 2 :: ProductType
115+productTypeEnterprise = 3 :: ProductType
116+type ProductType = Int
117+
118+type ProfileProviderResponse = {
119+ id :: String,
120+ name :: String,
121+ key :: String,
122+ status :: ProviderUserStatusType,
123+ type :: ProviderUserType,
124+ enabled :: Boolean,
125+ permissions :: PermissionsApi,
126+ userId :: String,
127+ useEvents :: Boolean
128+}
129+
130+providerUserStatusTypeInvited = 0 :: ProviderUserStatusType
131+providerUserStatusTypeAccepted = 1 :: ProviderUserStatusType
132+providerUserStatusTypeConfirmed = 2 :: ProviderUserStatusType
133+type ProviderUserStatusType = Int
134+
135+providerUserTypeProviderAdmin = 0 :: ProviderUserType
136+providerUserTypeServiceUser = 1 :: ProviderUserType
137+type ProviderUserType = Int
138+
139+type ProfileProviderOrganizationResponse = {
140+ id :: String,
141+ name :: String,
142+ usePolicies :: Boolean,
143+ useGroups :: Boolean,
144+ useDirectory :: Boolean,
145+ useEvents :: Boolean,
146+ useTotp :: Boolean,
147+ use2fa :: Boolean,
148+ useApi :: Boolean,
149+ useSso :: Boolean,
150+ useKeyConnector :: Boolean,
151+ useResetPassword :: Boolean,
152+ selfHost :: Boolean,
153+ usersGetPremium :: Boolean,
154+ seats :: Int,
155+ maxCollections :: Int,
156+ maxStorageGb :: Nullable Int,
157+ key :: String,
158+ hasPublicAndPrivateKeys :: Boolean,
159+ status :: OrganizationUserStatusType,
160+ type :: OrganizationUserType,
161+ enabled :: Boolean,
162+ ssoBound :: Boolean,
163+ identifier :: String,
164+ permissions :: PermissionsApi,
165+ resetPasswordEnrolled :: Boolean,
166+ userId :: String,
167+ providerId :: String,
168+ providerName :: String,
169+ familySponsorshipFriendlyName :: String,
170+ familySponsorshipAvailable :: Boolean,
171+ planProductType :: ProductType,
172+ keyConnectorEnabled :: Boolean,
173+ keyConnectorUrl :: String,
174+ familySponsorshipLastSyncDate :: Nullable Date,
175+ familySponsorshipValidUntil :: Nullable Date,
176+ familySponsorshipToDelete :: Nullable Boolean
177+}
178+
179+type Urls = {
180+ base :: Nullable String,
181+ webVault :: Nullable String,
182+ api :: Nullable String,
183+ identity :: Nullable String,
184+ icons :: Nullable String,
185+ notifications :: Nullable String,
186+ events :: Nullable String,
187+ keyConnector :: Nullable String
188+}
189+
190+type PasswordTokenRequest = {
191+ email :: String,
192+ masterPasswordHash :: String,
193+ captchaResponse :: String,
194+ twoFactor :: TokenRequestTwoFactor,
195+ device :: Nullable Unit -- we won't use this, so leave this null
196+}
197+
198+type TokenRequestTwoFactor = {
199+ provider :: TwoFactorProviderType,
200+ token :: String,
201+ remember :: Boolean
202+}
203+
204+twoFactorProviderTypeAuthenticator = 0 :: TwoFactorProviderType
205+twoFactorProviderTypeEmail = 1 :: TwoFactorProviderType
206+twoFactorProviderTypeDuo = 2 :: TwoFactorProviderType
207+twoFactorProviderTypeYubikey = 3 :: TwoFactorProviderType
208+twoFactorProviderTypeU2f = 4 :: TwoFactorProviderType
209+twoFactorProviderTypeRemember = 5 :: TwoFactorProviderType
210+twoFactorProviderTypeOrganizationDuo = 6 :: TwoFactorProviderType
211+twoFactorProviderTypeWebAuthn = 7 :: TwoFactorProviderType
212+type TwoFactorProviderType = Int