buildProofOptions function

String buildProofOptions({
  1. required SignatureType type,
  2. required String verificationMethod,
  3. String? domain,
  4. 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);
}