const ( // NonceSize is the default NonceSize NonceSize = 24 )
func ExpiresAt(identityBytes []byte) time.Time
ExpiresAt returns when the given identity expires, or a zero time.Time in case we cannot determine that
func GetRandomBytes(len int) ([]byte, error)
GetRandomBytes returns len random looking bytes
func GetRandomNonce() ([]byte, error)
GetRandomNonce returns a random byte array of length NonceSize
func SanitizeIdentity(identity []byte) ([]byte, error)
func TrackExpiration(tls bool, serverCert []byte, clientCertChain [][]byte, sIDBytes []byte, warn WarnFunc, now time.Time, s Scheduler)
TrackExpiration warns a week before one of the certificates expires
IdentitySerializer serializes identities
type IdentitySerializer interface { // Serialize converts an identity to bytes Serialize() ([]byte, error) }
LocalSigner is a temporary stub interface which will be implemented by the local MSP
type LocalSigner interface { SignatureHeaderMaker Signer }
Scheduler invokes f after d time, and can be replaced with time.AfterFunc.
type Scheduler func(d time.Duration, f func()) *time.Timer
SignatureHeaderCreator creates signature headers
type SignatureHeaderCreator struct { SignerSupport }
func NewSignatureHeaderCreator(ss SignerSupport) *SignatureHeaderCreator
NewSignatureHeaderCreator creates new signature headers
func (bs *SignatureHeaderCreator) NewSignatureHeader() (*cb.SignatureHeader, error)
NewSignatureHeader creates a SignatureHeader with the correct signing identity and a valid nonce
SignatureHeaderMaker creates a new SignatureHeader
type SignatureHeaderMaker interface { // NewSignatureHeader creates a SignatureHeader with the correct signing identity and a valid nonce NewSignatureHeader() (*cb.SignatureHeader, error) }
Signer signs messages
type Signer interface { // Sign a message and return the signature over the digest, or error on failure Sign(message []byte) ([]byte, error) }
SignerSupport implements the needed support for LocalSigner
type SignerSupport interface { Signer IdentitySerializer }
WarnFunc notifies a warning happened with the given format, and can be replaced with Warnf of a logger.
type WarnFunc func(format string, args ...interface{})