{ "format_version": 1, "id": "code_credential", "list_route": "/code/credentials", "scope": "personal", "setup": true, "name": "Credential", "plural": "Credentials for cloning", "picture": null, "builtin": true, "engine": "code", "columns": [ { "key": "name", "name": "Name", "type": "text", "required": true }, { "key": "line", "name": "Scope and last use", "type": "text", "readonly": true }, { "key": "place", "name": "Where", "type": "choice", "choices": [ "mine", "other" ], "readonly": true }, { "key": "scope", "name": "Scope", "type": "text", "readonly": true }, { "key": "last_used_at", "name": "Last used", "type": "date", "readonly": true }, { "key": "created_at", "name": "Made", "type": "date", "readonly": true } ], "title": "name", "date": null, "project": null, "order": null, "slip": { "title": "name", "subtitle": "line", "trailing": null, "photo": null, "toggle": null }, "group": { "column": "place", "sections": [ { "heading": null, "values": [ "mine" ] }, { "heading": null, "values": [ "other" ] } ] }, "tile": { "face": "slip-list" }, "page": [ { "heading": null, "columns": [ "name", "line", "scope", "last_used_at", "created_at" ] } ], "empty": { "title": "No credentials yet.", "message": "Make one with New script credential above." }, "instructions": "The credentials a git client spends against Cotton: what a git clone from your relay address sends as its password, and what a script sends as a bearer. Not the token Cotton reads a git host with. A credential lets git on a machine clone and push to your own repositories; it is signed off the workspace key and stored on no Mac, so it works against whichever Mac is serving you and keeps working when they change hands. A credential is shown once, when it is made, and nothing can read it back. Each Mac installs its own when it serves; New script credential makes one for a script. Removing one stops it working at once and cannot be undone.", "delete": false, "create": { "label": "New script credential", "path": "/code/credentials/new" }, "commands": [ { "id": "mint_credential", "label": "Make credential", "object": "link", "kind": "create", "method": "code.mintCredential", "form": true, "data": { "scope": "script" }, "bindings": { "name": "name" }, "receipt": "Credential made", "reveals": { "answer": "secret", "title": "Your script credential", "note": "Copy it now. Cotton cannot show it again, and nothing here can read it back." } }, { "id": "remove", "label": "Remove", "kind": "delete", "method": "code.revokeCredential", "bindings": { "id": "$id" }, "destructive": true, "confirm": "Whatever spends it — a checkout, a script, a runner registering — stops working at once. A Mac installs itself a new one the next time it starts; anywhere else needs a new credential pasted in.", "receipt": "Revoked {name}", "does": "destroys" } ], "tables": [ { "name": "cotton_code_credentials", "columns": [ { "name": "id", "type": "TEXT", "default": null, "nullable": true, "primary_key": true, "declaration": "\n id TEXT PRIMARY KEY", "position": 0 }, { "name": "workspace_id", "type": "TEXT", "default": null, "nullable": false, "primary_key": false, "declaration": "\n workspace_id TEXT NOT NULL", "position": 1 }, { "name": "device_id", "type": "TEXT", "default": null, "nullable": false, "primary_key": false, "declaration": "\n device_id TEXT NOT NULL CHECK (length(trim(device_id)) > 0)", "position": 2 }, { "name": "name", "type": "TEXT", "default": null, "nullable": false, "primary_key": false, "declaration": "\n name TEXT NOT NULL CHECK (length(trim(name)) > 0)", "position": 3 }, { "name": "scope", "type": "TEXT", "default": null, "nullable": false, "primary_key": false, "declaration": "\n scope TEXT NOT NULL CHECK (scope IN ('device', 'script', 'runner'))", "position": 4 }, { "name": "created_at", "type": "TEXT", "default": null, "nullable": false, "primary_key": false, "declaration": "\n created_at TEXT NOT NULL", "position": 5 }, { "name": "expires_at", "type": "TEXT", "default": null, "nullable": true, "primary_key": false, "declaration": "\n expires_at TEXT", "position": 6 }, { "name": "revoked_at", "type": "TEXT", "default": null, "nullable": true, "primary_key": false, "declaration": "\n revoked_at TEXT", "position": 7 }, { "name": "last_used_at", "type": "TEXT", "default": null, "nullable": true, "primary_key": false, "declaration": "\n last_used_at TEXT", "position": 8 }, { "name": "_hlc", "type": "TEXT", "default": "''", "nullable": false, "primary_key": false, "declaration": "\n _hlc TEXT NOT NULL DEFAULT ''", "position": 9 }, { "name": "_born", "type": "TEXT", "default": null, "nullable": true, "primary_key": false, "declaration": "\n _born TEXT", "position": 10 }, { "name": "token_digest", "type": "TEXT", "default": null, "nullable": true, "primary_key": false, "declaration": "\n token_digest TEXT", "position": 11 }, { "name": "minted_by", "type": "TEXT", "default": null, "nullable": true, "primary_key": false, "declaration": "\n minted_by TEXT", "position": 12 } ], "constraints": [ { "declaration": "\n FOREIGN KEY (workspace_id) REFERENCES cotton_workspaces(id) ON DELETE CASCADE\n ", "position": 13 } ], "prefix": "CREATE TABLE IF NOT EXISTS cotton_code_credentials (", "suffix": ")", "indexes": [ "CREATE INDEX IF NOT EXISTS idx_cotton_code_credentials_workspace ON cotton_code_credentials (workspace_id, created_at DESC)", "CREATE INDEX IF NOT EXISTS idx_cotton_code_credentials_author ON cotton_code_credentials (substr(_hlc, 20), _hlc)" ], "full_text": [], "triggers": [] } ], "parts": { "shape": "sheet", "head": { "facts": [ "scope" ] }, "links": [], "lists": [], "acts": { "main": "mint_credential", "more": [], "away": "remove" }, "cards": [ { "column": "line" }, { "column": "last_used_at" } ] }, "readonly_when": "created_at" }