You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: explainer.md
+1-58Lines changed: 1 addition & 58 deletions
Original file line number
Diff line number
Diff line change
@@ -32,64 +32,7 @@ To balance this tension we propose an API with the following key properties:
32
32
33
33
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)).
34
34
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:
if (typeofwindow.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
-
constoid4vp= {
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
-
constcontroller=newAbortController();
66
-
67
-
// Call the Digital Credentials API using the presentation request from the backend
68
-
let dcResponse =awaitnavigator.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/).
0 commit comments