@@ -2,6 +2,7 @@ module BW.Types where
3import Prelude
3import Prelude
5+import Data.ArrayBuffer.Types (ArrayBuffer)
5import Data.Date (Date)
6import Data.Date (Date)
6import Data.List (List)
7import Data.List (List)
7import Data.Nullable (Nullable)
8import Data.Nullable (Nullable)
@@ -188,13 +189,43 @@ type Urls = {
190type PasswordTokenRequest = {
191type PasswordTokenRequest = {
191− email :: String,
192+ email :: Email,
192 masterPasswordHash :: String,
193 masterPasswordHash :: String,
193 captchaResponse :: String,
194 captchaResponse :: String,
194 twoFactor :: TokenRequestTwoFactor,
195 twoFactor :: TokenRequestTwoFactor,
195− device :: Nullable Unit -- we won't use this, so leave this null
196+ device :: DeviceRequest
199+type DeviceRequest = {
202+ identifier :: String,
203+ pushToken :: Nullable String
206+deviceTypeAndroid = 0 :: DeviceType
207+deviceTypeiOS = 1 :: DeviceType
208+deviceTypeChromeExtension = 2 :: DeviceType
209+deviceTypeFirefoxExtension = 3 :: DeviceType
210+deviceTypeOperaExtension = 4 :: DeviceType
211+deviceTypeEdgeExtension = 5 :: DeviceType
212+deviceTypeWindowsDesktop = 6 :: DeviceType
213+deviceTypeMacOsDesktop = 7 :: DeviceType
214+deviceTypeLinuxDesktop = 8 :: DeviceType
215+deviceTypeChromeBrowser = 9 :: DeviceType
216+deviceTypeFirefoxBrowser = 10 :: DeviceType
217+deviceTypeOperaBrowser = 11 :: DeviceType
218+deviceTypeEdgeBrowser = 12 :: DeviceType
219+deviceTypeIEBrowser = 13 :: DeviceType
220+deviceTypeUnknownBrowser = 14 :: DeviceType
221+deviceTypeAndroidAmazon = 15 :: DeviceType
222+deviceTypeUWP = 16 :: DeviceType
223+deviceTypeSafariBrowser = 17 :: DeviceType
224+deviceTypeVivaldiBrowser = 18 :: DeviceType
225+deviceTypeVivaldiExtension = 19 :: DeviceType
226+deviceTypeSafariExtension = 20 :: DeviceType
227+type DeviceType = Int
198type TokenRequestTwoFactor = {
229type TokenRequestTwoFactor = {
199 provider :: TwoFactorProviderType,
230 provider :: TwoFactorProviderType,
200 token :: String,
231 token :: String,
@@ -210,3 +241,49 @@ twoFactorProviderTypeRemember = 5 :: TwoFactorProviderType
210twoFactorProviderTypeOrganizationDuo = 6 :: TwoFactorProviderType
241twoFactorProviderTypeOrganizationDuo = 6 :: TwoFactorProviderType
211twoFactorProviderTypeWebAuthn = 7 :: TwoFactorProviderType
242twoFactorProviderTypeWebAuthn = 7 :: TwoFactorProviderType
212type TwoFactorProviderType = Int
243type TwoFactorProviderType = Int
246+type SymmetricCryptoKey = {
248+ encKey :: Nullable ArrayBuffer,
249+ macKey :: Nullable ArrayBuffer,
250+ encType :: EncryptionType,
252+ encKeyB64 :: String,
256+encryptionTypeAesCbc256_B64 = 0 :: EncryptionType
257+encryptionTypeAesCbc128_HmacSha256_B64 = 1 :: EncryptionType
258+encryptionTypeAesCbc256_HmacSha256_B64 = 2 :: EncryptionType
259+encryptionTypeRsa2048_OaepSha256_B64 = 3 :: EncryptionType
260+encryptionTypeRsa2048_OaepSha1_B64 = 4 :: EncryptionType
261+encryptionTypeRsa2048_OaepSha256_HmacSha256_B64 = 5 :: EncryptionType
262+encryptionTypeRsa2048_OaepSha1_HmacSha256_B64 = 6 :: EncryptionType
263+type EncryptionType = Int
265+newtype Password = Password String
267+hashPurposeServerAuthorization = 1 :: HashPurpose
268+hashPurposeLocalAuthorization = 2 :: HashPurpose
269+type HashPurpose = Int
271+newtype Hash = Hash String
273+type IdentityTokenResponse = {
274+ accessToken :: String,
276+ refreshToken :: String,
277+ tokenType :: String,
278+ resetMasterPassword :: Boolean,
279+ privateKey :: String,
281+ twoFactorToken :: Nullable String,
283+ kdfIterations :: Int,
284+ forcePasswordReset :: Nullable Boolean,
285+ apiUseKeyConnector :: Nullable Boolean,
286+ keyConnectorUrl :: Nullable String
289+newtype Email = Email String