CBOR library for the Crystal language. Similar to the JSON-mapping implementation.
Go to file
Alberto Restifo 2f8693ca34 Implement CBOR::Serializable to decode from_cbor
The CBOR::Serializable macro implements a from_cbor method on any
object on which it's included.
2020-05-22 22:06:53 +02:00
.vscode Add some works to the dictionary 2020-05-09 20:27:53 +02:00
spec Implement CBOR::Serializable to decode from_cbor 2020-05-22 22:06:53 +02:00
src Implement CBOR::Serializable to decode from_cbor 2020-05-22 22:06:53 +02:00
.build.yml Work on lexer and diagnostic representation 2020-04-20 14:57:20 +02:00
.editorconfig Initialize library 2020-04-17 14:32:43 +02:00
.gitignore Initialize library 2020-04-17 14:32:43 +02:00
LICENSE Initialize library 2020-04-17 14:32:43 +02:00
README.md Add issue tracker link 2020-05-08 11:43:41 +02:00
shard.yml Add repository details 2020-04-19 14:05:27 +02:00

README.md

CBOR

builds.sr.ht status

This library implements the RFC7049: Concise Binary Object Representation (CBOR) in Crystal.

WARNING: This library is still a work in progress.

Features

  • Full support for diagnostic notation
  • Assign a field to a type base on the CBOR tag
  • Support for a wide range of IANA CBOR Tags (see below)

Installation

  1. Add the dependency to your shard.yml:

    dependencies:
      cbor:
        git: https://git.sr.ht/~arestifo/crystal-cbor
    
  2. Run shards install

Usage

require "cbor"

TODO: Write usage instructions here

Supported tags

All the tags specified in section 2.4 of RFC 7049 are supported and the values are encoded in the respective Crystal types:

  • Time
  • BigInt
  • BigDecimal

Limitations

Maximum Array/String array/Bytes array length

The spec allows for the maximum length of arrays, string arrays and bytes array to be a UInt64.

While this library supports lengths expressed as a UInt64, it must not exceed Int32::MAX.

Development

TODO: Write development instructions here

Contributing

The code is hosted on SourceHut and the development happens over the crystal-cbor mailing list.

To learn how to use git send-email, there is a great step-by-step tutorial at git-send-email.io. You might also want to read the mailing list etiquette.