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 +4 -4
- data/.rubocop.yml +3 -0
- data/CHANGELOG.md +13 -0
- data/Rakefile +2 -0
- data/asherah.gemspec +1 -1
- data/ext/asherah/checksums.yml +5 -5
- data/ext/asherah/native_file.rb +10 -10
- data/lib/asherah/version.rb +1 -1
- data/lib/asherah.rb +17 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9098ee6681a398bacec44f13be279fec2fbef2923624fc9078c7742e8e1518fc
|
4
|
+
data.tar.gz: 6c3dbb005b491d3ae2885dd9d8e20889b363f8207ed23034965db28ad0c8400d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49b917c12c8c717d26c9e55555c5bfdc0852d378dae5e92aa7c2707d0c66ffd841e02434785d895716bc496ced2c555684ed409029fbfbb58dcb4614a9f50212
|
7
|
+
data.tar.gz: f90603b74c0a0c8366855292c4fa49813a5bf9b21cd6dc7ce5c779394bc865b393c529931ea17c9ef8eaaf08bff1f1b67179d2560252b3d83838732e603c64f7
|
data/.rubocop.yml
CHANGED
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
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'
|
data/ext/asherah/checksums.yml
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
version: v0.4.
|
2
|
-
libasherah-arm64.so:
|
3
|
-
libasherah-x64.so:
|
4
|
-
libasherah-arm64.dylib:
|
5
|
-
libasherah-x64.dylib:
|
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
|
data/ext/asherah/native_file.rb
CHANGED
@@ -17,16 +17,15 @@ class NativeFile
|
|
17
17
|
RETRY_DELAY = 1
|
18
18
|
|
19
19
|
class << self
|
20
|
-
def download
|
21
|
-
file_name
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
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
|
|
data/lib/asherah/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2022-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cobhan
|