StatusListCredential represents a digitally verifiable status list credential according to the W3C Verifiable Credentials Status List v2021.

When a status list is published, the result is a verifiable credential that encapsulates the status list.

Constructors

Methods

  • Create a [StatusListCredential] with a specific purpose, e.g., for revocation.

    Returns VerifiableCredential

    A special [VerifiableCredential] instance that is a StatusListCredential.

    Throws

    Error If the status list credential cannot be created.

    Example:

       StatusListCredential.create({
    statusListCredentialId : 'https://statuslistcred.com/123',
    issuer : issuerDid.uri,
    statusPurpose : StatusPurpose.revocation,
    credentialsToDisable : [credWithCredStatus]
    })
  • Generates a Base64URL encoded, GZIP compressed bit string.

    Parameters

    • indexOfBitsToTurnOn: number[]

      The indexes of the bits to turn on (set to 1) in the bit string.

    Returns string

    The compressed bit string as a base64-encoded string.

  • Retrieves the value of a specific bit from a compressed base64 URL-encoded bitstring by decoding and decompressing a bitstring, then extracting a bit's value by its index.

    Parameters

    • compressedBitstring: string

      A base64 URL-encoded string representing the compressed bitstring.

    • bitIndex: number

      The zero-based index of the bit to retrieve from the decompressed bitstream.

    Returns boolean

    True if the bit at the specified index is 1, false if it is 0.

  • Validates if a given credential is part of the status list represented by a [VerifiableCredential].

    Parameters

    • credentialToValidate: VerifiableCredential

      The [VerifiableCredential] to be validated against the status list.

    • statusListCredential: VerifiableCredential

      The [VerifiableCredential] representing the status list.

    Returns boolean

    A [Boolean] indicating whether the credentialToValidate is part of the status list.

    This function checks if the given credentialToValidate's status list index is present in the expanded status list derived from the statusListCredential.

    Example:

    const isRevoked = StatusListCredential.validateCredentialInStatusList(credentialToCheck, statusListCred);
    
  • Validates that the status list entry index in all the given credentials are unique, and returns the unique index values.

    Parameters

    • statusPurpose: StatusPurpose

      The status purpose that all given credentials must match to.

    • credentials: VerifiableCredential[]

      An array of VerifiableCredential objects each contain a status list entry index.

    Returns number[]

    An array of unique statusListIndex values.

    Throws

    If any validation fails.