Help us shape the future of Go! Take the 2026 Go Developer Survey

pairing

package
v0.57.10 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2026 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
const ProtocolID = protocol.ID("alpha/account-pairing/2")

ProtocolID identifies account enrollment on an authenticated connection.

Variables

View Source
var (
	ErrExchangeMissing      = errors.New("pairing exchange is missing")
	ErrExchangeUnconfirmed  = errors.New("account enrollment is not complete")
	ErrExchangePeerMismatch = errors.New("pairing exchange peer does not match")
)
View Source
var (
	AccountOutcome_name = map[int32]string{
		0: "AccountOutcome_UNSPECIFIED",
		1: "AccountOutcome_SIGN_IN_OFFERED",
		2: "AccountOutcome_SIGN_IN_RECEIVING",
		3: "AccountOutcome_MERGE_INTO_OFFERED",
		4: "AccountOutcome_MERGE_INTO_RECEIVING",
	}
	AccountOutcome_value = map[string]int32{
		"AccountOutcome_UNSPECIFIED":          0,
		"AccountOutcome_SIGN_IN_OFFERED":      1,
		"AccountOutcome_SIGN_IN_RECEIVING":    2,
		"AccountOutcome_MERGE_INTO_OFFERED":   3,
		"AccountOutcome_MERGE_INTO_RECEIVING": 4,
	}
)

Enum value maps for AccountOutcome.

Functions

func ApprovalContext

func ApprovalContext(offer *AccountOffer, identity *Identity, sourcePeer, receivingPeer peer.ID) (string, error)

ApprovalContext binds bilateral approval to both complete signed proofs.

func BindEnrolledLink(connection link.Link, offer *AccountOffer, identity *Identity, source, receiving peer.ID) (link.Link, error)

BindEnrolledLink authenticates the receiving Session on an existing encrypted pairing connection. The receiving key's signed proof binds it to both original transport peers and this exact account enrollment. Bilateral account approval and durable enrollment must precede handing the result to ordinary routing.

func DeriveSASEmoji

func DeriveSASEmoji(
	localPriv bifrost_crypto.PrivKey,
	remotePub bifrost_crypto.PubKey,
	localPeerID peer.ID,
	remotePeerID peer.ID,
) ([]string, error)

DeriveSASEmoji derives a 6-emoji SAS verification sequence from the local session's private key and the remote peer's public key. Both sides compute the same sequence if keys are authentic.

func IdentityContext

func IdentityContext(offer *AccountOffer, ref *session.SessionRef, sourcePeer, receivingPeer peer.ID) (string, error)

IdentityContext prevents a proof from authorizing another account, receiving reference, transport connection, or pairing attempt.

func ResolveCode

func ResolveCode(ctx context.Context, relay Relay, code string) (peer.ID, error)

ResolveCode consumes a code at the relay and returns the peer that registered it. The relay deletes the code, so a code resolves once.

func SameAccount

func SameAccount(left, right *AccountOffer) bool

SameAccount compares logical account identity within the configured provider. Storage participants and Session credentials can differ between replicas.

func SessionProviderID

func SessionProviderID(offer *AccountOffer) string

SessionProviderID returns the configured provider selected by an offer. Empty identifies local offers from the first account-enrollment protocol.

func ValidateIdentity

func ValidateIdentity(offer *AccountOffer, identity *Identity, sourcePeer, receivingPeer peer.ID) error

ValidateIdentity verifies both receiving key proofs before authorization.

Types

type AccountAdapter

type AccountAdapter interface {
	OfferPairingAccount(context.Context, crypto.PrivKey) (*AccountOffer, error)
	PreparePairingReceiver(context.Context, *AccountOffer, peer.ID, peer.ID) (*Receiver, error)
	EnrollPairingReceiver(context.Context, *stream_packet.Session, *Enrollment, crypto.PrivKey, peer.ID, peer.ID) error
}

AccountAdapter implements account enrollment through the responsible provider. Preparation may reserve local receiving keys; it cannot grant account access.

type AccountChoice

type AccountChoice struct {

	// OfferedAccount is the account selected by the code creator.
	OfferedAccount *AccountOffer `protobuf:"bytes,1,opt,name=offered_account,json=offeredAccount,proto3" json:"offeredAccount,omitempty"`
	// ReceivingAccount is absent when pairing from Home without a selected account.
	ReceivingAccount *AccountOffer `protobuf:"bytes,2,opt,name=receiving_account,json=receivingAccount,proto3" json:"receivingAccount,omitempty"`
	// Outcome is fixed before either client approves the operation.
	Outcome AccountOutcome `protobuf:"varint,3,opt,name=outcome,proto3" json:"outcome,omitempty"`
	// contains filtered or unexported fields
}

AccountChoice carries the two account identities and the selected relationship.

func (*AccountChoice) CloneMessageVT

func (m *AccountChoice) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*AccountChoice) CloneVT

