@settlemint/dalp-sdk 3.1.33 → 3.2.0-rc.1

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.
Files changed (133) hide show
  1. package/LICENSE +3 -157
  2. package/README.md +276 -169
  3. package/dist/auth/client.d.ts +114 -0
  4. package/dist/auth/invite-step-up.d.ts +2 -0
  5. package/dist/auth/live.d.ts +47 -0
  6. package/dist/auth/native-passkey.d.ts +8 -0
  7. package/dist/{auth-permissions.d.ts → auth/permissions.d.ts} +0 -8
  8. package/dist/auth/wallet-plugins.d.ts +196 -0
  9. package/dist/auth-surface.d.ts +2 -0
  10. package/dist/auth.d.ts +8 -115
  11. package/dist/auth.js +540 -0
  12. package/dist/chunk-6hckdbwt.js +600 -0
  13. package/dist/chunk-7mvx7xq8.js +4 -0
  14. package/dist/chunk-b03ycwb7.js +68 -0
  15. package/dist/chunk-crtb9edj.js +29 -0
  16. package/dist/chunk-g5j1xky8.js +99 -0
  17. package/dist/chunk-grdfnbwd.js +1529 -0
  18. package/dist/chunk-j43gfc9p.js +5 -0
  19. package/dist/chunk-k3ntysxx.js +57 -0
  20. package/dist/chunk-ptwkww6j.js +38 -0
  21. package/dist/chunk-qncpzave.js +185 -0
  22. package/dist/chunk-t8v94nvb.js +5 -0
  23. package/dist/chunk-xnarraj7.js +339 -0
  24. package/dist/client/conditional-request.d.ts +8 -0
  25. package/dist/client/factory.d.ts +4 -0
  26. package/dist/client/query-serializer.d.ts +1 -0
  27. package/dist/client/request-compression.d.ts +12 -0
  28. package/dist/client/ssr-fetch.d.ts +10 -0
  29. package/dist/client/step-up-challenge.d.ts +10 -0
  30. package/dist/effect.d.ts +39 -0
  31. package/dist/effect.js +110 -0
  32. package/dist/errors/api-error.d.ts +35 -0
  33. package/dist/errors/error-codes.d.ts +18 -0
  34. package/dist/errors/find-current-error.d.ts +2 -0
  35. package/dist/errors/public-error.d.ts +3 -0
  36. package/dist/errors/public-error.js +9 -0
  37. package/dist/errors/sdk-error.d.ts +52 -0
  38. package/dist/errors/sdk-error.js +8 -0
  39. package/dist/generated/api-types.d.ts +104535 -0
  40. package/dist/generated/api-types.ts +111921 -0
  41. package/dist/generated/console-routes.d.ts +12 -0
  42. package/dist/generated/error-catalog.d.ts +9 -0
  43. package/dist/generated/error-codes.d.ts +9 -0
  44. package/dist/generated/response-scalars.d.ts +9 -0
  45. package/dist/generated/response-schemas.d.ts +9 -0
  46. package/dist/generated/route-error-codes.d.ts +9 -0
  47. package/dist/generated/routes.d.ts +12 -0
  48. package/dist/index.d.ts +28 -45
  49. package/dist/index.js +159 -94522
  50. package/dist/proxy/builder.d.ts +17 -0
  51. package/dist/proxy/client-core.d.ts +36 -0
  52. package/dist/proxy/client.d.ts +5 -0
  53. package/dist/proxy/fetch-executor.d.ts +7 -0
  54. package/dist/proxy/flat-args.d.ts +24 -0
  55. package/dist/proxy/response-decode.d.ts +38 -0
  56. package/dist/proxy/sse.d.ts +11 -0
  57. package/dist/proxy/step-up-challenge.d.ts +4 -0
  58. package/dist/proxy/tanstack.d.ts +6 -0
  59. package/dist/proxy/transport.d.ts +76 -0
  60. package/dist/react-query.d.ts +2 -0
  61. package/dist/react-query.js +14 -0
  62. package/dist/routes/cli-command.d.ts +17 -0
  63. package/dist/routes/console.d.ts +14 -0
  64. package/dist/routes/console.js +27 -0
  65. package/dist/routes/index.d.ts +6 -0
  66. package/dist/routes/index.js +122 -0
  67. package/dist/routes/types.d.ts +73 -0
  68. package/dist/runtime-exports.d.ts +4 -0
  69. package/dist/runtime-exports.js +38 -0
  70. package/dist/runtime.d.ts +8 -0
  71. package/dist/scalars/big-decimal.d.ts +22 -0
  72. package/dist/scalars/big-int.d.ts +3 -0
  73. package/dist/scalars/dalp-scalars.d.ts +28 -0
  74. package/dist/scalars/ethereum-address.d.ts +3 -0
  75. package/dist/scalars/exchange-rates.d.ts +13 -0
  76. package/dist/scalars/index.d.ts +14 -0
  77. package/dist/scalars/index.js +236 -0
  78. package/dist/scalars/organization-id.d.ts +5 -0
  79. package/dist/scalars/token-decimals.d.ts +4 -0
  80. package/dist/secret.d.ts +12 -0
  81. package/dist/server-proxy.d.ts +39 -0
  82. package/dist/server-proxy.js +186 -0
  83. package/dist/sign-webhook-receipt.d.ts +16 -0
  84. package/dist/sign-webhook-receipt.js +26 -0
  85. package/dist/transport/cookie-store.d.ts +9 -0
  86. package/dist/transport/sse-lifecycle.d.ts +24 -0
  87. package/dist/types.d.ts +38 -114
  88. package/dist/url.d.ts +0 -1
  89. package/dist/verify-webhook.d.ts +18 -28
  90. package/dist/verify-webhook.js +8 -0
  91. package/dist/version.d.ts +0 -3
  92. package/dist/wait-for-transaction.d.ts +46 -86
  93. package/dist/wait-for-transaction.js +154 -0
  94. package/dist/webhook-events.d.ts +1360 -35
  95. package/package.json +176 -36
  96. package/dist/api-types.generated.d.ts +0 -14160
  97. package/dist/api-types.generated.d.ts.map +0 -1
  98. package/dist/auth-permissions.d.ts.map +0 -1
  99. package/dist/auth-wallet-plugins.d.ts +0 -86
  100. package/dist/auth-wallet-plugins.d.ts.map +0 -1
  101. package/dist/auth.d.ts.map +0 -1
  102. package/dist/bundler.d.ts +0 -217
  103. package/dist/bundler.d.ts.map +0 -1
  104. package/dist/client.d.ts +0 -19
  105. package/dist/client.d.ts.map +0 -1
  106. package/dist/contract-errors.d.ts +0 -4156
  107. package/dist/contract-errors.d.ts.map +0 -1
  108. package/dist/contract.d.ts +0 -22
  109. package/dist/contract.d.ts.map +0 -1
  110. package/dist/cookie-store.d.ts +0 -10
  111. package/dist/cookie-store.d.ts.map +0 -1
  112. package/dist/dapi-errors.d.ts +0 -656
  113. package/dist/dapi-errors.d.ts.map +0 -1
  114. package/dist/errors.d.ts +0 -639
  115. package/dist/errors.d.ts.map +0 -1
  116. package/dist/index.d.ts.map +0 -1
  117. package/dist/platform.d.ts +0 -41
  118. package/dist/platform.d.ts.map +0 -1
  119. package/dist/plugins/index.d.ts +0 -13
  120. package/dist/plugins/index.d.ts.map +0 -1
  121. package/dist/plugins/index.js +0 -8
  122. package/dist/sdk-error.d.ts +0 -74
  123. package/dist/sdk-error.d.ts.map +0 -1
  124. package/dist/serializers.d.ts +0 -41
  125. package/dist/serializers.d.ts.map +0 -1
  126. package/dist/types.d.ts.map +0 -1
  127. package/dist/url.d.ts.map +0 -1
  128. package/dist/verify-webhook.d.ts.map +0 -1
  129. package/dist/version.d.ts.map +0 -1
  130. package/dist/version.generated.d.ts +0 -8
  131. package/dist/version.generated.d.ts.map +0 -1
  132. package/dist/wait-for-transaction.d.ts.map +0 -1
  133. package/dist/webhook-events.d.ts.map +0 -1
