iterate.com / cloud

git clone https://git.iterate.com/repos/cloud

cloud / internal-packages / cloud-clients / scripts / bot-link.tsmain at aacbc74

// scripts/bot-link.ts — AN OPERATOR'S LINK TO CONNECT THE BOT'S ACCOUNT AT X (src/bot.ts). Whoever
// holds the Cloud's key can make one, and it is good for ten minutes:
//
//   op run --env-file <dev.env> -- node internal-packages/cloud-clients/scripts/bot-link.ts <cloud origin> [client, default x]
//
// Open it signed in at X as the bot's account (@iterate) and consent. The Cloud then keeps that
// account's tokens, sealed, and nothing else of anybody's.
import { botLinkOf } from "../src/keys.ts";

const [origin, name = "x"] = process.argv.slice(2);
if (!origin) throw new Error("usage: bot-link.ts <cloud origin> [client]");
console.log(await botLinkOf(process.env.CLOUD_KEY!, origin, name));