Skip to content

Commit d7559c6

Browse files
docs(explainer.md): remove example. Point to spec. (#309)
1 parent 7b39d26 commit d7559c6

File tree

1 file changed

+1
-58
lines changed

1 file changed

+1
-58
lines changed

explainer.md

Lines changed: 1 addition & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -32,64 +32,7 @@ To balance this tension we propose an API with the following key properties:
3232

3333
At its core, the API is designed for a website ("verifier") to [transparently](https://github.com/w3cping/credential-considerations/blob/main/credentials-considerations.md#in-context-explanations) request the [selective disclosure](https://github.com/w3cping/credential-considerations/blob/main/credentials-considerations.md#selective-disclosure) of attributes from (issued) digital credentials that were provisioned - ahead of time - to wallets ("holders"), in a manner that is seamlessly compatible with existing architectural choices (such as [OpenID4VP integration](https://github.com/openid/OpenID4VP/issues/125)).
3434

35-
Here is an example of how the  the API might be used in practice:
36-
37-
The API needs to be initiated through a user gesture, such as a button click:
38-
39-
```html
40-
<button onclick="requestCredential()">Request Driver's license<button>
41-
```
42-
43-
44-
```javascript
45-
async function requestCredential() {
46-
47-
// Check for Digital Credentials API support
48-
if (typeof window.DigitalCredential !== 'undefined') {
49-
50-
try {
51-
52-
// These parameters are typically fetched from the backend.
53-
// Statically defined here for protocol extensibility illustration purposes.
54-
const oid4vp = {
55-
protocol: "oid4vp", // An example of an OpenID4VP request to wallets. // Based on https://github.com/openid/OpenID4VP/issues/125
56-
data: {
57-
nonce: "n-0S6_WzA2Mj",
58-
presentation_definition: {
59-
//Presentation Exchange request, omitted for brevity
60-
},
61-
},
62-
};
63-
64-
// create an Abort Controller
65-
const controller = new AbortController();
66-
67-
// Call the Digital Credentials API using the presentation request from the backend
68-
let dcResponse = await navigator.credentials.get({
69-
signal: controller.signal,
70-
mediation: "required",
71-
digital: {
72-
requests: [ oid4vp ]
73-
}
74-
});
75-
76-
// Send the encrypted response to the backend for decryption and verification
77-
// Ommitted for brevity
78-
79-
} catch (error) {
80-
console.error('Error:', error);
81-
}
82-
} else {
83-
84-
// fallback scenario, illustrative only
85-
alert("The Digital Credentials API is not supported in this browser.")
86-
}
87-
};
88-
```
89-
90-
> Example from: https://digitalcredentials.dev/docs/verifier-site/requesting-cred
91-
92-
You can read a more detailed and technical description of the API in the [specification draft](https://w3c-fedid.github.io/digital-credentials/).
35+
For an [example of how to use the API](https://w3c-fedid.github.io/digital-credentials/#example-requesting-a-digital-credential) and a more detailed technical description, please refer to the [specification draft](https://www.w3.org/TR/digital-credentials/).
9336

9437
### Using the API from another origin
9538

0 commit comments

Comments
 (0)