asherah 0.4.0 → 0.4.3

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: e488eb972195bbc3f37253f2d71b54ad89d069c24260e7800de4602df9277ca5
4
- data.tar.gz: c865721c410b6a887cbb89b425d64dd17bae9ceda8c2796ca68ff67537750bb9
3
+ metadata.gz: 9098ee6681a398bacec44f13be279fec2fbef2923624fc9078c7742e8e1518fc
4
+ data.tar.gz: 6c3dbb005b491d3ae2885dd9d8e20889b363f8207ed23034965db28ad0c8400d
5
5
  SHA512:
6
- metadata.gz: 141ef3ec23e647f077372e3026dc68539609fec19b05b4ce683d06b30ba8d7b9253ec62beb38a2edec4adfe63e62d1596ed5694e9ffa6822bd37a4a231b220e6
7
- data.tar.gz: d8ca23008b6146270b4d13cbc0a1d0c8d84d798fe4a45b54cddacefc351040b7667823c19321aef09f8b142b628b84b8b27f0ae8840e16db59eeb4f99266426e
6
+ metadata.gz: 49b917c12c8c717d26c9e55555c5bfdc0852d378dae5e92aa7c2707d0c66ffd841e02434785d895716bc496ced2c555684ed409029fbfbb58dcb4614a9f50212
7
+ data.tar.gz: f90603b74c0a0c8366855292c4fa49813a5bf9b21cd6dc7ce5c779394bc865b393c529931ea17c9ef8eaaf08bff1f1b67179d2560252b3d83838732e603c64f7
data/.rubocop.yml CHANGED
@@ -32,3 +32,6 @@ Metrics/AbcSize:
32
32
 
33
33
  Style/GuardClause:
34
34
  Enabled: false
35
+
36
+ Naming/AccessorMethodName:
37
+ Enabled: false
data/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.4.3] - 2022-08-31
4
+
5
+ - Upgrade to use asherah-cobhan v0.4.16
6
+
7
+ ## [0.4.2] - 2022-07-25
8
+
9
+ - Upgrade to use asherah-cobhan v0.4.15
10
+ - Add `set_env` method to set environment variables for Asherah
11
+
12
+ ## [0.4.1] - 2022-03-25
13
+
14
+ - Build and release platform gems
15
+
3
16
  ## [0.4.0] - 2022-03-25
4
17
 
5
18
  - Download native file during gem install and verify checksum
data/Rakefile CHANGED
@@ -25,3 +25,5 @@ desc 'Print current version'
25
25
  task :version do
26
26
  puts Asherah::VERSION
27
27
  end
28
+
29
+ Rake.add_rakelib 'tasks'
data/asherah.gemspec CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
27
27
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
28
28
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
29
29
  `git ls-files -z`.split("\x0").reject do |f|
30
- (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
30
+ (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features|tasks)/|\.(?:git|travis|circleci)|appveyor)})
31
31
  end
32
32
  end
33
33
  spec.bindir = 'exe'
@@ -1,5 +1,5 @@
1
- version: v0.4.11
2
- libasherah-arm64.so: bc044b74453fc8fceca564fb127c9f2748aeac107791bd24c680ced1fcb7b816
3
- libasherah-x64.so: 82f10505ef11fba2c8e027668d9b5c89584f73eb1e53a9f5ff21d5705ecffb3a
4
- libasherah-arm64.dylib: 0b843d002212722c442c990d84e6ceac73c78e1663260be8c3f759a9a283b14a
5
- libasherah-x64.dylib: fd0592ed4cdfbc7b3a2534b540c22301a9669c6c37dfb3d28f600ccc9ba975f8
1
+ version: v0.4.16
2
+ libasherah-arm64.so: 14c4734de6bbae936e3504ad9daa31f1081755de017188a46079f0b1d3a14ea1
3
+ libasherah-x64.so: 60d68c030cdc1c792ee002f77f3b4f3f28994b94ed080b2c618d7ee636248a12
4
+ libasherah-arm64.dylib: 5d7b358e1dfd6a1946a6538442856f44a1c122d5ec467b41f6f994eac45c8a2f
5
+ libasherah-x64.dylib: 0b01f69740628869052dabdcc33c69f4a1349e4136c68ce7d859b4eb7800d0a9
@@ -17,16 +17,15 @@ class NativeFile
17
17
  RETRY_DELAY = 1
18
18
 
19
19
  class << self
20
- def download
21
- file_name = Class.new.extend(Cobhan).library_file_name(LIB_NAME)
22
- lib_dir = File.join(ROOT_DIR, 'lib/asherah')
23
- abort "#{lib_dir} does not exist" unless File.exist?(lib_dir)
24
-
25
- native_dir = "#{lib_dir}/native"
26
- FileUtils.mkdir_p(native_dir)
27
-
28
- file_path = File.join(native_dir, file_name)
29
- abort "#{file_path} already exists" if File.exist?(file_path)
20
+ def download(
21
+ file_name: Class.new.extend(Cobhan).library_file_name(LIB_NAME),
22
+ dir: File.join(ROOT_DIR, 'lib/asherah/native')
23
+ )
24
+ file_path = File.join(dir, file_name)
25
+ if File.exist?(file_path)
26
+ puts "#{file_path} already exists ... skipping download"
27
+ return
28
+ end
30
29
 
31
30
  checksum = CHECKSUMS.fetch(file_name) do
32
31
  abort "Unsupported platform #{RUBY_PLATFORM}"
@@ -37,6 +36,7 @@ class NativeFile
37
36
  sha256 = Digest::SHA256.hexdigest(content)
38
37
  abort "Could not verify checksum of #{file_name}" if sha256 != checksum
39
38
 
39
+ FileUtils.mkdir_p(dir)
40
40
  File.binwrite(file_path, content)
41
41
  end
42
42
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Asherah
4
- VERSION = '0.4.0'
4
+ VERSION = '0.4.3'
5
5
  end
data/lib/asherah.rb CHANGED
@@ -11,6 +11,7 @@ module Asherah
11
11
 
12
12
  LIB_ROOT_PATH = File.expand_path('asherah/native', __dir__)
13
13
  load_library(LIB_ROOT_PATH, 'libasherah', [
14
+ [:SetEnv, [:pointer], :int32],
14
15
  [:SetupJson, [:pointer], :int32],
15
16
  [:EncryptToJson, [:pointer, :pointer, :pointer], :int32],
16
17
  [:DecryptFromJson, [:pointer, :pointer, :pointer], :int32],
@@ -22,6 +23,22 @@ module Asherah
22
23
  BASE64_OVERHEAD = 1.34
23
24
 
24
25
  class << self
26
+ # Set environment variables needed by Asherah dependencies for when
27
+ # Go os.Getenv() doesn't see variables set by C.setenv().
28
+ # References:
29
+ # https://github.com/golang/go/wiki/cgo#environmental-variables
30
+ # https://github.com/golang/go/issues/44108
31
+ #
32
+ # @yield [Config]
33
+ # @param env [Hash], Key-value pairs to set Asherah ENV
34
+ # @return [void]
35
+ def set_env(env = {})
36
+ env_buffer = string_to_cbuffer(env.to_json)
37
+
38
+ result = SetEnv(env_buffer)
39
+ Error.check_result!(result, 'SetEnv failed')
40
+ end
41
+
25
42
  # Configures Asherah
26
43
  #
27
44
  # @yield [Config]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asherah
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - GoDaddy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-03-25 00:00:00.000000000 Z
11
+ date: 2022-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cobhan