htlc

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetScriptSenderAndRecipient

func GetScriptSenderAndRecipient(ro *identity.TypedIdentity) (sender, recipient driver.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 AuditDeserializer

type AuditDeserializer struct {
	AuditInfoDeserializer driver2.AuditInfoDeserializer
}

func NewAuditDeserializer

func NewAuditDeserializer(auditInfoDeserializer driver2.AuditInfoDeserializer) *AuditDeserializer

func (*AuditDeserializer) DeserializeAuditInfo

func (a *AuditDeserializer) DeserializeAuditInfo(bytes []byte) (driver2.AuditInfo, error)

type AuditInfoProvider

type AuditInfoProvider interface {
	GetAuditInfo(identity driver.Identity) ([]byte, 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) Unmarshal

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

type TypedIdentityDeserializer

type TypedIdentityDeserializer struct {
	VerifierDeserializer VerifierDES
}

func NewTypedIdentityDeserializer

func NewTypedIdentityDeserializer(verifierDeserializer VerifierDES) *TypedIdentityDeserializer

func (*TypedIdentityDeserializer) DeserializeVerifier

func (t *TypedIdentityDeserializer) DeserializeVerifier(typ string, raw []byte) (driver.Verifier, error)

func (*TypedIdentityDeserializer) GetOwnerAuditInfo

func (t *TypedIdentityDeserializer) GetOwnerAuditInfo(id driver.Identity, typ string, raw []byte, p driver.AuditInfoProvider) ([][]byte, error)

func (*TypedIdentityDeserializer) Recipients

func (t *TypedIdentityDeserializer) Recipients(id driver.Identity, typ string, raw []byte) ([]driver.Identity, error)

type VerifierDES

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

Jump to

Keyboard shortcuts

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