Documentation
¶
Overview ¶
package etebase implements a Etebase client. Etebase is an end-to-end encrypted backend as a service. Think Firebase, but encrypted in a way that only your users can access their data.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct {
// contains filtered or unexported fields
}
Account represents a user account and is the main object for all user interactions and data manipulation.
func Login ¶
Login a user and returns a handle to an Account instance.
Example ¶
var (
client = NewClient(PartnerClientOptions("your-name"))
user = User{
Username: "john",
Email: "[email protected]",
}
password = "john's-secret"
)
if _, err := Signup(client, user, password); err != nil {
panic(err)
}
acc, err := Login(client, user.Username, password)
if err != nil {
panic(err)
}
_ = acc
func (*Account) Collection ¶
Collection is not implemented yet.
func (*Account) IsEtebaseServer ¶
IsEtebaseServer checks whether the Client is pointing to a valid Etebase server.
func (*Account) Logout ¶ added in v0.0.3
Logout the user from the current session and invalidate the authentication token.
func (*Account) PasswordChange ¶
PasswordChange changes the password of an active session.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client implements the network client to use to interact with the Etebase server.
func NewClient ¶
func NewClient(opts ClientOptions) *Client
NewClient returns a new client object given a name (your etebase account name), and options inside the ClientOptions struct.
type ClientOptions ¶
type ClientOptions struct {
// Host is the Etebase server host.
Host string
// Prefix is a string used as a prefix for requests.
// Possible values are `/partner/your-username` or
// `/developer/your-username` if your are using etebase.com server.
// For local server leave it blank.
Prefix string
// UseSSL specifies is ssl should be used or not.
UseSSL bool
Logger interface {
Logf(format string, v ...interface{})
}
}
ClientOptions allow you control specific options of the client. Most of the users should use DefaultClientOptions when constructing the client.
func DeveloperClientOptions ¶
func DeveloperClientOptions(name string) ClientOptions
DefaultClientOptions will make your client point to the official Etebase server in 'developer' mode.
func PartnerClientOptions ¶
func PartnerClientOptions(name string) ClientOptions
type ErrorResponse ¶
type ErrorResponse struct {
Code string `msgpack:"code"`
Detail string `msgpack:"detail"`
Errors []ErrorResponse `msgpack:"errors,omitempty"`
}
func (*ErrorResponse) Error ¶
func (err *ErrorResponse) Error() string
type LoginChallengeRequest ¶
type LoginChallengeRequest struct {
Username string `msgpack:"username"`
}
type LoginChallengeResponse ¶
type LoginRequest ¶
type LoginRequest struct {
// These fields are common to login and passwordChange
Username string `msgpack:"username"`
Challenge []byte `msgpack:"challenge"`
Host string `msgpack:"host"`
Action string `msgpack:"action"`
// These fields exclusively used for passwordChange
LoginPubKey []byte `msgpack:"loginPubkey,omitempty"`
EncryptedContent []byte `msgpack:"encryptedContent,omitempty"`
}