Object VerifiableCredential.Companion

    • Constructor Detail

    • Method Detail

      • create

        @JvmOverloads() final <T extends Any> VerifiableCredential create(String type, String issuer, String subject, T data, Date issuanceDate, Date expirationDate, CredentialStatus credentialStatus, CredentialSchema credentialSchema, List<Object> evidence)

        Create a VerifiableCredential based on the provided parameters.

        Parameters:
        type - The type of the credential, as a String.
        issuer - The issuer URI of the credential, as a String.
        subject - The subject URI of the credential, as a String.
        data - The credential data, as a generic type T.
        issuanceDate - Optional date to set in the issuanceDate property of the credential.
        expirationDate - Optional date to set in the expirationDate property of the credential.
        evidence - Optional evidence property that gives additional supporting data
        Returns:

        A VerifiableCredential instance.

        Example:

        val vc = VerifiableCredential.create("ExampleCredential", "http://example.com/issuers/1", "http://example.com/subjects/1", myData)
      • create

        @JvmOverloads() final <T extends Any> VerifiableCredential create(String type, String issuer, String subject, T data, Date issuanceDate, Date expirationDate, CredentialStatus credentialStatus, CredentialSchema credentialSchema)

        Create a VerifiableCredential based on the provided parameters.

        Parameters:
        type - The type of the credential, as a String.
        issuer - The issuer URI of the credential, as a String.
        subject - The subject URI of the credential, as a String.
        data - The credential data, as a generic type T.
        issuanceDate - Optional date to set in the issuanceDate property of the credential.
        expirationDate - Optional date to set in the expirationDate property of the credential.
        Returns:

        A VerifiableCredential instance.

        Example:

        val vc = VerifiableCredential.create("ExampleCredential", "http://example.com/issuers/1", "http://example.com/subjects/1", myData)
      • create

        @JvmOverloads() final <T extends Any> VerifiableCredential create(String type, String issuer, String subject, T data, Date issuanceDate, Date expirationDate, CredentialStatus credentialStatus)

        Create a VerifiableCredential based on the provided parameters.

        Parameters:
        type - The type of the credential, as a String.
        issuer - The issuer URI of the credential, as a String.
        subject - The subject URI of the credential, as a String.
        data - The credential data, as a generic type T.
        issuanceDate - Optional date to set in the issuanceDate property of the credential.
        expirationDate - Optional date to set in the expirationDate property of the credential.
        Returns:

        A VerifiableCredential instance.

        Example:

        val vc = VerifiableCredential.create("ExampleCredential", "http://example.com/issuers/1", "http://example.com/subjects/1", myData)
      • create

        @JvmOverloads() final <T extends Any> VerifiableCredential create(String type, String issuer, String subject, T data, Date issuanceDate, Date expirationDate)

        Create a VerifiableCredential based on the provided parameters.

        Parameters:
        type - The type of the credential, as a String.
        issuer - The issuer URI of the credential, as a String.
        subject - The subject URI of the credential, as a String.
        data - The credential data, as a generic type T.
        issuanceDate - Optional date to set in the issuanceDate property of the credential.
        expirationDate - Optional date to set in the expirationDate property of the credential.
        Returns:

        A VerifiableCredential instance.

        Example:

        val vc = VerifiableCredential.create("ExampleCredential", "http://example.com/issuers/1", "http://example.com/subjects/1", myData)
      • create

        @JvmOverloads() final <T extends Any> VerifiableCredential create(String type, String issuer, String subject, T data, Date issuanceDate)

        Create a VerifiableCredential based on the provided parameters.

        Parameters:
        type - The type of the credential, as a String.
        issuer - The issuer URI of the credential, as a String.
        subject - The subject URI of the credential, as a String.
        data - The credential data, as a generic type T.
        issuanceDate - Optional date to set in the issuanceDate property of the credential.
        Returns:

        A VerifiableCredential instance.

        Example:

        val vc = VerifiableCredential.create("ExampleCredential", "http://example.com/issuers/1", "http://example.com/subjects/1", myData)
      • create

        @JvmOverloads() final <T extends Any> VerifiableCredential create(String type, String issuer, String subject, T data)

        Create a VerifiableCredential based on the provided parameters.

        Parameters:
        type - The type of the credential, as a String.
        issuer - The issuer URI of the credential, as a String.
        subject - The subject URI of the credential, as a String.
        data - The credential data, as a generic type T.
        Returns:

        A VerifiableCredential instance.

        Example:

        val vc = VerifiableCredential.create("ExampleCredential", "http://example.com/issuers/1", "http://example.com/subjects/1", myData)
      • create

        @JvmOverloads() final <T extends Any> VerifiableCredential create(String issuer, String subject, T data)

        Create a VerifiableCredential based on the provided parameters.

        Parameters:
        issuer - The issuer URI of the credential, as a String.
        subject - The subject URI of the credential, as a String.
        data - The credential data, as a generic type T.
        Returns:

        A VerifiableCredential instance.

        Example:

        val vc = VerifiableCredential.create("ExampleCredential", "http://example.com/issuers/1", "http://example.com/subjects/1", myData)
      • verify

         final Unit verify(String vcJwt)

        Verifies the integrity and authenticity of a Verifiable Credential (VC) encoded as a JSON Web Token (JWT).

        This method conforms to wording about VC data model JWT encoding https://www.w3.org/TR/vc-data-model/#jwt-encoding

        If any of these steps fail, the function will throw a IllegalArgumentException with a message indicating the nature of the failure:

        • exp MUST represent the expirationDate property, encoded as a UNIX timestamp (NumericDate).

        • iss MUST represent the issuer property of a verifiable credential or the holder property of a verifiable presentation.

        • nbf MUST represent issuanceDate, encoded as a UNIX timestamp (NumericDate).

        • jti MUST represent the id property of the verifiable credential or verifiable presentation.

        • sub MUST represent the id property contained in the credentialSubject.

        Parameters:
        vcJwt - The Verifiable Credential in JWT format as a String.