forked from hashicorp/vault
/
seal_access.go
39 lines (31 loc) · 899 Bytes
/
seal_access.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package vault
// SealAccess is a wrapper around Seal that exposes accessor methods
// through Core.SealAccess() while restricting the ability to modify
// Core.seal itself.
type SealAccess struct {
seal Seal
}
func NewSealAccess(seal Seal) *SealAccess {
return &SealAccess{seal: seal}
}
func (s *SealAccess) StoredKeysSupported() bool {
return s.seal.StoredKeysSupported()
}
func (s *SealAccess) BarrierConfig() (*SealConfig, error) {
return s.seal.BarrierConfig()
}
func (s *SealAccess) RecoveryKeySupported() bool {
return s.seal.RecoveryKeySupported()
}
func (s *SealAccess) RecoveryConfig() (*SealConfig, error) {
return s.seal.RecoveryConfig()
}
func (s *SealAccess) VerifyRecoveryKey(key []byte) error {
return s.seal.VerifyRecoveryKey(key)
}
func (s *SealAccess) ClearCaches() {
s.seal.SetBarrierConfig(nil)
if s.RecoveryKeySupported() {
s.seal.SetRecoveryConfig(nil)
}
}