commands

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 9, 2019 License: ISC Imports: 22 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ErrorNoUserIdentity = "No user identity found.  You must login with a user."
	ErrorNoProposalFile = "You must either provide a markdown file or use the --random flag"
	ErrorBeforeAndAfter = "before and after flags cannot be used at the same time"
)

Variables

View Source
var AuthorizeVoteCmdHelpMsg = `` /* 543-byte string literal not displayed */

Help message displayed for the command 'hcAutonomywwwcli help authorizevote'

View Source
var LoginCmdHelpMsg = `` /* 877-byte string literal not displayed */

Help message displayed for the command 'hcAutonomywwwcli help login'

View Source
var LogoutCmdHelpMsg = `logout 

Logout as a user or admin.

Arguments:
None

Result:
{}`

Help message displayed for the command 'hcAutonomywwwcli help logout'

View Source
var NewProposalCmdHelpMsg = `` /* 600-byte string literal not displayed */

Help message displayed for the command 'hcAutonomywwwcli help newproposal'

View Source
var NewUserCmdHelpMsg = `` /* 625-byte string literal not displayed */

Help message displayed for the command 'hcAutonomywwwcli help newuser'

Functions

func ConvertTicketHashes

func ConvertTicketHashes(h []string) ([][]byte, error)

ConvertTicketHashes converts a slice of hexadecimal ticket hashes into a slice of byte slices.

func DigestSHA3

func DigestSHA3(s string) string

Digest returns the hex encoded SHA3-256 of a string.

func NewIdentity

func NewIdentity() (*identity.FullIdentity, error)

NewIdentity generates a new FullIdentity using randomly generated data to create the public/private key pair.

func Print

func Print(body interface{}, verbose, rawJSON bool) error

func PromptPassphrase

func PromptPassphrase() ([]byte, error)

PromptPassphrase is used to prompt the user for the private passphrase to their wallet.

func SetClient

func SetClient(client *client.Client)

func SetConfig

func SetConfig(config *config.Config)

func SignMerkleRoot

func SignMerkleRoot(files []v1.File, id *identity.FullIdentity) (string, error)

SignMerkleRoot calculates the merkle root of the passed in list of files, signs the merkle root with the passed in identity and returns the signature.

func VerifyProposal

func VerifyProposal(p v1.ProposalRecord, serverPubKey string) error

VerifyProposal verifies the integrity of a proposal by verifying the proposal's merkle root (if the files are present), the proposal signature, and the censorship record signature.

Types

type AuthorizeVoteCmd

type AuthorizeVoteCmd struct {
	Args struct {
		Token  string `positional-arg-name:"token" required:"true" description:"Proposal censorship token"`
		Action string `positional-arg-name:"action" description:"Valid actions are 'authorize' or 'revoke'"`
	} `positional-args:"true"`
}

func (*AuthorizeVoteCmd) Execute

func (cmd *AuthorizeVoteCmd) Execute(args []string) error

type CensorCommentCmd

type CensorCommentCmd struct {
	Args struct {
		Token     string `positional-arg-name:"token" description:"Proposal censorship token"`
		CommentID string `positional-arg-name:"commentID" description:"ID of the comment"`
		Reason    string `positional-arg-name:"reason" description:"Reason for censoring the comment"`
	} `positional-args:"true" required:"true"`
}

func (*CensorCommentCmd) Execute

func (cmd *CensorCommentCmd) Execute(args []string) error

type ChangePasswordCmd

type ChangePasswordCmd struct {
	Args struct {
		Password    string `positional-arg-name:"currentPassword"`
		NewPassword string `positional-arg-name:"newPassword"`
	} `positional-args:"true" required:"true"`
}

func (*ChangePasswordCmd) Execute

func (cmd *ChangePasswordCmd) Execute(args []string) error

type ChangeUsernameCmd

type ChangeUsernameCmd struct {
	Args struct {
		Password    string `positional-arg-name:"password"`
		NewUsername string `positional-arg-name:"newusername"`
	} `positional-args:"true" required:"true"`
}

func (*ChangeUsernameCmd) Execute

