@authn-sh/sdk-node 0.4.0-alpha.2 → 0.5.0-alpha.9
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/index.cjs +155 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +164 -14
- package/dist/index.d.ts +164 -14
- package/dist/index.js +149 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,17 +1,5 @@
|
|
|
1
1
|
export { AuthnApiError, AuthnConfigError, AuthnHttpError, AuthnTokenInvalidError, AuthnWebhookSignatureInvalidError } from './errors.cjs';
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* Pagination + ordering parameters shared by every `list*` BAPI call.
|
|
5
|
-
* Resource-specific filter params extend this with their own fields.
|
|
6
|
-
*/
|
|
7
|
-
declare class ListParams {
|
|
8
|
-
limit?: number | undefined;
|
|
9
|
-
offset?: number | undefined;
|
|
10
|
-
orderBy?: string | undefined;
|
|
11
|
-
constructor(limit?: number | undefined, offset?: number | undefined, orderBy?: string | undefined);
|
|
12
|
-
toQuery(): Record<string, unknown>;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
3
|
interface TransportOptions {
|
|
16
4
|
/** API base URL — typically `https://api.authn.sh/v1`. Trailing `/v1` is required. */
|
|
17
5
|
apiUrl: string;
|
|
@@ -69,6 +57,71 @@ declare abstract class Manager {
|
|
|
69
57
|
constructor(transport: Transport);
|
|
70
58
|
}
|
|
71
59
|
|
|
60
|
+
interface AppearanceVariables {
|
|
61
|
+
colorPrimary?: string;
|
|
62
|
+
colorBackground?: string;
|
|
63
|
+
colorText?: string;
|
|
64
|
+
colorTextOnPrimary?: string;
|
|
65
|
+
colorInputBackground?: string;
|
|
66
|
+
colorInputText?: string;
|
|
67
|
+
colorDanger?: string;
|
|
68
|
+
colorSuccess?: string;
|
|
69
|
+
colorWarning?: string;
|
|
70
|
+
colorNeutral?: string;
|
|
71
|
+
fontFamily?: string;
|
|
72
|
+
fontFamilyButtons?: string;
|
|
73
|
+
fontSize?: string;
|
|
74
|
+
borderRadius?: string;
|
|
75
|
+
spacingUnit?: string;
|
|
76
|
+
[key: string]: string | undefined;
|
|
77
|
+
}
|
|
78
|
+
interface AppearanceLayout {
|
|
79
|
+
logoImageUrl?: string | null;
|
|
80
|
+
logoLinkUrl?: string | null;
|
|
81
|
+
socialButtonsPlacement?: 'top' | 'bottom';
|
|
82
|
+
socialButtonsVariant?: 'blockButton' | 'iconButton';
|
|
83
|
+
showOptionalFields?: boolean;
|
|
84
|
+
privacyPageUrl?: string | null;
|
|
85
|
+
termsPageUrl?: string | null;
|
|
86
|
+
helpPageUrl?: string | null;
|
|
87
|
+
animations?: boolean;
|
|
88
|
+
}
|
|
89
|
+
interface Appearance {
|
|
90
|
+
variables?: AppearanceVariables;
|
|
91
|
+
elements?: Record<string, string>;
|
|
92
|
+
layout?: AppearanceLayout;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* BAPI surface for the env-scoped `appearance` blob.
|
|
96
|
+
* Mirrors sdk-php's `AppearanceManager`:
|
|
97
|
+
*
|
|
98
|
+
* - `GET /v1/instance/appearance` — fetch the current blob.
|
|
99
|
+
* - `PUT /v1/instance/appearance` — replace wholesale.
|
|
100
|
+
* - `PATCH /v1/instance/appearance` — sparse merge.
|
|
101
|
+
*
|
|
102
|
+
* The SDK transmits camelCase keys; the server's snake/camel boundary
|
|
103
|
+
* is handled by the BAPI itself (the appearance schema is intentionally
|
|
104
|
+
* camelCase per OA-4).
|
|
105
|
+
*/
|
|
106
|
+
declare class AppearanceManager extends Manager {
|
|
107
|
+
get(): Promise<Appearance>;
|
|
108
|
+
put(blob: Appearance, idempotencyKey?: string): Promise<Appearance>;
|
|
109
|
+
patch(partial: Partial<Appearance>, idempotencyKey?: string): Promise<Appearance>;
|
|
110
|
+
}
|
|
111
|
+
declare function hydrateAppearance(raw: unknown): Appearance;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Pagination + ordering parameters shared by every `list*` BAPI call.
|
|
115
|
+
* Resource-specific filter params extend this with their own fields.
|
|
116
|
+
*/
|
|
117
|
+
declare class ListParams {
|
|
118
|
+
limit?: number | undefined;
|
|
119
|
+
offset?: number | undefined;
|
|
120
|
+
orderBy?: string | undefined;
|
|
121
|
+
constructor(limit?: number | undefined, offset?: number | undefined, orderBy?: string | undefined);
|
|
122
|
+
toQuery(): Record<string, unknown>;
|
|
123
|
+
}
|
|
124
|
+
|
|
72
125
|
/**
|
|
73
126
|
* Generic paginated-list envelope returned by every `list*` BAPI endpoint.
|
|
74
127
|
*/
|
|
@@ -180,6 +233,39 @@ declare class BlocklistIdentifiersManager extends Manager {
|
|
|
180
233
|
declare function hydrateAllowlistIdentifier(raw: unknown): AllowlistIdentifier;
|
|
181
234
|
declare function hydrateBlocklistIdentifier(raw: unknown): BlocklistIdentifier;
|
|
182
235
|
|
|
236
|
+
interface Localization {
|
|
237
|
+
default_locale: string;
|
|
238
|
+
fallback_locale: string;
|
|
239
|
+
supported_locales: string[];
|
|
240
|
+
/**
|
|
241
|
+
* Sparse per-locale overrides: `{ [locale]: { [dot.keyed.key]: 'translation' } }`.
|
|
242
|
+
* The SDK never stores the canonical defaults — those ship with
|
|
243
|
+
* `@authn-sh/sdk-react`. The server stores overrides only and rejects
|
|
244
|
+
* unknown canonical keys at save time.
|
|
245
|
+
*/
|
|
246
|
+
overrides: Record<string, Record<string, string>>;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* BAPI surface for the env-scoped `localization` blob.
|
|
250
|
+
* Mirrors sdk-php's `LocalizationManager`:
|
|
251
|
+
*
|
|
252
|
+
* - `GET /v1/instance/localization` — fetch the current blob.
|
|
253
|
+
* - `PUT /v1/instance/localization` — replace wholesale.
|
|
254
|
+
* - `PATCH /v1/instance/localization` — sparse merge per locale; setting a
|
|
255
|
+
* leaf key to `null` removes that single override.
|
|
256
|
+
*/
|
|
257
|
+
declare class LocalizationManager extends Manager {
|
|
258
|
+
get(): Promise<Localization>;
|
|
259
|
+
put(blob: Localization, idempotencyKey?: string): Promise<Localization>;
|
|
260
|
+
patch(partial: {
|
|
261
|
+
default_locale?: string;
|
|
262
|
+
fallback_locale?: string;
|
|
263
|
+
supported_locales?: string[];
|
|
264
|
+
overrides?: Record<string, Record<string, string | null>>;
|
|
265
|
+
}, idempotencyKey?: string): Promise<Localization>;
|
|
266
|
+
}
|
|
267
|
+
declare function hydrateLocalization(raw: unknown): Localization;
|
|
268
|
+
|
|
183
269
|
interface OauthProvider {
|
|
184
270
|
id: string;
|
|
185
271
|
object: 'oauth_provider';
|
|
@@ -330,6 +416,46 @@ declare function hydrateOrganizationMembership(raw: unknown): OrganizationMember
|
|
|
330
416
|
declare function hydrateOrganizationInvitation(raw: unknown): OrganizationInvitation;
|
|
331
417
|
declare function hydrateOrganizationDomain(raw: unknown): OrganizationDomain;
|
|
332
418
|
|
|
419
|
+
type PasskeyTransport = 'usb' | 'nfc' | 'ble' | 'internal' | 'hybrid';
|
|
420
|
+
interface Passkey {
|
|
421
|
+
id: string;
|
|
422
|
+
object: 'passkey';
|
|
423
|
+
userId: string;
|
|
424
|
+
nickname: string;
|
|
425
|
+
transports: PasskeyTransport[];
|
|
426
|
+
aaguid: string | null;
|
|
427
|
+
verified: boolean;
|
|
428
|
+
lastUsedAt: number | null;
|
|
429
|
+
createdAt: number;
|
|
430
|
+
updatedAt: number;
|
|
431
|
+
raw: Record<string, unknown>;
|
|
432
|
+
}
|
|
433
|
+
declare class PasskeysListParams extends ListParams {
|
|
434
|
+
userId?: string | undefined;
|
|
435
|
+
constructor(userId?: string | undefined, limit?: number, offset?: number, orderBy?: string);
|
|
436
|
+
toQuery(): Record<string, unknown>;
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* BAPI admin surface for passkeys. Mirrors sdk-php's `PasskeysManager`:
|
|
440
|
+
*
|
|
441
|
+
* - `GET /v1/passkeys` — list across the workspace (optionally filtered by `userId`).
|
|
442
|
+
* - `GET /v1/passkeys/{id}` — single passkey row.
|
|
443
|
+
* - `PATCH /v1/passkeys/{id}` — rename (`nickname` is the only mutable field).
|
|
444
|
+
* - `DELETE /v1/passkeys/{id}` — soft-remove.
|
|
445
|
+
*
|
|
446
|
+
* FAPI-side enrollment / authentication lives in `@authn-sh/sdk-js`.
|
|
447
|
+
* `@authn-sh/sdk-node` is admin-only.
|
|
448
|
+
*/
|
|
449
|
+
declare class PasskeysManager extends Manager {
|
|
450
|
+
list(params?: PasskeysListParams): Promise<PaginatedList<Passkey>>;
|
|
451
|
+
get(passkeyId: string): Promise<Passkey>;
|
|
452
|
+
update(passkeyId: string, data: {
|
|
453
|
+
nickname: string;
|
|
454
|
+
}, idempotencyKey?: string): Promise<Passkey>;
|
|
455
|
+
delete(passkeyId: string): Promise<void>;
|
|
456
|
+
}
|
|
457
|
+
declare function hydratePasskey(raw: unknown): Passkey;
|
|
458
|
+
|
|
333
459
|
interface PhoneNumber {
|
|
334
460
|
id: string;
|
|
335
461
|
object: 'phone_number';
|
|
@@ -560,6 +686,9 @@ declare class Authn {
|
|
|
560
686
|
readonly roles: RolesManager;
|
|
561
687
|
readonly permissions: PermissionsManager;
|
|
562
688
|
readonly instance: InstanceManager;
|
|
689
|
+
readonly passkeys: PasskeysManager;
|
|
690
|
+
readonly appearance: AppearanceManager;
|
|
691
|
+
readonly localization: LocalizationManager;
|
|
563
692
|
constructor(opts: AuthnOptions);
|
|
564
693
|
}
|
|
565
694
|
|
|
@@ -598,12 +727,33 @@ declare class VerifiedClaims {
|
|
|
598
727
|
readonly firstFactorAgeSeconds: number | null;
|
|
599
728
|
readonly phoneNumberVerified: boolean;
|
|
600
729
|
readonly defaultSecondFactor: 'totp' | 'phone_code' | 'backup_code' | null;
|
|
730
|
+
/**
|
|
731
|
+
* `true` when the session was completed via a passkey first-factor
|
|
732
|
+
* ceremony (AU-15 sets the `pkv` claim on the session JWT).
|
|
733
|
+
*/
|
|
734
|
+
readonly passkeyVerified: boolean;
|
|
735
|
+
/**
|
|
736
|
+
* Number of verified passkeys enrolled on the user at session
|
|
737
|
+
* creation time (AU-15 sets the `pkc` claim).
|
|
738
|
+
*/
|
|
739
|
+
readonly passkeyCount: number;
|
|
601
740
|
readonly raw: Record<string, unknown>;
|
|
602
|
-
constructor(sub: string, sid: string, iss: string, azp: string | null, exp: number, iat: number, nbf: number | null, actor: VerifiedActor | null, organization: VerifiedOrganization | null, wasTest: boolean, twoFactorVerified: boolean, secondFactorAgeSeconds: number | null, firstFactorAgeSeconds: number | null, phoneNumberVerified: boolean, defaultSecondFactor: 'totp' | 'phone_code' | 'backup_code' | null,
|
|
741
|
+
constructor(sub: string, sid: string, iss: string, azp: string | null, exp: number, iat: number, nbf: number | null, actor: VerifiedActor | null, organization: VerifiedOrganization | null, wasTest: boolean, twoFactorVerified: boolean, secondFactorAgeSeconds: number | null, firstFactorAgeSeconds: number | null, phoneNumberVerified: boolean, defaultSecondFactor: 'totp' | 'phone_code' | 'backup_code' | null,
|
|
742
|
+
/**
|
|
743
|
+
* `true` when the session was completed via a passkey first-factor
|
|
744
|
+
* ceremony (AU-15 sets the `pkv` claim on the session JWT).
|
|
745
|
+
*/
|
|
746
|
+
passkeyVerified: boolean,
|
|
747
|
+
/**
|
|
748
|
+
* Number of verified passkeys enrolled on the user at session
|
|
749
|
+
* creation time (AU-15 sets the `pkc` claim).
|
|
750
|
+
*/
|
|
751
|
+
passkeyCount: number, raw: Record<string, unknown>);
|
|
603
752
|
hasRole(roleKey: string): boolean;
|
|
604
753
|
hasPermission(permissionKey: string): boolean;
|
|
605
754
|
hasVerifiedPhoneNumber(): boolean;
|
|
606
755
|
preferredSecondFactor(): VerifiedClaims['defaultSecondFactor'];
|
|
756
|
+
hasVerifiedPasskey(): boolean;
|
|
607
757
|
}
|
|
608
758
|
/**
|
|
609
759
|
* Build a VerifiedClaims from a JWT claims-bag (post-signature-verify).
|
|
@@ -725,4 +875,4 @@ declare class WebhookSignatureVerifier {
|
|
|
725
875
|
private matchesAny;
|
|
726
876
|
}
|
|
727
877
|
|
|
728
|
-
export { type AllowlistIdentifier, AllowlistIdentifiersManager, Authn, type AuthnOptions, type BlocklistIdentifier, BlocklistIdentifiersManager, type ExternalAccount, ExternalAccountsListParams, ExternalAccountsManager, InstanceManager, type InstanceSettings, type Invitation, InvitationsListParams, InvitationsManager, ListParams, type OauthProvider, type OauthProviderTestResult, OauthProvidersManager, type Organization, type OrganizationDomain, OrganizationDomainsManager, type OrganizationInvitation, OrganizationInvitationsManager, type OrganizationMembership, OrganizationMembershipsManager, OrganizationsManager, type PaginatedList, type Permission, PermissionsManager, type PhoneNumber, PhoneNumbersListParams, PhoneNumbersManager, type RedirectUrl, RedirectUrlsManager, type RequestOptions, type Role, RolesManager, type Session, SessionsListParams, SessionsManager, type SmsTemplate, type SmsTemplateSlug, SmsTemplatesManager, TokenVerifier, type TokenVerifierOptions, type TotpVerificationResult, Transport, type TransportOptions, type User, UsersListParams, UsersManager, type VerifiedActor, VerifiedClaims, type VerifiedOrganization, type WebhookEvent, WebhookSignatureVerifier, type WebhookSignatureVerifierOptions, buildVerifiedClaims, decodeFrontendApiUrl, hydrateAllowlistIdentifier, hydrateBlocklistIdentifier, hydrateExternalAccount, hydrateInstance, hydrateInvitation, hydrateOauthProvider, hydrateOrganization, hydrateOrganizationDomain, hydrateOrganizationInvitation, hydrateOrganizationMembership, hydratePermission, hydratePhoneNumber, hydrateRedirectUrl, hydrateRole, hydrateSession, hydrateSmsTemplate, hydrateUser };
|
|
878
|
+
export { type AllowlistIdentifier, AllowlistIdentifiersManager, type Appearance, type AppearanceLayout, AppearanceManager, type AppearanceVariables, Authn, type AuthnOptions, type BlocklistIdentifier, BlocklistIdentifiersManager, type ExternalAccount, ExternalAccountsListParams, ExternalAccountsManager, InstanceManager, type InstanceSettings, type Invitation, InvitationsListParams, InvitationsManager, ListParams, type Localization, LocalizationManager, type OauthProvider, type OauthProviderTestResult, OauthProvidersManager, type Organization, type OrganizationDomain, OrganizationDomainsManager, type OrganizationInvitation, OrganizationInvitationsManager, type OrganizationMembership, OrganizationMembershipsManager, OrganizationsManager, type PaginatedList, type Passkey, type PasskeyTransport, PasskeysListParams, PasskeysManager, type Permission, PermissionsManager, type PhoneNumber, PhoneNumbersListParams, PhoneNumbersManager, type RedirectUrl, RedirectUrlsManager, type RequestOptions, type Role, RolesManager, type Session, SessionsListParams, SessionsManager, type SmsTemplate, type SmsTemplateSlug, SmsTemplatesManager, TokenVerifier, type TokenVerifierOptions, type TotpVerificationResult, Transport, type TransportOptions, type User, UsersListParams, UsersManager, type VerifiedActor, VerifiedClaims, type VerifiedOrganization, type WebhookEvent, WebhookSignatureVerifier, type WebhookSignatureVerifierOptions, buildVerifiedClaims, decodeFrontendApiUrl, hydrateAllowlistIdentifier, hydrateAppearance, hydrateBlocklistIdentifier, hydrateExternalAccount, hydrateInstance, hydrateInvitation, hydrateLocalization, hydrateOauthProvider, hydrateOrganization, hydrateOrganizationDomain, hydrateOrganizationInvitation, hydrateOrganizationMembership, hydratePasskey, hydratePermission, hydratePhoneNumber, hydrateRedirectUrl, hydrateRole, hydrateSession, hydrateSmsTemplate, hydrateUser };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,5 @@
|
|
|
1
1
|
export { AuthnApiError, AuthnConfigError, AuthnHttpError, AuthnTokenInvalidError, AuthnWebhookSignatureInvalidError } from './errors.js';
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* Pagination + ordering parameters shared by every `list*` BAPI call.
|
|
5
|
-
* Resource-specific filter params extend this with their own fields.
|
|
6
|
-
*/
|
|
7
|
-
declare class ListParams {
|
|
8
|
-
limit?: number | undefined;
|
|
9
|
-
offset?: number | undefined;
|
|
10
|
-
orderBy?: string | undefined;
|
|
11
|
-
constructor(limit?: number | undefined, offset?: number | undefined, orderBy?: string | undefined);
|
|
12
|
-
toQuery(): Record<string, unknown>;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
3
|
interface TransportOptions {
|
|
16
4
|
/** API base URL — typically `https://api.authn.sh/v1`. Trailing `/v1` is required. */
|
|
17
5
|
apiUrl: string;
|
|
@@ -69,6 +57,71 @@ declare abstract class Manager {
|
|
|
69
57
|
constructor(transport: Transport);
|
|
70
58
|
}
|
|
71
59
|
|
|
60
|
+
interface AppearanceVariables {
|
|
61
|
+
colorPrimary?: string;
|
|
62
|
+
colorBackground?: string;
|
|
63
|
+
colorText?: string;
|
|
64
|
+
colorTextOnPrimary?: string;
|
|
65
|
+
colorInputBackground?: string;
|
|
66
|
+
colorInputText?: string;
|
|
67
|
+
colorDanger?: string;
|
|
68
|
+
colorSuccess?: string;
|
|
69
|
+
colorWarning?: string;
|
|
70
|
+
colorNeutral?: string;
|
|
71
|
+
fontFamily?: string;
|
|
72
|
+
fontFamilyButtons?: string;
|
|
73
|
+
fontSize?: string;
|
|
74
|
+
borderRadius?: string;
|
|
75
|
+
spacingUnit?: string;
|
|
76
|
+
[key: string]: string | undefined;
|
|
77
|
+
}
|
|
78
|
+
interface AppearanceLayout {
|
|
79
|
+
logoImageUrl?: string | null;
|
|
80
|
+
logoLinkUrl?: string | null;
|
|
81
|
+
socialButtonsPlacement?: 'top' | 'bottom';
|
|
82
|
+
socialButtonsVariant?: 'blockButton' | 'iconButton';
|
|
83
|
+
showOptionalFields?: boolean;
|
|
84
|
+
privacyPageUrl?: string | null;
|
|
85
|
+
termsPageUrl?: string | null;
|
|
86
|
+
helpPageUrl?: string | null;
|
|
87
|
+
animations?: boolean;
|
|
88
|
+
}
|
|
89
|
+
interface Appearance {
|
|
90
|
+
variables?: AppearanceVariables;
|
|
91
|
+
elements?: Record<string, string>;
|
|
92
|
+
layout?: AppearanceLayout;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* BAPI surface for the env-scoped `appearance` blob.
|
|
96
|
+
* Mirrors sdk-php's `AppearanceManager`:
|
|
97
|
+
*
|
|
98
|
+
* - `GET /v1/instance/appearance` — fetch the current blob.
|
|
99
|
+
* - `PUT /v1/instance/appearance` — replace wholesale.
|
|
100
|
+
* - `PATCH /v1/instance/appearance` — sparse merge.
|
|
101
|
+
*
|
|
102
|
+
* The SDK transmits camelCase keys; the server's snake/camel boundary
|
|
103
|
+
* is handled by the BAPI itself (the appearance schema is intentionally
|
|
104
|
+
* camelCase per OA-4).
|
|
105
|
+
*/
|
|
106
|
+
declare class AppearanceManager extends Manager {
|
|
107
|
+
get(): Promise<Appearance>;
|
|
108
|
+
put(blob: Appearance, idempotencyKey?: string): Promise<Appearance>;
|
|
109
|
+
patch(partial: Partial<Appearance>, idempotencyKey?: string): Promise<Appearance>;
|
|
110
|
+
}
|
|
111
|
+
declare function hydrateAppearance(raw: unknown): Appearance;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Pagination + ordering parameters shared by every `list*` BAPI call.
|
|
115
|
+
* Resource-specific filter params extend this with their own fields.
|
|
116
|
+
*/
|
|
117
|
+
declare class ListParams {
|
|
118
|
+
limit?: number | undefined;
|
|
119
|
+
offset?: number | undefined;
|
|
120
|
+
orderBy?: string | undefined;
|
|
121
|
+
constructor(limit?: number | undefined, offset?: number | undefined, orderBy?: string | undefined);
|
|
122
|
+
toQuery(): Record<string, unknown>;
|
|
123
|
+
}
|
|
124
|
+
|
|
72
125
|
/**
|
|
73
126
|
* Generic paginated-list envelope returned by every `list*` BAPI endpoint.
|
|
74
127
|
*/
|
|
@@ -180,6 +233,39 @@ declare class BlocklistIdentifiersManager extends Manager {
|
|
|
180
233
|
declare function hydrateAllowlistIdentifier(raw: unknown): AllowlistIdentifier;
|
|
181
234
|
declare function hydrateBlocklistIdentifier(raw: unknown): BlocklistIdentifier;
|
|
182
235
|
|
|
236
|
+
interface Localization {
|
|
237
|
+
default_locale: string;
|
|
238
|
+
fallback_locale: string;
|
|
239
|
+
supported_locales: string[];
|
|
240
|
+
/**
|
|
241
|
+
* Sparse per-locale overrides: `{ [locale]: { [dot.keyed.key]: 'translation' } }`.
|
|
242
|
+
* The SDK never stores the canonical defaults — those ship with
|
|
243
|
+
* `@authn-sh/sdk-react`. The server stores overrides only and rejects
|
|
244
|
+
* unknown canonical keys at save time.
|
|
245
|
+
*/
|
|
246
|
+
overrides: Record<string, Record<string, string>>;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* BAPI surface for the env-scoped `localization` blob.
|
|
250
|
+
* Mirrors sdk-php's `LocalizationManager`:
|
|
251
|
+
*
|
|
252
|
+
* - `GET /v1/instance/localization` — fetch the current blob.
|
|
253
|
+
* - `PUT /v1/instance/localization` — replace wholesale.
|
|
254
|
+
* - `PATCH /v1/instance/localization` — sparse merge per locale; setting a
|
|
255
|
+
* leaf key to `null` removes that single override.
|
|
256
|
+
*/
|
|
257
|
+
declare class LocalizationManager extends Manager {
|
|
258
|
+
get(): Promise<Localization>;
|
|
259
|
+
put(blob: Localization, idempotencyKey?: string): Promise<Localization>;
|
|
260
|
+
patch(partial: {
|
|
261
|
+
default_locale?: string;
|
|
262
|
+
fallback_locale?: string;
|
|
263
|
+
supported_locales?: string[];
|
|
264
|
+
overrides?: Record<string, Record<string, string | null>>;
|
|
265
|
+
}, idempotencyKey?: string): Promise<Localization>;
|
|
266
|
+
}
|
|
267
|
+
declare function hydrateLocalization(raw: unknown): Localization;
|
|
268
|
+
|
|
183
269
|
interface OauthProvider {
|
|
184
270
|
id: string;
|
|
185
271
|
object: 'oauth_provider';
|
|
@@ -330,6 +416,46 @@ declare function hydrateOrganizationMembership(raw: unknown): OrganizationMember
|
|
|
330
416
|
declare function hydrateOrganizationInvitation(raw: unknown): OrganizationInvitation;
|
|
331
417
|
declare function hydrateOrganizationDomain(raw: unknown): OrganizationDomain;
|
|
332
418
|
|
|
419
|
+
type PasskeyTransport = 'usb' | 'nfc' | 'ble' | 'internal' | 'hybrid';
|
|
420
|
+
interface Passkey {
|
|
421
|
+
id: string;
|
|
422
|
+
object: 'passkey';
|
|
423
|
+
userId: string;
|
|
424
|
+
nickname: string;
|
|
425
|
+
transports: PasskeyTransport[];
|
|
426
|
+
aaguid: string | null;
|
|
427
|
+
verified: boolean;
|
|
428
|
+
lastUsedAt: number | null;
|
|
429
|
+
createdAt: number;
|
|
430
|
+
updatedAt: number;
|
|
431
|
+
raw: Record<string, unknown>;
|
|
432
|
+
}
|
|
433
|
+
declare class PasskeysListParams extends ListParams {
|
|
434
|
+
userId?: string | undefined;
|
|
435
|
+
constructor(userId?: string | undefined, limit?: number, offset?: number, orderBy?: string);
|
|
436
|
+
toQuery(): Record<string, unknown>;
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* BAPI admin surface for passkeys. Mirrors sdk-php's `PasskeysManager`:
|
|
440
|
+
*
|
|
441
|
+
* - `GET /v1/passkeys` — list across the workspace (optionally filtered by `userId`).
|
|
442
|
+
* - `GET /v1/passkeys/{id}` — single passkey row.
|
|
443
|
+
* - `PATCH /v1/passkeys/{id}` — rename (`nickname` is the only mutable field).
|
|
444
|
+
* - `DELETE /v1/passkeys/{id}` — soft-remove.
|
|
445
|
+
*
|
|
446
|
+
* FAPI-side enrollment / authentication lives in `@authn-sh/sdk-js`.
|
|
447
|
+
* `@authn-sh/sdk-node` is admin-only.
|
|
448
|
+
*/
|
|
449
|
+
declare class PasskeysManager extends Manager {
|
|
450
|
+
list(params?: PasskeysListParams): Promise<PaginatedList<Passkey>>;
|
|
451
|
+
get(passkeyId: string): Promise<Passkey>;
|
|
452
|
+
update(passkeyId: string, data: {
|
|
453
|
+
nickname: string;
|
|
454
|
+
}, idempotencyKey?: string): Promise<Passkey>;
|
|
455
|
+
delete(passkeyId: string): Promise<void>;
|
|
456
|
+
}
|
|
457
|
+
declare function hydratePasskey(raw: unknown): Passkey;
|
|
458
|
+
|
|
333
459
|
interface PhoneNumber {
|
|
334
460
|
id: string;
|
|
335
461
|
object: 'phone_number';
|
|
@@ -560,6 +686,9 @@ declare class Authn {
|
|
|
560
686
|
readonly roles: RolesManager;
|
|
561
687
|
readonly permissions: PermissionsManager;
|
|
562
688
|
readonly instance: InstanceManager;
|
|
689
|
+
readonly passkeys: PasskeysManager;
|
|
690
|
+
readonly appearance: AppearanceManager;
|
|
691
|
+
readonly localization: LocalizationManager;
|
|
563
692
|
constructor(opts: AuthnOptions);
|
|
564
693
|
}
|
|
565
694
|
|
|
@@ -598,12 +727,33 @@ declare class VerifiedClaims {
|
|
|
598
727
|
readonly firstFactorAgeSeconds: number | null;
|
|
599
728
|
readonly phoneNumberVerified: boolean;
|
|
600
729
|
readonly defaultSecondFactor: 'totp' | 'phone_code' | 'backup_code' | null;
|
|
730
|
+
/**
|
|
731
|
+
* `true` when the session was completed via a passkey first-factor
|
|
732
|
+
* ceremony (AU-15 sets the `pkv` claim on the session JWT).
|
|
733
|
+
*/
|
|
734
|
+
readonly passkeyVerified: boolean;
|
|
735
|
+
/**
|
|
736
|
+
* Number of verified passkeys enrolled on the user at session
|
|
737
|
+
* creation time (AU-15 sets the `pkc` claim).
|
|
738
|
+
*/
|
|
739
|
+
readonly passkeyCount: number;
|
|
601
740
|
readonly raw: Record<string, unknown>;
|
|
602
|
-
constructor(sub: string, sid: string, iss: string, azp: string | null, exp: number, iat: number, nbf: number | null, actor: VerifiedActor | null, organization: VerifiedOrganization | null, wasTest: boolean, twoFactorVerified: boolean, secondFactorAgeSeconds: number | null, firstFactorAgeSeconds: number | null, phoneNumberVerified: boolean, defaultSecondFactor: 'totp' | 'phone_code' | 'backup_code' | null,
|
|
741
|
+
constructor(sub: string, sid: string, iss: string, azp: string | null, exp: number, iat: number, nbf: number | null, actor: VerifiedActor | null, organization: VerifiedOrganization | null, wasTest: boolean, twoFactorVerified: boolean, secondFactorAgeSeconds: number | null, firstFactorAgeSeconds: number | null, phoneNumberVerified: boolean, defaultSecondFactor: 'totp' | 'phone_code' | 'backup_code' | null,
|
|
742
|
+
/**
|
|
743
|
+
* `true` when the session was completed via a passkey first-factor
|
|
744
|
+
* ceremony (AU-15 sets the `pkv` claim on the session JWT).
|
|
745
|
+
*/
|
|
746
|
+
passkeyVerified: boolean,
|
|
747
|
+
/**
|
|
748
|
+
* Number of verified passkeys enrolled on the user at session
|
|
749
|
+
* creation time (AU-15 sets the `pkc` claim).
|
|
750
|
+
*/
|
|
751
|
+
passkeyCount: number, raw: Record<string, unknown>);
|
|
603
752
|
hasRole(roleKey: string): boolean;
|
|
604
753
|
hasPermission(permissionKey: string): boolean;
|
|
605
754
|
hasVerifiedPhoneNumber(): boolean;
|
|
606
755
|
preferredSecondFactor(): VerifiedClaims['defaultSecondFactor'];
|
|
756
|
+
hasVerifiedPasskey(): boolean;
|
|
607
757
|
}
|
|
608
758
|
/**
|
|
609
759
|
* Build a VerifiedClaims from a JWT claims-bag (post-signature-verify).
|
|
@@ -725,4 +875,4 @@ declare class WebhookSignatureVerifier {
|
|
|
725
875
|
private matchesAny;
|
|
726
876
|
}
|
|
727
877
|
|
|
728
|
-
export { type AllowlistIdentifier, AllowlistIdentifiersManager, Authn, type AuthnOptions, type BlocklistIdentifier, BlocklistIdentifiersManager, type ExternalAccount, ExternalAccountsListParams, ExternalAccountsManager, InstanceManager, type InstanceSettings, type Invitation, InvitationsListParams, InvitationsManager, ListParams, type OauthProvider, type OauthProviderTestResult, OauthProvidersManager, type Organization, type OrganizationDomain, OrganizationDomainsManager, type OrganizationInvitation, OrganizationInvitationsManager, type OrganizationMembership, OrganizationMembershipsManager, OrganizationsManager, type PaginatedList, type Permission, PermissionsManager, type PhoneNumber, PhoneNumbersListParams, PhoneNumbersManager, type RedirectUrl, RedirectUrlsManager, type RequestOptions, type Role, RolesManager, type Session, SessionsListParams, SessionsManager, type SmsTemplate, type SmsTemplateSlug, SmsTemplatesManager, TokenVerifier, type TokenVerifierOptions, type TotpVerificationResult, Transport, type TransportOptions, type User, UsersListParams, UsersManager, type VerifiedActor, VerifiedClaims, type VerifiedOrganization, type WebhookEvent, WebhookSignatureVerifier, type WebhookSignatureVerifierOptions, buildVerifiedClaims, decodeFrontendApiUrl, hydrateAllowlistIdentifier, hydrateBlocklistIdentifier, hydrateExternalAccount, hydrateInstance, hydrateInvitation, hydrateOauthProvider, hydrateOrganization, hydrateOrganizationDomain, hydrateOrganizationInvitation, hydrateOrganizationMembership, hydratePermission, hydratePhoneNumber, hydrateRedirectUrl, hydrateRole, hydrateSession, hydrateSmsTemplate, hydrateUser };
|
|
878
|
+
export { type AllowlistIdentifier, AllowlistIdentifiersManager, type Appearance, type AppearanceLayout, AppearanceManager, type AppearanceVariables, Authn, type AuthnOptions, type BlocklistIdentifier, BlocklistIdentifiersManager, type ExternalAccount, ExternalAccountsListParams, ExternalAccountsManager, InstanceManager, type InstanceSettings, type Invitation, InvitationsListParams, InvitationsManager, ListParams, type Localization, LocalizationManager, type OauthProvider, type OauthProviderTestResult, OauthProvidersManager, type Organization, type OrganizationDomain, OrganizationDomainsManager, type OrganizationInvitation, OrganizationInvitationsManager, type OrganizationMembership, OrganizationMembershipsManager, OrganizationsManager, type PaginatedList, type Passkey, type PasskeyTransport, PasskeysListParams, PasskeysManager, type Permission, PermissionsManager, type PhoneNumber, PhoneNumbersListParams, PhoneNumbersManager, type RedirectUrl, RedirectUrlsManager, type RequestOptions, type Role, RolesManager, type Session, SessionsListParams, SessionsManager, type SmsTemplate, type SmsTemplateSlug, SmsTemplatesManager, TokenVerifier, type TokenVerifierOptions, type TotpVerificationResult, Transport, type TransportOptions, type User, UsersListParams, UsersManager, type VerifiedActor, VerifiedClaims, type VerifiedOrganization, type WebhookEvent, WebhookSignatureVerifier, type WebhookSignatureVerifierOptions, buildVerifiedClaims, decodeFrontendApiUrl, hydrateAllowlistIdentifier, hydrateAppearance, hydrateBlocklistIdentifier, hydrateExternalAccount, hydrateInstance, hydrateInvitation, hydrateLocalization, hydrateOauthProvider, hydrateOrganization, hydrateOrganizationDomain, hydrateOrganizationInvitation, hydrateOrganizationMembership, hydratePasskey, hydratePermission, hydratePhoneNumber, hydrateRedirectUrl, hydrateRole, hydrateSession, hydrateSmsTemplate, hydrateUser };
|