@trymellon/js 1.3.3 → 1.3.4

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-Cks8wrUf.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-B9rvhe53.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-Cks8wrUf.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-B9rvhe53.js';
4
4
 
5
5
  declare function TryMellonProvider(props: {
6
6
  client: TryMellon;
@@ -139,13 +139,32 @@ type CrossDeviceStatusResult = {
139
139
  user_id?: string;
140
140
  session_token?: string;
141
141
  };
142
- type CrossDeviceContextResult = {
142
+ /** Context for auth: request options (get). */
143
+ type CrossDeviceContextAuth = {
144
+ type: 'auth';
143
145
  options: AuthStartResponse['challenge'];
144
146
  };
147
+ /** Context for registration: creation options (create). */
148
+ type CrossDeviceContextRegistration = {
149
+ type: 'registration';
150
+ options: RegisterStartResponse['challenge'];
151
+ };
152
+ /**
153
+ * Contract: response of getCrossDeviceContext.
154
+ * Single source of truth for branching in approve(): use context.type to decide
155
+ * whether to run credentials.get (auth) or credentials.create (registration).
156
+ * Validators must return only CrossDeviceContextAuth | CrossDeviceContextRegistration.
157
+ */
158
+ type CrossDeviceContextResult = CrossDeviceContextAuth | CrossDeviceContextRegistration;
145
159
  type CrossDeviceVerifyRequest = {
146
160
  session_id: string;
147
161
  credential: AuthFinishRequest['credential'];
148
162
  };
163
+ /** Same shape as RegisterFinishRequest; used for POST verify-registration. */
164
+ type CrossDeviceVerifyRegistrationRequest = {
165
+ session_id: string;
166
+ credential: RegisterFinishRequest['credential'];
167
+ };
149
168
  type RegisterStartRequest = {
150
169
  external_user_id: string;
151
170
  };
@@ -379,9 +398,19 @@ declare class ApiClient {
379
398
  registerOnboardingPasskey(sessionId: string, request: OnboardingRegisterPasskeyRequest): Promise<Result<OnboardingRegisterPasskeyResponse, TryMellonError>>;
380
399
  completeOnboarding(sessionId: string, request: OnboardingCompleteRequest): Promise<Result<OnboardingCompleteResponse, TryMellonError>>;
381
400
  initCrossDeviceAuth(): Promise<Result<CrossDeviceInitResult, TryMellonError>>;
401
+ initCrossDeviceRegistration(options: {
402
+ externalUserId: string;
403
+ }): Promise<Result<CrossDeviceInitResult, TryMellonError>>;
382
404
  getCrossDeviceStatus(sessionId: string): Promise<Result<CrossDeviceStatusResult, TryMellonError>>;
405
+ /**
406
+ * Fetches WebAuthn options for the cross-device session.
407
+ * Contract: response is CrossDeviceContextResult (auth | registration).
408
+ * Use result.value.type to branch: 'auth' → credentials.get + verify;
409
+ * 'registration' → credentials.create + verify-registration.
410
+ */
383
411
  getCrossDeviceContext(sessionId: string): Promise<Result<CrossDeviceContextResult, TryMellonError>>;
384
412
  verifyCrossDeviceAuth(request: CrossDeviceVerifyRequest): Promise<Result<void, TryMellonError>>;
413
+ verifyCrossDeviceRegistration(request: CrossDeviceVerifyRegistrationRequest): Promise<Result<void, TryMellonError>>;
385
414
  }
386
415
 
387
416
  declare class OnboardingManager {
@@ -434,6 +463,9 @@ declare class TryMellon {
434
463
  auth: {
435
464
  crossDevice: {
436
465
  init: () => Promise<Result<CrossDeviceInitResult, TryMellonError>>;
466
+ initRegistration: (options: {
467
+ externalUserId: string;
468
+ }) => Promise<Result<CrossDeviceInitResult, TryMellonError>>;
437
469
  waitForSession: (sessionId: string, signal?: AbortSignal) => Promise<Result<{
438
470
  session_token: string;
439
471
  user_id: string;
@@ -139,13 +139,32 @@ type CrossDeviceStatusResult = {
139
139
  user_id?: string;
140
140
  session_token?: string;
141
141
  };
142
- type CrossDeviceContextResult = {
142
+ /** Context for auth: request options (get). */
143
+ type CrossDeviceContextAuth = {
144
+ type: 'auth';
143
145
  options: AuthStartResponse['challenge'];
144
146
  };
147
+ /** Context for registration: creation options (create). */
148
+ type CrossDeviceContextRegistration = {
149
+ type: 'registration';
150
+ options: RegisterStartResponse['challenge'];
151
+ };
152
+ /**
153
+ * Contract: response of getCrossDeviceContext.
154
+ * Single source of truth for branching in approve(): use context.type to decide
155
+ * whether to run credentials.get (auth) or credentials.create (registration).
156
+ * Validators must return only CrossDeviceContextAuth | CrossDeviceContextRegistration.
157
+ */
158
+ type CrossDeviceContextResult = CrossDeviceContextAuth | CrossDeviceContextRegistration;
145
159
  type CrossDeviceVerifyRequest = {
146
160
  session_id: string;
147
161
  credential: AuthFinishRequest['credential'];
148
162
  };
163
+ /** Same shape as RegisterFinishRequest; used for POST verify-registration. */
164
+ type CrossDeviceVerifyRegistrationRequest = {
165
+ session_id: string;
166
+ credential: RegisterFinishRequest['credential'];
167
+ };
149
168
  type RegisterStartRequest = {
150
169
  external_user_id: string;
151
170
  };
@@ -379,9 +398,19 @@ declare class ApiClient {
379
398
  registerOnboardingPasskey(sessionId: string, request: OnboardingRegisterPasskeyRequest): Promise<Result<OnboardingRegisterPasskeyResponse, TryMellonError>>;
380
399
  completeOnboarding(sessionId: string, request: OnboardingCompleteRequest): Promise<Result<OnboardingCompleteResponse, TryMellonError>>;
381
400
  initCrossDeviceAuth(): Promise<Result<CrossDeviceInitResult, TryMellonError>>;
401
+ initCrossDeviceRegistration(options: {
402
+ externalUserId: string;
403
+ }): Promise<Result<CrossDeviceInitResult, TryMellonError>>;
382
404
  getCrossDeviceStatus(sessionId: string): Promise<Result<CrossDeviceStatusResult, TryMellonError>>;
405
+ /**
406
+ * Fetches WebAuthn options for the cross-device session.
407
+ * Contract: response is CrossDeviceContextResult (auth | registration).
408
+ * Use result.value.type to branch: 'auth' → credentials.get + verify;
409
+ * 'registration' → credentials.create + verify-registration.
410
+ */
383
411
  getCrossDeviceContext(sessionId: string): Promise<Result<CrossDeviceContextResult, TryMellonError>>;
384
412
  verifyCrossDeviceAuth(request: CrossDeviceVerifyRequest): Promise<Result<void, TryMellonError>>;
413
+ verifyCrossDeviceRegistration(request: CrossDeviceVerifyRegistrationRequest): Promise<Result<void, TryMellonError>>;
385
414
  }
386
415
 
387
416
  declare class OnboardingManager {
@@ -434,6 +463,9 @@ declare class TryMellon {
434
463
  auth: {
435
464
  crossDevice: {
436
465
  init: () => Promise<Result<CrossDeviceInitResult, TryMellonError>>;
466
+ initRegistration: (options: {
467
+ externalUserId: string;
468
+ }) => Promise<Result<CrossDeviceInitResult, TryMellonError>>;
437
469
  waitForSession: (sessionId: string, signal?: AbortSignal) => Promise<Result<{
438
470
  session_token: string;
439
471
  user_id: string;
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-Cks8wrUf.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-B9rvhe53.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-Cks8wrUf.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-B9rvhe53.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.3.3",
3
+ "version": "1.3.4",
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",