Documentation ¶
Index ¶
- Constants
- Variables
- func EnsureParams(req *http.Request, args ...string) (map[string]string, error)
- func FromMS(ms int64) time.Time
- func GenerateToken(medium string) string
- func MS(ts *time.Time) int64
- func RandomString(length int) string
- func Seed()
- func Time() int64
- type Association
- type BulkLookupRequest
- type Data
- type EphemeralPublicKey
- type Error
- type IDLookupResponse
- type InviteToken
- type Peer
- type Profile
- type PublicKey
- type Query
- type SQL
- type ServerVerifyKey
- type Success
- type TokenSession
- type Tx
- type ValidPubKey
- type ValidationSession
Constants ¶
View Source
const ( ErrUnrecognized = "M_UNRECOGNIZED" ErrForbidden = "M_FORBIDDEN" ErrBadJSON = "M_BAD_JSON" ErrNotJSON = "M_NOT_JSON" ErrUserInUse = "M_USER_IN_USE" ErrRoomInUse = "M_ROOM_IN_USE" ErrBadPagination = "M_BAD_PAGINATION" ErrBadState = "M_BAD_STATE" ErrUnknown = "M_UNKNOWN" ErrNotFound = "M_NOT_FOUND" ErrMissingToken = "M_MISSING_TOKEN" ErrUnknownToken = "M_UNKNOWN_TOKEN" ErrGuestAccessForbidden = "M_GUEST_ACCESS_FORBIDDEN" ErrLimitExceeded = "M_LIMIT_EXCEEDED" ErrCaptchaNeeded = "M_CAPTCHA_NEEDED" ErrCaptchaInvalid = "M_CAPTCHA_INVALID" ErrMissingParam = "M_MISSING_PARAM" ErrInvalidParam = "M_INVALID_PARAM" ErrTooLarge = "M_TOO_LARGE" ErrExclusive = "M_EXCLUSIVE" ErrThreepidAuthFailed = "M_THREEPID_AUTH_FAILED" ErrThreepidInUse = "M_THREEPID_IN_USE" ErrThreepidNotFound = "M_THREEPID_NOT_FOUND" ErrThreepidDenied = "M_THREEPID_DENIED" ErrInvalidUsername = "M_INVALID_USERNAME" ErrServerNotTrusted = "M_SERVER_NOT_TRUSTED" ErrConsentNotGiven = "M_CONSENT_NOT_GIVEN" ErrCannotLeaveServerNoticeRoom = "M_CANNOT_LEAVE_SERVER_NOTICE_ROOM" ErrResourceLimitExceeded = "M_RESOURCE_LIMIT_EXCEEDED" ErrUnsupportedRoomVersion = "M_UNSUPPORTED_ROOM_VERSION" ErrIncompatibleRoomVersion = "M_INCOMPATIBLE_ROOM_VERSION" ErrWrongRoomKeysVersion = "M_WRONG_ROOM_KEYS_VERSION" ErrNoValidSession = "M_NO_VALID_SESSION" ErrSessionExpiredCode = "M_SESSION_EXPIRED" ErrSessionNotValidatedCode = "M_SESSION_NOT_VALIDATED" ErrUnknownPeer = "M_UNKNOWN_PEER" ErrVerificationFailed = "M_VERIFICATION_FAILED" ErrInvalidEmail = "M_INVALID_EMAIL" ErrEmailSendError = "M_EMAIL_SEND_ERROR" ErrIncorrectClientSecretCode = "M_INCORRECT_CLIENT_SECRET" )
matrix error codes
Variables ¶
View Source
var ErrIncorrectClientSecret = errors.New("db: incorrect client secret")
View Source
var ErrIncorrectToken = errors.New("bad token")
View Source
var ErrNoMatchingSignature = errors.New("no matching signatures found")
View Source
var ErrNoSignature = errors.New("no signatures found")
View Source
var ErrSessionExpired = errors.New("db: session expired")
View Source
var ErrSessionNotValidated = errors.New("db: session not validated")
Functions ¶
func EnsureParams ¶
EnsureParams makes sure the query params are in params.
func FromMS ¶
FromMS returns time.Time initialized from ms which is time in milliseconds since unix epoch.
func GenerateToken ¶
func RandomString ¶
RandomString returns a nice looking random string.
Types ¶
type Association ¶
type Association struct { ID int64 `json:"-"` Medium string `json:"medium"` Address string `json:"address"` MatrixID string `json:"mxid"` Timestamp int64 `json:"ts"` NotBefore int64 `json:"notBefore"` NotAfter int64 `json:"notAfter"` ExtraFields map[string]interface{} `json:"-"` }
func (*Association) ToMap ¶
func (a *Association) ToMap() map[string]interface{}
type BulkLookupRequest ¶
type BulkLookupRequest struct {
Threepids [][]string `json:"threepids"`
}
type EphemeralPublicKey ¶
type Error ¶
Error implements error interface, that wraps around the response from the matrix server.
type IDLookupResponse ¶
type IDLookupResponse struct { // The 3pid address of the user being looked up, matching the address requested. Address string `json:"address"` Medium string `json:"medium"` Mxid string `json:"mxid"` // A unix timestamp before which the association is not known to be valid NotBefore int64 `json:"not_before"` // A unix timestamp after which the association is not known to be valid. NotAfter int64 `json:"not_after"` // The unix timestamp at which the association was verified. Timestamp int64 `json:"ts"` // The signatures of the verifying identity servers which show that the // association should be trusted, if you trust the verifying identity servers Signature map[string]map[string]string `json:"signature"` }
IDLookupResponse is the response sent by identity server for /lookup request.
type InviteToken ¶
type InviteToken struct { ID int64 Medium string Address string RoomID string Sender string Token string ReceivedAt time.Time SentAt time.Time }
func (*InviteToken) ToMap ¶
func (i *InviteToken) ToMap() map[string]interface{}
type Peer ¶
type Peer struct { Name string `json:"name"` Port sql.NullInt64 `json:"-"` JSONPort int64 `json:"port,omitempty"` LastSentVersion sql.NullInt64 `json:"-"` LastPokeSucceededAt sql.NullInt64 `json:"-"` // 1 is for active and 0 is for not active Active int64 `json:"-"` PublicKeys map[string]string `json:"public_keys"` }
type PublicKey ¶
type PublicKey struct {
Key string `json:"public_key" example:"ed25519:0"`
}
PublicKey represent a publick key response object that is returned by the identity server.
type ServerVerifyKey ¶
type TokenSession ¶
type TokenSession struct { ValidationSession SendAttemptNumber int64 }
type ValidPubKey ¶
type ValidPubKey struct {
Valid bool `json:"valid"`
}
ValidPubKey is a response object for valid public key.
Click to show internal directories.
Click to hide internal directories.