tanker-core 2.32.0.beta.5 → 2.32.0.beta.7

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: daa4b2c0d8815ee230c2b0d527cf4e22bc291caf8e26e1f900bfc13b1d9017d2
4
- data.tar.gz: 48dc528f83683a21044011b007af7a840be1627bc3ef6d88fb74a2e3d384e7ac
3
+ metadata.gz: 042b0f9b9fe8964bf0d3da88e1bffb4646f260304627d6a6813bb429838dc255
4
+ data.tar.gz: 498a8a4ba6fe003dcc23f255f7263d33d8d9d63f028e53e36872e416a859e5ff
5
5
  SHA512:
6
- metadata.gz: f3248db2c24300af11d21440ec162cccc0af2ed01a5d18b7d40386394940145c06958f4e0a8ee26058cd9668701fe1ce800b6231534f4e8320a55e188e70ad62
7
- data.tar.gz: c7448b1ec95d804ae6c3cf23678f94fa63b8424eb90afeccf4f93e9f21ad1438a6b682d9af7ba7305969c8f4c30e48693940320a2cabc31d5b6f01f6881bc7a7
6
+ metadata.gz: e5e64eac1254d2850fad38e28cbc2837703e589bf876ef9ae25693f0967a1b200800e0b363fd404beb7614e387eced8051c142b3e43fb820302f2c504fbe2124
7
+ data.tar.gz: 90b6995a2b1c1b22a7e5a68d1011806d60872633314e70ee1f184ea889bb42ff9da2f44fc6219d44d1a519889ca743014ef27a1af8a5808c44e294fb1ac986ea
@@ -47,7 +47,7 @@ module Tanker
47
47
  blocking_attach_function :tanker_attach_provisional_identity, [:session_pointer, :string], CFuture
48
48
  blocking_attach_function :tanker_verify_provisional_identity, [:session_pointer, CVerification], CFuture
49
49
 
50
- blocking_attach_function :tanker_encrypted_size, [:uint64, :uint32], :uint64
50
+ blocking_attach_function :tanker_encrypted_size, [:uint64], :uint64
51
51
  blocking_attach_function :tanker_decrypted_size, [:pointer, :uint64], CFuture
52
52
  blocking_attach_function :tanker_get_resource_id, [:pointer, :uint64], CFuture
53
53
 
@@ -68,7 +68,7 @@ module Tanker
68
68
 
69
69
  blocking_attach_function :tanker_encryption_session_open, [:session_pointer, Tanker::EncryptionOptions], CFuture
70
70
  blocking_attach_function :tanker_encryption_session_close, [:enc_sess_pointer], CFuture
71
- blocking_attach_function :tanker_encryption_session_encrypted_size, [:enc_sess_pointer, :uint64], :uint64
71
+ blocking_attach_function :tanker_encryption_session_encrypted_size, [:uint64], :uint64
72
72
  blocking_attach_function :tanker_encryption_session_get_resource_id, [:enc_sess_pointer], CFuture
73
73
  blocking_attach_function :tanker_encryption_session_encrypt, [:enc_sess_pointer, :pointer,
74
74
  :pointer, :uint64], CFuture
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'tanker/c_tanker'
4
- require 'tanker/encryption_options'
5
4
  require_relative 'encryption_session'
6
5
 
7
6
  module Tanker
@@ -81,19 +80,17 @@ module Tanker
81
80
 
82
81
  private
83
82
 
84
- def encrypt_common(data, encryption_options)
85
- unless encryption_options.nil? || encryption_options.is_a?(EncryptionOptions)
83
+ def encrypt_common(data, encryption_options = nil)
84
+ unless !encryption_options || encryption_options.is_a?(EncryptionOptions)
86
85
  raise TypeError, "expected encryption_options to be a EncryptionOptions, but got a #{encryption_options.class}"
87
86
  end
88
87
 
89
88
  inbuf = FFI::MemoryPointer.from_string(data)
90
89
 
