github.com/trustbloc/kms-go@v1.1.2/wrapper/localsuite/params.go (about)

     1  /*
     2  Copyright Gen Digital Inc. All Rights Reserved.
     3  SPDX-License-Identifier: Apache-2.0
     4  */
     5  
     6  package localsuite
     7  
     8  import (
     9  	kmsapi "github.com/trustbloc/kms-go/spi/kms"
    10  )
    11  
    12  type signer interface {
    13  	Sign(msg []byte, kh interface{}) ([]byte, error)
    14  }
    15  
    16  type multiSigner interface {
    17  	signer
    18  	SignMulti(messages [][]byte, kh interface{}) ([]byte, error)
    19  }
    20  
    21  type verifier interface {
    22  	Verify(signature []byte, msg []byte, kh interface{}) error
    23  }
    24  
    25  type signerVerifier interface {
    26  	signer
    27  	verifier
    28  }
    29  
    30  type keyGetter interface {
    31  	Get(keyID string) (interface{}, error)
    32  }
    33  
    34  type keyHandleFetcher interface {
    35  	PubKeyBytesToHandle(pubKeyBytes []byte, keyType kmsapi.KeyType, opts ...kmsapi.KeyOpts) (interface{}, error)
    36  	ExportPubKeyBytes(keyID string) ([]byte, kmsapi.KeyType, error)
    37  	keyGetter
    38  }
    39  
    40  type keyCreator interface {
    41  	CreateAndExportPubKeyBytes(kt kmsapi.KeyType, opts ...kmsapi.KeyOpts) (string, []byte, error)
    42  }
    43  
    44  type keyManager interface {
    45  	keyCreator
    46  	keyHandleFetcher
    47  }
    48  
    49  type encDecrypter interface {
    50  	Encrypt(msg, aad []byte, kh interface{}) ([]byte, []byte, error)
    51  	Decrypt(cipher, aad, nonce []byte, kh interface{}) ([]byte, error)
    52  }
    53  
    54  type allCrypto interface {
    55  	multiSigner
    56  	verifier
    57  	encDecrypter
    58  }