enquo-core 0.7.0.2.ga69badc-x86_64-linux → 0.7.0.5.gb281772-x86_64-linux

Sign up to get free protection for your applications and to get access to all the features.
data/lib/enquo/root.rb DELETED
@@ -1,28 +0,0 @@
1
- module Enquo
2
- class Root
3
- def self.new(key)
4
- case key
5
- when RootKey::Static
6
- _new_from_static_root_key(key)
7
- else
8
- raise ArgumentError, "key must be a root key provider object (got a #{key.class})"
9
- end.tap do |k|
10
- # DIRTY HACK ALERT: take a reference to the key so it doesn't get GC'd
11
- # If someone can come up with a better way to acheive this, I'm all ears
12
- k.instance_variable_set(:@_key, key)
13
- end
14
- end
15
-
16
- def field(relation, name)
17
- if relation.is_a?(Symbol)
18
- relation = relation.to_s
19
- end
20
-
21
- if name.is_a?(Symbol)
22
- name = name.to_s
23
- end
24
-
25
- _field(relation, name)
26
- end
27
- end
28
- end
@@ -1,27 +0,0 @@
1
- module Enquo
2
- module RootKey
3
- class Static
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
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
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
19
-
20
- [k].pack("H*")
21
- end
22
-
23
- _new(key)
24
- end
25
- end
26
- end
27
- end
@@ -1 +0,0 @@
1
- require_relative "./root_key/static"