challenge method

Future<({String challengeToken})> challenge()

Retrieves a challenge token from the server.

Challenge tokens are used to prevent replay attacks by ensuring that each attestation request includes fresh, server-generated data. The challenge must be signed during device attestation.

Returns

A Future that resolves to a record containing the challenge token

Throws

  • HttpException if there's a network error
  • CalljmpException if the server returns an error

Example

final challenge = await calljmp.integrity.challenge();
print('Challenge token: ${challenge.challengeToken}');

Implementation

Future<({String challengeToken})> challenge() => http
    .request("${_config.serviceUrl}/integrity/challenge")
    .use(http.context(_config))
    .get()
    .json((json) => (challengeToken: json["challengeToken"] as String));