Documentation
¶
Index ¶
- Constants
- Variables
- func BuildJoinResponse(inviteID string, privKey crypto.PrivKey) (*sobject.SOJoinResponse, error)
- func DeserializeInviteLink(encoded string) (*sobject.SOInviteMessage, error)
- func HashInviteToken(token []byte) []byte
- func LeaveSharedObject(ctx context.Context, childBus bus.Bus, localPeerID, ownerPeerID peer.ID, ...) (*sobject.SOLeaveResponse, error)
- func NewSRPCSOInviteServiceHandler(impl SRPCSOInviteServiceServer, serviceID string) srpc.Handler
- func SRPCRegisterSOInviteService(mux srpc.Mux, impl SRPCSOInviteServiceServer) error
- func SerializeInviteLink(msg *sobject.SOInviteMessage) (string, error)
- func ValidateJoinResponse(joinResp *sobject.SOJoinResponse) (peer.ID, crypto.PubKey, error)
- type AcceptInviteRequest
- func (m *AcceptInviteRequest) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *AcceptInviteRequest) CloneVT() *AcceptInviteRequest
- func (this *AcceptInviteRequest) EqualMessageVT(thatMsg any) bool
- func (this *AcceptInviteRequest) EqualVT(that *AcceptInviteRequest) bool
- func (x *AcceptInviteRequest) GetJoinResponse() *sobject.SOJoinResponse
- func (x *AcceptInviteRequest) GetStorageJoinResponse() *sobject.SOJoinResponse
- func (x *AcceptInviteRequest) GetToken() []byte
- func (x *AcceptInviteRequest) MarshalJSON() ([]byte, error)
- func (x *AcceptInviteRequest) MarshalProtoJSON(s *json.MarshalState)
- func (x *AcceptInviteRequest) MarshalProtoText() string
- func (m *AcceptInviteRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *AcceptInviteRequest) MarshalToVT(dAtA []byte) (int, error)
- func (m *AcceptInviteRequest) MarshalVT() (dAtA []byte, err error)
- func (*AcceptInviteRequest) ProtoMessage()
- func (x *AcceptInviteRequest) Reset()
- func (m *AcceptInviteRequest) SizeVT() (n int)
- func (x *AcceptInviteRequest) String() string
- func (x *AcceptInviteRequest) UnmarshalJSON(b []byte) error
- func (x *AcceptInviteRequest) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *AcceptInviteRequest) UnmarshalVT(dAtA []byte) error
- type AcceptInviteResponse
- func (m *AcceptInviteResponse) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *AcceptInviteResponse) CloneVT() *AcceptInviteResponse
- func (this *AcceptInviteResponse) EqualMessageVT(thatMsg any) bool
- func (this *AcceptInviteResponse) EqualVT(that *AcceptInviteResponse) bool
- func (x *AcceptInviteResponse) GetGrant() *sobject.SOGrant
- func (x *AcceptInviteResponse) GetOwnerGrant() *sobject.SOGrant
- func (x *AcceptInviteResponse) GetSharedObjectId() string
- func (x *AcceptInviteResponse) GetSharedObjectState() *sobject.SOState
- func (x *AcceptInviteResponse) MarshalJSON() ([]byte, error)
- func (x *AcceptInviteResponse) MarshalProtoJSON(s *json.MarshalState)
- func (x *AcceptInviteResponse) MarshalProtoText() string
- func (m *AcceptInviteResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *AcceptInviteResponse) MarshalToVT(dAtA []byte) (int, error)
- func (m *AcceptInviteResponse) MarshalVT() (dAtA []byte, err error)
- func (*AcceptInviteResponse) ProtoMessage()
- func (x *AcceptInviteResponse) Reset()
- func (m *AcceptInviteResponse) SizeVT() (n int)
- func (x *AcceptInviteResponse) String() string
- func (x *AcceptInviteResponse) UnmarshalJSON(b []byte) error
- func (x *AcceptInviteResponse) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *AcceptInviteResponse) UnmarshalVT(dAtA []byte) error
- type EnrollFn
- type InviteController
- type InviteLookupFn
- type InviteLookupResult
- type JoinResult
- type LeaveFn
- type SRPCSOInviteServiceClient
- type SRPCSOInviteServiceHandler
- func (SRPCSOInviteServiceHandler) GetMethodIDs() []string
- func (d *SRPCSOInviteServiceHandler) GetServiceID() string
- func (d *SRPCSOInviteServiceHandler) InvokeMethod(serviceID, methodID string, strm srpc.Stream) (bool, error)
- func (SRPCSOInviteServiceHandler) InvokeMethod_AcceptInvite(impl SRPCSOInviteServiceServer, strm srpc.Stream) error
- func (SRPCSOInviteServiceHandler) InvokeMethod_Leave(impl SRPCSOInviteServiceServer, strm srpc.Stream) error
- type SRPCSOInviteServiceServer
- type SRPCSOInviteService_AcceptInviteStream
- type SRPCSOInviteService_LeaveStream
- type Server
Constants ¶
const ControllerID = "alpha/so-invite/server"
ControllerID is the ID of the controller.
const ProtocolID = protocol.ID("alpha/so-invite")
ProtocolID is the bifrost protocol ID for the SO invite handshake.
const SRPCSOInviteServiceServiceID = "sobject.invite.SOInviteService"
Variables ¶
var Version = controller.MustParseVersion("0.0.1")
Version is the version of the controller implementation.
Functions ¶
func BuildJoinResponse ¶
BuildJoinResponse constructs and signs a SOJoinResponse for an invite. The invitee calls this with their private key and the invite details.
func DeserializeInviteLink ¶
func DeserializeInviteLink(encoded string) (*sobject.SOInviteMessage, error)
DeserializeInviteLink deserializes a base58-encoded SOInviteMessage from a URL path or query parameter.
func HashInviteToken ¶
HashInviteToken computes the SHA256 hash of a raw invite token. Used by clients that need to compare raw invite tokens with SOInvite.token_hash.
func LeaveSharedObject ¶
func LeaveSharedObject(ctx context.Context, childBus bus.Bus, localPeerID, ownerPeerID peer.ID, request *sobject.SOLeaveRequest) (*sobject.SOLeaveResponse, error)
LeaveSharedObject sends signed departure consent to the authenticated native owner. The caller verifies the returned configuration proof before retiring its local access.
func NewSRPCSOInviteServiceHandler ¶
func NewSRPCSOInviteServiceHandler(impl SRPCSOInviteServiceServer, serviceID string) srpc.Handler
NewSRPCSOInviteServiceHandler constructs a new RPC handler. serviceID: if empty, uses default: sobject.invite.SOInviteService
func SRPCRegisterSOInviteService ¶
func SRPCRegisterSOInviteService(mux srpc.Mux, impl SRPCSOInviteServiceServer) error
SRPCRegisterSOInviteService registers the implementation with the mux. Uses the default serviceID: sobject.invite.SOInviteService
func SerializeInviteLink ¶
func SerializeInviteLink(msg *sobject.SOInviteMessage) (string, error)
SerializeInviteLink serializes an SOInviteMessage as a base58 string suitable for embedding in a URL path or query parameter.
func ValidateJoinResponse ¶
ValidateJoinResponse validates a signed join response and returns the responder identity.
Types ¶
type AcceptInviteRequest ¶
type AcceptInviteRequest struct {
// JoinResponse is the signed join response from the invitee.
JoinResponse *sobject.SOJoinResponse `protobuf:"bytes,1,opt,name=join_response,json=joinResponse,proto3" json:"joinResponse,omitempty"`
// Token is the raw invite token.
// The owner SHA256 hashes it to verify against the on-chain token_hash.
// Only the owner sees the raw token on the authenticated stream.
// The cloud beacon/mailbox layer gates on token_hash (never sees raw token).
Token []byte `protobuf:"bytes,2,opt,name=token,proto3" json:"token,omitempty"`
// StorageJoinResponse proves the persistent local storage identity that will
// read and write the joined copy.
StorageJoinResponse *sobject.SOJoinResponse `protobuf:"bytes,3,opt,name=storage_join_response,json=storageJoinResponse,proto3" json:"storageJoinResponse,omitempty"`
// contains filtered or unexported fields
}
AcceptInviteRequest is sent by the invitee to the owner.
func (*AcceptInviteRequest) CloneMessageVT ¶
func (m *AcceptInviteRequest) CloneMessageVT() protobuf_go_lite.CloneMessage
func (*AcceptInviteRequest) CloneVT ¶
func (m *AcceptInviteRequest) CloneVT() *AcceptInviteRequest
func (*AcceptInviteRequest) EqualMessageVT ¶
func (this *AcceptInviteRequest) EqualMessageVT(thatMsg any) bool
func (*AcceptInviteRequest) EqualVT ¶
func (this *AcceptInviteRequest) EqualVT(that *AcceptInviteRequest) bool
func (*AcceptInviteRequest) GetJoinResponse ¶
func (x *AcceptInviteRequest) GetJoinResponse() *sobject.SOJoinResponse
func (*AcceptInviteRequest) GetStorageJoinResponse ¶ added in v0.57.2
func (x *AcceptInviteRequest) GetStorageJoinResponse() *sobject.SOJoinResponse
func (*AcceptInviteRequest) GetToken ¶
func (x *AcceptInviteRequest) GetToken() []byte
func (*AcceptInviteRequest) MarshalJSON ¶
func (x *AcceptInviteRequest) MarshalJSON() ([]byte, error)
MarshalJSON marshals the AcceptInviteRequest to JSON.
func (*AcceptInviteRequest) MarshalProtoJSON ¶
func (x *AcceptInviteRequest) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the AcceptInviteRequest message to JSON.
func (*AcceptInviteRequest) MarshalProtoText ¶
func (x *AcceptInviteRequest) MarshalProtoText() string
func (*AcceptInviteRequest) MarshalToSizedBufferVT ¶
func (m *AcceptInviteRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error)
func (*AcceptInviteRequest) MarshalToVT ¶
func (m *AcceptInviteRequest) MarshalToVT(dAtA []byte) (int, error)
func (*AcceptInviteRequest) MarshalVT ¶
func (m *AcceptInviteRequest) MarshalVT() (dAtA []byte, err error)
func (*AcceptInviteRequest) ProtoMessage ¶
func (*AcceptInviteRequest) ProtoMessage()
func (*AcceptInviteRequest) Reset ¶
func (x *AcceptInviteRequest) Reset()
func (*AcceptInviteRequest) SizeVT ¶
func (m *AcceptInviteRequest) SizeVT() (n int)
func (*AcceptInviteRequest) String ¶
func (x *AcceptInviteRequest) String() string
func (*AcceptInviteRequest) UnmarshalJSON ¶
func (x *AcceptInviteRequest) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals the AcceptInviteRequest from JSON.
func (*AcceptInviteRequest) UnmarshalProtoJSON ¶
func (x *AcceptInviteRequest) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the AcceptInviteRequest message from JSON.
func (*AcceptInviteRequest) UnmarshalVT ¶
func (m *AcceptInviteRequest) UnmarshalVT(dAtA []byte) error
type AcceptInviteResponse ¶
type AcceptInviteResponse struct {
// Grant is the encrypted SOGrant for the invitee.
Grant *sobject.SOGrant `protobuf:"bytes,1,opt,name=grant,proto3" json:"grant,omitempty"`
SharedObjectId string `protobuf:"bytes,2,opt,name=shared_object_id,json=sharedObjectId,proto3" json:"sharedObjectId,omitempty"`
// OwnerGrant is the owner's existing root grant. The invitee preserves it so
// the owner can read later state written by the joined copy.
OwnerGrant *sobject.SOGrant `protobuf:"bytes,3,opt,name=owner_grant,json=ownerGrant,proto3" json:"ownerGrant,omitempty"`
// invitee installs this state so both copies use the same root transform.
SharedObjectState *sobject.SOState `protobuf:"bytes,4,opt,name=shared_object_state,json=sharedObjectState,proto3" json:"sharedObjectState,omitempty"`
// contains filtered or unexported fields
}
AcceptInviteResponse is returned by the owner after enrollment.
func (*AcceptInviteResponse) CloneMessageVT ¶
func (m *AcceptInviteResponse) CloneMessageVT() protobuf_go_lite.CloneMessage
func (*AcceptInviteResponse) CloneVT ¶
func (m *AcceptInviteResponse) CloneVT() *AcceptInviteResponse
func (*AcceptInviteResponse) EqualMessageVT ¶
func (this *AcceptInviteResponse) EqualMessageVT(thatMsg any) bool
func (*AcceptInviteResponse) EqualVT ¶
func (this *AcceptInviteResponse) EqualVT(that *AcceptInviteResponse) bool
func (*AcceptInviteResponse) GetGrant ¶
func (x *AcceptInviteResponse) GetGrant() *sobject.SOGrant
func (*AcceptInviteResponse) GetOwnerGrant ¶ added in v0.57.2
func (x *AcceptInviteResponse) GetOwnerGrant() *sobject.SOGrant
func (*AcceptInviteResponse) GetSharedObjectId ¶
func (x *AcceptInviteResponse) GetSharedObjectId() string
func (*AcceptInviteResponse) GetSharedObjectState ¶ added in v0.57.2
func (x *AcceptInviteResponse) GetSharedObjectState() *sobject.SOState
func (*AcceptInviteResponse) MarshalJSON ¶
func (x *AcceptInviteResponse) MarshalJSON() ([]byte, error)
MarshalJSON marshals the AcceptInviteResponse to JSON.
func (*AcceptInviteResponse) MarshalProtoJSON ¶
func (x *AcceptInviteResponse) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the AcceptInviteResponse message to JSON.
func (*AcceptInviteResponse) MarshalProtoText ¶
func (x *AcceptInviteResponse) MarshalProtoText() string
func (*AcceptInviteResponse) MarshalToSizedBufferVT ¶
func (m *AcceptInviteResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error)
func (*AcceptInviteResponse) MarshalToVT ¶
func (m *AcceptInviteResponse) MarshalToVT(dAtA []byte) (int, error)
func (*AcceptInviteResponse) MarshalVT ¶
func (m *AcceptInviteResponse) MarshalVT() (dAtA []byte, err error)
func (*AcceptInviteResponse) ProtoMessage ¶
func (*AcceptInviteResponse) ProtoMessage()
func (*AcceptInviteResponse) Reset ¶
func (x *AcceptInviteResponse) Reset()
func (*AcceptInviteResponse) SizeVT ¶
func (m *AcceptInviteResponse) SizeVT() (n int)
func (*AcceptInviteResponse) String ¶
func (x *AcceptInviteResponse) String() string
func (*AcceptInviteResponse) UnmarshalJSON ¶
func (x *AcceptInviteResponse) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals the AcceptInviteResponse from JSON.
func (*AcceptInviteResponse) UnmarshalProtoJSON ¶
func (x *AcceptInviteResponse) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the AcceptInviteResponse message from JSON.
func (*AcceptInviteResponse) UnmarshalVT ¶
func (m *AcceptInviteResponse) UnmarshalVT(dAtA []byte) error
type EnrollFn ¶
type EnrollFn func(ctx context.Context, result *InviteLookupResult, inviteePeerID peer.ID, inviteePubKey crypto.PubKey) (*sobject.SOGrant, error)
EnrollFn enrolls a participant after invite verification. Called with the resolved invite context and the invitee's identity. Returns the SOGrant for the invitee.
type InviteController ¶
type InviteController struct {
// Server owns the invitation stream service and its controller lifetime.
*stream_srpc_server.Server
}
InviteController wraps the SRPC server with the bifrost stream handler.
func NewInviteController ¶
func NewInviteController( le *logrus.Entry, b bus.Bus, lookupFn InviteLookupFn, enrollFn EnrollFn, leaveFn LeaveFn, peerIDs []string, ) (*InviteController, error)
NewInviteController constructs an SO invite controller.
type InviteLookupFn ¶
type InviteLookupFn func(ctx context.Context, tokenHash []byte) (*InviteLookupResult, error)
InviteLookupFn resolves an invite by token hash. Returns nil result if no matching invite is found.
type InviteLookupResult ¶
type InviteLookupResult struct {
// Host is the SOHost managing the shared object.
Host *sobject.SOHost
// InviteMutator applies invite state mutations for this shared object.
InviteMutator sobject.InviteMutator
// Invite is the matching SOInvite.
Invite *sobject.SOInvite
SharedObjectID string
// OwnerPrivKey is the owner's private key for signing config changes.
OwnerPrivKey crypto.PrivKey
}
InviteLookupResult contains the resolved invite and its context.
type JoinResult ¶
type JoinResult struct {
// Grant is the encrypted SOGrant for the invitee.
Grant *sobject.SOGrant
SharedObjectID string
// OwnerGrant keeps the originating owner's root access on the joined copy.
OwnerGrant *sobject.SOGrant
SharedObjectState *sobject.SOState
}
JoinResult contains the result of a successful invite join.
func JoinViaInvite ¶
func JoinViaInvite( ctx context.Context, childBus bus.Bus, localPeerID peer.ID, inviteePrivKey crypto.PrivKey, storagePrivKey crypto.PrivKey, inviteMsg *sobject.SOInviteMessage, ) (*JoinResult, error)
JoinViaInvite executes the invitee side of the invite handshake.
The invitee must already have a session transport running with a child bus that can reach the owner's peer (via signaling/WebRTC). This function: 1. Builds and signs a SOJoinResponse 2. Opens an SRPC stream to the owner on protocol alpha/so-invite 3. Sends AcceptInviteRequest with the raw token 4. Returns the SOGrant from the owner
type LeaveFn ¶
type LeaveFn func(context.Context, *sobject.SOLeaveRequest) (*sobject.SOLeaveResponse, error)
LeaveFn commits voluntary departure while retaining the selected native host through acknowledgment.
type SRPCSOInviteServiceClient ¶
type SRPCSOInviteServiceClient interface {
// SRPCClient returns the underlying SRPC client.
SRPCClient() srpc.Client
// AcceptInvite verifies admission proofs and issues native participant grants.
AcceptInvite(ctx context.Context, in *AcceptInviteRequest) (*AcceptInviteResponse, error)
// Leave verifies signed consent and returns the owner's committed removal proof.
Leave(ctx context.Context, in *sobject.SOLeaveRequest) (*sobject.SOLeaveResponse, error)
}
func NewSRPCSOInviteServiceClient ¶
func NewSRPCSOInviteServiceClient(cc srpc.Client) SRPCSOInviteServiceClient
func NewSRPCSOInviteServiceClientWithServiceID ¶
func NewSRPCSOInviteServiceClientWithServiceID(cc srpc.Client, serviceID string) SRPCSOInviteServiceClient
type SRPCSOInviteServiceHandler ¶
type SRPCSOInviteServiceHandler struct {
// contains filtered or unexported fields
}
func (SRPCSOInviteServiceHandler) GetMethodIDs ¶
func (SRPCSOInviteServiceHandler) GetMethodIDs() []string
func (*SRPCSOInviteServiceHandler) GetServiceID ¶
func (d *SRPCSOInviteServiceHandler) GetServiceID() string
func (*SRPCSOInviteServiceHandler) InvokeMethod ¶
func (SRPCSOInviteServiceHandler) InvokeMethod_AcceptInvite ¶
func (SRPCSOInviteServiceHandler) InvokeMethod_AcceptInvite(impl SRPCSOInviteServiceServer, strm srpc.Stream) error
func (SRPCSOInviteServiceHandler) InvokeMethod_Leave ¶
func (SRPCSOInviteServiceHandler) InvokeMethod_Leave(impl SRPCSOInviteServiceServer, strm srpc.Stream) error
type SRPCSOInviteServiceServer ¶
type SRPCSOInviteServiceServer interface {
// AcceptInvite verifies admission proofs and issues native participant grants.
AcceptInvite(context.Context, *AcceptInviteRequest) (*AcceptInviteResponse, error)
// Leave verifies signed consent and returns the owner's committed removal proof.
Leave(context.Context, *sobject.SOLeaveRequest) (*sobject.SOLeaveResponse, error)
}
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server implements the SOInviteService SRPC server.
func NewServer ¶
func NewServer(le *logrus.Entry, lookupFn InviteLookupFn, enrollFn EnrollFn, leaveFn LeaveFn) *Server
NewServer constructs a new SO invite server.
func (*Server) AcceptInvite ¶
func (s *Server) AcceptInvite(ctx context.Context, req *AcceptInviteRequest) (*AcceptInviteResponse, error)
AcceptInvite processes a join request from an invitee.
func (*Server) Leave ¶
func (s *Server) Leave(ctx context.Context, request *sobject.SOLeaveRequest) (*sobject.SOLeaveResponse, error)
Leave binds the transport to a departing identity before invoking the native owner.