buildProofOptions function
String
buildProofOptions({
- required SignatureType type,
- required String verificationMethod,
- String? domain,
- String? challenge,
Implementation
String buildProofOptions(
{required SignatureType type,
required String verificationMethod,
String? domain,
String? challenge}) {
Map<String, dynamic> jsonObject = {};
jsonObject.putIfAbsent('type', () => type.value);
jsonObject.putIfAbsent('proofPurpose', () => 'assertionMethod');
jsonObject.putIfAbsent('verificationMethod', () => verificationMethod);
jsonObject.putIfAbsent(
'created', () => DateTime.now().toUtc().toIso8601String());
if (domain != null) {
jsonObject['domain'] = domain;
}
if (challenge != null) {
jsonObject['challenge'] = challenge;
}
return json.encode(jsonObject);
}