func (cmd *ChangeUsernameCmd) Execute(args []string) error

type Cmds

type Cmds struct {
	AuthorizeVote      AuthorizeVoteCmd      `command:"authorizevote" description:"authorize a proposal vote (must be proposal author)"`
	CensorComment      CensorCommentCmd      `command:"censorcomment" description:"(admin) censor a proposal comment"`
	ChangePassword     ChangePasswordCmd     `command:"changepassword" description:"change the password for the currently logged in user"`
	CommentsLikes      CommentsLikesCmd      `command:"commentslikes" description:"fetch all the comments voted by the user on a proposal"`
	ChangeUsername     ChangeUsernameCmd     `command:"changeusername" description:"change the username for the currently logged in user"`
	EditProposal       EditProposalCmd       `command:"editproposal" description:"edit a proposal"`
	ManageUser         ManageUserCmd         `command:"manageuser" description:"(admin) edit the details for the given user id"`
	EditUser           EditUserCmd           `command:"edituser" description:"edit your user preferences"`
	Faucet             FaucetCmd             `command:"faucet" description:"use the Hc testnet faucet to send HC to an address"`
	GetComments        GetCommentsCmd        `command:"getcomments" description:"fetch a proposal's comments"`
	GetProposal        GetProposalCmd        `command:"getproposal" description:"fetch a proposal"`
	GetUnvetted        GetUnvettedCmd        `command:"getunvetted" description:"fetch unvetted proposals"`
	GetVetted          GetVettedCmd          `command:"getvetted" description:"fetch vetted proposals"`
	GetPaywallPayment  GetPaywallPaymentCmd  `command:"getpaywallpayment" description:"fetch payment details for a proposal paywall payment"`
	Help               HelpCmd               `command:"help" description:"print detailed help message of specified command"`
	Inventory          InventoryCmd          `command:"inventory" description:"fetch the proposals that are being voted on"`
	Login              LoginCmd              `command:"login" description:"login to HcAutonomy"`
	Logout             LogoutCmd             `command:"logout" description:"logout of HcAutonomy"`
	Me                 MeCmd                 `command:"me" description:"return the user information of the currently logged in user"`
	NewProposal        NewProposalCmd        `command:"newproposal" description:"submit a new proposal to HcAutonomy"`
	NewComment         NewCommentCmd         `command:"newcomment" description:"comment on a proposal"`
	NewUser            NewUserCmd            `command:"newuser" description:"create a new HcAutonomy user"`
	Policy             PolicyCmd             `command:"policy" description:"fetch server policy"`
	ProposalPaywall    ProposalPaywallCmd    `command:"proposalpaywall" description:"fetch proposal paywall details"`
	ProposalVotes      ProposalVotesCmd      `command:"proposalvotes" description:"fetch vote results for a specific proposal"`
	RescanUserPayments RescanUserPaymentsCmd `command:"rescanuserpayments" description:"rescan user payments to check for missed payments"`
	ResetPassword      ResetPasswordCmd      `command:"resetpassword" description:"change the password for a user that is not currently logged in"`
	Secret             SecretCmd             `command:"secret" description:"ping hcAutonomywww"`
	SetProposalStatus  SetProposalStatusCmd  `command:"setproposalstatus" description:"(admin) set the status of a proposal"`
	StartVote          StartVoteCmd          `command:"startvote" description:"(admin) start the voting period on a proposal"`
	Tally              TallyCmd              `command:"tally" description:"fetch the vote tally for a proposal"`
	UpdateUserKey      UpdateUserKeyCmd      `command:"updateuserkey" description:"generate a new identity for the user"`
	UserDetails        UserDetailsCmd        `command:"userdetails" description:"fetch a user's details by his user id"`
	UserProposals      UserProposalsCmd      `command:"userproposals" description:"fetch all proposals submitted by a specific user"`
	Users              UsersCmd              `command:"users" description:"fetch a list of users, optionally filtering them by email and/or username"`
	VerifyUser         VerifyUserCmd         `command:"verifyuser" description:"verify user's email address"`
	VerifyUserPayment  VerifyUserPaymentCmd  `command:"verifyuserpayment" description:"check if the user has paid their user registration fee"`
	Version            VersionCmd            `command:"version" description:"fetch server info and CSRF token"`
	Vote               VoteCmd               `command:"vote" description:"cast ticket votes for a proposal"`
	VoteComment        VoteCommentCmd        `command:"votecomment" description:"vote on a comment"`
	VoteStatus         VoteStatusCmd         `command:"votestatus" description:"fetch the vote status of a proposal"`
}

