 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Overview ¶
sequence-guard v0.4.0 776b307c2145ac7a994eec63240acae042c96067 -- Code generated by webrpc-gen@v0.25.3 with golang generator. DO NOT EDIT.
webrpc-gen -schema=guard.ridl -target=golang -pkg=proto -client -out=./clients/guard.gen.go
Index ¶
- Constants
- Variables
- func HTTPRequestHeaders(ctx context.Context) (http.Header, bool)
- func MethodCtx(ctx context.Context) (method, bool)
- func MethodNameFromContext(ctx context.Context) string
- func RequestFromContext(ctx context.Context) *http.Request
- func ServiceNameFromContext(ctx context.Context) string
- func WebRPCSchemaHash() string
- func WebRPCSchemaVersion() string
- func WebRPCVersion() string
- func WebrpcMethods() map[string]method
- func WithHTTPRequestHeaders(ctx context.Context, h http.Header) (context.Context, error)
- type AuthToken
- type Guard
- type GuardClient
- type HTTPClient
- type OwnershipProof
- type RecoveryCode
- type RuntimeStatus
- type SignRequest
- type Version
- type WalletConfig
- type WalletSigner
- type WebRPCError
- type WebrpcGenVersions
Constants ¶
      View Source
      
  
    const GuardPathPrefix = "/rpc/Guard/"
    
      View Source
      
  
    const WebrpcHeader = "Webrpc"
    
      View Source
      
  
const WebrpcHeaderValue = "webrpc@v0.25.3;gen-golang@v0.18.4;sequence-guard@v0.4.0"
    Variables ¶
      View Source
      
  
    var ( HTTPClientRequestHeadersCtxKey = &contextKey{"HTTPClientRequestHeaders"} HTTPRequestCtxKey = &contextKey{"HTTPRequest"} ServiceNameCtxKey = &contextKey{"ServiceName"} MethodNameCtxKey = &contextKey{"MethodName"} )
      View Source
      
  var ( ErrWebrpcEndpoint = WebRPCError{Code: 0, Name: "WebrpcEndpoint", Message: "endpoint error", HTTPStatus: 400} ErrWebrpcRequestFailed = WebRPCError{Code: -1, Name: "WebrpcRequestFailed", Message: "request failed", HTTPStatus: 400} ErrWebrpcBadRoute = WebRPCError{Code: -2, Name: "WebrpcBadRoute", Message: "bad route", HTTPStatus: 404} ErrWebrpcBadMethod = WebRPCError{Code: -3, Name: "WebrpcBadMethod", Message: "bad method", HTTPStatus: 405} ErrWebrpcBadRequest = WebRPCError{Code: -4, Name: "WebrpcBadRequest", Message: "bad request", HTTPStatus: 400} ErrWebrpcBadResponse = WebRPCError{Code: -5, Name: "WebrpcBadResponse", Message: "bad response", HTTPStatus: 500} ErrWebrpcServerPanic = WebRPCError{Code: -6, Name: "WebrpcServerPanic", Message: "server panic", HTTPStatus: 500} ErrWebrpcInternalError = WebRPCError{Code: -7, Name: "WebrpcInternalError", Message: "internal error", HTTPStatus: 500} ErrWebrpcClientDisconnected = WebRPCError{Code: -8, Name: "WebrpcClientDisconnected", Message: "client disconnected", HTTPStatus: 400} ErrWebrpcStreamLost = WebRPCError{Code: -9, Name: "WebrpcStreamLost", Message: "stream lost", HTTPStatus: 400} ErrWebrpcStreamFinished = WebRPCError{Code: -10, Name: "WebrpcStreamFinished", Message: "stream finished", HTTPStatus: 200} )
