OSS Projects and Documentation
Tiny CBOR
npm i @levischuck/tiny-cborpnpm add @levischuck/tiny-cbordeno add jsr:@levischuck/tiny-cborbunx jsr add @levischuck/tiny-cborThis minimal library decodes and encodes most useful CBOR structures into simple JavaScript structures.
- Maps with keys as
strings ornumbers withCBORTypevalues in JSMaps - Arrays of
CBORTypevalues - integers as
numbers - float32 and float64 as
numbers - float16
NaN,Infinity,-Infinity strings- byte strings as
Uint8Array - booleans
nullandundefined- tags as
CBORTag(tag, value)
Limitations
- No support for indefinite-length arrays, maps, strings, or byte strings.
- Limited support for half-precision floating point numbers.
- JS integers outside the range of
[-9007199254740991, 9007199254740991], seeNumber.MAX_SAFE_INTEGER. - Does not take input of or output to JS Objects – If you're looking to make CBOR parsing and encoding more ergonomic with known structures, see Tiny CBOR Schema below.
- Map keys must be text strings or numbers. Other types are not supported until something like the TC39 Composites proposal reaches baseline support.
- Does not interpret registered tags into other structures like JS Dates.
Tiny CBOR Schema
npm i @levischuck/tiny-cbor-schemapnpm add @levischuck/tiny-cbor-schemadeno add jsr:@levischuck/tiny-cbor-schemabunx jsr add @levischuck/tiny-cbor-schemaThis minimal library decodes and encodes most useful CBOR structures into prespecified JavaScript structures through a schema at runtime! When used in TypeScript, parsed outputs will have the types you expect too. See tiny-cbor, which is automatically included, for limitations on what CBOR types are supported. It works in a similar way to Zod where you define a schema object with functions exported by this library. With this schema in hand, you can use the fromCBOR and toCBOR functions to read, update, and write CBOR binary data.
Tiny Encodings
npm i @levischuck/tiny-encodingspnpm add @levischuck/tiny-encodingsdeno add jsr:@levischuck/tiny-encodingsbunx jsr add @levischuck/tiny-encodingsThis library provides reasonably fast constant-time implementations of:
- Base64 Standard and Base64 URL encoding and decoding
- Hex / Base16 encoding and decoding
Tiny COSE
npm i @levischuck/tiny-cosepnpm add @levischuck/tiny-cosedeno add npm:@levischuck/tiny-cosebun add @levischuck/tiny-coseReads COSE keys and converts them into usable CryptoKey references. Intended use is to register and verify WebAuthn authenticators in Tiny WebAuthn (see below).
Supported signing and verification algorithms include:
- RS256
- RS384
- RS512
- PS256
- PS384
- PS512
- ES256
- ES384
- EdDSA with Ed25519
Limitations
- ES512 is not implemented due to Deno lacking support for the P-521 curve.
- Does not support other keys for algorithms like HMAC, HKDF, AES-GCM, or ECDH keys.
- Does not support or verify COSE messages such as
COSE_SignorCOSE_Mac0. - Does not support COSE headers, signing objects, MAC objects, encryption objects, or other COSE structures.
Tiny WebAuthn
npm i @levischuck/tiny-webauthnpnpm add @levischuck/tiny-webauthndeno add npm:@levischuck/tiny-webauthnbun add @levischuck/tiny-webauthnA server-side WebAuthn library made to be as comprehensible in as little code as possible.
Supports:
- Registering and authenticating roaming authenticators
- Registering and authenticating device-bound authenticators
- Registering and authenticating device-bound passkeys
- Registering and authenticating synced passkeys
JaneTLS
A Cryptography utility implementation in Janet
I no longer use the Janet programming language, so I'm not actively developing this project anymore. If you're looking into what you can do, check out the unit tests. It provides hashing, symmetric cryptography, assymetric cryptography, and encoding utilities. The cryptography primitives are implemented using MBed TLS. Contrary to its name, JaneTLS does not provide a means to facilitate TLS connections.