authenticateGameCenter method

  1. @override
Future<Session> authenticateGameCenter({
  1. required String playerId,
  2. required String bundleId,
  3. required int timestampSeconds,
  4. required String salt,
  5. required String signature,
  6. required String publicKeyUrl,
  7. bool create = true,
  8. String? username,
  9. Map<String, String>? vars,
})
override

Implementation

@override
Future<model.Session> authenticateGameCenter({
  required String playerId,
  required String bundleId,
  required int timestampSeconds,
  required String salt,
  required String signature,
  required String publicKeyUrl,
  bool create = true,
  String? username,
  Map<String, String>? vars,
}) async {
  final request = AuthenticateGameCenterRequest()
    ..create_2 = BoolValue(value: create)
    ..account = (AccountGameCenter()
      ..playerId = playerId
      ..bundleId = bundleId
      ..timestampSeconds = Int64(timestampSeconds)
      ..salt = salt
      ..signature = signature
      ..publicKeyUrl = publicKeyUrl
      ..vars.addAll(vars ?? {}));

  if (username != null) {
    request.username = username;
  }

  final res = await _client.authenticateGameCenter(request);

  return model.Session(
    created: res.created,
    token: res.token,
    refreshToken: res.refreshToken,
  );
}