Credentials

Credentials Management

1. Send a Credential

To send a credential to another profile, use the sendCredential method. This method accepts a profileId, a vc object (which can be an UnsignedVC or VC), and an optional encrypt parameter.

const profileId = 'janesmith';
const vc = await networkLearnCard.invoke.issueCredential(networkLearnCard.invoke.newCredential())
const encrypt = true;

learnCard.invoke.sendCredential(profileId, vc, encrypt);

2. Accept a Credential

To accept a credential, use the acceptCredential method. This method accepts a uri parameter.

const uri = 'your_credential_uri';

learnCard.invoke.acceptCredential(uri);

3. Get Received Credentials

To retrieve all received credentials, use the getReceivedCredentials method. This method accepts an optional from parameter.

const from = 'johnsmith';

learnCard.invoke.getReceivedCredentials(from);

4. Get Sent Credentials

To retrieve all sent credentials, use the getSentCredentials method. This method accepts an optional to parameter.

const to = 'janesmith';

learnCard.invoke.getSentCredentials(to);

5. Get Incoming Credentials

To retrieve all incoming credentials, use the getIncomingCredentials method. This method accepts an optional from parameter.

const from = 'johnsmith';

learnCard.invoke.getIncomingCredentials(from);

6. Delete a Credential

To delete a credential, use the deleteCredential method. This method accepts a uri parameter.

const uri = 'your_credential_uri';

learnCard.invoke.deleteCredential(uri);

Last updated