symmetric-encryption 4.3.3 → 4.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 48319cdd25b04f6722c7bb4f3baf282a4fa76b4a06041ec1065fdade1677f2a4
4
- data.tar.gz: 59e09a6dcefa9759c8c4c196b396f7068b80dddd77936716dde1a5d218d272f2
3
+ metadata.gz: 17ec7e95cd640a1bc8b960bff9244557e3dcd58bb58744b054e4bb7ef95a051a
4
+ data.tar.gz: 36230ce36bf337f98d5cf70e45c5ed1658faeed8ce650cd9b4b7d12354a477df
5
5
  SHA512:
6
- metadata.gz: 49d434857542e8e91e5311cc01145658a293a9aaefd432d3ef948fed9d041bf3675b114a0c4d132865ff4c5ea7b1d54cdff1cbdae2b9a282c463ca4bfcbc2ab7
7
- data.tar.gz: 163c0baeaaac833f092cf07614f55d48e49932b494a126b90e9f00b7432b877d38b0e341e58e25747e91762a5cd48734a10f7dde1df26e2a1f0affa6379044f3
6
+ metadata.gz: 4d880e284b3aa211e2a4bdeb872ff294d8c8743eb033edcafd6ec7ee569da3390b12821e555b1efe98503b2e4c4c05d0380f5da6d09577dfcd57badc12c0bce2
7
+ data.tar.gz: 36453ff31c896a7b7359b66cd53d3777f71b6855d53d8f002a77d7af91e3fe21c1a346869c0414aecbe8cc92c7e93dd73701edaa751072df6dcdd9459dd74752
data/README.md CHANGED
@@ -21,8 +21,6 @@ expose all the encryption algorithms supported by OpenSSL.
21
21
 
22
22
  [Symmetric Encryption Guide](https://encryption.rocketjob.io/)
23
23
 
24
- [Reference Documentation](http://www.rubydoc.info/gems/symmetric-encryption/)
25
-
26
24
  ## Rocket Job
27
25
 
28
26
  Checkout the sister project [Rocket Job](http://rocketjob.io): Ruby's missing batch system.
@@ -50,6 +50,8 @@ module SymmetricEncryption
50
50
  # This is the recommended format since newlines in the values to
51
51
  # SQL queries are cumbersome. Also the newline reformatting is unnecessary
52
52
  # It is not the default for backward compatibility
53
+ # :base64urlsafe
54
+ # Same as base64strict except that base64urlsafe uses '-' instead of '+' and '_' instead of '/'.
53
55
  # :base64
54
56
  # Return as a base64 encoded string
55
57
  # :base16
@@ -6,6 +6,8 @@ module SymmetricEncryption
6
6
  Base64.new
7
7
  when :base64strict
8
8
  Base64Strict.new
9
+ when :base64urlsafe
10
+ Base64UrlSafe.new
9
11
  when :base16
10
12
  Base16.new
11
13
  when :none
@@ -65,6 +67,22 @@ module SymmetricEncryption
65
67
  end
66
68
  end
67
69
 
70
+ class Base64UrlSafe
71
+ def encode(binary_string)
72
+ return binary_string if binary_string.nil? || (binary_string == "")
73
+
74
+ encoded_string = ::Base64.urlsafe_encode64(binary_string)
75
+ encoded_string.force_encoding(SymmetricEncryption::UTF8_ENCODING)
76
+ end
77
+
78
+ def decode(encoded_string)
79
+ return encoded_string if encoded_string.nil? || (encoded_string == "")
80
+
81
+ decoded_string = ::Base64.urlsafe_decode64(encoded_string)
82
+ decoded_string.force_encoding(SymmetricEncryption::BINARY_ENCODING)
83
+ end
84
+ end
85
+
68
86
  class Base16
69
87
  def encode(binary_string)
70
88
  return binary_string if binary_string.nil? || (binary_string == "")
@@ -1,3 +1,3 @@
1
1
  module SymmetricEncryption
2
- VERSION = "4.3.3".freeze
2
+ VERSION = "4.4.0".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: symmetric-encryption
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.3.3
4
+ version: 4.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Reid Morrison
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-15 00:00:00.000000000 Z
11
+ date: 2021-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: coercible