Documentation ¶
Index ¶
- func LoadSchema(_db *sql.DB) error
- type AddDeviceParams
- type AddWalletParams
- type Config
- type DBTX
- type Device
- type GetUserSigningParametersRow
- type Queries
- func (q *Queries) AddDevice(ctx context.Context, arg AddDeviceParams) (Device, error)
- func (q *Queries) AddUser(ctx context.Context, foreignKey string) (User, error)
- func (q *Queries) AddWallet(ctx context.Context, arg AddWalletParams) (Wallet, error)
- func (q *Queries) GetFirstUser(ctx context.Context) (User, error)
- func (q *Queries) GetUserByAddress(ctx context.Context, publicaddress string) (User, error)
- func (q *Queries) GetUserByForeignKey(ctx context.Context, foreignkey string) (User, error)
- func (q *Queries) GetUserDevices(ctx context.Context, userid int64) ([]Device, error)
- func (q *Queries) GetUserSigningParameters(ctx context.Context, foreignkey string) (GetUserSigningParametersRow, error)
- func (q *Queries) GetUserWallets(ctx context.Context, userid int64) ([]Wallet, error)
- func (q *Queries) GetWalletByAddress(ctx context.Context, publicaddress string) (Wallet, error)
- func (q *Queries) Status(ctx context.Context) (interface{}, error)
- func (q *Queries) WithTx(tx *sql.Tx) *Queries
- type Server
- func (server *Server) AuthorizeHandler(w http.ResponseWriter, r *http.Request)
- func (server *Server) CustomAuth(token string) (string, error)
- func (server *Server) DkgHandler(w http.ResponseWriter, r *http.Request)
- func (server *Server) IdentifyHandler(w http.ResponseWriter, r *http.Request)
- func (server *Server) RetrieveWallet(foreignKey string) (*tss.DkgResult, error)
- func (server *Server) Router() http.Handler
- func (server *Server) RpcHandler(w http.ResponseWriter, r *http.Request)
- func (server *Server) ServeWasm(w http.ResponseWriter, r *http.Request)
- func (server *Server) SignHandler(w http.ResponseWriter, r *http.Request)
- func (server *Server) Start()
- func (server *Server) StoreWallet(userAgent string, userId string, dkgResults *tss.DkgResult) error
- func (server *Server) Supabase(jwt string) (string, error)
- type SupabaseUser
- type User
- type Wallet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadSchema ¶
Types ¶
type AddDeviceParams ¶
type AddWalletParams ¶
type AddWalletParams struct { UserId int64 PublicAddress string Params json.RawMessage }
type GetUserSigningParametersRow ¶
type GetUserSigningParametersRow struct { ID sql.NullInt64 UserID sql.NullInt64 PublicAddress sql.NullString Params pqtype.NullRawMessage }
type Queries ¶
type Queries struct {
// contains filtered or unexported fields
}
func (*Queries) GetFirstUser ¶
----- SELECTS -------
func (*Queries) GetUserByAddress ¶
func (*Queries) GetUserByForeignKey ¶
func (*Queries) GetUserDevices ¶
func (*Queries) GetUserSigningParameters ¶
func (*Queries) GetUserWallets ¶
func (*Queries) GetWalletByAddress ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) AuthorizeHandler ¶
func (server *Server) AuthorizeHandler(w http.ResponseWriter, r *http.Request)
AuthorizeHandler is responsible for creating an access token allowing for a tss request to be performed It uses identityMiddleware to get the userId from auth provider based on a generic bearer token provided by the client It then creates an access token linked to that userId, stores it in cache and returns it
func (*Server) CustomAuth ¶
CustomAuth gets the userId from a generic CustomAuth auth provider, based on a token representing a session or connexion Calls the generic CustomAuth auth provider using the webhook provided (server config) with pre-established API contract
func (*Server) DkgHandler ¶
func (server *Server) DkgHandler(w http.ResponseWriter, r *http.Request)
DkgHandler performs the dkg process from the server side goes through the authMiddleware to confirm the access token and get the userId stores the result of dkg in DB (new wallet)
func (*Server) IdentifyHandler ¶
func (server *Server) IdentifyHandler(w http.ResponseWriter, r *http.Request)
IdentifyHandler is responsible for getting a unique identifier of a user from the auth provider It uses identityMiddleware to get the userId from auth provider based on a generic bearer token provided by the client, then returns it
func (*Server) RetrieveWallet ¶
RetrieveWallet retrieves a wallet from DB based on the userID of the user (which is a loose foreign key, the format will depend on the auth provider) Tested in integration tests (with throw away db)
func (*Server) RpcHandler ¶
func (server *Server) RpcHandler(w http.ResponseWriter, r *http.Request)
RpcHandler is used for debug operations : it logs every RPC-JSON requests and the return value
func (*Server) ServeWasm ¶
func (server *Server) ServeWasm(w http.ResponseWriter, r *http.Request)
ServeWasm is responsible for serving the wasm module
func (*Server) SignHandler ¶
func (server *Server) SignHandler(w http.ResponseWriter, r *http.Request)
SignHandler performs the signing process from the server side goes through the authMiddleware to confirm the access token and get the userId requires a hex-encoded message to be signed (provided in URL parameter)
func (*Server) StoreWallet ¶
StoreWallet upserts a wallet (if it already exists, it does nothing, no error returned) Tested in integration tests (with throw away db)
type SupabaseUser ¶
type SupabaseUser struct {
ID string `json:"id"`
}