func (m *AccountChoice) CloneVT() *AccountChoice

func (*AccountChoice) EqualMessageVT

func (this *AccountChoice) EqualMessageVT(thatMsg any) bool

func (*AccountChoice) EqualVT

func (this *AccountChoice) EqualVT(that *AccountChoice) bool

func (*AccountChoice) GetOfferedAccount

func (x *AccountChoice) GetOfferedAccount() *AccountOffer

func (*AccountChoice) GetOutcome

func (x *AccountChoice) GetOutcome() AccountOutcome

func (*AccountChoice) GetReceivingAccount

func (x *AccountChoice) GetReceivingAccount() *AccountOffer

func (*AccountChoice) MarshalJSON

func (x *AccountChoice) MarshalJSON() ([]byte, error)

MarshalJSON marshals the AccountChoice to JSON.

func (*AccountChoice) MarshalProtoJSON

func (x *AccountChoice) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the AccountChoice message to JSON.

func (*AccountChoice) MarshalProtoText

func (x *AccountChoice) MarshalProtoText() string

func (*AccountChoice) MarshalToSizedBufferVT

func (m *AccountChoice) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*AccountChoice) MarshalToVT

func (m *AccountChoice) MarshalToVT(dAtA []byte) (int, error)

func (*AccountChoice) MarshalVT

func (m *AccountChoice) MarshalVT() (dAtA []byte, err error)

func (*AccountChoice) Merging

func (c *AccountChoice) Merging() bool

Merging reports whether the selected account absorbs the other account.

func (*AccountChoice) ProtoMessage

func (*AccountChoice) ProtoMessage()

func (*AccountChoice) Reset

func (x *AccountChoice) Reset()

func (*AccountChoice) SizeVT

func (m *AccountChoice) SizeVT() (n int)

func (*AccountChoice) String

func (x *AccountChoice) String() string

func (*AccountChoice) UnmarshalJSON

func (x *AccountChoice) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the AccountChoice from JSON.

func (*AccountChoice) UnmarshalProtoJSON

func (x *AccountChoice) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the AccountChoice message from JSON.

func (*AccountChoice) UnmarshalVT

func (m *AccountChoice) UnmarshalVT(dAtA []byte) error

func (*AccountChoice) Validate

func (c *AccountChoice) Validate() error

Validate checks that the chosen relationship applies to the exchanged accounts.

func (*AccountChoice) ValidateAccounts

func (c *AccountChoice) ValidateAccounts() error

ValidateAccounts requires complete, unmodified account descriptions before selection.

type AccountMerger

type AccountMerger interface {
	// MergePairingAccount preserves the destination identity and its local storage key.
	MergePairingAccount(context.Context, session.Session, provider.ProviderAccount, *session.SessionRef) (func(context.Context) (*session.SessionRef, error), error)
}

AccountMerger moves this client's source account into the selected destination. Completion requires durable resource and Session transitions while retaining source recovery through any interrupted transfer.

type AccountOffer

type AccountOffer struct {

	// AccountId is the logical ProviderAccount selected for enrollment.
	AccountId string `protobuf:"bytes,1,opt,name=account_id,json=accountId,proto3" json:"accountId,omitempty"`
	// SettingsId is the canonical account settings SharedObject.
	SettingsId string `protobuf:"bytes,2,opt,name=settings_id,json=settingsId,proto3" json:"settingsId,omitempty"`
	// OperationId binds enrollment proofs to this pairing attempt.
	OperationId string `protobuf:"bytes,3,opt,name=operation_id,json=operationId,proto3" json:"operationId,omitempty"`
	// StoragePeerId is the source account's storage participant identity.
	StoragePeerId string `protobuf:"bytes,4,opt,name=storage_peer_id,json=storagePeerId,proto3" json:"storagePeerId,omitempty"`
	// DisplayName identifies the offered account in the approval screen.
	DisplayName string `protobuf:"bytes,5,opt,name=display_name,json=displayName,proto3" json:"displayName,omitempty"`
	// ProviderId selects a configured provider on the receiving client.
	ProviderId string `protobuf:"bytes,6,opt,name=provider_id,json=providerId,proto3" json:"providerId,omitempty"`
	// ProviderEndpoint binds cloud enrollment to the configured provider service.
	ProviderEndpoint string `protobuf:"bytes,7,opt,name=provider_endpoint,json=providerEndpoint,proto3" json:"providerEndpoint,omitempty"`
	// RevokedSessionPeerIds require a new receiving Session identity when repairing access.
	RevokedSessionPeerIds []string `protobuf:"bytes,8,rep,name=revoked_session_peer_ids,json=revokedSessionPeerIds,proto3" json:"revokedSessionPeerIds,omitempty"`
	// ActiveSessionPeerIds identifies current cloud authorizations for Session reuse.
	ActiveSessionPeerIds []string `protobuf:"bytes,9,rep,name=active_session_peer_ids,json=activeSessionPeerIds,proto3" json:"activeSessionPeerIds,omitempty"`
	// SelectionContext binds this enrollment to both accounts and the selected outcome.
	SelectionContext string `protobuf:"bytes,10,opt,name=selection_context,json=selectionContext,proto3" json:"selectionContext,omitempty"`
	// MachineName names the client sending this offer. A client with no account
	// sends an offer carrying only this field.
	MachineName string `protobuf:"bytes,11,opt,name=machine_name,json=machineName,proto3" json:"machineName,omitempty"`
	// SpaceCount and SessionCount describe the current migration preview.
	SpaceCount   uint32 `protobuf:"varint,12,opt,name=space_count,json=spaceCount,proto3" json:"spaceCount,omitempty"`
	SessionCount uint32 `protobuf:"varint,13,opt,name=session_count,json=sessionCount,proto3" json:"sessionCount,omitempty"`
	// contains filtered or unexported fields
}

