-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
dkgsign_key.go
38 lines (31 loc) · 985 Bytes
/
dkgsign_key.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
package presenters
import (
"github.com/manyminds/api2go/jsonapi"
"github.com/smartcontractkit/chainlink/core/services/keystore/keys/dkgsignkey"
)
// DKGSignKeyResource is just that.
type DKGSignKeyResource struct {
JAID
PublicKey string `json:"publicKey"`
}
var _ jsonapi.EntityNamer = DKGSignKeyResource{}
// GetName implements jsonapi.EntityNamer
func (DKGSignKeyResource) GetName() string {
return "encryptedDKGSignKeys"
}
// NewDKGSignKeyResource creates a new DKGSignKeyResource from the given DKG sign key.
func NewDKGSignKeyResource(key dkgsignkey.Key) *DKGSignKeyResource {
return &DKGSignKeyResource{
JAID: JAID{
ID: key.ID(),
},
PublicKey: key.PublicKeyString(),
}
}
// NewDKGSignKeyResources creates many DKGSignKeyResource objects from the given DKG sign keys.
func NewDKGSignKeyResources(keys []dkgsignkey.Key) (resources []DKGSignKeyResource) {
for _, key := range keys {
resources = append(resources, *NewDKGSignKeyResource(key))
}
return
}