rbor 0.1.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +79 -0
  3. data/lib/rbor.rb +2 -1
  4. metadata +6 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f277956fa01f8ecc1f4adcc4fc2168b0b6a7fea002a3330dce4a89b4fa2f83b8
4
- data.tar.gz: 36568d6d3106fa0193be560d76396f7e8bbaca5e1488970a58051ce1cd2fc468
3
+ metadata.gz: 7cf669e2e3de8dcd659e40222892ac70837e8207d38202c9024673944d3b0a01
4
+ data.tar.gz: 261366e3e566152139ed7e08b73759be7e4eb3db91c574eadb4374d59b8b092d
5
5
  SHA512:
6
- metadata.gz: 49e15f6656f1beec5746aae587162e7732ba44c33ccbcccfb70b27d30240a27dec73dfa89f538e6dd8bd44d1fbf40c8d6c371535806ad32c942b6827fec2489e
7
- data.tar.gz: d3641a6e489c7914027f4de2be93b0765b44be898386638376020182778357f8bbf0f2841d76695cc77e51b08d2b525649632f3929829d673c7d6f35e703dcb6
6
+ metadata.gz: 4cabd7d560af3a52010635910d9afc9a1f25e708623a62dd2a51d3a6be7d321a3d104ce21276bd5fd23e45c59fd94b3e79da5c6f6ac7d1e5a592aa51525db624
7
+ data.tar.gz: 5aac68fffda7a647c1fccf4d3986113f17ff25c33a5453076423062ef30fdf880fb12cdcf30d5e2dee6e2d6cc42b7b066ba8a01bd7b848f25f19e3dfbbdcbebe
data/README.md ADDED
@@ -0,0 +1,79 @@
1
+ # Ruby-cBOR
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/rbor.svg)](https://badge.fury.io/rb/rbor)
4
+
5
+ The Concise Binary Object Representation (CBOR) is a data format whose
6
+ design goals include the possibility of extremely small code size, fairly
7
+ small message size, and extensibility without the need for version negotiation
8
+ (RFC8949). It is used in different protocols like the Client to Authenticator
9
+ Protocol CTAP2 which is a essential part of FIDO2 authenticators/ Passkeys.
10
+
11
+ This gem implements de-/serialization for the following Ruby classes:
12
+
13
+ - `Integer`
14
+ - `String`
15
+ - `Array`
16
+ - `Hash`
17
+ - `FalseClass`
18
+ - `TrueClass`
19
+ - `NilClass`
20
+
21
+ Furthermore, serialization adheres to the [CTAP2 canonical CBOR encoding form](https://fidoalliance.org/specs/fido-v2.0-ps-20190130/fido-client-to-authenticator-protocol-v2.0-ps-20190130.html#ctap2-canonical-cbor-encoding-form), i.e.:
22
+
23
+ - Integers are encoded as small as possible.
24
+ - The expression of lengths is encoded as small as possible.
25
+ - No support for indefinite-length items.
26
+ - Keys of Hashes/Maps are sorted lowest value to highest. Sorting rules are:
27
+ - If the major types are different, the one with the lower value in numerical order sorts earlier.
28
+ - If two keys have different lengths, the shorter one sorts earlier.
29
+ - If two keys have the same length, the one with the lower value in (byte-wise) lexical order sorts earlier.
30
+
31
+ ## Usage
32
+
33
+ Requiring `rbor` exposes two methods for the aforementioned classes: `cbor_serialize`
34
+ and `cbor_deserialize`. Use `cbor_serialize` to translate an object into CBOR and
35
+ `cbor_deserialize` to de-serialize CBOR data (`String` or `Array`) into a Ruby object.
36
+
37
+ ```irb
38
+ 3.3.5 :001 > require 'rbor'
39
+ => true
40
+ 3.3.5 :002 > {1 => 2, 3 => 3}.cbor_serialize
41
+ => "\xA2\x01\x02\x03\x03"
42
+ 3.3.5 :003 > "\xA2\x01\x02\x03\x03".cbor_deserialize
43
+ => [{1=>2, 3=>3}, []]
44
+ ```
45
+
46
+ The `cbor_deserialize` method return an `Array` with two values: a de-serialized Ruby object
47
+ and an `Array` representing the remaining bytes.
48
+
49
+ ## Build
50
+
51
+ ### Build gem
52
+
53
+ ```bash
54
+ gem build rbor.gemspec
55
+ gem push rbor-x.y.z.gem
56
+ ```
57
+
58
+ ## Docs
59
+
60
+ The project uses Yard to build the documentation. You can install it using
61
+ the `gem` command.
62
+
63
+ ```bash
64
+ gem install yard
65
+ ```
66
+
67
+ To build the documentation run:
68
+
69
+ ```
70
+ yard
71
+ ```
72
+
73
+ ## Testing
74
+
75
+ You can run tests with [rspec](https://rspec.info/):
76
+
77
+ ```bash
78
+ rspec --format doc
79
+ ```
data/lib/rbor.rb CHANGED
@@ -4,7 +4,7 @@
4
4
  # (RFC8949). It is used in different protocols like the Client to Authenticator
5
5
  # Protocol CTAP2 which is a essential part of FIDO2 authenticators/ Passkeys.
6
6
 
7
- class Cbor
7
+ module Cbor
8
8
 
9
9
  end
10
10
 
@@ -13,3 +13,4 @@ require_relative 'rbor/string.rb'
13
13
  require_relative 'rbor/array.rb'
14
14
  require_relative 'rbor/hash.rb'
15
15
  require_relative 'rbor/bool.rb'
16
+ require_relative 'rbor/streaming.rb'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David P. Sugar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-08 00:00:00.000000000 Z
11
+ date: 2024-09-09 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: The Concise Binary Object Representation (CBOR) is a data format whose
14
14
  design goals include the possibility of extremely small code size, fairly small
@@ -20,6 +20,7 @@ executables: []
20
20
  extensions: []
21
21
  extra_rdoc_files: []
22
22
  files:
23
+ - README.md
23
24
  - lib/rbor.rb
24
25
  - lib/rbor/array.rb
25
26
  - lib/rbor/bool.rb
@@ -29,7 +30,9 @@ files:
29
30
  homepage: https://rubygems.org/gems/rbor
30
31
  licenses:
31
32
  - MIT
32
- metadata: {}
33
+ metadata:
34
+ source_code_uri: https://github.com/r4gus/rbor
35
+ documentation_uri: https://r4gus.github.io/rbor/
33
36
  post_install_message:
34
37
  rdoc_options: []
35
38
  require_paths: