htlc

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetOwnerAuditInfo

func GetOwnerAuditInfo(raw []byte, s AuditInfoProvider) ([]byte, error)

GetOwnerAuditInfo returns the audit info of the owner

func GetScriptSenderAndRecipient

func GetScriptSenderAndRecipient(ro *identity.RawOwner) (sender, recipient view.Identity, err error)

GetScriptSenderAndRecipient returns the script's sender and recipient according to the type of the given owner

func MetadataClaimKeyCheck

func MetadataClaimKeyCheck(action Action, script *htlc.Script, op OperationType, sig []byte) (string, error)

MetadataClaimKeyCheck checks that the claim key is in place

func MetadataLockKeyCheck

func MetadataLockKeyCheck(action Action, script *htlc.Script) (string, error)

MetadataLockKeyCheck checks that the lock key is in place

Types

type Action

type Action interface {
	GetMetadata() map[string][]byte
}

type AuditInfoProvider

type AuditInfoProvider interface {
	GetAuditInfo(identity view.Identity) ([]byte, error)
}

type Deserializer

type Deserializer struct {
	OwnerDeserializer VerifierDES
}

func NewDeserializer

func NewDeserializer(ownerDeserializer VerifierDES) *Deserializer

func (*Deserializer) DeserializeVerifier

func (d *Deserializer) DeserializeVerifier(id view.Identity) (driver.Verifier, error)

type OperationType

type OperationType int
const (
	None OperationType = iota
	Claim
	Reclaim
)

func VerifyOwner

func VerifyOwner(senderRawOwner []byte, outRawOwner []byte, now time.Time) (*htlc.Script, OperationType, error)

VerifyOwner validates the owners of the transfer in the htlc script

type ScriptInfo

type ScriptInfo struct {
	Sender    []byte
	Recipient []byte
}

ScriptInfo includes info about the sender and the recipient

func (*ScriptInfo) Marshal

func (si *ScriptInfo) Marshal() ([]byte, error)

func (*ScriptInfo) Unarshal

func (si *ScriptInfo) Unarshal(raw []byte) error

type VerifierDES

type VerifierDES interface {
	DeserializeVerifier(id view.Identity) (driver.Verifier, error)
}

Jump to

Keyboard shortcuts

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