/
kms.go
48 lines (37 loc) · 1.12 KB
/
kms.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
/*
Copyright SecureKey Technologies Inc. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
//go:generate mockgen -destination mocks/kms_mocks.go -self_package mocks -package mocks -source=kms.go -mock_names VCSKeyManager=MockVCSKeyManager
package kms
import (
"net/http"
"github.com/trustbloc/kms-go/doc/jose/jwk"
"github.com/trustbloc/kms-go/spi/kms"
"github.com/trustbloc/vcs/pkg/doc/vc"
vcsverifiable "github.com/trustbloc/vcs/pkg/doc/verifiable"
)
type Type string
const (
AWS Type = "aws"
Local Type = "local"
Web Type = "web"
)
// Config configure kms that stores signing keys.
type Config struct {
KMSType Type
Endpoint string
Region string
AliasPrefix string
HTTPClient *http.Client
SecretLockKeyPath string
DBType string
DBURL string
DBPrefix string
}
type VCSKeyManager interface {
SupportedKeyTypes() []kms.KeyType
CreateJWKKey(keyType kms.KeyType) (string, *jwk.JWK, error)
CreateCryptoKey(keyType kms.KeyType) (string, interface{}, error)
NewVCSigner(creator string, signatureType vcsverifiable.SignatureType) (vc.SignerAlgorithm, error)
}