type CommentsLikesCmd

type CommentsLikesCmd struct {
	Args struct {
		Token string `positional-arg-name:"token"`
	} `positional-args:"true" required:"true"`
}

func (*CommentsLikesCmd) Execute

func (cmd *CommentsLikesCmd) Execute(args []string) error

type EditProposalCmd

type EditProposalCmd struct {
	Args struct {
		Token       string   `positional-arg-name:"token"`
		Markdown    string   `positional-arg-name:"markdownFile"`
		Attachments []string `positional-arg-name:"attachmentFiles"`
	} `positional-args:"true" optional:"true"`
	Random bool `long:"random" optional:"true" description:"Generate a random proposal"`
}

func (*EditProposalCmd) Execute

func (cmd *EditProposalCmd) Execute(args []string) error

type EditUserCmd

type EditUserCmd struct {
	EmailNotifications *uint64 `long:"emailnotifications" optional:"true" description:"Whether to notify via emails"`
}

func (*EditUserCmd) Execute

func (cmd *EditUserCmd) Execute(args []string) error

type FaucetCmd

type FaucetCmd struct {
	Args struct {
		Address       string `positional-arg-name:"address" required:"true" description:"Address to send HC to"`
		Amount        uint64 `positional-arg-name:"amount" required:"true" description:"Amount to send (in atoms)"`
		OverrideToken string `positional-arg-name:"overridetoken" description:"Override token for testnet faucet"`
	} `positional-args:"true"`
}

func (*FaucetCmd) Execute

func (cmd *FaucetCmd) Execute(args []string) error

type GetCommentsCmd

type GetCommentsCmd struct {
	Args struct {
		Token string `positional-arg-name:"token"`
	} `positional-args:"true" required:"true"`
}

func (*GetCommentsCmd) Execute

func (cmd *GetCommentsCmd) Execute(args []string) error

type GetPaywallPaymentCmd

type GetPaywallPaymentCmd struct{}

func (*GetPaywallPaymentCmd) Execute

func (cmd *GetPaywallPaymentCmd) Execute(args []string) error

type GetProposalCmd

type GetProposalCmd struct {
	Args struct {
		Token   string `positional-arg-name:"token" required:"true"`
		Version string `positional-arg-name:"version"`
	} `positional-args:"true"`
}

func (*GetProposalCmd) Execute

func (cmd *GetProposalCmd) Execute(args []string) error

type GetUnvettedCmd

type GetUnvettedCmd struct {
	Before string `` /* 176-byte string literal not displayed */
	After  string `` /* 176-byte string literal not displayed */
}

func (*GetUnvettedCmd) Execute

func (cmd *GetUnvettedCmd) Execute(args []string) error

type GetVettedCmd

type GetVettedCmd struct {
	Before string `` /* 176-byte string literal not displayed */
	After  string `` /* 174-byte string literal not displayed */
}

func (*GetVettedCmd) Execute

func (cmd *GetVettedCmd) Execute(args []string) error

type HelpCmd

type HelpCmd struct {
	Args struct {
		Topic string `positional-arg-name:"topic" description:"get information about available commands"`
	} `positional-args:"true"  required:"true"`
}

func (*HelpCmd) Execute

func (cmd *HelpCmd) Execute(args []string) error

type InventoryCmd

type InventoryCmd struct{}

func (*InventoryCmd) Execute

func (cmd *InventoryCmd) Execute(args []string) error

type LoginCmd

type LoginCmd struct {
	Args struct {
		Email    string `positional-arg-name:"email"`
		Password string `positional-arg-name:"password"`
	} `positional-args:"true" required:"true"`
}

func (*LoginCmd) Execute

