xml-kit 0.4.0 → 0.5.0
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 +4 -4
- data/.rubocop.yml +14 -3
- data/.travis.yml +2 -1
- data/CHANGELOG.md +7 -4
- data/lib/xml/kit/certificate.rb +0 -2
- data/lib/xml/kit/decryption.rb +4 -6
- data/lib/xml/kit/templatable.rb +1 -3
- data/lib/xml/kit/version.rb +1 -1
- data/xml-kit.gemspec +2 -2
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee208a968c74fe0dc205e929d934b15bff996f417e9d6d7d466a42658f264ce6
|
4
|
+
data.tar.gz: 392da204421d6acd28ed5e123c5bdb02790fb74401ea6dfca68204c1050a0dcf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9cbda7b1dcb0dfad250bd8de4b73d20eaeff7bd26884f700d0976967c5522626bb988205609e3e25ed1afd536b3d569d281e4456adcda2ebad4396647697b857
|
7
|
+
data.tar.gz: 56e952683e4376af240cef1933c112a17637cfaf7982ed29034212f203d516b0278fbbbf1c8423a550daf1e9972c197a2a1425f5ec7844202d1e0df96d1b448f
|
data/.rubocop.yml
CHANGED
@@ -9,7 +9,7 @@ AllCops:
|
|
9
9
|
- 'spec/fixtures/**/*'
|
10
10
|
- 'tmp/**/*'
|
11
11
|
- 'vendor/**/*'
|
12
|
-
TargetRubyVersion: 2.
|
12
|
+
TargetRubyVersion: 2.5
|
13
13
|
|
14
14
|
Layout/ClassStructure:
|
15
15
|
Enabled: true
|
@@ -30,10 +30,10 @@ Layout/ClassStructure:
|
|
30
30
|
Layout/EndOfLine:
|
31
31
|
EnforcedStyle: lf
|
32
32
|
|
33
|
-
Layout/
|
33
|
+
Layout/FirstArrayElementIndentation:
|
34
34
|
EnforcedStyle: consistent
|
35
35
|
|
36
|
-
Layout/
|
36
|
+
Layout/HeredocIndentation:
|
37
37
|
EnforcedStyle: active_support
|
38
38
|
|
39
39
|
Layout/MultilineOperationIndentation:
|
@@ -47,6 +47,10 @@ Lint/InterpolationCheck:
|
|
47
47
|
Exclude:
|
48
48
|
- 'spec/**/*.rb'
|
49
49
|
|
50
|
+
Metrics/AbcSize:
|
51
|
+
Exclude:
|
52
|
+
- 'lib/xml/kit/self_signed_certificate.rb'
|
53
|
+
|
50
54
|
Metrics/BlockLength:
|
51
55
|
Exclude:
|
52
56
|
- '**/**/*.builder'
|
@@ -87,9 +91,16 @@ Style/TrailingCommaInHashLiteral:
|
|
87
91
|
RSpec/ExampleLength:
|
88
92
|
Max: 80
|
89
93
|
|
94
|
+
RSpec/LeakyConstantDeclaration:
|
95
|
+
Exclude:
|
96
|
+
- 'spec/xml/kit/templatable_spec.rb'
|
97
|
+
|
90
98
|
RSpec/MultipleExpectations:
|
91
99
|
Enabled: false
|
92
100
|
|
101
|
+
RSpec/MultipleMemoizedHelpers:
|
102
|
+
Enabled: false
|
103
|
+
|
93
104
|
RSpec/NamedSubject:
|
94
105
|
Enabled: false
|
95
106
|
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Version 0.
|
1
|
+
Version 0.5.0
|
2
2
|
|
3
3
|
# Changelog
|
4
4
|
All notable changes to this project will be documented in this file.
|
@@ -7,7 +7,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
7
7
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
8
8
|
|
9
9
|
## [Unreleased]
|
10
|
-
|
10
|
+
|
11
|
+
## [0.5.0] - 2021-01-30
|
12
|
+
### Changed
|
13
|
+
- Minimum Ruby 2.5+
|
11
14
|
|
12
15
|
## [0.4.0] - 2019-04-30
|
13
16
|
### Added
|
@@ -34,8 +37,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
34
37
|
- \_assign does not coerce values by default.
|
35
38
|
- errors are merged together instead of overwritten during attribute validation.
|
36
39
|
|
37
|
-
[Unreleased]: https://github.com/saml-kit/xml-kit/compare/v0.
|
38
|
-
[
|
40
|
+
[Unreleased]: https://github.com/saml-kit/xml-kit/compare/v0.5.0...HEAD
|
41
|
+
[0.5.0]: https://github.com/saml-kit/xml-kit/compare/v0.4.0...v0.5.0
|
39
42
|
[0.4.0]: https://github.com/saml-kit/xml-kit/compare/v0.3.1...v0.4.0
|
40
43
|
[0.3.1]: https://github.com/saml-kit/xml-kit/compare/v0.3.0...v0.3.1
|
41
44
|
[0.3.0]: https://github.com/saml-kit/xml-kit/compare/v0.2.0...v0.3.0
|
data/lib/xml/kit/certificate.rb
CHANGED
@@ -7,9 +7,7 @@ module Xml
|
|
7
7
|
# {include:file:spec/xml/kit/certificate_spec.rb}
|
8
8
|
class Certificate
|
9
9
|
include Templatable
|
10
|
-
# rubocop:disable Metrics/LineLength
|
11
10
|
BASE64_FORMAT = %r(\A([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?\Z).freeze
|
12
|
-
# rubocop:enable Metrics/LineLength
|
13
11
|
BEGIN_CERT = /-----BEGIN CERTIFICATE-----/.freeze
|
14
12
|
END_CERT = /-----END CERTIFICATE-----/.freeze
|
15
13
|
# The use can be `:signing` or `:encryption`. Use `nil` for both.
|
data/lib/xml/kit/decryption.rb
CHANGED
@@ -56,12 +56,10 @@ module Xml
|
|
56
56
|
def symmetric_key_from(encrypted_key, attempts = private_keys.count)
|
57
57
|
cipher, algorithm = cipher_and_algorithm_from(encrypted_key)
|
58
58
|
private_keys.each do |private_key|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
raise if attempts.zero?
|
64
|
-
end
|
59
|
+
attempts -= 1
|
60
|
+
return to_plaintext(cipher, private_key, algorithm)
|
61
|
+
rescue OpenSSL::PKey::RSAError
|
62
|
+
raise if attempts.zero?
|
65
63
|
end
|
66
64
|
raise DecryptionError, private_keys
|
67
65
|
end
|
data/lib/xml/kit/templatable.rb
CHANGED
@@ -76,9 +76,7 @@ module Xml
|
|
76
76
|
# @abstract
|
77
77
|
# @since 0.3.0
|
78
78
|
def asymmetric_cipher(algorithm: Crypto::RsaCipher::ALGORITHM)
|
79
|
-
unless encryption_certificate
|
80
|
-
raise Xml::Kit::Error, 'encryption_certificate is not specified.'
|
81
|
-
end
|
79
|
+
raise Xml::Kit::Error, 'encryption_certificate is not specified.' unless encryption_certificate
|
82
80
|
|
83
81
|
@asymmetric_cipher ||= Crypto.cipher_for(
|
84
82
|
algorithm,
|
data/lib/xml/kit/version.rb
CHANGED
data/xml-kit.gemspec
CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.description = 'A simple toolkit for working with XML.'
|
15
15
|
spec.homepage = 'https://github.com/saml-kit/xml-kit'
|
16
16
|
spec.license = 'MIT'
|
17
|
-
spec.required_ruby_version = '
|
17
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.5.0')
|
18
18
|
|
19
19
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
20
20
|
f.match(%r{^(test|spec|features)/})
|
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.add_development_dependency 'bundler', '~> 2.0'
|
33
33
|
spec.add_development_dependency 'bundler-audit', '~> 0.6'
|
34
34
|
spec.add_development_dependency 'ffaker', '~> 2.7'
|
35
|
-
spec.add_development_dependency 'rake', '~>
|
35
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
36
36
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
37
37
|
spec.add_development_dependency 'rubocop', '~> 0.52'
|
38
38
|
spec.add_development_dependency 'rubocop-rspec', '~> 1.22'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xml-kit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mo khan
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -128,14 +128,14 @@ dependencies:
|
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: '
|
131
|
+
version: '13.0'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: '
|
138
|
+
version: '13.0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: rspec
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -258,23 +258,23 @@ licenses:
|
|
258
258
|
- MIT
|
259
259
|
metadata:
|
260
260
|
yard.run: yri
|
261
|
-
post_install_message:
|
261
|
+
post_install_message:
|
262
262
|
rdoc_options: []
|
263
263
|
require_paths:
|
264
264
|
- lib
|
265
265
|
required_ruby_version: !ruby/object:Gem::Requirement
|
266
266
|
requirements:
|
267
|
-
- - "
|
267
|
+
- - ">="
|
268
268
|
- !ruby/object:Gem::Version
|
269
|
-
version:
|
269
|
+
version: 2.5.0
|
270
270
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
271
271
|
requirements:
|
272
272
|
- - ">="
|
273
273
|
- !ruby/object:Gem::Version
|
274
274
|
version: '0'
|
275
275
|
requirements: []
|
276
|
-
rubygems_version: 3.
|
277
|
-
signing_key:
|
276
|
+
rubygems_version: 3.2.3
|
277
|
+
signing_key:
|
278
278
|
specification_version: 4
|
279
279
|
summary: A simple toolkit for working with XML.
|
280
280
|
test_files: []
|