File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ class Audit < Response
1919 end
2020
2121 class Sys
22- # List all audis for the vault.
22+ # List all audits for the vault.
2323 #
2424 # @example
2525 # Vault.sys.audits #=> { :file => #<Audit> }
@@ -70,5 +70,22 @@ def disable_audit(path)
7070 client . delete ( "/v1/sys/audit/#{ encode_path ( path ) } " )
7171 return true
7272 end
73+
74+ # Generates a HMAC verifier for a given input.
75+ #
76+ # @example
77+ # Vault.sys.audit_hash("file-audit", "my input") #=> "hmac-sha256:30aa7de18a5e90bbc1063db91e7c387b32b9fa895977eb8c177bbc91e7d7c542"
78+ #
79+ # @param [String] path
80+ # the path of the audit backend
81+ # @param [String] input
82+ # the input to generate a HMAC for
83+ #
84+ # @return [String]
85+ def audit_hash ( path , input )
86+ json = client . post ( "/v1/sys/audit-hash/#{ encode_path ( path ) } " , JSON . fast_generate ( input : input ) )
87+ json = json [ :data ] if json [ :data ]
88+ json [ :hash ]
89+ end
7390 end
7491end
You can’t perform that action at this time.
0 commit comments