signedBy

fun signedBy(issuerDid: Did)

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

This method resolves the DID and extracts the first verification method's key ID automatically. The resolution happens during build().

Example:

val issuerDid = trustWeave.createDid { }.getOrThrowDid()
val credential = trustWeave.issue {
credential { ... }
signedBy(issuerDid) // Key ID auto-extracted during build
}

Parameters

issuerDid

The issuer DID (key ID will be auto-extracted during build)


fun signedBy(issuerDid: Did, keyId: String)

Set issuer DID and explicit key ID for signing.

Use this method when you need to specify a particular key ID from the DID document.

Example:

val issuerDid = trustWeave.createDid { }.getOrThrowDid()
val credential = trustWeave.issue {
credential { ... }
signedBy(issuerDid, "key-1") // Explicit key ID
}

Parameters

issuerDid

The issuer DID

keyId

The key ID (fragment part, e.g., "key-1")