waitForApproval abstract method
- AtEnrollmentResponse enrollmentResponse, {
- bool logProgress = defaultLogProgress,
- int maxRetries = defaultMaxRetries,
- Duration retryInterval = defaultRetryInterval,
- required AtLookupMuxable atLookup,
- Future<
void> ? cancelled,
Polls for the approval or denial of an enrollment request, and on approval collects and decrypts what the approval released.
The wait for a decision is unbounded. Somebody has to decide this
request, on their own schedule, so polling continues until the atServer
reports approval or denial — for as long as that takes. An enrollment
that has expired, or that the atServer has no record of, ends the wait
at once with an AtEnrollmentException carrying its answer. No parameter
here shortens it; a caller that needs to give up must race this against
its own timer.
maxRetries is a budget for consecutive failures to reach the
atServer, and nothing else — the exit from an atServer that is
genuinely gone. An answer restores it, including a refusal, which is an
answer about the enrollment. Exhausting it propagates the underlying
connection failure.
retryInterval is the pause between polls, and logProgress narrates
the wait on progressStream (which costs a brief additional pause per
attempt). Their defaults, and maxRetries', are
defaultRetryInterval, defaultLogProgress and defaultMaxRetries.
Dart resolves a default in the method that runs, not from the type of the reference a caller holds, so what an implementation declares here is what its callers actually get and what is declared on this interface is documentation. Naming the same constants on both is what keeps that documentation true.
AtEnrollment atEnrollment = AtEnrollment.create();
AtEnrollmentResponse? atEnrollmentResponse =
await atEnrollmentBase?.submit(dummyEnrollmentRequest, atLookUp!);
try{
await atEnrollment.waitForApproval(atEnrollmentResponse!,
atLookup: atLookUp);
}catch{
// Handle errors
}
atLookup is the connection the approval handshake runs on — the PKAM
retries and the post-approval key fetches — and it is left open for the
caller to close.
Once cancelled completes, with a value or an error, no further poll
starts and the wait throws StoppedException; a connection that is
stopped ends it the same way.
Implementation
Future<void> waitForApproval(
AtEnrollmentResponse enrollmentResponse, {
bool logProgress = defaultLogProgress,
int maxRetries = defaultMaxRetries,
Duration retryInterval = defaultRetryInterval,
required AtLookupMuxable atLookup,
Future<void>? cancelled,
});