@movmo_app/types 1.20.0 → 1.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/auth.d.ts CHANGED
@@ -1,29 +1,32 @@
1
- export declare enum AuthenticationUsernameType {
2
- EMAIL = "email",
3
- PHONE_NUMBER = "phoneNumber"
4
- }
5
- export declare enum AuthenticationUserStatus {
6
- CONFIRMED = "CONFIRMED",
7
- UNCONFIRMED = "UNCONFIRMED"
8
- }
9
- export declare enum AuthenticationChallengeName {
10
- SMS_OTP = "SMS_OTP",
11
- EMAIL_OTP = "EMAIL_OTP",
12
- CONFIRM_SIGN_UP = "CONFIRM_SIGN_UP"
13
- }
14
- export declare enum AuthenticationChallengeResponse {
15
- SMS_OTP_CODE = "SMS_OTP_CODE",
16
- EMAIL_OTP_CODE = "EMAIL_OTP_CODE"
17
- }
18
1
  export declare enum OTPAction {
19
2
  EMAILED = "emailed",
20
3
  TEXTED = "texted"
21
4
  }
22
- /**
23
- * Response from the login endpoint.
24
- */
25
- export type LoginUserResponse = {
26
- session: string;
27
- challengeName?: AuthenticationChallengeName;
28
- username?: string;
5
+ export type WebAuthnOptionsJSON = {
6
+ publicKey: Record<string, unknown>;
7
+ mediation?: string;
8
+ };
9
+ export type MovmoCodeFlow = {
10
+ flow_id: string;
11
+ next: 'code';
12
+ code_length: number;
13
+ expires_in: number;
14
+ resend_after: number;
15
+ };
16
+ export type MovmoPasskeyFlow = {
17
+ flow_id: string;
18
+ next: 'passkey';
19
+ options: WebAuthnOptionsJSON;
20
+ code_length: number;
21
+ expires_in: number;
22
+ };
23
+ export type MovmoLoginResponse = MovmoCodeFlow | MovmoPasskeyFlow;
24
+ export type PasskeyOptionsResponse = {
25
+ flow_id: string;
26
+ options: WebAuthnOptionsJSON;
27
+ };
28
+ export type MovmoVerifyResponse = {
29
+ user_id: string;
30
+ new_user: boolean;
29
31
  };
32
+ export type AuthErrorCode = 'invalid_email' | 'rate_limited' | 'resend_too_soon' | 'flow_expired' | 'invalid_code' | 'too_many_attempts' | 'invalid_request' | 'invalid_credential' | 'topOrigin_required' | 'passkey_limit' | 'credential_exists' | 'not_found' | 'reauth_required' | 'movmo_session_required' | 'first_party_only' | 'issuer_unavailable' | 'passkey_failed' | 'sign_in_failed';
package/dist/auth.js CHANGED
@@ -1,27 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OTPAction = exports.AuthenticationChallengeResponse = exports.AuthenticationChallengeName = exports.AuthenticationUserStatus = exports.AuthenticationUsernameType = void 0;
4
- var AuthenticationUsernameType;
5
- (function (AuthenticationUsernameType) {
6
- AuthenticationUsernameType["EMAIL"] = "email";
7
- AuthenticationUsernameType["PHONE_NUMBER"] = "phoneNumber";
8
- })(AuthenticationUsernameType || (exports.AuthenticationUsernameType = AuthenticationUsernameType = {}));
9
- var AuthenticationUserStatus;
10
- (function (AuthenticationUserStatus) {
11
- AuthenticationUserStatus["CONFIRMED"] = "CONFIRMED";
12
- AuthenticationUserStatus["UNCONFIRMED"] = "UNCONFIRMED";
13
- })(AuthenticationUserStatus || (exports.AuthenticationUserStatus = AuthenticationUserStatus = {}));
14
- var AuthenticationChallengeName;
15
- (function (AuthenticationChallengeName) {
16
- AuthenticationChallengeName["SMS_OTP"] = "SMS_OTP";
17
- AuthenticationChallengeName["EMAIL_OTP"] = "EMAIL_OTP";
18
- AuthenticationChallengeName["CONFIRM_SIGN_UP"] = "CONFIRM_SIGN_UP";
19
- })(AuthenticationChallengeName || (exports.AuthenticationChallengeName = AuthenticationChallengeName = {}));
20
- var AuthenticationChallengeResponse;
21
- (function (AuthenticationChallengeResponse) {
22
- AuthenticationChallengeResponse["SMS_OTP_CODE"] = "SMS_OTP_CODE";
23
- AuthenticationChallengeResponse["EMAIL_OTP_CODE"] = "EMAIL_OTP_CODE";
24
- })(AuthenticationChallengeResponse || (exports.AuthenticationChallengeResponse = AuthenticationChallengeResponse = {}));
3
+ exports.OTPAction = void 0;
25
4
  var OTPAction;
26
5
  (function (OTPAction) {
27
6
  OTPAction["EMAILED"] = "emailed";
package/dist/index.d.ts CHANGED
@@ -16,3 +16,4 @@ export * from './locale_preferences';
16
16
  export * from './postmessage_contracts';
17
17
  export * from './identity';
18
18
  export * from './scope_copy';
19
+ export * from './passkeys';
package/dist/index.js CHANGED
@@ -32,3 +32,4 @@ __exportStar(require("./locale_preferences"), exports);
32
32
  __exportStar(require("./postmessage_contracts"), exports);
33
33
  __exportStar(require("./identity"), exports);
34
34
  __exportStar(require("./scope_copy"), exports);
35
+ __exportStar(require("./passkeys"), exports);
@@ -0,0 +1,18 @@
1
+ import { WebAuthnOptionsJSON } from './auth';
2
+ export type PasskeyKind = 'synced' | 'device' | 'security_key';
3
+ /**
4
+ * `kind` is optional so the UI tolerates a monolith that predates Task 2: it
5
+ * falls back to `synced ? 'synced' : 'device'`.
6
+ */
7
+ export type PasskeySummary = {
8
+ id: string;
9
+ provider: string;
10
+ created_at: string;
11
+ last_used_at: string | null;
12
+ synced: boolean;
13
+ kind?: PasskeyKind;
14
+ };
15
+ export type PasskeyRegistrationStart = {
16
+ flow_id: string;
17
+ options: WebAuthnOptionsJSON;
18
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,15 +1,10 @@
1
1
  /**
2
- * OTPDeliveryMethod represents how one-time passcodes are delivered.
3
- */
4
- export type OTPDeliveryMethod = 'email_and_phone' | 'email_only' | 'phone_only';
5
- /**
6
- * SecurityPreferences represents a user's OTP delivery preference settings.
2
+ * SecurityPreferences represents a user's security settings.
3
+ * phone_number_verified comes from Postgres `users.phone_verified_at` since MOVMO-706.
7
4
  */
8
5
  export type SecurityPreferences = {
9
6
  user_id: string;
10
- otp_delivery_method: OTPDeliveryMethod;
11
7
  phone_number_verified: boolean;
12
- updated_at?: string;
13
8
  };
14
9
  /**
15
10
  * AuthEvent represents a recorded authentication event returned by
@@ -18,7 +13,7 @@ export type SecurityPreferences = {
18
13
  export type AuthEvent = {
19
14
  id: string;
20
15
  user_id: string;
21
- event_type: 'sign_in' | 'sign_up' | 'email_change' | 'phone_change';
16
+ event_type: 'sign_in' | 'sign_up' | 'email_change' | 'phone_change' | 'passkey_added' | 'passkey_removed';
22
17
  browser: string;
23
18
  device_type: string;
24
19
  os: string;
@@ -27,6 +22,8 @@ export type AuthEvent = {
27
22
  country: string;
28
23
  timezone: string;
29
24
  created_at: string;
25
+ /** How the traveler authenticated (server: `user_auth_events.method`, MOVMO-705). */
26
+ method?: 'otp' | 'passkey';
30
27
  };
31
28
  /**
32
29
  * @deprecated Use AuthEvent instead. This type was a placeholder before the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@movmo_app/types",
3
- "version": "1.20.0",
3
+ "version": "1.22.0",
4
4
  "description": "A collection of Movmo's types",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",