@eudiplo/sdk-core 1.14.0-main.d446bdf → 1.14.0-main.d6bef75
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/client.gen.js +5 -3
- package/dist/api/client/client.gen.mjs +5 -3
- package/dist/api/client/index.d.mts +1 -1
- package/dist/api/client/index.d.ts +1 -1
- package/dist/api/client/index.js +6 -4
- package/dist/api/client/index.mjs +6 -4
- 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 +2 -2
- package/dist/api/client.gen.d.ts +2 -2
- package/dist/api/client.gen.js +5 -3
- package/dist/api/client.gen.mjs +5 -3
- package/dist/api/index.d.mts +94 -192
- package/dist/api/index.d.ts +94 -192
- package/dist/api/index.js +208 -249
- package/dist/api/index.mjs +187 -208
- package/dist/index.d.mts +82 -5
- package/dist/index.d.ts +82 -5
- package/dist/index.js +324 -256
- package/dist/index.mjs +303 -215
- package/dist/{types.gen-DDunhhsd.d.mts → types.gen-BltYeQS_.d.mts} +7 -7
- package/dist/{types.gen-DDunhhsd.d.ts → types.gen-BltYeQS_.d.ts} +7 -7
- package/dist/{types.gen-D7mQfhiG.d.mts → types.gen-DussKHRF.d.mts} +1366 -919
- package/dist/{types.gen-D7mQfhiG.d.ts → types.gen-DussKHRF.d.ts} +1366 -919
- 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
|
|
@@ -637,8 +637,9 @@ var createClient = (config = {}) => {
|
|
|
637
637
|
if (opts.body === void 0 || opts.serializedBody === "") {
|
|
638
638
|
opts.headers.delete("Content-Type");
|
|
639
639
|
}
|
|
640
|
-
const
|
|
641
|
-
|
|
640
|
+
const resolvedOpts = opts;
|
|
641
|
+
const url = buildUrl(resolvedOpts);
|
|
642
|
+
return { opts: resolvedOpts, url };
|
|
642
643
|
};
|
|
643
644
|
const request = async (options) => {
|
|
644
645
|
const { opts, url } = await beforeRequest(options);
|
|
@@ -789,8 +790,9 @@ var createClient = (config = {}) => {
|
|
|
789
790
|
url
|
|
790
791
|
});
|
|
791
792
|
};
|
|
793
|
+
const _buildUrl = (options) => buildUrl({ ..._config, ...options });
|
|
792
794
|
return {
|
|
793
|
-
buildUrl,
|
|
795
|
+
buildUrl: _buildUrl,
|
|
794
796
|
connect: makeMethodFn("CONNECT"),
|
|
795
797
|
delete: makeMethodFn("DELETE"),
|
|
796
798
|
get: makeMethodFn("GET"),
|
|
@@ -635,8 +635,9 @@ var createClient = (config = {}) => {
|
|
|
635
635
|
if (opts.body === void 0 || opts.serializedBody === "") {
|
|
636
636
|
opts.headers.delete("Content-Type");
|
|
637
637
|
}
|
|
638
|
-
const
|
|
639
|
-
|
|
638
|
+
const resolvedOpts = opts;
|
|
639
|
+
const url = buildUrl(resolvedOpts);
|
|
640
|
+
return { opts: resolvedOpts, url };
|
|
640
641
|
};
|
|
641
642
|
const request = async (options) => {
|
|
642
643
|
const { opts, url } = await beforeRequest(options);
|
|
@@ -787,8 +788,9 @@ var createClient = (config = {}) => {
|
|
|
787
788
|
url
|
|
788
789
|
});
|
|
789
790
|
};
|
|
791
|
+
const _buildUrl = (options) => buildUrl({ ..._config, ...options });
|
|
790
792
|
return {
|
|
791
|
-
buildUrl,
|
|
793
|
+
buildUrl: _buildUrl,
|
|
792
794
|
connect: makeMethodFn("CONNECT"),
|
|
793
795
|
delete: makeMethodFn("DELETE"),
|
|
794
796
|
get: makeMethodFn("GET"),
|
|
@@ -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-BltYeQS_.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-BltYeQS_.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
|
}
|
|
@@ -859,8 +859,9 @@ var createClient = (config = {}) => {
|
|
|
859
859
|
if (opts.body === void 0 || opts.serializedBody === "") {
|
|
860
860
|
opts.headers.delete("Content-Type");
|
|
861
861
|
}
|
|
862
|
-
const
|
|
863
|
-
|
|
862
|
+
const resolvedOpts = opts;
|
|
863
|
+
const url = buildUrl(resolvedOpts);
|
|
864
|
+
return { opts: resolvedOpts, url };
|
|
864
865
|
};
|
|
865
866
|
const request = async (options) => {
|
|
866
867
|
const { opts, url } = await beforeRequest(options);
|
|
@@ -1011,8 +1012,9 @@ var createClient = (config = {}) => {
|
|
|
1011
1012
|
url
|
|
1012
1013
|
});
|
|
1013
1014
|
};
|
|
1015
|
+
const _buildUrl = (options) => buildUrl({ ..._config, ...options });
|
|
1014
1016
|
return {
|
|
1015
|
-
buildUrl,
|
|
1017
|
+
buildUrl: _buildUrl,
|
|
1016
1018
|
connect: makeMethodFn("CONNECT"),
|
|
1017
1019
|
delete: makeMethodFn("DELETE"),
|
|
1018
1020
|
get: makeMethodFn("GET"),
|
|
@@ -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
|
}
|
|
@@ -857,8 +857,9 @@ var createClient = (config = {}) => {
|
|
|
857
857
|
if (opts.body === void 0 || opts.serializedBody === "") {
|
|
858
858
|
opts.headers.delete("Content-Type");
|
|
859
859
|
}
|
|
860
|
-
const
|
|
861
|
-
|
|
860
|
+
const resolvedOpts = opts;
|
|
861
|
+
const url = buildUrl(resolvedOpts);
|
|
862
|
+
return { opts: resolvedOpts, url };
|
|
862
863
|
};
|
|
863
864
|
const request = async (options) => {
|
|
864
865
|
const { opts, url } = await beforeRequest(options);
|
|
@@ -1009,8 +1010,9 @@ var createClient = (config = {}) => {
|
|
|
1009
1010
|
url
|
|
1010
1011
|
});
|
|
1011
1012
|
};
|
|
1013
|
+
const _buildUrl = (options) => buildUrl({ ..._config, ...options });
|
|
1012
1014
|
return {
|
|
1013
|
-
buildUrl,
|
|
1015
|
+
buildUrl: _buildUrl,
|
|
1014
1016
|
connect: makeMethodFn("CONNECT"),
|
|
1015
1017
|
delete: makeMethodFn("DELETE"),
|
|
1016
1018
|
get: makeMethodFn("GET"),
|
|
@@ -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-BltYeQS_.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-BltYeQS_.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-BltYeQS_.mjs';
|
|
2
|
+
import { ag as ClientOptions$1 } from '../types.gen-DussKHRF.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The `createClientConfig()` function will be called on client initialization
|
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-BltYeQS_.js';
|
|
2
|
+
import { ag as ClientOptions$1 } from '../types.gen-DussKHRF.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The `createClientConfig()` function will be called on client initialization
|
package/dist/api/client.gen.js
CHANGED
|
@@ -637,8 +637,9 @@ var createClient = (config = {}) => {
|
|
|
637
637
|
if (opts.body === void 0 || opts.serializedBody === "") {
|
|
638
638
|
opts.headers.delete("Content-Type");
|
|
639
639
|
}
|
|
640
|
-
const
|
|
641
|
-
|
|
640
|
+
const resolvedOpts = opts;
|
|
641
|
+
const url = buildUrl(resolvedOpts);
|
|
642
|
+
return { opts: resolvedOpts, url };
|
|
642
643
|
};
|
|
643
644
|
const request = async (options) => {
|
|
644
645
|
const { opts, url } = await beforeRequest(options);
|
|
@@ -789,8 +790,9 @@ var createClient = (config = {}) => {
|
|
|
789
790
|
url
|
|
790
791
|
});
|
|
791
792
|
};
|
|
793
|
+
const _buildUrl = (options) => buildUrl({ ..._config, ...options });
|
|
792
794
|
return {
|
|
793
|
-
buildUrl,
|
|
795
|
+
buildUrl: _buildUrl,
|
|
794
796
|
connect: makeMethodFn("CONNECT"),
|
|
795
797
|
delete: makeMethodFn("DELETE"),
|
|
796
798
|
get: makeMethodFn("GET"),
|
package/dist/api/client.gen.mjs
CHANGED
|
@@ -635,8 +635,9 @@ var createClient = (config = {}) => {
|
|
|
635
635
|
if (opts.body === void 0 || opts.serializedBody === "") {
|
|
636
636
|
opts.headers.delete("Content-Type");
|
|
637
637
|
}
|
|
638
|
-
const
|
|
639
|
-
|
|
638
|
+
const resolvedOpts = opts;
|
|
639
|
+
const url = buildUrl(resolvedOpts);
|
|
640
|
+
return { opts: resolvedOpts, url };
|
|
640
641
|
};
|
|
641
642
|
const request = async (options) => {
|
|
642
643
|
const { opts, url } = await beforeRequest(options);
|
|
@@ -787,8 +788,9 @@ var createClient = (config = {}) => {
|
|
|
787
788
|
url
|
|
788
789
|
});
|
|
789
790
|
};
|
|
791
|
+
const _buildUrl = (options) => buildUrl({ ..._config, ...options });
|
|
790
792
|
return {
|
|
791
|
-
buildUrl,
|
|
793
|
+
buildUrl: _buildUrl,
|
|
792
794
|
connect: makeMethodFn("CONNECT"),
|
|
793
795
|
delete: makeMethodFn("DELETE"),
|
|
794
796
|
get: makeMethodFn("GET"),
|