ech_config 0.0.3 → 0.0.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.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +9 -11
  3. data/.ruby-version +1 -1
  4. data/Gemfile +4 -6
  5. data/Gemfile.lock +201 -48
  6. data/README.md +1 -1
  7. data/Rakefile +11 -5
  8. data/Steepfile +8 -0
  9. data/ech_config.gemspec +7 -4
  10. data/example/README.md +1 -1
  11. data/lib/ech_config/ech_config_contents/extensions.rb +7 -5
  12. data/lib/ech_config/ech_config_contents/hpke_key_config/hpke_kem_id.rb +11 -6
  13. data/lib/ech_config/ech_config_contents/hpke_key_config/hpke_public_key.rb +7 -4
  14. data/lib/ech_config/ech_config_contents/hpke_key_config/hpke_symmetric_cipher_suite/hpke_aead_id.rb +11 -6
  15. data/lib/ech_config/ech_config_contents/hpke_key_config/hpke_symmetric_cipher_suite/hpke_kdf_id.rb +11 -6
  16. data/lib/ech_config/ech_config_contents/hpke_key_config/hpke_symmetric_cipher_suite.rb +11 -6
  17. data/lib/ech_config/ech_config_contents/hpke_key_config.rb +16 -18
  18. data/lib/ech_config/ech_config_contents.rb +15 -17
  19. data/lib/ech_config/error.rb +2 -1
  20. data/lib/ech_config/version.rb +3 -2
  21. data/lib/ech_config.rb +39 -14
  22. data/sig/generated/ech_config/ech_config_contents/extensions.rbs +16 -0
  23. data/sig/generated/ech_config/ech_config_contents/hpke_key_config/hpke_kem_id.rbs +20 -0
  24. data/sig/generated/ech_config/ech_config_contents/hpke_key_config/hpke_public_key.rbs +16 -0
  25. data/sig/generated/ech_config/ech_config_contents/hpke_key_config/hpke_symmetric_cipher_suite/hpke_aead_id.rbs +20 -0
  26. data/sig/generated/ech_config/ech_config_contents/hpke_key_config/hpke_symmetric_cipher_suite/hpke_kdf_id.rbs +20 -0
  27. data/sig/generated/ech_config/ech_config_contents/hpke_key_config/hpke_symmetric_cipher_suite.rbs +26 -0
  28. data/sig/generated/ech_config/ech_config_contents/hpke_key_config.rbs +31 -0
  29. data/sig/generated/ech_config/ech_config_contents.rbs +31 -0
  30. data/sig/generated/ech_config/error.rbs +13 -0
  31. data/sig/generated/ech_config/version.rbs +5 -0
  32. data/sig/generated/ech_config.rbs +35 -0
  33. metadata +18 -46
  34. data/.github/workflows/ci.yml +0 -34
  35. data/.gitignore +0 -16
  36. data/sorbet/config +0 -3
  37. data/sorbet/rbi/gems/ast.rbi +0 -49
  38. data/sorbet/rbi/gems/byebug.rbi +0 -1041
  39. data/sorbet/rbi/gems/ech_config.rbi +0 -22
  40. data/sorbet/rbi/gems/parallel.rbi +0 -84
  41. data/sorbet/rbi/gems/parser.rbi +0 -1533
  42. data/sorbet/rbi/gems/racc.rbi +0 -43
  43. data/sorbet/rbi/gems/rainbow.rbi +0 -122
  44. data/sorbet/rbi/gems/rake.rbi +0 -647
  45. data/sorbet/rbi/gems/regexp_parser.rbi +0 -1026
  46. data/sorbet/rbi/gems/rexml.rbi +0 -603
  47. data/sorbet/rbi/gems/rspec-core.rbi +0 -1947
  48. data/sorbet/rbi/gems/rspec-expectations.rbi +0 -1178
  49. data/sorbet/rbi/gems/rspec-mocks.rbi +0 -1096
  50. data/sorbet/rbi/gems/rspec-support.rbi +0 -282
  51. data/sorbet/rbi/gems/rspec.rbi +0 -15
  52. data/sorbet/rbi/gems/rubocop-ast.rbi +0 -1404
  53. data/sorbet/rbi/gems/rubocop-sorbet.rbi +0 -312
  54. data/sorbet/rbi/gems/rubocop.rbi +0 -9351
  55. data/sorbet/rbi/gems/ruby-progressbar.rbi +0 -321
  56. data/sorbet/rbi/gems/unicode-display_width.rbi +0 -23
  57. data/sorbet/rbi/gems/webrick.rbi +0 -667
  58. data/sorbet/rbi/hidden-definitions/errors.txt +0 -23073
  59. data/sorbet/rbi/hidden-definitions/hidden.rbi +0 -12232
  60. data/sorbet/rbi/sorbet-typed/lib/rainbow/all/rainbow.rbi +0 -276
  61. data/sorbet/rbi/sorbet-typed/lib/rake/all/rake.rbi +0 -645
  62. data/sorbet/rbi/sorbet-typed/lib/rspec-core/all/rspec-core.rbi +0 -24
  63. data/sorbet/rbi/sorbet-typed/lib/rubocop/>=1.8/rubocop.rbi +0 -12
  64. data/sorbet/rbi/todo.rbi +0 -6
  65. data/spec/ech_config_spec.rb +0 -35
  66. data/spec/hpke_key_config_spec.rb +0 -31
  67. data/spec/spec_helper.rb +0 -6
