ProposeCredential.fromJson constructor
ProposeCredential.fromJson(
- dynamic jsonObject
Implementation
ProposeCredential.fromJson(dynamic jsonObject) : super.fromJson(jsonObject) {
if (type != DidcommMessages.proposeCredential.value) {
throw Exception('Unknown Message type or version');
}
goalCode = body['goal_code'];
comment = body['comment'];
if (body.containsKey('credential_preview')) {
credentialPreview =
PreviewCredential.fromJson(body['credential_preview']);
}
if (attachments != null && attachments!.isNotEmpty) {
detail = [];
for (var a in attachments!) {
if (a.format != null &&
a.format == AttachmentFormat.ldProofVcDetail.value) {
if (a.mediaType != null && a.mediaType == 'application/json') {
a.data.resolveData();
detail!.add(LdProofVcDetail.fromJson(a.data.json!));
}
} else if (a.format != null &&
a.format == AttachmentFormat.credentialManifestAries.value) {
throw UnimplementedError(
'dif credential Manifest Attachment is not supported yet');
} else if (a.format != null &&
a.format == AttachmentFormat.indyCredentialFilter.value) {
throw UnimplementedError('indy Attachment is not supported');
} else {
continue;
}
}
}
}