Home

Awesome

simple-cesr

simple-cesr is a simple, limited, true-to-spec implementation of Composable Event Streaming Representation (CESR). It is compatible with Node.js and major browsers. It has a simple API for encoding and transforming primitives across three domain representations (Raw, Text, and Binary), as discussed in the spec. It conspicuously adheres to terminology from the spec and carefully avoids introducing outside concepts.

For now, we have only implemented a selected subset of primitives from the small fixed raw size and large fixed raw size tables:

CodeDescription
ASeed of Ed25519 private key
BEd25519 non-transferable prefix public verification key
CX25519 public encryption key
DEd25519 public verification key
EBlake3-256 Digest
FBlake2b-256 Digest
GBlake2s-256 Digest
HSHA3-256 Digest
ISHA2-256 Digest
JSeed of ECDSA secp256k1 private key
MShort number 2 byte base-2
NBig number 8 byte base-2
OX25519 private decryption key
0ARandom salt, seed, private key, or sequence number of length 128 bits
0BEd25519 signature
0CECDSA secp256k1 signature
0DBlake3-512 Digest
0EBlake2b-512 Digest
0FSHA3-512 Digest
0GSHA2-512 Digest
0HLong number 4 byte base-2
1AAAECDSA secp256k1 non-transferable prefix public verification key
1AABECDSA secp256k1 public verification or encryption key
1AACEd448 non-transferable prefix public verification key
1AADEd448 public verification key
1AAEEd448 signature
1AAFTag Base64 4 chars or 3 byte base-2 number

You can find the complete list of all the primitives supported by the CESR protocol in the spec.

This implementation is consistent with the 1.0 spec housed at IETF. We have not considered the soon-to-be-finished CESR 2.0 spec from the Trust Over IP Foundation but plan to do so in upcoming releases.

Usage

npm install @simple-ssi/simple-cesr

then:

const cesr = require('@simple-ssi/simple-cesr')

or

import * as cesr from '@simple-ssi/simple-cesr'

API

The API has three encode functions and three transform functions.

Encode

Encode functions are in the form function (code, raw).

Encode Functions:

Transform

Transform functions are in the form function (rawOrTextOrBinary).

Transform Functions:

Development

Run unit tests.

npm test

Run a high-level sanity test suite to verify the consistency of simple-cesr's output with another prominent CESR implementation, the matter class from signify-ts.

npm run standards-test

Run both test suites.

npm run all-tests

Run all tests, format the code, transpile for ECMAScript and CommonJS, and write the output to the dist directory at the project's root.

npm run full-build

Getting Started

Three files that serve as a good starting point for developers becoming familiar with the project.

src/api/encode/text.ts src/api/transform/transformers/transformTextToRaw.ts src/implementation/make.ts