CredentialManifestAttachment.fromJson constructor

CredentialManifestAttachment.fromJson(
  1. dynamic jsonObject
)

Implementation

CredentialManifestAttachment.fromJson(dynamic jsonObject) {
  var data = credentialToMap(jsonObject);
  Map? options = data['options'];
  if (options == null || options.isEmpty) {
    throw Exception('Options needed');
  }
  if (options.containsKey('challenge')) {
    challenge = options['challenge'];
  } else {
    throw Exception('Challenge property needed');
  }
  if (options.containsKey('domain')) {
    domain = options['domain'];
  } else {
    throw Exception('Domain Property needed');
  }

  if (data.containsKey('credential_manifest')) {
    credentialManifest =
        CredentialManifest.fromJson(data['credential_manifest']);
  } else {
    throw Exception('credential_manifest property needed');
  }
}