AccountOffer identifies the account offered over an authenticated pairing stream.

func (*AccountOffer) CloneMessageVT

func (m *AccountOffer) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*AccountOffer) CloneVT

func (m *AccountOffer) CloneVT() *AccountOffer

func (*AccountOffer) EqualMessageVT

func (this *AccountOffer) EqualMessageVT(thatMsg any) bool

func (*AccountOffer) EqualVT

func (this *AccountOffer) EqualVT(that *AccountOffer) bool

func (*AccountOffer) GetAccountId

func (x *AccountOffer) GetAccountId() string

func (*AccountOffer) GetActiveSessionPeerIds

func (x *AccountOffer) GetActiveSessionPeerIds() []string

func (*AccountOffer) GetDisplayName

func (x *AccountOffer) GetDisplayName() string

func (*AccountOffer) GetMachineName

func (x *AccountOffer) GetMachineName() string

func (*AccountOffer) GetOperationId

func (x *AccountOffer) GetOperationId() string

func (*AccountOffer) GetProviderEndpoint

func (x *AccountOffer) GetProviderEndpoint() string

func (*AccountOffer) GetProviderId

func (x *AccountOffer) GetProviderId() string

func (*AccountOffer) GetRevokedSessionPeerIds

func (x *AccountOffer) GetRevokedSessionPeerIds() []string

func (*AccountOffer) GetSelectionContext

func (x *AccountOffer) GetSelectionContext() string

func (*AccountOffer) GetSessionCount

func (x *AccountOffer) GetSessionCount() uint32

func (*AccountOffer) GetSettingsId

func (x *AccountOffer) GetSettingsId() string

func (*AccountOffer) GetSpaceCount

func (x *AccountOffer) GetSpaceCount() uint32

func (*AccountOffer) GetStoragePeerId

func (x *AccountOffer) GetStoragePeerId() string

func (*AccountOffer) MarshalJSON

func (x *AccountOffer) MarshalJSON() ([]byte, error)

MarshalJSON marshals the AccountOffer to JSON.

func (*AccountOffer) MarshalProtoJSON

func (x *AccountOffer) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the AccountOffer message to JSON.

func (*AccountOffer) MarshalProtoText

func (x *AccountOffer) MarshalProtoText() string

func (*AccountOffer) MarshalToSizedBufferVT

func (m *AccountOffer) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*AccountOffer) MarshalToVT

func (m *AccountOffer) MarshalToVT(dAtA []byte) (int, error)

func (*AccountOffer) MarshalVT

func (m *AccountOffer) MarshalVT() (dAtA []byte, err error)

func (*AccountOffer) ProtoMessage

func (*AccountOffer) ProtoMessage()

func (*AccountOffer) Reset

func (x *AccountOffer) Reset()

func (*AccountOffer) SizeVT

func (m *AccountOffer) SizeVT() (n int)

func (*AccountOffer) String

func (x *AccountOffer) String() string

func (*AccountOffer) UnmarshalJSON

func (x *AccountOffer) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the AccountOffer from JSON.

func (*AccountOffer) UnmarshalProtoJSON

func (x *AccountOffer) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the AccountOffer message from JSON.

func (*AccountOffer) UnmarshalVT

func (m *AccountOffer) UnmarshalVT(dAtA []byte) error

type AccountOutcome

type AccountOutcome int32

AccountOutcome selects the account relationship created by bilateral approval.

const (
	// AccountOutcome_UNSPECIFIED requires the receiving client to choose an outcome.
	AccountOutcome_AccountOutcome_UNSPECIFIED AccountOutcome = 0
	// AccountOutcome_SIGN_IN_OFFERED adds the code creator's account on the receiving client.
	AccountOutcome_AccountOutcome_SIGN_IN_OFFERED AccountOutcome = 1
	// AccountOutcome_SIGN_IN_RECEIVING adds the receiving client's account on the code creator.
	AccountOutcome_AccountOutcome_SIGN_IN_RECEIVING AccountOutcome = 2
	// AccountOutcome_MERGE_INTO_OFFERED moves the receiving account into the offered account.
	AccountOutcome_AccountOutcome_MERGE_INTO_OFFERED AccountOutcome = 3
	// AccountOutcome_MERGE_INTO_RECEIVING moves the offered account into the receiving account.
	AccountOutcome_AccountOutcome_MERGE_INTO_RECEIVING AccountOutcome = 4
)