@@ -0,0 +1,114 @@
1
+ import type { DalpFetch } from "../client/ssr-fetch.ts";
2
+ import type { DalpAuthSurface } from "../auth-surface.ts";
3
+ import type { AuthGetApiKeyListResponse, AuthGetOrganizationListResponse, AuthPostApiKeyCreateData, AuthPostApiKeyCreateResponse, AuthPostApiKeyDeleteData, AuthPostApiKeyDeleteResponse, AuthPostOrganizationCreateData, AuthPostOrganizationCreateResponse, AuthPostRevokeOtherSessionsResponse, AuthPostRevokeSessionData, AuthPostRevokeSessionResponse, AuthPostTwoFactorDisableData, AuthPostTwoFactorDisableResponse, AuthPostTwoFactorEnableData, AuthPostTwoFactorEnableResponse, AuthPostTwoFactorVerifyBackupCodeData, AuthPostTwoFactorVerifyBackupCodeResponse, AuthPostTwoFactorVerifyTotpData, AuthPostTwoFactorVerifyTotpResponse, CreateOrganizationInvitationData, CreateOrganizationInvitationResponse, GetSessionResponse, ListUserSessionsResponse, Member, SetActiveOrganizationData, SetActiveOrganizationResponse } from "../generated/api-types.ts";
4
+ import { Secret } from "../secret.ts";
5
+ import type { CookieStoreShape } from "../transport/cookie-store.ts";
6
+ import type { DalpRuntime } from "../runtime.ts";
7
+ import type { DalpPasskeyCeremony } from "./native-passkey.ts";
8
+ export interface DalpAuthClientConfig {
9
+ readonly url: string;
10
+ readonly apiKey?: string;
11
+ readonly cookie?: string;
12
+ readonly cookieStore?: CookieStoreShape;
13
+ readonly authSurface?: DalpAuthSurface;
14
+ readonly headers?: Record<string, string>;
15
+ readonly fetch?: DalpFetch;
16
+ readonly runtime?: DalpRuntime;
17
+ readonly passkey?: DalpPasskeyCeremony;
18
+ }
19
+ export interface DecodedDalpAuthClientConfig extends Omit<DalpAuthClientConfig, "apiKey" | "cookie"> {
20
+ readonly apiKey?: Secret;
21
+ readonly cookie?: Secret;
22
+ }
23
+ export interface DalpAuthError {
24
+ readonly code?: string;
25
+ readonly message?: string;
26
+ readonly status?: number;
27
+ readonly statusText?: string;
28
+ readonly [key: string]: unknown;
29
+ }
30
+ export interface DalpAuthResult<TData = unknown, TError = DalpAuthError> {
31
+ readonly data: TData | null;
32
+ readonly error: TError | null;
33
+ }
34
+ export type DalpAuthOperation<TInput, TData = unknown> = (input?: TInput, options?: unknown) => Promise<DalpAuthResult<TData>>;
35
+ export type DalpRequiredAuthOperation<TInput, TData> = (input: TInput, options?: unknown) => Promise<DalpAuthResult<TData>>;
36
+ export type DalpNoInputAuthOperation<TData> = (options?: unknown) => Promise<DalpAuthResult<TData>>;
37
+ export type RequestBody<TData> = TData;
38
+ export type DalpTwoFactorSendOtpData = {
39
+ readonly trustDevice?: boolean;
40
+ readonly fetchOptions?: unknown;
41
+ };
42
+ export type DalpTwoFactorVerifyOtpData = {
43
+ readonly code: string;
44
+ readonly trustDevice?: boolean;
45
+ readonly fetchOptions?: unknown;
46
+ };
47
+ export interface DalpOrganizationMember extends Member {
48
+ readonly user: {
49
+ readonly id: string;
50
+ readonly email: string;
51
+ readonly name: string;
52
+ readonly image?: string;
53
+ };
54
+ }
55
+ export interface DalpOrganizationMembersQuery {
56
+ readonly limit?: string | number;
57
+ readonly offset?: string | number;
58
+ readonly sortBy?: string;
59
+ readonly sortDirection?: "asc" | "desc";
60
+ readonly filterField?: string;
61
+ readonly filterValue?: string | number | boolean | ReadonlyArray<string> | ReadonlyArray<number>;
62
+ readonly filterOperator?: "eq" | "ne" | "gt" | "gte" | "lt" | "lte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with";
63
+ readonly organizationId?: string;
64
+ readonly organizationSlug?: string;
65
+ }
66
+ export interface DalpOrganizationInvitation {
67
+ readonly id: string;
68
+ readonly organizationId: string;
69
+ readonly email: string;
70
+ readonly role?: string;
71
+ readonly status: string;
72
+ readonly expiresAt: string | Date;
73
+ }
74
+ export interface DalpOrganizationInvitationsQuery {
75
+ readonly organizationId?: string;
76
+ }
77
+ export interface DalpCliAuthClient {
78
+ readonly getSession: DalpNoInputAuthOperation<GetSessionResponse>;
79
+ readonly listSessions: DalpNoInputAuthOperation<ListUserSessionsResponse>;
80
+ readonly revokeSession: DalpRequiredAuthOperation<RequestBody<AuthPostRevokeSessionData>, AuthPostRevokeSessionResponse>;
81
+ readonly revokeOtherSessions: DalpNoInputAuthOperation<AuthPostRevokeOtherSessionsResponse>;
82
+ readonly apiKey: {
83
+ readonly list: DalpNoInputAuthOperation<AuthGetApiKeyListResponse>;
84
+ readonly create: DalpRequiredAuthOperation<RequestBody<AuthPostApiKeyCreateData>, AuthPostApiKeyCreateResponse>;
85
+ readonly delete: DalpRequiredAuthOperation<RequestBody<AuthPostApiKeyDeleteData>, AuthPostApiKeyDeleteResponse>;
86
+ };
87
+ readonly organization: {
88
+ readonly list: DalpNoInputAuthOperation<AuthGetOrganizationListResponse>;
89
+ readonly setActive: DalpRequiredAuthOperation<RequestBody<SetActiveOrganizationData>, SetActiveOrganizationResponse>;
90
+ readonly create: DalpRequiredAuthOperation<RequestBody<AuthPostOrganizationCreateData>, AuthPostOrganizationCreateResponse>;
91
+ readonly inviteMember: DalpRequiredAuthOperation<RequestBody<CreateOrganizationInvitationData>, CreateOrganizationInvitationResponse>;
92
+ readonly listMembers: DalpRequiredAuthOperation<{
93
+ readonly query?: DalpOrganizationMembersQuery;
94
+ }, {
95
+ readonly members: ReadonlyArray<DalpOrganizationMember>;
96
+ readonly total: number;
97
+ }>;
98
+ readonly listInvitations: DalpAuthOperation<{
99
+ readonly query?: DalpOrganizationInvitationsQuery;
100
+ }, ReadonlyArray<DalpOrganizationInvitation>>;
101
+ readonly listUserInvitations: DalpNoInputAuthOperation<ReadonlyArray<DalpOrganizationInvitation>>;
102
+ };
103
+ readonly twoFactor: {
104
+ readonly enable: DalpRequiredAuthOperation<RequestBody<AuthPostTwoFactorEnableData>, AuthPostTwoFactorEnableResponse>;
105
+ readonly disable: DalpRequiredAuthOperation<RequestBody<AuthPostTwoFactorDisableData>, AuthPostTwoFactorDisableResponse>;
106
+ readonly verifyTotp: DalpRequiredAuthOperation<RequestBody<AuthPostTwoFactorVerifyTotpData>, AuthPostTwoFactorVerifyTotpResponse>;
107
+ readonly verifyBackupCode: DalpRequiredAuthOperation<RequestBody<AuthPostTwoFactorVerifyBackupCodeData>, AuthPostTwoFactorVerifyBackupCodeResponse>;
108
+ readonly sendOtp: DalpRequiredAuthOperation<DalpTwoFactorSendOtpData, {
109
+ readonly status: boolean;
110
+ }>;
111
+ readonly verifyOtp: DalpRequiredAuthOperation<DalpTwoFactorVerifyOtpData, unknown>;
112
+ };
113
+ }
114
+ export declare function decodeDalpAuthClientConfig(input: DalpAuthClientConfig): Promise<DecodedDalpAuthClientConfig>;
@@ -0,0 +1,2 @@
1
+ import type { CookieStoreFetch } from "../transport/cookie-store.ts";
2
+ export declare function withInviteStepUp(fetchImpl: CookieStoreFetch, baseUrl: string): CookieStoreFetch;
@@ -0,0 +1,47 @@
1
+ import { apiKeyClient } from "@better-auth/api-key/client";
2
+ import { passkeyClient } from "@better-auth/passkey/client";
3
+ import { type AuthClient, type BetterAuthClientOptions } from "better-auth/client";
4
+ import { adminClient, customSessionClient, deviceAuthorizationClient, inferAdditionalFields, organizationClient, twoFactorClient } from "better-auth/client/plugins";
5
+ import { type DalpAuthClientConfig, type DalpCliAuthClient } from "./client.ts";
6
+ import { type DalpWalletAuthClient, walletPincodeClient, walletSecretCodesClient, walletTwoFactorClient } from "./wallet-plugins.ts";
7
+ declare const adminPluginOptions: {
8
+ ac: import("better-auth/plugins").AccessControl;
9
+ roles: {
10
+ admin: import("better-auth/plugins").Role;
11
+ owner: import("better-auth/plugins").Role;
12
+ member: import("better-auth/plugins").Role;
13
+ };
14
+ };
15
+ declare const organizationPluginOptions: {
16
+ ac: import("better-auth/plugins").AccessControl;
17
+ roles: {
18
+ owner: import("better-auth/plugins").Role;
19
+ member: import("better-auth/plugins").Role;
20
+ };
21
+ };
22
+ type ConfiguredBetterAuthPluginTuple = [
23
+ ReturnType<typeof customSessionClient>,
24
+ ReturnType<typeof inferAdditionalFields>,
25
+ ReturnType<typeof adminClient<typeof adminPluginOptions>>,
26
+ ReturnType<typeof apiKeyClient>,
27
+ ReturnType<typeof passkeyClient>,
28
+ ReturnType<typeof walletPincodeClient>,
29
+ ReturnType<typeof walletTwoFactorClient>,
30
+ ReturnType<typeof walletSecretCodesClient>,
31
+ ReturnType<typeof twoFactorClient>,
32
+ ReturnType<typeof deviceAuthorizationClient>,
33
+ ReturnType<typeof organizationClient<typeof organizationPluginOptions>>
34
+ ];
35
+ type ConfiguredBetterAuthClientOptions = Omit<BetterAuthClientOptions, "plugins"> & {
36
+ plugins: ConfiguredBetterAuthPluginTuple;
37
+ };
38
+ export type InferredBetterAuthClient = AuthClient<ConfiguredBetterAuthClientOptions>;
39
+ type UnservedAuthClientMembers = "deleteUser" | "revokeSessions" | "sendVerificationEmail";
40
+ interface DalpDeviceAuthClient {
41
+ readonly device: Omit<InferredBetterAuthClient["device"], "approve" | "deny">;
42
+ readonly passkey: Omit<InferredBetterAuthClient["passkey"], "updatePasskey">;
43
+ }
44
+ export type DalpAuthClient = Omit<InferredBetterAuthClient, keyof DalpCliAuthClient | keyof DalpWalletAuthClient | keyof DalpDeviceAuthClient | UnservedAuthClientMembers> & DalpDeviceAuthClient & DalpCliAuthClient & DalpWalletAuthClient;
45
+ export declare function createDalpAuthClient(input: DalpAuthClientConfig): Promise<DalpAuthClient>;
46
+ export declare const makeDalpAuthClient: typeof createDalpAuthClient;
47
+ export {};
@@ -0,0 +1,8 @@
1
+ import { passkeyClient, type AuthenticationResponseJSON, type PublicKeyCredentialCreationOptionsJSON, type PublicKeyCredentialRequestOptionsJSON, type RegistrationResponseJSON } from "@better-auth/passkey/client";
2
+ export interface DalpPasskeyCeremony {
3
+ readonly authenticate: (options: PublicKeyCredentialRequestOptionsJSON) => Promise<AuthenticationResponseJSON>;
4
+ readonly register: (options: PublicKeyCredentialCreationOptionsJSON) => Promise<RegistrationResponseJSON>;
5
+ }
6
+ type PasskeyClientPlugin = ReturnType<typeof passkeyClient>;
7
+ export declare function ceremonyPasskeyClient(ceremony: DalpPasskeyCeremony): PasskeyClientPlugin;
8
+ export {};
@@ -1,13 +1,5 @@
1
- /**
2
- * Client-side Better Auth access-control metadata for DALP auth clients.
3
- *
4
- * Related: packages/dalp/auth/src/utils/permissions.ts, kit/sdk/src/auth.ts
5
- *
6
- * @module
7
- */
8
1
  import { type AccessControl, type Role } from "better-auth/plugins/access";
