github.com/decred/politeia@v1.4.0/politeiawww/cmd/cmswww/dccdetails.go (about) 1 // Copyright (c) 2017-2019 The Decred developers 2 // Use of this source code is governed by an ISC 3 // license that can be found in the LICENSE file. 4 5 package main 6 7 import ( 8 "fmt" 9 10 "github.com/decred/politeia/politeiawww/cmd/shared" 11 ) 12 13 // DCCDetailsCmd retrieves the details of a dcc. 14 type DCCDetailsCmd struct { 15 Args struct { 16 Token string `positional-arg-name:"token" required:"true"` // Censorship token 17 } `positional-args:"true"` 18 } 19 20 // Execute executes the dcc details command. 21 func (cmd *DCCDetailsCmd) Execute(args []string) error { 22 // Get server's public key 23 vr, err := client.Version() 24 if err != nil { 25 return err 26 } 27 28 // Get dcc 29 ddr, err := client.DCCDetails(cmd.Args.Token) 30 if err != nil { 31 return err 32 } 33 34 // Verify dcc censorship record 35 err = verifyDCC(ddr.DCC, vr.PubKey) 36 if err != nil { 37 return fmt.Errorf("unable to verify dcc %v: %v", 38 ddr.DCC.CensorshipRecord.Token, err) 39 } 40 41 // Print invoice details 42 return shared.PrintJSON(ddr) 43 }