-
Notifications
You must be signed in to change notification settings - Fork 37
Description
Problem Statement
The top level properties of the request object that are passed into the Digital Credentials API (via the data property), are different for signed and unsigned requests. For example, a signed request only has payload and signature while an unsigned request has a completely different set of properties.
For implementers, the only way to know whether the request is signed or unsigned is to do some implicit matching based on the properties which are present at the top level of the data object (e.g. look for payload or signature). This doesn't scale well, can be error prone, and thus makes implementation more challenging.
Proposal
The loose consensus from the 2024-11-13 Digital Credentials API call was to bring this issue forward for discussion in the DCP WG: w3c-fedid/digital-credentials#185.
The proposal in the issue is to use different protocol strings when the top level structure is different. So for OID4VP, for signed vs unsigned requests, openid4vp-signed and openid4vp-unsigned respectively.
const credential = await navigator.credentials.get({
digital: {
providers: [{
protocol: "openid4vp-signed",
data: {
"payload": "eyAiaXNzIjogImh0dHBzOi8...NzY4Mzc4MzYiIF0gfQ",
"signatures": [
{
"protected": "eyJhbGciOiJFUzI1NiJ9",
"header": {
"client_id": "987647789",
"client_id_scheme": "x509_san_dns"
},
"signature": "PFwem0Ajp2Sag...T2z784h8TQqgTR9tXcif0jw"
}
]
}
}
]
}
});Alternative Proposal
An alternative would be to have an additional top level property for the DigitalCredentialsRequest object, such as requestType, which would be an enum of values appropriate to the protocol (and would be part of the registry).
const credential = await navigator.credentials.get({
digital: {
providers: [{
protocol: "openid4vp",
requestType: "signed",
data: {
"payload": "eyAiaXNzIjogImh0dHBzOi8...NzY4Mzc4MzYiIF0gfQ",
"signatures": [
{
"protected": "eyJhbGciOiJFUzI1NiJ9",
"header": {
"client_id": "987647789",
"client_id_scheme": "x509_san_dns"
},
"signature": "PFwem0Ajp2Sag...T2z784h8TQqgTR9tXcif0jw"
}
]
}
}
]
}
});