/derive Endpoint
Warning
As of ESS 2.3, this endpoint has been deprecated. Please use the /query
endpoint instead.
ESS supports an authorization mechanism based on Access Requests and Grants.
ESS serializes the access requests and grants as Verifiable Credentials (VCs) and provides an endpoint that queries Access Requests/Grants VCs and returns the matching VCs in a Verifiable Presentation (VP).
/derive
Endpoint
/derive
EndpointThe ESS Access Grant Service provides an endpoint with the following URL:
https://vc.<ESS DOMAIN>/derive
To query for /derive Access Requests/Grants, clients can send a derivation request to the endpoint:
Method
POST
Content-Type
application/json
Endpoint
https://vc.<ESS DOMAIN>/derive
Payload
Derivation request object.
Behavior
The ESS’ /derive
endpoint implements the derive credential portion of the VC API specification with the following exceptions:
ESS’
/derive
endpoint returns a VP instead of a VC.ESS’
/derive
endpoint, by default, excludes both expired VCs (i.e., VCs withexpirationDate
in the past) and future VCs (i.e., VCs withissuanceDate
in the future). To override, see options.
The endpoint queries the user-associated Access Requests/Grants (regardless of revocation status) to return a VP that contains the matching Access Requests/Grants VCs.
User-associated Access Requests are requests that have either:
The
credentialSubject.id
set to the user’s WebID (i.e., the request is created by the user); orThe
credentialSubject.hasConsent.isConsentForDataSubject
set to the user’s WebID (i.e., the request is made to the user).
User-associated Access Grants are grants that have either:
The
credentialSubject.id
set to the user’s WebID (i.e., the grant is created by the user); orThe
credentialSubject.providedConsent.isProvidedTo
set to the user’s WebID (i.e., the grant is given to the user).
Input: Verifiable Credential
The endpoint accepts a JSON document of the form:
{
"verifiableCredential": <VC to filter/query by>,
"options": {
"include": "ExpiredVerifiableCredential"
}
}
verifiableCredential
Specify a filter Access Requests/Grants VC. The filter VC acts similarly to a “search-by-example” model and can be minimal (i.e., can be missing fields or have empty values such as an empty array, an empty document) or comprehensive. However, if any of the following field paths appear in the filter VC and are non-empty, ESS Access Grant Services uses these non-empty field paths to filter Access Requests/Grants VCs:
options
Optional. Specify the "include": "ExpiredVerifiableCredential"
option to include expired VCs and future VCs in the returned VP.
"options": {
"include": "ExpiredVerifiableCredential"
}
Omit to exclude the expired and future VCs.
If you specify a different option or value (such as "include": "ExpiredVerifiableCredentials"
with an s
), the endpoint ignores the option and excludes the expired and future VCs.
Filter Paths
id
id
If the id
field is present in the filter Access Requests/Grants VC, the ESS Access Grant Service considers the field for filtering user-associated Access Requests/Grants.
"id": <value>
If the id
(i.e., the URL) of an access request/grant is known, you can use the id
filter field to return a specific Access Requests/Grants in the output.
A user can also directly fetch an Access Requests/Grants (if associated with the user) by its id
(i.e., URL). If fetching directly, the returned object is the VC instead of a VP.
type
type
If the type
field is present in the filter Access Requests/Grants VC, the ESS Access Grant Service considers the field for filtering user-associated Access Requests/Grants VCs.
"type": <value(s)>
You can use the type
field to query specifically for access requests or specifically for access grants.
For Access Requests
To query for Access Requests, you can specify filter "type": [ "SolidAccessRequest" ]
:
"type": [ "SolidAccessRequest" ]
For Access Grants
To query for Access Grants, you can specify "type": [ "SolidAccessGrant" ]
:
"type": [ "SolidAccessGrant" ]
credentialSubject
credentialSubject
If the credentialSubject
field is present in the filter Access Requests/Grants VC, and is not empty (i.e., it is not an empty document and contains at least one non-empty field path) , the ESS Access Grant Service considers the non-empty credentialSubject
field paths to filter user-associated VCs.
"credentialSubject": {
"id": <value>,
<"hasConsent"|"providedConsent">: {
//...
}
}
For Access Request VCs
In Access Requests, the credentialSubject
field contains an id
field and a credentialSubject.hasConsent
field. When querying for Access Requests, you can query by any non-empty combination of the fields.
"credentialSubject": {
"id": <value>, // The requestor's WebID
"hasConsent": {
"mode": <value or array of values>
"hasStatus": <value>,
"isConsentForDataSubject": <value>, // The resource owner's WebID
"forPersonalData": <value or array of values>,
"forPurpose": <value or array of values>
}
}
For Access Grant VCs
In Access Grants, the credentialSubject
field contains an id
field and a credentialSubject.providedConsent
field. When querying for Access Grants, you can query by any non-empty combination of the fields.
"credentialSubject": {
"id": <value>, // The resource owner(grantor)'s WebID
"providedConsent": {
"mode": <value or array of values>,
"hasStatus": <value>,
"isProvidedTo": <value>, // The grant recipient's WebID
"forPersonalData": <value or array of values>,
"forPurpose": <value or array of values>
}
}
Empty credentialSubject
ESS Access Grant Service only considers non-empty credentialSubject
field paths to filter user-associated Access Requests/Grants. Empty credentialSubject
field paths are not considered as part of the filter. Examples of empty credentialSubject
field paths are:
"credentialSubject": {
}
"credentialSubject": {
"hasConsent": {}
}
"credentialSubject": {
"hasConsent": {
"mode": [],
"forPersonalData": []
}
}
"credentialSubject": {
"providedConsent": { }
}
"credentialSubject": {
"providedConsent": {
"mode": []
}
}
issuer
issuer
If the issuer
field is present in the filter Access Requests/Grants VC, the ESS Access Grant Service considers the field for filtering user-associated Access Requests/Grants VCs.
"issuer": <value>
Output: Verifiable Presentation
The /derive
endpoint returns a Verifiable Presentation containing the matching Access Requests/Grants VCs:
{
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://w3id.org/security/data-integrity/v1",
"https://w3id.org/security/suites/ed25519-2020/v1"
],
"holder": "https://vc.<ESS Domain>",
"type": "VerifiablePresentation",
"verifiableCredential": [
{ // Matching access request/grant VC },
{ // Matching access request/grant VC },
...
]
}
Examples
ESS Access Grant Service performs a match on non-empty id
, credentialSubject
, issuer
, and type
field paths present in the filter VCs.
Example 1
The following filter queries for user-associated Access Grants where owliverowner
grants Read
access to requestingrabbit
.
{
"verifiableCredential": {
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://schema.inrupt.com/credentials/v1.jsonld"
],
"type": [
"VerifiableCredential",
"SolidAccessGrant"
],
"credentialSubject": {
"providedConsent": {
"mode": [ "Read" ],
"hasStatus": "ConsentStatusExplicitlyGiven",
"isProvidedTo": "https://id.<ESS DOMAIN>/requestingrabbit"
},
"id": "https://id.<ESS DOMAIN>/owliverowner"
}
}
}
The filter’s verifiableCredential
field contains the following non-empty fields for matching user-associated Access Grants:
type
that matches an array that includes both"VerifiableCredential"
and"SolidAccessGrant"
as elements, ANDcredentialSubject.providedConsent
.mode
that matches the value"Read"
, AND.hasStatus
that matches the value"ConsentStatusExplicitlyGiven"
, AND.isProvidedTo
that matches the value"https://id.<ESS DOMAIN>/requestingrabbit"
, AND
credentialSubject.id
that matches the value"https://id.<ESS DOMAIN>/owliverowner"
.
For owliverowner
or requestingrabbit
, the endpoint returns a VP with the matching Access Grants.
For other users, the endpoint returns a VP with no matching Access Grants.
Or the field matches an array that includes the specified values as elements.
Example 2
The following filter queries for user-associated Access Grants that gives Write
access to the specified resource.
{
"verifiableCredential": {
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://schema.inrupt.com/credentials/v1.jsonld"
],
"type": [
"SolidAccessGrant"
],
"credentialSubject": {
"providedConsent": {
"mode": "http://www.w3.org/ns/auth/acl#Write",
"forPersonalData": [
"https://storage.<ESS Domain>/<Root Container>/getting-started/readingList/myList"
]
}
}
}
}
The filter’s verifiableCredential
field contains the following non-empty fields for matching:
type
that matches"SolidAccessGrant"
value as an element, ANDcredentialSubject.providedConsent
.mode
that matches the value"http://www.w3.org/ns/auth/acl#Write"
, AND.forPersonalData
that matches the value"https://storage.<ESS Domain>/<Root Container>/getting-started/readingList/myList"
.
When the filter is posted to the /derive
endpoint by either the resource owner of the reading list or by a user who has been granted access to that reading list:
For the resource owner, the endpoint returns a VVP with all the matching Access Grants given by the resource owner for that resource (regardless of the recipients).
For a user who is a recipient, the endpoint returns a VP with all the matching Access Grants given to the user for that resource.
For other users, the endpoint returns a VP with no matching Access Grants.
Upon completion, the endpoint returns a VP with the matching VCs.
Or the field matches an array that includes the specified values as elements.
Empty Filter Paths
ESS Access Grant service performs a match only on non-empty id
, credentialSubject
, issuer
, and type
field paths. Otherwise, the service returns all Access Requests/Grants associated with the user.
For example, when the following payloads are posted to the /derive
endpoint:
The filter’s
verifiableCredential
field is an empty document; i.e., the filter VC does not contain any of the fields used for matching:{ "verifiableCredential": { } }
This would match all Access Requests VCs and Access Grants VCs associated with the user.
The filter’s
verifiableCredential
containstype
value of"VerifiableCredential"
and empty values for the query fieldcredentialSubject.hasConsent
and no other filtering fields. As such, the filter VC does not have any non-empty matching filter paths{ "verifiableCredential": { "@context": [ "https://www.w3.org/2018/credentials/v1", "https://schema.inrupt.com/credentials/v1.jsonld" ], "type": [ "VerifiableCredential" ], "credentialSubject": { "hasConsent": { } } } }
This would match all Access Requests VCs and Access Grants VCs associated with the user.
The filter’s
verifiableCredential
containstype
value of"VerifiableCredential"
and an empty values for the query fieldcredentialSubject.providedConsent
and no other filtering fields:{ "verifiableCredential": { "@context": [ "https://www.w3.org/2018/credentials/v1", "https://schema.inrupt.com/credentials/v1.jsonld", "https://w3id.org/security/data-integrity/v1", "https://w3id.org/vc-revocation-list-2020/v1", "https://w3id.org/vc/status-list/2021/v1", "https://w3id.org/security/suites/ed25519-2020/v1" ], "credentialStatus": { "id": "https://vc./status/VfaR#98", "revocationListCredential": "https://vc.<ESS DOMAIN>/status/VfaR", "revocationListIndex": "98", "type": "RevocationList2020Status" }, "credentialSubject": { "providedConsent": { } }, "type": [ "VerifiableCredential" ] } }
Upon completion, the endpoint returns a VP with the matching VCs; in this case, all Access Requests VCs and Access Grants VCs associated with the user.
The VC API specification is in Draft status. Features based on draft specifications are subject to change.
Last updated