CredentialBuilder
class CredentialBuilder
Credential Builder DSL.
Provides a fluent API for creating verifiable credentials with minimal boilerplate.
Example Usage:
val credential = credential {
id("https://example.edu/credentials/123")
type(CredentialType.Degree, CredentialType.Custom("BachelorDegreeCredential"))
issuer("did:key:university")
subject {
id("did:key:student")
"degree" {
"type" to "BachelorDegree"
"name" to "Bachelor of Science"
"university" to "Example University"
}
}
issued(Instant.now())
expires(Clock.System.now() + 3650.days) // ~10 years
schema("https://example.edu/schemas/degree.json")
}Content copied to clipboard
Functions
Link copied to clipboard
Build the verifiable credential.
Link copied to clipboard
Add evidence.
Link copied to clipboard
Set refresh service.
Link copied to clipboard
Set credential status (for revocation).
Link copied to clipboard
Configure credential subject.
Configure credential subject with IRI string.
Configure credential subject with DID.
Link copied to clipboard
Set terms of use.
Link copied to clipboard
Link copied to clipboard
Set validUntil date (VC 2.0).