func (AccountOutcome) Enum

func (x AccountOutcome) Enum() *AccountOutcome

func (AccountOutcome) MarshalJSON

func (x AccountOutcome) MarshalJSON() ([]byte, error)

MarshalJSON marshals the AccountOutcome to JSON.

func (AccountOutcome) MarshalProtoJSON

func (x AccountOutcome) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the AccountOutcome to JSON.

func (AccountOutcome) MarshalProtoText

func (x AccountOutcome) MarshalProtoText() string

func (AccountOutcome) MarshalText

func (x AccountOutcome) MarshalText() ([]byte, error)

MarshalText marshals the AccountOutcome to text.

func (AccountOutcome) String

func (x AccountOutcome) String() string

func (*AccountOutcome) UnmarshalJSON

func (x *AccountOutcome) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the AccountOutcome from JSON.

func (*AccountOutcome) UnmarshalProtoJSON

func (x *AccountOutcome) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the AccountOutcome from JSON.

func (*AccountOutcome) UnmarshalText

func (x *AccountOutcome) UnmarshalText(b []byte) error

UnmarshalText unmarshals the AccountOutcome from text.

type Approval

type Approval struct {

	// Confirmed indicates the user verified the SAS emoji match.
	Confirmed bool `protobuf:"varint,1,opt,name=confirmed,proto3" json:"confirmed,omitempty"`
	// Rejected indicates the user rejected the SAS emoji match.
	Rejected bool `protobuf:"varint,2,opt,name=rejected,proto3" json:"rejected,omitempty"`
	// OperationContext binds approval to the selected account and both receiving keys.
	OperationContext string `protobuf:"bytes,3,opt,name=operation_context,json=operationContext,proto3" json:"operationContext,omitempty"`
	// contains filtered or unexported fields
}

Approval is exchanged over a bifrost link during the mutual SAS verification step. Both peers send their confirmation status and wait for the remote's response.

func (*Approval) CloneMessageVT

func (m *Approval) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*Approval) CloneVT

func (m *Approval) CloneVT() *Approval

func (*Approval) EqualMessageVT

func (this *Approval) EqualMessageVT(thatMsg any) bool

func (*Approval) EqualVT

func (this *Approval) EqualVT(that *Approval) bool

func (*Approval) GetConfirmed

func (x *Approval) GetConfirmed() bool

func (*Approval) GetOperationContext

func (x *Approval) GetOperationContext() string

func (*Approval) GetRejected

func (x *Approval) GetRejected() bool

func (*Approval) MarshalJSON

func (x *Approval) MarshalJSON() ([]byte, error)

MarshalJSON marshals the Approval to JSON.

func (*Approval) MarshalProtoJSON

func (x *Approval) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the Approval message to JSON.

func (*Approval) MarshalProtoText

func (x *Approval) MarshalProtoText() string

func (*Approval) MarshalToSizedBufferVT

func (m *Approval) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Approval) MarshalToVT

func (m *Approval) MarshalToVT(dAtA []byte) (int, error)

func (*Approval) MarshalVT

func (m *Approval) MarshalVT() (dAtA []byte, err error)

func (*Approval) ProtoMessage

func (*Approval) ProtoMessage()

func (*Approval) Reset

func (x *Approval) Reset()

func (*Approval) SizeVT

func (m *Approval) SizeVT() (n int)

func (*Approval) String

func (x *Approval) String() string

func (*Approval) UnmarshalJSON

func (x *Approval) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the Approval from JSON.

func (*Approval) UnmarshalProtoJSON

func (x *Approval) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the Approval message from JSON.

func (*Approval) UnmarshalVT

func (m *Approval) UnmarshalVT(dAtA []byte) error

type Engine

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

Engine owns approval and enrollment for one mounted Session. Account adapters own provider authorization and persistence; its transport remains owned by the Session's ordinary transport lifecycle.

func NewEngine

func NewEngine(ctx context.Context, le *logrus.Entry, b bus.Bus, mounted session.Session, adapter AccountAdapter, getTransport func(context.Context, Relay) (*transport.SessionTransport, error)) (*Engine, error)

NewEngine binds a Session's key, provider adapter, and transport owner.

func (*Engine) Clear

func (e *Engine) Clear()

Clear releases the active exchange and its temporary transport demand.

func (*Engine) CompletePeer

func (e *Engine) CompletePeer(ctx context.Context, relay Relay, remotePeer peer.ID, offerCurrent bool, label string) error

