Documentation
¶
Index ¶
- Variables
- func ExtractToken(f func(string, http.ResponseWriter, *http.Request, httprouter.Params)) httprouter.Handle
- func NewAuth(log *zap.Logger, cfgStore RSAStore, tokenExpiry time.Duration) (*auth, error)
- func ParseSubmitTransactionRequest(r *http.Request) (*walletpb.SubmitTransactionRequest, commands.Errors)
- type Auth
- type Claims
- type CreateLoginWalletRequest
- type ErrorResponse
- type ErrorsResponse
- type GenKeyPairRequest
- type KeyResponse
- type KeysResponse
- type NodeForward
- type RSAStore
- type Service
- func (s *Service) CreateWallet(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
- func (s *Service) DownloadWallet(token string, w http.ResponseWriter, r *http.Request, _ httprouter.Params)
- func (s *Service) GenerateKeypair(t string, w http.ResponseWriter, r *http.Request, _ httprouter.Params)
- func (s *Service) GetPublicKey(t string, w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func (s *Service) ListPublicKeys(t string, w http.ResponseWriter, r *http.Request, _ httprouter.Params)
- func (s *Service) Login(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
- func (s *Service) Revoke(t string, w http.ResponseWriter, _ *http.Request, _ httprouter.Params)
- func (s *Service) SignAny(t string, w http.ResponseWriter, r *http.Request, _ httprouter.Params)
- func (s *Service) SignTx(t string, w http.ResponseWriter, r *http.Request, p httprouter.Params)
- func (s *Service) SignTxAsync(t string, w http.ResponseWriter, r *http.Request, p httprouter.Params)
- func (s *Service) SignTxCommit(t string, w http.ResponseWriter, r *http.Request, p httprouter.Params)
- func (s *Service) SignTxCommitV2(token string, w http.ResponseWriter, r *http.Request, p httprouter.Params)
- func (s *Service) SignTxSyncV2(token string, w http.ResponseWriter, r *http.Request, p httprouter.Params)
- func (s *Service) SignTxV2(token string, w http.ResponseWriter, r *http.Request, p httprouter.Params)
- func (s *Service) Start() error
- func (s *Service) Stop() error
- func (s *Service) TaintKey(t string, w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func (s *Service) UpdateMeta(t string, w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func (s *Service) VerifyAny(t string, w http.ResponseWriter, r *http.Request, _ httprouter.Params)
- type SignAnyRequest
- type SignAnyResponse
- type SignTxRequest
- type SignTxResponse
- type SuccessResponse
- type TaintKeyRequest
- type TokenResponse
- type UpdateMetaRequest
- type VerifyAnyRequest
- type WalletHandler
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidOrMissingToken = newErrorResponse("invalid or missing token") ErrCouldNotReadRequest = errors.New("could not read request") ErrCouldNotGetBlockHeight = errors.New("could not get last block height") )
var (
ErrSessionNotFound = errors.New("session not found")
)
Functions ¶
func ExtractToken ¶
func ExtractToken(f func(string, http.ResponseWriter, *http.Request, httprouter.Params)) httprouter.Handle
ExtractToken this is public for testing purposes
Types ¶
type Auth ¶
type Auth interface { NewSession(name string) (string, error) VerifyToken(token string) (string, error) Revoke(token string) error }
Auth ...
type CreateLoginWalletRequest ¶
type CreateLoginWalletRequest struct { Wallet string `json:"wallet"` Passphrase string `json:"passphrase"` }
CreateLoginWalletRequest describes the request for CreateWallet, LoginWallet.
func ParseCreateLoginWalletRequest ¶
func ParseCreateLoginWalletRequest(r *http.Request) (*CreateLoginWalletRequest, commands.Errors)
type ErrorResponse ¶
func (ErrorResponse) Error ¶
func (e ErrorResponse) Error() string
type ErrorsResponse ¶
type GenKeyPairRequest ¶
type GenKeyPairRequest struct { Passphrase string `json:"passphrase"` Meta []wallet.Meta `json:"meta"` }
GenKeyPairRequest describes the request for GenerateKeypair
func ParseGenKeyPairRequest ¶
func ParseGenKeyPairRequest(r *http.Request) (*GenKeyPairRequest, commands.Errors)
type KeyResponse ¶
KeyResponse describes the response to a request that returns a single key.
type KeysResponse ¶
KeysResponse describes the response to a request that returns a list of keys.
type NodeForward ¶
type NodeForward interface { Send(context.Context, *wallet.SignedBundle, api.SubmitTransactionRequest_Type) error SendTxV2(context.Context, *commandspb.Transaction, api.SubmitTransactionV2Request_Type) error HealthCheck(context.Context) error LastBlockHeight(context.Context) (uint64, error) }
NodeForward ...
type Service ¶
type Service struct { *httprouter.Router // contains filtered or unexported fields }
func NewService ¶
func NewServiceWith ¶
func NewServiceWith(log *zap.Logger, cfg *config.Config, h WalletHandler, a Auth, n NodeForward) (*Service, error)
func (*Service) CreateWallet ¶
func (s *Service) CreateWallet(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
func (*Service) DownloadWallet ¶
func (s *Service) DownloadWallet(token string, w http.ResponseWriter, r *http.Request, _ httprouter.Params)
func (*Service) GenerateKeypair ¶
func (s *Service) GenerateKeypair(t string, w http.ResponseWriter, r *http.Request, _ httprouter.Params)
func (*Service) GetPublicKey ¶
func (s *Service) GetPublicKey(t string, w http.ResponseWriter, r *http.Request, ps httprouter.Params)
func (*Service) ListPublicKeys ¶
func (s *Service) ListPublicKeys(t string, w http.ResponseWriter, r *http.Request, _ httprouter.Params)
func (*Service) Login ¶
func (s *Service) Login(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
func (*Service) Revoke ¶
func (s *Service) Revoke(t string, w http.ResponseWriter, _ *http.Request, _ httprouter.Params)
func (*Service) SignAny ¶
func (s *Service) SignAny(t string, w http.ResponseWriter, r *http.Request, _ httprouter.Params)
func (*Service) SignTx ¶
func (s *Service) SignTx(t string, w http.ResponseWriter, r *http.Request, p httprouter.Params)
func (*Service) SignTxAsync ¶
func (s *Service) SignTxAsync(t string, w http.ResponseWriter, r *http.Request, p httprouter.Params)
func (*Service) SignTxCommit ¶
func (s *Service) SignTxCommit(t string, w http.ResponseWriter, r *http.Request, p httprouter.Params)
func (*Service) SignTxCommitV2 ¶
func (s *Service) SignTxCommitV2(token string, w http.ResponseWriter, r *http.Request, p httprouter.Params)
func (*Service) SignTxSyncV2 ¶
func (s *Service) SignTxSyncV2(token string, w http.ResponseWriter, r *http.Request, p httprouter.Params)
func (*Service) SignTxV2 ¶
func (s *Service) SignTxV2(token string, w http.ResponseWriter, r *http.Request, p httprouter.Params)
func (*Service) TaintKey ¶
func (s *Service) TaintKey(t string, w http.ResponseWriter, r *http.Request, ps httprouter.Params)
func (*Service) UpdateMeta ¶
func (s *Service) UpdateMeta(t string, w http.ResponseWriter, r *http.Request, ps httprouter.Params)
func (*Service) VerifyAny ¶
func (s *Service) VerifyAny(t string, w http.ResponseWriter, r *http.Request, _ httprouter.Params)
type SignAnyRequest ¶
type SignAnyRequest struct { // InputData is the payload to generate a signature from. I should be // base 64 encoded. InputData string `json:"inputData"` // PubKey is used to retrieve the private key to sign the InputDate. PubKey string `json:"pubKey"` }
SignAnyRequest describes the request for SignAny.
func ParseSignAnyRequest ¶
func ParseSignAnyRequest(r *http.Request) (*SignAnyRequest, commands.Errors)
type SignAnyResponse ¶
type SignAnyResponse struct { HexSignature string `json:"hexSignature"` Base64Signature string `json:"base64Signature"` }
SignAnyResponse describes the response for SignAny.
type SignTxRequest ¶
type SignTxRequest struct { Tx string `json:"tx"` PubKey string `json:"pubKey"` Propagate bool `json:"propagate"` }
SignTxRequest describes the request for SignTx.
type SignTxResponse ¶
type SignTxResponse struct { SignedTx wallet.SignedBundle `json:"signedTx"` HexBundle string `json:"hexBundle"` Base64Bundle string `json:"base64Bundle"` }
SignTxResponse describes the response for SignTx.
type SuccessResponse ¶
type SuccessResponse struct {
Success bool `json:"success"`
}
SuccessResponse describes the response to a request that returns a simple true/false answer.
type TaintKeyRequest ¶
type TaintKeyRequest struct {
Passphrase string `json:"passphrase"`
}
TaintKeyRequest describes the request for TaintKey.
func ParseTaintKeyRequest ¶
type TokenResponse ¶
type TokenResponse struct {
Token string `json:"token"`
}
TokenResponse describes the response to a request that returns a token.
type UpdateMetaRequest ¶
type UpdateMetaRequest struct { Passphrase string `json:"passphrase"` Meta []wallet.Meta `json:"meta"` }
UpdateMetaRequest describes the request for UpdateMeta.
func ParseUpdateMetaRequest ¶
type VerifyAnyRequest ¶
type VerifyAnyRequest struct { // InputData is the payload to be verified. It should be base64 encoded. InputData string `json:"inputData"` // Signature is the signature to check against the InputData. It should be // base64 encoded. Signature string `json:"signature"` // PubKey is the public key used along the signature to check the InputData. PubKey string `json:"pubKey"` }
VerifyAnyRequest describes the request for VerifyAny.
func ParseVerifyAnyRequest ¶
func ParseVerifyAnyRequest(r *http.Request) (*VerifyAnyRequest, commands.Errors)
type WalletHandler ¶
type WalletHandler interface { CreateWallet(name, passphrase string) error LoginWallet(name, passphrase string) error LogoutWallet(name string) SecureGenerateKeyPair(name, passphrase string) (string, error) GetPublicKey(name, pubKey string) (*wallet.PublicKey, error) ListPublicKeys(name string) ([]wallet.PublicKey, error) SignTx(name, tx, pubKey string, height uint64) (wallet.SignedBundle, error) SignTxV2(name string, req *walletpb.SubmitTransactionRequest, height uint64) (*commandspb.Transaction, error) SignAny(name, inputData, pubKey string) ([]byte, error) VerifyAny(name, inputData, sig, pubKey string) (bool, error) TaintKey(name, pubKey, passphrase string) error UpdateMeta(name, pubKey, passphrase string, meta []wallet.Meta) error GetWalletPath(name string) (string, error) }
WalletHandler ...