OSS Projects and Documentation
Tiny CBOR
npm i @levischuck/tiny-cbor
pnpm add @levischuck/tiny-cbor
deno add jsr:@levischuck/tiny-cbor
bunx jsr add @levischuck/tiny-cbor
This minimal library decodes and encodes most useful CBOR structures into simple JavaScript structures.
- Maps with keys as
string
s ornumber
s withCBORType
values in JSMap
s - Arrays of
CBORType
values - integers as
number
s - float32 and float64 as
number
s - float16
NaN
,Infinity
,-Infinity
string
s- byte strings as
Uint8Array
- booleans
null
andundefined
- 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-schema
pnpm add @levischuck/tiny-cbor-schema
deno add jsr:@levischuck/tiny-cbor-schema
bunx jsr add @levischuck/tiny-cbor-schema
This 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-encodings
pnpm add @levischuck/tiny-encodings
deno add jsr:@levischuck/tiny-encodings
bunx jsr add @levischuck/tiny-encodings
This 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-cose
pnpm add @levischuck/tiny-cose
deno add npm:@levischuck/tiny-cose
bun add @levischuck/tiny-cose
Reads 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_Sign
orCOSE_Mac0
. - Does not support COSE headers, signing objects, MAC objects, encryption objects, or other COSE structures.
Tiny WebAuthn
npm i @levischuck/tiny-webauthn
pnpm add @levischuck/tiny-webauthn
deno add npm:@levischuck/tiny-webauthn
bun add @levischuck/tiny-webauthn
A 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.