{"format_version": 1,"id": "code_credential","name": "Credential","plural": "Credentials for cloning","builtin": true,"visibility": "owner","title": "name","columns": [ {"key": "device_id","type": "text","readonly": true }, {"key": "name","name": "Name","type": "text","required": true }, {"key": "scope","name": "Scope","type": "text","readonly": true }, {"key": "expires_at","type": "date","format": "calendar-datetime","readonly": true }, {"key": "revoked_at","type": "date","format": "calendar-datetime","readonly": true }, {"key": "last_used_at","name": "Last used","type": "date","readonly": true }, {"key": "token_digest","type": "text","readonly": true }, {"key": "minted_by","type": "text","readonly": true }, {"key": "read_only","type": "number","readonly": true }, {"key": "line","name": "Scope and last use","type": "text","readonly": true }, {"key": "place","name": "Where","type": "choice","choices": ["mine","other" ],"readonly": true }, {"key": "created_at","name": "Made","type": "date","readonly": true } ],"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 device or script 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 read credential only lists runs and reads their jobs and logs; it cannot clone, push or change code. 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.","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 }, {"name": "read_only","type": "INTEGER","default": "0","nullable": false,"primary_key": false,"declaration": " read_only INTEGER NOT NULL DEFAULT 0","position": 13 } ],"constraints": [ {"declaration": "\n FOREIGN KEY (workspace_id) REFERENCES cotton_workspaces(id) ON DELETE CASCADE\n ","position": 14 } ],"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": [] } ],"picture": null,"engine": "code","date": null,"project": null,"order": null,"slip": {"title": "name","subtitle": "line","trailing": null,"photo": null,"toggle": null },"tile": {"face": "slip-list" },"page": [ {"heading": null,"columns": ["name","line","scope","last_used_at","created_at" ] } ],"readonly_when": "created_at","list_route": "/code/credentials","scope": "personal","setup": true,"group": {"column": "place","sections": [ {"heading": null,"values": ["mine" ] }, {"heading": null,"values": ["other" ] } ] },"empty": {"title": "No credentials yet.","message": "Make one with New script credential above." },"create": {"label": "New script credential","path": "/code/credentials/new" },"delete": false,"commands": [ {"id": "mint_credential","label": "Make credential","kind": "create","method": "code.mintCredential","data": {"scope": "script" },"bindings": {"name": "name" },"receipt": "Credential made","object": "link","form": true,"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","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.","bindings": {"id": "$id" },"receipt": "Revoked {name}","does": "destroys" } ],"parts": {"shape": "sheet","head": {"facts": ["scope" ] },"links": [],"lists": [],"acts": {"main": "mint_credential","more": [],"away": "remove" },"cards": [ {"column": "line" }, {"column": "last_used_at" } ] }}