enquo-core 0.6.0 → 0.6.0.4.gd752e84

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: bcf12f9a2c0fe653f6b34e5e7ab9914d105e924d35ccc8470b25d65c74f564b6
4
- data.tar.gz: d31beface873561e3b2ef47508c3e39e67c25ff2f1e4e69b5c2bda220b9af164
3
+ metadata.gz: 3dfc1b777651bc1aaccc983a226023962ebb3a566badff9c0c1cfd80c21c2ab6
4
+ data.tar.gz: f4d046426b428b0c6142ff581301b1e9137508bcef5d48850b983d60a58c91b3
5
5
  SHA512:
6
- metadata.gz: 9dab51ccec229e7e60003648fcb2ac28bca3af5e0772c02ad410f5e39037c84546b41857605467cda0bd9b2455095f98a9b07456235936915fa1b74c9a85a40d
7
- data.tar.gz: 9b3ee13bfe6ef04143c8b162b0beb0e390c18845ecbb2fd7b34ee7fc2fca92bdbc6fbd9320e021945d27b7fe8ed8f58edf97dfaf13e9cf8f169b61b293a688ce
6
+ metadata.gz: 9e93651c57ae0bf2f1c141c4fbabadd34ba51bde2c8da481ec077a352d19184b151459202fd521654a8534cd959cbbe9d7e44ffbffa09f775fb51e131d830553
7
+ data.tar.gz: 2b131ac4df53533d2433b59d621efe92ed04116c6d4b1b3236aba62419fddcf5bf803c9a8b66011db9ac3269b2348b5e554d2cdd7fa2063fa22b254e9cab44ef
data/README.md ADDED
@@ -0,0 +1,55 @@
1
+ This directory contains the Ruby bindings for the [Enquo](https://enquo.org) core cryptography library.
2
+
3
+ ## Note Well
4
+
5
+ When reading these docs, bear in mind that this is a *low level* cryptographic library.
6
+ It is not intended that most users will use `enquo-core` directly.
7
+ Instead, typically you will use Enquo via your preferred ORM or other higher-level integration.
8
+ This library is intended to be used to build *those* integrations, not to be used in applications directly.
9
+
10
+
11
+ # Installation
12
+
13
+ Typically you'll want to install [the rubygem]:
14
+
15
+ ```bash
16
+ gem install enquo-core
17
+ ```
18
+
19
+ If you use a platform for which pre-built binary packages are available, this will Just Work.
20
+ Otherwise, you'll need a [Rust toolchain](https://www.rust-lang.org/learn/get-started) to build.
21
+
22
+
23
+ # Usage
24
+
25
+ The Enquo core is all about encrypting and decrypting *field data*, using keys derived from a *root*.
26
+
27
+ Load the library:
28
+
29
+ ```ruby
30
+ require "enquo-core"
31
+ ```
32
+
33
+ Create the root key, from which all other cryptographic keys are derived:
34
+
35
+ ```ruby
36
+ root_key = Enquo::RootKey::Static.new(SecureRandom.bytes(32))
37
+ ```
38
+
39
+ (In real-world use, you'll want to take that key from somewhere it can be securely stored)
40
+
41
+ Now, you can create the root itself:
42
+
43
+ ```ruby
44
+ root = Enquo::Root.new(root_key)
45
+ ```
46
+
47
+ Finally, you can now create a "field" object, which is what is used to do encryption and decryption:
48
+
49
+ ```ruby
50
+ f = root.field("some_relation", "some_field_name")
51
+ ciphertext = f.encrypt_text("this is some text", "test")
52
+ puts f.decrypt_text(ciphertext, "test").inspect # Should print "this is some text"
53
+ ```
54
+
55
+ For more details on the full API, consult [the fine manual](https://www.rubydoc.info/gems/enquo-core).
@@ -2,23 +2,23 @@ module Enquo
2
2
  module RootKey
3
3
  class Static
4
4
  def self.new(k)
5
- unless k.is_a?(String)
6
- raise ArgumentError, "An Enquo static root key must be passed a string"
7
- end
5
+ unless k.is_a?(String)
6
+ raise ArgumentError, "An Enquo static root key must be passed a string"
7
+ end
8
8
 
9
- key = if k.encoding == Encoding::BINARY
10
- unless k.bytesize == 32
11
- raise ArgumentError, "An Enquo static root key must be a 32 byte binary string"
12
- end
9
+ key = if k.encoding == Encoding::BINARY
10
+ unless k.bytesize == 32
11
+ raise ArgumentError, "An Enquo static root key must be a 32 byte binary string"
12
+ end
13
13
 
14
- k
15
- else
16
- unless k =~ /\A\h{64}\z/
17
- raise ArgumentError, "An Enquo static root key must be a 64 byte hex string"
18
- end
14
+ k
15
+ else
16
+ unless k =~ /\A\h{64}\z/
17
+ raise ArgumentError, "An Enquo static root key must be a 64 byte hex string"
18
+ end
19
19
 
20
- [k].pack("H*")
21
- end
20
+ [k].pack("H*")
21
+ end
22
22
 
23
23
  _new(key)
24
24
  end
data/lib/enquo-core.rb ADDED
@@ -0,0 +1 @@
1
+ require_relative "./enquo.rb"
data/lib/enquo_core.rb ADDED
@@ -0,0 +1 @@
1
+ require_relative "./enquo.rb"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enquo-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.0.4.gd752e84
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Palmer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-07 00:00:00.000000000 Z
11
+ date: 2023-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -158,17 +158,20 @@ extensions: []
158
158
  extra_rdoc_files: []
159
159
  files:
160
160
  - ".gitignore"
161
+ - README.md
161
162
  - enquo-core.gemspec
162
163
  - ext/enquo/.gitignore
163
164
  - ext/enquo/Cargo.lock
164
165
  - ext/enquo/Cargo.toml
165
166
  - ext/enquo/extconf.rb
166
167
  - ext/enquo/src/lib.rs
168
+ - lib/enquo-core.rb
167
169
  - lib/enquo.rb
168
170
  - lib/enquo/field.rb
169
171
  - lib/enquo/root.rb
170
172
  - lib/enquo/root_key.rb
171
173
  - lib/enquo/root_key/static.rb
174
+ - lib/enquo_core.rb
172
175
  homepage: https://enquo.org/active_enquo
173
176
  licenses: []
174
177
  metadata:
@@ -187,9 +190,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
187
190
  version: 2.7.0
188
191
  required_rubygems_version: !ruby/object:Gem::Requirement
189
192
  requirements:
190
- - - ">="
193
+ - - ">"
191
194
  - !ruby/object:Gem::Version
192
- version: '0'
195
+ version: 1.3.1
193
196
  requirements: []
194
197
  rubygems_version: 3.1.6
195
198
  signing_key: