* Rework client/server authentication. - Remove Signature from all requests, and instead expect a signature in HTTP header "VSP-Client-Signature". - Remove CommitmentSignatures from the database. - Use a bool flag to indicate when a ticket is missing from the database rather than an error. This commit introduces a lot of duplication into each of the authenticated HTTP handlers. This should be removed in future work which moves the authentication to a dedicated middleware. * Introduce auth and rpc middleware. This removed the duplication added in the previous commit, and also removes the duplication of RPC client error handling.
63 lines
2.3 KiB
Go
63 lines
2.3 KiB
Go
package webapi
|
|
|
|
type pubKeyResponse struct {
|
|
Timestamp int64 `json:"timestamp" binding:"required"`
|
|
PubKey []byte `json:"pubkey" binding:"required"`
|
|
}
|
|
|
|
type feeResponse struct {
|
|
Timestamp int64 `json:"timestamp" binding:"required"`
|
|
Fee float64 `json:"fee" binding:"required"`
|
|
}
|
|
|
|
type FeeAddressRequest struct {
|
|
Timestamp int64 `json:"timestamp" binding:"required"`
|
|
TicketHash string `json:"tickethash" binding:"required"`
|
|
}
|
|
|
|
type feeAddressResponse struct {
|
|
Timestamp int64 `json:"timestamp" binding:"required"`
|
|
FeeAddress string `json:"feeaddress" binding:"required"`
|
|
Fee float64 `json:"fee" binding:"required"`
|
|
Expiration int64 `json:"expiration" binding:"required"`
|
|
Request FeeAddressRequest `json:"request" binding:"required"`
|
|
}
|
|
|
|
type PayFeeRequest struct {
|
|
Timestamp int64 `json:"timestamp" binding:"required"`
|
|
TicketHash string `json:"tickethash" binding:"required"`
|
|
FeeTx string `json:"feetx" binding:"required"`
|
|
VotingKey string `json:"votingkey" binding:"required"`
|
|
VoteChoices map[string]string `json:"votechoices" binding:"required"`
|
|
}
|
|
|
|
type payFeeResponse struct {
|
|
Timestamp int64 `json:"timestamp" binding:"required"`
|
|
TxHash string `json:"txhash" binding:"required"`
|
|
Request PayFeeRequest `json:"request" binding:"required"`
|
|
}
|
|
|
|
type SetVoteChoicesRequest struct {
|
|
Timestamp int64 `json:"timestamp" binding:"required"`
|
|
TicketHash string `json:"tickethash" binding:"required"`
|
|
VoteChoices map[string]string `json:"votechoices" binding:"required"`
|
|
}
|
|
|
|
type setVoteChoicesResponse struct {
|
|
Timestamp int64 `json:"timestamp" binding:"required"`
|
|
Request SetVoteChoicesRequest `json:"request" binding:"required"`
|
|
VoteChoices map[string]string `json:"votechoices" binding:"required"`
|
|
}
|
|
|
|
type TicketStatusRequest struct {
|
|
Timestamp int64 `json:"timestamp" binding:"required"`
|
|
TicketHash string `json:"tickethash" binding:"required"`
|
|
}
|
|
|
|
type ticketStatusResponse struct {
|
|
Timestamp int64 `json:"timestamp" binding:"required"`
|
|
Request TicketStatusRequest `json:"request" binding:"required"`
|
|
Status string `json:"status" binding:"required"`
|
|
VoteChoices map[string]string `json:"votechoices" binding:"required"`
|
|
}
|