signchain_db

package
v0.0.0-...-3a41573 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FOUNDATION_CREATE     SignOP   = "foundation_create"
	PACKAGE_IMPORT        SignOP   = "package_import"
	LICENSE_CREATE        SignOP   = "license_create"
	LICENSE_APPEND        SignOP   = "license_append"
	LICENSE_REVERT        SignOP   = "license_revert"
	LICENSE_OVERWRITE     SignOP   = "license_overwrite"
	LICENSE_WATCH_DOG     SignOP   = "license_watchdog"
	LICENSE_MANAGE_TYPE   SignType = "license_manage_type"
	LICENSE_GUARD_TYPE    SignType = "license_guard_type"
	BLOCK_FOUNDATION_TYPE SignType = "block_foundation_type"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ParentBlock

type ParentBlock struct {
	SignedAt time.Time `json:"signed_at"`
	UUID     string    `json:"uuid"`
	SignType SignType  `json:"sign_type"`
	SignOP   SignOP    `json:"sign_op"`
}

func (*ParentBlock) Scan

func (m *ParentBlock) Scan(value interface{}) error

func (ParentBlock) Value

func (m ParentBlock) Value() (driver.Value, error)

type SignChain

type SignChain struct {
	Max     int              `json:"max"`      //可追溯的最大数
	BeginAt time.Time        `json:"begin_at"` //可追溯到的时间
	Blocks  []SignChainBlock `json:"blocks"`   //SignChainBlock
}

func (*SignChain) AppendPackageBlock

func (c *SignChain) AppendPackageBlock(deadLine time.Time, extra string, db *gorm.DB, alg encrypt.EncryptAlg) error

func (*SignChain) Load

func (c *SignChain) Load(tx *gorm.DB) error

func (*SignChain) Verify

func (c *SignChain) Verify(alg encrypt.EncryptAlg) error

type SignChainBlock

type SignChainBlock struct {
	gorm.Model
	BlockName      string      `json:"block_name"`
	SignedAt       time.Time   `json:"signed_at"`                     //签名时间
	UUID           string      `gorm:"unique" json:"uuid"`            //签名的唯一uuid
	Parent         ParentBlock `gorm:"type:JSON" json:"parent"`       //父Block信息
	SignType       SignType    `json:"sign_type"`                     //签名的类型
	Content        SignContent `gorm:"type:JSON" json:"sign_content"` //签名内容,其它非共性的, 都放到这个字段下面
	SignOP         SignOP      `json:"sign_op"`                       //签名行为
	SignTotalCnt   int         `json:"sign_total"`                    //当前所有授权的数量
	SignTotalMonth int         `json:"sign_total_month"`              //当前所有授权的总时间, 以月为单位
	UsedTotalMonth int         `json:"used_total_month"`              //已经使用的所有授权的总时间, 以月为单位
	Signature      string      `json:"signature"`                     //签名
	LMSRequestSign string      `json:"lmsrequest_sign"`               //lms服务向signer申请授权的签名
}

func FoundationBlock

func FoundationBlock(alg encrypt.EncryptAlg) SignChainBlock

func (*SignChainBlock) Sign

func (b *SignChainBlock) Sign(alg encrypt.EncryptAlg) error

func (SignChainBlock) TableName

func (b SignChainBlock) TableName() string

func (*SignChainBlock) Verify

func (b *SignChainBlock) Verify(alg encrypt.EncryptAlg) error

func (*SignChainBlock) VerifyParent

func (b *SignChainBlock) VerifyParent(parent SignChainBlock) error

type SignContent

type SignContent struct {
	ServiceBornedAt  time.Time `json:"service_borned_at"`  //服务授权导入时间
	ServiceExpiredAt time.Time `json:"service_expired_at"` //服务授权的过期时间
	Extra            string    `json:"extra"`              //一些额外信息序列化后存到这个字段
}

func (*SignContent) Scan

func (m *SignContent) Scan(value interface{}) error

func (SignContent) Value

func (m SignContent) Value() (driver.Value, error)

type SignOP

type SignOP string

func (*SignOP) Scan

func (m *SignOP) Scan(value interface{}) error

func (SignOP) Value

func (m SignOP) Value() (driver.Value, error)

type SignType

type SignType string

func (*SignType) Scan

func (m *SignType) Scan(value interface{}) error

func (SignType) Value

func (m SignType) Value() (driver.Value, error)

Jump to

Keyboard shortcuts

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