limitedUseAppCheckToken function
A token for a single use: not cached, not shared.
A custom provider serves this without implementing anything further — the SDK's limited-use path falls back to the ordinary one.
Implementation
Future<AppCheckToken> limitedUseAppCheckToken() {
final completer = Completer<AppCheckToken>();
final receive = RawReceivePort();
receive.handler = (Object? message) {
receive.close();
try {
completer.complete(_readToken(message! as Uint8List));
} on Object catch (e) {
completer.completeError(e);
}
};
final rc = fdbAcLimitedUseToken(receive.sendPort.nativePort);
if (rc != 0) {
receive.close();
return Future.error(
StateError('limitedUseAppCheckToken before initAppCheck ($rc)'),
);
}
return completer.future;
}