agentlink

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package agentlink is the server side of the phone link: the two-line handshake and the encrypted session (PROTOCOL.md 4.4-4.5).

Index

Constants

View Source
const (
	Proto = 1
)

Variables

This section is empty.

Functions

func Decode

func Decode(b []byte) (map[string]any, error)

Decode parses one JSON object keeping numbers as json.Number.

func Str

func Str(m map[string]any, k string) string

func Uint

func Uint(m map[string]any, k string) uint64

Types

type Accepted

type Accepted struct {
	Session  *Session
	Mode     string
	PhonePub string
	TID      string
	SAS      string
	Hello    Hello
}

func Accept

func Accept(conn wire.LineConn, auth Authority) (*Accepted, error)

Accept runs the handshake on a fresh link and reads the phone's hello.

type Authority

type Authority interface {
	ServerID() string
	StaticKey() *ecdh.PrivateKey
	DevicePub(device string) (*ecdh.PublicKey, bool)
	EnrollToken(tid string) ([]byte, bool)
	CodePairingOpen() bool
}

Authority answers the questions the handshake needs about paired devices.

type Hello

type Hello struct {
	Device       string          `json:"device"`
	Boot         string          `json:"boot"`
	Model        string          `json:"model"`
	Manufacturer string          `json:"manufacturer"`
	SDK          int             `json:"sdk"`
	Release      string          `json:"release"`
	Agent        string          `json:"agent"`
	Route        string          `json:"route"`
	Lang         string          `json:"lang"`
	Ready        map[string]bool `json:"ready"`
}

type Session

type Session struct {
	DeviceID string
	// contains filtered or unexported fields
}

Session is an authenticated, encrypted link to one phone.

func NewClientSession

func NewClientSession(conn wire.LineConn, keys *dlcrypto.SessionKeys) (*Session, error)

NewClientSession builds the phone side of a session; used by the simulator.

func (*Session) Close

func (s *Session) Close()

func (*Session) Done

func (s *Session) Done() <-chan struct{}

func (*Session) Recv

func (s *Session) Recv() (map[string]any, error)

Recv returns the next decrypted message. Numbers stay json.Number so they round-trip to clients unchanged. Only one goroutine may call Recv.

func (*Session) RemoteAddr

func (s *Session) RemoteAddr() string

func (*Session) Send

func (s *Session) Send(msg any) error

Send encrypts one message, splitting the blob when it exceeds 512 KiB.

func (*Session) Transport

func (s *Session) Transport() string

Jump to

Keyboard shortcuts

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