wallet

package
v1.9.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2022 License: MIT, Apache-2.0, MIT Imports: 27 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SupportedMsgTypes = map[types.MsgType]*Types{
	types.MTDealProposal: {reflect.TypeOf(market.DealProposal{}), func(i interface{}) ([]byte, error) {
		return cborutil.Dump(i)
	}, nil},
	types.MTClientDeal: {reflect.TypeOf(market.ClientDealProposal{}), func(in interface{}) ([]byte, error) {
		ni, err := cborutil.AsIpld(in)
		if err != nil {
			return nil, err
		}
		return ni.Cid().Bytes(), nil
	}, nil},
	types.MTDrawRandomParam: {reflect.TypeOf(types2.DrawRandomParams{}), func(in interface{}) ([]byte, error) {
		param := in.(*types2.DrawRandomParams)
		return param.SignBytes()
	}, nil},
	types.MTSignedVoucher: {reflect.TypeOf(paych.SignedVoucher{}), func(in interface{}) ([]byte, error) {
		return (in.(*paych.SignedVoucher)).SigningBytes()
	}, nil},
	types.MTStorageAsk: {reflect.TypeOf(storagemarket.StorageAsk{}), func(in interface{}) ([]byte, error) {
		return cborutil.Dump(in)
	}, nil},
	types.MTAskResponse: {Type: reflect.TypeOf(network.AskResponse{}), /* contains filtered or unexported fields */},
	types.MTNetWorkResponse: {reflect.TypeOf(network.Response{}), func(in interface{}) ([]byte, error) {
		return cborutil.Dump(in)
	}, nil},

	types.MTBlock: {reflect.TypeOf(types.BlockHeader{}), func(in interface{}) ([]byte, error) {
		return in.(*types.BlockHeader).SignatureData()
	}, nil},
	types.MTChainMsg: {reflect.TypeOf(types.Message{}), func(in interface{}) ([]byte, error) {
		msg := in.(*types.Message)
		return msg.Cid().Bytes(), nil
	}, nil},
	types.MTProviderDealState: {
		reflect.TypeOf(storagemarket.ProviderDealState{}), func(in interface{}) ([]byte, error) {
			return cborutil.Dump(in)
		}, nil,
	},

	types.MTUnknown: {reflect.TypeOf([]byte{}), func(in interface{}) ([]byte, error) {
		msg, isok := in.([]byte)
		if !isok {
			return nil, fmt.Errorf("MTUnkown must be []byte")
		}
		return msg, nil
	}, func(in []byte, meta types.MsgMeta) (interface{}, error) {
		if meta.Type == types.MTUnknown {
			return in, nil
		}
		return nil, fmt.Errorf("un-expected MsgType:%s", meta.Type)
	}},

	types.MTVerifyAddress: {
		Type: reflect.TypeOf([]byte{}),
		// contains filtered or unexported fields
	},
}

SupportedMsgTypes signature type factory

Functions

func GetSignBytes added in v1.9.0

func GetSignBytes(toSign []byte, meta types.MsgMeta) (interface{}, []byte, error)

GetSignBytes Matches the type and returns the data that needs to be signed

func RegisterSupportedMsgTypes added in v1.9.0

func RegisterSupportedMsgTypes(msgType types.MsgType, p reflect.Type,
	fGetSignBytes FGetSignBytes, fParseObj FParseObj,
) (replaced bool)

Types

type FGetSignBytes added in v1.9.0

type FGetSignBytes func(in interface{}) ([]byte, error)

type FParseObj added in v1.9.0

type FParseObj func([]byte, types.MsgMeta) (interface{}, error)

type GetPwdFunc added in v1.2.0

type GetPwdFunc func() string

type ISignMsgFilter added in v1.9.0

type ISignMsgFilter interface {
	CheckSignMsg(ctx context.Context, signMsg SignMsg) error
}

type SignFilter added in v1.9.0

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

func NewSignFilter added in v1.9.0

func NewSignFilter(cfg *config.SignFilter) *SignFilter

func (*SignFilter) CheckSignMsg added in v1.9.0

func (filter *SignFilter) CheckSignMsg(ctx context.Context, signMsg SignMsg) error

type SignMsg added in v1.9.0

type SignMsg struct {
	SignType types.MsgType
	Data     interface{}
}

type Types added in v1.9.0

type Types struct {
	Type reflect.Type
	// contains filtered or unexported fields
}

Types Abstract data types to be signed

Jump to

Keyboard shortcuts

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