@@ -1,6 +1,7 @@
1
- # typed: true
2
1
  # frozen_string_literal: true
3
2
 
3
+ # rbs_inline: enabled
4
+
4
5
  class ECHConfig::ECHConfigContents::HpkeKeyConfig
5
6
  # define class
6
7
  end
@@ -9,17 +10,13 @@ Dir["#{File.dirname(__FILE__)}/hpke_key_config/*.rb"]
9
10
  .sort.each { |f| require f }
10
11
 
11
12
  class ECHConfig::ECHConfigContents::HpkeKeyConfig
12
- extend T::Sig
13
13
  attr_reader :config_id, :kem_id, :public_key, :cipher_suites
14
14
 
15
- sig do
16
- params(
17
- config_id: Integer,
18
- kem_id: HpkeKemId,
19
- public_key: HpkePublicKey,
20
- cipher_suites: T::Array[HpkeSymmetricCipherSuite]
21
- ).void
22
- end
15
+ # @rbs config_id: Integer
16
+ # @rbs kem_id: ECHConfig::ECHConfigContents::HpkeKeyConfig::HpkeKemId
17
+ # @rbs public_key: ECHConfig::ECHConfigContents::HpkeKeyConfig::HpkePublicKey
18
+ # @rbs cipher_suites: Array[ECHConfig::ECHConfigContents::HpkeKeyConfig::HpkeSymmetricCipherSuite]
19
+ # @rbs return: void
23
20
  def initialize(config_id,
24
21
  kem_id,
25
22
  public_key,
@@ -30,7 +27,7 @@ class ECHConfig::ECHConfigContents::HpkeKeyConfig
30
27
  @cipher_suites = cipher_suites
31
28
  end
32
29
 
33
- sig { returns(String) }
30
+ # @rbs return: String
34
31
  def encode
35
32
  [@config_id].pack('C') \
36
33
  + @kem_id.encode \
@@ -41,11 +38,12 @@ class ECHConfig::ECHConfigContents::HpkeKeyConfig
41
38
  # rubocop:disable Metrics/AbcSize
42
39
  # rubocop:disable Metrics/CyclomaticComplexity
43
40
  # rubocop:disable Metrics/PerceivedComplexity
44
- sig { params(octet: String).returns([T.attached_class, T.nilable(String)]) }
41
+ # @rbs octet: String
42
+ # @rbs return: [ECHConfig::ECHConfigContents::HpkeKeyConfig, String | nil]
45
43
  def self.decode(octet)
46
44
  raise ::ECHConfig::DecodeError if octet.empty?
47
45
 
48
- config_id = octet.slice(0, 1)&.unpack1('C')
46
+ config_id = octet.slice(0, 1)&.unpack1('C') #: Integer
49
47
  i = 1
50
48
  raise ::ECHConfig::DecodeError if i + 2 > octet.length
51
49
 
@@ -53,7 +51,7 @@ class ECHConfig::ECHConfigContents::HpkeKeyConfig
53
51
  i += 2
54
52
  raise ::ECHConfig::DecodeError if i + 2 > octet.length
55
53
 
56
- pk_len = octet.slice(i, 2)&.unpack1('n')
54
+ pk_len = octet.slice(i, 2)&.unpack1('n') #: Integer
57
55
  i += 2
58
56
  raise ::ECHConfig::DecodeError if i + pk_len > octet.length
59
57
 
@@ -61,20 +59,20 @@ class ECHConfig::ECHConfigContents::HpkeKeyConfig
61
59
  i += pk_len
62
60
  raise ::ECHConfig::DecodeError if i + 2 > octet.length
63
61
 
64
- cs_len = octet.slice(i, 2)&.unpack1('n')
62
+ cs_len = octet.slice(i, 2)&.unpack1('n') #: Integer
65
63
  i += 2
66
64
  raise ::ECHConfig::DecodeError if i + 2 > octet.length
67
65
 
68
- cs_bin = octet.slice(i, cs_len)
66
+ cs_bin = octet.slice(i, cs_len) #: String
69
67
  i += cs_len
70
- cipher_suites = HpkeSymmetricCipherSuite.decode_vectors(cs_bin || '')
68
+ cipher_suites = HpkeSymmetricCipherSuite.decode_vectors(cs_bin)
71
69
  hpke_key_config = new(
72
70
  config_id,
73
71
  kem_id,
74
72
  public_key,
75
73
  cipher_suites
76
74
  )
77
- [hpke_key_config, octet[i..]]
75
+ return hpke_key_config, octet[i..]
78
76
  end
79
77
  # rubocop:enable Metrics/AbcSize
80
78
  # rubocop:enable Metrics/CyclomaticComplexity
@@ -1,6 +1,7 @@
1
- # typed: true
2
1
  # frozen_string_literal: true
3
2
 
3
+ # rbs_inline: enabled
4
+
4
5
  class ECHConfig::ECHConfigContents
5
6
  # define class
6
7
  end
@@ -9,17 +10,13 @@ Dir["#{File.dirname(__FILE__)}/ech_config_contents/*.rb"]
9
10
  .sort.each { |f| require f }
10
11
 
11
12
  class ECHConfig::ECHConfigContents
12
- extend T::Sig
13
13
  attr_reader :key_config, :maximum_name_length, :public_name, :extensions
14
14
 
15
- sig do
16
- params(
17
- key_config: HpkeKeyConfig,
18
- maximum_name_length: Integer,
19
- public_name: String,
20
- extensions: Extensions
21
- ).void
22
- end
15
+ # @rbs key_config: ECHConfig::ECHConfigContents::HpkeKeyConfig
16
+ # @rbs maximum_name_length: Integer
17
+ # @rbs public_name: String
18
+ # @rbs extensions: ECHConfig::ECHConfigContents::Extensions
19
+ # @rbs return: void
23
20
  def initialize(key_config,
24
21
  maximum_name_length,
25
22
  public_name,
@@ -30,7 +27,7 @@ class ECHConfig::ECHConfigContents
30
27
  @extensions = extensions
31
28
  end
32
29
 
33
- sig { returns(String) }
30
+ # @rbs return: String
34
31
  def encode
35
32
  @key_config.encode \
36
33
  + [@maximum_name_length].pack('C') \
@@ -41,16 +38,17 @@ class ECHConfig::ECHConfigContents
41
38
  # rubocop:disable Metrics/AbcSize
42
39
  # rubocop:disable Metrics/CyclomaticComplexity
43
40
  # rubocop:disable Metrics/PerceivedComplexity
44
- sig { params(octet: String).returns(T.attached_class) }
41
+ # @rbs octet: String
42
+ # @rbs return: ECHConfig::ECHConfigContents
45
43
  def self.decode(octet)
46
44
  key_config, octet = HpkeKeyConfig.decode(octet)
47
- raise ::ECHConfig::DecodeError if octet.nil?
48
- raise ::ECHConfig::DecodeError if octet.length < 2
45
+ octet ||= ''
46
+ raise ::ECHConfig::DecodeError if octet.nil? || octet.length < 2
49
47
 
50
- maximum_name_length = octet.slice(0, 1)&.unpack1('C')
48
+ maximum_name_length = octet.slice(0, 1)&.unpack1('C') #: Integer
51
49
  raise ::ECHConfig::DecodeError if maximum_name_length.nil?
52
50
 
53
- pn_len = octet.slice(1, 1)&.unpack1('C')
51
+ pn_len = octet.slice(1, 1)&.unpack1('C') #: Integer
54
52
  i = 2
55
53
  raise ::ECHConfig::DecodeError if i + pn_len > octet.length
56
54
 
@@ -60,7 +58,7 @@ class ECHConfig::ECHConfigContents
60
58
  i += pn_len
61
59
  raise ::ECHConfig::DecodeError if i + 2 > octet.length
62
60
 
63
- ex_len = octet.slice(i, 2)&.unpack1('n')
61
+ ex_len = octet.slice(i, 2)&.unpack1('n') #: Integer
64
62
  i += 2
65
63
  raise ::ECHConfig::DecodeError if i + ex_len != octet.length
66
64
 
@@ -1,6 +1,7 @@
1
- # typed: strict
2
1
  # frozen_string_literal: true
3
2
 
3
+ # rbs_inline: enabled
4
+
4
5
  # Generic error, common for all classes under ECHConfig module.
5
6
  class ECHConfig::Error < StandardError; end
6
7
 
@@ -1,6 +1,7 @@
1
- # typed: strict
2
1
  # frozen_string_literal: true
3
2
 
3
+ # rbs_inline: enabled
4
+
4
5
  class ECHConfig
5
- VERSION = '0.0.3'
6
+ VERSION = '0.0.4'
6
7
  end
data/lib/ech_config.rb CHANGED
@@ -1,8 +1,9 @@
1
1
  # encoding: ascii-8bit
2
- # typed: true
3
2
  # frozen_string_literal: true
4
3
 
5
- require 'sorbet-runtime'
4
+ # rbs_inline: enabled
5
+
6
+ require 'base64'
6
7
 
7
8
  class ECHConfig
8
9
  # define class
@@ -13,40 +14,39 @@ require_relative 'ech_config/ech_config_contents'
13
14
  require_relative 'ech_config/version'
14
15
 
15
16
  class ECHConfig
16
- extend T::Sig
17
17
  attr_reader :version, :echconfig_contents
18
18
 
19
- private_class_method :new
20
-
21
- @version = T.let(nil, T.nilable(String))
22
- @echconfig_contents = T.let(nil, T.nilable(ECHConfigContents))
23
-
19
+ # @rbs version: String
20
+ # @rbs echconfig_contents: ECHConfig::ECHConfigContents
21
+ # @rbs return: void
24
22
  def initialize(version, echconfig_contents)
25
23
  v = version.unpack1('n')
26
- # https://author-tools.ietf.org/iddiff?url2=draft-ietf-tls-esni-11.txt#context-3
27
- raise ::ECHConfig::UnsupportedVersion unless v > "\xfe\x0a".unpack1('n') && v <= "\xfe\x0d".unpack1('n')
24
+ # https://datatracker.ietf.org/doc/html/rfc9849#section-4
25
+ raise ::ECHConfig::UnsupportedVersion \
26
+ unless v > "\xfe\x0a".unpack1('n') && v <= "\xfe\x0d".unpack1('n') # steep:ignore
28
27
 
29
28
  @version = version
30
29
  @echconfig_contents = echconfig_contents
31
30
  end
32
31
 
33
- sig { returns(String) }
32
+ # @rbs return: String
34
33
  def encode
35
34
  @version + @echconfig_contents.encode.then { |s| [s.length].pack('n') + s }
36
35
  end
37
36
 
38
37
  # rubocop:disable Metrics/CyclomaticComplexity
39
- sig { params(octet: String).returns(T::Array[T.attached_class]) }
38
+ # @rbs octet: String
39
+ # @rbs return: Array[ECHConfig]
40
40
  def self.decode_vectors(octet)
41
41
  i = 0
42
- echconfigs = []
42
+ echconfigs = [] # @type var echconfigs: Array[ECHConfig]
43
43
  while i < octet.length
44
44
  raise ::ECHConfig::DecodeError if i + 4 > octet.length
45
45
 
46
46
  version = octet.slice(i, 2)
47
47
  raise ::ECHConfig::DecodeError if version.nil?
48
48
 
49
- length = octet.slice(i + 2, 2)&.unpack1('n')
49
+ length = octet.slice(i + 2, 2)&.unpack1('n') # @type var length: Integer
50
50
  i += 4
51
51
  raise ::ECHConfig::DecodeError if i + length > octet.length
52
52
 
@@ -60,3 +60,28 @@ class ECHConfig
60
60
  end
61
61
  # rubocop:enable Metrics/CyclomaticComplexity
62
62
  end
63
+
64
+ class ECHConfigList
65
+ # @rbs echconfigs: Array[ECHConfig]
66
+ # @rbs return: void
67
+ def initialize(echconfigs)
68
+ @echconfigs = echconfigs
69
+ end
70
+
71
+ # @rbs return: String
72
+ def encode
73
+ @echconfigs.map(&:encode).join.then { |s| [s.length].pack('n') + s }
74
+ end
75
+
76
+ # @rbs return: String
77
+ def to_pem
78
+ body = Base64.strict_encode64(encode).scan(/.{1,64}/).join("\n")
79
+
80
+ # https://datatracker.ietf.org/doc/html/rfc9934#section-3
81
+ <<~PEM
82
+ -----BEGIN ECHCONFIG-----
83
+ #{body}
84
+ -----END ECHCONFIG-----
85
+ PEM
86
+ end
87
+ end
@@ -0,0 +1,16 @@
1
+ # Generated from lib/ech_config/ech_config_contents/extensions.rb with RBS::Inline
2
+
3
+ class ECHConfig::ECHConfigContents::Extensions
4
+ attr_reader octet: untyped
5
+
6
+ # @rbs octet: String
7
+ # @rbs return: void
8
+ def initialize: (String octet) -> void
9
+
10
+ # @rbs return: String
11
+ def load: () -> String
12
+
13
+ # @rbs octet: String
14
+ # @rbs return: ECHConfig::ECHConfigContents::Extensions
15
+ def self.store: (String octet) -> ECHConfig::ECHConfigContents::Extensions
16
+ end
@@ -0,0 +1,20 @@
1
+ # Generated from lib/ech_config/ech_config_contents/hpke_key_config/hpke_kem_id.rb with RBS::Inline
2
+
3
+ class ECHConfig::ECHConfigContents::HpkeKeyConfig::HpkeKemId
4
+ attr_reader uint16: untyped
5
+
6
+ # @rbs uint16: Integer
7
+ # @rbs return: void
8
+ def initialize: (Integer uint16) -> void
9
+
10
+ # @rbs return: String
11
+ def encode: () -> String
12
+
13
+ # @rbs other: ECHConfig::ECHConfigContents::HpkeKeyConfig::HpkeKemId
14
+ # @rbs return: bool
15
+ def ==: (ECHConfig::ECHConfigContents::HpkeKeyConfig::HpkeKemId other) -> bool
16
+
17
+ # @rbs octet: String
18
+ # @rbs return: ECHConfig::ECHConfigContents::HpkeKeyConfig::HpkeKemId
19
+ def self.decode: (String octet) -> ECHConfig::ECHConfigContents::HpkeKeyConfig::HpkeKemId
20
+ end
@@ -0,0 +1,16 @@
1
+ # Generated from lib/ech_config/ech_config_contents/hpke_key_config/hpke_public_key.rb with RBS::Inline
2
+
3
+ class ECHConfig::ECHConfigContents::HpkeKeyConfig::HpkePublicKey
4
+ attr_reader opaque: untyped
5
+
6
+ # @rbs opaque: String
7
+ # @rbs return: void
8
+ def initialize: (String opaque) -> void
9
+
10
+ # @rbs return: String
11
+ def encode: () -> String
12
+
13
+ # @rbs octet: String
14
+ # @rbs return: ECHConfig::ECHConfigContents::HpkeKeyConfig::HpkePublicKey
15
+ def self.decode: (String octet) -> ECHConfig::ECHConfigContents::HpkeKeyConfig::HpkePublicKey
16
+ end
@@ -0,0 +1,20 @@
1
+ # Generated from lib/ech_config/ech_config_contents/hpke_key_config/hpke_symmetric_cipher_suite/hpke_aead_id.rb with RBS::Inline
2
+
3
+ class ECHConfig::ECHConfigContents::HpkeKeyConfig::HpkeSymmetricCipherSuite::HpkeAeadId
4
+ attr_reader uint16: untyped
5
+
6
+ # @rbs uint16: Integer
7
+ # @rbs return: void
8
+ def initialize: (Integer uint16) -> void
9
+
10
+ # @rbs return: String
11
+ def encode: () -> String
12
+
13
+ # @rbs other: ECHConfig::ECHConfigContents::HpkeKeyConfig::HpkeSymmetricCipherSuite::HpkeAeadId
14
+ # @rbs return: bool
15
+ def ==: (ECHConfig::ECHConfigContents::HpkeKeyConfig::HpkeSymmetricCipherSuite::HpkeAeadId other) -> bool
16
+
17
+ # @rbs octet: String
18
+ # @rbs return: ECHConfig::ECHConfigContents::HpkeKeyConfig::HpkeSymmetricCipherSuite::HpkeAeadId
19
+ def self.decode: (String octet) -> ECHConfig::ECHConfigContents::HpkeKeyConfig::HpkeSymmetricCipherSuite::HpkeAeadId
20
+ end
@@ -0,0 +1,20 @@
1
+ # Generated from lib/ech_config/ech_config_contents/hpke_key_config/hpke_symmetric_cipher_suite/hpke_kdf_id.rb with RBS::Inline
2
+
3
+ class ECHConfig::ECHConfigContents::HpkeKeyConfig::HpkeSymmetricCipherSuite::HpkeKdfId
4
+ attr_reader uint16: untyped
5
+
6
+ # @rbs uint16: Integer
7
+ # @rbs return: void
8
+ def initialize: (Integer uint16) -> void
9
+
10
+ # @rbs return: String
11
+ def encode: () -> String
12
+
13
+ # @rbs other: ECHConfig::ECHConfigContents::HpkeKeyConfig::HpkeSymmetricCipherSuite::HpkeKdfId
14
+ # @rbs return: bool
15
+ def ==: (ECHConfig::ECHConfigContents::HpkeKeyConfig::HpkeSymmetricCipherSuite::HpkeKdfId other) -> bool
16
+
17
+ # @rbs octet: String
18
+ # @rbs return: ECHConfig::ECHConfigContents::HpkeKeyConfig::HpkeSymmetricCipherSuite::HpkeKdfId
19
+ def self.decode: (String octet) -> ECHConfig::ECHConfigContents::HpkeKeyConfig::HpkeSymmetricCipherSuite::HpkeKdfId
20
+ end
@@ -0,0 +1,26 @@
1
+ # Generated from lib/ech_config/ech_config_contents/hpke_key_config/hpke_symmetric_cipher_suite.rb with RBS::Inline
2
+
3
+ class ECHConfig::ECHConfigContents::HpkeKeyConfig::HpkeSymmetricCipherSuite
4
+ end
5
+
6
+ class ECHConfig::ECHConfigContents::HpkeKeyConfig::HpkeSymmetricCipherSuite
7
+ attr_reader kdf_id: untyped
8
+
9
+ attr_reader aead_id: untyped
10
+
11
+ # @rbs kdf_id: ECHConfig::ECHConfigContents::HpkeKeyConfig::HpkeSymmetricCipherSuite::HpkeKdfId
12
+ # @rbs aead_id: ECHConfig::ECHConfigContents::HpkeKeyConfig::HpkeSymmetricCipherSuite::HpkeAeadId
13
+ # @rbs return: void
14
+ def initialize: (ECHConfig::ECHConfigContents::HpkeKeyConfig::HpkeSymmetricCipherSuite::HpkeKdfId kdf_id, ECHConfig::ECHConfigContents::HpkeKeyConfig::HpkeSymmetricCipherSuite::HpkeAeadId aead_id) -> void
15
+
16
+ # @rbs return: String
17
+ def encode: () -> String
18
+
19
+ # @rbs other: ECHConfig::ECHConfigContents::HpkeKeyConfig::HpkeSymmetricCipherSuite
20
+ # @rbs return: bool
21
+ def ==: (ECHConfig::ECHConfigContents::HpkeKeyConfig::HpkeSymmetricCipherSuite other) -> bool
22
+
23
+ # @rbs octet: String
24
+ # @rbs return: Array[ECHConfig::ECHConfigContents::HpkeKeyConfig::HpkeSymmetricCipherSuite]
25
+ def self.decode_vectors: (String octet) -> Array[ECHConfig::ECHConfigContents::HpkeKeyConfig::HpkeSymmetricCipherSuite]
26
+ end
@@ -0,0 +1,31 @@
1
+ # Generated from lib/ech_config/ech_config_contents/hpke_key_config.rb with RBS::Inline
2
+
3
+ class ECHConfig::ECHConfigContents::HpkeKeyConfig
4
+ end
5
+
6
+ class ECHConfig::ECHConfigContents::HpkeKeyConfig
7
+ attr_reader config_id: untyped
8
+
9
+ attr_reader kem_id: untyped
10
+
11
+ attr_reader public_key: untyped
12
+
13
+ attr_reader cipher_suites: untyped
14
+
15
+ # @rbs config_id: Integer
16
+ # @rbs kem_id: ECHConfig::ECHConfigContents::HpkeKeyConfig::HpkeKemId
17
+ # @rbs public_key: ECHConfig::ECHConfigContents::HpkeKeyConfig::HpkePublicKey
18
+ # @rbs cipher_suites: Array[ECHConfig::ECHConfigContents::HpkeKeyConfig::HpkeSymmetricCipherSuite]
19
+ # @rbs return: void
20
+ def initialize: (Integer config_id, ECHConfig::ECHConfigContents::HpkeKeyConfig::HpkeKemId kem_id, ECHConfig::ECHConfigContents::HpkeKeyConfig::HpkePublicKey public_key, Array[ECHConfig::ECHConfigContents::HpkeKeyConfig::HpkeSymmetricCipherSuite] cipher_suites) -> void
21
+
22
+ # @rbs return: String
23
+ def encode: () -> String
24
+
25
+ # rubocop:disable Metrics/AbcSize
26
+ # rubocop:disable Metrics/CyclomaticComplexity
27
+ # rubocop:disable Metrics/PerceivedComplexity
28
+ # @rbs octet: String
29
+ # @rbs return: [ECHConfig::ECHConfigContents::HpkeKeyConfig, String | nil]
30
+ def self.decode: (String octet) -> [ ECHConfig::ECHConfigContents::HpkeKeyConfig, String | nil ]
31
+ end
@@ -0,0 +1,31 @@
1
+ # Generated from lib/ech_config/ech_config_contents.rb with RBS::Inline
2
+
3
+ class ECHConfig::ECHConfigContents
4
+ end
5
+
6
+ class ECHConfig::ECHConfigContents
7
+ attr_reader key_config: untyped
8
+
9
+ attr_reader maximum_name_length: untyped
10
+
11
+ attr_reader public_name: untyped
12
+
13
+ attr_reader extensions: untyped
14
+
15
+ # @rbs key_config: ECHConfig::ECHConfigContents::HpkeKeyConfig
16
+ # @rbs maximum_name_length: Integer
17
+ # @rbs public_name: String
18
+ # @rbs extensions: ECHConfig::ECHConfigContents::Extensions
19
+ # @rbs return: void
20
+ def initialize: (ECHConfig::ECHConfigContents::HpkeKeyConfig key_config, Integer maximum_name_length, String public_name, ECHConfig::ECHConfigContents::Extensions extensions) -> void
21
+
22
+ # @rbs return: String
23
+ def encode: () -> String
24
+
25
+ # rubocop:disable Metrics/AbcSize
26
+ # rubocop:disable Metrics/CyclomaticComplexity
27
+ # rubocop:disable Metrics/PerceivedComplexity
28
+ # @rbs octet: String
29
+ # @rbs return: ECHConfig::ECHConfigContents
30
+ def self.decode: (String octet) -> ECHConfig::ECHConfigContents
31
+ end
@@ -0,0 +1,13 @@
1
+ # Generated from lib/ech_config/error.rb with RBS::Inline
2
+
3
+ # Generic error, common for all classes under ECHConfig module.
4
+ class ECHConfig::Error < StandardError
5
+ end
6
+
7
+ # Raised if configure is invalid.
8
+ class ECHConfig::DecodeError < ECHConfig::Error
9
+ end
10
+
11
+ # Raised if version is unsupported.
12
+ class ECHConfig::UnsupportedVersion < ECHConfig::Error
13
+ end
@@ -0,0 +1,5 @@
1
+ # Generated from lib/ech_config/version.rb with RBS::Inline
2
+
3
+ class ECHConfig
4
+ VERSION: ::String
5
+ end
@@ -0,0 +1,35 @@
1
+ # Generated from lib/ech_config.rb with RBS::Inline
2
+
3
+ class ECHConfig
4
+ end
5
+
6
+ class ECHConfig
7
+ attr_reader version: untyped
8
+
9
+ attr_reader echconfig_contents: untyped
10
+
11
+ # @rbs version: String
12
+ # @rbs echconfig_contents: ECHConfig::ECHConfigContents
13
+ # @rbs return: void
14
+ def initialize: (String version, ECHConfig::ECHConfigContents echconfig_contents) -> void
15
+
16
+ # @rbs return: String
17
+ def encode: () -> String
18
+
19
+ # rubocop:disable Metrics/CyclomaticComplexity
20
+ # @rbs octet: String
21
+ # @rbs return: Array[ECHConfig]
22
+ def self.decode_vectors: (String octet) -> Array[ECHConfig]
23
+ end
24
+
25
+ class ECHConfigList
26
+ # @rbs echconfigs: Array[ECHConfig]
27
+ # @rbs return: void
28
+ def initialize: (Array[ECHConfig] echconfigs) -> void
29
+
30
+ # @rbs return: String
31
+ def encode: () -> String
32
+
33
+ # @rbs return: String
34
+ def to_pem: () -> String
35
+ end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ech_config
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - thekuwayama
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2023-12-19 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: bundler
@@ -25,7 +24,7 @@ dependencies:
25
24
  - !ruby/object:Gem::Version
26
25
  version: '0'
27
26
  - !ruby/object:Gem::Dependency
28
- name: sorbet-runtime
27
+ name: base64
29
28
  requirement: !ruby/object:Gem::Requirement
30
29
  requirements:
31
30
  - - ">="
@@ -45,8 +44,6 @@ executables: []
45
44
  extensions: []
46
45
  extra_rdoc_files: []
47
46
  files:
48
- - ".github/workflows/ci.yml"
49
- - ".gitignore"
50
47
  - ".rubocop.yml"
51
48
  - ".ruby-version"
52
49
  - Gemfile
@@ -54,6 +51,7 @@ files:
54
51
  - LICENSE.txt
55
52
  - README.md
56
53
  - Rakefile
54
+ - Steepfile
57
55
  - ech_config.gemspec
58
56
  - example/README.md
59
57
  - example/well_known_url_client.rb
@@ -68,43 +66,21 @@ files:
68
66
  - lib/ech_config/ech_config_contents/hpke_key_config/hpke_symmetric_cipher_suite/hpke_kdf_id.rb
69
67
  - lib/ech_config/error.rb
70
68
  - lib/ech_config/version.rb
71
- - sorbet/config
72
- - sorbet/rbi/gems/ast.rbi
73
- - sorbet/rbi/gems/byebug.rbi
74
- - sorbet/rbi/gems/ech_config.rbi
75
- - sorbet/rbi/gems/parallel.rbi
76
- - sorbet/rbi/gems/parser.rbi
77
- - sorbet/rbi/gems/racc.rbi
78
- - sorbet/rbi/gems/rainbow.rbi
79
- - sorbet/rbi/gems/rake.rbi
80
- - sorbet/rbi/gems/regexp_parser.rbi
81
- - sorbet/rbi/gems/rexml.rbi
82
- - sorbet/rbi/gems/rspec-core.rbi
83
- - sorbet/rbi/gems/rspec-expectations.rbi
84
- - sorbet/rbi/gems/rspec-mocks.rbi
85
- - sorbet/rbi/gems/rspec-support.rbi
86
- - sorbet/rbi/gems/rspec.rbi
87
- - sorbet/rbi/gems/rubocop-ast.rbi
88
- - sorbet/rbi/gems/rubocop-sorbet.rbi
89
- - sorbet/rbi/gems/rubocop.rbi
90
- - sorbet/rbi/gems/ruby-progressbar.rbi
91
- - sorbet/rbi/gems/unicode-display_width.rbi
92
- - sorbet/rbi/gems/webrick.rbi
93
- - sorbet/rbi/hidden-definitions/errors.txt
94
- - sorbet/rbi/hidden-definitions/hidden.rbi
95
- - sorbet/rbi/sorbet-typed/lib/rainbow/all/rainbow.rbi
96
- - sorbet/rbi/sorbet-typed/lib/rake/all/rake.rbi
97
- - sorbet/rbi/sorbet-typed/lib/rspec-core/all/rspec-core.rbi
98
- - sorbet/rbi/sorbet-typed/lib/rubocop/>=1.8/rubocop.rbi
99
- - sorbet/rbi/todo.rbi
100
- - spec/ech_config_spec.rb
101
- - spec/hpke_key_config_spec.rb
102
- - spec/spec_helper.rb
69
+ - sig/generated/ech_config.rbs
70
+ - sig/generated/ech_config/ech_config_contents.rbs
71
+ - sig/generated/ech_config/ech_config_contents/extensions.rbs
72
+ - sig/generated/ech_config/ech_config_contents/hpke_key_config.rbs
73
+ - sig/generated/ech_config/ech_config_contents/hpke_key_config/hpke_kem_id.rbs
74
+ - sig/generated/ech_config/ech_config_contents/hpke_key_config/hpke_public_key.rbs
75
+ - sig/generated/ech_config/ech_config_contents/hpke_key_config/hpke_symmetric_cipher_suite.rbs
76
+ - sig/generated/ech_config/ech_config_contents/hpke_key_config/hpke_symmetric_cipher_suite/hpke_aead_id.rbs
77
+ - sig/generated/ech_config/ech_config_contents/hpke_key_config/hpke_symmetric_cipher_suite/hpke_kdf_id.rbs
78
+ - sig/generated/ech_config/error.rbs
79
+ - sig/generated/ech_config/version.rbs
103
80
  homepage: https://github.com/thekuwayama/ech_config
104
81
  licenses:
105
82
  - MIT
106
83
  metadata: {}
107
- post_install_message:
108
84
  rdoc_options: []
109
85
  require_paths:
110
86
  - lib
@@ -112,18 +88,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
112
88
  requirements:
113
89
  - - ">="
114
90
  - !ruby/object:Gem::Version
115
- version: 2.7.0
91
+ version: '4.0'
116
92
  required_rubygems_version: !ruby/object:Gem::Requirement
117
93
  requirements:
118
94
  - - ">="
119
95
  - !ruby/object:Gem::Version
120
96
  version: '0'
121
97
  requirements: []
122
- rubygems_version: 3.3.7
123
- signing_key:
98
+ rubygems_version: 4.0.7
124
99
  specification_version: 4
125
100
  summary: ECHConfig
126
- test_files:
127
- - spec/ech_config_spec.rb
128
- - spec/hpke_key_config_spec.rb
129
- - spec/spec_helper.rb
101
+ test_files: []
@@ -1,34 +0,0 @@
1
- name: CI
2
-
3
- on:
4
- push:
5
- branches:
6
- - main
7
- pull_request:
8
- branches:
9
- - '*'
10
-
11
- jobs:
12
- ci:
13
- runs-on: ubuntu-latest
14
- strategy:
15
- matrix:
16
- ruby-version: ['2.7.x', '3.0.x', '3.1.x', '3.2.x']
17
- steps:
18
- - uses: actions/checkout@v3
19
- - name: Set up Ruby
20
- uses: ruby/setup-ruby@v1
21
- with:
22
- ruby-version: ${{ matrix.ruby }}
23
- - name: Install dependencies
24
- run: |
25
- gem --version
26
- gem install bundler
27
- bundle --version
28
- bundle install
29
- - name: Run Rubocop
30
- run: |
31
- bundle exec rake rubocop
32
- - name: Run Sorbet type checker
33
- run: |
34
- bundle exec rake sorbet