mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-26 08:13:09 -06:00
Define APIs for ThreePid component
This commit is contained in:
parent
caa5c89ecb
commit
35622c8b94
38
threepid/api.go
Normal file
38
threepid/api.go
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
package threepid
|
||||
|
||||
import "context"
|
||||
|
||||
type API interface {
|
||||
CreateSession(context.Context, *CreateSessionRequest, *Session) error
|
||||
ValidateSession(context.Context, *ValidateSessionRequest, struct{}) error
|
||||
GetThreePidForSession(context.Context, *SessionOwnership, *GetThreePidForSessionResponse) error
|
||||
DeleteSession(context.Context, *SessionOwnership, struct{}) error
|
||||
IsSessionValidated(context.Context, *SessionOwnership, *IsSessionValidatedResponse) error
|
||||
}
|
||||
|
||||
type CreateSessionRequest struct {
|
||||
ClientSecret, NextLink, ThreePid string
|
||||
}
|
||||
|
||||
type ValidateSessionRequest struct {
|
||||
SessionOwnership
|
||||
Token string
|
||||
}
|
||||
|
||||
type GetThreePidForSessionResponse struct {
|
||||
ThreePid string
|
||||
}
|
||||
|
||||
type SessionOwnership struct {
|
||||
Sid, ClientSecret string
|
||||
}
|
||||
|
||||
type Session struct {
|
||||
Sid, ClientSecret, ThreePid, Token, NextLink string
|
||||
SendAttempt int
|
||||
}
|
||||
|
||||
type IsSessionValidatedResponse struct {
|
||||
Validated bool
|
||||
ValidatedAt int
|
||||
}
|
||||
8
threepid/storage.go
Normal file
8
threepid/storage.go
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
package threepid
|
||||
|
||||
type storage interface {
|
||||
InsertSession(*Session) error
|
||||
GetSession(sid string) (*Session, error)
|
||||
GetSessionByThreePidAndSecret(threePid, ClientSecret string) (*Session, error)
|
||||
RemoveSession(sid string) error
|
||||
}
|
||||
Loading…
Reference in a new issue