CompletePeer links to the peer that registered a code and retains the link through enrollment. The caller resolved the code, so the relay is used only for signaling. Label names this client on the other client's approval screen and in its Session list; empty uses the machine name.

func (*Engine) ConfirmSAS

func (e *Engine) ConfirmSAS(confirmed bool)

ConfirmSAS submits the current screen's bilateral approval decision.

func (*Engine) Context

func (e *Engine) Context() context.Context

Context returns the mounted Session lifetime for direct signaling operations.

func (*Engine) GenerateCode

func (e *Engine) GenerateCode(ctx context.Context, relay Relay) (string, error)

GenerateCode publishes a code after the Session transport is ready to accept an authenticated peer. Local and cloud accounts use the same relay contract.

func (*Engine) Result

func (e *Engine) Result(remote peer.ID) (*session.SessionRef, error)

Result returns the durable receiving attachment. The offering side returns nil. Repeated reads cannot grant more access or enroll another Session.

func (*Engine) SelectAccount

func (e *Engine) SelectAccount(outcome AccountOutcome) error

SelectAccount fixes the code-entering client's account proposal before approval. A different choice requires a new exchange once the proposal has been submitted.

func (*Engine) SetFailed

func (e *Engine) SetFailed(message string)

SetFailed publishes a direct signaling failure, including before a link exists.

func (*Engine) Snapshot

func (e *Engine) Snapshot() (Snapshot, <-chan struct{})

Snapshot returns coherent state and a channel that closes on the next change.

func (*Engine) StartDirect

func (e *Engine) StartDirect(lnk link.Link, offering, offerCurrent bool)

StartDirect uses the same approval and enrollment on a manually signaled link.

func (*Engine) StartOnStream

func (e *Engine) StartOnStream(ctx context.Context, stream io.ReadWriteCloser, remote peer.ID, offering, offerCurrent bool, label string)

StartOnStream runs enrollment on an already authenticated duplex connection. The caller retains the stream's transport through completion. Label names this client to the other client; empty uses the machine name.

func (*Engine) Watch

func (e *Engine) Watch(ctx context.Context, fn func(Snapshot) error) error

Watch observes coherent snapshots until cancellation or a callback error.

type Enrollment

type Enrollment struct {
	// Choice is the immutable account relationship approved by both clients.
	Choice *AccountChoice
	// Offer binds the selected account to the complete account choice.
	Offer *AccountOffer
	// Identity proves possession of both receiving keys.
	Identity *Identity
	// Receiver installs the approved account on the receiving client.
	Receiver *Receiver
	// Account is the mounted destination account on the receiving client.
	Account provider.ProviderAccount
	// Offering indicates that this client authorizes the selected account.
	Offering bool
	// RemoteLabel is the name the other client gave itself. The authorizing
	// client records it for the receiving Session.
	RemoteLabel string
	// Release drops preparation handles without undoing durable enrollment.
	Release func()
}

Enrollment retains the selected account and receiving capability until the pairing engine releases its preparation. Offering identifies the account source, independently of which client created the pairing code.

type Frame

type Frame struct {

	// Types that are assignable to Body:
	//	*Frame_Account
	//	*Frame_Identity
	//	*Frame_Object
	//	*Frame_Complete
	//	*Frame_Error
	//	*Frame_Choice
	Body isFrame_Body `protobuf_oneof:"body"`
	// contains filtered or unexported fields
}

Frame carries the ordered account enrollment exchange.

func ReceiveFrame

func ReceiveFrame(stream *stream_packet.Session) (*Frame, error)

ReceiveFrame returns the next enrollment frame or its terminal error.

func (*Frame) CloneMessageVT

func (m *Frame) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*Frame) CloneVT

func (m *Frame) CloneVT() *Frame

func (*Frame) EqualMessageVT

func (this *Frame) EqualMessageVT(thatMsg any) bool

func (*Frame) EqualVT

func (this *Frame) EqualVT(that *Frame) bool

func (*Frame) GetAccount

func (x *Frame) GetAccount() *AccountOffer

func (*Frame) GetBody

func (m *Frame) GetBody() isFrame_Body

func (*Frame) GetChoice

func (x *Frame) GetChoice() *AccountChoice

func (*Frame) GetComplete

func (x *Frame) GetComplete() bool

func (*Frame) GetError

func (x *Frame) GetError() string

func (*Frame) GetIdentity

func (x *Frame) GetIdentity() *Identity

func (*Frame) GetObject

func (x *Frame) GetObject() *SharedObject

func (*Frame) MarshalJSON

func (x *Frame) MarshalJSON() ([]byte, error)

MarshalJSON marshals the Frame to JSON.

func (*Frame) MarshalProtoJSON

func (x *Frame) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the Frame message to JSON.

func (*Frame) MarshalProtoText

func (x *Frame) MarshalProtoText() string

func (*Frame) MarshalToSizedBufferVT

func (m *Frame) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Frame) MarshalToVT

func (m *Frame) MarshalToVT(dAtA []byte) (int, error)

