forked from hyperledger-archives/aries-framework-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprivKey_opts.go
36 lines (29 loc) · 1012 Bytes
/
privKey_opts.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
/*
Copyright SecureKey Technologies Inc. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package kms
// privateKeyOpts holds options for ImportPrivateKey.
type privateKeyOpts struct {
ksID string
}
// NewOpt creates a new empty private key option.
// Not to be used directly. It's intended for implementations of KeyManager interface
// Use WithKeyID() option function below instead.
func NewOpt() *privateKeyOpts { // nolint
return &privateKeyOpts{}
}
// KsID gets the KsID to be used for import a private key.
// Not to be used directly. It's intended for implementations of KeyManager interface
// Use WithKeyID() option function below instead.
func (pk *privateKeyOpts) KsID() string {
return pk.ksID
}
// PrivateKeyOpts are the import private key option.
type PrivateKeyOpts func(opts *privateKeyOpts)
// WithKeyID option is for importing a private key with a specified KeyID.
func WithKeyID(keyID string) PrivateKeyOpts {
return func(opts *privateKeyOpts) {
opts.ksID = keyID
}
}