Webrpc errors
      View Source
      
  var ( ErrPermissionDenied = WebRPCError{Code: 1001, Name: "PermissionDenied", Message: "Permission denied", HTTPStatus: 403} ErrSessionExpired = WebRPCError{Code: 1002, Name: "SessionExpired", Message: "Session expired", HTTPStatus: 403} ErrMethodNotFound = WebRPCError{Code: 1003, Name: "MethodNotFound", Message: "Method not found", HTTPStatus: 404} ErrRequestConflict = WebRPCError{Code: 1004, Name: "RequestConflict", Message: "Conflict with target resource", HTTPStatus: 409} ErrAborted = WebRPCError{Code: 1005, Name: "Aborted", Message: "Request aborted", HTTPStatus: 400} ErrGeoblocked = WebRPCError{Code: 1006, Name: "Geoblocked", Message: "Geoblocked region", HTTPStatus: 451} ErrRateLimited = WebRPCError{Code: 1007, Name: "RateLimited", Message: "Rate-limited. Please slow down.", HTTPStatus: 429} ErrInvalidArgument = WebRPCError{Code: 2001, Name: "InvalidArgument", Message: "Invalid argument", HTTPStatus: 400} ErrQueryFailed = WebRPCError{Code: 2003, Name: "QueryFailed", Message: "Query failed", HTTPStatus: 400} ErrValidationFailed = WebRPCError{Code: 2004, Name: "ValidationFailed", Message: "Validation Failed", HTTPStatus: 422} ErrNotFound = WebRPCError{Code: 3000, Name: "NotFound", Message: "Resource not found", HTTPStatus: 400} )
Schema errors
      View Source
      
  
var WebRPCServices = map[string][]string{
	"Guard": {
		"Ping",
		"Version",
		"RuntimeStatus",
		"GetSignerConfig",
		"Sign",
		"SignWith",
		"Patch",
		"AuthMethods",
		"SetPIN",
		"ResetPIN",
		"CreateTOTP",
		"CommitTOTP",
		"ResetTOTP",
		"Reset2FA",
		"RecoveryCodes",
		"ResetRecoveryCodes",
	},
}
    Functions ¶
func MethodNameFromContext ¶
func ServiceNameFromContext ¶
func WebrpcMethods ¶
func WebrpcMethods() map[string]method
Types ¶
type Guard ¶
type Guard interface {
	Ping(ctx context.Context) (bool, error)
	Version(ctx context.Context) (*Version, error)
	RuntimeStatus(ctx context.Context) (*RuntimeStatus, error)
	GetSignerConfig(ctx context.Context, signer string) (*WalletConfig, error)
	// Called by sequence.app when the user signs in, and signs messages/transactions/migrations.
	// Requires a valid 2FA token if enabled.
	Sign(ctx context.Context, request *SignRequest, token *AuthToken) (string, error)
	SignWith(ctx context.Context, signer string, request *SignRequest, token *AuthToken) (string, error)
	// Internal use only.
	// Only ever needs to be called once per chain.
	// Signs a preconfigured payload that the caller has no control over.
	Patch(ctx context.Context, signer string, chainId uint64, secret string) (interface{}, error)
	// Called by sequence.app when it needs to check the user's 2FA.
	// This happens during sign in, before signing messages and transactions, and when configuring 2FA.
	// Requires either a valid JWT or a signature by one of the wallet's signers.
	AuthMethods(ctx context.Context, proof *OwnershipProof) ([]string, bool, error)
	// Not currently called. Requires both a JWT and a wallet signature.
	SetPIN(ctx context.Context, pin string, timestamp uint64, signature string) error
	// Not currently called. Requires both a JWT and a wallet signature.
	ResetPIN(ctx context.Context, timestamp uint64, signature string) error
	// Called by sequence.app when the user configures their 2FA.
	// Requires both a JWT and a wallet signature.
	CreateTOTP(ctx context.Context, timestamp uint64, signature string) (string, error)
	// Called by sequence.app when the user configures their 2FA.
	// Requires both a JWT and a wallet signature.
	CommitTOTP(ctx context.Context, token string) ([]*RecoveryCode, error)
	// Called by sequence.app when the user configures their 2FA.
	// Requires both a JWT and a wallet signature.
	ResetTOTP(ctx context.Context, timestamp uint64, signature string) error
	// Called by sequence.app when the user uses a recovery code.
	// Requires either a valid JWT or a signature by one of the wallet's signers.
	Reset2FA(ctx context.Context, code string, proof *OwnershipProof) error
	// Called by sequence.app when the user is viewing their recovery codes.
	// Requires both a JWT and a wallet signature.
	RecoveryCodes(ctx context.Context, timestamp uint64, signature string) ([]*RecoveryCode, error)
	// Called by sequence.app when the user is viewing their recovery codes.
	// Requires both a JWT and a wallet signature.
	ResetRecoveryCodes(ctx context.Context, timestamp uint64, signature string) ([]*RecoveryCode, error)
}
    type GuardClient ¶