func (*Frame) MarshalVT

func (m *Frame) MarshalVT() (dAtA []byte, err error)

func (*Frame) ProtoMessage

func (*Frame) ProtoMessage()

func (*Frame) Reset

func (x *Frame) Reset()

func (*Frame) SizeVT

func (m *Frame) SizeVT() (n int)

func (*Frame) String

func (x *Frame) String() string

func (*Frame) UnmarshalJSON

func (x *Frame) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the Frame from JSON.

func (*Frame) UnmarshalProtoJSON

func (x *Frame) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the Frame message from JSON.

func (*Frame) UnmarshalVT

func (m *Frame) UnmarshalVT(dAtA []byte) error

type Frame_Account

type Frame_Account struct {
	// Account offers an existing account before user approval.
	Account *AccountOffer `protobuf:"bytes,1,opt,name=account,proto3,oneof"`
}

func (*Frame_Account) CloneOneofVT

func (m *Frame_Account) CloneOneofVT() isFrame_Body

func (*Frame_Account) CloneVT

func (m *Frame_Account) CloneVT() *Frame_Account

func (*Frame_Account) EqualVT

func (this *Frame_Account) EqualVT(thatIface isFrame_Body) bool

func (*Frame_Account) MarshalToSizedBufferVT

func (m *Frame_Account) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Frame_Account) MarshalToVT

func (m *Frame_Account) MarshalToVT(dAtA []byte) (int, error)

func (*Frame_Account) SizeVT

func (m *Frame_Account) SizeVT() (n int)

type Frame_Choice

type Frame_Choice struct {
	// Choice selects the relationship after both account identities are known.
	Choice *AccountChoice `protobuf:"bytes,6,opt,name=choice,proto3,oneof"`
}

func (*Frame_Choice) CloneOneofVT

func (m *Frame_Choice) CloneOneofVT() isFrame_Body

func (*Frame_Choice) CloneVT

func (m *Frame_Choice) CloneVT() *Frame_Choice

func (*Frame_Choice) EqualVT

func (this *Frame_Choice) EqualVT(thatIface isFrame_Body) bool

func (*Frame_Choice) MarshalToSizedBufferVT

func (m *Frame_Choice) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Frame_Choice) MarshalToVT

func (m *Frame_Choice) MarshalToVT(dAtA []byte) (int, error)

func (*Frame_Choice) SizeVT

func (m *Frame_Choice) SizeVT() (n int)

type Frame_Complete

type Frame_Complete struct {
	// Complete ends object transfer or acknowledges durable enrollment.
	Complete bool `protobuf:"varint,4,opt,name=complete,proto3,oneof"`
}

func (*Frame_Complete) CloneOneofVT

func (m *Frame_Complete) CloneOneofVT() isFrame_Body

func (*Frame_Complete) CloneVT

func (m *Frame_Complete) CloneVT() *Frame_Complete

func (*Frame_Complete) EqualVT

func (this *Frame_Complete) EqualVT(thatIface isFrame_Body) bool

func (*Frame_Complete) MarshalToSizedBufferVT

func (m *Frame_Complete) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Frame_Complete) MarshalToVT

func (m *Frame_Complete) MarshalToVT(dAtA []byte) (int, error)

func (*Frame_Complete) SizeVT

func (m *Frame_Complete) SizeVT() (n int)

type Frame_Error

type Frame_Error struct {
	// Error terminates enrollment with a reason visible to both clients.
	Error string `protobuf:"bytes,5,opt,name=error,proto3,oneof"`
}

func (*Frame_Error) CloneOneofVT

func (m *Frame_Error) CloneOneofVT() isFrame_Body

func (*Frame_Error) CloneVT

func (m *Frame_Error) CloneVT() *Frame_Error

func (*Frame_Error) EqualVT

func (this *Frame_Error) EqualVT(thatIface isFrame_Body) bool

func (*Frame_Error) MarshalToSizedBufferVT

func (m *Frame_Error) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Frame_Error) MarshalToVT

func (m *Frame_Error) MarshalToVT(dAtA []byte) (int, error)

func (*Frame_Error) SizeVT

func (m *Frame_Error) SizeVT() (n int)

type Frame_Identity

type Frame_Identity struct {
	// Identity supplies the receiving client identities before approval.
	Identity *Identity `protobuf:"bytes,2,opt,name=identity,proto3,oneof"`
}

func (*Frame_Identity) CloneOneofVT

func (m *Frame_Identity) CloneOneofVT() isFrame_Body

func (*Frame_Identity) CloneVT

func (m *Frame_Identity) CloneVT() *Frame_Identity

func (*Frame_Identity) EqualVT

func (this *Frame_Identity) EqualVT(thatIface isFrame_Body) bool

func (*Frame_Identity) MarshalToSizedBufferVT

func (m *Frame_Identity) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Frame_Identity) MarshalToVT

func (m *Frame_Identity) MarshalToVT(dAtA []byte) (int, error)

