mirror of
https://github.com/profullstack/logicsrc.git
synced 2026-09-10 19:26:00 +00:00
* Add the LogicSRC OpenCreds specification Leaving a password manager means writing every secret you own to disk in the clear, and losing whatever the spreadsheet had no column for. A CSV is plaintext by construction, lossy by omission, and carries no integrity: nothing in it says which rows were meant to be there, so a truncated import looks exactly like a complete one. The same gap showed up inside LogicSRC. `logicsrc credentials` moves .env secrets and SSH keys through end-to-end-encrypted team vaults, but it can only model a key/value pair. A card, a passport, a login with a TOTP seed, or an OAuth account with a refresh token are all things people already keep in a vault, and none of them are a key/value pair. OpenCreds defines three things: the item, the vault, and the database. - Six item types (login, card, identity, note, key, account) as one record with a type and a named field group, so everything the user typed lives in a single encrypted blob. Codes 1-4 match MarkSyncr's deployed vault and are not renumbered; compatibility is cheaper than elegance. - AES-256-GCM over that record with the item id bound as AAD. Without it, anyone with storage write access could move a low-value login's ciphertext into a high-value row and watch what the user does next. - A key hierarchy where the user key is random, not derived, so a password change re-wraps 32 bytes rather than re-encrypting a vault. The auth hash comes out of a different HKDF label than the wrap key, which is what lets it reach a server at all. - A portable .opencreds file, encrypted by default, whose header is the AAD over the payload -- so the manifest is authenticated by the same tag as the data and a truncated import fails rather than reporting success. The plaintext form exists because people move to products that read nothing else; it is opt-in, confirmed, 0600, and labelled "protected": false in its own header. Namespaces are carried as data, not fixed by the spec: labels are compiled into every ciphertext a vault has written, so editing one does not migrate a vault, it makes it undecryptable. MarkSyncr's deployed vault is conformant by declaring `marksyncr`. Ships: prd/0004, nine spec pages under docs/opencreds/, six JSON Schemas, the @logicsrc/opencreds reference implementation with CSV importers for five products, `logicsrc vault` and the standalone `opencreds` binary, and the spec page at logicsrc.com/opencreds. `vault` rather than `creds` because `creds` is already an alias of `logicsrc credentials`, and the two are different: one moves a pair between providers, the other stores a record. @logicsrc/validators now registers every schema by $id before compiling, so the database schema can $ref the item and manifest schemas rather than restating them. 120 tests, including CLI end-to-end coverage of the masking rules, exit codes, and the manifest-mismatch path. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QRQrfuwuYKKV5UB9kLHuX5 * Make the OpenCreds conformance claim executable The conformance page described a fixture suite and an `opencreds conformance` command that did not exist. A specification that documents a conformance surface it cannot run is a specification nobody can hold to, including us. `opencreds conformance` now runs the requirement list as code -- one check per C-number, carrying its own id and level -- and emits the report shape the spec publishes. It exits 2 when a MUST does not pass, so it can gate CI directly. The reference implementation reports 29 passed, 0 failed, 1 skipped; the skip is C19, because key management for the team profile lives in @logicsrc/plugin-credential-sharing rather than in this package, and a skipped MAY does not affect conformance. Fixtures are generated (`--emit-fixtures <dir>`) rather than hand-written. A vector produced by an implementation and then verified by it is worth more than a JSON file someone typed: the typed file drifts silently when the format moves, and the generated one cannot. Fourteen files, including an invalid/ set every conforming reader must reject -- a wrong field group, a weak KDF, an unregistered namespace, a short payload and a tampered manifest. The CLI requirements stay with the end-to-end tests that drive the real binary through a child process; a command cannot meaningfully check its own exit codes, and a masked value that is only masked in the library is not masked. conformance.md and cli.md now describe what ships. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QRQrfuwuYKKV5UB9kLHuX5 * Add @logicsrc/opencreds to the lockfile `npm ci` refuses a lockfile that does not match package.json, and the new workspace package plus the CLI's dependency on it were never recorded: the worktree was bootstrapped by hardlinking node_modules rather than installing, so npm was never asked to update the lock. Adds the workspace link and the package entry. No dependency versions move. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QRQrfuwuYKKV5UB9kLHuX5 * Register PRD 0004, and stop the fixtures looking like real secrets Two CI failures, both mine. `prd/README.md` is generated by `logicsrc prd index --write` and the scaffold test asserts it is current, so adding a PRD without regenerating it leaves the repo's own conformance check failing. Regenerated. The MCP test asserts the next free PRD id against the live prd/ directory — its comment says it advances with every PRD added — so it moves to 0005. ThreatCrush flagged three of the example strings: a PEM header in the item-model docs and in the conformance fixture, and an `sk_live_` prefixed token. All placeholders, none real, but the finding is the scanner working. A fixture only has to exercise the field, and a real-looking private key header or live-key prefix sitting in the tree trains both the scanner and the people reading its output to shrug at exactly the shape that matters. Replaced with obvious placeholders rather than suppressing the rule. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QRQrfuwuYKKV5UB9kLHuX5 --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
129 lines
5.5 KiB
Markdown
129 lines
5.5 KiB
Markdown
# OpenCreds
|
|
|
|
Status: 0.1 draft · reference implementation available (`@logicsrc/opencreds`)
|
|
|
|
Slug: `opencreds`
|
|
|
|
OpenCreds is a LogicSRC OpenSpec for **credential records and portable vaults**.
|
|
It defines what a credential item is, how a vault is encrypted, and what a vault
|
|
looks like as a file — so that moving a vault between two products is a
|
|
supported operation rather than a plaintext CSV export.
|
|
|
|
It exists because leaving a password manager currently means writing every
|
|
secret you own to disk in the clear, and losing whatever the spreadsheet had no
|
|
column for.
|
|
|
|
- Full specification: [`docs/opencreds/spec.md`](./opencreds/spec.md)
|
|
- Item model: [`docs/opencreds/item-model.md`](./opencreds/item-model.md)
|
|
- Cryptography: [`docs/opencreds/crypto.md`](./opencreds/crypto.md)
|
|
- Portable database: [`docs/opencreds/database.md`](./opencreds/database.md)
|
|
- Importing from other products: [`docs/opencreds/interop.md`](./opencreds/interop.md)
|
|
- CLI: [`docs/opencreds/cli.md`](./opencreds/cli.md)
|
|
- Conformance: [`docs/opencreds/conformance.md`](./opencreds/conformance.md)
|
|
- Security model: [`docs/opencreds/security.md`](./opencreds/security.md)
|
|
- FAQ: [`docs/opencreds/faq.md`](./opencreds/faq.md)
|
|
|
|
## What it defines
|
|
|
|
**One record, six types.** Logins, cards, identities, notes, keys and accounts
|
|
are not six features — they are one record with a `type` and a named field
|
|
group. Everything the user typed lives inside a single encrypted blob, which is
|
|
what makes password history free: it is an array in that blob, encrypted by
|
|
construction rather than needing its own protected table.
|
|
|
|
```json
|
|
{
|
|
"v": 1,
|
|
"id": "6f1e7b3a-1f4e-4f0f-9a1d-6a2f0b6f8d21",
|
|
"type": "login",
|
|
"name": "GitHub",
|
|
"folderId": null,
|
|
"notes": "",
|
|
"login": {
|
|
"username": "anthony",
|
|
"password": "…",
|
|
"totp": "otpauth://totp/GitHub:anthony?secret=…",
|
|
"uris": [{ "uri": "https://github.com", "match": "domain" }]
|
|
},
|
|
"history": [],
|
|
"createdAt": "2026-08-29T00:00:00.000Z",
|
|
"updatedAt": "2026-08-29T00:00:00.000Z"
|
|
}
|
|
```
|
|
|
|
**One envelope.** AES-256-GCM over that JSON, with the item id bound in as
|
|
additional authenticated data. A ciphertext moved from one row to another fails
|
|
to decrypt rather than quietly showing the wrong credential — without that,
|
|
anyone with database write access could swap a low-value login's ciphertext into
|
|
a high-value one and watch what the user does next.
|
|
|
|
**One key hierarchy.** The master password is stretched once by PBKDF2-SHA256
|
|
into a master key, and everything else is derived from it by HKDF with a
|
|
distinct label. The only password-derived value that ever reaches a server comes
|
|
out of a different label than the wrapping key, so holding it does not help
|
|
decrypt anything.
|
|
|
|
**One file.** A vault exports as a single `.opencreds` JSON document, encrypted
|
|
by default, carrying a manifest — item count, type histogram, digest over the
|
|
item ids — that is authenticated by the same tag as the data. A truncated
|
|
import fails instead of looking like a complete one.
|
|
|
|
## What it does not define
|
|
|
|
Sync. Storage. Autofill. A conforming vault is a file and a key; how two devices
|
|
reconcile, where the ciphertext lives, and how a browser fills a form are all
|
|
left to the implementation.
|
|
|
|
## Implementations
|
|
|
|
| Implementation | Profile | Namespace | Notes |
|
|
| --- | --- | --- | --- |
|
|
| `@logicsrc/opencreds` | `user`, `team` | `opencreds` | Reference implementation; local store and CLI |
|
|
| `logicsrc credentials` | `team` | `opencreds` | `.env` secrets and SSH keys as `key` items |
|
|
| `@marksyncr/vault` | `user` | `marksyncr` | Pre-dates the spec; conformant via its declared namespace |
|
|
|
|
MarkSyncr's vault shipped before OpenCreds and has domain-separation labels
|
|
baked into every ciphertext already written. Labels cannot be edited — changing
|
|
one makes every existing vault undecryptable — so the spec carries the label
|
|
prefix as a declared per-vault `namespace` rather than mandating a single
|
|
string. See [crypto.md](./opencreds/crypto.md#namespaces).
|
|
|
|
## Quick start
|
|
|
|
```bash
|
|
# Create a vault (asks for a master password; prints a recovery key once)
|
|
logicsrc vault init
|
|
|
|
# Add items
|
|
logicsrc vault add login --name GitHub --username anthony --url https://github.com
|
|
logicsrc vault add card --name "Visa ending 4242"
|
|
logicsrc vault add key --name "deploy key" --key-type ssh --file ~/.ssh/id_ed25519
|
|
|
|
# List (never prints secret values)
|
|
logicsrc vault list --type login
|
|
|
|
# Move the vault somewhere else, encrypted
|
|
logicsrc vault export --out vault.opencreds
|
|
logicsrc vault import vault.opencreds --dry-run
|
|
|
|
# Import from another product
|
|
logicsrc vault import bitwarden-export.csv --source bitwarden --dry-run
|
|
```
|
|
|
|
The same commands ship as the standalone `opencreds` binary, so
|
|
`logicsrc vault validate` and `opencreds validate` are the same contract.
|
|
|
|
## Relationship to the other LogicSRC specs
|
|
|
|
- **Credential Sharing** ([credential-sharing.md](./credential-sharing.md))
|
|
moves secrets *between providers* — `.env`, Doppler, Railway, GitHub, SSH. It
|
|
models a key/value pair and a sync plan. OpenCreds models the **record** and
|
|
the **vault file**. A `key` item is what a synced `.env` entry becomes when it
|
|
is stored rather than moved.
|
|
- **OpenContext** ([opencontext.md](./opencontext.md)) governs what an agent may
|
|
*read*. An agent that resolves a context bundle may be entitled to one
|
|
OpenCreds item and not the vault; the permission decision is OpenContext's,
|
|
the record shape is OpenCreds'.
|
|
- **OpenOntology** ([openontology.md](./openontology.md)) names the entities a
|
|
credential belongs to. An `account` item's `provider` is an ontology entity,
|
|
not a free string, where an ontology is in use.
|