@eudiplo/sdk-core 1.14.0-main.6616ca1 → 1.14.0-main.748e526
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 -0
- package/dist/api/client/client.gen.d.mts +5 -0
- package/dist/api/client/client.gen.d.ts +5 -0
- package/dist/api/client/client.gen.js +823 -0
- package/dist/api/client/client.gen.mjs +821 -0
- package/dist/api/client/index.d.mts +58 -0
- package/dist/api/client/index.d.ts +58 -0
- package/dist/api/client/index.js +1052 -0
- package/dist/api/client/index.mjs +1043 -0
- package/dist/api/client/types.gen.d.mts +1 -0
- package/dist/api/client/types.gen.d.ts +1 -0
- package/dist/api/client/types.gen.js +4 -0
- package/dist/api/client/types.gen.mjs +3 -0
- package/dist/api/client.gen.d.mts +15 -0
- package/dist/api/client.gen.d.ts +15 -0
- package/dist/api/client.gen.js +828 -0
- package/dist/api/client.gen.mjs +826 -0
- package/dist/api/index.d.mts +26 -2735
- package/dist/api/index.d.ts +26 -2735
- package/dist/api/index.js +47 -1
- package/dist/api/index.mjs +43 -2
- package/dist/index.d.mts +146 -3
- package/dist/index.d.ts +146 -3
- package/dist/index.js +225 -1
- package/dist/index.mjs +217 -2
- package/dist/types.gen-DDunhhsd.d.mts +328 -0
- package/dist/types.gen-DDunhhsd.d.ts +328 -0
- package/dist/types.gen-KKg4o5Hj.d.mts +2687 -0
- package/dist/types.gen-KKg4o5Hj.d.ts +2687 -0
- package/package.json +11 -1
package/README.md
CHANGED
|
@@ -82,6 +82,60 @@ await waitForCompletion();
|
|
|
82
82
|
| `verifyAndWait(options)` | One-liner: create request + wait for result |
|
|
83
83
|
| `issueAndWait(options)` | One-liner: create offer + wait for result |
|
|
84
84
|
|
|
85
|
+
### Digital Credentials API (Browser Native)
|
|
86
|
+
|
|
87
|
+
The SDK includes utilities for the [Digital Credentials API](https://wicg.github.io/digital-credentials/), enabling browser-native credential presentation without QR codes.
|
|
88
|
+
|
|
89
|
+
```typescript
|
|
90
|
+
import { isDcApiAvailable, verifyWithDcApi } from '@eudiplo/sdk-core';
|
|
91
|
+
|
|
92
|
+
// Check if browser supports DC API
|
|
93
|
+
if (isDcApiAvailable()) {
|
|
94
|
+
const result = await verifyWithDcApi({
|
|
95
|
+
baseUrl: 'https://eudiplo.example.com',
|
|
96
|
+
clientId: 'my-demo',
|
|
97
|
+
clientSecret: 'secret',
|
|
98
|
+
configId: 'age-over-18',
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
console.log('Verified!', result.session.credentials);
|
|
102
|
+
} else {
|
|
103
|
+
// Fall back to QR code flow
|
|
104
|
+
const session = await verifyAndWait({...});
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
#### DC API Functions
|
|
109
|
+
|
|
110
|
+
| Function | Description |
|
|
111
|
+
| ---------------------- | --------------------------------------------------- |
|
|
112
|
+
| `isDcApiAvailable()` | Check if browser supports Digital Credentials API |
|
|
113
|
+
| `verifyWithDcApi()` | Complete verification flow using browser-native API |
|
|
114
|
+
| `createDcApiRequest()` | Create a `DigitalCredentialRequestOptions` object |
|
|
115
|
+
|
|
116
|
+
#### Lower-level DC API Usage
|
|
117
|
+
|
|
118
|
+
```typescript
|
|
119
|
+
import { createDcApiRequest, EudiploClient } from '@eudiplo/sdk-core';
|
|
120
|
+
|
|
121
|
+
const client = new EudiploClient({...});
|
|
122
|
+
|
|
123
|
+
// Create presentation request
|
|
124
|
+
const { uri, sessionId } = await client.createPresentationRequest({
|
|
125
|
+
configId: 'age-over-18',
|
|
126
|
+
responseType: 'dc-api',
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
// Create the browser request object
|
|
130
|
+
const request = createDcApiRequest(uri);
|
|
131
|
+
|
|
132
|
+
// Call the browser API directly
|
|
133
|
+
const credential = await navigator.credentials.get(request);
|
|
134
|
+
|
|
135
|
+
// Submit the response and get verified session
|
|
136
|
+
const session = await client.submitDcApiResponse(sessionId, credential);
|
|
137
|
+
```
|
|
138
|
+
|
|
85
139
|
### Class-based API (More Control)
|
|
86
140
|
|
|
87
141
|
```typescript
|