func (*Frame_Identity) SizeVT

func (m *Frame_Identity) SizeVT() (n int)

type Frame_Object

type Frame_Object struct {
	// Object transfers an authorized object after bilateral approval.
	Object *SharedObject `protobuf:"bytes,3,opt,name=object,proto3,oneof"`
}

func (*Frame_Object) CloneOneofVT

func (m *Frame_Object) CloneOneofVT() isFrame_Body

func (*Frame_Object) CloneVT

func (m *Frame_Object) CloneVT() *Frame_Object

func (*Frame_Object) EqualVT

func (this *Frame_Object) EqualVT(thatIface isFrame_Body) bool

func (*Frame_Object) MarshalToSizedBufferVT

func (m *Frame_Object) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Frame_Object) MarshalToVT

func (m *Frame_Object) MarshalToVT(dAtA []byte) (int, error)

func (*Frame_Object) SizeVT

func (m *Frame_Object) SizeVT() (n int)

type Identity

type Identity struct {

	// SessionRef is the independently generated receiving Session.
	SessionRef *session.SessionRef `protobuf:"bytes,1,opt,name=session_ref,json=sessionRef,proto3" json:"sessionRef,omitempty"`
	// SessionProof binds the receiving Session key to the offered operation.
	SessionProof *sobject.SOJoinResponse `protobuf:"bytes,2,opt,name=session_proof,json=sessionProof,proto3" json:"sessionProof,omitempty"`
	// StorageProof binds the replica volume key to the same operation.
	StorageProof *sobject.SOJoinResponse `protobuf:"bytes,3,opt,name=storage_proof,json=storageProof,proto3" json:"storageProof,omitempty"`
	// contains filtered or unexported fields
}

Identity proves possession of the receiving Session and storage keys.

func BuildIdentity

func BuildIdentity(offer *AccountOffer, ref *session.SessionRef, sessionKey, storageKey crypto.PrivKey, sourcePeer, receivingPeer peer.ID) (*Identity, error)

BuildIdentity binds the receiving Session and storage keys to one offered account, Session reference, and authenticated transport connection.

func (*Identity) CloneMessageVT

func (m *Identity) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*Identity) CloneVT

func (m *Identity) CloneVT() *Identity

func (*Identity) EqualMessageVT

func (this *Identity) EqualMessageVT(thatMsg any) bool

func (*Identity) EqualVT

func (this *Identity) EqualVT(that *Identity) bool

func (*Identity) GetSessionProof

func (x *Identity) GetSessionProof() *sobject.SOJoinResponse

func (*Identity) GetSessionRef

func (x *Identity) GetSessionRef() *session.SessionRef

func (*Identity) GetStorageProof

func (x *Identity) GetStorageProof() *sobject.SOJoinResponse

func (*Identity) MarshalJSON

func (x *Identity) MarshalJSON() ([]byte, error)

MarshalJSON marshals the Identity to JSON.

func (*Identity) MarshalProtoJSON

func (x *Identity) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the Identity message to JSON.

func (*Identity) MarshalProtoText

func (x *Identity) MarshalProtoText() string

func (*Identity) MarshalToSizedBufferVT

func (m *Identity) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Identity) MarshalToVT

func (m *Identity) MarshalToVT(dAtA []byte) (int, error)

func (*Identity) MarshalVT

func (m *Identity) MarshalVT() (dAtA []byte, err error)

func (*Identity) ProtoMessage

func (*Identity) ProtoMessage()

func (*Identity) Reset

func (x *Identity) Reset()

func (*Identity) SizeVT

func (m *Identity) SizeVT() (n int)

func (*Identity) String

func (x *Identity) String() string

func (*Identity) UnmarshalJSON

func (x *Identity) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the Identity from JSON.

func (*Identity) UnmarshalProtoJSON

func (x *Identity) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the Identity message from JSON.

func (*Identity) UnmarshalVT

func (m *Identity) UnmarshalVT(dAtA []byte) error

type Receiver

type Receiver struct {
	// Transport returns the enrolled Session connection owner after Receive succeeds.
	Transport func(context.Context) (*transport.SessionTransport, error)
	Identity  *Identity
	Receive   func(context.Context, *stream_packet.Session) error
	Release   func()
}

Receiver retains the approved receiving identity through durable attachment. Receive consumes provider checkpoints through a final Complete frame. Release drops preparation handles while preserving keys and any completed attachment.

type Relay

type Relay struct {
	// URL is the base URL that serves the /api/pair routes.
	URL string
	// SigningEnvPrefix scopes request signatures to the relay's environment.
	SigningEnvPrefix string
	// Client performs relay requests; nil uses http.DefaultClient.
	Client *http.Client
}

Relay supplies the configured code and signaling service as one signing scope.

type Session

type Session interface {
	GetPairingEngine() (*Engine, error)
	GetPairingTransport(context.Context, Relay) (*transport.SessionTransport, error)
}

