aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/swarm/access.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/swarm/access.go')
-rw-r--r--cmd/swarm/access.go60
1 files changed, 59 insertions, 1 deletions
diff --git a/cmd/swarm/access.go b/cmd/swarm/access.go
index dd2d513c2..629781edd 100644
--- a/cmd/swarm/access.go
+++ b/cmd/swarm/access.go
@@ -29,7 +29,65 @@ import (
"gopkg.in/urfave/cli.v1"
)
-var salt = make([]byte, 32)
+var (
+ salt = make([]byte, 32)
+ accessCommand = cli.Command{
+ CustomHelpTemplate: helpTemplate,
+ Name: "access",
+ Usage: "encrypts a reference and embeds it into a root manifest",
+ ArgsUsage: "<ref>",
+ Description: "encrypts a reference and embeds it into a root manifest",
+ Subcommands: []cli.Command{
+ {
+ CustomHelpTemplate: helpTemplate,
+ Name: "new",
+ Usage: "encrypts a reference and embeds it into a root manifest",
+ ArgsUsage: "<ref>",
+ Description: "encrypts a reference and embeds it into a root access manifest and prints the resulting manifest",
+ Subcommands: []cli.Command{
+ {
+ Action: accessNewPass,
+ CustomHelpTemplate: helpTemplate,
+ Flags: []cli.Flag{
+ utils.PasswordFileFlag,
+ SwarmDryRunFlag,
+ },
+ Name: "pass",
+ Usage: "encrypts a reference with a password and embeds it into a root manifest",
+ ArgsUsage: "<ref>",
+ Description: "encrypts a reference and embeds it into a root access manifest and prints the resulting manifest",
+ },
+ {
+ Action: accessNewPK,
+ CustomHelpTemplate: helpTemplate,
+ Flags: []cli.Flag{
+ utils.PasswordFileFlag,
+ SwarmDryRunFlag,
+ SwarmAccessGrantKeyFlag,
+ },
+ Name: "pk",
+ Usage: "encrypts a reference with the node's private key and a given grantee's public key and embeds it into a root manifest",
+ ArgsUsage: "<ref>",
+ Description: "encrypts a reference and embeds it into a root access manifest and prints the resulting manifest",
+ },
+ {
+ Action: accessNewACT,
+ CustomHelpTemplate: helpTemplate,
+ Flags: []cli.Flag{
+ SwarmAccessGrantKeysFlag,
+ SwarmDryRunFlag,
+ utils.PasswordFileFlag,
+ },
+ Name: "act",
+ Usage: "encrypts a reference with the node's private key and a given grantee's public key and embeds it into a root manifest",
+ ArgsUsage: "<ref>",
+ Description: "encrypts a reference and embeds it into a root access manifest and prints the resulting manifest",
+ },
+ },
+ },
+ },
+ }
+)
func init() {
if _, err := io.ReadFull(rand.Reader, salt); err != nil {