Skip to content

rezn-project/rezn-jcsd

Repository files navigation

rezn-jcsd

rezn-jcsd is a fast, dependency-free UNIX socket daemon for canonicalizing JSON according to RFC 8785 (JCS).


Why?

https://discuss.ocaml.org/t/canonical-json-with-yojson-for-signature-verification/16725/16


Features

  • Canonicalizes JSON via UNIX socket or CLI
  • Vendored Go implementation (Apache 2.0)
  • C++ implementation based on the Go implementation - suitable for FFI
  • Suitable for cryptographic signing pipelines
  • Minimal, auditable, production-ready

Usage

Socket mode (default)

Launch the service (creating socket file in /tmp for quick testing)

REZN_JCSD_SOCKET=/tmp/jcsd.sock ./jcsd

Hit it with some JSON

echo '{"op":"canon","source":"{ \"b\":2, \"a\":1 }"}' | socat - UNIX-CONNECT:/tmp/jcsd.sock

Returns:

{"result":"{\"a\":1,\"b\":2}"}

CLI mode

cat input.json | reznjcs-cli > canonical.json

Environment

  • REZN_JCSD_SOCKET: override default socket path (/run/rezn-jcsd/jcs.sock)

Building

go build -o reznjcs-cli ./cmd/cli
go build -o jcsd ./cmd/jcsd

C++ implementation

See the corresponding readme


License