IssuanceBuilder

class IssuanceBuilder(credentialService: CredentialService, revocationManager: CredentialRevocationManager? = null, defaultProofSuite: ProofSuiteId = ProofSuiteId.VC_LD, ioDispatcher: CoroutineDispatcher = Dispatchers.IO, didResolver: DidResolver? = null, autoAnchor: Boolean = false, defaultChain: String? = null, blockchainService: BlockchainService? = null)

Issuance Builder DSL.

Provides a fluent API for issuing credentials. Focused only on credential-specific operations.

Example Usage:

import org.trustweave.did.identifiers.Did
val issuerDid = Did("did:key:university")
val issuedCredential = trustWeave.issue {
credential {
id("https://example.edu/credentials/123")
type("DegreeCredential")
issuer(issuerDid)
subject {
id("did:key:student")
"degree" {
"type" to "BachelorDegree"
"name" to "Bachelor of Science"
}
}
issued(Clock.System.now())
withRevocation() // Auto-creates status list if needed
}
signedBy(issuerDid, "key-1")
withProof(ProofType.Ed25519Signature2020)
}.getOrThrow()

Constructors

Link copied to clipboard
constructor(credentialService: CredentialService, revocationManager: CredentialRevocationManager? = null, defaultProofSuite: ProofSuiteId = ProofSuiteId.VC_LD, ioDispatcher: CoroutineDispatcher = Dispatchers.IO, didResolver: DidResolver? = null, autoAnchor: Boolean = false, defaultChain: String? = null, blockchainService: BlockchainService? = null)

Functions

Link copied to clipboard
fun additionalOption(key: String, value: Any?)

Inject a suite-specific option into ProofOptions.additionalOptions.

Link copied to clipboard
suspend fun build(): IssuanceResult

Build and issue the credential.

Link copied to clipboard
fun challenge(challenge: String)

Set challenge for proof.

Link copied to clipboard

Set the credential to issue (can be built inline).

Set the credential directly.

Link copied to clipboard
fun domain(domain: String)

Set domain for proof.

Link copied to clipboard
fun signedBy(issuerDid: Did)

Set issuer DID for signing, automatically extracting the key ID.

fun signedBy(issuerDid: Did, keyId: String)

Set issuer DID and explicit key ID for signing.

Link copied to clipboard

Override the KMS key ID the JAdES signer should use. Optional — by default the engine reads IssuanceRequest.issuerKeyId (populated by IssuanceBuilder.signedBy). Use this when the signing key in the KMS is not the same as the verification method ID embedded in the DID document.

Link copied to clipboard
fun IssuanceBuilder.withJadesProfile(profile: JadesProfile, signerCertificateChain: List<ByteArray>, tsaConfig: TsaConfig? = null, contentType: String? = null)

Configure the issuance to produce a JAdES B-B or B-T signature.

Link copied to clipboard
fun withProof(suite: ProofSuiteId)

Set proof suite.

Link copied to clipboard

Enable automatic revocation support (creates status list if needed).