subject

fun subject(id: Iri? = null, block: SubjectBuilder.() -> Unit = {}): CredentialSubject

Sleek builder DSL for creating CredentialSubject with infix to syntax.

Examples:

// Simple subject with properties
val subject = subject {
"name" to "John Doe"
"email" to "john@example.com"
"age" to 30
}

// Subject with DID
val subject = subject(did) {
"name" to "John Doe"
"degree" to buildJsonObject {
"type" to "BachelorDegree"
"name" to "Bachelor of Science"
}
}

// Nested objects
val subject = subject {
"address" to buildJsonObject {
"street" to "123 Main St"
"city" to "New York"
}
}

fun subject(did: Did, block: SubjectBuilder.() -> Unit = {}): CredentialSubject

Create subject from DID.


fun subject(iri: String, block: SubjectBuilder.() -> Unit = {}): CredentialSubject

Create subject from IRI string.