func (cmd *LoginCmd) Execute(args []string) error

type LogoutCmd

type LogoutCmd struct{}

func (*LogoutCmd) Execute

func (cmd *LogoutCmd) Execute(args []string) error

type ManageUserCmd

type ManageUserCmd struct {
	Args struct {
		UserID string `positional-arg-name:"userid" description:"User ID"`
		Action string `positional-arg-name:"action" description:"(Admin) edit user action"`
		Reason string `positional-arg-name:"reason" description:"Reason for editing the user"`
	} `positional-args:"true" required:"true"`
}

func (*ManageUserCmd) Execute

func (cmd *ManageUserCmd) Execute(args []string) error

type MeCmd

type MeCmd struct{}

func (*MeCmd) Execute

func (cmd *MeCmd) Execute(args []string) error

type NewCommentCmd

type NewCommentCmd struct {
	Args struct {
		Token    string `positional-arg-name:"token" required:"true"`
		Comment  string `positional-arg-name:"comment" required:"true"`
		ParentID string `positional-arg-name:"parentID"`
	} `positional-args:"true"`
}

func (*NewCommentCmd) Execute

func (cmd *NewCommentCmd) Execute(args []string) error

type NewProposalCmd

type NewProposalCmd struct {
	Args struct {
		Markdown    string   `positional-arg-name:"markdownFile"`
		Attachments []string `positional-arg-name:"attachmentFiles"`
	} `positional-args:"true" optional:"true"`
	Random bool `long:"random" optional:"true" description:"Generate a random proposal"`
}

func (*NewProposalCmd) Execute

func (cmd *NewProposalCmd) Execute(args []string) error

type NewUserCmd

type NewUserCmd struct {
	Args struct {
		Email    string `positional-arg-name:"email"`
		Username string `positional-arg-name:"username"`
		Password string `positional-arg-name:"password"`
	} `positional-args:"true" optional:"true"`
	Random bool `long:"random" optional:"true" description:"Generate a random email/password for the user"`
	Verify bool `long:"verify" optional:"true" description:"Verify the user's email address"`
	NoSave bool `long:"nosave" optional:"true" description:"Do not save the user identity to disk"`
}

func (*NewUserCmd) Execute

func (cmd *NewUserCmd) Execute(args []string) error

type PolicyCmd

type PolicyCmd struct{}

func (*PolicyCmd) Execute

func (cmd *PolicyCmd) Execute(args []string) error

type ProposalPaywallCmd

type ProposalPaywallCmd struct{}

func (*ProposalPaywallCmd) Execute

func (cmd *ProposalPaywallCmd) Execute(args []string) error

type ProposalVotesCmd

type ProposalVotesCmd struct {
	Args struct {
		Token string `positional-arg-name:"token" description:"Proposal censorship token"`
	} `positional-args:"true" required:"true"`
}

func (*ProposalVotesCmd) Execute

func (cmd *ProposalVotesCmd) Execute(args []string) error

type RescanUserPaymentsCmd

type RescanUserPaymentsCmd struct {
	Args struct {
		UserID string `positional-arg-name:"userid" description:"User ID"`
	} `positional-args:"true" required:"true"`
}

func (*RescanUserPaymentsCmd) Execute

func (cmd *RescanUserPaymentsCmd) Execute(args []string) error

type ResetPasswordCmd

type ResetPasswordCmd struct {
	Args struct {
		Email       string `positional-arg-name:"email"`
		NewPassword string `positional-arg-name:"newpassword"`
	} `positional-args:"true" required:"true"`
}

func (*ResetPasswordCmd) Execute

func (cmd *ResetPasswordCmd) Execute(args []string) error

type SecretCmd

type SecretCmd struct{}

func (*SecretCmd) Execute

func (cmd *SecretCmd) Execute(args []string) error

type SetProposalStatusCmd

type SetProposalStatusCmd struct {
	Args struct {
		Token   string `positional-arg-name:"token" required:"true" description:"Proposal censorship record token"`
		Status  string `positional-arg-name:"status" required:"true" description:"New proposal status (censored or public)"`
		Message string `positional-arg-name:"message" description:"Status change message (required if censoring proposal)"`
	} `positional-args:"true"`
}

