Skip to main content

Credentials

These methods let a cloud wallet receive and manage credentials: look at a credential offer, accept or decline it, and list or delete stored credentials. They act on one wallet, so create the CloudWallet with that wallet's access token (see Authentication).

Most methods take a protocol: use 'openid' for EU Digital Identity credentials and 'didcomm' for cheqd and Indicio credentials.

Resolve credential offer URI​

Reads an EU Digital Identity credential offer URI (resolveOpenIdUri) and returns the offer's details.

import { CloudWallet } from '@hovi/cloudwallet-sdk';

const wallet = new CloudWallet({
walletAccessToken: '<WALLET_ACCESS_TOKEN>',
apiBaseUrl: 'https://cloudwallet.hovi.id',
});

const result = await wallet.resolveOpenIdUri({
protocol: 'openid',
credentialOfferUri: '<CREDENTIAL_OFFER_URI>',
});

Params​

ParameterTypeDescription
protocolstring (Required)Use openid.
credentialOfferUristring (Required)The credential offer URI from the issuer, for example from a QR code.

Preview credential offer​

Shows what a credential offer contains, before the wallet accepts or declines it.

import { CloudWallet } from '@hovi/cloudwallet-sdk';

const wallet = new CloudWallet({
walletAccessToken: '<WALLET_ACCESS_TOKEN>',
apiBaseUrl: 'https://cloudwallet.hovi.id',
});

const result = await wallet.previewCredentialOffer({
protocol: 'openid',
credentialOfferUri: '<CREDENTIAL_OFFER_URI>',
});

Params​

ParameterTypeDescription
protocolstring (Required)openid or didcomm.
credentialOfferUristring (Optional)EU Digital Identity: the credential offer URI.
credentialIdstring (Optional)cheqd and Indicio: the ID of the credential offer the wallet received.
connectionIdstring (Optional)cheqd and Indicio: the ID of the connection the offer came over.

Accept credential offer​

Accepts a credential offer and stores the credential in the wallet.

import { CloudWallet } from '@hovi/cloudwallet-sdk';

const wallet = new CloudWallet({
walletAccessToken: '<WALLET_ACCESS_TOKEN>',
apiBaseUrl: 'https://cloudwallet.hovi.id',
});

const result = await wallet.acceptCredentialOffer({
protocol: 'openid',
credentialOfferUri: '<CREDENTIAL_OFFER_URI>',
// Only if the issuer asked for a transaction code (PIN):
preAuthorizedFlowOptions: { transactionCode: '<TRANSACTION_CODE>' },
});

Params​

ParameterTypeDescription
protocolstring (Required)openid or didcomm.
credentialOfferUristring (Optional)EU Digital Identity: the credential offer URI.
credentialIdstring (Optional)cheqd and Indicio: the ID of the credential offer to accept.
codeflowstring (Optional)EU Digital Identity: the issuance flow of the offer.
preAuthorizedFlowOptions{ transactionCode: string } (Optional)EU Digital Identity: the transaction code (PIN), if the issuer asked for one.
authorizationFlowOptionsobject (Optional)EU Digital Identity: options for the authorization code flow.

The response contains the stored credential: its id, credentialType, attributes and issuanceDate.

Decline credential offer​

Declines a credential offer. The credential isn't stored.

import { CloudWallet } from '@hovi/cloudwallet-sdk';

const wallet = new CloudWallet({
walletAccessToken: '<WALLET_ACCESS_TOKEN>',
apiBaseUrl: 'https://cloudwallet.hovi.id',
});

const result = await wallet.declineCredentialOffer({
protocol: 'didcomm',
credentialId: '<CREDENTIAL_ID>',
});

Params​

ParameterTypeDescription
protocolstring (Required)openid or didcomm.
credentialIdstring (Required)The ID of the credential offer to decline.

Delete credential​

Deletes a stored credential from the wallet.

import { CloudWallet } from '@hovi/cloudwallet-sdk';

const wallet = new CloudWallet({
walletAccessToken: '<WALLET_ACCESS_TOKEN>',
apiBaseUrl: 'https://cloudwallet.hovi.id',
});

const result = await wallet.deleteCredential({
credentialId: '<CREDENTIAL_ID>',
});

Params​

ParameterTypeDescription
credentialIdstring (Required)The ID of the credential to delete.
note
  • This can't be undone.

Get credential offers​

Lists the credential offers the wallet has received.

import { CloudWallet } from '@hovi/cloudwallet-sdk';

const wallet = new CloudWallet({
walletAccessToken: '<WALLET_ACCESS_TOKEN>',
apiBaseUrl: 'https://cloudwallet.hovi.id',
});

const result = await wallet.getCredentialOffers();

Get stored credentials​

Lists the credentials stored in the wallet.

import { CloudWallet } from '@hovi/cloudwallet-sdk';

const wallet = new CloudWallet({
walletAccessToken: '<WALLET_ACCESS_TOKEN>',
apiBaseUrl: 'https://cloudwallet.hovi.id',
});

const result = await wallet.getStoredCredentials();