/** * Proving a Google connection works, by using it. * * The defect this exists to fix is subtle and it cost the owner most of an * evening: the flow reported success after storing a refresh token, and the * first CALENDAR call afterwards failed with "insufficient authentication * scopes". Storing a credential is not evidence that the credential does the * job, a token can be perfectly valid and still carry the wrong scopes, name * a different account, or belong to a project whose APIs are switched off. * Every one of those looks identical to success at the moment of storage. * * So a connection run does not finish by saying "stored". It finishes by * reading the mailbox and reading the calendar, and reporting what it read. * "Connected and proven" or a specific reason, never "try it and see". * * Both calls are reads. `users.getProfile` returns the address and message * counts and touches nothing; `events.list` reads the primary calendar. No * message is sent, nothing is marked read, no event is created. This is safe * to run on every connection and on demand. */ import type { GoogleApiClient } from './api-client.js'; /** One capability, proven or not, with the reason when not. */ export interface GoogleProofResult { readonly ok: boolean; /** What was actually read. Safe to display. */ readonly detail: string; /** Populated only on failure. */ readonly problem?: string; readonly fix?: string; } export interface GoogleConnectionProof { /** True only when BOTH mail and calendar answered. */ readonly ok: boolean; readonly mail: GoogleProofResult; readonly calendar: GoogleProofResult; /** The address Google says this credential belongs to, when it answered. */ readonly account: string | null; /** One line for the end of a connection run. */ readonly summary: string; } /** * Read mail and calendar with the live credential. * * Both are attempted even when the first fails, because "mail works and * calendar does not" is a materially different report from "nothing works", * and stopping at the first failure would hide which one it is. */ export declare function proveGoogleConnection(client: GoogleApiClient): Promise; /** The proof as lines for a transcript. */ export declare function describeGoogleConnectionProof(proof: GoogleConnectionProof): readonly string[]; //# sourceMappingURL=connection-proof.d.ts.map