IKey, IKeyPair, IPrivateKey, IPublicKey, ISigningKeyPair, IEncryptionKeyPair — clean separation of concernsurn:nacl:pk:ed25519:<base64url>) — deterministic, no external registry neededIBytesEncode, IHexEncode, Ibase64urlEncode — keys naturally convert between representations(make-key-pair :sodium :ed25519) — extensible via multimethodsTEd25519KeyPair, TEd25519PrivateKey, TEd25519PublicKeyTCurve25519KeyPair, TCurve25519PrivateKey, TCurve25519PublicKey, TCurve25519DHKeybox-easy vs box-detached vs raw to-buf!;; Keypairs as simple maps
(caesium.crypto.sign/keypair!) ;; → {:public bytes :secret bytes}
(caesium.crypto.box/keypair!) ;; → {:public bytes :secret bytes}
;; Signing
(caesium.crypto.sign/sign msg sk) ;; → signature-bytes
(caesium.crypto.sign/verify sig pk) ;; → throws on failure
;; Encryption
(caesium.crypto.box/encrypt pt nonce their-pk my-sk) ;; → ciphertext
(caesium.crypto.box/decrypt ct nonce their-pk my-sk) ;; → plaintext
KeyPairGenerator.getInstance("Ed25519")Signature.getInstance("Ed25519")MessageDigest.getInstance("SHA-256");; 1. Construct envelope (map with :message, :signer-key, :request-id, :expires)
;; 2. Canonicalize via cedn/canonical-bytes
;; 3. SHA-256 hash the canonical bytes
;; 4. Ed25519 sign the hash
;; 5. Return {:type :stroopwafel/signed-envelope :envelope env :signature sig}
:signer-key, :next-key, :external-key)(cedn/canonical-bytes value) ;; → byte array (deterministic UTF-8)
(cedn/canonical-str value) ;; → string
(cedn/valid? value) ;; → boolean (type check)
nil, boolean, int, double, string, keyword, symbol, list, vector, set, map, #inst, #uuid, #bytes
(uuidv7/uuidv7) ;; → UUID (monotonic within millisecond)
(uuidv7/extract-ts u) ;; → epoch-ms
(uuidv7/uuidv7? u) ;; → boolean
Can you improve this documentation?Edit on GitHub
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 |