@inrupt/solid-client-vc / lookup/query
Module: lookup/query#
Type Aliases#
QueryByExample#
Ƭ QueryByExample: Object
Based on https://w3c-ccg.github.io/vp-request-spec/#query-by-example.
Type declaration#
Name |
Type |
---|---|
|
{ |
|
|
Defined in#
src/lookup/query.ts:33
VerifiablePresentationRequest#
Ƭ VerifiablePresentationRequest: Object
A VP request is a standard way of getting a Verifiable Presentation matching the requestor’s needs.
Note: Currently, only the QueryByExample type is implemented, but support for other query types may be added in the future.
Type declaration#
Name |
Type |
---|---|
|
|
|
|
|
Defined in#
src/lookup/query.ts:58
Functions#
query#
▸ query(queryEndpoint
, vpRequest
, options?
): Promise
<VerifiablePresentation
>
Send a Verifiable Presentation Request to a query endpoint in order to retrieve all Verifiable Credentials matching the query, wrapped in a single Presentation.
Parameters#
Name |
Type |
Description |
---|---|---|
|
|
URL of the query endpoint. |
|
VP Request object, compliant with https://w3c-ccg.github.io/vp-request-spec |
|
|
|
Options object, including an authenticated |
Returns#
Promise
<VerifiablePresentation
>
The resulting Verifiable Presentation wrapping all the Credentials matching the query.
Example
The following shows how to query for credentials of a certain type. Adding a reason to the request is helpful when interacting with a user. The resulting Verifiable Presentation will wrap zero or more Verifiable Credentials.
const verifiablePresentation = await query(
"https://example.org/query", {
query: [{
type: "QueryByExample",
credentialQuery: [
{
reason: "Some reason",
example: {
type: ["SomeCredentialType"],
},
},
],
}]
},
{ fetch: session.fetch }
);
Defined in#
src/lookup/query.ts:96