Documentation
Index ¶
- func Decrypt(b []byte, v interface{}, key *keys.EdX25519Key) (*keys.X25519PublicKey, error)
- func Encrypt(i interface{}, sender *keys.EdX25519Key, recipient keys.ID) ([]byte, error)
- func NewID() string
- type BatchRequest
- type BatchRequests
- type BatchResponse
- type BatchResponses
- type Channel
- type ChannelCreateRequest
- type ChannelCreateResponse
- type ChannelInfo
- type ChannelInvite
- type ChannelJoin
- type ChannelLeave
- type ChannelStatus
- type ChannelToken
- type ChannelsStatusRequest
- type ChannelsStatusResponse
- type Data
- type DirectToken
- type Error
- type Events
- type EventsResponse
- type Follow
- type FollowResponse
- type FollowsResponse
- type InviteCodeCreateResponse
- type InviteCodeResponse
- type Message
- func DecryptMessage(b []byte, key *keys.EdX25519Key) (*Message, error)
- func DecryptMessageFromEvent(event *events.Event, key *keys.EdX25519Key) (*Message, error)
- func NewMessage(sender keys.ID) *Message
- func NewMessageForChannelInfo(sender keys.ID, info *ChannelInfo) *Message
- func NewMessageForChannelInvites(sender keys.ID, invites []*ChannelInvite) *Message
- type Metadata
- type Response
- type SigchainResponse
- type User
- type UserResponse
- type UserSearchResponse
- type VaultResponse
Constants ¶
Variables ¶
Functions ¶
func Decrypt ¶
func Decrypt(b []byte, v interface{}, key *keys.EdX25519Key) (*keys.X25519PublicKey, error)
Decrypt value, returning sender public key.
Types ¶
type BatchRequest ¶
type BatchRequest struct { ID string `json:"id"` Method string `json:"method"` URL string `json:"url"` Headers map[string]string `json:"headers"` }
BatchRequest ...
func NewBatchRequest ¶
func NewBatchRequest(id string, method string, urs string, contentHash string, now time.Time, key *keys.EdX25519Key) (*BatchRequest, error)
NewBatchRequest returns batch request.
type BatchRequests ¶
type BatchRequests struct {
Requests []*BatchRequest `json:"requests"`
}
BatchRequests ...
type BatchResponse ¶
type BatchResponse struct { ID string `json:"id"` Status int `json:"status"` Body interface{} `json:"body"` }
BatchResponse ..
func (*BatchResponse) As ¶
func (r *BatchResponse) As(v interface{}) error
As unmarshals into value.
func (*BatchResponse) Error ¶
func (r *BatchResponse) Error() *Error
type BatchResponses ¶
type BatchResponses struct {
Responses []*BatchResponse `json:"responses"`
}
BatchResponses ...
type Channel ¶
type Channel struct { ID keys.ID `json:"id" msgpack:"id"` Index int64 `json:"idx,omitempty" msgpack:"idx,omitempty"` Timestamp int64 `json:"ts,omitempty" msgpack:"ts,omitempty"` Token string `json:"token,omitempty" msgpack:"token,omitempty"` }
Channel ...
type ChannelCreateRequest ¶
type ChannelCreateRequest struct { // Message to post on create. Message []byte `json:"msg,omitempty" msgpack:"msg,omitempty"` }
ChannelCreateRequest ...
type ChannelCreateResponse ¶
type ChannelCreateResponse struct {
Channel *Channel `json:"channel,omitempty" msgpack:"channel,omitempty"`
}
ChannelCreateResponse ...
type ChannelInfo ¶
type ChannelInfo struct { Name string `json:"name,omitempty" msgpack:"name,omitempty"` Description string `json:"desc,omitempty" msgpack:"desc,omitempty"` }
ChannelInfo for setting channel name or description.
type ChannelInvite ¶
type ChannelInvite struct { Channel keys.ID `json:"channel" msgpack:"channel"` Recipient keys.ID `json:"recipient" msgpack:"recipient"` Sender keys.ID `json:"sender" msgpack:"sender"` Key *api.Key `json:"key" msgpack:"key"` Token string `json:"token" msgpack:"token"` Info *ChannelInfo `json:"info,omitempty" msgpack:"info,omitempty"` }
ChannelInvite if invited to a channel.
type ChannelJoin ¶
ChannelJoin is a user joined a channel (invite was accepted) (notification).
type ChannelLeave ¶
ChannelLeave if a user left the channel (notification).
type ChannelStatus ¶
type ChannelStatus struct { ID keys.ID `json:"id" msgpack:"id"` Index int64 `json:"idx" msgpack:"idx"` Timestamp int64 `json:"ts" msgpack:"ts"` }
ChannelStatus ...
type ChannelsStatusRequest ¶
type ChannelsStatusRequest struct {
Channels map[keys.ID]string `json:"channels,omitempty" msgpack:"channels,omitempty"`
}
ChannelsStatusRequest ...
type ChannelsStatusResponse ¶
type ChannelsStatusResponse struct {
Channels []*ChannelStatus `json:"channels,omitempty" msgpack:"channels,omitempty"`
}
ChannelsStatusResponse ...
type DirectToken ¶
type DirectToken struct { User keys.ID `json:"user" msgpack:"user"` Token string `json:"token" msgpack:"token"` }
DirectToken ...
type Error ¶
type Error struct { Message string `json:"message,omitempty"` Status int `json:"status,omitempty"` }
Error ...
type Events ¶
type Events struct { Events []*events.Event `json:"events"` Index int64 `json:"idx"` Truncated bool `json:"truncated,omitempty"` }
Events ...
type EventsResponse ¶
type EventsResponse struct { Events []*events.Event `json:"events" msgpack:"events"` Index int64 `json:"idx" msgpack:"idx"` }
EventsResponse ...
type Follow ¶
type Follow struct { Sender keys.ID `json:"sender" msgpack:"sender"` Recipient keys.ID `json:"recipient" msgpack:"recipient"` }
Follow user.
type FollowResponse ¶
type FollowResponse struct {
Follow *Follow `json:"follow" msgpack:"follow"`
}
FollowResponse ...
type FollowsResponse ¶
type FollowsResponse struct {
Follows []*Follow `json:"follows" msgpack:"follows"`
}
FollowsResponse ...
type InviteCodeCreateResponse ¶
type InviteCodeCreateResponse struct {
Code string `json:"code"`
}
InviteCodeCreateResponse ...
type InviteCodeResponse ¶
type InviteCodeResponse struct { Sender keys.ID `json:"sender"` Recipient keys.ID `json:"recipient"` }
InviteCodeResponse ...
type Message ¶
type Message struct { ID string `json:"id,omitempty" msgpack:"id,omitempty"` Prev string `json:"prev,omitempty" msgpack:"prev,omitempty"` Timestamp int64 `json:"ts,omitempty" msgpack:"ts,omitempty"` Sender keys.ID `json:"sender" msgpack:"sender"` // For message text (optional). Text string `json:"text,omitempty" msgpack:"text,omitempty"` // ChannelInfo sets info. ChannelInfo *ChannelInfo `json:"channelInfo,omitempty" msgpack:"channelInfo,omitempty"` // ChannelInvites to invite to a new channel. ChannelInvites []*ChannelInvite `json:"channelInvites,omitempty" msgpack:"channelInvites,omitempty"` // RemoteIndex is set from the remote events API (untrusted). RemoteIndex int64 `json:"-" msgpack:"-"` // RemoteTimestamp is set from the remote events API (untrusted). RemoteTimestamp int64 `json:"-" msgpack:"-"` }
Message is encrypted by clients.
func DecryptMessage ¶
func DecryptMessage(b []byte, key *keys.EdX25519Key) (*Message, error)
DecryptMessage decrypts message.
func DecryptMessageFromEvent ¶
DecryptMessageFromEvent decrypts a remote Event from Messages.
func NewMessageForChannelInfo ¶
func NewMessageForChannelInfo(sender keys.ID, info *ChannelInfo) *Message
NewMessageForChannelInfo ...
func NewMessageForChannelInvites ¶
func NewMessageForChannelInvites(sender keys.ID, invites []*ChannelInvite) *Message
NewMessageForChannelInvites ...
func (*Message) WithTimestamp ¶
WithTimestamp ...
type Metadata ¶
type Metadata struct { CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` }
Metadata ...
type SigchainResponse ¶
type SigchainResponse struct { KID keys.ID `json:"kid"` Metadata map[string]Metadata `json:"md,omitempty"` Statements []*keys.Statement `json:"statements"` }
SigchainResponse is the response format for a Sigchain request.
func (SigchainResponse) MetadataFor ¶
func (r SigchainResponse) MetadataFor(st *keys.Statement) Metadata
MetadataFor returns metadata for Signed.
type User ¶
type User struct { ID string `json:"id,omitempty"` Name string `json:"name,omitempty"` KID keys.ID `json:"kid,omitempty"` Seq int `json:"seq,omitempty"` Service string `json:"service,omitempty"` URL string `json:"url,omitempty"` Status user.Status `json:"status,omitempty"` Statement string `json:"statement,omitempty"` VerifiedAt int64 `json:"verifiedAt,omitempty"` Timestamp int64 `json:"ts,omitempty"` MatchField string `json:"mf,omitempty"` Err string `json:"err,omitempty"` }
User ...
func UserFromResult ¶
UserFromResult returns User from user.Result.
func UserFromSearchResult ¶
func UserFromSearchResult(sr *users.SearchResult) *User
UserFromSearchResult returns User from user.SearchResult.
type UserSearchResponse ¶
type UserSearchResponse struct {
Users []*User `json:"users"`
}
UserSearchResponse ...