Object VerifiableCredential.Companion
-
- All Implemented Interfaces:
public class VerifiableCredential.Companion
-
-
Field Summary
Fields Modifier and Type Field Description public final static VerifiableCredential.CompanionINSTANCE
-
Method Summary
Modifier and Type Method Description final <T extends Any> VerifiableCredentialcreate(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. final <T extends Any> VerifiableCredentialcreate(String type, String issuer, String subject, T data, Date issuanceDate, Date expirationDate, CredentialStatus credentialStatus, CredentialSchema credentialSchema)Create a VerifiableCredential based on the provided parameters. final <T extends Any> VerifiableCredentialcreate(String type, String issuer, String subject, T data, Date issuanceDate, Date expirationDate, CredentialStatus credentialStatus)Create a VerifiableCredential based on the provided parameters. final <T extends Any> VerifiableCredentialcreate(String type, String issuer, String subject, T data, Date issuanceDate, Date expirationDate)Create a VerifiableCredential based on the provided parameters. final <T extends Any> VerifiableCredentialcreate(String type, String issuer, String subject, T data, Date issuanceDate)Create a VerifiableCredential based on the provided parameters. final <T extends Any> VerifiableCredentialcreate(String type, String issuer, String subject, T data)Create a VerifiableCredential based on the provided parameters. final <T extends Any> VerifiableCredentialcreate(String issuer, String subject, T data)Create a VerifiableCredential based on the provided parameters. final Unitverify(String vcJwt)Verifies the integrity and authenticity of a Verifiable Credential (VC) encoded as a JSON Web Token (JWT). final VerifiableCredentialparseJwt(String vcJwt)Parses a JWT into a VerifiableCredential instance. final VerifiableCredentialfromJson(String vcJson)Parses a JSON string into a VerifiableCredential instance. -
-
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 theissuanceDateproperty of the credential.expirationDate- Optional date to set in theexpirationDateproperty 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 theissuanceDateproperty of the credential.expirationDate- Optional date to set in theexpirationDateproperty 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 theissuanceDateproperty of the credential.expirationDate- Optional date to set in theexpirationDateproperty 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 theissuanceDateproperty of the credential.expirationDate- Optional date to set in theexpirationDateproperty 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 theissuanceDateproperty 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.
-
parseJwt
final VerifiableCredential parseJwt(String vcJwt)
Parses a JWT into a VerifiableCredential instance.
- Parameters:
vcJwt- The verifiable credential JWT as a String.- Returns:
A VerifiableCredential instance derived from the JWT.
Example:
val vc = VerifiableCredential.parseJwt(signedVcJwt)
-
fromJson
final VerifiableCredential fromJson(String vcJson)
Parses a JSON string into a VerifiableCredential instance.
- Parameters:
vcJson- The verifiable credential JSON as a String.- Returns:
A VerifiableCredential instance derived from the JSON.
-
-
-
-