cddlc 0.4.2 → 0.4.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f2a8aaeed392227b1d7650ddc62d010a577360f06c3bd07f879dd22d6a2e3ce9
4
- data.tar.gz: e0db7efbdb77e5cc3f770e6a586ce710414e82419127f7b08302248943f1e045
3
+ metadata.gz: 170d7338cde350c8b6ee58e02b2c7b0ada1c72a1500b4ea9ce81414f9915f8a9
4
+ data.tar.gz: 6ac50c47755da10bea332c53b4986393541284197e266d1450d8035d11bf9333
5
5
  SHA512:
6
- metadata.gz: 2b95180d14a2cab74e89e76a753a8519f3aa2b17abc7809ed5b9fd1bbbaf20e2dee87a6635c279b35d89cb754b2e9ac4b9051c4eb15a628ac6accb2ad5f3ccb1
7
- data.tar.gz: 1ad97e5fc8ac2b5242dacedb9a8521b4ea376c79f54669370d7a1d1156d10ce6ca2b3d9ce2075844d5991dee8d1fa36e17fd9d5a175317f14516e92314396e89
6
+ metadata.gz: 53a637266de716c2e8e3a20b225f1ec1a141e0a91ee84a0666bcf8698eb85f7044e842e3735288071da6a66aa72bd9fd34be2ad1db35bfe7fbbcfac834be9c2c
7
+ data.tar.gz: c4f41f0fb34bc103e5d667a82b27757ea044e974689044e0d56df842452748e359903d56d7a4d8bad9918bd3a7bdf04a09e413ddc3281b3d8247c6b40634d7e8
data/bin/cddlc CHANGED
@@ -42,6 +42,8 @@ require 'optparse'
42
42
  require 'ostruct'
43
43
 
44
44
  $options = OpenStruct.new
45
+ $options.auto_choices = {}
46
+
45
47
  begin
46
48
  op = OptionParser.new do |opts|
47
49
  opts.banner = "Usage: cddlc [options] [-e cddl | file.cddl... | -]"
@@ -100,6 +102,12 @@ begin
100
102
  $options.include ||= []
101
103
  $options.include << v
102
104
  end
105
+ opts.on("-TRULE", "--type-choice=RULE", String, "Treat multiple assignments to RULE as type choice") do |v|
106
+ $options.auto_choices[v] = ["tcho", "tadd"]
107
+ end
108
+ opts.on("-GRULE", "--group-choice=RULE", String, "Treat multiple assignments to RULE as group choice") do |v|
109
+ $options.auto_choices[v] = ["gcho", "gadd"]
110
+ end
103
111
  end
104
112
  op.parse!
105
113
  rescue StandardError => e
data/cddlc.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "cddlc"
3
- s.version = "0.4.2"
3
+ s.version = "0.4.4"
4
4
  s.summary = "CDDL (Concise Data Definition Language) converters and miscellaneous tools"
5
5
  s.description = %q{cddlc implements converters and miscellaneous tools for CDDL, RFC 8610}
6
6
  s.author = "Carsten Bormann"
data/data/rfc9781.cddl ADDED
@@ -0,0 +1,47 @@
1
+ UCCS-Untagged = Claims-Set
2
+ UCCS-Tagged = #6.601(UCCS-Untagged)
3
+
4
+ Claims-Set = {
5
+ * $$Claims-Set-Claims
6
+ * Claim-Label .feature "extended-claims-label" => any
7
+ }
8
+ Claim-Label = CBOR-ONLY<int> / text
9
+ string-or-uri = text
10
+
11
+ $$Claims-Set-Claims //= ( iss-claim-label => string-or-uri )
12
+ $$Claims-Set-Claims //= ( sub-claim-label => string-or-uri )
13
+ $$Claims-Set-Claims //= ( aud-claim-label => string-or-uri )
14
+ $$Claims-Set-Claims //= ( exp-claim-label => ~time )
15
+ $$Claims-Set-Claims //= ( nbf-claim-label => ~time )
16
+ $$Claims-Set-Claims //= ( iat-claim-label => ~time )
17
+ $$Claims-Set-Claims //= ( cti-claim-label => bytes )
18
+
19
+ iss-claim-label = JC<"iss", 1>
20
+ sub-claim-label = JC<"sub", 2>
21
+ aud-claim-label = JC<"aud", 3>
22
+ exp-claim-label = JC<"exp", 4>
23
+ nbf-claim-label = JC<"nbf", 5>
24
+ iat-claim-label = JC<"iat", 6>
25
+ cti-claim-label = CBOR-ONLY<7> ; jti in JWT: different name and text
26
+
27
+ JSON-ONLY<J> = J .feature "json"
28
+ CBOR-ONLY<C> = C .feature "cbor"
29
+ JC<J,C> = JSON-ONLY<J> / CBOR-ONLY<C>
30
+
31
+ ; [RFC8747]
32
+ $$Claims-Set-Claims //= ( 8: CWT-cnf ) ; cnf
33
+ CWT-cnf = {
34
+ (1: CWT-COSE-Key) //
35
+ (2: CWT-Encrypted_COSE_Key) //
36
+ (3: CWT-kid)
37
+ }
38
+
39
+ CWT-COSE-Key = COSE_Key
40
+ CWT-Encrypted_COSE_Key = COSE_Encrypt / COSE_Encrypt0
41
+ CWT-kid = bytes
42
+
43
+ ;;; Insert the required CDDL from RFC 9052 to complete these
44
+ ;;; definitions. This can be done manually or automated by a
45
+ ;;; tool that implements an import directive such as:
46
+ ;# import rfc9052
47
+
data/lib/cddlc.rb CHANGED
@@ -280,6 +280,7 @@ class CDDL
280
280
  when "name"
281
281
  fail unless name.size == 2
282
282
  name = name[1]
283
+ cho ||= $options.auto_choices[name] if @rules[name]
283
284
  when "gen"
284
285
  parmnames = name[2..-1]
285
286
  name = name[1] # XXX update val with parm/arg
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cddlc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carsten Bormann
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-02-16 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: bundler
@@ -101,6 +101,7 @@ files:
101
101
  - data/rfc9594-sign_info-parameter.cddl
102
102
  - data/rfc9594-sign_info_entry-with-a-gene.cddl
103
103
  - data/rfc9597.cddl
104
+ - data/rfc9781.cddl
104
105
  - lib/cddlc.rb
105
106
  - lib/parser/cddl-util.rb
106
107
  - lib/parser/cddlgrammar.rb
@@ -129,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
129
130
  - !ruby/object:Gem::Version
130
131
  version: '0'
131
132
  requirements: []
132
- rubygems_version: 3.6.2
133
+ rubygems_version: 4.0.8
133
134
  specification_version: 4
134
135
  summary: CDDL (Concise Data Definition Language) converters and miscellaneous tools
135
136
  test_files: []