Democrachain
  • How it works
  • 📦 Block
  • 🔐 Security
  • 🧠 Smart-contracts
    • 🪙 Tokens
    • 🗳️ Voting
  • 🛂 Passport NFC reader
  • 🔑 Keys
  • Study cases
    • 🇻🇪 Solution for Transparent and Secure Elections in Venezuela
Powered by GitBook
On this page

🔑 Keys

The main strength of the network is on it's keys

Keys are generated directly in the browser:

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:

// ADD NEW USER

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

Previous🛂 Passport NFC readerNext🇻🇪 Solution for Transparent and Secure Elections in Venezuela

Last updated 2 years ago