Extensions
Google Cloud
Extensions
gcloud.md

Google Cloud

Google's APIs from the back end, written out in Mote: Cloud Storage, Sheets, Drive, Calendar, Gmail, Firebase Cloud Messaging (and Apple's push service beside it), Pub/Sub, BigQuery, Gemini on Vertex AI or the Gemini API, and Maps. An extension: ordinary Mote in extensions/gcloud/, a core (gcloud.mote) and a file for each service. Back to the map.

mote
use "pkg:gcloud/sheets.mote"
use "pkg:gcloud/calendar.mote"
shape Lead
name: string
email: string
score: number
// The sales team keeps leads in a sheet by hand; the back end reads them as
// records, and books a call in the signed-in rep's own calendar.
server fn book(sheet: string, accessToken: string): string requires signedIn
let leads: Lead[] = gcloudSheetsRecords(gcloudAuth([gcloudSheetsScope()]), sheet, "Leads!A:C")?
let best = leads.toSorted((a, b) => b.score - a.score)[0]
let rep = gcloudUser(accessToken)
let e = gcloudCalendarAdd(rep, "primary", {summary: `Call ${best.name}`, start: now() + 86400000, end: now() + 88200000, attendees: [best.email]}, true)?
return e.link
toml
[packages]
gcloud = "../mote/extensions/gcloud"
mail = "../mote/extensions/mail" # for gmail.mote
ai = "../mote/extensions/ai" # for vertex.mote

What was checked. RS256, which the service account's assertion and every V4 signed address rest on, against RFC 7515 appendix A.2: its RSA key signs its signing input to its published signature, byte for byte (extensions/gcloud/tests.mote). Every call against given net answers in that file, and the whole program against a stand-in of Google's APIs (tests/svc_gcloud_standin.mjs, tests/all.sh real_svc_gcloud) that checks the assertion's signature and claims, the access token on every call, works each V4 signed address out again from the request and refuses one that differs, checks APNs' ES256 provider token, and speaks HTTP/2 for APNs. Google's own example of a V4 signed URL could not be reproduced here: its key is not at hand, and nothing may be downloaded. Nothing has been asked of Google: the steps are below.

Who asks#

Cloud Storage#

Sheets, Drive, Calendar, Gmail#

Pushes: FCM, and APNs beside it#

Pub/Sub, BigQuery, Gemini, Maps#

Unsure#

Checking it against Google#

Edit this page:docs/gcloud.md
esc
1072 sections of 111 pages, ranked as you type.A heading's words count for more than what stands under it.
↑↓move
↵open
ranked by BM25, in the page