forked from jwx-go/crypto-signer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathecdsa_gen.go
58 lines (52 loc) · 1.42 KB
/
ecdsa_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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package awssigner
import (
"context"
"github.com/aws/aws-sdk-go-v2/service/kms/types"
)
// WithAlgorithm associates a new types.SigningAlgorithmSpec with the object, which will be used for Sign() and Public()
func (cs *ECDSA) WithAlgorithm(v types.SigningAlgorithmSpec) *ECDSA {
return &ECDSA{
client: cs.client,
alg: v,
cache: cs.cache,
ctx: cs.ctx,
kid: cs.kid,
}
}
// 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 *ECDSA) WithCache(v Cache) *ECDSA {
return &ECDSA{
client: cs.client,
alg: cs.alg,
cache: v,
ctx: cs.ctx,
kid: cs.kid,
}
}
// WithContext associates a new context.Context with the object, which will be used for Sign() and Public()
func (cs *ECDSA) WithContext(v context.Context) *ECDSA {
return &ECDSA{
client: cs.client,
alg: cs.alg,
cache: cs.cache,
ctx: v,
kid: cs.kid,
}
}
// WithKeyID associates a new string with the object, which will be used for Sign() and Public()
func (cs *ECDSA) WithKeyID(v string) *ECDSA {
return &ECDSA{
client: cs.client,
alg: cs.alg,
cache: cs.cache,
ctx: cs.ctx,
kid: v,
}
}