91
- options = encryption_options || EncryptionOptions.new
92
-
93
- encrypted_size = CTanker.tanker_encrypted_size(data.bytesize, options[:padding_step])
90
+ encrypted_size = CTanker.tanker_encrypted_size data.bytesize
94
91
  outbuf = FFI::MemoryPointer.new(:char, encrypted_size)
95
92
 
96
- CTanker.tanker_encrypt(@ctanker, outbuf, inbuf, data.bytesize, options).get
93
+ CTanker.tanker_encrypt(@ctanker, outbuf, inbuf, data.bytesize, encryption_options).get
97
94
 
98
95
  outbuf.read_string encrypted_size
99
96
  end
@@ -33,7 +33,7 @@ module Tanker
33
33
  def encrypt_common(data)
34
34
  inbuf = FFI::MemoryPointer.from_string(data)
35
35
 
36
- encrypted_size = CTanker.tanker_encryption_session_encrypted_size(@csession, data.bytesize)
36
+ encrypted_size = CTanker.tanker_encryption_session_encrypted_size data.bytesize
37
37
  outbuf = FFI::MemoryPointer.new(:char, encrypted_size)
38
38
 
39
39
  CTanker.tanker_encryption_session_encrypt(@csession, outbuf, inbuf, data.bytesize).get
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Tanker
4
4
  class Core
5
- VERSION = '2.32.0.beta.5'
5
+ VERSION = '2.32.0.beta.7'
6
6
 
7
7
  def self.native_version
8
8
  CTanker.tanker_version_string
@@ -6,8 +6,7 @@ require 'tanker/c_tanker/c_string'
6
6
  module Tanker
7
7
  # Options that can be given when encrypting data
8
8
  class EncryptionOptions < FFI::Struct
9
- def initialize(share_with_users: [], share_with_groups: [], share_with_self: true,
10
- padding_step: Padding::AUTO)
9
+ def initialize(share_with_users: [], share_with_groups: [], share_with_self: true)
11
10
  super()
12
11
 
13
12
  @users_objs = share_with_users.map { |id| CTanker.new_cstring id }
@@ -18,13 +17,12 @@ module Tanker
18
17
  groups = FFI::MemoryPointer.new(:pointer, share_with_groups.length)
19
18
  groups.write_array_of_pointer(@groups_objs)
20
19
 
21
- self[:version] = 4
20
+ self[:version] = 3
22
21
  self[:recipient_public_identities] = users
23
22
  self[:nb_recipient_public_identities] = share_with_users.length
24
23
  self[:recipient_group_ids] = groups
25
24
  self[:nb_recipient_group_ids] = share_with_groups.length
26
25
  self[:share_with_self] = share_with_self
27
- self[:padding_step] = padding_step.native_value
28
26
  end
29
27
 
30
28
  layout :version, :uint8,
@@ -32,33 +30,6 @@ module Tanker
32
30
  :nb_recipient_public_identities, :uint32,
33
31
  :recipient_group_ids, :pointer,
34
32
  :nb_recipient_group_ids, :uint32,
35
- :share_with_self, :bool,
36
- :padding_step, :uint32
37
- end
38
-
39
- class Padding
40
- private_class_method :new
41
- attr_reader :native_value
42
-
43
- def initialize(native_value)
44
- super()
45
- @native_value = native_value
46
- end
47
-
48
- AUTO = new 0
49
- OFF = new 1
50
-
51
- def self.step(value)
52
- unless value.is_a?(Integer)
53
- raise TypeError,
54
- "expected step to be an Integer >= 2, but got a #{value.class}"
55
- end
56
- unless value >= 2
57
- raise ArgumentError,
58
- "expected step to be an Integer >= 2, but got #{value}"
59
- end
60
-
61
- new(value)
62
- end
33
+ :share_with_self, :bool
63
34
  end
64
35
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tanker-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.32.0.beta.5
4
+ version: 2.32.0.beta.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tanker team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-19 00:00:00.000000000 Z
11
+ date: 2022-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday