2.0.0 • Published 2 years ago

@verixyz/credential-w3c v2.0.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
2 years ago

Verixyz W3C credentials plugin

Verixyz package for working with W3C Verifiable Credentials & Presentations.

This package contains a plugin and a message handler for issuing and verifying Credentials and Presentations that adhere to W3C standards.

Classes

CredentialIssuer

A verixyz plugin that implements the ICredentialIssuer methods.

Constructors

  • (constructor)() Constructs a new instance of the CredentialIssuer class

Properties

  • methods: ICredentiallssuer
  • schema: any

Methods

  • createVerifiableCredential(args, context) Creates a Verifiable Credential. The payload, signer and format are chosen based on the args parameter.
  • createVerifiablePresentation(args, context) Creates a Verifiable Presentation. The payload, signer and format are chosen based on the args parameter.

W3cMessageHandler

An implementation of the AbstractMessageHandler .This plugin can handle incoming W3C Verifiable Credentials and Presentations and prepare them for internal storage as Message types.The current version can only handle JWT encoded

Methods

  • handle(message, context)

Interfaces

ICreateVerifiableCredentialArgs

Encapsulates the parameters required to create a W3C Verifiable Credential

Properties

  • credential: Partial The json payload of the Credential according to the canonical model The signer of the Credential is chosen based on the issuer.id property of the credential'@context', 'type' and 'issuanceDate' will be added automatically if omitted
  • proofFormat: EncodingFormat The desired format for the VerifiablePresentation to be created. Currently, only JWT is supported
  • removeOriginalFields: boolean Remove payload members during JWT-JSON transformation. Defaults to true. See https://www.w3.org/TR/vc-data-model/#jwt-encoding
  • save: boolean If this parameter is true, the resulting VerifiablePresentation is sent to the storage plugin to be saved

ICreateVerifiablePresentationArgs

Encapsulates the parameters required to create a W3C Verifiable Presentation

Properties

  • presentation: Partial The json payload of the Presentation according to the canonical model .The signer of the Presentation is chosen based on the holder property of the presentation'@context', 'type' and 'issuanceDate' will be added automatically if omitted
  • proofFormat: EncodingFormat The desired format for the VerifiablePresentation to be created. Currently, only JWT is supported
  • removeOriginalFields: boolean Remove payload members during JWT-JSON transformation. Defaults to true. See https://www.w3.org/TR/vc-data-model/#jwt-encoding
  • save: boolean If this parameter is true, the resulting VerifiablePresentation is sent to the storage plugin to be saved

ICredentialIssuer

The interface definition for a plugin that can generate Verifiable Credentials and Presentations

Methods

  • createVerifiableCredential(args, context) Creates a Verifiable Credential. The payload, signer and format are chosen based on the args parameter.
  • createVerifiablePresentation(args, context) Creates a Verifiable Presentation. The payload, signer and format are chosen based on the args parameter.

Variables

  • schema

Type Aliases

  • EncodingFormat The type of encoding to be used for the Verifiable Credential or Presentation to be generated. Only jwt is supported at the moment.