legion-crypt 1.4.8 → 1.4.10

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: f23263a49bc4e450c4c13189039e6a1324201fc31c074a59800569076c4baa40
4
- data.tar.gz: 7c7fddeb4adb4a6d6721dea856af301f69a6b6a4c124c28195c87cf3e5e04f82
3
+ metadata.gz: 14e4a34517eb19612bc6e2f1f07093f3e5d2affef6e04f48b5c8a1fb1bd06a74
4
+ data.tar.gz: 793e8657ba9d56a34a96362fb0777c7f22e1c63f8953ab00b562fa3e57e9e5a3
5
5
  SHA512:
6
- metadata.gz: fe700545e2fe3ec3166cf14e760655e84572c5283895057d9c5f114849e89d5e00f59b13de05769c350eea9deabc0caa3cba926d89ca9121f40787c75707583c
7
- data.tar.gz: 7b22b0a6ff01a262d44497e201c0f9fab260d5897e4be7af0a7a8c8d7a1e6c7c95ec9b422c9047ef5c6428a8ffb0ed9de066bda0d63849f45c9634eb2692ebc4
6
+ metadata.gz: e56636a54d3a9e6c615184361ca3242d7c17919c0235878cf43e8283858b2e261dc82ff02fa4777d57b2b619cd16f3c254e7aa5e453cf56cdcfca6156166c98d
7
+ data.tar.gz: e5f5b735f176da76b49438d1bd5b0a40a42b1087c288d5487edbcc3b0601466ca9f4d16fba257bda8cd2f84782102ab675d117c976567efab4dcaa493706343e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Legion::Crypt
2
2
 
3
+ ## [1.4.10] - 2026-03-24
4
+
5
+ ### Added
6
+ - `Legion::Crypt.delete(path)` for Vault KV path deletion (supports credential revocation on worker termination)
7
+
8
+ ## [1.4.9] - 2026-03-22
9
+
10
+ ### Added
11
+ - `Legion::Crypt::Helper` module: injectable Vault mixin for LEX extensions
12
+ - Namespaced `vault_get`, `vault_write`, `vault_exist?` with automatic lex-prefixed paths
13
+
3
14
  ## [1.4.8] - 2026-03-22
4
15
 
5
16
  ### Changed
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Legion
4
+ module Crypt
5
+ module Helper
6
+ def vault_namespace
7
+ @vault_namespace ||= derive_vault_namespace
8
+ end
9
+
10
+ def vault_get(path = nil)
11
+ Legion::Crypt.get(vault_path(path))
12
+ end
13
+
14
+ def vault_write(path, data)
15
+ Legion::Crypt.write(vault_path(path), data)
16
+ end
17
+
18
+ def vault_exist?(path = nil)
19
+ Legion::Crypt.exist?(vault_path(path))
20
+ end
21
+
22
+ private
23
+
24
+ def vault_path(suffix = nil)
25
+ base = vault_namespace
26
+ suffix ? "#{base}/#{suffix}" : base
27
+ end
28
+
29
+ def derive_vault_namespace
30
+ if respond_to?(:lex_filename)
31
+ fname = lex_filename
32
+ fname.is_a?(Array) ? fname.first : fname
33
+ else
34
+ derive_vault_namespace_from_class
35
+ end
36
+ end
37
+
38
+ def derive_vault_namespace_from_class
39
+ name = respond_to?(:ancestors) ? ancestors.first.to_s : self.class.to_s
40
+ parts = name.split('::')
41
+ ext_idx = parts.index('Extensions')
42
+ target = if ext_idx && parts[ext_idx + 1]
43
+ parts[ext_idx + 1]
44
+ else
45
+ parts.last
46
+ end
47
+ target.gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
48
+ .gsub(/([a-z\d])([A-Z])/, '\1_\2')
49
+ .downcase
50
+ end
51
+ end
52
+ end
53
+ end
@@ -76,6 +76,14 @@ module Legion
76
76
  raise
77
77
  end
78
78
 
79
+ def delete(path)
80
+ ::Vault.logical.delete(path)
81
+ { success: true, path: path }
82
+ rescue StandardError => e
83
+ Legion::Logging.warn "Vault delete failed for #{path}: #{e.message}" if defined?(Legion::Logging)
84
+ { success: false, path: path, error: e.message }
85
+ end
86
+
79
87
  def exist?(path)
80
88
  !::Vault.kv(settings[:vault][:kv_path]).read_metadata(path).nil?
81
89
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Legion
4
4
  module Crypt
5
- VERSION = '1.4.8'
5
+ VERSION = '1.4.10'
6
6
  end
7
7
  end
data/lib/legion/crypt.rb CHANGED
@@ -10,6 +10,7 @@ require 'legion/crypt/vault_jwt_auth'
10
10
  require 'legion/crypt/lease_manager'
11
11
  require 'legion/crypt/vault_cluster'
12
12
  require 'legion/crypt/ldap_auth'
13
+ require 'legion/crypt/helper'
13
14
 
14
15
  module Legion
15
16
  module Crypt
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.8
4
+ version: 1.4.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esity
@@ -77,6 +77,7 @@ files:
77
77
  - lib/legion/crypt/cluster_secret.rb
78
78
  - lib/legion/crypt/ed25519.rb
79
79
  - lib/legion/crypt/erasure.rb
80
+ - lib/legion/crypt/helper.rb
80
81
  - lib/legion/crypt/jwks_client.rb
81
82
  - lib/legion/crypt/jwt.rb
82
83
  - lib/legion/crypt/ldap_auth.rb