@@ -2,6 +2,7 @@ module BW.Types where
22
33import Prelude
44
5+import Data.ArrayBuffer.Types (ArrayBuffer)
56import Data.Date (Date)
67import Data.List (List)
78import Data.Nullable (Nullable)
@@ -188,13 +189,43 @@ type Urls = {
188189}
189190
190191type PasswordTokenRequest = {
191− email :: String,
192+ email :: Email,
192193 masterPasswordHash :: String,
193194 captchaResponse :: String,
194195 twoFactor :: TokenRequestTwoFactor,
195− device :: Nullable Unit -- we won't use this, so leave this null
196+ device :: DeviceRequest
197+}
198+
199+type DeviceRequest = {
200+ type :: DeviceType,
201+ name :: String,
202+ identifier :: String,
203+ pushToken :: Nullable String
196204}
197205
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
228+
198229type TokenRequestTwoFactor = {
199230 provider :: TwoFactorProviderType,
200231 token :: String,
@@ -210,3 +241,49 @@ twoFactorProviderTypeRemember = 5 :: TwoFactorProviderType
210241twoFactorProviderTypeOrganizationDuo = 6 :: TwoFactorProviderType
211242twoFactorProviderTypeWebAuthn = 7 :: TwoFactorProviderType
212243type TwoFactorProviderType = Int
244+
245+
246+type SymmetricCryptoKey = {
247+ key :: ArrayBuffer,
248+ encKey :: Nullable ArrayBuffer,
249+ macKey :: Nullable ArrayBuffer,
250+ encType :: EncryptionType,
251+ keyB64 :: String,
252+ encKeyB64 :: String,
253+ macKeyB64 :: String
254+}
255+
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
264+
265+newtype Password = Password String
266+
267+hashPurposeServerAuthorization = 1 :: HashPurpose
268+hashPurposeLocalAuthorization = 2 :: HashPurpose
269+type HashPurpose = Int
270+
271+newtype Hash = Hash String
272+
273+type IdentityTokenResponse = {
274+ accessToken :: String,
275+ expiresIn :: Int,
276+ refreshToken :: String,
277+ tokenType :: String,
278+ resetMasterPassword :: Boolean,
279+ privateKey :: String,
280+ key :: String,
281+ twoFactorToken :: Nullable String,
282+ kdf :: KDF,
283+ kdfIterations :: Int,
284+ forcePasswordReset :: Nullable Boolean,
285+ apiUseKeyConnector :: Nullable Boolean,
286+ keyConnectorUrl :: Nullable String
287+}
288+
289+newtype Email = Email String