vc-sdk
v0.0.6
Published
### Installation: `yarn add lit-vc-sdk`
Downloads
5
Readme
Lit Verifiable Credentials SDK
Installation:
yarn add lit-vc-sdk
npm install lit-vc-sdk
Usage
The lit-vc-sdk uses Ceramic to store conditions. By default, the SDK connects to the Ceramic Clay Testnet. This can be changed
by adding CERAMIC_NETWORK="<your desired network address>"
to the .env
Planned functions and status (Sept 2022)
Issuer Functions
| Function | Description | Status | |----------------------------------------------|-----------------------------------------------------------|----------| | issueCredential | issue and sign a verifiable credential (VC) to a receiver | beta | | revokeCredential | revoke previously issues credential | not done |
Receiver/User Functions
| Function | Description | Status | |--------------------------------------------------------|-----------------------------------------------------------|----------| | verifyCredential | verify an issued credential | beta | | generatePresentation | generate a verifiable presentation (VP) for a selected VC | beta | | acceptCredential | accept a credential issued to a the user | not done | | burnCredential | remove a previously issued credential | not done | | requestCredential | request a credential from an issuer | not done | | transferCredential | transfer a credential to another PKP | not done |
Verifier Functions
| Function | Description | Status | |----------------------------------------------------|-------------------------------------|----------| | verifyPresentation | verify an issued VP | beta | | requestDecryption | request decryption rights over a VP | not done |
Functions
issueCredential
issues a verifiable credential to a receiver
issueCredential(credential: Credential, proof: Proof, recipient: string): Promise<IssueCredentialResponse>
Parameters
credential (Credential): credential object
receiver (string): PKP Public key of VC receiving party
Returns
Promise<string>: A promise containing the Ceramic stream ID of the stored VC
verifyCredential
verifies a previously issued credential
verifyCredential(vcId: string, issuer: string): Promise<any>
Parameters
vcId(string): the Ceramic stream ID of the credential to verify
issuer(string): the PKP public key of the VC owner
Returns
Promise<VerifyCredentialResponse>: A promise containing an object that includes a boolean verified
property, as well as the verified credential obj.
generatePresentation
generates a VP for a given VC
generatePresentation(presentation: Presentation, credential: Credential[], issuer: string): Promise<any>
Parameters
presentation (Presentation): the presentation object
credential (Credential[]): an array of the credentials to include in the VP
issuer (string): the PKP public key of the party issuing the VP
Returns
Promise<GeneratePresentationResponse>: A promise containing the Ceramic stream ID of the stored VP
verifyPresentation
verifies a previously issued presentation and the contained credentials
verifyPresentation(vcId: string, issuer: string): Promise<VerifyPresentationResponse>
Parameters
vcId(string): the Ceramic stream ID of the presentation to verify
issuer(string): the PKP public key of the VC owner
Returns
Promise<VerifyPresentationResponse>: A promise containing an object that includes a boolean verified
property, as well as the verified presentation obj.
Types
Credential
interface Credential {
"@context": string[],
id: string,
type: string[],
issuer: string,
issuanceDate: string,
credentialSubject: CredentialSubject,
proof?: Proof
}
Presentation
interface Presentation {
"@context": string[],
type: string,
proof?: Proof,
issuer?: string
verifiableCredential?: Credential[]
}
Proof
interface Proof {
type: string,
created: string,
proofPurpose: string,
verificationMethod: string,
jws: string
}
VerifyCredentialResponse
interface VerifyCredentialResponse {
recoveredCredential: Credential
verified: boolean
}
GeneratePresentationResponse
interface GeneratePresentationResponse {
docId: string,
presentation: Presentation
}
VerifyPresentationResponse
interface VerifyPresentationResponse {
recoveredPresentation: Presentation
verified: boolean
}