IssueCredential constructor
IssueCredential({
- String? id,
- String? goalCode,
- String? comment,
- String? replacementId,
- List<
VerifiableCredential> ? credentials, - VerifiablePresentation? credentialFulfillment,
- String? replyUrl,
- List<
String> ? replyTo, - String? parentThreadId,
- String? threadId,
- String? from,
- List<
String> ? to, - DateTime? createdTime,
- DateTime? expiresTime,
- bool pleaseAck = false,
- FromPriorJWT? fromPrior,
- Map<
String, dynamic> ? additionalHeaders, - WebRedirect? webRedirect,
- ReturnRouteValue? returnRoute,
- DidcommMessageTyp? typ,
Implementation
IssueCredential(
{String? id,
this.goalCode,
this.comment,
this.replacementId,
this.credentials,
this.credentialFulfillment,
String? replyUrl,
List<String>? replyTo,
String? parentThreadId,
String? threadId,
String? from,
List<String>? to,
DateTime? createdTime,
DateTime? expiresTime,
bool pleaseAck = false,
FromPriorJWT? fromPrior,
Map<String, dynamic>? additionalHeaders,
WebRedirect? webRedirect,
ReturnRouteValue? returnRoute,
DidcommMessageTyp? typ})
: super(
type: DidcommMessages.issueCredential.value,
id: id ?? Uuid().v4(),
body: {},
replyUrl: replyUrl,
replyTo: replyTo,
threadId: threadId,
parentThreadId: parentThreadId,
from: from,
to: to,
createdTime: createdTime,
expiresTime: expiresTime,
pleaseAck: pleaseAck,
fromPrior: fromPrior,
additionalHeaders: additionalHeaders,
webRedirect: webRedirect,
returnRoute: returnRoute,
typ: typ) {
if (comment != null) body['comment'] = comment;
if (goalCode != null) body['goal_code'] = goalCode;
if (replacementId != null) body['replacement_id'] = replacementId;
if (credentials != null) {
attachments = [];
for (var a in credentials!) {
attachments!.add(Attachment(
data: AttachmentData(json: a.toJson()),
id: Uuid().v4(),
format: AttachmentFormat.ldProofVc.value,
mediaType: 'application/json'));
}
}
if (credentialFulfillment != null) {
attachments ??= [];
attachments!.add(Attachment(
data: AttachmentData(json: credentialFulfillment!.toJson()),
id: Uuid().v4(),
format: AttachmentFormat.credentialFulfillment.value,
mediaType: 'application/json'));
}
}