9
2
  export declare const accessControl: AccessControl;
10
3
  export declare const adminRole: Role;
11
4
  export declare const ownerRole: Role;
12
5
  export declare const memberRole: Role;
13
- //# sourceMappingURL=auth-permissions.d.ts.map
@@ -0,0 +1,196 @@
1
+ import type { DalpAuthResult } from "./client.ts";
2
+ export type WalletAuthOperation<TInput, TData> = (input: TInput, options?: unknown) => Promise<DalpAuthResult<TData>>;
3
+ export type WalletStepUpMethod = "PINCODE" | "OTP" | "SECRET_CODES" | "OIDC_MFA";
4
+ export interface WalletStepUpVerification {
5
+ readonly secretVerificationCode: string;
6
+ readonly verificationType?: WalletStepUpMethod;
7
+ }
8
+ export interface WalletStepUp {
9
+ readonly walletVerification?: WalletStepUpVerification;
10
+ }
11
+ export interface WalletStepUpRequired {
12
+ readonly walletVerification: WalletStepUpVerification;
13
+ }
14
+ export interface DalpWalletAuthClient {
15
+ readonly wallet: {
16
+ readonly pincode: {
17
+ readonly enable: WalletAuthOperation<WalletStepUp & {
18
+ readonly pincode: string;
19
+ }, {
20
+ readonly success: boolean;
21
+ }>;
22
+ readonly update: WalletAuthOperation<WalletStepUpRequired & {
23
+ readonly newPincode: string;
24
+ }, {
25
+ readonly success: boolean;
26
+ }>;
27
+ readonly disable: WalletAuthOperation<WalletStepUpRequired, {
28
+ readonly success: boolean;
29
+ }>;
30
+ readonly recover: WalletAuthOperation<{
31
+ readonly newPincode: string;
32
+ }, {
33
+ readonly success: boolean;
34
+ }>;
35
+ readonly reset: WalletAuthOperation<{
36
+ readonly newPincode: string;
37
+ readonly recoveryCode: string;
38
+ }, {
39
+ readonly success: boolean;
40
+ readonly recoveryCodes?: ReadonlyArray<string>;
41
+ }>;
42
+ };
43
+ readonly twoFactor: {
44
+ readonly enable: WalletAuthOperation<WalletStepUp & {
45
+ readonly issuer?: string;
46
+ }, {
47
+ readonly totpURI: string;
48
+ }>;
49
+ readonly verify: WalletAuthOperation<{
50
+ readonly code: string;
51
+ }, {
52
+ readonly status: boolean;
53
+ }>;
54
+ readonly disable: WalletAuthOperation<WalletStepUpRequired, {
55
+ readonly status: boolean;
56
+ }>;
57
+ };
58
+ readonly secretCodes: {
59
+ readonly generate: WalletAuthOperation<WalletStepUp, {
60
+ readonly rotated: boolean;
61
+ readonly secretCodes: ReadonlyArray<string>;
62
+ readonly verificationId: string;
63
+ }>;
64
+ readonly confirm: WalletAuthOperation<{
65
+ readonly stored: boolean;
66
+ readonly verificationId: string;
67
+ }, {
68
+ readonly success: boolean;
69
+ }>;
70
+ };
71
+ };
72
+ }
73
+ export declare const walletPincodeClient: () => {
74
+ id: "wallet-pincode";
75
+ $InferServerPlugin: {
76
+ id: "wallet-pincode";
77
+ $ERROR_CODES: {
78
+ WALLET_CREDENTIAL_LOCKED: import("better-auth").RawError<"WALLET_CREDENTIAL_LOCKED">;
79
+ WALLET_LAST_SIGNING_FACTOR: import("better-auth").RawError<"WALLET_LAST_SIGNING_FACTOR">;
80
+ WALLET_PINCODE_ALREADY_REMOVED: import("better-auth").RawError<"WALLET_PINCODE_ALREADY_REMOVED">;
81
+ WALLET_PINCODE_ALREADY_SET: import("better-auth").RawError<"WALLET_PINCODE_ALREADY_SET">;
82
+ WALLET_PINCODE_FRESH_SSO_REQUIRED: import("better-auth").RawError<"WALLET_PINCODE_FRESH_SSO_REQUIRED">;
83
+ WALLET_PINCODE_INVALID_RECOVERY_CODE: import("better-auth").RawError<"WALLET_PINCODE_INVALID_RECOVERY_CODE">;
84
+ WALLET_PINCODE_NO_RECOVERY_CODES_REMAINING: import("better-auth").RawError<"WALLET_PINCODE_NO_RECOVERY_CODES_REMAINING">;
85
+ WALLET_PINCODE_PASSWORD_REQUIRED: import("better-auth").RawError<"WALLET_PINCODE_PASSWORD_REQUIRED">;
86
+ WALLET_PINCODE_RECOVERY_NOT_CONFIGURED: import("better-auth").RawError<"WALLET_PINCODE_RECOVERY_NOT_CONFIGURED">;
87
+ WALLET_VERIFICATION_FACTOR_UNAVAILABLE: import("better-auth").RawError<"WALLET_VERIFICATION_FACTOR_UNAVAILABLE">;
88
+ WALLET_VERIFICATION_INVALID_CODE: import("better-auth").RawError<"WALLET_VERIFICATION_INVALID_CODE">;
89
+ WALLET_VERIFICATION_NOT_CONFIGURED: import("better-auth").RawError<"WALLET_VERIFICATION_NOT_CONFIGURED">;
90
+ WALLET_VERIFICATION_UNAVAILABLE: import("better-auth").RawError<"WALLET_VERIFICATION_UNAVAILABLE">;
91
+ };
92
+ endpoints: {};
93
+ };
94
+ $ERROR_CODES: {
95
+ WALLET_CREDENTIAL_LOCKED: import("better-auth").RawError<"WALLET_CREDENTIAL_LOCKED">;
96
+ WALLET_LAST_SIGNING_FACTOR: import("better-auth").RawError<"WALLET_LAST_SIGNING_FACTOR">;
97
+ WALLET_PINCODE_ALREADY_REMOVED: import("better-auth").RawError<"WALLET_PINCODE_ALREADY_REMOVED">;
98
+ WALLET_PINCODE_ALREADY_SET: import("better-auth").RawError<"WALLET_PINCODE_ALREADY_SET">;
99
+ WALLET_PINCODE_FRESH_SSO_REQUIRED: import("better-auth").RawError<"WALLET_PINCODE_FRESH_SSO_REQUIRED">;
100
+ WALLET_PINCODE_INVALID_RECOVERY_CODE: import("better-auth").RawError<"WALLET_PINCODE_INVALID_RECOVERY_CODE">;
101
+ WALLET_PINCODE_NO_RECOVERY_CODES_REMAINING: import("better-auth").RawError<"WALLET_PINCODE_NO_RECOVERY_CODES_REMAINING">;
102
+ WALLET_PINCODE_PASSWORD_REQUIRED: import("better-auth").RawError<"WALLET_PINCODE_PASSWORD_REQUIRED">;
103
+ WALLET_PINCODE_RECOVERY_NOT_CONFIGURED: import("better-auth").RawError<"WALLET_PINCODE_RECOVERY_NOT_CONFIGURED">;
104
+ WALLET_VERIFICATION_FACTOR_UNAVAILABLE: import("better-auth").RawError<"WALLET_VERIFICATION_FACTOR_UNAVAILABLE">;
105
+ WALLET_VERIFICATION_INVALID_CODE: import("better-auth").RawError<"WALLET_VERIFICATION_INVALID_CODE">;
106
+ WALLET_VERIFICATION_NOT_CONFIGURED: import("better-auth").RawError<"WALLET_VERIFICATION_NOT_CONFIGURED">;
107
+ WALLET_VERIFICATION_UNAVAILABLE: import("better-auth").RawError<"WALLET_VERIFICATION_UNAVAILABLE">;
108
+ };
109
+ pathMethods: {
110
+ "/wallet/pincode/enable": "POST";
111
+ "/wallet/pincode/disable": "POST";
112
+ "/wallet/pincode/update": "POST";
113
+ "/wallet/pincode/recover": "POST";
114
+ "/wallet/pincode/reset": "POST";
115
+ };
116
+ atomListeners: {
117
+ matcher: (path: string) => boolean;
118
+ signal: "$sessionSignal";
119
+ }[];
120
+ };
121
+ export declare const walletTwoFactorClient: () => {
122
+ id: "wallet-two-factor";
123
+ $InferServerPlugin: {
124
+ id: "wallet-two-factor";
125
+ $ERROR_CODES: {
126
+ WALLET_CREDENTIAL_LOCKED: import("better-auth").RawError<"WALLET_CREDENTIAL_LOCKED">;
127
+ WALLET_LAST_SIGNING_FACTOR: import("better-auth").RawError<"WALLET_LAST_SIGNING_FACTOR">;
128
+ WALLET_TWO_FACTOR_AUTHENTICATOR_PROOF_REQUIRED: import("better-auth").RawError<"WALLET_TWO_FACTOR_AUTHENTICATOR_PROOF_REQUIRED">;
129
+ WALLET_TWO_FACTOR_INVALID_CODE: import("better-auth").RawError<"WALLET_TWO_FACTOR_INVALID_CODE">;
130
+ WALLET_TWO_FACTOR_PASSWORD_REQUIRED: import("better-auth").RawError<"WALLET_TWO_FACTOR_PASSWORD_REQUIRED">;
131
+ WALLET_VERIFICATION_FACTOR_UNAVAILABLE: import("better-auth").RawError<"WALLET_VERIFICATION_FACTOR_UNAVAILABLE">;
132
+ WALLET_VERIFICATION_INVALID_CODE: import("better-auth").RawError<"WALLET_VERIFICATION_INVALID_CODE">;
133
+ WALLET_VERIFICATION_NOT_CONFIGURED: import("better-auth").RawError<"WALLET_VERIFICATION_NOT_CONFIGURED">;
134
+ WALLET_VERIFICATION_UNAVAILABLE: import("better-auth").RawError<"WALLET_VERIFICATION_UNAVAILABLE">;
135
+ };
136
+ endpoints: {};
137
+ };
138
+ $ERROR_CODES: {
139
+ WALLET_CREDENTIAL_LOCKED: import("better-auth").RawError<"WALLET_CREDENTIAL_LOCKED">;
140
+ WALLET_LAST_SIGNING_FACTOR: import("better-auth").RawError<"WALLET_LAST_SIGNING_FACTOR">;
141
+ WALLET_TWO_FACTOR_AUTHENTICATOR_PROOF_REQUIRED: import("better-auth").RawError<"WALLET_TWO_FACTOR_AUTHENTICATOR_PROOF_REQUIRED">;
142
+ WALLET_TWO_FACTOR_INVALID_CODE: import("better-auth").RawError<"WALLET_TWO_FACTOR_INVALID_CODE">;
143
+ WALLET_TWO_FACTOR_PASSWORD_REQUIRED: import("better-auth").RawError<"WALLET_TWO_FACTOR_PASSWORD_REQUIRED">;
144
+ WALLET_VERIFICATION_FACTOR_UNAVAILABLE: import("better-auth").RawError<"WALLET_VERIFICATION_FACTOR_UNAVAILABLE">;
145
+ WALLET_VERIFICATION_INVALID_CODE: import("better-auth").RawError<"WALLET_VERIFICATION_INVALID_CODE">;
146
+ WALLET_VERIFICATION_NOT_CONFIGURED: import("better-auth").RawError<"WALLET_VERIFICATION_NOT_CONFIGURED">;
147
+ WALLET_VERIFICATION_UNAVAILABLE: import("better-auth").RawError<"WALLET_VERIFICATION_UNAVAILABLE">;
148
+ };
149
+ pathMethods: {
150
+ "/wallet/two-factor/enable": "POST";
151
+ "/wallet/two-factor/disable": "POST";
152
+ "/wallet/two-factor/verify": "POST";
153
+ };
154
+ atomListeners: {
155
+ matcher: (path: string) => boolean;
156
+ signal: "$sessionSignal";
157
+ }[];
158
+ };
159
+ export declare const walletSecretCodesClient: () => {
160
+ id: "wallet-secret-codes";
161
+ $InferServerPlugin: {
162
+ id: "wallet-secret-codes";
163
+ $ERROR_CODES: {
164
+ WALLET_CREDENTIAL_LOCKED: import("better-auth").RawError<"WALLET_CREDENTIAL_LOCKED">;
165
+ WALLET_SECRET_CODES_AUTHENTICATOR_PROOF_REQUIRED: import("better-auth").RawError<"WALLET_SECRET_CODES_AUTHENTICATOR_PROOF_REQUIRED">;
166
+ WALLET_SECRET_CODES_PIN_PROOF_REQUIRED: import("better-auth").RawError<"WALLET_SECRET_CODES_PIN_PROOF_REQUIRED">;
167
+ WALLET_SECRET_CODES_VERIFICATION_MISMATCH: import("better-auth").RawError<"WALLET_SECRET_CODES_VERIFICATION_MISMATCH">;
168
+ WALLET_VERIFICATION_FACTOR_UNAVAILABLE: import("better-auth").RawError<"WALLET_VERIFICATION_FACTOR_UNAVAILABLE">;
169
+ WALLET_VERIFICATION_INVALID_CODE: import("better-auth").RawError<"WALLET_VERIFICATION_INVALID_CODE">;
170
+ WALLET_VERIFICATION_NOT_CONFIGURED: import("better-auth").RawError<"WALLET_VERIFICATION_NOT_CONFIGURED">;
171
+ WALLET_VERIFICATION_UNAVAILABLE: import("better-auth").RawError<"WALLET_VERIFICATION_UNAVAILABLE">;
172
+ };
173
+ endpoints: {};
174
+ };
175
+ $ERROR_CODES: {
176
+ WALLET_CREDENTIAL_LOCKED: import("better-auth").RawError<"WALLET_CREDENTIAL_LOCKED">;
177
+ WALLET_SECRET_CODES_AUTHENTICATOR_PROOF_REQUIRED: import("better-auth").RawError<"WALLET_SECRET_CODES_AUTHENTICATOR_PROOF_REQUIRED">;
178
+ WALLET_SECRET_CODES_PIN_PROOF_REQUIRED: import("better-auth").RawError<"WALLET_SECRET_CODES_PIN_PROOF_REQUIRED">;
179
+ WALLET_SECRET_CODES_VERIFICATION_MISMATCH: import("better-auth").RawError<"WALLET_SECRET_CODES_VERIFICATION_MISMATCH">;
180
+ WALLET_VERIFICATION_FACTOR_UNAVAILABLE: import("better-auth").RawError<"WALLET_VERIFICATION_FACTOR_UNAVAILABLE">;
181
+ WALLET_VERIFICATION_INVALID_CODE: import("better-auth").RawError<"WALLET_VERIFICATION_INVALID_CODE">;
182
+ WALLET_VERIFICATION_NOT_CONFIGURED: import("better-auth").RawError<"WALLET_VERIFICATION_NOT_CONFIGURED">;
183
+ WALLET_VERIFICATION_UNAVAILABLE: import("better-auth").RawError<"WALLET_VERIFICATION_UNAVAILABLE">;
184
+ };
185
+ pathMethods: {
186
+ "/wallet/secret-codes/generate": "POST";
187
+ "/wallet/secret-codes/confirm": "POST";
188
+ };
189
+ atomListeners: {
190
+ matcher: (path: string) => boolean;
191
+ signal: "$sessionSignal";
192
+ }[];
193
+ };
194
+ export type StripLeadingSlash<T extends string> = T extends `/${infer Rest}` ? Rest : never;
195
+ export type WalletPluginPathMethodKeys = keyof ReturnType<typeof walletPincodeClient>["pathMethods"] | keyof ReturnType<typeof walletTwoFactorClient>["pathMethods"] | keyof ReturnType<typeof walletSecretCodesClient>["pathMethods"];
196
+ export type WalletAuthEndpointPath = StripLeadingSlash<WalletPluginPathMethodKeys>;
@@ -0,0 +1,2 @@
1
+ export type DalpAuthSurface = "console" | "portal";
2
+ export declare const DALP_AUTH_SURFACE_HEADER = "X-Dalp-Auth-Surface";
package/dist/auth.d.ts CHANGED
@@ -1,115 +1,8 @@
1
- import { DalpCookieStore } from "./cookie-store.js";
2
- export interface DalpAuthClientConfig {
3
- /** Base URL of the DALP API (e.g., `"https://dalp.example.com"`). */
4
- url: string;
5
- /** API key used for Better Auth API-key-authenticated operations. */
6
- apiKey?: string;
7
- /** Better Auth session token sent as an Authorization bearer token. */
8
- sessionToken?: string;
9
- /** Cookie header value for explicit Node/browser-session handoff. */
10
- cookie?: string;
11
- /** Cookie store for Node-side session persistence across Better Auth calls. */
12
- cookieStore?: DalpCookieStore;
13
- /**
14
- * Organization ID for multi-tenant setups.
15
- * Sent as `x-organization-id` when provided.
16
- */
17
- organizationId?: string;
18
- /**
19
- * Additional headers merged into every Better Auth request.
20
- * Can override defaults like `User-Agent` but cannot override configured security headers.
21
- */
22
- headers?: Record<string, string>;
23
- /**
24
- * Custom `fetch` implementation.
25
- * Use this to inject logging, proxy configuration, or test doubles.
26
- */
27
- fetch?: typeof globalThis.fetch;
28
- }
29
- export interface DalpAuthError {
30
- code?: string;
31
- message?: string;
32
- status?: number;
33
- statusText?: string;
34
- [key: string]: unknown;
35
- }
36
- export interface DalpAuthResult<TData = unknown, TError = DalpAuthError> {
37
- data: TData | null;
38
- error: TError | null;
39
- }
40
- export type DalpAuthOperation<TInput = Record<string, unknown>, TData = unknown> = (input?: TInput, options?: unknown) => Promise<DalpAuthResult<TData>>;
41
- export interface DalpAuthClient {
42
- signIn: Record<string, DalpAuthOperation> & {
43
- email: DalpAuthOperation;
44
- };
45
- signUp: Record<string, DalpAuthOperation> & {
46
- email: DalpAuthOperation;
47
- };
48
- getSession: DalpAuthOperation;
49
- listSessions: DalpAuthOperation;
50
- revokeSession: DalpAuthOperation;
51
- revokeOtherSessions: DalpAuthOperation;
52
- apiKey: Record<string, DalpAuthOperation> & {
53
- create: DalpAuthOperation;
54
- list: DalpAuthOperation;
55
- delete: DalpAuthOperation;
56
- };
57
- organization: Record<string, DalpAuthOperation> & {
58
- create: DalpAuthOperation;
59
- list: DalpAuthOperation;
60
- setActive: DalpAuthOperation;
61
- inviteMember: DalpAuthOperation;
62
- acceptInvitation: DalpAuthOperation;
63
- listMembers: DalpAuthOperation;
64
- addMember: DalpAuthOperation;
65
- removeMember: DalpAuthOperation;
66
- };
67
- admin: Record<string, DalpAuthOperation> & {
68
- listUsers: DalpAuthOperation;
69
- createUser: DalpAuthOperation;
70
- removeUser: DalpAuthOperation;
71
- setRole: DalpAuthOperation;
72
- };
73
- device: Record<string, DalpAuthOperation> & {
74
- code: DalpAuthOperation;
75
- token: DalpAuthOperation;
76
- approve: DalpAuthOperation;
77
- deny: DalpAuthOperation;
78
- };
79
- passkey: Record<string, DalpAuthOperation>;
80
- twoFactor: Record<string, DalpAuthOperation> & {
81
- enable: DalpAuthOperation;
82
- disable: DalpAuthOperation;
83
- verifyTotp: DalpAuthOperation;
84
- verifyBackupCode: DalpAuthOperation;
85
- generateBackupCodes: DalpAuthOperation;
86
- };
87
- wallet: {
88
- pincode: {
89
- enable: DalpAuthOperation;
90
- disable: DalpAuthOperation;
91
- update: DalpAuthOperation;
92
- reset: DalpAuthOperation;
93
- };
94
- twoFactor: {
95
- enable: DalpAuthOperation;
96
- disable: DalpAuthOperation;
97
- verify: DalpAuthOperation;
98
- };
99
- secretCodes: {
100
- generate: DalpAuthOperation;
101
- confirm: DalpAuthOperation;
102
- };
103
- passkey: {
104
- register: DalpAuthOperation;
105
- complete: DalpAuthOperation;
106
- disable: DalpAuthOperation;
107
- challenge: DalpAuthOperation;
108
- verify: DalpAuthOperation;
109
- };
110
- };
111
- $fetch: (path: string, options?: Record<string, unknown>) => Promise<unknown>;
112
- $ERROR_CODES: Record<string, unknown>;
113
- }
114
- export declare function createDalpAuthClient(config: DalpAuthClientConfig): DalpAuthClient;
115
- //# sourceMappingURL=auth.d.ts.map
1
+ export { createDalpAuthClient, makeDalpAuthClient } from "./auth/live.ts";
2
+ export type { DalpAuthClient } from "./auth/live.ts";
3
+ export { decodeDalpAuthClientConfig } from "./auth/client.ts";
4
+ export type { DalpAuthSurface } from "./auth-surface.ts";
5
+ export type { DalpAuthClientConfig, DalpCliAuthClient, DalpAuthError, DalpAuthOperation, DalpAuthResult, DalpOrganizationInvitation, DalpOrganizationInvitationsQuery, DalpOrganizationMember, DalpOrganizationMembersQuery, DecodedDalpAuthClientConfig, } from "./auth/client.ts";
6
+ export type { DalpPasskeyCeremony } from "./auth/native-passkey.ts";
7
+ export type { DalpRuntime } from "./runtime.ts";
8
+ export type { WalletAuthEndpointPath } from "./auth/wallet-plugins.ts";