seal

package
v0.0.0-...-5a6e01e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 19, 2023 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package seal is the basic form of message.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsValidSeal

func IsValidSeal(seal Seal, networkID []byte) error

func LogEventSeal

func LogEventSeal(sl Seal, key string, e *zerolog.Event, isTrace bool) *zerolog.Event

Types

type BaseSeal

type BaseSeal struct {
	hint.BaseHinter

	GenerateBodyHashFunc func() (valuehash.Hash, error)
	// contains filtered or unexported fields
}

func NewBaseSealWithHint

func NewBaseSealWithHint(ht hint.Hint) BaseSeal

func (BaseSeal) BSONPacker

func (sl BaseSeal) BSONPacker() map[string]interface{}

func (BaseSeal) BodyBytes

func (sl BaseSeal) BodyBytes() []byte

func (BaseSeal) BodyHash

func (sl BaseSeal) BodyHash() valuehash.Hash

func (BaseSeal) GenerateBodyHash

func (sl BaseSeal) GenerateBodyHash() (valuehash.Hash, error)

func (BaseSeal) GenerateHash

func (sl BaseSeal) GenerateHash() valuehash.Hash

func (BaseSeal) Hash

func (sl BaseSeal) Hash() valuehash.Hash

func (BaseSeal) IsValid

func (sl BaseSeal) IsValid(networkID []byte) error

func (BaseSeal) JSONPacker

func (sl BaseSeal) JSONPacker() *BaseSealJSONPack

func (*BaseSeal) Sign

func (sl *BaseSeal) Sign(pk key.Privatekey, b []byte) error

func (*BaseSeal) SignWithTime

func (sl *BaseSeal) SignWithTime(pk key.Privatekey, networkID []byte, t time.Time) error

func (BaseSeal) Signature

func (sl BaseSeal) Signature() key.Signature

func (BaseSeal) SignedAt

func (sl BaseSeal) SignedAt() time.Time

func (BaseSeal) Signer

func (sl BaseSeal) Signer() key.Publickey

func (*BaseSeal) UnpackBSON

func (sl *BaseSeal) UnpackBSON(b []byte, enc *bsonenc.Encoder) error

func (*BaseSeal) UnpackJSON

func (sl *BaseSeal) UnpackJSON(b []byte, enc *jsonenc.Encoder) error

type BaseSealBSONUnpack

type BaseSealBSONUnpack struct {
	HH valuehash.Bytes      `bson:"hash"`
	BH valuehash.Bytes      `bson:"body_hash"`
	SN key.PublickeyDecoder `bson:"signer"`
	SG key.Signature        `bson:"signature"`
	SA time.Time            `bson:"signed_at"`
}

type BaseSealJSONPack

type BaseSealJSONPack struct {
	jsonenc.HintedHead
	HH valuehash.Hash `json:"hash"`
	BH valuehash.Hash `json:"body_hash"`
	SN key.Publickey  `json:"signer"`
	SG key.Signature  `json:"signature"`
	SA localtime.Time `json:"signed_at"`
}

type BaseSealJSONUnpack

type BaseSealJSONUnpack struct {
	HH valuehash.Bytes      `json:"hash"`
	BH valuehash.Bytes      `json:"body_hash"`
	SN key.PublickeyDecoder `json:"signer"`
	SG key.Signature        `json:"signature"`
	SA localtime.Time       `json:"signed_at"`
}

type DummySeal

type DummySeal struct {
	PK        key.Publickey
	H         valuehash.Hash
	BH        valuehash.Hash
	S         string
	CreatedAt time.Time
}

func NewDummySeal

func NewDummySeal(pk key.Publickey) DummySeal

func (DummySeal) BodyHash

func (ds DummySeal) BodyHash() valuehash.Hash

func (DummySeal) GenerateBodyHash

func (ds DummySeal) GenerateBodyHash() (valuehash.Hash, error)

func (DummySeal) GenerateHash

func (ds DummySeal) GenerateHash() valuehash.Hash

func (DummySeal) Hash

func (ds DummySeal) Hash() valuehash.Hash

func (DummySeal) Hint

func (ds DummySeal) Hint() hint.Hint

func (DummySeal) IsValid

func (ds DummySeal) IsValid([]byte) error

func (DummySeal) MarshalBSON

func (ds DummySeal) MarshalBSON() ([]byte, error)

func (DummySeal) MarshalJSON

func (ds DummySeal) MarshalJSON() ([]byte, error)

func (DummySeal) Signature

func (ds DummySeal) Signature() key.Signature

func (DummySeal) SignedAt

func (ds DummySeal) SignedAt() time.Time

func (DummySeal) Signer

func (ds DummySeal) Signer() key.Publickey

func (*DummySeal) UnmarshalBSON

func (ds *DummySeal) UnmarshalBSON(b []byte) error

func (*DummySeal) UnmarshalJSON

func (ds *DummySeal) UnmarshalJSON(b []byte) error

type DummySealBSONUnpacker

type DummySealBSONUnpacker struct {
	PK        key.PublickeyDecoder
	H         valuehash.Bytes
	BH        valuehash.Bytes
	S         string
	CreatedAt time.Time
}

type DummySealJSONPacker

type DummySealJSONPacker struct {
	jsonenc.HintedHead
	PK        key.Publickey
	H         valuehash.Hash
	BH        valuehash.Hash
	S         string
	CreatedAt localtime.Time
}

type DummySealJSONUnpacker

type DummySealJSONUnpacker struct {
	jsonenc.HintedHead
	PK        key.PublickeyDecoder
	H         valuehash.Bytes
	BH        valuehash.Bytes
	S         string
	CreatedAt localtime.Time
}

type Seal

type Seal interface {
	isvalid.IsValider
	hint.Hinter
	valuehash.HashGenerator                    // geneate new hash of seal
	Hash() valuehash.Hash                      // hash of seal
	BodyHash() valuehash.Hash                  // hash of seal body
	GenerateBodyHash() (valuehash.Hash, error) // geneate new hash of seal body
	Signer() key.Publickey                     // signer's PublicKey
	Signature() key.Signature                  // Signature, signed by key
	SignedAt() time.Time                       // signed(or created) time
}

Seal is the container of SealBody.

type Signer

type Signer interface {
	Sign(key.Privatekey, []byte) error
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL