Skip to content

cub user key add

cub user key add

Register a public key for an identity

Synopsis

Register a public key against an identity.

Either generate a keypair here with --generate, which stores the private key locally and registers the public half, or register a public key you already have with --public-key.

--generate takes an alias or a path. A bare name is an alias stored under ~/.confighub/keys, which is what "cub auth login --private-key=" looks up; anything containing a path separator is written there instead and has no alias.

The private key never reaches ConfigHub in either case. --generate creates it locally and only the public half is sent.

Examples:

  # Generate a keypair, storing it under ~/.confighub/keys as the alias "my-worker"
  cub user key add --worker my-worker --generate my-worker

  # ...then authenticate with it
  cub auth login --private-key=my-worker

  # Generate to an explicit path instead of an alias
  cub user key add --worker my-worker --generate ./my-worker.jwk

  # Register a public key you already have
  cub user key add --worker my-worker --public-key ./worker.pub.jwk

  # Register a public key from stdin, with a note about who holds it
  cat worker.pub.jwk | cub user key add --worker my-worker --public-key - \
      --description "CI runner, us-east"
cub user key add [flags]

Options

      --description string   note recording which host or pipeline holds the private key
      --generate string      generate an Ed25519 keypair, store the private key under this alias (or path), and register the public half
  -h, --help                 help for add
      --public-key string    file holding the public key as a JWK, or - for stdin

Options inherited from parent commands

      --context string   The context to use for this command
      --debug            Debug output
      --space string     space ID to perform command on
      --user string      identity to manage keys for, by username or UUID
      --worker string    worker whose bot user to manage keys for, by slug or UUID

SEE ALSO

  • cub user key - Manage the public keys registered against an identity