Documentation
¶
Index ¶
- Variables
- func RegisterAuthenticationServer(s grpc.ServiceRegistrar, srv AuthenticationServer)
- func RegisterGroupsServer(s grpc.ServiceRegistrar, srv GroupsServer)
- func RegisterMessagingServer(s grpc.ServiceRegistrar, srv MessagingServer)
- func RegisterUserServer(s grpc.ServiceRegistrar, srv UserServer)
- type Auth
- type AuthenticationClient
- type AuthenticationServer
- type DemoteRequest
- func (*DemoteRequest) Descriptor() ([]byte, []int)deprecated
- func (x *DemoteRequest) GetDemotee() string
- func (x *DemoteRequest) GetGroupId() string
- func (*DemoteRequest) ProtoMessage()
- func (x *DemoteRequest) ProtoReflect() protoreflect.Message
- func (x *DemoteRequest) Reset()
- func (x *DemoteRequest) String() string
- type Group
- func (*Group) Descriptor() ([]byte, []int)deprecated
- func (x *Group) GetId() string
- func (x *Group) GetIsBroadcast() bool
- func (x *Group) GetIsOpen() bool
- func (x *Group) GetMembers() []string
- func (x *Group) GetOwners() []string
- func (*Group) ProtoMessage()
- func (x *Group) ProtoReflect() protoreflect.Message
- func (x *Group) Reset()
- func (x *Group) String() string
- type GroupsClient
- type GroupsServer
- type InfoRequest
- type InviteRequest
- func (*InviteRequest) Descriptor() ([]byte, []int)deprecated
- func (x *InviteRequest) GetGroupId() string
- func (x *InviteRequest) GetInvitee() string
- func (*InviteRequest) ProtoMessage()
- func (x *InviteRequest) ProtoReflect() protoreflect.Message
- func (x *InviteRequest) Reset()
- func (x *InviteRequest) String() string
- type JoinRequest
- func (*JoinRequest) Descriptor() ([]byte, []int)deprecated
- func (x *JoinRequest) GetGroupId() string
- func (x *JoinRequest) GetJoiner() string
- func (*JoinRequest) ProtoMessage()
- func (x *JoinRequest) ProtoReflect() protoreflect.Message
- func (x *JoinRequest) Reset()
- func (x *JoinRequest) String() string
- type LeaveRequest
- func (*LeaveRequest) Descriptor() ([]byte, []int)deprecated
- func (x *LeaveRequest) GetGroupId() string
- func (x *LeaveRequest) GetLeaver() string
- func (*LeaveRequest) ProtoMessage()
- func (x *LeaveRequest) ProtoReflect() protoreflect.Message
- func (x *LeaveRequest) Reset()
- func (x *LeaveRequest) String() string
- type Message
- func (*Message) Descriptor() ([]byte, []int)deprecated
- func (x *Message) GetBody() []byte
- func (x *Message) GetDatetime() *timestamppb.Timestamp
- func (x *Message) GetMimetype() string
- func (*Message) ProtoMessage()
- func (x *Message) ProtoReflect() protoreflect.Message
- func (x *Message) Reset()
- func (x *Message) String() string
- type MessageWrapper
- func (*MessageWrapper) Descriptor() ([]byte, []int)deprecated
- func (x *MessageWrapper) GetEncoded() []byte
- func (x *MessageWrapper) GetRecipient() *Subject
- func (x *MessageWrapper) GetSender() *Subject
- func (*MessageWrapper) ProtoMessage()
- func (x *MessageWrapper) ProtoReflect() protoreflect.Message
- func (x *MessageWrapper) Reset()
- func (x *MessageWrapper) String() string
- type MessagingClient
- type MessagingServer
- type Messaging_SubscribeClient
- type Messaging_SubscribeServer
- type PromoteRequest
- func (*PromoteRequest) Descriptor() ([]byte, []int)deprecated
- func (x *PromoteRequest) GetGroupId() string
- func (x *PromoteRequest) GetPromotee() string
- func (*PromoteRequest) ProtoMessage()
- func (x *PromoteRequest) ProtoReflect() protoreflect.Message
- func (x *PromoteRequest) Reset()
- func (x *PromoteRequest) String() string
- type PublicKeyRequest
- func (*PublicKeyRequest) Descriptor() ([]byte, []int)deprecated
- func (x *PublicKeyRequest) GetOwner() *Subject
- func (x *PublicKeyRequest) GetValue() string
- func (*PublicKeyRequest) ProtoMessage()
- func (x *PublicKeyRequest) ProtoReflect() protoreflect.Message
- func (x *PublicKeyRequest) Reset()
- func (x *PublicKeyRequest) String() string
- type PublicKeyValue
- func (*PublicKeyValue) Descriptor() ([]byte, []int)deprecated
- func (x *PublicKeyValue) GetUserId() string
- func (x *PublicKeyValue) GetValue() string
- func (*PublicKeyValue) ProtoMessage()
- func (x *PublicKeyValue) ProtoReflect() protoreflect.Message
- func (x *PublicKeyValue) Reset()
- func (x *PublicKeyValue) String() string
- type SignupRequest
- type SignupResponse
- func (*SignupResponse) Descriptor() ([]byte, []int)deprecated
- func (x *SignupResponse) GetTotpSeed() string
- func (x *SignupResponse) GetUserId() string
- func (*SignupResponse) ProtoMessage()
- func (x *SignupResponse) ProtoReflect() protoreflect.Message
- func (x *SignupResponse) Reset()
- func (x *SignupResponse) String() string
- type Subject
- type TokenValue
- type UnimplementedAuthenticationServer
- type UnimplementedGroupsServer
- func (UnimplementedGroupsServer) Create(context.Context, *Group) (*Group, error)
- func (UnimplementedGroupsServer) DemoteUser(context.Context, *DemoteRequest) (*emptypb.Empty, error)
- func (UnimplementedGroupsServer) Info(context.Context, *InfoRequest) (*Group, error)
- func (UnimplementedGroupsServer) Invite(context.Context, *InviteRequest) (*emptypb.Empty, error)
- func (UnimplementedGroupsServer) Join(context.Context, *JoinRequest) (*emptypb.Empty, error)
- func (UnimplementedGroupsServer) Leave(context.Context, *LeaveRequest) (*emptypb.Empty, error)
- func (UnimplementedGroupsServer) PromoteUser(context.Context, *PromoteRequest) (*emptypb.Empty, error)
- type UnimplementedMessagingServer
- type UnimplementedUserServer
- func (UnimplementedUserServer) AddPublicKey(context.Context, *PublicKeyValue) (*emptypb.Empty, error)
- func (UnimplementedUserServer) DelPublicKey(context.Context, *PublicKeyValue) (*emptypb.Empty, error)
- func (UnimplementedUserServer) DelToken(context.Context, *TokenValue) (*emptypb.Empty, error)
- func (UnimplementedUserServer) PublicKey(*PublicKeyRequest, User_PublicKeyServer) error
- func (UnimplementedUserServer) Tokens(*emptypb.Empty, User_TokensServer) error
- type UnsafeAuthenticationServer
- type UnsafeGroupsServer
- type UnsafeMessagingServer
- type UnsafeUserServer
- type UserClient
- type UserServer
- type User_PublicKeyClient
- type User_PublicKeyServer
- type User_TokensClient
- type User_TokensServer
Constants ¶
This section is empty.
Variables ¶
var Authentication_ServiceDesc = grpc.ServiceDesc{ ServiceName: "auth.Authentication", HandlerType: (*AuthenticationServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Signup", Handler: _Authentication_Signup_Handler, }, { MethodName: "Finalise", Handler: _Authentication_Finalise_Handler, }, { MethodName: "Token", Handler: _Authentication_Token_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "auth.proto", }
Authentication_ServiceDesc is the grpc.ServiceDesc for Authentication service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var File_auth_proto protoreflect.FileDescriptor
var File_group_proto protoreflect.FileDescriptor
var File_messaging_proto protoreflect.FileDescriptor
var File_user_proto protoreflect.FileDescriptor
var Groups_ServiceDesc = grpc.ServiceDesc{ ServiceName: "group.Groups", HandlerType: (*GroupsServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Create", Handler: _Groups_Create_Handler, }, { MethodName: "Join", Handler: _Groups_Join_Handler, }, { MethodName: "Info", Handler: _Groups_Info_Handler, }, { MethodName: "Invite", Handler: _Groups_Invite_Handler, }, { MethodName: "PromoteUser", Handler: _Groups_PromoteUser_Handler, }, { MethodName: "DemoteUser", Handler: _Groups_DemoteUser_Handler, }, { MethodName: "Leave", Handler: _Groups_Leave_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "group.proto", }
Groups_ServiceDesc is the grpc.ServiceDesc for Groups service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var Messaging_ServiceDesc = grpc.ServiceDesc{ ServiceName: "messaging.Messaging", HandlerType: (*MessagingServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Send", Handler: _Messaging_Send_Handler, }, }, Streams: []grpc.StreamDesc{ { StreamName: "Subscribe", Handler: _Messaging_Subscribe_Handler, ServerStreams: true, }, }, Metadata: "messaging.proto", }
Messaging_ServiceDesc is the grpc.ServiceDesc for Messaging service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var User_ServiceDesc = grpc.ServiceDesc{ ServiceName: "user.User", HandlerType: (*UserServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "AddPublicKey", Handler: _User_AddPublicKey_Handler, }, { MethodName: "DelPublicKey", Handler: _User_DelPublicKey_Handler, }, { MethodName: "DelToken", Handler: _User_DelToken_Handler, }, }, Streams: []grpc.StreamDesc{ { StreamName: "Tokens", Handler: _User_Tokens_Handler, ServerStreams: true, }, { StreamName: "PublicKey", Handler: _User_PublicKey_Handler, ServerStreams: true, }, }, Metadata: "user.proto", }
User_ServiceDesc is the grpc.ServiceDesc for User service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterAuthenticationServer ¶
func RegisterAuthenticationServer(s grpc.ServiceRegistrar, srv AuthenticationServer)
func RegisterGroupsServer ¶
func RegisterGroupsServer(s grpc.ServiceRegistrar, srv GroupsServer)
func RegisterMessagingServer ¶
func RegisterMessagingServer(s grpc.ServiceRegistrar, srv MessagingServer)
func RegisterUserServer ¶
func RegisterUserServer(s grpc.ServiceRegistrar, srv UserServer)
Types ¶
type Auth ¶
type Auth struct { UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` Totp string `protobuf:"bytes,3,opt,name=totp,proto3" json:"totp,omitempty"` // contains filtered or unexported fields }
Auth encapsulates the information necessary to authenticate, specifically:
- User ID
- Password
- TOTP value
and is used in a number of places:
- To finalise signup; and
- To receive a new session token
func (*Auth) Descriptor
deprecated
func (*Auth) GetPassword ¶
func (*Auth) ProtoMessage ¶
func (*Auth) ProtoMessage()
func (*Auth) ProtoReflect ¶
func (x *Auth) ProtoReflect() protoreflect.Message
type AuthenticationClient ¶
type AuthenticationClient interface { // Signup accepts a new password and mints a new ID and OTP seed Signup(ctx context.Context, in *SignupRequest, opts ...grpc.CallOption) (*SignupResponse, error) // Finalise is used to finalise the signup flow, which it does by accepting // the minted ID and a valid OTP value. // // This call will return an error or nothing Finalise(ctx context.Context, in *Auth, opts ...grpc.CallOption) (*emptypb.Empty, error) // Token accepts a password and a valid OTP value, returning a new bearer // token which can be used in Subscribing to message stream Token(ctx context.Context, in *Auth, opts ...grpc.CallOption) (*TokenValue, error) }
AuthenticationClient is the client API for Authentication service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
func NewAuthenticationClient ¶
func NewAuthenticationClient(cc grpc.ClientConnInterface) AuthenticationClient
type AuthenticationServer ¶
type AuthenticationServer interface { // Signup accepts a new password and mints a new ID and OTP seed Signup(context.Context, *SignupRequest) (*SignupResponse, error) // Finalise is used to finalise the signup flow, which it does by accepting // the minted ID and a valid OTP value. // // This call will return an error or nothing Finalise(context.Context, *Auth) (*emptypb.Empty, error) // Token accepts a password and a valid OTP value, returning a new bearer // token which can be used in Subscribing to message stream Token(context.Context, *Auth) (*TokenValue, error) // contains filtered or unexported methods }
AuthenticationServer is the server API for Authentication service. All implementations must embed UnimplementedAuthenticationServer for forward compatibility
type DemoteRequest ¶
type DemoteRequest struct { GroupId string `protobuf:"bytes,1,opt,name=group_id,json=groupId,proto3" json:"group_id,omitempty"` Demotee string `protobuf:"bytes,2,opt,name=demotee,proto3" json:"demotee,omitempty"` // contains filtered or unexported fields }
DemoteRequest is used to demote a user (the demotee) to a group, from owner -> normal user, and normal user -> booted
The value of `demoter` is ignored when an invitation request comes from a non-peered connection. It is the responsibility of the server which recieves that first, non-peered/ relayed, request to set the demoter field to the originator of the call
func (*DemoteRequest) Descriptor
deprecated
func (*DemoteRequest) Descriptor() ([]byte, []int)
Deprecated: Use DemoteRequest.ProtoReflect.Descriptor instead.
func (*DemoteRequest) GetDemotee ¶
func (x *DemoteRequest) GetDemotee() string
func (*DemoteRequest) GetGroupId ¶
func (x *DemoteRequest) GetGroupId() string
func (*DemoteRequest) ProtoMessage ¶
func (*DemoteRequest) ProtoMessage()
func (*DemoteRequest) ProtoReflect ¶
func (x *DemoteRequest) ProtoReflect() protoreflect.Message
func (*DemoteRequest) Reset ¶
func (x *DemoteRequest) Reset()
func (*DemoteRequest) String ¶
func (x *DemoteRequest) String() string
type Group ¶
type Group struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Owners []string `protobuf:"bytes,2,rep,name=owners,proto3" json:"owners,omitempty"` Members []string `protobuf:"bytes,3,rep,name=members,proto3" json:"members,omitempty"` IsOpen bool `protobuf:"varint,4,opt,name=is_open,json=isOpen,proto3" json:"is_open,omitempty"` IsBroadcast bool `protobuf:"varint,5,opt,name=is_broadcast,json=isBroadcast,proto3" json:"is_broadcast,omitempty"` // contains filtered or unexported fields }
Group is used for creating and reading groups; with the following caveats:
- The ID field is ignored when creating a new group; group IDs are minted serverside (in much the same way user IDs are)
func (*Group) Descriptor
deprecated
func (*Group) GetIsBroadcast ¶
func (*Group) GetMembers ¶
func (*Group) ProtoMessage ¶
func (*Group) ProtoMessage()
func (*Group) ProtoReflect ¶
func (x *Group) ProtoReflect() protoreflect.Message
type GroupsClient ¶
type GroupsClient interface { // CreateGroup will create a group, setting the calling user as owner. // // This call is not federated; a user can only create a group on the // server their account is hosted on Create(ctx context.Context, in *Group, opts ...grpc.CallOption) (*Group, error) // Join accepts a group_id (and, when from a federared peer, a joiner) // and tries to add a user to the members list of that group Join(ctx context.Context, in *JoinRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) // Group returns information about a group, such as owners and members Info(ctx context.Context, in *InfoRequest, opts ...grpc.CallOption) (*Group, error) // InviteToGroup allows group owners to invite users to a group Invite(ctx context.Context, in *InviteRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) // PromoteUser allows a group owner to make another user an owner PromoteUser(ctx context.Context, in *PromoteRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) // DemoteUser allows a group owner to demote another owner to // regular user, or to boot a regular user from the group DemoteUser(ctx context.Context, in *DemoteRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) // LeaveGroup allows a user to leave a group Leave(ctx context.Context, in *LeaveRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) }
GroupsClient is the client API for Groups service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
func NewGroupsClient ¶
func NewGroupsClient(cc grpc.ClientConnInterface) GroupsClient
type GroupsServer ¶
type GroupsServer interface { // CreateGroup will create a group, setting the calling user as owner. // // This call is not federated; a user can only create a group on the // server their account is hosted on Create(context.Context, *Group) (*Group, error) // Join accepts a group_id (and, when from a federared peer, a joiner) // and tries to add a user to the members list of that group Join(context.Context, *JoinRequest) (*emptypb.Empty, error) // Group returns information about a group, such as owners and members Info(context.Context, *InfoRequest) (*Group, error) // InviteToGroup allows group owners to invite users to a group Invite(context.Context, *InviteRequest) (*emptypb.Empty, error) // PromoteUser allows a group owner to make another user an owner PromoteUser(context.Context, *PromoteRequest) (*emptypb.Empty, error) // DemoteUser allows a group owner to demote another owner to // regular user, or to boot a regular user from the group DemoteUser(context.Context, *DemoteRequest) (*emptypb.Empty, error) // LeaveGroup allows a user to leave a group Leave(context.Context, *LeaveRequest) (*emptypb.Empty, error) // contains filtered or unexported methods }
GroupsServer is the server API for Groups service. All implementations must embed UnimplementedGroupsServer for forward compatibility
type InfoRequest ¶
type InfoRequest struct { GroupId string `protobuf:"bytes,1,opt,name=group_id,json=groupId,proto3" json:"group_id,omitempty"` // contains filtered or unexported fields }
InfoRequest is used to retrieve a group. Clients need only set the value of group_id. When a prattle server relays an InfoRequest to a peer, the relaying server must set the value of requester to the ID of the originator of the call
func (*InfoRequest) Descriptor
deprecated
func (*InfoRequest) Descriptor() ([]byte, []int)
Deprecated: Use InfoRequest.ProtoReflect.Descriptor instead.
func (*InfoRequest) GetGroupId ¶
func (x *InfoRequest) GetGroupId() string
func (*InfoRequest) ProtoMessage ¶
func (*InfoRequest) ProtoMessage()
func (*InfoRequest) ProtoReflect ¶
func (x *InfoRequest) ProtoReflect() protoreflect.Message
func (*InfoRequest) Reset ¶
func (x *InfoRequest) Reset()
func (*InfoRequest) String ¶
func (x *InfoRequest) String() string
type InviteRequest ¶
type InviteRequest struct { GroupId string `protobuf:"bytes,1,opt,name=group_id,json=groupId,proto3" json:"group_id,omitempty"` Invitee string `protobuf:"bytes,2,opt,name=invitee,proto3" json:"invitee,omitempty"` // contains filtered or unexported fields }
InviteRequest is used to invite a user (the invitee) to a group.
func (*InviteRequest) Descriptor
deprecated
func (*InviteRequest) Descriptor() ([]byte, []int)
Deprecated: Use InviteRequest.ProtoReflect.Descriptor instead.
func (*InviteRequest) GetGroupId ¶
func (x *InviteRequest) GetGroupId() string
func (*InviteRequest) GetInvitee ¶
func (x *InviteRequest) GetInvitee() string
func (*InviteRequest) ProtoMessage ¶
func (*InviteRequest) ProtoMessage()
func (*InviteRequest) ProtoReflect ¶
func (x *InviteRequest) ProtoReflect() protoreflect.Message
func (*InviteRequest) Reset ¶
func (x *InviteRequest) Reset()
func (*InviteRequest) String ¶
func (x *InviteRequest) String() string
type JoinRequest ¶
type JoinRequest struct { GroupId string `protobuf:"bytes,1,opt,name=group_id,json=groupId,proto3" json:"group_id,omitempty"` Joiner string `protobuf:"bytes,2,opt,name=joiner,proto3" json:"joiner,omitempty"` // contains filtered or unexported fields }
JoinRequest is used to join a group. Clients need only set the value of group_id. When a prattle server relays a JoinRequest to a peer, the relaying server must set the value of joiner to the ID of the originator of the call
func (*JoinRequest) Descriptor
deprecated
func (*JoinRequest) Descriptor() ([]byte, []int)
Deprecated: Use JoinRequest.ProtoReflect.Descriptor instead.
func (*JoinRequest) GetGroupId ¶
func (x *JoinRequest) GetGroupId() string
func (*JoinRequest) GetJoiner ¶
func (x *JoinRequest) GetJoiner() string
func (*JoinRequest) ProtoMessage ¶
func (*JoinRequest) ProtoMessage()
func (*JoinRequest) ProtoReflect ¶
func (x *JoinRequest) ProtoReflect() protoreflect.Message
func (*JoinRequest) Reset ¶
func (x *JoinRequest) Reset()
func (*JoinRequest) String ¶
func (x *JoinRequest) String() string
type LeaveRequest ¶
type LeaveRequest struct { GroupId string `protobuf:"bytes,1,opt,name=group_id,json=groupId,proto3" json:"group_id,omitempty"` Leaver string `protobuf:"bytes,2,opt,name=leaver,proto3" json:"leaver,omitempty"` // contains filtered or unexported fields }
LeaveRequest is used to leave a group. Clients need only set the value of group_id. When a prattle server relays an LeaveRequest to a peer, the relaying server must set the value of leaver to the ID of the originator of the call
func (*LeaveRequest) Descriptor
deprecated
func (*LeaveRequest) Descriptor() ([]byte, []int)
Deprecated: Use LeaveRequest.ProtoReflect.Descriptor instead.
func (*LeaveRequest) GetGroupId ¶
func (x *LeaveRequest) GetGroupId() string
func (*LeaveRequest) GetLeaver ¶
func (x *LeaveRequest) GetLeaver() string
func (*LeaveRequest) ProtoMessage ¶
func (*LeaveRequest) ProtoMessage()
func (*LeaveRequest) ProtoReflect ¶
func (x *LeaveRequest) ProtoReflect() protoreflect.Message
func (*LeaveRequest) Reset ¶
func (x *LeaveRequest) Reset()
func (*LeaveRequest) String ¶
func (x *LeaveRequest) String() string
type Message ¶
type Message struct { Datetime *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=datetime,proto3" json:"datetime,omitempty"` Body []byte `protobuf:"bytes,2,opt,name=body,proto3" json:"body,omitempty"` Mimetype string `protobuf:"bytes,3,opt,name=mimetype,proto3" json:"mimetype,omitempty"` // contains filtered or unexported fields }
Message holds a minimum amount of metadata for a message, plus arbitrary body.
This message is expected to be marshalled to text, encrypted with the recipient's public key(s) and then added to a MessageWrapper before being sent to a user
func (*Message) Descriptor
deprecated
func (*Message) GetDatetime ¶
func (x *Message) GetDatetime() *timestamppb.Timestamp
func (*Message) GetMimetype ¶
func (*Message) ProtoMessage ¶
func (*Message) ProtoMessage()
func (*Message) ProtoReflect ¶
func (x *Message) ProtoReflect() protoreflect.Message
type MessageWrapper ¶
type MessageWrapper struct { Recipient *Subject `protobuf:"bytes,1,opt,name=recipient,proto3" json:"recipient,omitempty"` Sender *Subject `protobuf:"bytes,2,opt,name=sender,proto3" json:"sender,omitempty"` Encoded []byte `protobuf:"bytes,3,opt,name=encoded,proto3" json:"encoded,omitempty"` // contains filtered or unexported fields }
MessageWrappper wraps an encoded/ encrypted message to be forwarded to a recipient
Encoded is expected to be formed by taking a 'Message' and encypting it with the recipient's public key. Because of this, that message is where all of the important and useful metadatas are stored, such as sender.
While the existence of the Sender field makes it easy to log and track who is sending messages where, it does allow us to check permissions more easily, and it does allow us to ensure senders are not spoofed in payloads.
That being said, a user sending a message to another user on the same domain may omit the Sender field; in this instance, the sender can be derived from the authentication data associated with a user's token
When sending a message to a user in a group, the field 'for' should be set the the group name. It is the client's responsibility to match this field with the recipient field in a decoded, decrypted 'Message' to ensure it matches the 'for' field when the value of Message.Recipient is a group
func (*MessageWrapper) Descriptor
deprecated
func (*MessageWrapper) Descriptor() ([]byte, []int)
Deprecated: Use MessageWrapper.ProtoReflect.Descriptor instead.
func (*MessageWrapper) GetEncoded ¶
func (x *MessageWrapper) GetEncoded() []byte
func (*MessageWrapper) GetRecipient ¶
func (x *MessageWrapper) GetRecipient() *Subject
func (*MessageWrapper) GetSender ¶
func (x *MessageWrapper) GetSender() *Subject
func (*MessageWrapper) ProtoMessage ¶
func (*MessageWrapper) ProtoMessage()
func (*MessageWrapper) ProtoReflect ¶
func (x *MessageWrapper) ProtoReflect() protoreflect.Message
func (*MessageWrapper) Reset ¶
func (x *MessageWrapper) Reset()
func (*MessageWrapper) String ¶
func (x *MessageWrapper) String() string
type MessagingClient ¶
type MessagingClient interface { // Send accepts an encoded/ wrapped message and sends it to a user Send(ctx context.Context, in *MessageWrapper, opts ...grpc.CallOption) (*emptypb.Empty, error) // Subscribe is used to provide a stream to receive a user's messages // User's must only call Subscribe on the prattle instance which owns/ // hosts their account. // // Server implementations must return an error if a user tries to subscribe // to an account which is not on the domain it owns Subscribe(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (Messaging_SubscribeClient, error) }
MessagingClient is the client API for Messaging service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
func NewMessagingClient ¶
func NewMessagingClient(cc grpc.ClientConnInterface) MessagingClient
type MessagingServer ¶
type MessagingServer interface { // Send accepts an encoded/ wrapped message and sends it to a user Send(context.Context, *MessageWrapper) (*emptypb.Empty, error) // Subscribe is used to provide a stream to receive a user's messages // User's must only call Subscribe on the prattle instance which owns/ // hosts their account. // // Server implementations must return an error if a user tries to subscribe // to an account which is not on the domain it owns Subscribe(*emptypb.Empty, Messaging_SubscribeServer) error // contains filtered or unexported methods }
MessagingServer is the server API for Messaging service. All implementations must embed UnimplementedMessagingServer for forward compatibility
type Messaging_SubscribeClient ¶
type Messaging_SubscribeClient interface { Recv() (*MessageWrapper, error) grpc.ClientStream }
type Messaging_SubscribeServer ¶
type Messaging_SubscribeServer interface { Send(*MessageWrapper) error grpc.ServerStream }
type PromoteRequest ¶
type PromoteRequest struct { GroupId string `protobuf:"bytes,1,opt,name=group_id,json=groupId,proto3" json:"group_id,omitempty"` Promotee string `protobuf:"bytes,2,opt,name=promotee,proto3" json:"promotee,omitempty"` // contains filtered or unexported fields }
PromoteRequest is used to promote a user (the promotee) within a group, from a normal member to a owner
The value of `promoter` is ignored when an invitation request comes from a non-peered connection. It is the responsibility of the server which recieves that first, non-peered/ relayed, request to set the promoter field to the originator of the call
func (*PromoteRequest) Descriptor
deprecated
func (*PromoteRequest) Descriptor() ([]byte, []int)
Deprecated: Use PromoteRequest.ProtoReflect.Descriptor instead.
func (*PromoteRequest) GetGroupId ¶
func (x *PromoteRequest) GetGroupId() string
func (*PromoteRequest) GetPromotee ¶
func (x *PromoteRequest) GetPromotee() string
func (*PromoteRequest) ProtoMessage ¶
func (*PromoteRequest) ProtoMessage()
func (*PromoteRequest) ProtoReflect ¶
func (x *PromoteRequest) ProtoReflect() protoreflect.Message
func (*PromoteRequest) Reset ¶
func (x *PromoteRequest) Reset()
func (*PromoteRequest) String ¶
func (x *PromoteRequest) String() string
type PublicKeyRequest ¶
type PublicKeyRequest struct { Owner *Subject `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` // contains filtered or unexported fields }
PublicKey is used when looking up the relevant public keys for a user, especially when looking up a user in a group
func (*PublicKeyRequest) Descriptor
deprecated
func (*PublicKeyRequest) Descriptor() ([]byte, []int)
Deprecated: Use PublicKeyRequest.ProtoReflect.Descriptor instead.
func (*PublicKeyRequest) GetOwner ¶
func (x *PublicKeyRequest) GetOwner() *Subject
func (*PublicKeyRequest) GetValue ¶
func (x *PublicKeyRequest) GetValue() string
func (*PublicKeyRequest) ProtoMessage ¶
func (*PublicKeyRequest) ProtoMessage()
func (*PublicKeyRequest) ProtoReflect ¶
func (x *PublicKeyRequest) ProtoReflect() protoreflect.Message
func (*PublicKeyRequest) Reset ¶
func (x *PublicKeyRequest) Reset()
func (*PublicKeyRequest) String ¶
func (x *PublicKeyRequest) String() string
type PublicKeyValue ¶
type PublicKeyValue struct { Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` UserId string `protobuf:"bytes,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // contains filtered or unexported fields }
PublicKey contains data associated with Public Keys
func (*PublicKeyValue) Descriptor
deprecated
func (*PublicKeyValue) Descriptor() ([]byte, []int)
Deprecated: Use PublicKeyValue.ProtoReflect.Descriptor instead.
func (*PublicKeyValue) GetUserId ¶
func (x *PublicKeyValue) GetUserId() string
func (*PublicKeyValue) GetValue ¶
func (x *PublicKeyValue) GetValue() string
func (*PublicKeyValue) ProtoMessage ¶
func (*PublicKeyValue) ProtoMessage()
func (*PublicKeyValue) ProtoReflect ¶
func (x *PublicKeyValue) ProtoReflect() protoreflect.Message
func (*PublicKeyValue) Reset ¶
func (x *PublicKeyValue) Reset()
func (*PublicKeyValue) String ¶
func (x *PublicKeyValue) String() string
type SignupRequest ¶
type SignupRequest struct { Password string `protobuf:"bytes,1,opt,name=password,proto3" json:"password,omitempty"` // contains filtered or unexported fields }
SignupRequest contains a password to be used during Signup
This message could be merged with OTPAndKey, but it makes a certain amount of sense to keep this small, explicit, and less complex by making it only used in a single place
func (*SignupRequest) Descriptor
deprecated
func (*SignupRequest) Descriptor() ([]byte, []int)
Deprecated: Use SignupRequest.ProtoReflect.Descriptor instead.
func (*SignupRequest) GetPassword ¶
func (x *SignupRequest) GetPassword() string
func (*SignupRequest) ProtoMessage ¶
func (*SignupRequest) ProtoMessage()
func (*SignupRequest) ProtoReflect ¶
func (x *SignupRequest) ProtoReflect() protoreflect.Message
func (*SignupRequest) Reset ¶
func (x *SignupRequest) Reset()
func (*SignupRequest) String ¶
func (x *SignupRequest) String() string
type SignupResponse ¶
type SignupResponse struct { UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` TotpSeed string `protobuf:"bytes,2,opt,name=totp_seed,json=totpSeed,proto3" json:"totp_seed,omitempty"` // contains filtered or unexported fields }
SignupResponse contains the information necessary to connect to a Proxy; namely: the user's new ID (including domain name information), and a value which can seed an OTP app/authenticator/etc. to act as a password.
func (*SignupResponse) Descriptor
deprecated
func (*SignupResponse) Descriptor() ([]byte, []int)
Deprecated: Use SignupResponse.ProtoReflect.Descriptor instead.
func (*SignupResponse) GetTotpSeed ¶
func (x *SignupResponse) GetTotpSeed() string
func (*SignupResponse) GetUserId ¶
func (x *SignupResponse) GetUserId() string
func (*SignupResponse) ProtoMessage ¶
func (*SignupResponse) ProtoMessage()
func (*SignupResponse) ProtoReflect ¶
func (x *SignupResponse) ProtoReflect() protoreflect.Message
func (*SignupResponse) Reset ¶
func (x *SignupResponse) Reset()
func (*SignupResponse) String ¶
func (x *SignupResponse) String() string
type Subject ¶
type Subject struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` GroupId string `protobuf:"bytes,2,opt,name=group_id,json=groupId,proto3" json:"group_id,omitempty"` // contains filtered or unexported fields }
Subject holds the necessary data for a prattle instance to determine not only the recipient of a message, but whether or not a sender can send a message to this recipient.
Additionally, it forms the subject of a public key lookup.
Specifically, in the case of sending to a group, it contains both the UserId of the recipient, and the GroupId that this message is being sent on behalf of. See messaging.Send for more information on why this is.
Direct messages may ignore the field group_id - prattle implementations should ignore this value (rather than error if set).
func (*Subject) Descriptor
deprecated
func (*Subject) GetGroupId ¶
func (*Subject) ProtoMessage ¶
func (*Subject) ProtoMessage()
func (*Subject) ProtoReflect ¶
func (x *Subject) ProtoReflect() protoreflect.Message
type TokenValue ¶
type TokenValue struct { Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` // contains filtered or unexported fields }
Token contains a session token, used during Subscribe, Send, and public key operations
func (*TokenValue) Descriptor
deprecated
func (*TokenValue) Descriptor() ([]byte, []int)
Deprecated: Use TokenValue.ProtoReflect.Descriptor instead.
func (*TokenValue) GetValue ¶
func (x *TokenValue) GetValue() string
func (*TokenValue) ProtoMessage ¶
func (*TokenValue) ProtoMessage()
func (*TokenValue) ProtoReflect ¶
func (x *TokenValue) ProtoReflect() protoreflect.Message
func (*TokenValue) Reset ¶
func (x *TokenValue) Reset()
func (*TokenValue) String ¶
func (x *TokenValue) String() string
type UnimplementedAuthenticationServer ¶
type UnimplementedAuthenticationServer struct { }
UnimplementedAuthenticationServer must be embedded to have forward compatible implementations.
func (UnimplementedAuthenticationServer) Signup ¶
func (UnimplementedAuthenticationServer) Signup(context.Context, *SignupRequest) (*SignupResponse, error)
func (UnimplementedAuthenticationServer) Token ¶
func (UnimplementedAuthenticationServer) Token(context.Context, *Auth) (*TokenValue, error)
type UnimplementedGroupsServer ¶
type UnimplementedGroupsServer struct { }
UnimplementedGroupsServer must be embedded to have forward compatible implementations.
func (UnimplementedGroupsServer) DemoteUser ¶
func (UnimplementedGroupsServer) DemoteUser(context.Context, *DemoteRequest) (*emptypb.Empty, error)
func (UnimplementedGroupsServer) Info ¶
func (UnimplementedGroupsServer) Info(context.Context, *InfoRequest) (*Group, error)
func (UnimplementedGroupsServer) Invite ¶
func (UnimplementedGroupsServer) Invite(context.Context, *InviteRequest) (*emptypb.Empty, error)
func (UnimplementedGroupsServer) Join ¶
func (UnimplementedGroupsServer) Join(context.Context, *JoinRequest) (*emptypb.Empty, error)
func (UnimplementedGroupsServer) Leave ¶
func (UnimplementedGroupsServer) Leave(context.Context, *LeaveRequest) (*emptypb.Empty, error)
func (UnimplementedGroupsServer) PromoteUser ¶
func (UnimplementedGroupsServer) PromoteUser(context.Context, *PromoteRequest) (*emptypb.Empty, error)
type UnimplementedMessagingServer ¶
type UnimplementedMessagingServer struct { }
UnimplementedMessagingServer must be embedded to have forward compatible implementations.
func (UnimplementedMessagingServer) Send ¶
func (UnimplementedMessagingServer) Send(context.Context, *MessageWrapper) (*emptypb.Empty, error)
func (UnimplementedMessagingServer) Subscribe ¶
func (UnimplementedMessagingServer) Subscribe(*emptypb.Empty, Messaging_SubscribeServer) error
type UnimplementedUserServer ¶
type UnimplementedUserServer struct { }
UnimplementedUserServer must be embedded to have forward compatible implementations.
func (UnimplementedUserServer) AddPublicKey ¶
func (UnimplementedUserServer) AddPublicKey(context.Context, *PublicKeyValue) (*emptypb.Empty, error)
func (UnimplementedUserServer) DelPublicKey ¶
func (UnimplementedUserServer) DelPublicKey(context.Context, *PublicKeyValue) (*emptypb.Empty, error)
func (UnimplementedUserServer) DelToken ¶
func (UnimplementedUserServer) DelToken(context.Context, *TokenValue) (*emptypb.Empty, error)
func (UnimplementedUserServer) PublicKey ¶
func (UnimplementedUserServer) PublicKey(*PublicKeyRequest, User_PublicKeyServer) error
func (UnimplementedUserServer) Tokens ¶
func (UnimplementedUserServer) Tokens(*emptypb.Empty, User_TokensServer) error
type UnsafeAuthenticationServer ¶
type UnsafeAuthenticationServer interface {
// contains filtered or unexported methods
}
UnsafeAuthenticationServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to AuthenticationServer will result in compilation errors.
type UnsafeGroupsServer ¶
type UnsafeGroupsServer interface {
// contains filtered or unexported methods
}
UnsafeGroupsServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to GroupsServer will result in compilation errors.
type UnsafeMessagingServer ¶
type UnsafeMessagingServer interface {
// contains filtered or unexported methods
}
UnsafeMessagingServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to MessagingServer will result in compilation errors.
type UnsafeUserServer ¶
type UnsafeUserServer interface {
// contains filtered or unexported methods
}
UnsafeUserServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to UserServer will result in compilation errors.
type UserClient ¶
type UserClient interface { // AddPublicKey adds a new public key for a user. A user can have up to n public // keys, where n is configured on the proxy. // // Where n is too few, a user is limited by the number of clients they can connect // with. // Where n is too high, the cost of sending a user a message becomes high, as does // receiving _for_ that user AddPublicKey(ctx context.Context, in *PublicKeyValue, opts ...grpc.CallOption) (*emptypb.Empty, error) // DelPublicKey removes a Public Key from the calling user DelPublicKey(ctx context.Context, in *PublicKeyValue, opts ...grpc.CallOption) (*emptypb.Empty, error) // Tokens returns a user's current tokens for audit/ removal Tokens(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (User_TokensClient, error) // DelToken invalidates a token for a user DelToken(ctx context.Context, in *TokenValue, opts ...grpc.CallOption) (*emptypb.Empty, error) // PublicKey retrieves the public keys of a user. This is a federated endpoint. // // A prattle implementation must accept and return valid keys: // 1. When both the sender and recipient are on the same host // 2. When the sender is on a federated peer and the recipient is on this host // 3. When the sender is local and the recipient is peered // 4. When both sender and recipient are peered // // Why case 4? Because when we send a message which on behalf of a group // on a peered server, a case exists where our server is not peered directly // the host that hosts another member of that same group. Thus, we wont be able // to send a message which that user can read. // // Since we relay messages through the owner server of a group anyway, we must // also do the same for keys PublicKey(ctx context.Context, in *PublicKeyRequest, opts ...grpc.CallOption) (User_PublicKeyClient, error) }
UserClient is the client API for User service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
func NewUserClient ¶
func NewUserClient(cc grpc.ClientConnInterface) UserClient
type UserServer ¶
type UserServer interface { // AddPublicKey adds a new public key for a user. A user can have up to n public // keys, where n is configured on the proxy. // // Where n is too few, a user is limited by the number of clients they can connect // with. // Where n is too high, the cost of sending a user a message becomes high, as does // receiving _for_ that user AddPublicKey(context.Context, *PublicKeyValue) (*emptypb.Empty, error) // DelPublicKey removes a Public Key from the calling user DelPublicKey(context.Context, *PublicKeyValue) (*emptypb.Empty, error) // Tokens returns a user's current tokens for audit/ removal Tokens(*emptypb.Empty, User_TokensServer) error // DelToken invalidates a token for a user DelToken(context.Context, *TokenValue) (*emptypb.Empty, error) // PublicKey retrieves the public keys of a user. This is a federated endpoint. // // A prattle implementation must accept and return valid keys: // 1. When both the sender and recipient are on the same host // 2. When the sender is on a federated peer and the recipient is on this host // 3. When the sender is local and the recipient is peered // 4. When both sender and recipient are peered // // Why case 4? Because when we send a message which on behalf of a group // on a peered server, a case exists where our server is not peered directly // the host that hosts another member of that same group. Thus, we wont be able // to send a message which that user can read. // // Since we relay messages through the owner server of a group anyway, we must // also do the same for keys PublicKey(*PublicKeyRequest, User_PublicKeyServer) error // contains filtered or unexported methods }
UserServer is the server API for User service. All implementations must embed UnimplementedUserServer for forward compatibility
type User_PublicKeyClient ¶
type User_PublicKeyClient interface { Recv() (*PublicKeyValue, error) grpc.ClientStream }
type User_PublicKeyServer ¶
type User_PublicKeyServer interface { Send(*PublicKeyValue) error grpc.ServerStream }
type User_TokensClient ¶
type User_TokensClient interface { Recv() (*TokenValue, error) grpc.ClientStream }
type User_TokensServer ¶
type User_TokensServer interface { Send(*TokenValue) error grpc.ServerStream }