verifyAuthPluginRuntimeConformance function

Future<void> verifyAuthPluginRuntimeConformance({
  1. required Uri origin,
  2. required AuthRuntimeConformanceSend send,
  3. required AuthRuntimeConformanceSend sendWithoutTwoFactor,
  4. required AuthPluginRuntimePhoneDeliveryRecorder phoneDeliveryRecorder,
})

Verifies representative plugin flows through an arbitrary host transport.

send must target an engine created with the default plugin topology. sendWithoutTwoFactor must target a fixture created with includeTwoFactor: false; it is used only to confirm opt-in route gating. This helper intentionally has no dependency on package:test or browser interop libraries.

Implementation

Future<void> verifyAuthPluginRuntimeConformance({
  required Uri origin,
  required AuthRuntimeConformanceSend send,
  required AuthRuntimeConformanceSend sendWithoutTwoFactor,
  required AuthPluginRuntimePhoneDeliveryRecorder phoneDeliveryRecorder,
}) async {
  final originHeader = origin.toString();

  await _verifyMagicLink(send, origin);
  await _verifyPhoneNumber(send, origin, phoneDeliveryRecorder);
  await _verifyEmailOtp(send, originHeader);
  final usernameSession = await _verifyUsername(send, originHeader);
  final csrf = await _issueCsrf(send, cookie: usernameSession);
  await _verifyApiKeyExchange(
    send,
    originHeader: originHeader,
    sessionCookie: csrf.cookie,
    csrf: csrf.token,
  );
  await _verifyWebAuthnBoundary(
    send,
    originHeader: originHeader,
    sessionCookie: csrf.cookie,
    csrf: csrf.token,
  );
  await verifyAuthWebAuthnBrowserRuntimeConformance(
    transportOrigin: origin,
    send: send,
    sessionCookie: csrf.cookie,
    sessionCookieName: authPluginRuntimeConformanceCookieName,
    csrfToken: csrf.token,
    expectedUserEmail: authPluginRuntimeConformanceUsernameEmail,
  );
  await _verifyAnonymous(send, originHeader);
  await _verifyTwoFactorGating(send, sendWithoutTwoFactor);
}