main.go (1465B)
1 // Copyright 2026 Shivakumar (Certichain) 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package main 16 17 import ( 18 "fmt" 19 "os" 20 ) 21 22 func main() { 23 if len(os.Args) < 2 { 24 printUsage() 25 os.Exit(1) 26 } 27 28 switch os.Args[1] { 29 case "init": 30 runInit(os.Args[2:]) 31 case "anchor": 32 runAnchor(os.Args[2:]) 33 case "verify": 34 runVerify(os.Args[2:]) 35 default: 36 fmt.Fprintf(os.Stderr, "unknown command: %s\n", os.Args[1]) 37 os.Exit(1) 38 } 39 } 40 41 func printUsage() { 42 fmt.Fprintln(os.Stdout, "usage: certi <command> [flags]") 43 fmt.Fprintln(os.Stdout, "commands:") 44 fmt.Fprintln(os.Stdout, "\tinit\tgenerate and store a new institution keypair") 45 fmt.Fprintln(os.Stdout, "\tanchor\tcreates a transaction from the merkleroot and anchors to blockchain") 46 fmt.Fprintln(os.Stdout, "flags:") 47 fmt.Fprintln(os.Stdout, "\t-force\t[init] overwrite existing key without prompting") 48 fmt.Fprintln(os.Stdout, "\t-url\t[anchor] default: localhost:8080, but can be set to other url") 49 }