getIssuerDidFromCredential function
Collects the did of the issuer of a credential
.
Implementation
String getIssuerDidFromCredential(dynamic credential) {
Map<String, dynamic> credentialMap;
if (credential is VerifiableCredential) {
credentialMap = credential.toJson();
} else {
credentialMap = credentialToMap(credential);
}
if (!credentialMap.containsKey('issuer')) {
return '';
} else {
var issuer = credentialMap['issuer'];
if (issuer is String) {
return issuer;
} else {
if (issuer is! Map) {
return '';
} else {
var id = issuer['id'];
if (id != null) {
return id;
} else {
return '';
}
}
}
}
}