Skip to content

Commit

Permalink
node: added "dump" command
Browse files Browse the repository at this point in the history
  • Loading branch information
valdok committed Mar 7, 2024
1 parent 62c6672 commit 2ff6e73
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
22 changes: 22 additions & 0 deletions cmd/secretd/attestation.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,28 @@ func ParseCert() *cobra.Command {
return cmd
}

func DumpBin() *cobra.Command {
cmd := &cobra.Command{
Use: "dump [binary file]",
Short: "Dump a binary file",
Long: "Helper to display the contents of a binary file, and extract the public key of the secret node, which is used to" +
"register the node, during node initialization",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
// parse coins trying to be sent
data, err := os.ReadFile(args[0])
if err != nil {
return err
}

fmt.Printf("%s\n", hex.EncodeToString(data))
return nil
},
}

return cmd
}

func ConfigureSecret() *cobra.Command {
cmd := &cobra.Command{
Use: "configure-secret [master-key] [seed]",
Expand Down
16 changes: 16 additions & 0 deletions cmd/secretd/cli_attestation.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,22 @@ func ParseCert() *cobra.Command {
return cmd
}

func DumpBin() *cobra.Command {
cmd := &cobra.Command{
Use: "dump [binary file]",
Short: "Dump a binary file",
Long: "Helper to display the contents of a binary file, and extract the public key of the secret node, which is used to" +
"register the node, during node initialization",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
println("This is a secretd only function, yo")
return nil
},
}

return cmd
}

func ConfigureSecret() *cobra.Command {
cmd := &cobra.Command{
Use: "configure-secret [master-key] [seed]",
Expand Down
1 change: 1 addition & 0 deletions cmd/secretd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig app.EncodingConfig) {
InitAttestation(),
InitBootstrapCmd(),
ParseCert(),
DumpBin(),
ConfigureSecret(),
HealthCheck(),
ResetEnclave(),
Expand Down

0 comments on commit 2ff6e73

Please sign in to comment.