Documentation ¶
Index ¶
- func AuthDetailsVerify(a tkv1.AuthDetails, serverPublicKey string) error
- func CastVoteDetailsVerify(cvd tkv1.CastVoteDetails, serverPublicKey string) error
- func CensorshipRecordVerify(r rcv1.Record, serverPubKey string) error
- func CommentEditVerify(c cmv1.Comment, serverPublicKey string) error
- func CommentTimestampVerify(ct cmv1.CommentTimestamp) error
- func CommentTimestampsVerify(tr cmv1.TimestampsReply) ([]uint32, error)
- func CommentVerify(c cmv1.Comment, serverPublicKey string) error
- func ProposalMetadataDecode(files []rcv1.File) (*piv1.ProposalMetadata, error)
- func RecordTimestampVerify(t rcv1.Timestamp) error
- func RecordTimestampsVerify(tr rcv1.TimestampsReply) error
- func RecordVerify(r rcv1.Record, serverPubKey string) error
- func StatusChangesDecode(metadata []v1.MetadataStream) ([]v1.StatusChange, error)
- func StatusChangesVerify(sc []v1.StatusChange) error
- func TicketVoteTimestampVerify(t tkv1.Timestamp) error
- func TicketVoteTimestampsVerify(tr tkv1.TimestampsReply) error
- func UserMetadataDecode(ms []v1.MetadataStream) (*rcv1.UserMetadata, error)
- func UserMetadataVerify(um v1.UserMetadata, merkleRoot string) error
- func VoteDetailsVerify(vd tkv1.VoteDetails, serverPublicKey string) error
- func VoteMetadataDecode(files []rcv1.File) (*piv1.VoteMetadata, error)
- type Client
- func (c *Client) CommentCount(cc cmv1.Count) (*cmv1.CountReply, error)
- func (c *Client) CommentDel(d cmv1.Del) (*cmv1.DelReply, error)
- func (c *Client) CommentEdit(e cmv1.Edit) (*cmv1.EditReply, error)
- func (c *Client) CommentNew(n cmv1.New) (*cmv1.NewReply, error)
- func (c *Client) CommentPolicy() (*cmv1.PolicyReply, error)
- func (c *Client) CommentTimestamps(t cmv1.Timestamps) (*cmv1.TimestampsReply, error)
- func (c *Client) CommentVote(v cmv1.Vote) (*cmv1.VoteReply, error)
- func (c *Client) CommentVotes(v cmv1.Votes) (*cmv1.VotesReply, error)
- func (c *Client) Comments(cm cmv1.Comments) (*cmv1.CommentsReply, error)
- func (c *Client) PiBillingStatusChanges(bscs piv1.BillingStatusChanges) (*piv1.BillingStatusChangesReply, error)
- func (c *Client) PiPolicy() (*piv1.PolicyReply, error)
- func (c *Client) PiSetBillingStatus(sbs piv1.SetBillingStatus) (*piv1.SetBillingStatusReply, error)
- func (c *Client) PiSummaries(s piv1.Summaries) (*piv1.SummariesReply, error)
- func (c *Client) RecordDetails(d rcv1.Details) (*rcv1.Record, error)
- func (c *Client) RecordEdit(e rcv1.Edit) (*rcv1.EditReply, error)
- func (c *Client) RecordInventory(i rcv1.Inventory) (*rcv1.InventoryReply, error)
- func (c *Client) RecordInventoryOrdered(i rcv1.InventoryOrdered) (*rcv1.InventoryOrderedReply, error)
- func (c *Client) RecordNew(n rcv1.New) (*rcv1.NewReply, error)
- func (c *Client) RecordPolicy() (*rcv1.PolicyReply, error)
- func (c *Client) RecordSetStatus(ss rcv1.SetStatus) (*rcv1.SetStatusReply, error)
- func (c *Client) RecordTimestamps(t rcv1.Timestamps) (*rcv1.TimestampsReply, error)
- func (c *Client) Records(r rcv1.Records) (map[string]rcv1.Record, error)
- func (c *Client) TicketVoteAuthorize(a tkv1.Authorize) (*tkv1.AuthorizeReply, error)
- func (c *Client) TicketVoteCastBallot(cb tkv1.CastBallot) (*tkv1.CastBallotReply, error)
- func (c *Client) TicketVoteDetails(d tkv1.Details) (*tkv1.DetailsReply, error)
- func (c *Client) TicketVoteInventory(i tkv1.Inventory) (*tkv1.InventoryReply, error)
- func (c *Client) TicketVotePolicy() (*tkv1.PolicyReply, error)
- func (c *Client) TicketVoteResults(r tkv1.Results) (*tkv1.ResultsReply, error)
- func (c *Client) TicketVoteStart(s tkv1.Start) (*tkv1.StartReply, error)
- func (c *Client) TicketVoteSubmissions(s tkv1.Submissions) (*tkv1.SubmissionsReply, error)
- func (c *Client) TicketVoteSummaries(s tkv1.Summaries) (*tkv1.SummariesReply, error)
- func (c *Client) TicketVoteTimestamps(t tkv1.Timestamps) (*tkv1.TimestampsReply, error)
- func (c *Client) UserRecords(ur rcv1.UserRecords) (*rcv1.UserRecordsReply, error)
- type ErrorReply
- type Opts
- type RespErr
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthDetailsVerify ¶
func AuthDetailsVerify(a tkv1.AuthDetails, serverPublicKey string) error
AuthDetailsVerify verifies the action, signature, and receipt of the provided ticketvote v1 AuthDetails.
func CastVoteDetailsVerify ¶
func CastVoteDetailsVerify(cvd tkv1.CastVoteDetails, serverPublicKey string) error
CastVoteDetailsVerify verifies the receipt of the provided ticketvote v1 CastVoteDetails.
func CensorshipRecordVerify ¶
CensorshipRecordVerify verifies the censorship record of a records v1 Record.
func CommentEditVerify ¶ added in v1.4.0
CommentEditVerify verifies the edited comment signature and receipt.
func CommentTimestampVerify ¶
func CommentTimestampVerify(ct cmv1.CommentTimestamp) error
CommentTimestampVerify verifies that all timestamps in the provided CommentTimestamp are valid.
func CommentTimestampsVerify ¶
func CommentTimestampsVerify(tr cmv1.TimestampsReply) ([]uint32, error)
CommentTimestampsVerify verifies that all timestamps in a comments v1 TimestampsReply are valid. The IDs of comments that have not been anchored yet are returned.
func CommentVerify ¶
CommentVerify verifies the comment signature and receipt. If the comment has been deleted then the deletion signature and receipt will be verified.
func ProposalMetadataDecode ¶
func ProposalMetadataDecode(files []rcv1.File) (*piv1.ProposalMetadata, error)
ProposalMetadataDecode decodes and returns the ProposalMetadata from the Provided record files. An error returned if a ProposalMetadata is not found.
func RecordTimestampVerify ¶
RecordTimestampVerify verifies a records v1 API timestamp. This proves inclusion of the data in the merkle root that was timestamped onto the dcr blockchain.
func RecordTimestampsVerify ¶
func RecordTimestampsVerify(tr rcv1.TimestampsReply) error
RecordTimestampsVerify verifies all timestamps in a records v1 API timestamps reply. This proves the inclusion of the data in the merkle root that was timestamped onto the dcr blockchain.
func RecordVerify ¶
RecordVerify verfifies the contents of a record. This includes verifying the censorship record, the user metadata, and any status changes that are present.
**Note** partial record's merkle root is not verifiable - when generating the record's merkle all files must be present.
func StatusChangesDecode ¶
func StatusChangesDecode(metadata []v1.MetadataStream) ([]v1.StatusChange, error)
StatusChangesDecode decodes and returns the status changes metadata stream from the provided metadata. An error IS NOT returned is status change metadata is not found.
func StatusChangesVerify ¶
func StatusChangesVerify(sc []v1.StatusChange) error
StatusChanges verifies the signatures on all status change metadata.
func TicketVoteTimestampVerify ¶
TicketVoteTimestampVerify verifies that the provided ticketvote v1 Timestamp is valid.
func TicketVoteTimestampsVerify ¶
func TicketVoteTimestampsVerify(tr tkv1.TimestampsReply) error
TicketVoteTimestampsVerify verifies that all timestamps in the ticketvote v1 TimestampsReply are valid.
func UserMetadataDecode ¶
func UserMetadataDecode(ms []v1.MetadataStream) (*rcv1.UserMetadata, error)
UserMetadataDecode decodes and returns the UserMetadata from the provided metadata streams. An error is returned if a UserMetadata is not found.
func UserMetadataVerify ¶
func UserMetadataVerify(um v1.UserMetadata, merkleRoot string) error
UserMetadataVerify verifies that the UserMetadata contains a valid user ID, a valid public key, and that this signature is a valid signature of the record merkle root.
func VoteDetailsVerify ¶
func VoteDetailsVerify(vd tkv1.VoteDetails, serverPublicKey string) error
VoteDetailsVerify verifies the signature and receipt of the provided ticketvote v1 VoteDetails.
func VoteMetadataDecode ¶
func VoteMetadataDecode(files []rcv1.File) (*piv1.VoteMetadata, error)
VoteMetadataDecode decodes and returns the VoteMetadata from the provided backend files. Nil is returned if a VoteMetadata is not found.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides a client for interacting with the politeiawww API.
func (*Client) CommentCount ¶
CommentCount sends a comments v1 Count request to politeiawww.
func (*Client) CommentDel ¶
CommentDel sends a comments v1 Del request to politeiawww.
func (*Client) CommentEdit ¶ added in v1.4.0
CommentEdit sends a comments v1 Edit request to politeiawww.
func (*Client) CommentNew ¶
CommentNew sends a comments v1 New request to politeiawww.
func (*Client) CommentPolicy ¶
func (c *Client) CommentPolicy() (*cmv1.PolicyReply, error)
CommentPolicy sends a comments v1 Policy request to politeiawww.
func (*Client) CommentTimestamps ¶
func (c *Client) CommentTimestamps(t cmv1.Timestamps) (*cmv1.TimestampsReply, error)
CommentTimestamps sends a comments v1 Timestamps request to politeiawww.
func (*Client) CommentVote ¶
CommentVote sends a comments v1 Vote request to politeiawww.
func (*Client) CommentVotes ¶
CommentVotes sends a comments v1 Votes request to politeiawww.
func (*Client) PiBillingStatusChanges ¶ added in v1.3.0
func (c *Client) PiBillingStatusChanges(bscs piv1.BillingStatusChanges) (*piv1.BillingStatusChangesReply, error)
PiBillingStatusChanges sends a pi v1 BillingStatusChanges request to politeiawww.
func (*Client) PiPolicy ¶
func (c *Client) PiPolicy() (*piv1.PolicyReply, error)
PiPolicy sends a pi v1 Policy request to politeiawww.
func (*Client) PiSetBillingStatus ¶ added in v1.2.0
func (c *Client) PiSetBillingStatus(sbs piv1.SetBillingStatus) (*piv1.SetBillingStatusReply, error)
PiSetBillingStatus sends a pi v1 SetBillingStatus request to politeiawww.
func (*Client) PiSummaries ¶ added in v1.2.0
PiSummaries sends a pi v1 Summaries request to politeiawww.
func (*Client) RecordDetails ¶
RecordDetails sends a records v1 Details request to politeiawww.
func (*Client) RecordEdit ¶
RecordEdit sends a records v1 Edit request to politeiawww.
func (*Client) RecordInventory ¶
RecordInventory sends a records v1 Inventory request to politeiawww.
func (*Client) RecordInventoryOrdered ¶
func (c *Client) RecordInventoryOrdered(i rcv1.InventoryOrdered) (*rcv1.InventoryOrderedReply, error)
RecordInventoryOrdered sends a records v1 InventoryOrdered request to politeiawww.
func (*Client) RecordPolicy ¶ added in v1.2.0
func (c *Client) RecordPolicy() (*rcv1.PolicyReply, error)
RecordPolicy sends a records v1 Policy request to politeiawww.
func (*Client) RecordSetStatus ¶
RecordSetStatus sends a records v1 SetStatus request to politeiawww.
func (*Client) RecordTimestamps ¶
func (c *Client) RecordTimestamps(t rcv1.Timestamps) (*rcv1.TimestampsReply, error)
RecordTimestamps sends a records v1 Timestamps request to politeiawww.
func (*Client) TicketVoteAuthorize ¶
TicketVoteAuthorize sends a ticketvote v1 Authorize request to politeiawww.
func (*Client) TicketVoteCastBallot ¶
func (c *Client) TicketVoteCastBallot(cb tkv1.CastBallot) (*tkv1.CastBallotReply, error)
TicketVoteCastBallot sends a ticketvote v1 CastBallot request to politeiawww.
func (*Client) TicketVoteDetails ¶
TicketVoteDetails sends a ticketvote v1 Details request to politeiawww.
func (*Client) TicketVoteInventory ¶
TicketVoteInventory sends a ticketvote v1 Inventory request to politeiawww.
func (*Client) TicketVotePolicy ¶
func (c *Client) TicketVotePolicy() (*tkv1.PolicyReply, error)
TicketVotePolicy sends a ticketvote v1 Policy request to politeiawww.
func (*Client) TicketVoteResults ¶
TicketVoteResults sends a ticketvote v1 Results request to politeiawww.
func (*Client) TicketVoteStart ¶
TicketVoteStart sends a ticketvote v1 Start request to politeiawww.
func (*Client) TicketVoteSubmissions ¶
func (c *Client) TicketVoteSubmissions(s tkv1.Submissions) (*tkv1.SubmissionsReply, error)
TicketVoteSubmissions sends a ticketvote v1 Submissions request to politeiawww.
func (*Client) TicketVoteSummaries ¶
TicketVoteSummaries sends a ticketvote v1 Summaries request to politeiawww.
func (*Client) TicketVoteTimestamps ¶
func (c *Client) TicketVoteTimestamps(t tkv1.Timestamps) (*tkv1.TimestampsReply, error)
TicketVoteTimestamps sends a ticketvote v1 Timestamps request to politeiawww.
func (*Client) UserRecords ¶
func (c *Client) UserRecords(ur rcv1.UserRecords) (*rcv1.UserRecordsReply, error)
UserRecords sends a records v1 UserRecords request to politeiawww.
type ErrorReply ¶
ErrorReply represents the request body that is returned from politeiawww when an error occurs. PluginID will only be populated if the error occurred during execution of a plugin command.
type Opts ¶
type Opts struct { HTTPSCert string Cookies []*http.Cookie HeaderCSRF string Verbose bool // Print verbose output RawJSON bool // Print raw json }
Opts contains the politeiawww client options. All values are optional.
Any provided HTTPSCert will be added to the http client's trusted cert pool, allowing you to interact with a politeiawww instance that uses a self signed cert.
Authenticated routes require a CSRF cookie as well as the corresponding CSRF header.
type RespErr ¶
type RespErr struct { HTTPCode int API string ErrorReply ErrorReply }
RespErr represents a politeiawww response error. A RespErr is returned anytime the politeiawww response is not a 200.
The various politeiawww APIs can have overlapping error codes. The API is included to allow the Error() method to return the correct human readable error message.