{"modulePath":"github.com/eric-erki/https-hyperledger.org","version":"v1.4.4","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package crypto\n\n## Constants\n\n```go\nconst (\n\t// NonceSize is the default NonceSize\n\tNonceSize = 24\n)\n```\n\n## Functions\n\n```go\nfunc ExpiresAt(identityBytes []byte) time.Time\n```\nExpiresAt returns when the given identity expires, or a zero time.Time in case we cannot determine that\n\n```go\nfunc GetRandomBytes(len int) ([]byte, error)\n```\nGetRandomBytes returns len random looking bytes\n\n```go\nfunc GetRandomNonce() ([]byte, error)\n```\nGetRandomNonce returns a random byte array of length NonceSize\n\n```go\nfunc TrackExpiration(tls bool, serverCert []byte, clientCertChain [][]byte, sIDBytes []byte, warn WarnFunc, now time.Time, s Scheduler)\n```\nTrackExpiration warns a week before one of the certificates expires\n\n## Types\n\n```go\ntype IdentitySerializer interface {\n\t// Serialize converts an identity to bytes\n\tSerialize() ([]byte, error)\n}\n```\nIdentitySerializer serializes identities\n\n```go\ntype LocalSigner interface {\n\tSignatureHeaderMaker\n\tSigner\n}\n```\nLocalSigner is a temporary stub interface which will be implemented by the local MSP\n\n```go\ntype Scheduler func(d time.Duration, f func()) *time.Timer\n```\nScheduler invokes f after d time, and can be replaced with time.AfterFunc.\n\n```go\ntype SignatureHeaderCreator struct {\n\tSignerSupport\n}\n```\nSignatureHeaderCreator creates signature headers\n\n```go\nfunc NewSignatureHeaderCreator(ss SignerSupport) *SignatureHeaderCreator\n```\nNewSignatureHeaderCreator creates new signature headers\n\n```go\nfunc (bs *SignatureHeaderCreator) NewSignatureHeader() (*cb.SignatureHeader, error)\n```\nNewSignatureHeader creates a SignatureHeader with the correct signing identity and a valid nonce\n\n```go\ntype SignatureHeaderMaker interface {\n\t// NewSignatureHeader creates a SignatureHeader with the correct signing identity and a valid nonce\n\tNewSignatureHeader() (*cb.SignatureHeader, error)\n}\n```\nSignatureHeaderMaker creates a new SignatureHeader\n\n```go\ntype Signer interface {\n\t// Sign a message and return the signature over the digest, or error on failure\n\tSign(message []byte) ([]byte, error)\n}\n```\nSigner signs messages\n\n```go\ntype SignerSupport interface {\n\tSigner\n\tIdentitySerializer\n}\n```\nSignerSupport implements the needed support for LocalSigner\n\n```go\ntype WarnFunc func(format string, args ...interface{})\n```\nWarnFunc notifies a warning happened with the given format, and can be replaced with Warnf of a logger.\n\n","path":"github.com/eric-erki/https-hyperledger.org/common/crypto","name":"crypto","synopsis":"","isRedistributable":true}
