Documentation
¶
Index ¶
- func Decrypt(b []byte, v interface{}, key *keys.EdX25519Key) error
- func DecryptKey(b []byte, key *keys.EdX25519Key) (*keys.EdX25519Key, error)
- func DecryptMessage(b []byte, key *keys.EdX25519Key) ([]byte, *keys.X25519PublicKey, error)
- func Encrypt(i interface{}, key *keys.EdX25519Key) ([]byte, error)
- func EncryptKey(key *keys.EdX25519Key, to keys.ID) ([]byte, error)
- func EncryptMessage(b []byte, channel *keys.EdX25519Key, sender *keys.EdX25519Key) []byte
- func NewID() string
- func TeamSign(team *keys.EdX25519Key, domain string, ts time.Time) (string, error)
- type Account
- type AccountAuth
- type AccountAuthsResponse
- type AccountCreateRequest
- type AccountRegisterInvite
- type AccountRegisterInviteRequest
- type AccountRegisterRequest
- type AccountResponse
- type AccountUnverified
- type AccountVault
- type AccountVaultsResponse
- type Channel
- type ChannelCreateRequest
- type ChannelInfo
- type ChannelToken
- type ChannelUsersAddRequest
- type ChannelUsersRemoveRequest
- type ChannelUsersResponse
- type ChannelsResponse
- type Config
- type Data
- type Encrypted
- type Error
- type Event
- type Events
- type EventsResponse
- type Message
- type MessageCommand
- type MesssagesResponse
- type Metadata
- type Response
- type SendEmailVerificationResponse
- type Team
- type TeamCreateRequest
- type TeamInvite
- type TeamInviteRequest
- type TeamInviteResponse
- type TeamStatement
- type TeamsResponse
- type User
- type UserKey
- type UsersLookupRequest
- type UsersResponse
- type Vault
- type VaultResponse
- type VaultStatus
- type VaultToken
- type VaultsStatusRequest
- type VaultsStatusResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecryptKey ¶
func DecryptKey(b []byte, key *keys.EdX25519Key) (*keys.EdX25519Key, error)
func DecryptMessage ¶
func DecryptMessage(b []byte, key *keys.EdX25519Key) ([]byte, *keys.X25519PublicKey, error)
DecryptMessage returning sender public key.
func EncryptKey ¶
func EncryptMessage ¶
func EncryptMessage(b []byte, channel *keys.EdX25519Key, sender *keys.EdX25519Key) []byte
EncryptMessage does crypto_box_seal(pk+crypto_box(b)).
Types ¶
type Account ¶
type Account struct {
KID keys.ID `json:"kid"`
Email string `json:"email"`
Username string `json:"username"`
}
Account ...
type AccountAuth ¶
type AccountAuthsResponse ¶
type AccountAuthsResponse struct {
Auths []*AccountAuth `json:"auths"`
}
type AccountCreateRequest ¶
type AccountCreateRequest struct {
Email string `json:"email"`
VerifyEmailCode string `json:"verifyEmailCode"`
}
AccountCreateRequest ...
type AccountRegisterInvite ¶
type AccountRegisterInviteRequest ¶
type AccountRegisterInviteRequest struct {
Email string `json:"email,omitempty"`
}
AccountRegisterInviteRequest ...
type AccountRegisterRequest ¶
type AccountRegisterRequest struct {
Email string `json:"email"`
RegisterCode string `json:"registerCode"`
}
AccountRegisterRequest ...
type AccountResponse ¶
type AccountResponse struct {
Email string `json:"email"`
KID keys.ID `json:"kid"`
Username string `json:"username"`
}
AccountResponse ...
type AccountUnverified ¶
type AccountVault ¶
type AccountVault struct {
Account keys.ID `json:"account"`
Vault keys.ID `json:"vault"`
Token string `json:"token"`
Usage int64 `json:"usage"`
}
AccountVault ...
type AccountVaultsResponse ¶
type AccountVaultsResponse struct {
Vaults []*AccountVault `json:"vaults"`
}
AccountVaultsResponse ...
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"`
Info Encrypted `json:"info,omitempty" msgpack:"info,omitempty"`
// For team channels
Team keys.ID `json:"team,omitempty" msgpack:"team,omitempty"`
TeamKey Encrypted `json:"teamKey,omitempty" msgpack:"teamKey,omitempty"`
// For user channels
UserKey Encrypted `json:"userKey,omitempty" msgpack:"userKey,omitempty"`
}
type ChannelCreateRequest ¶
type ChannelInfo ¶
type ChannelInfo struct {
Name string `json:"name,omitempty" msgpack:"name,omitempty"`
Description string `json:"desc,omitempty" msgpack:"desc,omitempty"`
Topic string `json:"topic,omitempty" msgpack:"topic,omitempty"`
}
ChannelInfo for setting channel name or description.
type ChannelToken ¶
type ChannelUsersAddRequest ¶
type ChannelUsersAddRequest struct {
UserKeys []*UserKey `json:"userKeys,omitempty"`
}
type ChannelUsersResponse ¶
type ChannelsResponse ¶
type ChannelsResponse struct {
Channels []*Channel `json:"channels,omitempty" msgpack:"channels,omitempty"`
}
type Error ¶
type Error struct {
Message string `json:"message,omitempty"`
Status int `json:"status,omitempty"`
}
Error ...
type Event ¶
type Event struct {
Data []byte `json:"data" msgpack:"dat" firestore:"data"`
// Index for event (read only).
Index int64 `json:"idx" msgpack:"idx" firestore:"idx"`
// Timestamp (read only). The time at which the event was created.
// Firestore sets this to the document create time.
Timestamp int64 `json:"ts" msgpack:"ts" firestore:"-"`
}
type Events ¶
type Events struct {
Events []*Event `json:"events"`
Index int64 `json:"idx"`
Truncated bool `json:"truncated,omitempty"`
}
Events ...
type EventsResponse ¶
type EventsResponse struct {
Events []*Event `json:"events" msgpack:"events"`
Index int64 `json:"idx" msgpack:"idx"`
}
EventsResponse ...
type Message ¶
type Message struct {
ID string `json:"id" msgpack:"id" db:"id"`
Channel keys.ID `json:"channel" msgpack:"channel" db:"channel"`
Sender keys.ID `json:"sender" msgpack:"sender" db:"sender"`
Timestamp int64 `json:"ts,omitempty" msgpack:"ts,omitempty" db:"ts"`
Prev string `json:"prev,omitempty" msgpack:"prev,omitempty" db:"prev"`
// For message text.
Text string `json:"text,omitempty" msgpack:"text,omitempty" db:"text"`
// Command encodes other types of messages.
Command *MessageCommand `json:"cmd,omitempty" msgpack:"cmd,omitempty" db:"cmd"`
// RemoteIndex is set from the remote events API (untrusted).
RemoteIndex int64 `json:"ridx,omitempty" msgpack:"ridx,omitempty" db:"ridx"`
// RemoteTimestamp is set from the remote events API (untrusted).
RemoteTimestamp int64 `json:"rts,omitempty" msgpack:"rts,omitempty" db:"rts"`
}
Message is encrypted by clients.
func NewMessage ¶
NewMessage creates a new empty message.
func NewMessageForChannelInfo ¶
NewMessageForChannelInfo ...
func (*Message) WithTimestamp ¶
WithTimestamp ...
type MessageCommand ¶
type MessageCommand struct {
// ChannelInfo sets info.
ChannelInfo *ChannelInfo `json:"channelInfo,omitempty" msgpack:"channelInfo,omitempty"`
}
MessageCommand encodes other types of messages.
type MesssagesResponse ¶
type Metadata ¶
type Metadata struct {
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
Metadata ...
type SendEmailVerificationResponse ¶
SendEmailVerificationResponse ...
type Team ¶
type TeamCreateRequest ¶
type TeamCreateRequest struct {
Domain string `json:"domain"`
}
TeamCreateRequest ...
type TeamInvite ¶
type TeamInviteRequest ¶
type TeamInviteResponse ¶
type TeamStatement ¶
type UsersLookupRequest ¶
type UsersResponse ¶
type Vault ¶
type Vault 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"`
Usage int64 `json:"usage,omitempty" msgpack:"usage,omitempty"`
Deleted bool `json:"del,omitempty" msgpack:"del,omitempty"`
Team keys.ID `json:"team" msgpack:"team"`
CreatedBy keys.ID `json:"createdBy" msgpack:"createdBy"`
}
Vault ...
type VaultResponse ¶
type VaultResponse struct {
Vault []*Event `json:"vault" msgpack:"vault"`
Index int64 `json:"idx" msgpack:"idx"`
Truncated bool `json:"truncated,omitempty" msgpack:"trunc,omitempty"`
}
VaultResponse ...
type VaultStatus ¶
type VaultStatus struct {
ID keys.ID `json:"id" msgpack:"id"`
Index int64 `json:"idx" msgpack:"idx"`
Timestamp int64 `json:"ts" msgpack:"ts"`
}
VaultStatus ...
type VaultToken ¶
VaultToken ...
type VaultsStatusRequest ¶
type VaultsStatusRequest struct {
Vaults map[keys.ID]string `json:"vaults,omitempty" msgpack:"vaults,omitempty"`
}
VaultsStatusRequest ...
type VaultsStatusResponse ¶
type VaultsStatusResponse struct {
Vaults []*VaultStatus `json:"vaults,omitempty" msgpack:"vaults,omitempty"`
}
VaultsStatusResponse ...