toJson method

Map<String, Object?> toJson()

Serializes to the shape the hosted page's credentials query param expects: {verificationId, clientSecret, deviceSessionKey?} for session credentials, {provider: 'persona', inquiryId, sessionToken?} otherwise.

Implementation

Map<String, Object?> toJson() {
  if (_verificationId != null) {
    return <String, Object?>{
      'verificationId': _verificationId,
      'clientSecret': _clientSecret,
      if (_deviceSessionKey != null && _deviceSessionKey.isNotEmpty)
        'deviceSessionKey': _deviceSessionKey,
    };
  }
  return <String, Object?>{
    'provider': _provider,
    'inquiryId': inquiryId,
    if (sessionToken != null) 'sessionToken': sessionToken,
  };
}