Signatures on PSOSF archives, as defined in the PSOSF specification.
An archive's signatures.json holds a digest list (the SHA-256 of every other file, sorted by path) and Ed25519 signatures over messages that bind each signer, role and time to that list. Any change to the archive's content invalidates every signature.
(verify-entries entries {:resolve-key f}) (sign-entries entries {:private-key k ...})
The digest list and the signature message are built here in portable code, so every implementation produces the same bytes. Hashing and Ed25519 use the JVM's built-in providers, or WebCrypto in JavaScript.
Keys are resolved through a function the caller supplies, from a key id to a key record (string keys):
{"key-id" "acme/users/a.mensah@acme.example/2026-11" "public-key" "<Base64 of the raw 32-byte Ed25519 public key>" "owner" {"kind" "human" "id" "a.mensah@acme.example"} "registered-at" "2026-11-02T14:00:00Z" "revoked-at" nil "custody" "device"}
custody records where the private key is held: "device", on the signer's own machine, or "service", held by the Zen service, which signs for the signed-in user. A record without it is treated as "device".
On the JVM, verify-entries and sign-entries return their results; in JavaScript they return promises, using WebCrypto.
This is the form WebCrypto exports (exportKey "raw"), and the form the Zen service returns for a key id.
Signatures on PSOSF archives, as defined in the PSOSF specification.
An archive's signatures.json holds a digest list (the SHA-256 of every
other file, sorted by path) and Ed25519 signatures over messages that bind
each signer, role and time to that list. Any change to the archive's
content invalidates every signature.
(verify-entries entries {:resolve-key f})
(sign-entries entries {:private-key k ...})
The digest list and the signature message are built here in portable code,
so every implementation produces the same bytes. Hashing and Ed25519 use
the JVM's built-in providers, or WebCrypto in JavaScript.
Keys are resolved through a function the caller supplies, from a key id to
a key record (string keys):
{"key-id" "acme/users/a.mensah@acme.example/2026-11"
"public-key" "<Base64 of the raw 32-byte Ed25519 public key>"
"owner" {"kind" "human" "id" "a.mensah@acme.example"}
"registered-at" "2026-11-02T14:00:00Z"
"revoked-at" nil
"custody" "device"}
custody records where the private key is held: "device", on the signer's
own machine, or "service", held by the Zen service, which signs for the
signed-in user. A record without it is treated as "device".
On the JVM, verify-entries and sign-entries return their results; in
JavaScript they return promises, using WebCrypto.
This is the form WebCrypto exports (exportKey "raw"), and the form the
Zen service returns for a key id.(archive-digest entries)The SHA-256 of the digest list, identifying the archive's content.
The SHA-256 of the digest list, identifying the archive's content.
(attach-signature entries details signature-base64)Adds a signature made over (signing-message entries details). When :public-key (Base64, raw 32 bytes) is given in details, the signature is checked first and refused if it does not verify.
Adds a signature made over (signing-message entries details). When :public-key (Base64, raw 32 bytes) is given in details, the signature is checked first and refused if it does not verify.
A promise of the entries with a signature added. When :public-key (Base64, raw 32 bytes) is given in details, the signature is checked first, and the promise rejects if it does not verify.
A promise of the entries with a signature added. When :public-key (Base64, raw 32 bytes) is given in details, the signature is checked first, and the promise rejects if it does not verify.
(digest-list-text digests)The digest list as text: one line per file, the lowercase hex SHA-256, two spaces and the path, sorted by path, each line ending in a line feed. digests maps path to hex digest.
The digest list as text: one line per file, the lowercase hex SHA-256, two spaces and the path, sorted by path, each line ending in a line feed. digests maps path to hex digest.
(digests entries)The digest map {path hex} of every entry except signatures.json.
The digest map {path hex} of every entry except signatures.json.
A promise of the digest map {path hex} of every entry except signatures.json.
A promise of the digest map {path hex} of every entry except signatures.json.
(generate-key-pair)A new Ed25519 key pair: {"private-key" seed, "public-key" raw}, each Base64.
A new Ed25519 key pair: {"private-key" seed, "public-key" raw}, each Base64.
(message {:strs [algorithm key-id role signer signed-at]} digests)The text a signature is made over, for a signature map with string keys and the archive's digest map.
The text a signature is made over, for a signature map with string keys and the archive's digest map.
(private-key seed-base64)A JVM PrivateKey from the Base64 of a raw 32-byte Ed25519 seed, for callers (Python, C) that hold the key as bytes.
A JVM PrivateKey from the Base64 of a raw 32-byte Ed25519 seed, for callers (Python, C) that hold the key as bytes.
(public-key raw-base64)A JVM PublicKey from the Base64 of a raw 32-byte Ed25519 key.
A JVM PublicKey from the Base64 of a raw 32-byte Ed25519 key.
(raw-public-key k)The Base64 of the raw 32 bytes of a JVM Ed25519 PublicKey, as stored in a key record.
The Base64 of the raw 32 bytes of a JVM Ed25519 PublicKey, as stored in a key record.
(raw-public-key public-key)A promise of the Base64 of a CryptoKey public key's raw 32 bytes, as registered with the Zen service.
A promise of the Base64 of a CryptoKey public key's raw 32 bytes, as registered with the Zen service.
(sha-256-hex s)Lowercase hex SHA-256 of a string's UTF-8 bytes.
Lowercase hex SHA-256 of a string's UTF-8 bytes.
A promise of the lowercase hex SHA-256 of a string's UTF-8 bytes.
A promise of the lowercase hex SHA-256 of a string's UTF-8 bytes.
(sign-entries entries {:keys [private-key] :as details})Adds a signature to an archive, returning the new entries. Every other file must already be in its final form; signing never changes them. An existing signatures.json keeps its signatures, so an approver signs an archive the author has already signed. :private-key an Ed25519 private key: see private-key :key-id the key's id, as registered :role "author" or "approver" :signer {"kind" "human"|"agent" "id" ... "model" ...} :signed-at ISO 8601 UTC time
Adds a signature to an archive, returning the new entries. Every other
file must already be in its final form; signing never changes them. An
existing signatures.json keeps its signatures, so an approver signs an
archive the author has already signed.
:private-key an Ed25519 private key: see private-key
:key-id the key's id, as registered
:role "author" or "approver"
:signer {"kind" "human"|"agent" "id" ... "model" ...}
:signed-at ISO 8601 UTC timeA promise of the entries with a signature added. :private-key is a WebCrypto Ed25519 CryptoKey, which may be non-extractable.
A promise of the entries with a signature added. :private-key is a WebCrypto Ed25519 CryptoKey, which may be non-extractable.
(signing-message entries details)Signing in two steps, for a key the library cannot hold (a key service, a hardware key, the Zen service): the exact text to sign. Sign its UTF-8 bytes with Ed25519, then pass the Base64 signature to attach-signature with the same details. details: :key-id :role :signer :signed-at.
Signing in two steps, for a key the library cannot hold (a key service, a hardware key, the Zen service): the exact text to sign. Sign its UTF-8 bytes with Ed25519, then pass the Base64 signature to attach-signature with the same details. details: :key-id :role :signer :signed-at.
A promise of the exact text to sign, for signing in two steps. Sign its UTF-8 bytes with Ed25519, then call attach-signature with the same details.
A promise of the exact text to sign, for signing in two steps. Sign its UTF-8 bytes with Ed25519, then call attach-signature with the same details.
(verify-entries entries {:keys [resolve-key] :as opts})Verifies an archive's signatures. Options: :resolve-key key id -> key record, or nil when unknown (required) :received-at ISO 8601 UTC time the archive was received; a key revoked after this time still vouches for it :approver-custody custodies an approver's key may have, e.g. #{"device"}; any custody when absent Returns {:status :unsigned | :verified | :failed :digests {:match bool :changed [...] :added [...] :removed [...]} :signatures [{:key-id :role :signer :signed-at :custody :valid :reason}] :errors [...]} :verified means the files are exactly those signed and every signature is valid. Signatures are never removed, whatever the result.
Verifies an archive's signatures. Options:
:resolve-key key id -> key record, or nil when unknown (required)
:received-at ISO 8601 UTC time the archive was received; a key
revoked after this time still vouches for it
:approver-custody custodies an approver's key may have, e.g.
#{"device"}; any custody when absent
Returns
{:status :unsigned | :verified | :failed
:digests {:match bool :changed [...] :added [...] :removed [...]}
:signatures [{:key-id :role :signer :signed-at :custody :valid :reason}]
:errors [...]}
:verified means the files are exactly those signed and every signature
is valid. Signatures are never removed, whatever the result.A promise of the same result as the JVM's verify-entries. :resolve-key may return a key record or a promise of one.
A promise of the same result as the JVM's verify-entries. :resolve-key may return a key record or a promise of one.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |