Documentation ¶
Index ¶
- Constants
- Variables
- func ComposeCompressedRM(fromSigner MessageSigner, rm interface{}, zlibLevel int) ([]byte, error)
- func ComposeRM(fromSigner MessageSigner, rm interface{}) ([]byte, error)
- func ComposeRMO(rm interface{}, zlibLevel int) ([]byte, error)
- func DecryptOOB(packed []byte, key *zkidentity.FixedSizeSntrupPrivateKey, ...) (interface{}, error)
- func EncryptRMO(x interface{}, theirKey *zkidentity.FixedSizeSntrupPublicKey, zlibLevel int) ([]byte, error)
- func EstimateRoutedRMWireSize(compressedRMSize int) int
- func IsPostStatus(attrs map[string]string) bool
- func MarshalOOBPublicIdentityInvite(pii *OOBPublicIdentityInvite) ([]byte, error)
- func MaxMsgSizeForVersion(v MaxMsgSizeVersion) uint
- func MaxPayloadSizeForVersion(v MaxMsgSizeVersion) uint
- func NewFullRatchetKX(ourPrivKey *zkidentity.FixedSizeSntrupPrivateKey, ...) (*ratchet.Ratchet, *ratchet.KeyExchange, error)
- func NewHalfRatchetKX(ourPrivKey *zkidentity.FixedSizeSntrupPrivateKey, ...) (*ratchet.Ratchet, *ratchet.KeyExchange, error)
- func ParseErrUnpaidSubscriptionRV(s string) error
- func SetLog(v slog.Logger)
- type Acknowledge
- type ErrUnpaidSubscriptionRV
- type FileManifest
- type FileMetadata
- type GetInvoice
- type GetInvoiceAction
- type GetInvoiceReply
- type InviteFunds
- type MaxMsgSizeVersion
- type Message
- type MessageMode
- type MessageSigner
- type MessageVerifier
- type OOBPublicIdentityInvite
- func CreateOOBPublicIdentityInvite(pi zkidentity.PublicIdentity) (*OOBPublicIdentityInvite, error)
- func DecryptOOBPublicIdentityInvite(packed []byte, key *zkidentity.FixedSizeSntrupPrivateKey, ...) (*OOBPublicIdentityInvite, error)
- func UnmarshalOOBPublicIdentityInviteFile(filename string) (*OOBPublicIdentityInvite, error)
- type Ping
- type Pong
- type PostListItem
- type PostMetadata
- type PostMetadataStatus
- type PushRoutedMessage
- type RMBlock
- type RMFTGet
- type RMFTGetChunk
- type RMFTGetChunkReply
- type RMFTGetReply
- type RMFTList
- type RMFTListReply
- type RMFTPayForChunk
- type RMFTSendFile
- type RMFetchResource
- type RMFetchResourceReply
- type RMGetInvoice
- type RMGetPost
- type RMGroupInvite
- type RMGroupJoin
- type RMGroupKick
- type RMGroupKill
- type RMGroupList
- type RMGroupMessage
- type RMGroupPart
- type RMGroupUpdateAdmins
- type RMGroupUpgradeVersion
- type RMHandshakeACK
- type RMHandshakeSYN
- type RMHandshakeSYNACK
- type RMHeader
- type RMInvite
- type RMInvoice
- type RMKXSearch
- type RMKXSearchRef
- type RMKXSearchRefType
- type RMKXSearchReply
- type RMKXSuggestion
- type RMListPosts
- type RMListPostsReply
- type RMMediateIdentity
- type RMOFullKX
- type RMOHalfKX
- type RMOHeader
- type RMPostGet
- type RMPostGetReply
- type RMPostShare
- type RMPostStatus
- type RMPostStatusReply
- type RMPostsSubscribe
- type RMPostsSubscribeReply
- type RMPostsUnsubscribe
- type RMPostsUnsubscribeReply
- type RMPrivateMessage
- type RMProfileUpdate
- type RMReceiptDomain
- type RMReceiveReceipt
- type RMTransitiveMessage
- type RMTransitiveMessageForward
- type RMTransitiveMessageReply
- type RMTransitiveReset
- type RMTransitiveResetReply
- type RMUser
- type RMUserReply
- type ResourceStatus
- type ResourceTag
- type RouteMessage
- type RouteMessageReply
- type ServerProperty
- type SubscribeRoutedMessages
- type SubscribeRoutedMessagesReply
- type TxHash
- type Welcome
Constants ¶
const ( RMHeaderVersion = 1 // Use NoCompression by default RMDefaultCompressionLevel = zlib.NoCompression )
Header that describes the payload that follows.
const ( RMCPrivateMessage = "pm" RMPrivateMessageModeNormal = 0 RMPrivateMessageModeMe = 1 // XXX not rigged up yet )
Private message to other client
const ( ResourceStatusOk = 200 ResourceStatusBadRequest = 400 ResourceStatusNotFound = 404 )
const ( RMCHandshakeSYN = "handshakesyn" RMCHandshakeSYNACK = "handshakesynack" RMCHandshakeACK = "handshakeack" )
const ( RMCFTList = "ftls" RMFTDGlobal = "global" // Globally accessible files )
const ( RMUDescription = "description" // User description RMUAway = "away" // User away message RMUProfilePicture = "profilepicture" // User profile picture )
const ( RMPSHeart = "heart" // Heart a post RMPSComment = "comment" // Comment on a post RMPSHeartYes = "1" // +1 heart RMPSHeartNo = "0" // -1 heart )
const ( RMPVersion = "version" // Post version RMPIdentifier = "identifier" // Post identifier RMPDescription = "description" // Post description RMPMain = "main" // Main post body RMPTitle = "title" // Title of the post RMPAttachment = "attachment" // Attached file to the post RMPStatusFrom = "statusfrom" // Status/post update from (author) RMPSignature = "signature" // Signature for the post/status RMPParent = "parent" // Parent status/post RMPStatusID = "statusid" // Status ID in status updates RMPNonce = "nonce" // Random nonce to avoid equal hashes RMPFromNick = "from_nick" // Nick of origin for post/status RMPTimestamp = "timestamp" // Timestamp of the status update )
const ( // pre session phase InitialCmdIdentify = "identify" InitialCmdSession = "session" // session phase SessionCmdWelcome = "welcome" // tagged server commands TaggedCmdAcknowledge = "ack" TaggedCmdPing = "ping" TaggedCmdPong = "pong" // payment cmds TaggedCmdGetInvoice = "getinvoice" TaggedCmdGetInvoiceReply = "getinvoicereply" TaggedCmdRouteMessage = "routemessage" TaggedCmdRouteMessageReply = "routemessagereply" TaggedCmdSubscribeRoutedMessages = "subscriberoutedmessages" TaggedCmdSubscribeRoutedMessagesReply = "subscriberoutedmessagesreply" TaggedCmdPushRoutedMessage = "pushroutedmessage" // misc MessageModeNormal MessageMode = 0 MessageModeMe MessageMode = 1 PaySchemeFree = "free" PaySchemeDCRLN = "dcrln" // PingLimit is how long to wait for a ping before disconnect. // DefaultPingInterval is how long to wait to send the next ping. DefaultPingInterval = 30 * time.Second // MaxChunkSize is the maximum size of a file chunk used in file // downloads. MaxChunkSize = 1024 * 1024 // 1 MiB // MinRMPushPayment is the minimum payment amount required to push a payment // to the server (in milliatoms). MinRMPushPayment uint64 = 1000 // InvoiceExpiryAffordance is the time before the expiry a client may // request a new invoice. InvoiceExpiryAffordance = 15 * time.Second )
const ( // Tag Depth is a required property. It defines maximum outstanding // commands. PropTagDepth = "tagdepth" PropTagDepthDefault = "10" // Server Time is a required property. It contains the server time // stamp. The client shall warn the user if the client is not time // synced. Clients and proxies really shall run NTP. PropServerTime = "servertime" // Payment Scheme is a required property. It defines whether the type // of payment that the server expects before routing messages. PropPaymentScheme = "payscheme" PropPaymentSchemeDefault = "free" // Push Payment rate is the required payment rate to push RMs when the // payment scheme is not free (in milli-atoms per byte). PropPushPaymentRate = "pushpayrate" PropPushPaymentRateDefault = 100 // MilliAtoms/byte // Sub payment rate is the required payment rate to sub to RVs when the // payment scheme is not free (in milli-atoms per byte). PropSubPaymentRate = "subpayrate" PropSubPaymentRateDefault = 1000 // MilliAtoms/sub // PropServerLNNode returns the node id of the server. PropServerLNNode = "serverlnnode" // PropExpirationDays is the number of days after which data is expired // from the server automatically. PropExpirationDays = "expirationdays" PropExpirationDaysDefault = 7 // PropPushPaymentLifetime is the maximum duration when a successful // payment for a push may be redeemed. After this duration, the push // needs to be paid for again. This value is in seconds. PropPushPaymentLifetime = "pushpaymentlifetime" PropPushPaymentLifetimeDefault = 60 * 60 * 24 // 24 hours // PropMaxPushInvoices is the maximum number of outstanding (unredeemed) // push invoices a connected client may request before needing to pay // for them. PropMaxPushInvoices = "maxpushinvoices" PropMaxPushInvoicesDefault = 8 // PropMaxMsgSizeVersion is the max message size version supported by // the server. PropMaxMsgSizeVersion = "maxmsgsizeversion" PropMaxMsgSizeVersionDefault = MaxMsgSizeV0 // PropPingLimit is the ping limit the server expects, after which it // will disconnect a client. PropPingLimit = "pinglimit" PropPingLimitDefault = 5 * time.Minute )
const FileMetadataVersion = 1
const OOBCPublicIdentityInvite = "oobpublicidentityinvite"
const PostMetadataStatusVersion = 1
const PostMetadataVersion = 1
const (
ProtocolVersion = 10
)
const RMCBlock = "block"
const RMCFTGet = "ftget"
const RMCFTGetChunk = "ftgetchunk"
const RMCFTGetChunkReply = "ftgetchunkreply"
const RMCFTGetReply = "ftgetreply"
const RMCFTListReply = "ftlsreply"
const RMCFTPayForChunk = "ftpayforchunk"
const RMCFTSendFile = "ftsendfile"
const RMCFetchResource = "fetchresource"
const RMCFetchResourceReply = "fetchresourcereply"
const RMCGetInvoice = "getinvoice"
const RMCGetPost = "getpost"
const RMCGroupInvite = "groupinvite"
const RMCGroupJoin = "groupjoin"
const RMCGroupKick = "groupkick"
const RMCGroupKill = "groupkill"
const RMCGroupList = "grouplist"
const RMCGroupMessage = "groupmessage"
const RMCGroupPart = "grouppart"
const RMCGroupUpgradeVersion = "groupupversion"
const RMCInvite = "invite"
const RMCInvoice = "invoice"
const RMCKXSearch = "kxsearch"
const RMCKXSearchReply = "kxsearchreply"
const RMCKXSuggestion = "kxsuggestion"
const RMCListPosts = "listposts"
const RMCListPostsReply = "listpostsreply"
const RMCMediateIdentity = "mediateidentity"
const RMCPostGet = "postget"
const RMCPostGetReply = "postgetreply"
const RMCPostStatus = "poststatus"
const RMCPostStatusReply = "poststatusreply"
const RMCPostsSubscribe = "postssubscribe"
const RMCPostsSubscribeReply = "postssubscribereply"
const RMCPostsUnsubscribe = "postsunsubscribe"
const RMCPostsUnsubscribeReply = "postsunsubscribereply"
const RMCProfileUpdate = "profileupdt"
RMCProfileUpdate is the command for a RMProfileUpdate.
const RMCReceiveReceipt = "recvreceipt"
RMCReceiveReceipt is the command for a RMReceiveReceipt value.
const RMCTransitiveMessage = "transitivemessage"
const RMCTransitiveMessageForward = "tmessageforward"
const RMCTransitiveMessageReply = "transitivemessagereply"
const RMCTransitiveReset = "transitivereset"
RMTransitiveReset ask proxy to forward reset message to another client.
const RMCTransitiveResetReply = "transitiveresetreply"
RMTransitiveResetReply ask proxy to forward reset message reply to another client.
const RMCUser = "user"
const RMCUserReply = "userreply"
const RMGCGroupUpdateAdmins = "groupupdateadmins"
const RMOCFullKX = "ofullkx"
const RMOCHalfKX = "ohalfkx"
const (
RMOHeaderVersion = 1
)
Following is the portion of the oob protocol which does travel over the wire.
Variables ¶
var ErrRMInvoicePayment = errors.New("invoice payment error on RM push")
ErrRMInvoicePayment is generated on servers when an RM push fails due to some payment check failure in the invoice.
Do not change this message as it's used in plain text across the C2S RPC interface.
var ErrUnableToGenerateInvoice = errors.New("unable to generate payment invoice")
ErrUnableToGenerateInvoice is generated on clients when they are unable to generate an invoice for a remote peer.
Do not change this message as it's used in plain text across the C2C RPC interface.
Functions ¶
func ComposeCompressedRM ¶
func ComposeCompressedRM(fromSigner MessageSigner, rm interface{}, zlibLevel int) ([]byte, error)
ComposeCompressedRM creates a blobified message that has a header and a payload that can then be encrypted and transmitted to the other side. The contents are zlib compressed with the specified level.
func ComposeRM ¶
func ComposeRM(fromSigner MessageSigner, rm interface{}) ([]byte, error)
ComposeRM creates a blobified message that has a header and a payload that can then be encrypted and transmitted to the other side.
func ComposeRMO ¶
ComposeRMO creates a blobified oob message that has a header and a payload that can then be encrypted and transmitted to the other side.
func DecryptOOB ¶
func DecryptOOB(packed []byte, key *zkidentity.FixedSizeSntrupPrivateKey, maxDecompressSize uint) (interface{}, error)
func EncryptRMO ¶
func EncryptRMO(x interface{}, theirKey *zkidentity.FixedSizeSntrupPublicKey, zlibLevel int) ([]byte, error)
EncryptRMO returns an encrypted blob from x. The returned blob is packed and prefixed with a sntrup ciphertext followed by an encrypted JSON objecti; or [sntrup ciphertext][encrypted JSON object].
func EstimateRoutedRMWireSize ¶ added in v0.1.3
EstimateRoutedRMWireSize estimates the final wire size of a compressed RM (with compression set to its lowest value, which effectively disables it).
func IsPostStatus ¶
IsPostStatus returns true when the map of attributes (possibly) corresponds to a post status update.
func MarshalOOBPublicIdentityInvite ¶
func MarshalOOBPublicIdentityInvite(pii *OOBPublicIdentityInvite) ([]byte, error)
MarshalOOBPublicIdentityInvite returns a JSON encoded OOBPublicIdentityInvite.
func MaxMsgSizeForVersion ¶ added in v0.1.10
func MaxMsgSizeForVersion(v MaxMsgSizeVersion) uint
MaxMsgSizeForVersion returns the max message size according to the given max message size version. It returns 0 for unknown versions.
func MaxPayloadSizeForVersion ¶ added in v0.1.10
func MaxPayloadSizeForVersion(v MaxMsgSizeVersion) uint
MaxPayloadSizeForVersion returns the (approximate) max payload size according to the given max message size version. It returns 0 for unknown versions.
It is approximate because due to encoding and compression, the actual payload may be slightly greater than this, but clients should not attempt to send more than this amount of data.
func NewFullRatchetKX ¶
func NewFullRatchetKX(ourPrivKey *zkidentity.FixedSizeSntrupPrivateKey, them zkidentity.PublicIdentity, halfKX *ratchet.KeyExchange) (*ratchet.Ratchet, *ratchet.KeyExchange, error)
NewFullRatchetKX creates a new full ratchet between two identities. It returns the completed full ratchet.
ourPrivKey should be the private key that corresponds to the local client's full identity.
func NewHalfRatchetKX ¶
func NewHalfRatchetKX(ourPrivKey *zkidentity.FixedSizeSntrupPrivateKey, them zkidentity.PublicIdentity) (*ratchet.Ratchet, *ratchet.KeyExchange, error)
NewHalfRatchetKX creates a new half ratchet between two identities. It returns the half ratchet and a random key exchange structure.
ourPrivKey should be the local client's private key from their full identity.
func ParseErrUnpaidSubscriptionRV ¶
ParseErrUnpaidSubscriptionRV attempts to parse a string as an ErrUnpaidSubscriptionRV. If this fails, it returns a nil error. If it succeeds, the return value is an instance of ErrUnpaidSubscriptionRV.
Types ¶
type Acknowledge ¶
Acknowledge is sent to acknowledge commands and Error is set if the command failed.
type ErrUnpaidSubscriptionRV ¶
ErrUnpaidSubscriptionRV is an error returned while attempting to subscribe to an RV that wasn't previously paid.
func (ErrUnpaidSubscriptionRV) Error ¶
func (err ErrUnpaidSubscriptionRV) Error() string
func (ErrUnpaidSubscriptionRV) Is ¶
func (err ErrUnpaidSubscriptionRV) Is(other error) bool
type FileManifest ¶
type FileMetadata ¶
type FileMetadata struct { Version uint64 `json:"version"` Cost uint64 `json:"cost"` Size uint64 `json:"size"` Directory string `json:"directory"` Filename string `json:"filename"` Description string `json:"description"` Hash string `json:"hash"` Manifest []FileManifest `json:"manifest"` // len == number of chunks Signature string `json:"signature"` Attributes map[string]string `json:"attributes,omitempty"` }
func (*FileMetadata) MetadataHash ¶
func (fm *FileMetadata) MetadataHash() [32]byte
MetadataHash calculates the hash of the metadata info. Note that the specific information that is hashed depends on the version of the metadata.
type GetInvoice ¶
type GetInvoice struct { PaymentScheme string // LN, on-chain, whatever Action GetInvoiceAction // push or subscribe }
type GetInvoiceAction ¶
type GetInvoiceAction string
GetInvoiceAction is the action the client wants to perform and needs an invoice for.
const ( InvoiceActionPush GetInvoiceAction = "push" InvoiceActionSub GetInvoiceAction = "sub" )
type GetInvoiceReply ¶
type GetInvoiceReply struct {
Invoice string // Depends on payment scheme
}
type InviteFunds ¶ added in v0.1.7
type MaxMsgSizeVersion ¶ added in v0.1.10
type MaxMsgSizeVersion uint
MaxMsgSizeVersion tracks defined versions of max msg size.
const ( // MaxMsgSizeV0 is the first version of the max size of a message. // This was determined as enough to contain a base64 encoded version of // 1MiB (1024*1024 bytes), along with the necessary overhead of // headers, encodings and frames needed by the encrypted routed // messages with some room to spare, when sending with compression // turned off. MaxMsgSizeV0 MaxMsgSizeVersion = 0 // MaxMsgSizeV1 is the second version of the max size of a message. // This was determined as enough to contain a base64 encoded version // of 10 MiB (10*1024*1024 bytes), along with the necessary overhead of // headers, encodings and frames needed by the encrypted routed mesasges // with some room to spare, when sending with compression turned off. MaxMsgSizeV1 MaxMsgSizeVersion = 1 )
type Message ¶
type Message struct { Command string // discriminator TimeStamp int64 // originator timestamp Cleartext bool // If set Payload is in clear text, proxy use only Tag uint32 // client generated tag, shall be unique }
Message is the generic command that flows between a server and client and vice versa. Its purpose is to add a discriminator to simplify payload decoding. Additionally it has a tag that the recipient shall return unmodified when replying. The tag is originated by the sender and shall be unique provided an answer is expected. The receiver shall not interpret or use the tag in any way. The Cleartext flag indicates that the payload is in clear text. This flag should only be used for proxy commands (e.g. ratchet reset).
type MessageMode ¶
type MessageMode uint32
type MessageSigner ¶ added in v0.2.0
type MessageSigner func(message []byte) zkidentity.FixedSizeSignature
type MessageVerifier ¶ added in v0.2.0
type MessageVerifier func(msg []byte, sig *zkidentity.FixedSizeSignature) bool
type OOBPublicIdentityInvite ¶
type OOBPublicIdentityInvite struct { Public zkidentity.PublicIdentity `json:"public"` InitialRendezvous zkidentity.ShortID `json:"initialrendezvous"` ResetRendezvous zkidentity.ShortID `json:"resetrendezvous"` Funds *InviteFunds `json:"funds,omitempty"` }
OOBPublicIdentityInvite is an unencrypted OOB command which contains all information to kick of an initial KX. This command is NOT part of the wire protocol. This is provided out-of-band. With this the other side can commence a KX by issuing a RMOCHalfKX command to the provided InitialRendezvous.
func CreateOOBPublicIdentityInvite ¶
func CreateOOBPublicIdentityInvite(pi zkidentity.PublicIdentity) (*OOBPublicIdentityInvite, error)
CreateOOBPublicIdentityInvite returns a OOBPublicIdentityInvite structure with a random initial and reset rendezvous.
func DecryptOOBPublicIdentityInvite ¶
func DecryptOOBPublicIdentityInvite(packed []byte, key *zkidentity.FixedSizeSntrupPrivateKey, maxDecompressSize uint) (*OOBPublicIdentityInvite, error)
func UnmarshalOOBPublicIdentityInviteFile ¶
func UnmarshalOOBPublicIdentityInviteFile(filename string) (*OOBPublicIdentityInvite, error)
UnmarshalOOBPublicIdentityInviteFile returns an OOBPublicIdentityInvite from a file.
type Ping ¶
type Ping struct{}
Ping is a PRPC that is used to determine if the server is alive. This command must be acknowledged by the remote side.
type PostListItem ¶
type PostListItem struct { ID zkidentity.ShortID `json:"id"` Title string `json:"title"` }
type PostMetadata ¶
type PostMetadata struct { Version uint64 `json:"version"` Attributes map[string]string `json:"attributes,omitempty"` }
func (*PostMetadata) Hash ¶
func (pm *PostMetadata) Hash() [32]byte
type PostMetadataStatus ¶
type PostMetadataStatus struct { Version uint64 `json:"version"` From string `json:"from"` // Who sent update Link string `json:"link"` // Original post ID Attributes map[string]string `json:"attributes,omitempty"` }
func (*PostMetadataStatus) Hash ¶
func (pm *PostMetadataStatus) Hash() [32]byte
type PushRoutedMessage ¶
type RMFTGet ¶
type RMFTGet struct { Directory string `json:"directory"` // Which directory **DEPRECATED Filename string `json:"filename"` // Which file **DEPRECATED Tag uint32 `json:"tag"` // Tag to copy in replies FileID string `json:"file_id"` // Equals metadata hash }
RMFTGet attempts to retrieve a file from another user
type RMFTGetChunk ¶
type RMFTGetChunk struct { FileID string `json:"file_id"` Hash []byte `json:"hash"` // Chunk to retrieve Index int `json:"index"` Tag uint32 `json:"tag"` // Tag to copy in replies }
RMFTGetChunk attempts to retrieve a file chunk from another user.
type RMFTGetChunkReply ¶
type RMFTGetChunkReply struct { FileID string `json:"file_id"` Index int `json:"index"` Chunk []byte `json:"chunk"` // Actual data, needs to be hashed to verify Tag uint32 `json:"tag"` Error *string `json:"error,omitempty"` }
RMFTGetChunkReply chunked file get reply
type RMFTGetReply ¶
type RMFTGetReply struct { Metadata FileMetadata `json:"metadata"` Tag uint32 `json:"tag"` Error *string `json:"error,omitempty"` }
RMFTGetReply file metadata get reply
type RMFTList ¶
type RMFTList struct { Directories []string `json:"directories"` // Which directories to obtain Filter string `json:"filter,omitempty"` // Filter list by this regex Tag uint32 `json:"tag"` // Tag to copy in replies }
RMFTList asks other side for a list of files. Directories are constants that describe which directories it should access. Currently only "global" and "shared" are allowed.
type RMFTListReply ¶
type RMFTListReply struct { Global []FileMetadata `json:"global,omitempty"` Tag uint32 Error *string `json:"error,omitempty"` }
type RMFTPayForChunk ¶
type RMFTSendFile ¶
type RMFTSendFile struct {
Metadata FileMetadata `json:"metadata"`
}
type RMFetchResource ¶ added in v0.1.8
type RMFetchResource struct { Path []string `json:"path"` Meta map[string]string `json:"meta"` Tag ResourceTag `json:"tag"` Data json.RawMessage `json:"data"` Index uint32 `json:"index"` Count uint32 `json:"count"` }
type RMFetchResourceReply ¶ added in v0.1.8
type RMFetchResourceReply struct { Tag ResourceTag `json:"tag"` Status ResourceStatus `json:"status"` Meta map[string]string `json:"meta"` Data []byte `json:"data"` Index uint32 `json:"index"` Count uint32 `json:"count"` }
type RMGetInvoice ¶
type RMGetPost ¶
type RMGetPost struct { ID zkidentity.ShortID `json:"id"` IncludeStatus bool `json:"include_status"` }
type RMGroupInvite ¶
type RMGroupInvite struct { ID zkidentity.ShortID `json:"id"` // group id Name string `json:"name"` // requested group name Token uint64 `json:"token"` // invite token Description string `json:"description"` // group description Expires int64 `json:"expires"` // unix time when this invite expires Version uint8 `json:"version"` // version the GC is running on }
RMGroupInvite invites a user to a group chat.
type RMGroupJoin ¶
type RMGroupJoin struct { // XXX who sent this? ID zkidentity.ShortID `json:"id"` // group id Token uint64 `json:"token"` // invite token, implicitly identifies sender Error string `json:"error"` // accept or deny Invite }
RMGroupJoin instructs inviter that a user did or did not join the group.
type RMGroupKick ¶
type RMGroupKick struct { Member [zkidentity.IdentitySize]byte `json:"member"` // kickee Reason string `json:"reason"` // why member was kicked Parted bool `json:"parted"` // kicked/parted NewGroupList RMGroupList `json:"newgrouplist"` // new GroupList }
RMGroupKick kicks a naughty member out of the group chat.
type RMGroupKill ¶
type RMGroupKill struct { // XXX who sent this? ID zkidentity.ShortID `json:"id"` // group id Reason string `json:"reason"` // reason to disassemble group }
RMGroupKill, sender is implicit to CRPC
type RMGroupList ¶
type RMGroupList struct { ID zkidentity.ShortID `json:"id"` // group id Name string `json:"name"` Generation uint64 `json:"generation"` // incremented every time list changes Timestamp int64 `json:"timestamp"` // unix time last generation changed Version uint8 `json:"version"` // version of the rules for GC op // Members is the list of GC participants. Members[0] is the "owner" // of the GC and has power over admins. Members []zkidentity.ShortID `json:"members"` // ExtraAdmins are additional admins. Members[0] is still considered // an admin in version 1 GCs. ExtraAdmins []zkidentity.ShortID `json:"extra_admins"` }
RMGroupList defines a Group Chat channel.
type RMGroupMessage ¶
type RMGroupMessage struct { ID zkidentity.ShortID `json:"id"` // group name Generation uint64 `json:"generation"` // Generation used Message string `json:"message"` // Actual message Mode MessageMode `json:"mode"` // 0 regular mode, 1 /me }
RMGroupMessage is a message to a group.
type RMGroupPart ¶
type RMGroupPart struct { // XXX who sent this? ID zkidentity.ShortID `json:"id"` // group id Reason string `json:"reason"` // reason to depart group }
RMGroupPart is sent to tell the group chat that a user has departed.
type RMGroupUpdateAdmins ¶ added in v0.1.6
type RMGroupUpdateAdmins struct { Reason string `json:"reason"` NewGroupList RMGroupList `json:"newgrouplist"` }
RMGroupUpdateAdmins updates the list of extra admins in the GC.
type RMGroupUpgradeVersion ¶ added in v0.1.6
type RMGroupUpgradeVersion struct {
NewGroupList RMGroupList `json:"newgrouplist"`
}
type RMHandshakeACK ¶ added in v0.1.8
type RMHandshakeACK struct{}
type RMHandshakeSYN ¶ added in v0.1.8
type RMHandshakeSYN struct{}
type RMHandshakeSYNACK ¶ added in v0.1.8
type RMHandshakeSYNACK struct{}
type RMHeader ¶
type RMHeader struct { Version uint64 `json:"version"` Timestamp int64 `json:"timestamp"` Command string `json:"command"` Tag uint32 `json:"tag"` Signature zkidentity.FixedSizeSignature `json:"signature,omitempty"` }
func DecomposeRM ¶
func DecomposeRM(msgVerifier MessageVerifier, mb []byte, maxDecompressSize uint) (*RMHeader, interface{}, error)
DecomposeRM decodes a message of up to maxDecompressSize bytes from mb.
type RMInvite ¶
type RMInvite struct {
Invitee zkidentity.PublicIdentity `json:"invitee"` // XXX why aren't we using Identity here?
}
RMInvite request an invite for third party.
type RMKXSearch ¶
type RMKXSearch struct {
Refs []RMKXSearchRef `json:"refs"`
}
RMKXSearch is sent when a user wishes to perform a transitive/recursive KX search for someone.
type RMKXSearchRef ¶
type RMKXSearchRef struct { Type RMKXSearchRefType `json:"type"` Ref string `json:"ref"` }
RMKXSearchRef identifies a specific reference that is being used to search for a user.
type RMKXSearchRefType ¶
type RMKXSearchRefType string
RMKXSearchRefType identifies the type of a reference used in a kx search message.
const (
KXSRTPostAuthor RMKXSearchRefType = "postauthor"
)
type RMKXSearchReply ¶
type RMKXSearchReply struct { TargetID zkidentity.ShortID `json:"target_id"` IDs []zkidentity.ShortID `json:"ids"` }
RMKXSearchReply is sent with a list of candidates the user might attempt to use to connect to target.
type RMKXSuggestion ¶
type RMKXSuggestion struct {
Target zkidentity.PublicIdentity
}
type RMListPosts ¶
type RMListPosts struct{}
type RMListPostsReply ¶
type RMListPostsReply struct {
Posts []PostListItem `json:"posts"`
}
type RMMediateIdentity ¶
type RMMediateIdentity struct {
Identity [zkidentity.IdentitySize]byte `json:"identity"`
}
RMMediateIdentity as target to send a RMInvite on the caller's behalf. This should kick of an autokx.
type RMOFullKX ¶
type RMOFullKX struct {
FullKX ratchet.KeyExchange `json:"fullkx"`
}
RMOFullKX
func DecryptOOBFullKXBlob ¶
func DecryptOOBFullKXBlob(packed []byte, key *zkidentity.FixedSizeSntrupPrivateKey, maxDecompressSize uint) (*RMOFullKX, error)
DecryptOOBFullKXBlob decrypts a packed RMOFullKX blob.
type RMOHalfKX ¶
type RMOHalfKX struct { Public zkidentity.PublicIdentity `json:"public"` HalfKX ratchet.KeyExchange `json:"halfkx"` InitialRendezvous ratchet.RVPoint `json:"initialrendezvous"` ResetRendezvous ratchet.RVPoint `json:"resetrendezvous"` }
RMOHalfKX is the command that flows after receiving an OOBPublicIdentityInvite.
func DecryptOOBHalfKXBlob ¶
func DecryptOOBHalfKXBlob(packed []byte, key *zkidentity.FixedSizeSntrupPrivateKey, maxDecompressSize uint) (*RMOHalfKX, error)
DecryptOOBHalfKXBlob decrypts a packed RMOHalfKX blob.
func NewHalfKX ¶
func NewHalfKX(us zkidentity.PublicIdentity, hkx *ratchet.KeyExchange) (*RMOHalfKX, error)
NewHalfKX creates a RMOHalfKX structure from a half ratchet.
us should be the public identity that is derived from the local client's full identity.
type RMOHeader ¶
type RMOHeader struct { Version uint64 `json:"version"` Timestamp int64 `json:"timestamp"` Command string `json:"command"` }
RMOHeader describes which command follows this structure.
type RMPostGetReply ¶
type RMPostStatus ¶
type RMPostStatus struct { Link string `json:"link"` // Link to post Attributes map[string]string `json:"attributes"` }
RMPostStatusReply sets attributes such as status on a post. Attributes is a key value store that is used to describe the update attributes.
type RMPostStatusReply ¶
type RMPostStatusReply struct {
Error *string `json:"error,omitempty"`
}
type RMPostsSubscribe ¶
type RMPostsSubscribe struct { // GetPost is an optional post to send to the client, assuming // subscribing to the posts worked. GetPost *zkidentity.ShortID `json:"get_post,omitempty"` // IncludeStatus also sends the post status updates if GetPost != nil. IncludeStatus bool `json:"include_status,omitempty"` }
RMPostSubscribe subscribes to new posts from a user.
type RMPostsSubscribeReply ¶
type RMPostsSubscribeReply struct {
Error *string `json:"error,omitempty"`
}
type RMPostsUnsubscribe ¶
type RMPostsUnsubscribe struct{}
RMPostUnsubscribe unsubscribes to new posts from a user.
type RMPostsUnsubscribeReply ¶
type RMPostsUnsubscribeReply struct {
Error *string `json:"error,omitempty"`
}
type RMPrivateMessage ¶
type RMProfileUpdate ¶ added in v0.2.0
type RMProfileUpdate struct { // Avatar is the user's avatar. If set to nil, the avatar is not // updated. If set to an empty slice, the avatar is cleared. Avatar []byte `json:"avatar"` }
RMProfileUpdate is a message sent by a client when it has updated one of its profile fields.
type RMReceiptDomain ¶ added in v0.1.10
type RMReceiptDomain string
RMReceiptDomain are the valid read receipt domains.
const ( ReceiptDomainPosts RMReceiptDomain = "posts" ReceiptDomainPostComments RMReceiptDomain = "postcomments" )
type RMReceiveReceipt ¶ added in v0.1.10
type RMReceiveReceipt struct { // Domain is the type of receipt. Domain RMReceiptDomain // ID is the main ID of the receipt. Depends on the domain. // // post, postcomments : ID of the post. ID *zkidentity.ShortID // SubID is the secondary id of the receipt. Depends on the domain. // // posts: nil // postcomments: ID of the comment. SubID *zkidentity.ShortID // ClientTime is the unix millisecond timestamp of when the client // received. ClientTime int64 }
RMReceiveReceipt is a receipt sent by a client when it has received an RM for something. The fields set and their interpretation depends on the domain.
type RMTransitiveMessage ¶
type RMTransitiveMessage struct { // For is the invitee identity and the corresponding public key that // was used to encrypt the InviteBlob. For zkidentity.ShortID `json:"for"` // CipherText contains a sntrup4591761 encapsulated shared key that is // used to encrypt the message. This ciphertext is decrypted by the // intended final recipient. CipherText zkidentity.FixedSizeSntrupCiphertext `json:"ciphertext,omitempty"` // Message is an encrypted json encoded structure. Message []byte `json:"message,omitempty"` }
RMTransitiveMessage is a request to forward a message
type RMTransitiveMessageForward ¶
type RMTransitiveMessageForward struct { // From is the sender identity. This is used as a hint to verify the // signature and identity inside Message. From zkidentity.ShortID `json:"from"` // CipherText contains a sntrup4591761 encapsulated shared key that is // used to encrypt the InviteBlob. CipherText zkidentity.FixedSizeSntrupCiphertext `json:"ciphertext"` // Message is an encrypted json encoded structure. Message []byte `json:"message"` }
RMTransitiveMessageForward forwards a transitive message to a user.
type RMTransitiveMessageReply ¶
type RMTransitiveMessageReply struct { // For is the intended recipient that needs Message routed. For zkidentity.ShortID `json:"for"` // Error is set if the other side encountered an error. Error *string `json:"error,omitempty"` }
RMTransitiveMessageReply is a reply to a transitive message.
type RMTransitiveReset ¶
type RMTransitiveReset struct {
HalfKX ratchet.KeyExchange `json:"halfkx"` // Half ratchet
}
type RMTransitiveResetReply ¶
type RMTransitiveResetReply struct {
FullKX ratchet.KeyExchange `json:"fullkx"` // Full ratchet
}
type RMUser ¶
type RMUser struct{}
RMUser retrieves user attributes such as status, profile etc. Attributes is a key value store that is used to describe the user attributes.
type RMUserReply ¶
type ResourceStatus ¶ added in v0.1.8
type ResourceStatus uint16
func (ResourceStatus) String ¶ added in v0.1.8
func (rs ResourceStatus) String() string
type ResourceTag ¶ added in v0.1.8
type ResourceTag uint64
func (*ResourceTag) FromString ¶ added in v0.1.8
func (tag *ResourceTag) FromString(s string) error
func (ResourceTag) MarshalJSON ¶ added in v0.1.8
func (tag ResourceTag) MarshalJSON() ([]byte, error)
MarshalJSON marshals the id into a json string.
func (ResourceTag) String ¶ added in v0.1.8
func (tag ResourceTag) String() string
func (*ResourceTag) UnmarshalJSON ¶ added in v0.1.8
func (tag *ResourceTag) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals the json representation of a ShortID.
type RouteMessage ¶
RouteMessage is a hack
type RouteMessageReply ¶
type ServerProperty ¶
type ServerProperty struct { Key string // name of property Value string // value of property Required bool // if true client must handle this entry }
func SupportedServerProperties ¶
func SupportedServerProperties() []ServerProperty
type SubscribeRoutedMessages ¶
type TxHash ¶ added in v0.1.7
func (*TxHash) FromString ¶ added in v0.1.7
FromString decodes s into a TxHash. s must contain an hex-encoded ID of the correct length.
func (TxHash) MarshalJSON ¶ added in v0.1.7
MarshalJSON marshals the id into a json string.
func (*TxHash) UnmarshalJSON ¶ added in v0.1.7
UnmarshalJSON unmarshals the json representation of a ShortID.
type Welcome ¶
type Welcome struct { Version int // protocol version ServerTime int64 // server timestamp // Client shall ensure it is compatible with the server requirements Properties []ServerProperty // server properties }
Welcome is written immediately following a key exchange. This command purpose is to detect if the key exchange completed on the client side. If the key exchange failed the server will simply disconnect.