Skip to content

GCP.OSLogin reference

Source: src/GCP/OSLogin/UsersSshPublicKey.ts

An OS Login SSH public key on a Google account.

SSH public keys have no labels field, so Alchemy tracks a key by the name in state; without state an identical key on the account is reported as unowned. user and the key text are identity — changing either replaces the key. Expiration updates in place. "me" works for user credentials; service accounts must pass their email as user.

Current user

const sshKey = yield* GCP.OSLogin.UsersSshPublicKey("Laptop", {
key: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAI... laptop",
});

With expiration

const sshKey = yield* GCP.OSLogin.UsersSshPublicKey("Laptop", {
user: "me",
key: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAI... laptop",
expirationTimeUsec: "4102444800000000",
});

Key for a service account

const sshKey = yield* GCP.OSLogin.UsersSshPublicKey("Deploy", {
user: "deployer@my-project.iam.gserviceaccount.com",
key: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAI... deploy",
});

Change props on the same logical id; the engine keeps the physical id.

const sshKey = yield* GCP.OSLogin.UsersSshPublicKey("Laptop", {
key: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAI... laptop",
expirationTimeUsec: "4133980800000000",
});