Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions docs/Getting-Started/polykey-cli/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import DocCardList from '@theme/DocCardList';

# Polykey CLI

The Polykey Command Line Interface (CLI) is the primary user interface for the
Polykey system, tailored for developers and system administrators. It was
conceived from the necessity of managing secrets efficiently during software
development and deployment workflows.

## Overview

The Polykey CLI is the first and primary interface to the Polykey system. It is
intended for developers and system administrators who require an advanced tool
for managing secrets efficiently. New features are introduced in the CLI first,
serving as a testing and integration ground before being ported to other user
interfaces. This approach ensures that the features are reliable and refined for
professional use.

We designed the CLI user-experience (UX) to be suitable for a human operator,
but also to be easily scripted and integrated into other tools.

The tutorial here should be followed in order, and the goal is to make use of
Polykey to manage secrets for a simple application from development to
deployment.

The CLI is open-source and available on GitHub:
[Polykey CLI](https://github.com/MatrixAI/Polykey-CLI).

### Supported Platforms

Polykey is continuously built and tested on:

- Linux x64 / arm64
- MacOS x64 / arm64
- Windows x64
- Docker

:::note Polykey is currently in beta. Its interface is at various levels of
stability. So bear with us as we perfect its design. You can contribute by
discussing with us on [Discord](https://discord.gg/h3UShM8WUN) or creating issue
tickets in the
[Polykey-CLI repo on GitHub](https://github.com/MatrixAI/Polykey-CLI). :::

## Getting Started

Start your journey with Polykey by following the tutorials below in sequence:

:::tip For a visual walkthrough, check out our
[getting started demo video](https://vimeo.com/884649667) after installing
Polykey. :::

1. **[Installation](/docs/tutorials/polykey-cli/installation)** - Install
Polykey CLI on your platform.
2. **[Bootstrap Keypair](/docs/tutorials/polykey-cli/bootstrapping)** - Set up
your node and connect to the network.
3. **[Managing Vaults](/docs/tutorials/polykey-cli/managing-vaults)** - Securely
store secrets within encrypted vaults.
4. **[Managing Secrets](/docs/tutorials/polykey-cli/managing-secrets)** -
Organize and handle secrets within your vaults.
5. **[Claiming Digital Identities](/docs/tutorials/polykey-cli/claiming-digital-identities)** -
Establish and authenticate your identity within the network.
6. **[Discovering Other User's Identities](/docs/tutorials/polykey-cli/discovering-other-users)** -
Find and verify other users to manage permissions.
7. **[Sharing Vaults](/docs/tutorials/polykey-cli/sharing-vaults)** - Share your
encrypted vaults securely with peers.
8. **[Managing Multiple Nodes](/docs/tutorials/polykey-cli/managing-multiple-nodes)** -
Operate multiple local nodes/agents.
9. **[Using Environment Variables](/docs/tutorials/polykey-cli/using-environment-variables)** -
Master `polykey secrets env` for dynamic environment management.

Explore advanced scenarios in subsequent sections, including:

- Managing multiple local nodes
- Integrating multiple nodes with a single identity
- Injecting secrets directly into your development environments using Polykey’s
`env` command

This will prepare you to fully exploit Polykey’s capabilities in diverse and
complex operational settings.

<DocCardList />
151 changes: 151 additions & 0 deletions docs/Getting-Started/polykey-cli/bootstrapping.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
# Bootstrapping

## Introduction

Bootstrapping is the process where the Polykey agent sets itself up as a new
Polykey node. This involves creating the encrypted-at-rest node state, and
connecting to the [mainnet](https://mainnet.polykey.com/) or a custom specified
network domain.

## Setting Up Your Node

### Creating the Root Key

When you first start the Polykey agent, it automatically generates a random root
key.

This root key is an asymmetric key pair consisting of a public key representing
your identity and used for verifying signatures, and a private key which is used
for signing.

Afterwards, encryption keys are derived from this root key, which is used for
encryption and decryption of all node state and secret data managed by Polykey.

You will be prompted to provide a root password. This password encrypts the root
key.

:::note Remember to keep your password in a secure location as you will need it
each time you start the Polykey agent. :::

### Starting the Polykey Agent

You can start the Polykey agent in the foreground of your terminal by running:

```bash
polykey agent start --verbose
```

Running the agent in the foreground allows you to monitor its output directly in
the terminal. Ensure this terminal session remains active to keep the agent
running. You can execute Polykey commands from any other terminal session while
this runs.

### Starting Polykey in the Background

Alternatively, in the demo video and other scenarios where you do not wish to
occupy your terminal, you can start the agent in the background:

```bash
polykey agent start --verbose --background
```

### Stopping the Polykey Agent

You can stop the Polykey agent by pressing **Control+C** in the terminal where
it's running in the foreground, or by running:

```bash
polykey agent stop
```

#### Troubleshooting

If the Polykey agent does not terminate properly, you can force quit the process
through the Activity Monitor on your machine. If you encounter this or any other
issue, please consider making a
[bug report](https://github.com/MatrixAI/Polykey-CLI/issues/new/choose) to help
improve Polykey.

## Check Agent Status

To check the status of your Polykey node, use the following command:

```bash
polykey agent status
```

This command provides detailed information about your node's current state,
including its connectivity and activity within the network.

### Example Output

```bash
status LIVE
pid 96992
nodeId vgijtpv0h8m1eajeir77g73muq88n5kj0413t6fjdqsv9kt8dq4pg
clientHost ::1
clientPort 54975
agentHost ::
agentPort 60358
upTime 8
startTime 1716509093
connectionsActive 3
nodesTotal 11
version 1.2.3-alpha.4-1-1
sourceVersion 1.2.3-alpha.4
stateVersion 1
networkVersion 1
```

## Check Network Status

When your agent has started, it should show as a node on the network. By default
the network is [mainnet](https://mainnet.polykey.com/). Check out the network
dashboard to see your placement on the world map.

## Monitoring Network Connections

To view the nodes currently connected to the network, including the seed nodes,
run:

```bash
polykey nodes connections
```

This will list all active connections, including details about each node.

### Example Output

```bash
host hostname nodeIdEncoded port timeout usageCount
3.145.86.40 N/A v6p14qcvvftnnscuavsehu37t22vfvnhse054pbkb3ehemmjsrdh0 1314 46873 0
13.239.117.143 N/A vncm2mkk41vgp2fmplqiu1je7b2l3v6fhgltlqf5f3f85923ve0j0 1314 116186 0
1.145.55.96 N/A vg6gldhfdstju8frtbguav2p2svmev85dvpdb34gffmiagpgjf2pg 1200 102086 0
```

## Checking Node Activity

To determine if a specific node is active, use the ping command:

```bash
polykey nodes ping <nodeID>
```

This will tell you whether the node is active within the network.

### Example Output

```bash
polykey nodes ping v6p14qcvvftnnscuavsehu37t22vfvnhse054pbkb3ehemmjsrdh0
Node is Active
```

## Conclusion

Bootstrapping your node is the first step to using Polykey effectively. It
prepares your node for managing and sharing secrets securely within the network.
By following these guidelines, you ensure that your node is well-configured,
secure, and ready for advanced operations in the Polykey ecosystem.

Stay tuned for upcoming sections where we will discuss managing multiple nodes,
assigning different file paths to each node, and other advanced configurations.
Loading