bep44

package
v0.25.0 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UnmarshalMessage

func UnmarshalMessage(data []byte, b *Message) error

UnmarshalMessage decodes the given byte slice into a BEP44 message.

Types

type Message

type Message struct {

	// The sequence number of the message, used to ensure the latest version of the data is retrieved
	// and updated. It's a monotonically increasing number.
	Seq int64

	// The actual data being stored or retrieved from the DHT network, typically encoded in a format
	// suitable for DNS packet representation of a DID Document.
	V []byte
	// contains filtered or unexported fields
}

Message Represents a BEP44 message, which is used for storing and retrieving data in the Mainline DHT network.

A BEP44 message is used primarily in the context of the DID DHT method for publishing and resolving DID documents in the DHT network. This type encapsulates the data structure required for such operations in accordance with BEP44.

https://www.bittorrent.org/beps/bep_0044.html

func NewMessage

func NewMessage(dnsPayload []byte, seq int64, publicKeyBytes []byte, signer Signer) (*Message, error)

NewMessage bencodes the payload, signes it with the signer and creates a new BEP44 message with the given sequence number, public key.

func (*Message) Marshal

func (msg *Message) Marshal() ([]byte, error)

Marshal encodes the BEP44 message into a byte slice, conforming to the Pkarr relay specification.

type Signer

type Signer func(payload []byte) ([]byte, error)

Signer is a function that signs a given payload and returns the signature.

Jump to

Keyboard shortcuts

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