@rakomi/react-native 0.1.0 → 0.3.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/COMPLIANCE.md +36 -6
- package/README.md +271 -6
- package/SECURITY.md +1 -1
- package/THIRD-PARTY-NOTICES +1 -1
- package/dist/index.cjs +728 -15
- package/dist/index.d.cts +97 -11
- package/dist/index.d.ts +97 -11
- package/dist/index.js +722 -19
- package/dist/native/index.cjs +265 -0
- package/dist/native/index.d.cts +33 -3
- package/dist/native/index.d.ts +33 -3
- package/dist/native/index.js +261 -1
- package/dist/{expo-adapter-CtPCEgue.d.cts → passkey-adapter-D_Z3Z7lV.d.cts} +172 -2
- package/dist/{expo-adapter-CtPCEgue.d.ts → passkey-adapter-D_Z3Z7lV.d.ts} +172 -2
- package/package.json +3 -3
- package/sbom.cdx.json +17 -11
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { AuthEvent, Locale, Translations, AuthMachineState, SignInOptions, SignInResult, TokenResult, AuthError, UserResource, HasParams, SwitchOrgResult, SessionResource, AuthConfig, BrandingConfig,
|
|
3
|
-
export { AuthError, AuthEvent, AuthMachineState, CryptoProvider, HasParams, HttpClient, KeyValueStore, Locale, MfaStepUpRequiredError, MfaStepUpUnavailableError, PkceChallenge, RegisterResult, SessionResource, SignInOptions, SignInResult, SwitchOrgResult, TokenResult, Translations, UserResource, base64url, createTranslator, decodeJwtPayload, decodeSession, decodeUser, generatePkce, getErrorMessage, hasPermission, hasRole, isSafeUrl, networkError, parseOAuthCallbackError, parseTokenEndpointError, scorePassword, selectPluralForm } from '@rakomi/sdk-core';
|
|
4
|
-
import { D as DpopProver, N as NativeAuthAdapter, T as TokenCache } from './
|
|
5
|
-
export { A as AppLifecycle, a as AppStateValue, b as AttestationVerifier, B as BackgroundTask, c as BiometricGate, d as BiometricResult, e as BrowserAuthSessionOptions, f as BrowserAuthSessionResult, C as ConnectivityProvider, g as CreateDefaultExpoAdapterOptions, h as CreateNativeDpopProverOptions, i as
|
|
2
|
+
import { AuthEvent, Locale, Translations, AuthMachineState, SignInOptions, SignInResult, TokenResult, AuthError, UserResource, HasParams, SwitchOrgResult, SessionResource, AuthConfig, BrandingConfig, OrgMembershipClaim, TranslationFn, OAuthTokenResponse, HttpClient, OpaqueUserHandle, PasskeyCeremonyAdapter, PasskeySummary, PasskeyError, AssertPasskeyResult, StepUpWithPasskeyResult, RegisterPasskeyResult, ListPasskeysResult, PasskeySummaryResult, DeletePasskeyResult, RequestResult, VerifyResult } from '@rakomi/sdk-core';
|
|
3
|
+
export { AssertPasskeyResult, AuthError, AuthEvent, AuthMachineState, AuthorizationEndpointCache, AuthorizationEndpointCacheOptions, CryptoProvider, DeletePasskeyResult, HasParams, HttpClient, KeyValueStore, ListPasskeysResult, Locale, MfaStepUpRequiredError, MfaStepUpUnavailableError, OpaqueUserHandle, PasskeyCeremonyAdapter, PasskeyError, PasskeyErrorCode, PasskeySummary, PasskeySummaryResult, PasskeyTokens, PkceChallenge, RegisterPasskeyResult, RegisterResult, SessionResource, SignInOptions, SignInResult, StepUpWithPasskeyResult, SwitchOrgResult, TokenResult, Translations, UserResource, base64url, createAuthorizationEndpointCache, createTranslator, decodeJwtPayload, decodeSession, decodeUser, deriveAuthorizationEndpointFallback, generatePkce, getErrorMessage, hasPermission, hasRole, isSafeUrl, networkError, parseOAuthCallbackError, parseTokenEndpointError, scorePassword, selectPluralForm } from '@rakomi/sdk-core';
|
|
4
|
+
import { D as DpopProver, N as NativeAuthAdapter, T as TokenCache } from './passkey-adapter-D_Z3Z7lV.cjs';
|
|
5
|
+
export { A as AppLifecycle, a as AppStateValue, b as AttestationVerifier, B as BackgroundTask, c as BiometricGate, d as BiometricResult, e as BrowserAuthSessionOptions, f as BrowserAuthSessionResult, C as ConnectivityProvider, g as CreateDefaultExpoAdapterOptions, h as CreateNativeDpopProverOptions, i as CreateNativePasskeyAdapterOptions, j as DeepLinkProvider, k as DpopProofInput, l as NativeDpopModuleSpec, m as NativePasskeyCeremonyAdapter, n as NativePasskeyModuleSpec, P as ParClient, S as SystemBrowser, o as createDefaultExpoAdapter, p as createNativeDpopProver, q as createNativePasskeyAdapter } from './passkey-adapter-D_Z3Z7lV.cjs';
|
|
6
6
|
|
|
7
7
|
/** Reason a DPoP-requested session was downgraded to Bearer by the server. */
|
|
8
8
|
interface DpopDowngradeInfo {
|
|
@@ -134,6 +134,11 @@ declare function RakomiProvider(props: RakomiProviderProps): ReactNode;
|
|
|
134
134
|
* Discriminated-union AuthState — identical to `@rakomi/react`'s `AuthState`.
|
|
135
135
|
*
|
|
136
136
|
* `state: AuthMachineState` is the addition.
|
|
137
|
+
*
|
|
138
|
+
* @experimental Preview — `signIn()` and `switchOrganization()` are present for type parity with
|
|
139
|
+
* `@rakomi/react` but always resolve `{ status: 'error', error: { code: 'INVALID_CONFIG', … } }` in the
|
|
140
|
+
* current release; nothing is wired to the network yet. Use one of the working sign-in paths instead
|
|
141
|
+
* (social, magic link, email OTP, passkeys — see the package README / docs).
|
|
137
142
|
*/
|
|
138
143
|
type AuthState = {
|
|
139
144
|
isLoaded: false;
|
|
@@ -212,6 +217,12 @@ interface UseFlagReturn<T = unknown> {
|
|
|
212
217
|
isEnabled: boolean;
|
|
213
218
|
}
|
|
214
219
|
declare function useFlag<T = unknown>(flag: string, options?: UseFlagOptions): UseFlagReturn<T>;
|
|
220
|
+
/** The active organization context, from the `org` scope's JWT claims. */
|
|
221
|
+
interface OrgContext {
|
|
222
|
+
orgId: string;
|
|
223
|
+
orgRole: string;
|
|
224
|
+
orgMemberships: OrgMembershipClaim[];
|
|
225
|
+
}
|
|
215
226
|
interface UseOrganizationReturn {
|
|
216
227
|
isLoaded: boolean;
|
|
217
228
|
organization: OrgContext | null;
|
|
@@ -219,7 +230,7 @@ interface UseOrganizationReturn {
|
|
|
219
230
|
declare function useOrganization(): UseOrganizationReturn;
|
|
220
231
|
interface UseOrganizationListReturn {
|
|
221
232
|
isLoaded: boolean;
|
|
222
|
-
organizations:
|
|
233
|
+
organizations: OrgMembershipClaim[];
|
|
223
234
|
}
|
|
224
235
|
declare function useOrganizationList(): UseOrganizationListReturn;
|
|
225
236
|
type LinkProvider = 'google' | 'github' | 'microsoft' | 'apple' | 'discord' | 'facebook' | 'slack' | 'twitter' | 'gitlab' | 'linkedin';
|
|
@@ -233,13 +244,19 @@ type LinkedMethods = LinkedMethod[];
|
|
|
233
244
|
interface UseLinkedAccountsResult {
|
|
234
245
|
isLoaded: boolean;
|
|
235
246
|
methods: LinkedMethods;
|
|
247
|
+
/** @experimental Preview — always resolves `{ status: 'error' }` in the current release; no network call is made. */
|
|
236
248
|
link: (provider: LinkProvider) => Promise<{
|
|
237
249
|
status: 'redirect' | 'error';
|
|
238
250
|
}>;
|
|
251
|
+
/** @experimental Preview — always resolves `{ status: 'error' }` in the current release; no network call is made. */
|
|
239
252
|
unlink: (provider: LinkProvider | 'password' | 'magic_link' | 'email_otp' | 'passkey') => Promise<{
|
|
240
253
|
status: 'complete' | 'error';
|
|
241
254
|
}>;
|
|
242
255
|
}
|
|
256
|
+
/**
|
|
257
|
+
* @experimental Preview — `methods` reads the JWT's `linked_methods` claim (live), but `link()` and
|
|
258
|
+
* `unlink()` are not yet wired to the network in this release; see the return type's per-field notes.
|
|
259
|
+
*/
|
|
243
260
|
declare function useLinkedAccounts(): UseLinkedAccountsResult;
|
|
244
261
|
declare function useTranslation(): {
|
|
245
262
|
t: TranslationFn;
|
|
@@ -257,12 +274,14 @@ interface UseBrandingReturn {
|
|
|
257
274
|
declare function useBranding(): UseBrandingReturn;
|
|
258
275
|
interface UseAnonymousSigninResult {
|
|
259
276
|
isLoaded: boolean;
|
|
277
|
+
/** @experimental Preview — always resolves `{ status: 'error' }` in the current release; no network call is made. */
|
|
260
278
|
signInAnonymously: (options?: {
|
|
261
279
|
publicMetadata?: Record<string, unknown>;
|
|
262
280
|
}) => Promise<{
|
|
263
281
|
status: 'complete' | 'error';
|
|
264
282
|
}>;
|
|
265
283
|
}
|
|
284
|
+
/** @experimental Preview — `signInAnonymously()` is not yet wired to the network in this release; see the return type's field note. */
|
|
266
285
|
declare function useAnonymousSignin(): UseAnonymousSigninResult;
|
|
267
286
|
interface BaasPlanPublicItem {
|
|
268
287
|
id: string;
|
|
@@ -348,15 +367,19 @@ interface FeatureProps {
|
|
|
348
367
|
declare function Feature({ flag, children, fallback }: FeatureProps): ReactNode;
|
|
349
368
|
|
|
350
369
|
/**
|
|
351
|
-
* `<SignIn />` — RN port.
|
|
370
|
+
* `<SignIn />` — RN port. **Preview:** `@rakomi/react-native` is a pre-1.0 preview package — see the
|
|
371
|
+
* package README for the full "what's wired today" boundary.
|
|
352
372
|
*
|
|
353
373
|
* Renders a sign-in flow using ONLY RN primitives (`<View>`, `<Text>`,
|
|
354
374
|
* `<TextInput>`, `<Pressable>`) — no HTML. Supports:
|
|
355
|
-
* - Password (direct) sign-in.
|
|
356
375
|
* - Social provider list (Google, GitHub, …) via `startSocialSignIn`.
|
|
357
376
|
* - MFA TOTP code entry view (`keyboardType="number-pad"`,
|
|
358
377
|
* `textContentType="oneTimeCode"`, `autoComplete="sms-otp"`).
|
|
359
378
|
*
|
|
379
|
+
* There is no email/password field in this component — direct email+password sign-in is not wired in
|
|
380
|
+
* the current release. Use `useRegister()` for account creation, or one of the other working sign-in
|
|
381
|
+
* paths (magic link, email OTP, passkeys).
|
|
382
|
+
*
|
|
360
383
|
* Accessibility:
|
|
361
384
|
* - Every interactive element has `accessibilityLabel` + `accessibilityRole`.
|
|
362
385
|
* - i18n keys come from `useRakomiContext.translate`.
|
|
@@ -364,7 +387,12 @@ declare function Feature({ flag, children, fallback }: FeatureProps): ReactNode;
|
|
|
364
387
|
*/
|
|
365
388
|
|
|
366
389
|
interface SignInProps {
|
|
367
|
-
/**
|
|
390
|
+
/**
|
|
391
|
+
* Full authorization-endpoint URL to open the system browser to. Default: resolved via OIDC
|
|
392
|
+
* discovery against `baseUrl` (cached, with a host-naming fallback) — see `useRakomiContext()`'s
|
|
393
|
+
* `authorizationEndpointCache`. A bare `${baseUrl}/oauth/authorize` is NOT a valid default: that
|
|
394
|
+
* path on the API host returns JSON, not the hosted login UI.
|
|
395
|
+
*/
|
|
368
396
|
authorizationEndpoint?: string;
|
|
369
397
|
/** Token endpoint, default `${baseUrl}/v1/auth/oauth/callback`. */
|
|
370
398
|
tokenEndpoint?: string;
|
|
@@ -418,8 +446,8 @@ declare function UserButton(props: UserButtonProps): ReactNode;
|
|
|
418
446
|
/**
|
|
419
447
|
* `<UserProfile />` — RN port (PREVIEW).
|
|
420
448
|
*
|
|
421
|
-
*
|
|
422
|
-
*
|
|
449
|
+
* In preview — on first mount in `__DEV__` builds we log a warning so consumers don't accidentally
|
|
450
|
+
* ship it to production ahead of graduation.
|
|
423
451
|
*/
|
|
424
452
|
|
|
425
453
|
interface UserProfileProps {
|
|
@@ -565,6 +593,64 @@ type SocialSignInOutcome = {
|
|
|
565
593
|
*/
|
|
566
594
|
declare function startSocialSignIn(input: StartSocialSignInInput): Promise<SocialSignInOutcome>;
|
|
567
595
|
|
|
596
|
+
interface UsePasskeysOptions {
|
|
597
|
+
/**
|
|
598
|
+
* Override the ceremony adapter. Intended for tests (`createFakePasskeyAdapter()` from
|
|
599
|
+
* `@rakomi/sdk-core/passkeys/testing`) and for a host that builds its adapter outside the provider.
|
|
600
|
+
* When omitted, the adapter comes from `nativeAdapter.passkeys`.
|
|
601
|
+
*/
|
|
602
|
+
adapter?: PasskeyCeremonyAdapter;
|
|
603
|
+
}
|
|
604
|
+
interface SignInWithPasskeyInput {
|
|
605
|
+
/**
|
|
606
|
+
* Identified sign-in. **An opaque, server-issued handle — NOT an email, NOT a username.** The type is
|
|
607
|
+
* branded (`OpaqueUserHandle`), so a raw string will not compile: passing a user-typed identifier here
|
|
608
|
+
* turns a usernameless flow into an account-enumeration oracle, and — because platform passkeys sync
|
|
609
|
+
* across a user's devices — can reveal which of their devices hold a credential. Omit it for the
|
|
610
|
+
* usernameless flow, which is what almost every app wants.
|
|
611
|
+
*/
|
|
612
|
+
userHandle?: OpaqueUserHandle;
|
|
613
|
+
}
|
|
614
|
+
interface RegisterPasskeyHookInput {
|
|
615
|
+
/** Minted by `stepUpWithPasskey()` or by the password step-up endpoint. */
|
|
616
|
+
stepUpToken: string;
|
|
617
|
+
nickname?: string;
|
|
618
|
+
}
|
|
619
|
+
interface ListPasskeysHookInput {
|
|
620
|
+
stepUpToken: string;
|
|
621
|
+
}
|
|
622
|
+
interface RenamePasskeyHookInput {
|
|
623
|
+
stepUpToken: string;
|
|
624
|
+
passkeyId: string;
|
|
625
|
+
nickname: string;
|
|
626
|
+
}
|
|
627
|
+
interface DeletePasskeyHookInput {
|
|
628
|
+
stepUpToken: string;
|
|
629
|
+
passkeyId: string;
|
|
630
|
+
}
|
|
631
|
+
interface UsePasskeysResult {
|
|
632
|
+
/** `null` until the capability probe resolves. `false` means this device cannot run a ceremony. */
|
|
633
|
+
isSupported: boolean | null;
|
|
634
|
+
/** `null` until probed, and `null` also means UNKNOWN (a module that cannot answer). A UI hint for
|
|
635
|
+
* wording ("Sign in with Face ID"), never a gate. */
|
|
636
|
+
hasPlatformAuthenticator: boolean | null;
|
|
637
|
+
/** `undefined` until `listPasskeys` is called — the hook fetches nothing on mount. */
|
|
638
|
+
passkeys: PasskeySummary[] | undefined;
|
|
639
|
+
error: PasskeyError | null;
|
|
640
|
+
isSigningIn: boolean;
|
|
641
|
+
isRegistering: boolean;
|
|
642
|
+
isSteppingUp: boolean;
|
|
643
|
+
isLoading: boolean;
|
|
644
|
+
isMutating: boolean;
|
|
645
|
+
signInWithPasskey: (input?: SignInWithPasskeyInput) => Promise<AssertPasskeyResult>;
|
|
646
|
+
stepUpWithPasskey: () => Promise<StepUpWithPasskeyResult>;
|
|
647
|
+
registerPasskey: (input: RegisterPasskeyHookInput) => Promise<RegisterPasskeyResult>;
|
|
648
|
+
listPasskeys: (input: ListPasskeysHookInput) => Promise<ListPasskeysResult>;
|
|
649
|
+
renamePasskey: (input: RenamePasskeyHookInput) => Promise<PasskeySummaryResult>;
|
|
650
|
+
deletePasskey: (input: DeletePasskeyHookInput) => Promise<DeletePasskeyResult>;
|
|
651
|
+
}
|
|
652
|
+
declare function usePasskeys(options?: UsePasskeysOptions): UsePasskeysResult;
|
|
653
|
+
|
|
568
654
|
/**
|
|
569
655
|
* `useSubmitOAuthTokens` — bridge between `startSocialSignIn` (free function) and the
|
|
570
656
|
* `<RakomiProvider>` runtime.
|
|
@@ -631,4 +717,4 @@ interface UseMfaResult {
|
|
|
631
717
|
}
|
|
632
718
|
declare function useMfa(): UseMfaResult;
|
|
633
719
|
|
|
634
|
-
export { type AuthState, type CreateDpopSessionOptions, type CreateRnHttpClientOptions, DEFAULT_WEBHOOK_TOLERANCE, type DpopDowngradeInfo, DpopProver, type DpopRefreshError, type DpopRefreshErrorClass, type DpopRefreshResult, DpopSession, Feature, type FeatureProps, type LinkProvider, type LinkedMethod, type LinkedMethods, type LinkedVia, MAX_WEBHOOK_TOLERANCE, NativeAuthAdapter, Protect, type ProtectProps, type PublisherEventType, type PublisherWebhookEvent, type PublisherWebhookEventType, type PublisherWebhookVerifyData, RakomiProvider, type RakomiProviderProps, SignIn, type SignInProps, SignUp, type SignUpProps, SignedIn, type SignedInProps, SignedOut, type SignedOutProps, type SocialSignInOutcome, type StartSocialSignInInput, TokenCache, type UseAnonymousSigninResult, type UseAuthConfigReturn, type UseBaasPlansReturn, type UseBaasSubscriptionReturn, type UseBrandingReturn, type UseEmailOtpResult, type UseFlagOptions, type UseFlagReturn, type UseLinkedAccountsResult, type UseMagicLinkResult, type UseMfaResult, type UseOrganizationListReturn, type UseOrganizationReturn, type UseRegisterResult, type UseSessionReturn, type UseUserReturn, UserButton, type UserButtonProps, UserProfile, type UserProfileProps, type WebhookVerifyErrorClass, type WebhookVerifyResult, createDpopSession, createRnHttpClient, startSocialSignIn, useAnonymousSignin, useAuth, useAuthConfig, useBaasPlans, useBaasSubscription, useBranding, useEmailOtp, useFlag, useLinkedAccounts, useMagicLink, useMfa, useOrganization, useOrganizationList, useRegister, useSession, useSubmitOAuthTokens, useTranslation, useUser, verifyPublisherWebhook, verifyWebhook };
|
|
720
|
+
export { type AuthState, type CreateDpopSessionOptions, type CreateRnHttpClientOptions, DEFAULT_WEBHOOK_TOLERANCE, type DeletePasskeyHookInput, type DpopDowngradeInfo, DpopProver, type DpopRefreshError, type DpopRefreshErrorClass, type DpopRefreshResult, DpopSession, Feature, type FeatureProps, type LinkProvider, type LinkedMethod, type LinkedMethods, type LinkedVia, type ListPasskeysHookInput, MAX_WEBHOOK_TOLERANCE, NativeAuthAdapter, Protect, type ProtectProps, type PublisherEventType, type PublisherWebhookEvent, type PublisherWebhookEventType, type PublisherWebhookVerifyData, RakomiProvider, type RakomiProviderProps, type RegisterPasskeyHookInput, type RenamePasskeyHookInput, SignIn, type SignInProps, type SignInWithPasskeyInput, SignUp, type SignUpProps, SignedIn, type SignedInProps, SignedOut, type SignedOutProps, type SocialSignInOutcome, type StartSocialSignInInput, TokenCache, type UseAnonymousSigninResult, type UseAuthConfigReturn, type UseBaasPlansReturn, type UseBaasSubscriptionReturn, type UseBrandingReturn, type UseEmailOtpResult, type UseFlagOptions, type UseFlagReturn, type UseLinkedAccountsResult, type UseMagicLinkResult, type UseMfaResult, type UseOrganizationListReturn, type UseOrganizationReturn, type UsePasskeysOptions, type UsePasskeysResult, type UseRegisterResult, type UseSessionReturn, type UseUserReturn, UserButton, type UserButtonProps, UserProfile, type UserProfileProps, type WebhookVerifyErrorClass, type WebhookVerifyResult, createDpopSession, createRnHttpClient, startSocialSignIn, useAnonymousSignin, useAuth, useAuthConfig, useBaasPlans, useBaasSubscription, useBranding, useEmailOtp, useFlag, useLinkedAccounts, useMagicLink, useMfa, useOrganization, useOrganizationList, usePasskeys, useRegister, useSession, useSubmitOAuthTokens, useTranslation, useUser, verifyPublisherWebhook, verifyWebhook };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { AuthEvent, Locale, Translations, AuthMachineState, SignInOptions, SignInResult, TokenResult, AuthError, UserResource, HasParams, SwitchOrgResult, SessionResource, AuthConfig, BrandingConfig,
|
|
3
|
-
export { AuthError, AuthEvent, AuthMachineState, CryptoProvider, HasParams, HttpClient, KeyValueStore, Locale, MfaStepUpRequiredError, MfaStepUpUnavailableError, PkceChallenge, RegisterResult, SessionResource, SignInOptions, SignInResult, SwitchOrgResult, TokenResult, Translations, UserResource, base64url, createTranslator, decodeJwtPayload, decodeSession, decodeUser, generatePkce, getErrorMessage, hasPermission, hasRole, isSafeUrl, networkError, parseOAuthCallbackError, parseTokenEndpointError, scorePassword, selectPluralForm } from '@rakomi/sdk-core';
|
|
4
|
-
import { D as DpopProver, N as NativeAuthAdapter, T as TokenCache } from './
|
|
5
|
-
export { A as AppLifecycle, a as AppStateValue, b as AttestationVerifier, B as BackgroundTask, c as BiometricGate, d as BiometricResult, e as BrowserAuthSessionOptions, f as BrowserAuthSessionResult, C as ConnectivityProvider, g as CreateDefaultExpoAdapterOptions, h as CreateNativeDpopProverOptions, i as
|
|
2
|
+
import { AuthEvent, Locale, Translations, AuthMachineState, SignInOptions, SignInResult, TokenResult, AuthError, UserResource, HasParams, SwitchOrgResult, SessionResource, AuthConfig, BrandingConfig, OrgMembershipClaim, TranslationFn, OAuthTokenResponse, HttpClient, OpaqueUserHandle, PasskeyCeremonyAdapter, PasskeySummary, PasskeyError, AssertPasskeyResult, StepUpWithPasskeyResult, RegisterPasskeyResult, ListPasskeysResult, PasskeySummaryResult, DeletePasskeyResult, RequestResult, VerifyResult } from '@rakomi/sdk-core';
|
|
3
|
+
export { AssertPasskeyResult, AuthError, AuthEvent, AuthMachineState, AuthorizationEndpointCache, AuthorizationEndpointCacheOptions, CryptoProvider, DeletePasskeyResult, HasParams, HttpClient, KeyValueStore, ListPasskeysResult, Locale, MfaStepUpRequiredError, MfaStepUpUnavailableError, OpaqueUserHandle, PasskeyCeremonyAdapter, PasskeyError, PasskeyErrorCode, PasskeySummary, PasskeySummaryResult, PasskeyTokens, PkceChallenge, RegisterPasskeyResult, RegisterResult, SessionResource, SignInOptions, SignInResult, StepUpWithPasskeyResult, SwitchOrgResult, TokenResult, Translations, UserResource, base64url, createAuthorizationEndpointCache, createTranslator, decodeJwtPayload, decodeSession, decodeUser, deriveAuthorizationEndpointFallback, generatePkce, getErrorMessage, hasPermission, hasRole, isSafeUrl, networkError, parseOAuthCallbackError, parseTokenEndpointError, scorePassword, selectPluralForm } from '@rakomi/sdk-core';
|
|
4
|
+
import { D as DpopProver, N as NativeAuthAdapter, T as TokenCache } from './passkey-adapter-D_Z3Z7lV.js';
|
|
5
|
+
export { A as AppLifecycle, a as AppStateValue, b as AttestationVerifier, B as BackgroundTask, c as BiometricGate, d as BiometricResult, e as BrowserAuthSessionOptions, f as BrowserAuthSessionResult, C as ConnectivityProvider, g as CreateDefaultExpoAdapterOptions, h as CreateNativeDpopProverOptions, i as CreateNativePasskeyAdapterOptions, j as DeepLinkProvider, k as DpopProofInput, l as NativeDpopModuleSpec, m as NativePasskeyCeremonyAdapter, n as NativePasskeyModuleSpec, P as ParClient, S as SystemBrowser, o as createDefaultExpoAdapter, p as createNativeDpopProver, q as createNativePasskeyAdapter } from './passkey-adapter-D_Z3Z7lV.js';
|
|
6
6
|
|
|
7
7
|
/** Reason a DPoP-requested session was downgraded to Bearer by the server. */
|
|
8
8
|
interface DpopDowngradeInfo {
|
|
@@ -134,6 +134,11 @@ declare function RakomiProvider(props: RakomiProviderProps): ReactNode;
|
|
|
134
134
|
* Discriminated-union AuthState — identical to `@rakomi/react`'s `AuthState`.
|
|
135
135
|
*
|
|
136
136
|
* `state: AuthMachineState` is the addition.
|
|
137
|
+
*
|
|
138
|
+
* @experimental Preview — `signIn()` and `switchOrganization()` are present for type parity with
|
|
139
|
+
* `@rakomi/react` but always resolve `{ status: 'error', error: { code: 'INVALID_CONFIG', … } }` in the
|
|
140
|
+
* current release; nothing is wired to the network yet. Use one of the working sign-in paths instead
|
|
141
|
+
* (social, magic link, email OTP, passkeys — see the package README / docs).
|
|
137
142
|
*/
|
|
138
143
|
type AuthState = {
|
|
139
144
|
isLoaded: false;
|
|
@@ -212,6 +217,12 @@ interface UseFlagReturn<T = unknown> {
|
|
|
212
217
|
isEnabled: boolean;
|
|
213
218
|
}
|
|
214
219
|
declare function useFlag<T = unknown>(flag: string, options?: UseFlagOptions): UseFlagReturn<T>;
|
|
220
|
+
/** The active organization context, from the `org` scope's JWT claims. */
|
|
221
|
+
interface OrgContext {
|
|
222
|
+
orgId: string;
|
|
223
|
+
orgRole: string;
|
|
224
|
+
orgMemberships: OrgMembershipClaim[];
|
|
225
|
+
}
|
|
215
226
|
interface UseOrganizationReturn {
|
|
216
227
|
isLoaded: boolean;
|
|
217
228
|
organization: OrgContext | null;
|
|
@@ -219,7 +230,7 @@ interface UseOrganizationReturn {
|
|
|
219
230
|
declare function useOrganization(): UseOrganizationReturn;
|
|
220
231
|
interface UseOrganizationListReturn {
|
|
221
232
|
isLoaded: boolean;
|
|
222
|
-
organizations:
|
|
233
|
+
organizations: OrgMembershipClaim[];
|
|
223
234
|
}
|
|
224
235
|
declare function useOrganizationList(): UseOrganizationListReturn;
|
|
225
236
|
type LinkProvider = 'google' | 'github' | 'microsoft' | 'apple' | 'discord' | 'facebook' | 'slack' | 'twitter' | 'gitlab' | 'linkedin';
|
|
@@ -233,13 +244,19 @@ type LinkedMethods = LinkedMethod[];
|
|
|
233
244
|
interface UseLinkedAccountsResult {
|
|
234
245
|
isLoaded: boolean;
|
|
235
246
|
methods: LinkedMethods;
|
|
247
|
+
/** @experimental Preview — always resolves `{ status: 'error' }` in the current release; no network call is made. */
|
|
236
248
|
link: (provider: LinkProvider) => Promise<{
|
|
237
249
|
status: 'redirect' | 'error';
|
|
238
250
|
}>;
|
|
251
|
+
/** @experimental Preview — always resolves `{ status: 'error' }` in the current release; no network call is made. */
|
|
239
252
|
unlink: (provider: LinkProvider | 'password' | 'magic_link' | 'email_otp' | 'passkey') => Promise<{
|
|
240
253
|
status: 'complete' | 'error';
|
|
241
254
|
}>;
|
|
242
255
|
}
|
|
256
|
+
/**
|
|
257
|
+
* @experimental Preview — `methods` reads the JWT's `linked_methods` claim (live), but `link()` and
|
|
258
|
+
* `unlink()` are not yet wired to the network in this release; see the return type's per-field notes.
|
|
259
|
+
*/
|
|
243
260
|
declare function useLinkedAccounts(): UseLinkedAccountsResult;
|
|
244
261
|
declare function useTranslation(): {
|
|
245
262
|
t: TranslationFn;
|
|
@@ -257,12 +274,14 @@ interface UseBrandingReturn {
|
|
|
257
274
|
declare function useBranding(): UseBrandingReturn;
|
|
258
275
|
interface UseAnonymousSigninResult {
|
|
259
276
|
isLoaded: boolean;
|
|
277
|
+
/** @experimental Preview — always resolves `{ status: 'error' }` in the current release; no network call is made. */
|
|
260
278
|
signInAnonymously: (options?: {
|
|
261
279
|
publicMetadata?: Record<string, unknown>;
|
|
262
280
|
}) => Promise<{
|
|
263
281
|
status: 'complete' | 'error';
|
|
264
282
|
}>;
|
|
265
283
|
}
|
|
284
|
+
/** @experimental Preview — `signInAnonymously()` is not yet wired to the network in this release; see the return type's field note. */
|
|
266
285
|
declare function useAnonymousSignin(): UseAnonymousSigninResult;
|
|
267
286
|
interface BaasPlanPublicItem {
|
|
268
287
|
id: string;
|
|
@@ -348,15 +367,19 @@ interface FeatureProps {
|
|
|
348
367
|
declare function Feature({ flag, children, fallback }: FeatureProps): ReactNode;
|
|
349
368
|
|
|
350
369
|
/**
|
|
351
|
-
* `<SignIn />` — RN port.
|
|
370
|
+
* `<SignIn />` — RN port. **Preview:** `@rakomi/react-native` is a pre-1.0 preview package — see the
|
|
371
|
+
* package README for the full "what's wired today" boundary.
|
|
352
372
|
*
|
|
353
373
|
* Renders a sign-in flow using ONLY RN primitives (`<View>`, `<Text>`,
|
|
354
374
|
* `<TextInput>`, `<Pressable>`) — no HTML. Supports:
|
|
355
|
-
* - Password (direct) sign-in.
|
|
356
375
|
* - Social provider list (Google, GitHub, …) via `startSocialSignIn`.
|
|
357
376
|
* - MFA TOTP code entry view (`keyboardType="number-pad"`,
|
|
358
377
|
* `textContentType="oneTimeCode"`, `autoComplete="sms-otp"`).
|
|
359
378
|
*
|
|
379
|
+
* There is no email/password field in this component — direct email+password sign-in is not wired in
|
|
380
|
+
* the current release. Use `useRegister()` for account creation, or one of the other working sign-in
|
|
381
|
+
* paths (magic link, email OTP, passkeys).
|
|
382
|
+
*
|
|
360
383
|
* Accessibility:
|
|
361
384
|
* - Every interactive element has `accessibilityLabel` + `accessibilityRole`.
|
|
362
385
|
* - i18n keys come from `useRakomiContext.translate`.
|
|
@@ -364,7 +387,12 @@ declare function Feature({ flag, children, fallback }: FeatureProps): ReactNode;
|
|
|
364
387
|
*/
|
|
365
388
|
|
|
366
389
|
interface SignInProps {
|
|
367
|
-
/**
|
|
390
|
+
/**
|
|
391
|
+
* Full authorization-endpoint URL to open the system browser to. Default: resolved via OIDC
|
|
392
|
+
* discovery against `baseUrl` (cached, with a host-naming fallback) — see `useRakomiContext()`'s
|
|
393
|
+
* `authorizationEndpointCache`. A bare `${baseUrl}/oauth/authorize` is NOT a valid default: that
|
|
394
|
+
* path on the API host returns JSON, not the hosted login UI.
|
|
395
|
+
*/
|
|
368
396
|
authorizationEndpoint?: string;
|
|
369
397
|
/** Token endpoint, default `${baseUrl}/v1/auth/oauth/callback`. */
|
|
370
398
|
tokenEndpoint?: string;
|
|
@@ -418,8 +446,8 @@ declare function UserButton(props: UserButtonProps): ReactNode;
|
|
|
418
446
|
/**
|
|
419
447
|
* `<UserProfile />` — RN port (PREVIEW).
|
|
420
448
|
*
|
|
421
|
-
*
|
|
422
|
-
*
|
|
449
|
+
* In preview — on first mount in `__DEV__` builds we log a warning so consumers don't accidentally
|
|
450
|
+
* ship it to production ahead of graduation.
|
|
423
451
|
*/
|
|
424
452
|
|
|
425
453
|
interface UserProfileProps {
|
|
@@ -565,6 +593,64 @@ type SocialSignInOutcome = {
|
|
|
565
593
|
*/
|
|
566
594
|
declare function startSocialSignIn(input: StartSocialSignInInput): Promise<SocialSignInOutcome>;
|
|
567
595
|
|
|
596
|
+
interface UsePasskeysOptions {
|
|
597
|
+
/**
|
|
598
|
+
* Override the ceremony adapter. Intended for tests (`createFakePasskeyAdapter()` from
|
|
599
|
+
* `@rakomi/sdk-core/passkeys/testing`) and for a host that builds its adapter outside the provider.
|
|
600
|
+
* When omitted, the adapter comes from `nativeAdapter.passkeys`.
|
|
601
|
+
*/
|
|
602
|
+
adapter?: PasskeyCeremonyAdapter;
|
|
603
|
+
}
|
|
604
|
+
interface SignInWithPasskeyInput {
|
|
605
|
+
/**
|
|
606
|
+
* Identified sign-in. **An opaque, server-issued handle — NOT an email, NOT a username.** The type is
|
|
607
|
+
* branded (`OpaqueUserHandle`), so a raw string will not compile: passing a user-typed identifier here
|
|
608
|
+
* turns a usernameless flow into an account-enumeration oracle, and — because platform passkeys sync
|
|
609
|
+
* across a user's devices — can reveal which of their devices hold a credential. Omit it for the
|
|
610
|
+
* usernameless flow, which is what almost every app wants.
|
|
611
|
+
*/
|
|
612
|
+
userHandle?: OpaqueUserHandle;
|
|
613
|
+
}
|
|
614
|
+
interface RegisterPasskeyHookInput {
|
|
615
|
+
/** Minted by `stepUpWithPasskey()` or by the password step-up endpoint. */
|
|
616
|
+
stepUpToken: string;
|
|
617
|
+
nickname?: string;
|
|
618
|
+
}
|
|
619
|
+
interface ListPasskeysHookInput {
|
|
620
|
+
stepUpToken: string;
|
|
621
|
+
}
|
|
622
|
+
interface RenamePasskeyHookInput {
|
|
623
|
+
stepUpToken: string;
|
|
624
|
+
passkeyId: string;
|
|
625
|
+
nickname: string;
|
|
626
|
+
}
|
|
627
|
+
interface DeletePasskeyHookInput {
|
|
628
|
+
stepUpToken: string;
|
|
629
|
+
passkeyId: string;
|
|
630
|
+
}
|
|
631
|
+
interface UsePasskeysResult {
|
|
632
|
+
/** `null` until the capability probe resolves. `false` means this device cannot run a ceremony. */
|
|
633
|
+
isSupported: boolean | null;
|
|
634
|
+
/** `null` until probed, and `null` also means UNKNOWN (a module that cannot answer). A UI hint for
|
|
635
|
+
* wording ("Sign in with Face ID"), never a gate. */
|
|
636
|
+
hasPlatformAuthenticator: boolean | null;
|
|
637
|
+
/** `undefined` until `listPasskeys` is called — the hook fetches nothing on mount. */
|
|
638
|
+
passkeys: PasskeySummary[] | undefined;
|
|
639
|
+
error: PasskeyError | null;
|
|
640
|
+
isSigningIn: boolean;
|
|
641
|
+
isRegistering: boolean;
|
|
642
|
+
isSteppingUp: boolean;
|
|
643
|
+
isLoading: boolean;
|
|
644
|
+
isMutating: boolean;
|
|
645
|
+
signInWithPasskey: (input?: SignInWithPasskeyInput) => Promise<AssertPasskeyResult>;
|
|
646
|
+
stepUpWithPasskey: () => Promise<StepUpWithPasskeyResult>;
|
|
647
|
+
registerPasskey: (input: RegisterPasskeyHookInput) => Promise<RegisterPasskeyResult>;
|
|
648
|
+
listPasskeys: (input: ListPasskeysHookInput) => Promise<ListPasskeysResult>;
|
|
649
|
+
renamePasskey: (input: RenamePasskeyHookInput) => Promise<PasskeySummaryResult>;
|
|
650
|
+
deletePasskey: (input: DeletePasskeyHookInput) => Promise<DeletePasskeyResult>;
|
|
651
|
+
}
|
|
652
|
+
declare function usePasskeys(options?: UsePasskeysOptions): UsePasskeysResult;
|
|
653
|
+
|
|
568
654
|
/**
|
|
569
655
|
* `useSubmitOAuthTokens` — bridge between `startSocialSignIn` (free function) and the
|
|
570
656
|
* `<RakomiProvider>` runtime.
|
|
@@ -631,4 +717,4 @@ interface UseMfaResult {
|
|
|
631
717
|
}
|
|
632
718
|
declare function useMfa(): UseMfaResult;
|
|
633
719
|
|
|
634
|
-
export { type AuthState, type CreateDpopSessionOptions, type CreateRnHttpClientOptions, DEFAULT_WEBHOOK_TOLERANCE, type DpopDowngradeInfo, DpopProver, type DpopRefreshError, type DpopRefreshErrorClass, type DpopRefreshResult, DpopSession, Feature, type FeatureProps, type LinkProvider, type LinkedMethod, type LinkedMethods, type LinkedVia, MAX_WEBHOOK_TOLERANCE, NativeAuthAdapter, Protect, type ProtectProps, type PublisherEventType, type PublisherWebhookEvent, type PublisherWebhookEventType, type PublisherWebhookVerifyData, RakomiProvider, type RakomiProviderProps, SignIn, type SignInProps, SignUp, type SignUpProps, SignedIn, type SignedInProps, SignedOut, type SignedOutProps, type SocialSignInOutcome, type StartSocialSignInInput, TokenCache, type UseAnonymousSigninResult, type UseAuthConfigReturn, type UseBaasPlansReturn, type UseBaasSubscriptionReturn, type UseBrandingReturn, type UseEmailOtpResult, type UseFlagOptions, type UseFlagReturn, type UseLinkedAccountsResult, type UseMagicLinkResult, type UseMfaResult, type UseOrganizationListReturn, type UseOrganizationReturn, type UseRegisterResult, type UseSessionReturn, type UseUserReturn, UserButton, type UserButtonProps, UserProfile, type UserProfileProps, type WebhookVerifyErrorClass, type WebhookVerifyResult, createDpopSession, createRnHttpClient, startSocialSignIn, useAnonymousSignin, useAuth, useAuthConfig, useBaasPlans, useBaasSubscription, useBranding, useEmailOtp, useFlag, useLinkedAccounts, useMagicLink, useMfa, useOrganization, useOrganizationList, useRegister, useSession, useSubmitOAuthTokens, useTranslation, useUser, verifyPublisherWebhook, verifyWebhook };
|
|
720
|
+
export { type AuthState, type CreateDpopSessionOptions, type CreateRnHttpClientOptions, DEFAULT_WEBHOOK_TOLERANCE, type DeletePasskeyHookInput, type DpopDowngradeInfo, DpopProver, type DpopRefreshError, type DpopRefreshErrorClass, type DpopRefreshResult, DpopSession, Feature, type FeatureProps, type LinkProvider, type LinkedMethod, type LinkedMethods, type LinkedVia, type ListPasskeysHookInput, MAX_WEBHOOK_TOLERANCE, NativeAuthAdapter, Protect, type ProtectProps, type PublisherEventType, type PublisherWebhookEvent, type PublisherWebhookEventType, type PublisherWebhookVerifyData, RakomiProvider, type RakomiProviderProps, type RegisterPasskeyHookInput, type RenamePasskeyHookInput, SignIn, type SignInProps, type SignInWithPasskeyInput, SignUp, type SignUpProps, SignedIn, type SignedInProps, SignedOut, type SignedOutProps, type SocialSignInOutcome, type StartSocialSignInInput, TokenCache, type UseAnonymousSigninResult, type UseAuthConfigReturn, type UseBaasPlansReturn, type UseBaasSubscriptionReturn, type UseBrandingReturn, type UseEmailOtpResult, type UseFlagOptions, type UseFlagReturn, type UseLinkedAccountsResult, type UseMagicLinkResult, type UseMfaResult, type UseOrganizationListReturn, type UseOrganizationReturn, type UsePasskeysOptions, type UsePasskeysResult, type UseRegisterResult, type UseSessionReturn, type UseUserReturn, UserButton, type UserButtonProps, UserProfile, type UserProfileProps, type WebhookVerifyErrorClass, type WebhookVerifyResult, createDpopSession, createRnHttpClient, startSocialSignIn, useAnonymousSignin, useAuth, useAuthConfig, useBaasPlans, useBaasSubscription, useBranding, useEmailOtp, useFlag, useLinkedAccounts, useMagicLink, useMfa, useOrganization, useOrganizationList, usePasskeys, useRegister, useSession, useSubmitOAuthTokens, useTranslation, useUser, verifyPublisherWebhook, verifyWebhook };
|