@trymellon/js 1.4.9 → 1.5.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/react.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ReactNode } from 'react';
3
- import { T as TryMellon, R as Result, a as RegisterResult, b as TryMellonError, c as RegisterOptions, A as AuthenticateResult, d as AuthenticateOptions } from './trymellon-DfbkkIz8.cjs';
3
+ import { T as TryMellon, R as Result, a as RegisterResult, b as TryMellonError, c as RegisterOptions, A as AuthenticateResult, d as AuthenticateOptions } from './trymellon-BkIVfr7x.cjs';
4
4
 
5
5
  declare function TryMellonProvider(props: {
6
6
  client: TryMellon;
package/dist/react.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ReactNode } from 'react';
3
- import { T as TryMellon, R as Result, a as RegisterResult, b as TryMellonError, c as RegisterOptions, A as AuthenticateResult, d as AuthenticateOptions } from './trymellon-DfbkkIz8.js';
3
+ import { T as TryMellon, R as Result, a as RegisterResult, b as TryMellonError, c as RegisterOptions, A as AuthenticateResult, d as AuthenticateOptions } from './trymellon-BkIVfr7x.js';
4
4
 
5
5
  declare function TryMellonProvider(props: {
6
6
  client: TryMellon;
@@ -119,6 +119,43 @@ type EmailFallbackVerifyOptions = {
119
119
  type EmailFallbackVerifyResult = {
120
120
  sessionToken: string;
121
121
  };
122
+ type RecoveryVerifyResponse = {
123
+ challenge: Record<string, unknown>;
124
+ recovery_session_id: string;
125
+ };
126
+ type RecoveryCompleteResponse = {
127
+ status: string;
128
+ session_token: string;
129
+ user: {
130
+ user_id: string;
131
+ external_user_id?: string;
132
+ email?: string;
133
+ metadata?: Record<string, unknown>;
134
+ };
135
+ credential_id: string;
136
+ };
137
+ type RecoverAccountOptions = {
138
+ /** The external user ID of the account being recovered. */
139
+ externalUserId: string | ExternalUserId;
140
+ /**
141
+ * @deprecated Use `externalUserId` instead.
142
+ */
143
+ external_user_id?: string | ExternalUserId;
144
+ /** The 6-digit OTP sent via email. */
145
+ otp: string;
146
+ };
147
+ interface RecoverAccountResult {
148
+ success: true;
149
+ credentialId: string;
150
+ status: string;
151
+ sessionToken: string;
152
+ user: {
153
+ userId: string;
154
+ externalUserId?: string;
155
+ email?: string;
156
+ metadata?: Record<string, unknown>;
157
+ };
158
+ }
122
159
  type OnboardingStartOptions = {
123
160
  user_role: 'maintainer' | 'app_user';
124
161
  };
@@ -169,7 +206,8 @@ type RegisterStartRequest = {
169
206
  external_user_id: string;
170
207
  };
171
208
  type AuthStartRequest = {
172
- external_user_id: string;
209
+ /** Omit for discoverable (resident) passkeys; server returns allowCredentials: [] */
210
+ external_user_id?: string;
173
211
  };
174
212
  type RegisterFinishRequest = {
175
213
  session_id: string;
@@ -411,6 +449,8 @@ declare class ApiClient {
411
449
  getCrossDeviceContext(sessionId: string): Promise<Result<CrossDeviceContextResult, TryMellonError>>;
412
450
  verifyCrossDeviceAuth(request: CrossDeviceVerifyRequest): Promise<Result<void, TryMellonError>>;
413
451
  verifyCrossDeviceRegistration(request: CrossDeviceVerifyRegistrationRequest): Promise<Result<void, TryMellonError>>;
452
+ verifyAccountRecoveryOtp(externalUserId: string, otp: string): Promise<Result<RecoveryVerifyResponse, TryMellonError>>;
453
+ completeAccountRecovery(recoverySessionId: string, credential: Record<string, unknown>): Promise<Result<RecoveryCompleteResponse, TryMellonError>>;
414
454
  }
415
455
 
416
456
  declare class OnboardingManager {
@@ -472,6 +512,7 @@ declare class TryMellon {
472
512
  }, TryMellonError>>;
473
513
  approve: (sessionId: string) => Promise<Result<void, TryMellonError>>;
474
514
  };
515
+ recoverAccount: (options: RecoverAccountOptions) => Promise<Result<RecoverAccountResult, TryMellonError>>;
475
516
  };
476
517
  }
477
518
 
@@ -119,6 +119,43 @@ type EmailFallbackVerifyOptions = {
119
119
  type EmailFallbackVerifyResult = {
120
120
  sessionToken: string;
121
121
  };
122
+ type RecoveryVerifyResponse = {
123
+ challenge: Record<string, unknown>;
124
+ recovery_session_id: string;
125
+ };
126
+ type RecoveryCompleteResponse = {
127
+ status: string;
128
+ session_token: string;
129
+ user: {
130
+ user_id: string;
131
+ external_user_id?: string;
132
+ email?: string;
133
+ metadata?: Record<string, unknown>;
134
+ };
135
+ credential_id: string;
136
+ };
137
+ type RecoverAccountOptions = {
138
+ /** The external user ID of the account being recovered. */
139
+ externalUserId: string | ExternalUserId;
140
+ /**
141
+ * @deprecated Use `externalUserId` instead.
142
+ */
143
+ external_user_id?: string | ExternalUserId;
144
+ /** The 6-digit OTP sent via email. */
145
+ otp: string;
146
+ };
147
+ interface RecoverAccountResult {
148
+ success: true;
149
+ credentialId: string;
150
+ status: string;
151
+ sessionToken: string;
152
+ user: {
153
+ userId: string;
154
+ externalUserId?: string;
155
+ email?: string;
156
+ metadata?: Record<string, unknown>;
157
+ };
158
+ }
122
159
  type OnboardingStartOptions = {
123
160
  user_role: 'maintainer' | 'app_user';
124
161
  };
@@ -169,7 +206,8 @@ type RegisterStartRequest = {
169
206
  external_user_id: string;
170
207
  };
171
208
  type AuthStartRequest = {
172
- external_user_id: string;
209
+ /** Omit for discoverable (resident) passkeys; server returns allowCredentials: [] */
210
+ external_user_id?: string;
173
211
  };
174
212
  type RegisterFinishRequest = {
175
213
  session_id: string;
@@ -411,6 +449,8 @@ declare class ApiClient {
411
449
  getCrossDeviceContext(sessionId: string): Promise<Result<CrossDeviceContextResult, TryMellonError>>;
412
450
  verifyCrossDeviceAuth(request: CrossDeviceVerifyRequest): Promise<Result<void, TryMellonError>>;
413
451
  verifyCrossDeviceRegistration(request: CrossDeviceVerifyRegistrationRequest): Promise<Result<void, TryMellonError>>;
452
+ verifyAccountRecoveryOtp(externalUserId: string, otp: string): Promise<Result<RecoveryVerifyResponse, TryMellonError>>;
453
+ completeAccountRecovery(recoverySessionId: string, credential: Record<string, unknown>): Promise<Result<RecoveryCompleteResponse, TryMellonError>>;
414
454
  }
415
455
 
416
456
  declare class OnboardingManager {
@@ -472,6 +512,7 @@ declare class TryMellon {
472
512
  }, TryMellonError>>;
473
513
  approve: (sessionId: string) => Promise<Result<void, TryMellonError>>;
474
514
  };
515
+ recoverAccount: (options: RecoverAccountOptions) => Promise<Result<RecoverAccountResult, TryMellonError>>;
475
516
  };
476
517
  }
477
518
 
package/dist/vue.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { InjectionKey, Ref } from 'vue';
2
- import { T as TryMellon, R as Result, a as RegisterResult, b as TryMellonError, c as RegisterOptions, A as AuthenticateResult, d as AuthenticateOptions } from './trymellon-DfbkkIz8.cjs';
2
+ import { T as TryMellon, R as Result, a as RegisterResult, b as TryMellonError, c as RegisterOptions, A as AuthenticateResult, d as AuthenticateOptions } from './trymellon-BkIVfr7x.cjs';
3
3
 
4
4
  declare const TryMellonKey: InjectionKey<TryMellon>;
5
5
  declare function provideTryMellon(client: TryMellon): void;
package/dist/vue.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { InjectionKey, Ref } from 'vue';
2
- import { T as TryMellon, R as Result, a as RegisterResult, b as TryMellonError, c as RegisterOptions, A as AuthenticateResult, d as AuthenticateOptions } from './trymellon-DfbkkIz8.js';
2
+ import { T as TryMellon, R as Result, a as RegisterResult, b as TryMellonError, c as RegisterOptions, A as AuthenticateResult, d as AuthenticateOptions } from './trymellon-BkIVfr7x.js';
3
3
 
4
4
  declare const TryMellonKey: InjectionKey<TryMellon>;
5
5
  declare function provideTryMellon(client: TryMellon): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trymellon/js",
3
- "version": "1.4.9",
3
+ "version": "1.5.0",
4
4
  "description": "SDK oficial de TryMellon para integrar autenticación passwordless con Passkeys / WebAuthn",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",