import type { GoogleWalletPort, GoogleWriteResult } from './port'; /** * The real Google Wallet API, over `fetch`. * * Two things here are worth more than the rest of the file. * * **The access token is exchanged, not signed.** Unlike a save link — which is * a JWT the *holder's browser* hands to Google — a write needs an OAuth access * token, obtained by signing an assertion and swapping it at Google's token * endpoint. Signing the assertion and sending it as a bearer token directly * produces a 401 with a message that does not say why. * * **An upsert is a PUT that falls back to a POST.** Google has no upsert, and a * product that tracks which identifiers it has created for itself will * eventually be wrong about one — a failed create, a restored backup, a * programme set up by hand in their console. Asking and then deciding costs a * round trip on every write; trying the update first costs one only the first * time. */ export interface GoogleWalletApiOptions { serviceAccountEmail: string; /** The service account's private key, PEM. */ privateKey: string; /** Injected so a test can hold the clock still. */ now?: () => Date; /** Injected so a test can answer without a network. */ fetch?: typeof fetch; } export declare class GoogleWalletApi implements GoogleWalletPort { private readonly options; private token; constructor(options: GoogleWalletApiOptions); upsertClass(loyaltyClass: Record): Promise; upsertObject(loyaltyObject: Record): Promise; private upsert; private accessToken; } //# sourceMappingURL=api.d.ts.map