legion-crypt 1.4.14 → 1.4.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 939ab01a7c1290816ca55ec819f24b7f92d74048d8e03f709e4b5dfa27777bcc
4
- data.tar.gz: 4695589ab361ab5f0be3abf5d5100ecf46f61a1cc3abf5985240769ba1a3a48e
3
+ metadata.gz: 5f43eee9680197c62f53f2a7ed8c77eee725f7f01744c32e5ad0115fdfb2ad21
4
+ data.tar.gz: 3ba3cd7da0684d8a9ec68d23797d487240035dc2f5e07fdba7ab0cfb1727dafe
5
5
  SHA512:
6
- metadata.gz: d0385d55fd7fe6e0e6b7addff8c23cd7f1009fcc3e617c3dee3f998341c1efa6b96879224da517a414d13ba27fdcf9f5bf5c113f08ccd76112202a2915cb7a05
7
- data.tar.gz: b899bcb0f84e3bc0a895649fd698c53c254fe0645a9248b906edecb8adee1aeef0831fe59d113db0046522316c2c50462dd7fd3fa7ee5ef58338e6dc98cbcec4
6
+ metadata.gz: 79fe4cd8653f9a09c3c2f6acc7da403e00d8a8e05b6fb6f488fb25a3c8fadfcbee00cc1ffa7e31319840025a5d622d2b1b6a32210ff0cd9141a04aef26c27e59
7
+ data.tar.gz: b691e62e093b3504d7e7da0501cda48aca9ae705429ed1d5caf97dd3ab7a9b7f87826a8d0cf4dabbff01e1f755d7cee555d74dee85754f7206feb5cadbfdd8f8
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Legion::Crypt
2
2
 
3
+ ## [1.4.15] - 2026-03-26
4
+
5
+ ### Fixed
6
+ - Route `get`, `write`, `read`, `delete`, `exist?` through default cluster client when multi-cluster Vault is configured (#1)
7
+ - Previously these methods used the global `::Vault` singleton which was never initialized when clusters were present, causing 403 errors against the wrong Vault server
8
+
3
9
  ## [1.4.14] - 2026-03-26
4
10
 
5
11
  ### Fixed
data/CLAUDE.md CHANGED
@@ -8,7 +8,7 @@
8
8
  Handles encryption, decryption, secrets management, JWT token management, and HashiCorp Vault connectivity for the LegionIO framework. Provides AES-256-CBC message encryption, RSA key pair generation, cluster secret management, JWT issue/verify operations, and Vault token lifecycle management.
9
9
 
10
10
  **GitHub**: https://github.com/LegionIO/legion-crypt
11
- **Version**: 1.4.7
11
+ **Version**: 1.4.15
12
12
  **License**: Apache-2.0
13
13
 
14
14
  ## Architecture
@@ -45,7 +45,7 @@ module Legion
45
45
  def read(path, type = 'legion')
46
46
  full_path = type.nil? || type.empty? ? "#{type}/#{path}" : path
47
47
  Legion::Logging.debug "Vault read: #{full_path}" if defined?(Legion::Logging)
48
- lease = ::Vault.logical.read(full_path)
48
+ lease = logical_client.read(full_path)
49
49
  add_session(path: lease.lease_id) if lease.respond_to? :lease_id
50
50
  lease.data
51
51
  rescue StandardError => e
@@ -55,7 +55,7 @@ module Legion
55
55
 
56
56
  def get(path)
57
57
  Legion::Logging.debug "Vault kv get: #{path}" if defined?(Legion::Logging)
58
- result = ::Vault.kv(settings[:vault][:kv_path]).read(path)
58
+ result = kv_client.read(path)
59
59
  return nil if result.nil?
60
60
 
61
61
  result.data
@@ -66,14 +66,14 @@ module Legion
66
66
 
67
67
  def write(path, **hash)
68
68
  Legion::Logging.debug "Vault kv write: #{path}" if defined?(Legion::Logging)
69
- ::Vault.kv(settings[:vault][:kv_path]).write(path, **hash)
69
+ kv_client.write(path, **hash)
70
70
  rescue StandardError => e
71
71
  Legion::Logging.warn "Vault kv write failed at #{path}: #{e.message}" if defined?(Legion::Logging)
72
72
  raise
73
73
  end
74
74
 
75
75
  def delete(path)
76
- ::Vault.logical.delete(path)
76
+ logical_client.delete(path)
77
77
  { success: true, path: path }
78
78
  rescue StandardError => e
79
79
  Legion::Logging.warn "Vault delete failed for #{path}: #{e.message}" if defined?(Legion::Logging)
@@ -81,7 +81,7 @@ module Legion
81
81
  end
82
82
 
83
83
  def exist?(path)
84
- !::Vault.kv(settings[:vault][:kv_path]).read_metadata(path).nil?
84
+ !kv_client.read_metadata(path).nil?
85
85
  end
86
86
 
87
87
  def add_session(path:)
@@ -140,6 +140,24 @@ module Legion
140
140
  def vault_exists?(name)
141
141
  ::Vault.sys.mounts.key?(name.to_sym)
142
142
  end
143
+
144
+ private
145
+
146
+ def kv_client
147
+ if respond_to?(:connected_clusters) && connected_clusters.any?
148
+ vault_client.kv(settings[:vault][:kv_path])
149
+ else
150
+ ::Vault.kv(settings[:vault][:kv_path])
151
+ end
152
+ end
153
+
154
+ def logical_client
155
+ if respond_to?(:connected_clusters) && connected_clusters.any?
156
+ vault_client.logical
157
+ else
158
+ ::Vault.logical
159
+ end
160
+ end
143
161
  end
144
162
  end
145
163
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Legion
4
4
  module Crypt
5
- VERSION = '1.4.14'
5
+ VERSION = '1.4.15'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: legion-crypt
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.14
4
+ version: 1.4.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esity