...
1 package sagoodkey
2
3 import (
4 "context"
5
6 "github.com/letsencrypt/boulder/goodkey"
7 sapb "github.com/letsencrypt/boulder/sa/proto"
8 "google.golang.org/grpc"
9 )
10
11
12
13
14 type BlockedKeyCheckFunc func(context.Context, *sapb.KeyBlockedRequest, ...grpc.CallOption) (*sapb.Exists, error)
15
16
17
18 func NewKeyPolicy(config *goodkey.Config, bkc BlockedKeyCheckFunc) (goodkey.KeyPolicy, error) {
19 var genericCheck goodkey.BlockedKeyCheckFunc
20 if bkc != nil {
21 genericCheck = func(ctx context.Context, keyHash []byte) (bool, error) {
22 exists, err := bkc(ctx, &sapb.KeyBlockedRequest{KeyHash: keyHash})
23 if err != nil {
24 return false, err
25 }
26 return exists.Exists, nil
27 }
28 }
29
30 return goodkey.NewKeyPolicy(config, genericCheck)
31 }
32
View as plain text