GCP.ApiKeys reference
GetKeyString
Section titled “GetKeyString”Source:
src/GCP/ApiKeys/GetKeyString.ts
Runtime binding for API Keys keys.getKeyString.
Bind this operation to a Key in a Function/Action init phase.
Provide GetKeyStringHttp. The key string is not included on
keys.get — this is the only way to read it.
GetKeyString: Reading the Key String
Section titled “GetKeyString: Reading the Key String”const getKeyString = yield* GCP.ApiKeys.GetKeyString(maps);const { keyString } = yield* getKeyString();GetKeyStringHttp
Section titled “GetKeyStringHttp”Source:
src/GCP/ApiKeys/GetKeyStringHttp.tsKind: Layer · Provides:GCP.ApiKeys.GetKeyString
HTTP implementation of GetKeyString.
Source:
src/GCP/ApiKeys/Key.ts
A Google Cloud API key (the API Keys API, apikeys.googleapis.com).
Keys are global (locations/global). They have no labels — Alchemy
stamps ownership into annotations so read, list, and
pnpm nuke:gcp can find them. keyId and serviceAccountEmail are
immutable; changing either replaces the key. Deletes are soft: the key
can be undeleted for 30 days, then it is purged.
Key: Creating a Key
Section titled “Key: Creating a Key”Generated name
const maps = yield* GCP.ApiKeys.Key("Maps", { displayName: "maps browser key",});Named key with annotations and API-target restrictions
const maps = yield* GCP.ApiKeys.Key("Maps", { keyId: "maps-browser", displayName: "maps browser key", annotations: { env: "prod" }, restrictions: { apiTargets: [{ service: "geocoding-backend.googleapis.com" }], browserKeyRestrictions: { allowedReferrers: ["https://example.com/*"], }, },});Key: Reading the Key String
Section titled “Key: Reading the Key String”const getKeyString = yield* GCP.ApiKeys.GetKeyString(maps);const { keyString } = yield* getKeyString();