# 🔑 Keys

Keys are generated directly in the browser:

```javascript
const keyPair = await subtle.generateKey(
  {
    name: "RSA-PSS",
    modulusLength: 2048,
    publicExponent: new Uint8Array([1, 0, 1]),
    hash: "SHA-256",
  },
  true,
  ["sign", "verify"]
);
```

This creates a key pair of Public and Private keys.

* Public Ley: can be public and will be used to verify all signatures generated with this key-pair.
* Private Key: is private and not be shared.

For a new key to be allowed to add new blocks to the network, an existing entity (with the proper permissions) must add it through a block with the content:

```javascript
// ADD NEW USER

grantKey({
  name: "KEYNAME",
  pubKey:
    "-----BEGIN PUBLIC KEY----- MIIBIjANBgkqhki...IVizEoJZIz8JA9tkjZ+ZVPBfYlBQIDAQAB -----END PUBLIC KEY-----",
});

```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://democrachain.gitbook.io/docs/keys.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
