Documentation ¶
Index ¶
- func Routes(c Context) []*server.Route
- func TokenFromRequest(r *http.Request) string
- type Account
- type AuthContext
- type Context
- type Key
- type RegisterFederationResponse
- type RegisterRequest
- type RegisterResponse
- type Status
- type V2
- func (v *V2) AuthRequired(n echo.HandlerFunc) echo.HandlerFunc
- func (v *V2) GetAccount(c echo.Context) error
- func (v *V2) GetEmphemeralKeyValidity(c echo.Context) error
- func (v *V2) GetKey(c echo.Context) error
- func (v *V2) GetKeyValidity(c echo.Context) error
- func (v *V2) GetLookup(c echo.Context) error
- func (v *V2) GetStatus(c echo.Context) error
- func (v *V2) PostAccountLogout(c echo.Context) error
- func (v *V2) PostAccountRegister(c echo.Context) error
- func (v *V2) PostBulkLookup(c echo.Context) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TokenFromRequest ¶
TokenFromRequest pulls out the access_token from the http.Request
Types ¶
type Account ¶
type Account interface { GenerateToken() Save() error }
Account interface represents an account object held by the server to connect a user from a matrix server to its threepids.
type AuthContext ¶
AuthContext extends echo.Context to include authentication information.
func NewAuthContext ¶
func NewAuthContext(c echo.Context) *AuthContext
NewAuthContext creates an echo.Context object that also contains authentication information.
type Context ¶
Context provides any state context for V1 routes. TODO: Add better support for a generic list of context
type Key ¶
type Key struct { }
Key is a simple JSON response object that carries a unpadded Base64 public key.
type RegisterFederationResponse ¶
type RegisterFederationResponse struct {
representor.HALBody
}
RegisterFederationResponse is the JSON response from a Matrix server.
type RegisterRequest ¶
type RegisterRequest struct { AccessToken string `json:"access_token" form:"access_token" query:"access_token"` Type string `json:"token_type" form:"token_type" query:"token_type"` Domain string `json:"matrix_server_name" form:"matrix_server_name" query:"matrix_server_name"` Expires int `json:"expires_in" form:"expires_in" query:"expires_in"` }
RegisterRequest is the JSON request expected by PostAccountRegister.
type RegisterResponse ¶
type RegisterResponse struct {
representor.HALBody
}
RegisterResponse is the JSON response sent by PostAccountRegister.
func NewRegisterResponse ¶
func NewRegisterResponse(t string) *RegisterResponse
NewRegisterResponse creates a RegisterResponse object to respond with.
type Status ¶
type Status struct { }
Status is a simple JSON response object. TODO: Add process metrics to monitor the server
type V2 ¶
type V2 struct {
Context
}
V2 implementation for the routes
func (*V2) AuthRequired ¶
func (v *V2) AuthRequired(n echo.HandlerFunc) echo.HandlerFunc
AuthRequired middleware indicates that an endpoint requires authentication.
func (*V2) GetAccount ¶
GetAccount gets an account based on :user_id.
GET /v2/account
Query Parameters:
user_id - Required. A string of the user ID which is registered.
Reference: https://matrix.org/docs/spec/identity_service/r0.3.0#get-matrix-identity-v2-account
func (*V2) GetEmphemeralKeyValidity ¶
GetEmphemeralKeyValidity checks the validity of an emphemeral key.
GET /v1/pubkey/emphemeral/isvalid
Query Parameters:
References: https://matrix.org/docs/spec/identity_service/r0.2.1#get-matrix-identity-api-v1-pubkey-ephemeral-isvalid
func (*V2) GetKey ¶
GetKey is used to get the public key passed by :key
GET /v1/pubkey/:id
Parameters:
:id - Required. The ID of the key. This should take the form algorithm:identifier where algorithm identifies the signing algorithm, and the identifier is an opaque string.
Reference: https://matrix.org/docs/spec/identity_service/r0.2.1#id12
func (*V2) GetKeyValidity ¶
GetKeyValidity checks the validity of a public key.
GET /v1/pubkey/isvalid GET /v1/pubkey/emphemeral/isvalid
Query Parameters:
References: https://matrix.org/docs/spec/identity_service/r0.2.1#get-matrix-identity-api-v1-pubkey-isvalid
func (*V2) GetLookup ¶
GetLookup is a lookup request to find a particular ThreePID.
GET /v1/lookup
Reference: https://matrix.org/docs/spec/identity_service/r0.2.1#get-matrix-identity-api-v1-lookup
func (*V2) PostAccountLogout ¶
PostAccountLogout logs a user out of the server.
POST /v2/account/logout
Reference: https://matrix.org/docs/spec/identity_service/r0.3.0#post-matrix-identity-v2-account-logout
func (*V2) PostAccountRegister ¶
PostAccountRegister registers a new matrix user in the server.
POST /v2/account/register
Post Parameters: access_token - Required. A string access token the consumer may use to verify
the identity of the person who generated the token.
token_type - Required. A string token type ("Bearer"). matrix_server_name - Required. A string homeserver domain the consumer should
use when attempting to verify the user's identity.
expires_in - Required. An integer of seconds before this token expires and a
new one must be generated.
Reference: https://matrix.org/docs/spec/identity_service/r0.3.0#post-matrix-identity-v2-account-register
func (*V2) PostBulkLookup ¶
PostBulkLookup allows one to lookup many ThreePID's.
POST /v1/bulk_lookup
Post Parameters:
threepids - Required. An array of tuples comprised of 3PID type and the address to look up.
Reference: https://matrix.org/docs/spec/identity_service/r0.2.1#post-matrix-identity-api-v1-bulk-lookup