type GuardClient interface {
	Ping(ctx context.Context) (bool, error)
	Version(ctx context.Context) (*Version, error)
	RuntimeStatus(ctx context.Context) (*RuntimeStatus, error)
	GetSignerConfig(ctx context.Context, signer string) (*WalletConfig, error)
	// Called by sequence.app when the user signs in, and signs messages/transactions/migrations.
	// Requires a valid 2FA token if enabled.
	Sign(ctx context.Context, request *SignRequest, token *AuthToken) (string, error)
	SignWith(ctx context.Context, signer string, request *SignRequest, token *AuthToken) (string, error)
	// Internal use only.
	// Only ever needs to be called once per chain.
	// Signs a preconfigured payload that the caller has no control over.
	Patch(ctx context.Context, signer string, chainId uint64, secret string) (interface{}, error)
	// Called by sequence.app when it needs to check the user's 2FA.
	// This happens during sign in, before signing messages and transactions, and when configuring 2FA.
	// Requires either a valid JWT or a signature by one of the wallet's signers.
	AuthMethods(ctx context.Context, proof *OwnershipProof) ([]string, bool, error)
	// Not currently called. Requires both a JWT and a wallet signature.
	SetPIN(ctx context.Context, pin string, timestamp uint64, signature string) error
	// Not currently called. Requires both a JWT and a wallet signature.
	ResetPIN(ctx context.Context, timestamp uint64, signature string) error
	// Called by sequence.app when the user configures their 2FA.
	// Requires both a JWT and a wallet signature.
	CreateTOTP(ctx context.Context, timestamp uint64, signature string) (string, error)
	// Called by sequence.app when the user configures their 2FA.
	// Requires both a JWT and a wallet signature.
	CommitTOTP(ctx context.Context, token string) ([]*RecoveryCode, error)
	// Called by sequence.app when the user configures their 2FA.
	// Requires both a JWT and a wallet signature.
	ResetTOTP(ctx context.Context, timestamp uint64, signature string) error
	// Called by sequence.app when the user uses a recovery code.
	// Requires either a valid JWT or a signature by one of the wallet's signers.
	Reset2FA(ctx context.Context, code string, proof *OwnershipProof) error
	// Called by sequence.app when the user is viewing their recovery codes.
	// Requires both a JWT and a wallet signature.
	RecoveryCodes(ctx context.Context, timestamp uint64, signature string) ([]*RecoveryCode, error)
	// Called by sequence.app when the user is viewing their recovery codes.
	// Requires both a JWT and a wallet signature.
	ResetRecoveryCodes(ctx context.Context, timestamp uint64, signature string) ([]*RecoveryCode, error)
}
    func NewGuardClient ¶
func NewGuardClient(addr string, client HTTPClient) GuardClient
type HTTPClient ¶
HTTPClient is the interface used by generated clients to send HTTP requests. It is fulfilled by *(net/http).Client, which is sufficient for most users. Users can provide their own implementation for special retry policies.
type OwnershipProof ¶
type RecoveryCode ¶
type RuntimeStatus ¶
type SignRequest ¶
type WalletConfig ¶
type WalletSigner ¶
type WebRPCError ¶
type WebRPCError struct {
	Name       string `json:"error"`
	Code       int    `json:"code"`
	Message    string `json:"msg"`
	Cause      string `json:"cause,omitempty"`
	HTTPStatus int    `json:"status"`
	// contains filtered or unexported fields
}
    
        
          
            func ErrorWithCause
            deprecated
            
          
  
    
  
      
      func ErrorWithCause(rpcErr WebRPCError, cause error) WebRPCError
Deprecated: Use .WithCause() method on WebRPCError.
func (WebRPCError) Error ¶
func (e WebRPCError) Error() string
func (WebRPCError) Is ¶
func (e WebRPCError) Is(target error) bool
func (WebRPCError) Unwrap ¶
func (e WebRPCError) Unwrap() error
func (WebRPCError) WithCause ¶
func (e WebRPCError) WithCause(cause error) WebRPCError
func (WebRPCError) WithCausef ¶
func (e WebRPCError) WithCausef(format string, args ...interface{}) WebRPCError
type WebrpcGenVersions ¶
type WebrpcGenVersions struct {
	WebrpcGenVersion string
	CodeGenName      string
	CodeGenVersion   string
	SchemaName       string
	SchemaVersion    string
}
    func VersionFromHeader ¶
func VersionFromHeader(h http.Header) (*WebrpcGenVersions, error)
 Click to show internal directories. 
   Click to hide internal directories.