kt

package
v1.0.4-0...-dc1bf15 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KnotType    Type    = "HOTU.KNOT"
	KnotVersion Version = DefaultVersion
)

Variables

This section is empty.

Functions

func InvariableMarshal

func InvariableMarshal(inv Invariable) ([]byte, *errors.Error)

func InvariableSign

func InvariableSign(inv Invariable, pri ki.PRI) *errors.Error

func InvariableVerify

func InvariableVerify(inv Invariable) *errors.Error

Types

type Chain

type Chain string

func CoinChain

func CoinChain(vnID vn.ID) Chain

func SPChain

func SPChain(vnID vn.ID) Chain

func VNChain

func VNChain() Chain

func YinChain

func YinChain(vnID vn.ID, yin yn.Code) Chain

func (Chain) S

func (c Chain) S() string

func (Chain) Verify

func (c Chain) Verify() *errors.Error

type Height

type Height uint64
const (
	GenesisHeight Height = 0
)

func (Height) Next

func (h Height) Next() Height

func (Height) Previous

func (h Height) Previous() Height

func (Height) S

func (h Height) S() string

type IRope

type IRope interface {
	GetChain() Chain
	GetHeight() Height
	GetTail() KID
}

type Invariable

type Invariable interface {
	GetType() Type
	GetVersion() Version
	GetVN() vn.ID
	GetSignature() *Signature
	SetSignature(signature *Signature)
	Signing() *Signing
}

type KID

type KID = bid.BID

type Knot

type Knot struct {
	Type       Type       `json:"t"`
	Version    Version    `json:"v"`
	Vn         vn.ID      `json:"vn"`
	Chain      Chain      `json:"c"`
	Height     Height     `json:"h"`
	Invariable *Lead      `json:"i"`
	Previous   KID        `json:"p"`
	Signature  *Signature `json:"s"`
}

func (*Knot) GetSignature

func (k *Knot) GetSignature() *Signature

func (*Knot) GetType

func (k *Knot) GetType() Type

func (*Knot) GetVN

func (k *Knot) GetVN() vn.ID

func (*Knot) GetVersion

func (k *Knot) GetVersion() Version

func (*Knot) Sign

func (k *Knot) Sign(signature *Signature)

func (*Knot) Signing

func (k *Knot) Signing() *Signing

type Lead

type Lead struct {
	Type       Type    `json:"t"`
	Version    Version `json:"v"`
	Invariable bid.BID `json:"f"`
}

func (*Lead) S

func (l *Lead) S() string

type Nonce

type Nonce uint64

func NewNonce

func NewNonce() Nonce

func (Nonce) S

func (n Nonce) S() string

type Signature

type Signature struct {
	Nonce     Nonce     `json:"nonce"`
	Timestamp Timestamp `json:"timestamp"`
	Signer    ki.ADR    `json:"signer"`
	Pub       ki.PUB    `json:"pub"`
	Hash      string    `json:"hash"`
	Signature []byte    `json:"signature"`
}

func NewSignature

func NewSignature() *Signature

type Signing

type Signing struct {
	// contains filtered or unexported fields
}

func NewSigning

func NewSigning() *Signing

func (*Signing) Add

func (b *Signing) Add(key string, val string) *Signing

type Template

type Template struct {
	Type      Type       `json:"t"`
	Version   Version    `json:"v"`
	Vn        vn.ID      `json:"vn"`
	Signature *Signature `json:"s"`
}

func InvariableOf

func InvariableOf(data []byte) (*Template, *errors.Error)

func (*Template) GetSignature

func (t *Template) GetSignature() *Signature

func (*Template) GetType

func (t *Template) GetType() Type

func (*Template) GetVN

func (t *Template) GetVN() vn.ID

func (*Template) GetVersion

func (t *Template) GetVersion() Version

func (*Template) SetSignature

func (t *Template) SetSignature(signature *Signature)

func (*Template) Signing

func (t *Template) Signing() *Signing

type Timestamp

type Timestamp uint64

func NewTimestamp

func NewTimestamp() Timestamp

func (Timestamp) S

func (t Timestamp) S() string

func (Timestamp) Time

func (t Timestamp) Time() time.Time

type Type

type Type string

func (Type) S

func (t Type) S() string

func (Type) Verify

func (t Type) Verify() *errors.Error

type Version

type Version uint64
const (
	DefaultVersion Version = 1
)

func (Version) S

func (v Version) S() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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