on master help sign in
Did some reorg
commit219f2bfc9dfbb37eb33a358ea954b000e519097f authoriko <ilyakooo0@gmail.com> dateSun 24 Jul 2022, 06:15 (4 years ago) parent38d0f98
3 files changed+225−182
bw/src/BW.purs+1−182 bw/src/BW/Logic.purs+12 bw/src/BW/Types.purs+212
bw/src/BW.purs+1−182
@@ -2,192 +2,11 @@ module BW where
22
33import Prelude
44
5+import BW.Types
56import Control.Promise (Promise)
6−import Data.Date (Date)
7−import Data.List (List)
8−import Data.Nullable (Nullable)
97import Effect (Effect)
108
11−kdfPBKDF2_SHA256 = 0 :: KDF
12−type KDF = Int
139
14−type PreloginResponse = {
15− kdf :: KDF,
16− kdfIterations :: Int
17−}
18−
19−type PreloginRequest = {
20− email :: String
21−}
22−
23−type ProfileResponse = {
24− id :: String,
25− name :: String,
26− email :: String,
27− emailVerified :: Boolean,
28− masterPasswordHint :: String,
29− premiumPersonally :: Boolean,
30− premiumFromOrganization :: Boolean,
31− culture :: String,
32− twoFactorEnabled :: Boolean,
33− key :: String,
34− privateKey :: String,
35− securityStamp :: String,
36− forcePasswordReset :: Boolean,
37− usesKeyConnector :: Boolean,
38− organizations :: List ProfileOrganizationResponse,
39− providers :: List ProfileProviderResponse,
40− providerOrganizations :: List ProfileProviderOrganizationResponse
41−}
42−
43−type ProfileOrganizationResponse = {
44− id :: String,
45− name :: String,
46− usePolicies :: Boolean,
47− useGroups :: Boolean,
48− useDirectory :: Boolean,
49− useEvents :: Boolean,
50− useTotp :: Boolean,
51− use2fa :: Boolean,
52− useApi :: Boolean,
53− useSso :: Boolean,
54− useKeyConnector :: Boolean,
55− useResetPassword :: Boolean,
56− selfHost :: Boolean,
57− usersGetPremium :: Boolean,
58− seats :: Int,
59− maxCollections :: Int,
60− maxStorageGb :: Nullable Int,
61− key :: String,
62− hasPublicAndPrivateKeys :: Boolean,
63− status :: OrganizationUserStatusType,
64− type :: OrganizationUserType,
65− enabled :: Boolean,
66− ssoBound :: Boolean,
67− identifier :: String,
68− permissions :: PermissionsApi,
69− resetPasswordEnrolled :: Boolean,
70− userId :: String,
71− providerId :: String,
72− providerName :: String,
73− familySponsorshipFriendlyName :: String,
74− familySponsorshipAvailable :: Boolean,
75− planProductType :: ProductType,
76− keyConnectorEnabled :: Boolean,
77− keyConnectorUrl :: String,
78− familySponsorshipLastSyncDate :: Nullable Date,
79− familySponsorshipValidUntil :: Nullable Date,
80− familySponsorshipToDelete :: Nullable Boolean
81− }
82−
83−organizationUserStatusTypeInvited = 0 :: OrganizationUserStatusType
84−organizationUserStatusTypeAccepted = 0 :: OrganizationUserStatusType
85−organizationUserStatusTypeConfirmed = 0 :: OrganizationUserStatusType
86−type OrganizationUserStatusType = Int
87−
88−organizationUserTypeOwner = 0 :: OrganizationUserType
89−organizationUserTypeAdmin = 1 :: OrganizationUserType
90−organizationUserTypeUser = 2 :: OrganizationUserType
91−organizationUserTypeManager = 3 :: OrganizationUserType
92−organizationUserTypeCustom = 4 :: OrganizationUserType
93−type OrganizationUserType = Int
94−
95−type PermissionsApi = {
96− accessEventLogs :: Boolean,
97− accessImportExport :: Boolean,
98− accessReports :: Boolean,
99− manageAllCollections :: Boolean,
100− createNewCollections :: Boolean,
101− editAnyCollection :: Boolean,
102− deleteAnyCollection :: Boolean,
103− manageAssignedCollections :: Boolean,
104− editAssignedCollections :: Boolean,
105− deleteAssignedCollections :: Boolean,
106− manageCiphers :: Boolean,
107− manageGroups :: Boolean,
108− manageSso :: Boolean,
109− managePolicies :: Boolean,
110− manageUsers :: Boolean,
111− manageResetPassword :: Boolean
112−}
113−
114−productTypeFree = 0 :: ProductType
115−productTypeFamilies = 1 :: ProductType
116−productTypeTeams = 2 :: ProductType
117−productTypeEnterprise = 3 :: ProductType
118−type ProductType = Int
119−
120−type ProfileProviderResponse = {
121− id :: String,
122− name :: String,
123− key :: String,
124− status :: ProviderUserStatusType,
125− type :: ProviderUserType,
126− enabled :: Boolean,
127− permissions :: PermissionsApi,
128− userId :: String,
129− useEvents :: Boolean
130−}
131−
132−providerUserStatusTypeInvited = 0 :: ProviderUserStatusType
133−providerUserStatusTypeAccepted = 1 :: ProviderUserStatusType
134−providerUserStatusTypeConfirmed = 2 :: ProviderUserStatusType
135−type ProviderUserStatusType = Int
136−
137−providerUserTypeProviderAdmin = 0 :: ProviderUserType
138−providerUserTypeServiceUser = 1 :: ProviderUserType
139−type ProviderUserType = Int
140−
141−type ProfileProviderOrganizationResponse = {
142− id :: String,
143− name :: String,
144− usePolicies :: Boolean,
145− useGroups :: Boolean,
146− useDirectory :: Boolean,
147− useEvents :: Boolean,
148− useTotp :: Boolean,
149− use2fa :: Boolean,
150− useApi :: Boolean,
151− useSso :: Boolean,
152− useKeyConnector :: Boolean,
153− useResetPassword :: Boolean,
154− selfHost :: Boolean,
155− usersGetPremium :: Boolean,
156− seats :: Int,
157− maxCollections :: Int,
158− maxStorageGb :: Nullable Int,
159− key :: String,
160− hasPublicAndPrivateKeys :: Boolean,
161− status :: OrganizationUserStatusType,
162− type :: OrganizationUserType,
163− enabled :: Boolean,
164− ssoBound :: Boolean,
165− identifier :: String,
166− permissions :: PermissionsApi,
167− resetPasswordEnrolled :: Boolean,
168− userId :: String,
169− providerId :: String,
170− providerName :: String,
171− familySponsorshipFriendlyName :: String,
172− familySponsorshipAvailable :: Boolean,
173− planProductType :: ProductType,
174− keyConnectorEnabled :: Boolean,
175− keyConnectorUrl :: String,
176− familySponsorshipLastSyncDate :: Nullable Date,
177− familySponsorshipValidUntil :: Nullable Date,
178− familySponsorshipToDelete :: Nullable Boolean
179−}
180−
181−type Urls = {
182− base :: Nullable String,
183− webVault :: Nullable String,
184− api :: Nullable String,
185− identity :: Nullable String,
186− icons :: Nullable String,
187− notifications :: Nullable String,
188− events :: Nullable String,
189− keyConnector :: Nullable String
190−}
19110
19211type ApiService = {
19312 postPrelogin :: PreloginRequest -> Promise PreloginResponse,
bw/src/BW/Logic.pursnew file+12
@@ -0,0 +1,12 @@
1+module BW.Logic where
2+
3+import Prelude
4+
5+import BW.Types
6+
7+newtype Username = Username String
8+
9+newtype Password = Password String
10+
11+-- generateLogin :: Username -> Password -> PasswordTokenRequest
12+-- generateLogin (Username user) (Password password) = 1
bw/src/BW/Types.pursnew file+212
@@ -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