Back to godoc.org

Package v2

v0.0.0-...-a44c3a2
Latest Go to latest

The latest major version is .

Published: Jan 28, 2020 | License: BSD-3-Clause | Module: github.com/identbase/identserv

Index

func Routes

func Routes(c Context) []*server.Route

Routes provides a list of routes that this Router will answer to.

func TokenFromRequest

func TokenFromRequest(r *http.Request) string

TokenFromRequest pulls out the access_token from the http.Request

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

type AuthContext struct {
	echo.Context
	User account.User
}

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

type Context interface {
	GetDatabase() (*store.InMemory, error)
}

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

func (v *V2) GetAccount(c echo.Context) error

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

func (v *V2) GetEmphemeralKeyValidity(c echo.Context) error

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

func (v *V2) GetKey(c echo.Context) error

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

func (v *V2) GetKeyValidity(c echo.Context) error

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

func (v *V2) GetLookup(c echo.Context) error

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) GetStatus

func (v *V2) GetStatus(c echo.Context) error

GetStatus is used for auto-discovery and health checks.

func (*V2) PostAccountLogout

func (v *V2) PostAccountLogout(c echo.Context) error

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

func (v *V2) PostAccountRegister(c echo.Context) error

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

func (v *V2) PostBulkLookup(c echo.Context) error

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

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier