noise

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultApplicationName = "waku-noise-sessions"
View Source
const DefaultApplicationVersion = "0.1"
View Source
const DefaultShardID = "10"

Variables

View Source
var ErrPairingTimeout = errors.New("pairing has timed out")

Functions

func DecodePayloadV2

func DecodePayloadV2(message *pb.WakuMessage) (*n.PayloadV2, error)

DecodePayloadV2 decodes a WakuMessage to a PayloadV2 Currently, this is just a wrapper over deserializePayloadV2 and encryption/decryption is done on top (no KeyInfo)

func EncodePayloadV2

func EncodePayloadV2(payload2 *n.PayloadV2) (*pb.WakuMessage, error)

EncodePayloadV2 encodes a PayloadV2 to a WakuMessage Currently, this is just a wrapper over serializePayloadV2 and encryption/decryption is done on top (no KeyInfo)

Types

type NoiseMessenger

type NoiseMessenger interface {
	Sender
	Receiver
	Stop()
}

type NoiseWakuRelay

type NoiseWakuRelay struct {
	NoiseMessenger
	// contains filtered or unexported fields
}

func NewWakuRelayMessenger

func NewWakuRelayMessenger(ctx context.Context, r *relay.WakuRelay, pubsubTopic *string, timesource timesource.Timesource) (*NoiseWakuRelay, error)

func (*NoiseWakuRelay) Publish

func (r *NoiseWakuRelay) Publish(ctx context.Context, contentTopic string, payload *n.PayloadV2) error

func (*NoiseWakuRelay) Stop

func (r *NoiseWakuRelay) Stop()

func (*NoiseWakuRelay) Subscribe

func (r *NoiseWakuRelay) Subscribe(ctx context.Context, contentTopic string) <-chan *pb.WakuMessage

type Pairing

type Pairing struct {
	sync.RWMutex
	ContentTopic string
	// contains filtered or unexported fields
}

func NewPairing

func NewPairing(myStaticKey n.Keypair, myEphemeralKey n.Keypair, opts PairingParameterOption, messenger NoiseMessenger, logger *zap.Logger) (*Pairing, error)

func (*Pairing) AuthCode

func (p *Pairing) AuthCode() <-chan string

func (*Pairing) ConfirmAuthCode

func (p *Pairing) ConfirmAuthCode(confirmed bool) error

func (*Pairing) Decrypt

func (p *Pairing) Decrypt(msg *pb.WakuMessage) ([]byte, error)

func (*Pairing) Encrypt

func (p *Pairing) Encrypt(plaintext []byte) (*pb.WakuMessage, error)

Returns a WakuMessage with version 2 and encrypted payload

func (*Pairing) Execute

func (p *Pairing) Execute(ctx context.Context) error

func (*Pairing) HandshakeComplete

func (p *Pairing) HandshakeComplete() bool

func (*Pairing) PairingInfo

func (p *Pairing) PairingInfo() (qrString string, qrMessageNametag n.MessageNametag)

type PairingParameterOption

type PairingParameterOption func(*PairingParameters) error

func WithDefaultResponderParameters

func WithDefaultResponderParameters() PairingParameterOption

func WithInitiatorParameters

func WithInitiatorParameters(qrString string, qrMessageNametag n.MessageNametag) PairingParameterOption

func WithResponderParameters

func WithResponderParameters(applicationName, applicationVersion, shardID string, qrMessageNameTag *n.MessageNametag) PairingParameterOption

type PairingParameters

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

type QR

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

func NewQR

func NewQR(applicationName, applicationVersion, shardID string, ephemeralKey ed25519.PublicKey, committedStaticKey []byte) QR

func StringToQR

func StringToQR(qrString string) (QR, error)

StringToQR deserializes input string in base64 to the corresponding (applicationName, applicationVersion, shardId, ephemeralKey, committedStaticKey)

func (QR) Bytes

func (qr QR) Bytes() []byte

func (QR) String

func (qr QR) String() string

Serializes input parameters to a base64 string for exposure through QR code (used by WakuPairing)

type Receiver

type Receiver interface {
	// Subscribe will return a channel to obtain next message received in a content topic
	Subscribe(ctx context.Context, contentTopic string) <-chan *pb.WakuMessage
}

type Sender

type Sender interface {
	Publish(ctx context.Context, contentTopic string, payload *n.PayloadV2) error
}

Jump to

Keyboard shortcuts

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