Skip to content

Commit 2b4485f

Browse files
committed
Add example doc requests to server readme
1 parent 2e8d18f commit 2b4485f

1 file changed

Lines changed: 90 additions & 0 deletions

File tree

packages/server/README.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ verification.
77
- [Node LTS 22.x and higher](#node-lts-22x-and-higher)
88
- [Deno 2.1 and higher](#deno-21-and-higher)
99
- [Usage](#usage)
10+
- [Example Presentation Requests](#example-presentation-requests)
1011

1112
## Installation
1213

@@ -69,3 +70,92 @@ const verified = await verifyPresentationResponse({
6970

7071
`verified.credential1.claims` will contain any verified claims contained in the presented
7172
credential.
73+
74+
## Example Presentation Requests
75+
76+
This library offers a respectable amount of flexibility to define desired claims when requesting an
77+
mdoc or SD-JWT-VC presentation. See below for some ideas of values suitable as `credentialOptions`
78+
when calling `generatePresentationRequest()`:
79+
80+
```ts
81+
import type {
82+
OID4VPMDLCredentialOptions,
83+
OID4VPMdocCredentialOptionsFull,
84+
OID4VPMdocCredentialOptionsSimple,
85+
OID4VPSDJWTVCCredentialOptions,
86+
} from '@simpledigicreds/server';
87+
```
88+
89+
```ts
90+
// A streamlined mDL request
91+
const mdlRequest: OID4VPMDLCredentialOptions = {
92+
format: 'mdl',
93+
desiredClaims: ['family_name', 'given_name'],
94+
};
95+
```
96+
97+
```ts
98+
// A simple European PID mdoc request
99+
const mdocPIDRequest: OID4VPMdocCredentialOptionsSimple = {
100+
format: 'mdoc',
101+
doctype: 'eu.europa.ec.eudi.pid.1',
102+
claimPathPrefix: 'eu.europa.ec.eudi.pid.1',
103+
desiredClaims: ['family_name', 'given_name', 'nationality'],
104+
};
105+
```
106+
107+
```ts
108+
// A simple EMVCo payment card mdoc request
109+
const mdocEMVCORequest: OID4VPMdocCredentialOptionsSimple = {
110+
format: 'mdoc',
111+
doctype: 'com.emvco.payment_card',
112+
claimPathPrefix: 'com.emvco.payment_card.1',
113+
desiredClaims: ['card_number', 'card_network', 'expiry_year', 'expiry_month'],
114+
};
115+
```
116+
117+
```ts
118+
// A simple mVRC mdoc request
119+
const mdocMVRCRequest: OID4VPMdocCredentialOptionsSimple = {
120+
format: 'mdoc',
121+
doctype: 'org.iso.7367.1.mVRC',
122+
claimPathPrefix: 'org.iso.18013.5.1',
123+
desiredClaims: ['registration_number', 'date_of_registration', 'vehicle_holder'],
124+
};
125+
```
126+
127+
```ts
128+
// An mdoc request with claims across multiple namespaces
129+
const mdocRequestFull: OID4VPMdocCredentialOptionsFull = {
130+
format: 'mdoc',
131+
doctype: 'org.iso.7367.1.mVRC',
132+
desiredClaims: [
133+
['org.iso.23220.1', 'issue_date'],
134+
['org.iso.23220.1', 'issuing_authority_unicode'],
135+
['org.iso.7367.1', 'vehicle_holder'],
136+
['org.iso.7367.1', 'registration_number'],
137+
],
138+
};
139+
```
140+
141+
```ts
142+
// A simple European PID SD-JWT-VC request
143+
const sdjwtvcRequest: OID4VPSDJWTVCCredentialOptions = {
144+
format: 'sd-jwt-vc',
145+
desiredClaims: ['family_name', 'given_name'],
146+
acceptedVCTValues: ['urn:eu.europa.ec.eudi:pid:1', 'urn:eudi:pid:1'],
147+
};
148+
```
149+
150+
```ts
151+
// A more complex SD-JWT-VC request with a mix of single-path and multi-path claims
152+
const sdjwtvcRequestComplex: OID4VPSDJWTVCCredentialOptions = {
153+
format: 'sd-jwt-vc',
154+
desiredClaims: [
155+
'given_name',
156+
'family_name',
157+
['age_equal_or_over', '18'],
158+
],
159+
acceptedVCTValues: ['urn:eudi:pid:1'],
160+
};
161+
```

0 commit comments

Comments
 (0)