-
Notifications
You must be signed in to change notification settings - Fork 2
/
signer_gen.go
40 lines (36 loc) · 1.02 KB
/
signer_gen.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
40
package gcpsigner
import "context"
// WithCache specifies the cache storage for frequently used items.
// Currently only the public key is cached.
//
// If it is not specified, nothing will be cached.
//
// Since it would be rather easy for the key in AWS KMS and the cache
// to be out of sync, make sure to either purge the cache periodically
// or use a cache with some sort of auto-eviction mechanism.
func (cs *Signer) WithCache(v Cache) *Signer {
return &Signer{
client: cs.client,
cache: v,
ctx: cs.ctx,
name: cs.name,
}
}
// WithContext associates a new context.Context with the object, which will be used for Sign() and Public()
func (cs *Signer) WithContext(v context.Context) *Signer {
return &Signer{
client: cs.client,
cache: cs.cache,
ctx: v,
name: cs.name,
}
}
// WithName associates a new string with the object, which will be used for Sign() and Public()
func (cs *Signer) WithName(v string) *Signer {
return &Signer{
client: cs.client,
cache: cs.cache,
ctx: cs.ctx,
name: v,
}
}