@eudiplo/sdk-core 1.14.0-main.a8faebc → 1.14.0-main.b01cdb7
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 +54 -15
- package/dist/api/client/client.gen.d.mts +1 -1
- package/dist/api/client/client.gen.d.ts +1 -1
- package/dist/api/client/index.d.mts +1 -1
- package/dist/api/client/index.d.ts +1 -1
- package/dist/api/client/index.js +1 -1
- package/dist/api/client/index.mjs +1 -1
- package/dist/api/client/types.gen.d.mts +1 -1
- package/dist/api/client/types.gen.d.ts +1 -1
- package/dist/api/client.gen.d.mts +3 -3
- package/dist/api/client.gen.d.ts +3 -3
- package/dist/api/index.d.mts +114 -186
- package/dist/api/index.d.ts +114 -186
- package/dist/api/index.js +207 -236
- package/dist/api/index.mjs +186 -197
- package/dist/index.d.mts +82 -5
- package/dist/index.d.ts +82 -5
- package/dist/index.js +323 -243
- package/dist/index.mjs +302 -204
- package/dist/{types.gen-DDunhhsd.d.mts → types.gen-D8LjzWc0.d.mts} +2 -2
- package/dist/{types.gen-DDunhhsd.d.ts → types.gen-D8LjzWc0.d.ts} +2 -2
- package/dist/{types.gen-CVlM1-va.d.mts → types.gen-sNmRQvUI.d.mts} +1698 -1130
- package/dist/{types.gen-CVlM1-va.d.ts → types.gen-sNmRQvUI.d.ts} +1698 -1130
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -141,14 +141,16 @@ const session = await client.submitDcApiResponse(sessionId, credential);
|
|
|
141
141
|
When deploying to production, you should **never expose your client credentials to the browser**. The SDK provides helper functions to split the DC API flow between your server (where credentials are safe) and the browser (where the DC API runs).
|
|
142
142
|
|
|
143
143
|
**Server-side Functions:**
|
|
144
|
-
|
|
145
|
-
|
|
|
144
|
+
|
|
145
|
+
| Function | Description |
|
|
146
|
+
| -------------------------------- | ------------------------------------------------------ |
|
|
146
147
|
| `createDcApiRequestForBrowser()` | Create request on server, return safe data for browser |
|
|
147
|
-
| `submitDcApiWalletResponse()`
|
|
148
|
+
| `submitDcApiWalletResponse()` | Submit wallet response to EUDIPLO from server |
|
|
148
149
|
|
|
149
150
|
**Browser-side Functions:**
|
|
150
|
-
|
|
151
|
-
|
|
|
151
|
+
|
|
152
|
+
| Function | Description |
|
|
153
|
+
| ------------- | ------------------------------------------------------ |
|
|
152
154
|
| `callDcApi()` | Call the native DC API with a request from your server |
|
|
153
155
|
|
|
154
156
|
##### Example: Express.js Backend + Browser Frontend
|
|
@@ -165,8 +167,8 @@ import {
|
|
|
165
167
|
app.post('/api/start-verification', async (req, res) => {
|
|
166
168
|
const requestData = await createDcApiRequestForBrowser({
|
|
167
169
|
baseUrl: process.env.EUDIPLO_URL,
|
|
168
|
-
clientId: process.env.EUDIPLO_CLIENT_ID,
|
|
169
|
-
clientSecret: process.env.EUDIPLO_SECRET,
|
|
170
|
+
clientId: process.env.EUDIPLO_CLIENT_ID, // ✅ Safe on server
|
|
171
|
+
clientSecret: process.env.EUDIPLO_SECRET, // ✅ Safe on server
|
|
170
172
|
configId: 'age-over-18',
|
|
171
173
|
});
|
|
172
174
|
|
|
@@ -181,7 +183,7 @@ app.post('/api/complete-verification', async (req, res) => {
|
|
|
181
183
|
const result = await submitDcApiWalletResponse({
|
|
182
184
|
responseUri,
|
|
183
185
|
walletResponse,
|
|
184
|
-
sendResponse: true,
|
|
186
|
+
sendResponse: true, // Get verified claims back
|
|
185
187
|
});
|
|
186
188
|
|
|
187
189
|
// result.credentials contains the verified data
|
|
@@ -224,13 +226,13 @@ async function verifyAge() {
|
|
|
224
226
|
|
|
225
227
|
**What stays where:**
|
|
226
228
|
|
|
227
|
-
| Data
|
|
228
|
-
|
|
229
|
-
| `clientId` / `clientSecret`
|
|
230
|
-
| `requestObject` (signed JWT)
|
|
231
|
-
| `responseUri`
|
|
232
|
-
| Wallet response (encrypted VP) | Browser → Server | ✅ Yes
|
|
233
|
-
| Verified credentials
|
|
229
|
+
| Data | Location | Safe to expose? |
|
|
230
|
+
| ------------------------------ | ---------------- | ------------------- |
|
|
231
|
+
| `clientId` / `clientSecret` | Server only | ❌ Never expose |
|
|
232
|
+
| `requestObject` (signed JWT) | Server → Browser | ✅ Yes |
|
|
233
|
+
| `responseUri` | Server → Browser | ✅ Yes |
|
|
234
|
+
| Wallet response (encrypted VP) | Browser → Server | ✅ Yes |
|
|
235
|
+
| Verified credentials | Server only | Depends on use case |
|
|
234
236
|
|
|
235
237
|
### Class-based API (More Control)
|
|
236
238
|
|
|
@@ -325,6 +327,43 @@ const session = await client.waitForSession(sessionId, {
|
|
|
325
327
|
});
|
|
326
328
|
```
|
|
327
329
|
|
|
330
|
+
### `subscribeToSession(sessionId, options)`
|
|
331
|
+
|
|
332
|
+
Subscribe to real-time session status updates via Server-Sent Events (SSE).
|
|
333
|
+
This is more efficient than polling and provides instant updates.
|
|
334
|
+
|
|
335
|
+
```typescript
|
|
336
|
+
const subscription = await client.subscribeToSession(sessionId, {
|
|
337
|
+
onStatusChange: (event) => {
|
|
338
|
+
console.log(`Status: ${event.status}`);
|
|
339
|
+
if (['completed', 'expired', 'failed'].includes(event.status)) {
|
|
340
|
+
subscription.close();
|
|
341
|
+
}
|
|
342
|
+
},
|
|
343
|
+
onError: (error) => console.error('SSE error:', error),
|
|
344
|
+
onOpen: () => console.log('Connected'),
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
// Later, to close the connection:
|
|
348
|
+
subscription.close();
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
### `waitForSessionWithSse(sessionId, options)`
|
|
352
|
+
|
|
353
|
+
Wait for session completion using SSE instead of polling. Returns a Promise
|
|
354
|
+
that resolves when the session completes.
|
|
355
|
+
|
|
356
|
+
```typescript
|
|
357
|
+
try {
|
|
358
|
+
const finalStatus = await client.waitForSessionWithSse(sessionId, {
|
|
359
|
+
onStatusChange: (event) => console.log('Status:', event.status),
|
|
360
|
+
});
|
|
361
|
+
console.log('Session completed:', finalStatus);
|
|
362
|
+
} catch (error) {
|
|
363
|
+
console.error('Session failed:', error);
|
|
364
|
+
}
|
|
365
|
+
```
|
|
366
|
+
|
|
328
367
|
## Examples
|
|
329
368
|
|
|
330
369
|
### Age Verification in a Web Shop
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as Auth, C as Client, a as ClientOptions, b as Config, c as CreateClientConfig, O as Options, Q as QuerySerializerOptions, R as RequestOptions, d as RequestResult, e as ResolvedRequestOptions, f as ResponseStyle, T as TDataShape, g as createConfig, h as formDataBodySerializer, j as jsonBodySerializer, m as mergeHeaders, u as urlSearchParamsBodySerializer } from '../../types.gen-
|
|
1
|
+
export { A as Auth, C as Client, a as ClientOptions, b as Config, c as CreateClientConfig, O as Options, Q as QuerySerializerOptions, R as RequestOptions, d as RequestResult, e as ResolvedRequestOptions, f as ResponseStyle, T as TDataShape, g as createConfig, h as formDataBodySerializer, j as jsonBodySerializer, m as mergeHeaders, u as urlSearchParamsBodySerializer } from '../../types.gen-D8LjzWc0.mjs';
|
|
2
2
|
export { createClient } from './client.gen.mjs';
|
|
3
3
|
|
|
4
4
|
type Slot = "body" | "headers" | "path" | "query";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as Auth, C as Client, a as ClientOptions, b as Config, c as CreateClientConfig, O as Options, Q as QuerySerializerOptions, R as RequestOptions, d as RequestResult, e as ResolvedRequestOptions, f as ResponseStyle, T as TDataShape, g as createConfig, h as formDataBodySerializer, j as jsonBodySerializer, m as mergeHeaders, u as urlSearchParamsBodySerializer } from '../../types.gen-
|
|
1
|
+
export { A as Auth, C as Client, a as ClientOptions, b as Config, c as CreateClientConfig, O as Options, Q as QuerySerializerOptions, R as RequestOptions, d as RequestResult, e as ResolvedRequestOptions, f as ResponseStyle, T as TDataShape, g as createConfig, h as formDataBodySerializer, j as jsonBodySerializer, m as mergeHeaders, u as urlSearchParamsBodySerializer } from '../../types.gen-D8LjzWc0.js';
|
|
2
2
|
export { createClient } from './client.gen.js';
|
|
3
3
|
|
|
4
4
|
type Slot = "body" | "headers" | "path" | "query";
|
package/dist/api/client/index.js
CHANGED
|
@@ -88,7 +88,7 @@ var buildKeyMap = (fields, map) => {
|
|
|
88
88
|
};
|
|
89
89
|
var stripEmptySlots = (params) => {
|
|
90
90
|
for (const [slot, value] of Object.entries(params)) {
|
|
91
|
-
if (value && typeof value === "object" && !Object.keys(value).length) {
|
|
91
|
+
if (value && typeof value === "object" && !Array.isArray(value) && !Object.keys(value).length) {
|
|
92
92
|
delete params[slot];
|
|
93
93
|
}
|
|
94
94
|
}
|
|
@@ -86,7 +86,7 @@ var buildKeyMap = (fields, map) => {
|
|
|
86
86
|
};
|
|
87
87
|
var stripEmptySlots = (params) => {
|
|
88
88
|
for (const [slot, value] of Object.entries(params)) {
|
|
89
|
-
if (value && typeof value === "object" && !Object.keys(value).length) {
|
|
89
|
+
if (value && typeof value === "object" && !Array.isArray(value) && !Object.keys(value).length) {
|
|
90
90
|
delete params[slot];
|
|
91
91
|
}
|
|
92
92
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { C as Client, a as ClientOptions, b as Config, c as CreateClientConfig, O as Options, R as RequestOptions, d as RequestResult, e as ResolvedRequestOptions, f as ResponseStyle, T as TDataShape } from '../../types.gen-
|
|
1
|
+
export { C as Client, a as ClientOptions, b as Config, c as CreateClientConfig, O as Options, R as RequestOptions, d as RequestResult, e as ResolvedRequestOptions, f as ResponseStyle, T as TDataShape } from '../../types.gen-D8LjzWc0.mjs';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { C as Client, a as ClientOptions, b as Config, c as CreateClientConfig, O as Options, R as RequestOptions, d as RequestResult, e as ResolvedRequestOptions, f as ResponseStyle, T as TDataShape } from '../../types.gen-
|
|
1
|
+
export { C as Client, a as ClientOptions, b as Config, c as CreateClientConfig, O as Options, R as RequestOptions, d as RequestResult, e as ResolvedRequestOptions, f as ResponseStyle, T as TDataShape } from '../../types.gen-D8LjzWc0.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as Client, a as ClientOptions, b as Config } from '../types.gen-
|
|
2
|
-
import {
|
|
1
|
+
import { C as Client, a as ClientOptions, b as Config } from '../types.gen-D8LjzWc0.mjs';
|
|
2
|
+
import { ae as ClientOptions$1 } from '../types.gen-sNmRQvUI.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The `createClientConfig()` function will be called on client initialization
|
|
@@ -9,7 +9,7 @@ import { aw as ClientOptions$1 } from '../types.gen-CVlM1-va.mjs';
|
|
|
9
9
|
* `setConfig()`. This is useful for example if you're using Next.js
|
|
10
10
|
* to ensure your client always has the correct values.
|
|
11
11
|
*/
|
|
12
|
-
type CreateClientConfig<T extends ClientOptions = ClientOptions$1> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T
|
|
12
|
+
type CreateClientConfig<T extends ClientOptions = ClientOptions$1> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T> | Promise<Config<Required<ClientOptions> & T>>;
|
|
13
13
|
declare const client: Client;
|
|
14
14
|
|
|
15
15
|
export { type CreateClientConfig, client };
|
package/dist/api/client.gen.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as Client, a as ClientOptions, b as Config } from '../types.gen-
|
|
2
|
-
import {
|
|
1
|
+
import { C as Client, a as ClientOptions, b as Config } from '../types.gen-D8LjzWc0.js';
|
|
2
|
+
import { ae as ClientOptions$1 } from '../types.gen-sNmRQvUI.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The `createClientConfig()` function will be called on client initialization
|
|
@@ -9,7 +9,7 @@ import { aw as ClientOptions$1 } from '../types.gen-CVlM1-va.js';
|
|
|
9
9
|
* `setConfig()`. This is useful for example if you're using Next.js
|
|
10
10
|
* to ensure your client always has the correct values.
|
|
11
11
|
*/
|
|
12
|
-
type CreateClientConfig<T extends ClientOptions = ClientOptions$1> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T
|
|
12
|
+
type CreateClientConfig<T extends ClientOptions = ClientOptions$1> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T> | Promise<Config<Required<ClientOptions> & T>>;
|
|
13
13
|
declare const client: Client;
|
|
14
14
|
|
|
15
15
|
export { type CreateClientConfig, client };
|