func (*SetProposalStatusCmd) Execute

func (cmd *SetProposalStatusCmd) Execute(args []string) error

type StartVoteCmd

type StartVoteCmd struct {
	Args struct {
		Token string `positional-arg-name:"token" description:"Proposal censorship token"`
	} `positional-args:"true" required:"true"`
	Duration         string `long:"duration" description:"Vote duration in blocks"`
	QuorumPercentage string `long:"quorumpercentage" description:"Percentage of eligible tickets required for quorum (0-100)"`
	PassPercentage   string `long:"passpercentage" description:"Percentage of votes required for vote to pass (0-100)"`
}

func (*StartVoteCmd) Execute

func (cmd *StartVoteCmd) Execute(args []string) error

type TallyCmd

type TallyCmd struct {
	Args struct {
		Token string `positional-arg-name:"token" description:"Proposal censorship token"`
	} `positional-args:"true" required:"true"`
}

func (*TallyCmd) Execute

func (cmd *TallyCmd) Execute(args []string) error

type UpdateUserKeyCmd

type UpdateUserKeyCmd struct {
	NoSave bool `long:"nosave" optional:"true" description:"Do not save the user identity to disk"`
}

func (*UpdateUserKeyCmd) Execute

func (cmd *UpdateUserKeyCmd) Execute(args []string) error

type UserDetailsCmd

type UserDetailsCmd struct {
	Args struct {
		UserID string `positional-arg-name:"userid"`
	} `positional-args:"true" required:"true"`
}

func (*UserDetailsCmd) Execute

func (cmd *UserDetailsCmd) Execute(args []string) error

type UserProposalsCmd

type UserProposalsCmd struct {
	Args struct {
		UserID string `positional-arg-name:"userID"`
	} `positional-args:"true" required:"true"`
}

func (*UserProposalsCmd) Execute

func (cmd *UserProposalsCmd) Execute(args []string) error

type UsersCmd

type UsersCmd struct {
	Email    string `long:"email" optional:"true" description:"Email query"`
	Username string `long:"username" optional:"true" description:"Username query"`
}

func (*UsersCmd) Execute

func (cmd *UsersCmd) Execute(args []string) error

type VerifyUserCmd

type VerifyUserCmd struct {
	Args struct {
		Email string `positional-arg-name:"email" description:"User email address"`
		Token string `positional-arg-name:"token" description:"Email verification token"`
	} `positional-args:"true" required:"true"`
}

func (*VerifyUserCmd) Execute

func (cmd *VerifyUserCmd) Execute(args []string) error

type VerifyUserPaymentCmd

type VerifyUserPaymentCmd struct{}

func (*VerifyUserPaymentCmd) Execute

func (cmd *VerifyUserPaymentCmd) Execute(args []string) error

type VersionCmd

type VersionCmd struct{}

func (*VersionCmd) Execute

func (cmd *VersionCmd) Execute(args []string) error

type VoteCmd

type VoteCmd struct {
	Args struct {
		Token  string `positional-arg-name:"token" description:"Proposal censorship token"`
		VoteID string `positional-arg-name:"voteid" description:"A single unique word identifying the vote (e.g. yes)"`
	} `positional-args:"true" required:"true"`
}

func (*VoteCmd) Execute

func (cmd *VoteCmd) Execute(args []string) error

type VoteCommentCmd

type VoteCommentCmd struct {
	Args struct {
		Token     string `positional-arg-name:"token"`
		CommentID string `positional-arg-name:"commentID"`
		Action    string `positional-arg-name:"action"`
	} `positional-args:"true" required:"true"`
}

func (*VoteCommentCmd) Execute

func (cmd *VoteCommentCmd) Execute(args []string) error

type VoteStatusCmd

type VoteStatusCmd struct {
	Args struct {
		Token string `positional-arg-name:"token" description:"Proposal censorship token"`
	} `positional-args:"true" required:"true"`
}

func (*VoteStatusCmd) Execute

func (cmd *VoteStatusCmd) Execute(args []string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL