selfsdk 0.0.189 → 0.0.192

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: 5b2273047a020d9c4a04ae840a37fedb2129cba216613ae91c54de7a04f16539
4
- data.tar.gz: 56d2336cdb03b894d5a792096ec2471bb9dba07377e3a1a7c735a225362cc886
3
+ metadata.gz: 1b84b3c0de37f3796956af4b2dad2ac22c36d607abac1dee60cf6eceb4d3ff38
4
+ data.tar.gz: 802b73496bc17ca86f09035e13a85c6d572b9607aac42b9688bd0cd2a0a0e994
5
5
  SHA512:
6
- metadata.gz: dc6acc1f75c6eb4fb2b64f372441d3a712f04958bca1f029809ea970d091850a5291d911587068ab4ba348a76d3baf29632cf9e337817e6c750907cddb51cabc
7
- data.tar.gz: c32cd01077dba0a2e0087d40472dac1b7ef565c01632a7ccd86e9f5286d9f01c6bb3b19865a64acd8b9a45006c0b5ff820a5adc466c32ead069cafebd9ee2958
6
+ metadata.gz: 82458fb940a2d07acd9a2ae91f4b6abc71b25e3acb43c297026de425998a9b666441c2c10d8f206c5a26a85bd76cd947fc498d0f4e092bfd9e43e06b0819ddfe
7
+ data.tar.gz: 36447c612f393d0c1cae07ddf88380532346eae60828114389e4e0f741ce08cdbc65e13c62b19fd704493d1867a962141d6ecc76ff4b4089b24e6678aa4cb690
@@ -13,7 +13,7 @@ module SelfSDK
13
13
  @url = url
14
14
  end
15
15
 
16
- def build_from_data(name, data, mime)
16
+ def build_from_data(name, data, mime, opts = {})
17
17
  @key = SelfCrypto::Util.aead_xchacha20poly1305_ietf_keygen
18
18
  @nonce = SelfCrypto::Util.aead_xchacha20poly1305_ietf_nonce
19
19
  @content = data
@@ -25,7 +25,8 @@ module SelfSDK
25
25
 
26
26
  # Upload
27
27
  remote_object = upload(ciphertext)
28
- @link = "#{@url}/v1/objects/#{remote_object["id"]}"
28
+ public_url = opts[:public_url] || @url
29
+ @link = "#{public_url}/v1/objects/#{remote_object["id"]}"
29
30
  @expires = remote_object["expires"]
30
31
 
31
32
  self
@@ -75,7 +76,7 @@ module SelfSDK
75
76
  def upload(ciphertext)
76
77
  uri = URI.parse("#{@url}/v1/objects")
77
78
  https = Net::HTTP.new(uri.host, uri.port)
78
- https.use_ssl = true
79
+ https.use_ssl = true if uri.scheme == "https"
79
80
  req = Net::HTTP::Post.new(uri.path)
80
81
  req["Authorization"] = "Bearer #{@token}"
81
82
  req.body = ciphertext.force_encoding("UTF-8")
data/lib/crypto.rb CHANGED
@@ -151,7 +151,7 @@ module SelfSDK
151
151
  # if there is no session, create one
152
152
  # if there is an existing session and we are sent a one time key message, check
153
153
  # if it belongs to this current session and create a new inbound session if it doesn't
154
- if session_with_bob.nil? || m.instance_of?(SelfCrypto::PreKeyMessage) and !session_with_bob.will_receive?(m)
154
+ if session_with_bob.nil? || m.instance_of?(SelfCrypto::PreKeyMessage) && !session_with_bob.will_receive?(m)
155
155
  # 7b-ii) use the initial message to create a session for bob or carol
156
156
  session_with_bob = @account.inbound_session(m)
157
157
 
data/lib/services/docs.rb CHANGED
@@ -28,7 +28,7 @@ module SelfSDK
28
28
  # @param objects [Array] array of objects to be signed. provide an empty array if
29
29
  # you just want the body to be signed.
30
30
  # @yield [request] Invokes the given block when a response is received.
31
- def request_signature(recipient, body, objects, &block)
31
+ def request_signature(recipient, body, objects, opts = {}, &block)
32
32
  jti = SecureRandom.uuid
33
33
  req = {
34
34
  jti: jti,
@@ -43,7 +43,8 @@ module SelfSDK
43
43
  req[:objects] << SelfSDK::Chat::FileObject.new(auth_token, @self_url).build_from_data(
44
44
  o[:name],
45
45
  o[:data],
46
- o[:mime]
46
+ o[:mime],
47
+ opts
47
48
  ).to_payload
48
49
  end
49
50
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: selfsdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.189
4
+ version: 0.0.192
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aldgate Ventures