Download this file
| 1 | #!/usr/bin/env node |
| 2 | // 🤖 tools/marketing-shots/device-link.mjs — mint a fresh "add a device" sign-in |
| 3 | // link for the demo space's operator identity ("Cass"), pointed at whatever |
| 4 | // origin you give. |
| 5 | // |
| 6 | // Each link is SINGLE-USE, so run this once per device you want to sign in: |
| 7 | // node tools/marketing-shots/device-link.mjs # link on the seeded base (localhost) |
| 8 | // node tools/marketing-shots/device-link.mjs https://try-abc.11relay.com # link on the tunnel origin (phone) |
| 9 | // |
| 10 | // Reads .demo-state.json (written by seed-team.mjs) for the base, admin token, |
| 11 | // and Cass's keypair. Prints just the link on stdout. |
| 12 | |
| 13 | import { readState, mintDeviceLink } from "./demo-lib.mjs"; |
| 14 | |
| 15 | const origin = process.argv[2] || null; |
| 16 | |
| 17 | async function main() { |
| 18 | const s = readState(); |
| 19 | if (!s) { |
| 20 | console.error("device-link: no .demo-state.json — run seed-team.mjs first."); |
| 21 | process.exit(1); |
| 22 | } |
| 23 | const link = await mintDeviceLink(s.base, s.adminToken, s.cass, origin || s.base, "You"); |
| 24 | console.log(link); |
| 25 | } |
| 26 | |
| 27 | main().catch((e) => { |
| 28 | console.error("device-link:", e.message); |
| 29 | process.exit(1); |
| 30 | }); |
| 31 | |