@settlemint/dalp-sdk 3.1.5-main.32670705612 → 3.1.5-release.32679963579
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/README.md +177 -111
- package/dist/{auth/permissions.d.ts → auth-permissions.d.ts} +2 -1
- package/dist/auth-permissions.d.ts.map +1 -0
- package/dist/{auth/wallet-plugins.d.ts → auth-wallet-plugins.d.ts} +5 -69
- package/dist/auth-wallet-plugins.d.ts.map +1 -0
- package/dist/auth.d.ts +115 -22
- package/dist/auth.d.ts.map +1 -0
- package/dist/bundler.d.ts +207 -17
- package/dist/bundler.d.ts.map +1 -0
- package/dist/chunk-xm8h1dzh.js +33 -0
- package/dist/client.d.ts +19 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/contract-errors.d.ts +4156 -0
- package/dist/contract-errors.d.ts.map +1 -0
- package/dist/contract.d.ts +17 -0
- package/dist/contract.d.ts.map +1 -0
- package/dist/cookie-store.d.ts +10 -0
- package/dist/cookie-store.d.ts.map +1 -0
- package/dist/dapi-errors.d.ts +650 -0
- package/dist/dapi-errors.d.ts.map +1 -0
- package/dist/errors.d.ts +633 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/index.d.ts +40 -23
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +96013 -208
- package/dist/platform.d.ts +41 -0
- package/dist/platform.d.ts.map +1 -0
- package/dist/plugins/index.d.ts +13 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +10 -0
- package/dist/sdk-error.d.ts +74 -0
- package/dist/sdk-error.d.ts.map +1 -0
- package/dist/serializers.d.ts +41 -0
- package/dist/serializers.d.ts.map +1 -0
- package/dist/types.d.ts +104 -57
- package/dist/types.d.ts.map +1 -0
- package/dist/url.d.ts +1 -0
- package/dist/url.d.ts.map +1 -0
- package/dist/verify-webhook.d.ts +28 -17
- package/dist/verify-webhook.d.ts.map +1 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/wait-for-transaction.d.ts +86 -37
- package/dist/wait-for-transaction.d.ts.map +1 -0
- package/dist/webhook-events.d.ts +26 -43
- package/dist/webhook-events.d.ts.map +1 -0
- package/package.json +29 -91
- package/dist/auth/client.d.ts +0 -99
- package/dist/auth/live.d.ts +0 -4366
- package/dist/auth.js +0 -248
- package/dist/bundler.js +0 -111
- package/dist/chunk-6zx7kn5t.js +0 -40273
- package/dist/chunk-cy9b59s6.js +0 -503
- package/dist/chunk-h12fatty.js +0 -63
- package/dist/chunk-k14jpms5.js +0 -249
- package/dist/chunk-r0vsftj4.js +0 -102
- package/dist/chunk-w21k7p99.js +0 -843
- package/dist/chunk-wx236z2x.js +0 -12300
- package/dist/chunk-y0d2c7kp.js +0 -54
- package/dist/client/conditional-request.d.ts +0 -16
- package/dist/client/factory.d.ts +0 -39
- package/dist/client/query-serializer.d.ts +0 -2
- package/dist/client/request-compression.d.ts +0 -47
- package/dist/client/ssr-fetch.d.ts +0 -12
- package/dist/errors/api-error.d.ts +0 -29
- package/dist/errors/find-current-error.d.ts +0 -8
- package/dist/errors/sdk-error.d.ts +0 -47
- package/dist/errors/sdk-error.js +0 -8
- package/dist/generated/@tanstack/react-query.gen.d.ts +0 -18693
- package/dist/generated/client/client.gen.d.ts +0 -2
- package/dist/generated/client/index.d.ts +0 -10
- package/dist/generated/client/types.gen.d.ts +0 -120
- package/dist/generated/client/utils.gen.d.ts +0 -37
- package/dist/generated/client.gen.d.ts +0 -12
- package/dist/generated/core/auth.gen.d.ts +0 -25
- package/dist/generated/core/bodySerializer.gen.d.ts +0 -25
- package/dist/generated/core/params.gen.d.ts +0 -43
- package/dist/generated/core/pathSerializer.gen.d.ts +0 -33
- package/dist/generated/core/queryKeySerializer.gen.d.ts +0 -18
- package/dist/generated/core/serverSentEvents.gen.d.ts +0 -71
- package/dist/generated/core/types.gen.d.ts +0 -83
- package/dist/generated/core/utils.gen.d.ts +0 -19
- package/dist/generated/index.d.ts +0 -2
- package/dist/generated/sdk.gen.d.ts +0 -4883
- package/dist/generated/transformers.gen.d.ts +0 -40
- package/dist/generated/types.gen.d.ts +0 -121889
- package/dist/generated/zod.gen.d.ts +0 -163107
- package/dist/operations.d.ts +0 -12
- package/dist/operations.js +0 -1635
- package/dist/react-query.d.ts +0 -11
- package/dist/react-query.js +0 -15315
- package/dist/readonly-deep.d.ts +0 -12
- package/dist/runtime-exports.d.ts +0 -20
- package/dist/runtime-exports.js +0 -16
- package/dist/scalars/big-decimal.d.ts +0 -12
- package/dist/scalars/ethereum-address.d.ts +0 -8
- package/dist/scalars/exchange-rates.d.ts +0 -36
- package/dist/scalars/index.d.ts +0 -15
- package/dist/scalars/index.js +0 -35
- package/dist/scalars/organization-id.d.ts +0 -8
- package/dist/schemas.d.ts +0 -10
- package/dist/schemas.js +0 -11070
- package/dist/secret.d.ts +0 -14
- package/dist/sign-webhook-receipt.d.ts +0 -76
- package/dist/sign-webhook-receipt.js +0 -26
- package/dist/transport/cookie-store.d.ts +0 -9
- package/dist/transport/sse-lifecycle.d.ts +0 -44
- package/dist/verify-webhook.js +0 -8
- package/dist/wait-for-transaction.js +0 -112
package/README.md
CHANGED
|
@@ -1,140 +1,206 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://github.com/settlemint/sdk/blob/main/logo.svg" width="200px" align="center" alt="SettleMint logo" />
|
|
3
|
+
<h1 align="center">DALP SDK</h1>
|
|
4
|
+
<p align="center">
|
|
5
|
+
<a href="https://settlemint.com">https://settlemint.com</a>
|
|
6
|
+
<br/>
|
|
7
|
+
Fully typed TypeScript SDK for the Digital Asset Lifecycle Platform API.
|
|
8
|
+
</p>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="https://www.npmjs.com/package/@settlemint/dalp-sdk" rel="nofollow"><img src="https://img.shields.io/npm/v/@settlemint/dalp-sdk" alt="npm version"></a>
|
|
13
|
+
<a href="https://www.npmjs.com/package/@settlemint/dalp-sdk" rel="nofollow"><img src="https://img.shields.io/npm/dw/@settlemint/dalp-sdk" alt="npm downloads"></a>
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
<div align="center">
|
|
17
|
+
<a href="https://settlemint.com">Website</a>
|
|
18
|
+
<span> • </span>
|
|
19
|
+
<a href="https://www.npmjs.com/package/@settlemint/dalp-sdk">NPM</a>
|
|
20
|
+
<span> • </span>
|
|
21
|
+
<a href="mailto:support@settlemint.com">Support</a>
|
|
22
|
+
<br />
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
## About
|
|
26
|
+
|
|
27
|
+
The DALP SDK provides a fully typed client for the Digital Asset Lifecycle Platform API. Built on [oRPC](https://orpc.unnoq.com/) with contract-first types, it gives you auto-complete for every API namespace — tokens, identities, compliance, transactions, and more.
|
|
28
|
+
|
|
29
|
+
## Installation
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# npm
|
|
33
|
+
npm install @settlemint/dalp-sdk
|
|
34
|
+
|
|
35
|
+
# bun
|
|
36
|
+
bun add @settlemint/dalp-sdk
|
|
37
|
+
```
|
|
7
38
|
|
|
8
|
-
##
|
|
39
|
+
## Quick Start
|
|
9
40
|
|
|
10
|
-
```
|
|
41
|
+
```typescript
|
|
11
42
|
import { createDalpClient } from "@settlemint/dalp-sdk";
|
|
12
43
|
|
|
13
44
|
const dalp = createDalpClient({
|
|
14
|
-
|
|
45
|
+
url: "https://dalp.example.com",
|
|
15
46
|
apiKey: "sm_dalp_...",
|
|
47
|
+
organizationId: "org_...", // optional, for multi-org setups
|
|
16
48
|
});
|
|
17
49
|
|
|
18
|
-
|
|
50
|
+
// Every method is fully typed with auto-complete
|
|
51
|
+
const tokens = await dalp.token.list({ query: {} });
|
|
52
|
+
const system = await dalp.system.read({});
|
|
19
53
|
```
|
|
20
54
|
|
|
21
|
-
|
|
22
|
-
(session cookie in the browser and on SSR, or an `X-Api-Key` header for
|
|
23
|
-
server/CLI callers — never both from the same runtime), organization headers,
|
|
24
|
-
idempotency keys, `Prefer`, conditional `If-None-Match` / ETag reuse, custom fetch
|
|
25
|
-
injection, and abort propagation. See the "Credential ownership matrix" JSDoc
|
|
26
|
-
on `createDalpClient` in `src/client/factory.ts` for which runtime may use
|
|
27
|
-
which credential.
|
|
55
|
+
## Auth Client
|
|
28
56
|
|
|
29
|
-
|
|
30
|
-
|
|
57
|
+
Use `createDalpAuthClient` for Better Auth operations such as sign-up, session listing, organization management, API
|
|
58
|
+
keys, device authorization, and wallet verification setup.
|
|
31
59
|
|
|
32
|
-
|
|
60
|
+
```typescript
|
|
61
|
+
import { createDalpAuthClient } from "@settlemint/dalp-sdk";
|
|
33
62
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
session. Version-stamp ETags (generation counters, watermarks, table versions)
|
|
40
|
-
are forbidden for conditional-request adopters — a stamp can collide across
|
|
41
|
-
tenants or lag a body change.
|
|
63
|
+
const auth = createDalpAuthClient({
|
|
64
|
+
url: "https://dalp.example.com",
|
|
65
|
+
apiKey: "sm_dalp_...",
|
|
66
|
+
organizationId: "org_...",
|
|
67
|
+
});
|
|
42
68
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
send another session's `If-None-Match`.
|
|
69
|
+
const apiKeys = await auth.apiKey.list();
|
|
70
|
+
```
|
|
46
71
|
|
|
47
|
-
|
|
48
|
-
|
|
72
|
+
For Node-side session flows, use the platform client. It keeps Better Auth cookies in an SDK-owned store and exposes the
|
|
73
|
+
DAPI client and auth client together.
|
|
49
74
|
|
|
50
|
-
|
|
51
|
-
|
|
75
|
+
```typescript
|
|
76
|
+
import { createDalpPlatformClient } from "@settlemint/dalp-sdk";
|
|
52
77
|
|
|
53
|
-
|
|
78
|
+
const platform = createDalpPlatformClient({
|
|
79
|
+
url: "https://dalp.example.com",
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
await platform.auth.signUp.email({
|
|
83
|
+
email: "user@example.com",
|
|
84
|
+
password: "Password123!",
|
|
85
|
+
name: "Example User",
|
|
86
|
+
});
|
|
54
87
|
|
|
55
|
-
|
|
56
|
-
import { createClient } from "@settlemint/dalp-sdk/operations";
|
|
88
|
+
const sessionCookie = platform.cookieStore.header;
|
|
57
89
|
```
|
|
58
90
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
`
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
91
|
+
### Auth Namespaces
|
|
92
|
+
|
|
93
|
+
All namespaces below are fully typed on `DalpAuthClient` — every operation has auto-complete and a typed return value.
|
|
94
|
+
|
|
95
|
+
| Namespace | Operations | Description |
|
|
96
|
+
| --------------------- | ------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- |
|
|
97
|
+
| `signIn` | `email` | Sign in with email and password |
|
|
98
|
+
| `signUp` | `email` | Register a new account |
|
|
99
|
+
| `getSession` | — | Fetch the current session |
|
|
100
|
+
| `listSessions` | — | List all active sessions |
|
|
101
|
+
| `revokeSession` | — | Revoke a specific session |
|
|
102
|
+
| `revokeOtherSessions` | — | Revoke all sessions except the current one |
|
|
103
|
+
| `apiKey` | `create`, `list`, `delete` | Manage API keys |
|
|
104
|
+
| `organization` | `create`, `list`, `setActive`, `inviteMember`, `acceptInvitation`, `listMembers`, `addMember`, `removeMember` | Manage organizations and membership |
|
|
105
|
+
| `admin` | `listUsers`, `createUser`, `removeUser`, `setRole` | Administrative user management |
|
|
106
|
+
| `device` | `code`, `token`, `approve`, `deny` | Device authorization flow |
|
|
107
|
+
| `twoFactor` | `enable`, `disable`, `verifyTotp`, `verifyBackupCode`, `generateBackupCodes` | Account-level TOTP two-factor authentication |
|
|
108
|
+
| `wallet.pincode` | `enable`, `disable`, `update`, `reset` | Wallet pincode protection |
|
|
109
|
+
| `wallet.twoFactor` | `enable`, `disable`, `verify` | Wallet two-factor verification |
|
|
110
|
+
| `wallet.secretCodes` | `generate`, `confirm` | Wallet secret (recovery) codes |
|
|
111
|
+
| `passkey` | — | Account-level passkey registration (browser/WebAuthn only) |
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
// Enable account-level 2FA and verify a TOTP code
|
|
115
|
+
await auth.twoFactor.enable({ password: "..." });
|
|
116
|
+
await auth.twoFactor.verifyTotp({ code: "123456" });
|
|
82
117
|
```
|
|
83
118
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
non-React consumers.
|
|
119
|
+
```typescript
|
|
120
|
+
// Enable wallet pincode protection
|
|
121
|
+
await auth.wallet.pincode.enable({ pincode: "1234", password: "..." });
|
|
122
|
+
```
|
|
89
123
|
|
|
90
|
-
##
|
|
124
|
+
## Configuration
|
|
91
125
|
|
|
92
|
-
```
|
|
93
|
-
import {
|
|
94
|
-
|
|
126
|
+
```typescript
|
|
127
|
+
import { createDalpClient } from "@settlemint/dalp-sdk";
|
|
128
|
+
|
|
129
|
+
const dalp = createDalpClient({
|
|
130
|
+
// Required
|
|
131
|
+
url: "https://dalp.example.com",
|
|
95
132
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
actions that must run in the browser (`passkeyClient` drives the WebAuthn
|
|
99
|
-
ceremony through `navigator.credentials`), and the access-control model that
|
|
100
|
-
evaluates a permission locally instead of round-tripping `has-permission`. Off
|
|
101
|
-
the package root because it costs roughly 70 KiB of Better Auth a
|
|
102
|
-
pure-operations consumer should not pay.
|
|
133
|
+
// Required for authenticated routes
|
|
134
|
+
apiKey: "sm_dalp_...",
|
|
103
135
|
|
|
104
|
-
|
|
136
|
+
// Optional
|
|
137
|
+
organizationId: "org_...", // multi-org scoping
|
|
138
|
+
headers: { "User-Agent": "MyApp" }, // override default headers
|
|
139
|
+
idempotencyKey: "req_abc123", // ⚠️ sent on EVERY request — use only for single-mutation clients
|
|
140
|
+
requestValidation: false, // validate requests client-side (default: false)
|
|
141
|
+
responseValidation: false, // validate responses client-side (default: false)
|
|
142
|
+
fetch: customFetch, // custom fetch implementation
|
|
143
|
+
});
|
|
144
|
+
```
|
|
105
145
|
|
|
106
|
-
|
|
107
|
-
|
|
146
|
+
## API Namespaces
|
|
147
|
+
|
|
148
|
+
| Namespace | Description |
|
|
149
|
+
| ------------------ | -------------------------- |
|
|
150
|
+
| `account` | Manage accounts |
|
|
151
|
+
| `actions` | Manage actions |
|
|
152
|
+
| `addons` | Manage addons |
|
|
153
|
+
| `admin` | Administrative operations |
|
|
154
|
+
| `contacts` | Manage contacts |
|
|
155
|
+
| `exchangeRates` | View exchange rates |
|
|
156
|
+
| `externalToken` | Manage external tokens |
|
|
157
|
+
| `identityRecovery` | Recover lost identities |
|
|
158
|
+
| `monitoring` | Platform monitoring |
|
|
159
|
+
| `search` | Search across the platform |
|
|
160
|
+
| `settings` | Platform settings |
|
|
161
|
+
| `system` | System administration |
|
|
162
|
+
| `token` | Manage security tokens |
|
|
163
|
+
| `transaction` | View transactions |
|
|
164
|
+
| `user` | Manage platform users |
|
|
165
|
+
|
|
166
|
+
## Endpoint Coverage
|
|
167
|
+
|
|
168
|
+
The SDK covers 100% of the v2 REST API: it is generated from the same oRPC contract that the server implements, and a
|
|
169
|
+
CI check (`bun run check:sdk-coverage`) diffs every mounted API route against the contract on every change. Endpoints
|
|
170
|
+
intentionally outside the SDK contract are named in a committed allowlist with a reason each, in these categories:
|
|
171
|
+
|
|
172
|
+
- **v1-frozen** — the deliberately frozen v1 REST surface
|
|
173
|
+
- **internal-ops** — health probes, CSP report sink, theme CSS, static manifests
|
|
174
|
+
- **webhook-receiver** — provider webhook receivers (DFNS, Ripple, compliance providers)
|
|
175
|
+
- **better-auth** — auth plumbing, covered by the SDK auth client instead
|
|
176
|
+
- **docs / asset-delivery / bundler / orpc-mount** — API docs pages, binary asset delivery, the ERC-4337 bundler
|
|
177
|
+
JSON-RPC passthrough (covered by the SDK bundler client), and the oRPC transport mounts themselves
|
|
178
|
+
|
|
179
|
+
## Subpath Exports
|
|
180
|
+
|
|
181
|
+
```typescript
|
|
182
|
+
// Main entry — client factory, error codes, serializers
|
|
183
|
+
import { createDalpAuthClient, createDalpClient, createDalpPlatformClient } from "@settlemint/dalp-sdk";
|
|
184
|
+
|
|
185
|
+
// Type-only — for function signatures without runtime code
|
|
186
|
+
import type { DalpClient, DalpClientConfig } from "@settlemint/dalp-sdk/types";
|
|
187
|
+
|
|
188
|
+
// Plugins — optional oRPC link plugins for advanced usage
|
|
189
|
+
import { BatchLinkPlugin, RequestValidationPlugin } from "@settlemint/dalp-sdk/plugins";
|
|
108
190
|
```
|
|
109
191
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
##
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
client factory, its config and errors, cookie-store transport, SSE lifecycle
|
|
126
|
-
handling, and SDK version constants — so a consumer
|
|
127
|
-
who only needs to call operations never pays for auth, bundler, react-query,
|
|
128
|
-
or webhook code. See the `@module` doc at the top of `src/index.ts` for the
|
|
129
|
-
current weight breakdown per subpath.
|
|
130
|
-
|
|
131
|
-
## Migrating from the Effect client
|
|
132
|
-
|
|
133
|
-
Prior major versions exposed an `Effect`-returning client
|
|
134
|
-
(`makeDalpEffectClient`, `makeDalpApiLayer`, `DalpEffectClient`) alongside the
|
|
135
|
-
Promise client. That dual surface, the `contracts/` schema re-exports, and
|
|
136
|
-
`makeDalpPlatformClient`/`waitForTransactionEffect` are removed — see
|
|
137
|
-
`CHANGELOG.md` and the
|
|
138
|
-
[v2 migration guide](../docs/content/docs/api-reference/reference/v2-migration.mdx).
|
|
139
|
-
No published consumer depended on the Effect surface, so this ships without a
|
|
140
|
-
major version bump.
|
|
192
|
+
## Security
|
|
193
|
+
|
|
194
|
+
- **API key authentication** — issued via the DALP dashboard (Settings → API Keys) or via `dalp login`
|
|
195
|
+
- Public routes can be called without an API key; authenticated routes still require one
|
|
196
|
+
- Security headers (`x-api-key`, `x-organization-id`) cannot be overridden by custom headers
|
|
197
|
+
- Client-side request validation can be enabled to catch schema violations early
|
|
198
|
+
|
|
199
|
+
## Errors
|
|
200
|
+
|
|
201
|
+
DAPI errors thrown by the SDK use `DalpSdkError` and include `message`, `why`, `fix`, `status`, `retryable`, and the
|
|
202
|
+
public DAPI error id when the server returns one.
|
|
203
|
+
|
|
204
|
+
## License
|
|
205
|
+
|
|
206
|
+
This project is licensed under the **SettleMint Commercial Customer Source License**. See the LICENSE file included in the package for full terms.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Client-side Better Auth access-control metadata for DALP auth clients.
|
|
3
3
|
*
|
|
4
|
-
* Related: packages/
|
|
4
|
+
* Related: packages/dalp/auth/src/utils/permissions.ts, kit/sdk/src/auth.ts
|
|
5
5
|
*
|
|
6
6
|
* @module
|
|
7
7
|
*/
|
|
@@ -10,3 +10,4 @@ export declare const accessControl: AccessControl;
|
|
|
10
10
|
export declare const adminRole: Role;
|
|
11
11
|
export declare const ownerRole: Role;
|
|
12
12
|
export declare const memberRole: Role;
|
|
13
|
+
//# sourceMappingURL=auth-permissions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-permissions.d.ts","sourceRoot":"","sources":["../src/auth-permissions.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,IAAI,EAAuB,MAAM,4BAA4B,CAAC;AAuBhG,eAAO,MAAM,aAAa,EAAE,aAI1B,CAAC;AAEH,eAAO,MAAM,SAAS,EAAE,IAOtB,CAAC;AAEH,eAAO,MAAM,SAAS,EAAE,IAMtB,CAAC;AAEH,eAAO,MAAM,UAAU,EAAE,IAKvB,CAAC"}
|
|
@@ -1,69 +1,3 @@
|
|
|
1
|
-
import type { DalpAuthResult } from "./client.ts";
|
|
2
|
-
export type WalletAuthOperation<TInput, TData> = (input: TInput, options?: unknown) => Promise<DalpAuthResult<TData>>;
|
|
3
|
-
/** Typed client actions supplied by the three DALP wallet-auth plugins. */
|
|
4
|
-
export interface DalpWalletAuthClient {
|
|
5
|
-
readonly wallet: {
|
|
6
|
-
readonly pincode: {
|
|
7
|
-
readonly enable: WalletAuthOperation<{
|
|
8
|
-
readonly pincode: string;
|
|
9
|
-
readonly password?: string;
|
|
10
|
-
}, {
|
|
11
|
-
readonly success: boolean;
|
|
12
|
-
}>;
|
|
13
|
-
readonly update: WalletAuthOperation<{
|
|
14
|
-
readonly newPincode: string;
|
|
15
|
-
readonly password: string;
|
|
16
|
-
}, {
|
|
17
|
-
readonly success: boolean;
|
|
18
|
-
}>;
|
|
19
|
-
readonly disable: WalletAuthOperation<{
|
|
20
|
-
readonly password: string;
|
|
21
|
-
}, {
|
|
22
|
-
readonly success: boolean;
|
|
23
|
-
}>;
|
|
24
|
-
readonly reset: WalletAuthOperation<{
|
|
25
|
-
readonly newPincode: string;
|
|
26
|
-
readonly recoveryCode: string;
|
|
27
|
-
}, {
|
|
28
|
-
readonly success: boolean;
|
|
29
|
-
readonly recoveryCodes?: ReadonlyArray<string>;
|
|
30
|
-
}>;
|
|
31
|
-
};
|
|
32
|
-
readonly twoFactor: {
|
|
33
|
-
readonly enable: WalletAuthOperation<{
|
|
34
|
-
readonly issuer?: string;
|
|
35
|
-
readonly password?: string;
|
|
36
|
-
}, {
|
|
37
|
-
readonly totpURI: string;
|
|
38
|
-
}>;
|
|
39
|
-
readonly verify: WalletAuthOperation<{
|
|
40
|
-
readonly code: string;
|
|
41
|
-
}, {
|
|
42
|
-
readonly status: boolean;
|
|
43
|
-
}>;
|
|
44
|
-
readonly disable: WalletAuthOperation<{
|
|
45
|
-
readonly password: string;
|
|
46
|
-
}, {
|
|
47
|
-
readonly status: boolean;
|
|
48
|
-
}>;
|
|
49
|
-
};
|
|
50
|
-
readonly secretCodes: {
|
|
51
|
-
readonly generate: WalletAuthOperation<{
|
|
52
|
-
readonly password?: string;
|
|
53
|
-
}, {
|
|
54
|
-
readonly rotated: boolean;
|
|
55
|
-
readonly secretCodes: ReadonlyArray<string>;
|
|
56
|
-
readonly verificationId: string;
|
|
57
|
-
}>;
|
|
58
|
-
readonly confirm: WalletAuthOperation<{
|
|
59
|
-
readonly stored: boolean;
|
|
60
|
-
readonly verificationId: string;
|
|
61
|
-
}, {
|
|
62
|
-
readonly success: boolean;
|
|
63
|
-
}>;
|
|
64
|
-
};
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
1
|
export declare const walletPincodeClient: () => {
|
|
68
2
|
id: "wallet-pincode";
|
|
69
3
|
$InferServerPlugin: {
|
|
@@ -144,7 +78,9 @@ export declare const walletSecretCodesClient: () => {
|
|
|
144
78
|
signal: "$sessionSignal";
|
|
145
79
|
}[];
|
|
146
80
|
};
|
|
147
|
-
|
|
148
|
-
|
|
81
|
+
type StripLeadingSlash<T extends string> = T extends `/${infer Rest}` ? Rest : never;
|
|
82
|
+
type WalletPluginPathMethodKeys = keyof ReturnType<typeof walletPincodeClient>["pathMethods"] | keyof ReturnType<typeof walletTwoFactorClient>["pathMethods"] | keyof ReturnType<typeof walletSecretCodesClient>["pathMethods"];
|
|
149
83
|
/** CLI coverage keys for DALP wallet Better Auth plugin endpoints (no leading slash). */
|
|
150
|
-
export type WalletAuthEndpointPath = StripLeadingSlash<WalletPluginPathMethodKeys>;
|
|
84
|
+
export type WalletAuthEndpointPath = StripLeadingSlash<WalletPluginPathMethodKeys & string>;
|
|
85
|
+
export {};
|
|
86
|
+
//# sourceMappingURL=auth-wallet-plugins.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-wallet-plugins.d.ts","sourceRoot":"","sources":["../src/auth-wallet-plugins.ts"],"names":[],"mappings":"AA6BA,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqBK,CAAC;AAEtC,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;CAoBG,CAAC;AAEtC,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;CAmBC,CAAC;AAEtC,KAAK,iBAAiB,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,IAAI,MAAM,IAAI,EAAE,GAAG,IAAI,GAAG,KAAK,CAAC;AAErF,KAAK,0BAA0B,GAC3B,MAAM,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC,aAAa,CAAC,GAC3D,MAAM,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC,aAAa,CAAC,GAC7D,MAAM,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC,aAAa,CAAC,CAAC;AAEpE,yFAAyF;AACzF,MAAM,MAAM,sBAAsB,GAAG,iBAAiB,CAAC,0BAA0B,GAAG,MAAM,CAAC,CAAC"}
|
package/dist/auth.d.ts
CHANGED
|
@@ -1,22 +1,115 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAoBA,OAAO,EAA0B,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAK5E,MAAM,WAAW,oBAAoB;IACnC,qEAAqE;IACrE,GAAG,EAAE,MAAM,CAAC;IAEZ,qEAAqE;IACrE,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,uEAAuE;IACvE,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,qEAAqE;IACrE,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,+EAA+E;IAC/E,WAAW,CAAC,EAAE,eAAe,CAAC;IAE9B;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,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