fromJson static method

Challenge fromJson(
  1. Map<String, dynamic> json
)

Creates a Challenge from a JSON map.

Binary data should be base64-encoded strings, and BigInt values should be decimal strings in the JSON.

Example:

final decoded = jsonDecode(jsonString);
final challenge = Challenge.fromJson(decoded);

Implementation

static Challenge fromJson(Map<String, dynamic> json) {
  return Challenge._(
    generator: BigInt.parse(json['generator'] as String),
    safePrime: BigInt.parse(json['safePrime'] as String),
    ephemeralServerPublicKey: base64.decode(json['ephemeralServerPublicKey'] as String),
    verifierKeySalt: base64.decode(json['verifierKeySalt'] as String),
    hashFunctionName: json['hashFunctionName'],
    isCustomHashFunction: json['isCustomHashFunction'],
  );
}