Session supports one pairing operation within its mounted lifetime.

type SharedObject

type SharedObject struct {

	// Entry describes the object's identity and body type.
	Entry *sobject.SharedObjectListEntry `protobuf:"bytes,1,opt,name=entry,proto3" json:"entry,omitempty"`
	// State is accepted only through the SharedObject host's enrollment contract.
	State *sobject.SOState `protobuf:"bytes,2,opt,name=state,proto3" json:"state,omitempty"`
	// HistoryBase and History retain the verified lineage leading to State.
	HistoryBase *sobject.SharedObjectConfig `protobuf:"bytes,3,opt,name=history_base,json=historyBase,proto3" json:"historyBase,omitempty"`
	History     []*sobject.SOConfigChange   `protobuf:"bytes,4,rep,name=history,proto3" json:"history,omitempty"`
	// Genesis retains the signed first entry when HistoryBase is that entry.
	Genesis *sobject.SOConfigChange `protobuf:"bytes,5,opt,name=genesis,proto3" json:"genesis,omitempty"`
	// contains filtered or unexported fields
}

SharedObject carries one authorized bootstrap checkpoint.

func (*SharedObject) CloneMessageVT

func (m *SharedObject) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*SharedObject) CloneVT

func (m *SharedObject) CloneVT() *SharedObject

func (*SharedObject) EqualMessageVT

func (this *SharedObject) EqualMessageVT(thatMsg any) bool

func (*SharedObject) EqualVT

func (this *SharedObject) EqualVT(that *SharedObject) bool

func (*SharedObject) GetEntry

func (*SharedObject) GetGenesis

func (x *SharedObject) GetGenesis() *sobject.SOConfigChange

func (*SharedObject) GetHistory

func (x *SharedObject) GetHistory() []*sobject.SOConfigChange

func (*SharedObject) GetHistoryBase

func (x *SharedObject) GetHistoryBase() *sobject.SharedObjectConfig

func (*SharedObject) GetState

func (x *SharedObject) GetState() *sobject.SOState

func (*SharedObject) MarshalJSON

func (x *SharedObject) MarshalJSON() ([]byte, error)

MarshalJSON marshals the SharedObject to JSON.

func (*SharedObject) MarshalProtoJSON

func (x *SharedObject) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the SharedObject message to JSON.

func (*SharedObject) MarshalProtoText

func (x *SharedObject) MarshalProtoText() string

func (*SharedObject) MarshalToSizedBufferVT

func (m *SharedObject) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*SharedObject) MarshalToVT

func (m *SharedObject) MarshalToVT(dAtA []byte) (int, error)

func (*SharedObject) MarshalVT

func (m *SharedObject) MarshalVT() (dAtA []byte, err error)

func (*SharedObject) ProtoMessage

func (*SharedObject) ProtoMessage()

func (*SharedObject) Reset

func (x *SharedObject) Reset()

func (*SharedObject) SizeVT

func (m *SharedObject) SizeVT() (n int)

func (*SharedObject) String

func (x *SharedObject) String() string

func (*SharedObject) UnmarshalJSON

func (x *SharedObject) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the SharedObject from JSON.

func (*SharedObject) UnmarshalProtoJSON

func (x *SharedObject) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the SharedObject message from JSON.

func (*SharedObject) UnmarshalVT

func (m *SharedObject) UnmarshalVT(dAtA []byte) error

type Snapshot

type Snapshot struct {
	// Status is the operation's current phase.
	Status Status
	// Code is the pairing code this client registered, when it created one.
	Code string
	// RemotePeerID is the other client's Session peer once it is known.
	RemotePeerID peer.ID
	// Emoji is the SAS sequence both people compare before approving.
	Emoji []string
	// ErrMsg describes the failure when Status is a failure phase.
	ErrMsg string
	// AccountID is the account selected for enrollment.
	AccountID string
	// AccountName is the selected account's display name.
	AccountName string
	// ProviderID is the provider that holds the selected account.
	ProviderID string
	// RemoteLabel is the name the other client gave itself, shown on the
	// approval screen and recorded for the Session it enrolls.
	RemoteLabel string
	// Receiving indicates this client is adding the selected account.
	Receiving bool
	// Choice is the proposed account relationship once both offers are known.
	Choice *AccountChoice
}

Snapshot describes one Session's current pairing operation.

type Status

type Status int32

Status matches the Session resource's pairing status enum.

const (
	StatusIdle Status = iota
	StatusCodeGenerated
	StatusWaitingForPeer
	StatusPeerConnected
	StatusVerifyingEmoji
	StatusVerified
	StatusFailed
	StatusSignalingFailed
	StatusConnectionTimeout
	StatusWaitingForRemote
	StatusBothConfirmed
	StatusPairingRejected
	StatusConfirmationTimeout
	StatusEnrolling
	StatusSelectingAccount
)

Jump to

Keyboard shortcuts

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