evervault 2.0.0 → 2.1.0

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: c750c2a56b880d7ef8c5c0cef1bb856476d8fa88bf2cc06c72be2e45b14935dd
4
- data.tar.gz: f162eb3e45b0d907642753b9f387cece1f49e3f3531b7cfb6570bcf6a00eba66
3
+ metadata.gz: d24159a979aa8a8a684447e804ce5280bb03946ff7b81847d3ca34cdc794c488
4
+ data.tar.gz: 5b5c762a8abab38f848c506acf3674a8b39357d06f4d57c2fd4d71e8949c2886
5
5
  SHA512:
6
- metadata.gz: 322cc850f1d240e09ce26069af576efe8d588b2a939e67fb4bc4402cffc32a8eaaecc98abc4ced0f18ce6e912c52bab801f0b08197fb695a9e115edc8b5fc04d
7
- data.tar.gz: fb7e6f187bdda3f361da65f6192424a6e09e20a97be40e486b29b9396d58a05a7d61f7df6d60338dce5133acecf3917091fa89f65005da93d29e69bb3c02a5ef
6
+ metadata.gz: 3e4b9c709918dd7623c7c5209d7b0848a9eef6f1c80c016234f266eb9ecca3994229f298e5001b2a14341fe687b52b37672705971366f7d027a2e91f2639528f
7
+ data.tar.gz: f11ad2a4010f1aaf6f1c11efe6e5fb1fe9db8f4efae07e581de4eaef7af41b8f78adf3e348182c8b65cbad694fe85009786da9da6d5ea7fc4d05fe7142942cae
data/README.md CHANGED
@@ -101,6 +101,21 @@ Evervault.decrypt(data = String | Array | Hash)
101
101
  | --------- | ------------------------- | -------------------- |
102
102
  | data | `String`, `Array`, `Hash` | Data to be decrypted |
103
103
 
104
+ ### Evervault.create_client_side_decrypt_token
105
+ `Evervault.create_client_side_token` is used to generate a time-bound token that can be used by front-end applications to decrypt Evervault encrypted data.
106
+
107
+ ```ruby
108
+ time_now = Time.now
109
+ time_in_five_minutes = time_now + 300
110
+ Evervault.create_client_side_decrypt_token(encrypted_data, time_in_five_minutes)
111
+ ```
112
+
113
+ | Parameter | Type | Description |
114
+ | --------- | ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
115
+ | data | `String`, `Array`, `Hash` | The payload the token can be used to decrypt. |
116
+ | expiry | `Time` | Optional -- The time the token should expire. The max expiry is 10 minutes in the future. If not supplied it defaults to 5 minutes |
117
+
118
+
104
119
  ### Evervault.enable_outbound_relay
105
120
 
106
121
  `Evervault.enable_outbound_relay` configures your application to proxy HTTP requests using Outbound Relay based on the configuration created in the Evervault UI. See [Outbound Relay](https://docs.evervault.com/concepts/outbound-relay/overview) to learn more.
@@ -45,6 +45,11 @@ module Evervault
45
45
  response["data"]
46
46
  end
47
47
 
48
+ def create_token(action, data, expiry = nil)
49
+ payload = { payload: data, expiry: expiry, action: action }
50
+ @request_handler.post("client-side-tokens", payload, nil, nil, true)
51
+ end
52
+
48
53
  def run(function_name, payload, options = {})
49
54
  optional_headers = {}
50
55
  if options.key?(:async)
@@ -1,4 +1,4 @@
1
1
  module Evervault
2
- VERSION = "2.0.0"
2
+ VERSION = "2.1.0"
3
3
  EV_VERSION = {"prime256v1" => "NOC", "secp256k1" => "DUB"}
4
4
  end
data/lib/evervault.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require "time"
1
2
  require_relative "evervault/version"
2
3
  require_relative "evervault/client"
3
4
  require_relative "evervault/errors/errors"
@@ -28,6 +29,13 @@ module Evervault
28
29
  client.create_run_token(function_name, data)
29
30
  end
30
31
 
32
+ def create_client_side_decrypt_token(data, expiry = nil)
33
+ if expiry != nil
34
+ expiry = (expiry.to_f * 1000).to_i
35
+ end
36
+ client.create_token("api:decrypt", data, expiry)
37
+ end
38
+
31
39
  private def client
32
40
  Evervault::Utils::ValidationUtils.validate_app_uuid_and_api_key(app_id, api_key)
33
41
  @client ||= Evervault::Client.new(app_uuid: app_id, api_key: api_key)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evervault
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonny O'Mahony
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-07-21 00:00:00.000000000 Z
11
+ date: 2023-08-23 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: