enquo-core 0.1.0.4.gdb566eb-arm64-darwin → 0.2.0.1.g790fccd-arm64-darwin

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: de31ec9020ed5b4ad70da8db13445cc05309aa98c84ec0763cff509899e4ba49
4
- data.tar.gz: 454c92f96d77efb118ea77ad589020c7d5a76eb3485df6875b8f4c40ad643798
3
+ metadata.gz: 0c9315e77f2fe1adc49156e43ca05dca5fac169ebcb541455f0d68c0c9873d03
4
+ data.tar.gz: 97cb80789242681969e4c6b6abff60751b6a187d5a4b54a83d8f994d1e55af76
5
5
  SHA512:
6
- metadata.gz: ad436c5557ed4f0319d45f50ecac05114faee01942bbf6c179fba937c00d18401d5fe0c615165d87be8565a0f7b0e275a6175d02ba2dc9dd2d669e53ce379788
7
- data.tar.gz: 94183a91696c8a7f95ca80c03196620d29e1911daf34ec188c3358b73b855d7737ddd7baa031fb82f5627ba0881ee66069d5133711e5e1a9b548f88e8f949a85
6
+ metadata.gz: 9ebcc951fc278c9b2749b9abe192d89ed6a5c180d0d1d7a60d6cbe4e6df26239f885c70e7e0fc8d219a679957f8a7a7c2d2840a603998d0bb351b38082529689
7
+ data.tar.gz: '0768611064af136afde9a9c687e97432792af2be23db966d162fdca23889123ec740dc3c0b9cbd8d784626c8729de3573e1f8598d6f8fe167a248664ad01f2bb'
data/ext/enquo/src/lib.rs CHANGED
@@ -2,7 +2,7 @@
2
2
  extern crate rutie;
3
3
 
4
4
  use enquo_core::{Field, Root, I64};
5
- use rutie::{Boolean, Class, Integer, Module, Object, RString, VerifiedObject, VM};
5
+ use rutie::{Class, Integer, Module, Object, RString, Symbol, VerifiedObject, VM};
6
6
 
7
7
  class!(EnquoRoot);
8
8
  class!(EnquoRootKeyStatic);
@@ -81,18 +81,24 @@ impl VerifiedObject for EnquoRootKeyStatic {
81
81
  methods!(
82
82
  EnquoField,
83
83
  rbself,
84
- fn enquo_field_encrypt_i64(value: Integer, context: RString, unsafe_parts: Boolean) -> RString {
84
+ fn enquo_field_encrypt_i64(value: Integer, context: RString, mode: Symbol) -> RString {
85
85
  let i = value.unwrap().to_i64();
86
86
  let field = rbself.get_data(&*FIELD_WRAPPER);
87
+ let r_mode = mode.unwrap();
88
+ let s_mode = r_mode.to_str();
87
89
 
88
- let res = maybe_raise(
89
- if unsafe_parts.unwrap().to_bool() {
90
+ let mut res = maybe_raise(
91
+ if s_mode == "unsafe" {
90
92
  I64::new_with_unsafe_parts(i, &context.unwrap().to_vec_u8_unchecked(), field)
91
93
  } else {
92
94
  I64::new(i, &context.unwrap().to_vec_u8_unchecked(), field)
93
95
  },
94
96
  "Failed to create encrypted i64",
95
97
  );
98
+ if s_mode == "no_query" {
99
+ res.drop_ore_ciphertext();
100
+ }
101
+
96
102
  RString::new_utf8(&serde_json::to_string(&res).unwrap())
97
103
  },
98
104
  fn enquo_field_decrypt_i64(ciphertext: RString, context: RString) -> Integer {
data/lib/2.7/enquo.bundle CHANGED
Binary file
data/lib/3.0/enquo.bundle CHANGED
Binary file
data/lib/3.1/enquo.bundle CHANGED
Binary file
data/lib/enquo/field.rb CHANGED
@@ -4,7 +4,7 @@ module Enquo
4
4
  raise RuntimeError, "Enquo::Field cannot be instantiated directly; use Enquo::Crypto#field instead"
5
5
  end
6
6
 
7
- def encrypt_i64(i, ctx, safety: nil)
7
+ def encrypt_i64(i, ctx, safety: true, no_query: false)
8
8
  unless i.is_a?(Integer)
9
9
  raise ArgumentError, "Enquo::Field#encrypt_i64 can only encrypt integers"
10
10
  end
@@ -17,7 +17,7 @@ module Enquo
17
17
  raise ArgumentError, "Encryption context must be a string (got a #{ctx.class})"
18
18
  end
19
19
 
20
- _encrypt_i64(i, ctx, safety == :unsafe)
20
+ _encrypt_i64(i, ctx, no_query ? :no_query : safety == :unsafe ? :unsafe : :default)
21
21
  end
22
22
 
23
23
  def decrypt_i64(data, ctx)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enquo-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.4.gdb566eb
4
+ version: 0.2.0.1.g790fccd
5
5
  platform: arm64-darwin
6
6
  authors:
7
7
  - Matt Palmer