github.com/trustbloc/kms-go@v1.1.2/spi/kms/privKey_opts.go (about) 1 /* 2 Copyright SecureKey Technologies Inc. All Rights Reserved. 3 4 SPDX-License-Identifier: Apache-2.0 5 */ 6 7 package kms 8 9 // privateKeyOpts holds options for ImportPrivateKey. 10 type privateKeyOpts struct { 11 ksID string 12 } 13 14 // NewOpt creates a new empty private key option. 15 // Not to be used directly. It's intended for implementations of KeyManager interface 16 // Use WithKeyID() option function below instead. 17 func NewOpt() *privateKeyOpts { // nolint 18 return &privateKeyOpts{} 19 } 20 21 // KsID gets the KsID to be used for import a private key. 22 // Not to be used directly. It's intended for implementations of KeyManager interface 23 // Use WithKeyID() option function below instead. 24 func (pk *privateKeyOpts) KsID() string { 25 return pk.ksID 26 } 27 28 // PrivateKeyOpts are the import private key option. 29 type PrivateKeyOpts func(opts *privateKeyOpts) 30 31 // WithKeyID option is for importing a private key with a specified KeyID. 32 func WithKeyID(keyID string) PrivateKeyOpts { 33 return func(opts *privateKeyOpts) { 34 opts.ksID = keyID 35 } 36 }