credential method

DcqlCredentialBuilder credential(
  1. String id, {
  2. Format? format,
  3. CredentialType? type,
})

Adds a new credential to the query.

id is the unique identifier for the credential. format is the format of the credential (e.g., mdoc, sd_jwt). type is a helper to set the format and meta filter based on a known credential type.

Implementation

DcqlCredentialBuilder credential(
  String id, {
  Format? format,
  CredentialType? type,
}) {
  final credential = Credential(id: id);

  if (type != null) {
    credential.format = type.format;
    credential.meta.setFilter(type);
  } else if (format != null) {
    credential.format = format;
  }

  _query.credentials.add(credential);

  return DcqlCredentialBuilder(_dcqlBuilder, credential);
}