From 8608098996a295afb9f910a75464f4d1894d8cc4 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Tue, 6 Oct 2020 15:30:49 +0200 Subject: [PATCH] Remove docs (replaced by docs repo) (#702) --- .github/workflows/pr-any.yml | 2 +- .github/workflows/push-master.yml | 3 +- docs/.nojekyll | 0 docs/.vuepress/config.js | 41 -------------- docs/.vuepress/styles/palette.styl | 9 ---- docs/README.md | 51 ------------------ docs/examples/.gitignore | 1 - .../keyring/01_create_account/README.md | 5 -- .../keyring/01_create_account/index.js | 22 -------- .../keyring/01_create_account/package.json | 19 ------- .../keyring/02_load_accounts/README.md | 5 -- .../keyring/02_load_accounts/index.js | 34 ------------ .../keyring/02_load_accounts/package.json | 19 ------- .../keyring/03_validate_address/README.md | 5 -- .../keyring/03_validate_address/index.js | 24 --------- .../keyring/03_validate_address/package.json | 18 ------- docs/examples/keyring/README.md | 12 ----- .../01_encrypt_decrypt_message_nacl/README.md | 5 -- .../01_encrypt_decrypt_message_nacl/index.js | 27 ---------- .../package.json | 18 ------- .../02_sign_verify_message_nacl/README.md | 5 -- .../02_sign_verify_message_nacl/index.js | 33 ------------ .../02_sign_verify_message_nacl/package.json | 18 ------- .../README.md | 5 -- .../index.js | 29 ---------- .../package.json | 18 ------- .../04_generate_multisig_address/README.md | 5 -- .../04_generate_multisig_address/index.js | 40 -------------- .../04_generate_multisig_address/package.json | 14 ----- docs/examples/util-crypto/README.md | 13 ----- docs/logo.png | Bin 7497 -> 0 bytes package.json | 2 - 32 files changed, 2 insertions(+), 500 deletions(-) delete mode 100644 docs/.nojekyll delete mode 100644 docs/.vuepress/config.js delete mode 100644 docs/.vuepress/styles/palette.styl delete mode 100644 docs/README.md delete mode 100644 docs/examples/.gitignore delete mode 100644 docs/examples/keyring/01_create_account/README.md delete mode 100755 docs/examples/keyring/01_create_account/index.js delete mode 100644 docs/examples/keyring/01_create_account/package.json delete mode 100644 docs/examples/keyring/02_load_accounts/README.md delete mode 100755 docs/examples/keyring/02_load_accounts/index.js delete mode 100644 docs/examples/keyring/02_load_accounts/package.json delete mode 100644 docs/examples/keyring/03_validate_address/README.md delete mode 100644 docs/examples/keyring/03_validate_address/index.js delete mode 100644 docs/examples/keyring/03_validate_address/package.json delete mode 100644 docs/examples/keyring/README.md delete mode 100644 docs/examples/util-crypto/01_encrypt_decrypt_message_nacl/README.md delete mode 100755 docs/examples/util-crypto/01_encrypt_decrypt_message_nacl/index.js delete mode 100644 docs/examples/util-crypto/01_encrypt_decrypt_message_nacl/package.json delete mode 100644 docs/examples/util-crypto/02_sign_verify_message_nacl/README.md delete mode 100755 docs/examples/util-crypto/02_sign_verify_message_nacl/index.js delete mode 100644 docs/examples/util-crypto/02_sign_verify_message_nacl/package.json delete mode 100644 docs/examples/util-crypto/03_mnemonic_generate_validate_bip39/README.md delete mode 100755 docs/examples/util-crypto/03_mnemonic_generate_validate_bip39/index.js delete mode 100644 docs/examples/util-crypto/03_mnemonic_generate_validate_bip39/package.json delete mode 100644 docs/examples/util-crypto/04_generate_multisig_address/README.md delete mode 100644 docs/examples/util-crypto/04_generate_multisig_address/index.js delete mode 100644 docs/examples/util-crypto/04_generate_multisig_address/package.json delete mode 100644 docs/examples/util-crypto/README.md delete mode 100644 docs/logo.png diff --git a/.github/workflows/pr-any.yml b/.github/workflows/pr-any.yml index de9f8a44e..599248325 100644 --- a/.github/workflows/pr-any.yml +++ b/.github/workflows/pr-any.yml @@ -5,7 +5,7 @@ jobs: pr: strategy: matrix: - step: ['lint', 'test', 'build', 'docs'] + step: ['lint', 'test', 'build'] name: ${{ matrix.step }} runs-on: ubuntu-latest steps: diff --git a/.github/workflows/push-master.yml b/.github/workflows/push-master.yml index 7d2e1962b..ee4dc1407 100644 --- a/.github/workflows/push-master.yml +++ b/.github/workflows/push-master.yml @@ -8,7 +8,7 @@ jobs: master: strategy: matrix: - step: ['build:release', 'docs:release'] + step: ['build:release'] name: ${{ matrix.step }} if: "! startsWith(github.event.head_commit.message, '[CI Skip]') && github.repository == 'polkadot-js/common'" runs-on: ubuntu-latest @@ -19,7 +19,6 @@ jobs: - name: ${{ matrix.step }} env: CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} - GH_PAGES_SRC: build-docs GH_PAT: ${{ secrets.GH_PAT }} GH_RELEASE_GITHUB_API_TOKEN: ${{ secrets.GH_PAT }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/docs/.nojekyll b/docs/.nojekyll deleted file mode 100644 index e69de29bb..000000000 diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js deleted file mode 100644 index b287db047..000000000 --- a/docs/.vuepress/config.js +++ /dev/null @@ -1,41 +0,0 @@ -module.exports = { - base: '/common/', - title: 'polkadot-js/common', - description: 'Common utilities and libraries that are in use accross all @polkadot projects', - markdown: { - lineNumbers: true - }, - themeConfig: { - displayAllHeaders: true, - nav: [ - { text: 'Polkadot/Substrate Apps', link: 'https://polkadot.js.org/apps/' }, - { text: 'Project family', link: 'https://polkadot.js.org/' }, - { - text: 'Documentation', - items: [ - { text: 'API Reference', link: 'https://polkadot.js.org/api/' }, - { text: 'Utility Reference (this)', link: 'https://polkadot.js.org/common/' }, - { text: 'UI Libs Reference', link: 'https://polkadot.js.org/ui/' }, - ] - }, - { text: 'GitHub', link: 'https://github.com/polkadot-js/common' } - ], - search: false, - sidebar: [ - { - title: 'Examples (keyring)', - path: '/examples/keyring/', - collapsable: false, - sidebarDepth: 1, - children: [ - ['/examples/keyring/01_create_account/', 'Create account'], - ['/examples/keyring/02_load_accounts/', 'Load Accounts'] - ] - }, - ['/util/', '@polkadot/util'], - ['/util-crypto/', '@polkadot/util-crypto'], - ['/keyring/', '@polkadot/keyring'], - '/CONTRIBUTING.md' - ] - } -}; diff --git a/docs/.vuepress/styles/palette.styl b/docs/.vuepress/styles/palette.styl deleted file mode 100644 index cd866cf86..000000000 --- a/docs/.vuepress/styles/palette.styl +++ /dev/null @@ -1,9 +0,0 @@ -$accentColor = #fd8824 -$textColor = #2c3e50 - -.home .hero .description, -.home .feature h2, -.home .feature p { - color: $textColor - opacity: 0.75 -} diff --git a/docs/README.md b/docs/README.md deleted file mode 100644 index f81b6081e..000000000 --- a/docs/README.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -home: true -heroText: -tagline: -# Bringing JavaScript to the Polkadot world. -# actionText: Repository Overview -# actionLink: /REPOS.md -features: -- title: Keyring - details: Manage user keys allowing for signing, encryption and decryption. -- title: Utilities - details: Various user utilities to work with data and perform check on it. -- title: Crypto - details: A thin and easy-to-use wrapper around cryptographic and hashing libraries. - -footer: Apache-2 Licensed | Copyright © 2017-2019 polkadot-js authors and contributors ---- - -## Welcome - -Various useful utility functions that are used across all projects in the [@polkadot](https://polkadot.js.org) namespace. It provides utility functions with additional safety checks, allowing not only for consistent coding, but also reducing the general boilerplate. - -::: tip Examples -In a rush and just want examples? [Jump right in](/examples/keyring/) and get a handle on using the various components in your projects. -::: - -## Available packages - -It is split up into a number of internal packages, namely utilities - - -- [keyring](keyring/README.md) Keyring management -- [util](util/README.md) General utilities -- [util-crypto](util-crypto/README.md) Crypto and hashing utilities - -## The Polkadot Project - -You can read more about the Polkadot Network at [https://polkadot.network/](https://polkadot.network/) - -## Github repositories - -You can find the Polkadot repositories at: - -- [https://github.com/polkadot-js](https://github.com/polkadot-js) -- [https://github.com/paritytech/polkadot](https://github.com/paritytech/polkadot) -- [https://github.com/paritytech/substrate](https://github.com/paritytech/substrate) - -This documentation is generated from [https://github.com/polkadot-js/common](https://github.com/polkadot-js/common) - -## Contributing - -Contribution to Polkadot JS Common are more than welcome. You can [report issues](https://github.com/polkadot-js/common/issues/new) and [log feature requests](https://github.com/polkadot-js/common/issues/new). diff --git a/docs/examples/.gitignore b/docs/examples/.gitignore deleted file mode 100644 index 8ee01d321..000000000 --- a/docs/examples/.gitignore +++ /dev/null @@ -1 +0,0 @@ -yarn.lock diff --git a/docs/examples/keyring/01_create_account/README.md b/docs/examples/keyring/01_create_account/README.md deleted file mode 100644 index a080d2d15..000000000 --- a/docs/examples/keyring/01_create_account/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Create Account - -The following example shows how to create and account with keyring. - -<<< @/docs/examples/keyring/01_create_account/index.js diff --git a/docs/examples/keyring/01_create_account/index.js b/docs/examples/keyring/01_create_account/index.js deleted file mode 100755 index 40f7f2b09..000000000 --- a/docs/examples/keyring/01_create_account/index.js +++ /dev/null @@ -1,22 +0,0 @@ -/* eslint-disable header/header */ -/* eslint-disable @typescript-eslint/require-await */ -/* eslint-disable @typescript-eslint/unbound-method */ - -// Import Keyring class and utility function -const Keyring = require('@polkadot/keyring').default; -const stringToU8a = require('@polkadot/util/string/toU8a').default; - -async function main () { - // Create account seed for Alice - const ALICE_SEED = 'Alice'.padEnd(32, ' '); - - // Create an instance of the Keyring - const keyring = new Keyring(); - - // Create pair and add Alice to keyring pair dictionary (with account seed) - const pairAlice = keyring.addFromSeed(stringToU8a(ALICE_SEED)); - - console.log(`Created keyring pair for Alice with address: ${keyring.getPair(pairAlice.address).address}`); -} - -main().catch(console.error).finally(() => process.exit()); diff --git a/docs/examples/keyring/01_create_account/package.json b/docs/examples/keyring/01_create_account/package.json deleted file mode 100644 index ec676826c..000000000 --- a/docs/examples/keyring/01_create_account/package.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "01_create_account", - "version": "0.1.0", - "description": "Example showing how to create an account", - "main": "index.js", - "author": "ltfschoen", - "license": "MIT", - "scripts": { - "clean": "rimraf node_modules", - "start": "node index.js" - }, - "dependencies": { - "@polkadot/util": "^0.32.10", - "@polkadot/keyring": "^0.32.10" - }, - "devDependencies": { - "rimraf": "^2.6.2" - } -} diff --git a/docs/examples/keyring/02_load_accounts/README.md b/docs/examples/keyring/02_load_accounts/README.md deleted file mode 100644 index f89d5b846..000000000 --- a/docs/examples/keyring/02_load_accounts/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Load Accounts - -The following example shows how to load all accounts from the keyring as pairs and convert them into JSON format. - -<<< @/docs/examples/keyring/02_load_accounts/index.js diff --git a/docs/examples/keyring/02_load_accounts/index.js b/docs/examples/keyring/02_load_accounts/index.js deleted file mode 100755 index 1f771b3a9..000000000 --- a/docs/examples/keyring/02_load_accounts/index.js +++ /dev/null @@ -1,34 +0,0 @@ -/* eslint-disable header/header */ -/* eslint-disable @typescript-eslint/require-await */ -/* eslint-disable @typescript-eslint/unbound-method */ - -// Import Keyring class and utility function -const Keyring = require('@polkadot/keyring').default; -const stringToU8a = require('@polkadot/util/string/toU8a').default; - -async function main () { - // Create account seed for Alice and Bob - const ALICE_SEED = 'Alice'.padEnd(32, ' '); - const BOB_SEED = 'Bob'.padEnd(32, ' '); - - // Create an instance of the Keyring - const keyring = new Keyring(); - - // Create their pairs with account seeds. Add to keyring pair dictionary - keyring.addFromSeed(stringToU8a(ALICE_SEED)); - keyring.addFromSeed(stringToU8a(BOB_SEED)); - - // Note that we did not use `addFromAddress` since it does not add the - // secret key to memory so we cannot later retrieve it with `getPairs` - - // Retrieve all keyring pairs from the keyring pair dictionary - keyring - .getPairs() - .forEach((pair, index) => { - const { address } = pair; - - console.log(`\nAccount with index #${index} has json: `, JSON.stringify(keyring.toJson(address), null, 2)); - }); -} - -main().catch(console.error).finally(() => process.exit()); diff --git a/docs/examples/keyring/02_load_accounts/package.json b/docs/examples/keyring/02_load_accounts/package.json deleted file mode 100644 index 2d2eeccef..000000000 --- a/docs/examples/keyring/02_load_accounts/package.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "02_load_accounts", - "version": "0.1.0", - "description": "Example showing how to load accounts", - "main": "index.js", - "author": "ltfschoen", - "license": "MIT", - "scripts": { - "clean": "rimraf node_modules", - "start": "node index.js" - }, - "dependencies": { - "@polkadot/util": "^0.32.10", - "@polkadot/keyring": "^0.32.10" - }, - "devDependencies": { - "rimraf": "^2.6.2" - } -} diff --git a/docs/examples/keyring/03_validate_address/README.md b/docs/examples/keyring/03_validate_address/README.md deleted file mode 100644 index 91e181b34..000000000 --- a/docs/examples/keyring/03_validate_address/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Validate Adress - -- This function will return true if the address is a legitamate Polkadot address and false if it is not - -- Works both with Ed25519 and Sr25519 key types diff --git a/docs/examples/keyring/03_validate_address/index.js b/docs/examples/keyring/03_validate_address/index.js deleted file mode 100644 index c5ee6a9ae..000000000 --- a/docs/examples/keyring/03_validate_address/index.js +++ /dev/null @@ -1,24 +0,0 @@ -/* eslint-disable header/header */ - -const { decodeAddress, encodeAddress } = require('@polkadot/keyring'); -const { hexToU8a, isHex } = require('@polkadot/util'); - -const address = '5GrpknVvGGrGH3EFuURXeMrWHvbpj3VfER1oX5jFtuGbfzCE'; - -const isValidAddressPolkadotAddress = () => { - try { - encodeAddress( - isHex(address) - ? hexToU8a(address) - : decodeAddress(address) - ); - - return true; - } catch (error) { - return false; - } -}; - -const isValid = isValidAddressPolkadotAddress(); - -console.log(isValid); diff --git a/docs/examples/keyring/03_validate_address/package.json b/docs/examples/keyring/03_validate_address/package.json deleted file mode 100644 index 17f075f74..000000000 --- a/docs/examples/keyring/03_validate_address/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "03_validate_address", - "version": "0.1.0", - "description": "Example showing how to validate a polkadot address", - "main": "index.js", - "author": "Jesse", - "license": "MIT", - "scripts": { - "clean": "rimraf node_modules", - "start": "node index.js" - }, - "dependencies": { - "@polkadot/keyring": "*" - }, - "devDependencies": { - "rimraf": "^2.6.2" - } -} diff --git a/docs/examples/keyring/README.md b/docs/examples/keyring/README.md deleted file mode 100644 index f00cfb416..000000000 --- a/docs/examples/keyring/README.md +++ /dev/null @@ -1,12 +0,0 @@ -# Keyring Examples - -Here you will find a list of examples that takes you through the basics of connecting to a local node, retrieving data from the Node and chain and execute transactions on the chain. - -## Running the examples - -From within each folder run the following to install required dependencies and to execute the example: -```shell -yarn; -yarn start -``` - diff --git a/docs/examples/util-crypto/01_encrypt_decrypt_message_nacl/README.md b/docs/examples/util-crypto/01_encrypt_decrypt_message_nacl/README.md deleted file mode 100644 index 3af78ecb1..000000000 --- a/docs/examples/util-crypto/01_encrypt_decrypt_message_nacl/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Encrypt & Decrypt Message using NaCl - -The following example shows how to encrypt and decrypt a message with NaCl (pronouced "salt"), which is a Networking and Cryptography library used in util-crypto. - -[include](index.js) diff --git a/docs/examples/util-crypto/01_encrypt_decrypt_message_nacl/index.js b/docs/examples/util-crypto/01_encrypt_decrypt_message_nacl/index.js deleted file mode 100755 index 3c8fe9a51..000000000 --- a/docs/examples/util-crypto/01_encrypt_decrypt_message_nacl/index.js +++ /dev/null @@ -1,27 +0,0 @@ -/* eslint-disable header/header */ -/* eslint-disable @typescript-eslint/require-await */ -/* eslint-disable @typescript-eslint/unbound-method */ - -const { naclDecrypt, naclEncrypt } = require('@polkadot/util-crypto'); - -async function main () { - const secret = new Uint8Array(32); - const messagePreEncryption = new Uint8Array([1, 2, 3, 4, 5, 4, 3, 2, 1]); - const noncePreEncryption = new Uint8Array(24); - - // Encrypt the message - const { encrypted, nonce } = naclEncrypt(messagePreEncryption, secret, noncePreEncryption); - - // Show contents of the encrypted message - console.log(`Encrypted message: ${JSON.stringify(encrypted, null, 2)}`); - - // Decrypt the message - const messageDecrypted = naclDecrypt(encrypted, nonce, secret); - // Convert each Uint8Array to a string for comparison - const isMatch = messagePreEncryption.toString === messageDecrypted.toString; - - // Verify that the decrypted message matches the original message - console.log(`Does the decrypted message match the original message? ${isMatch}`); -} - -main().catch(console.error).finally(() => process.exit()); diff --git a/docs/examples/util-crypto/01_encrypt_decrypt_message_nacl/package.json b/docs/examples/util-crypto/01_encrypt_decrypt_message_nacl/package.json deleted file mode 100644 index e77697e65..000000000 --- a/docs/examples/util-crypto/01_encrypt_decrypt_message_nacl/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "01_encrypt_decrypt_message_nacl", - "version": "0.1.0", - "description": "Example showing how to encrypt and decrypt a message using NaCl", - "main": "index.js", - "author": "ltfschoen", - "license": "MIT", - "scripts": { - "clean": "rimraf node_modules", - "start": "node index.js" - }, - "dependencies": { - "@polkadot/util-crypto": "^0.32.10" - }, - "devDependencies": { - "rimraf": "^2.6.2" - } -} diff --git a/docs/examples/util-crypto/02_sign_verify_message_nacl/README.md b/docs/examples/util-crypto/02_sign_verify_message_nacl/README.md deleted file mode 100644 index 2e4e9c768..000000000 --- a/docs/examples/util-crypto/02_sign_verify_message_nacl/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Sign & Verify Message using NaCl - -The following example shows how to sign and verify a message with NaCl (pronouced "salt"), which is a Networking and Cryptography library used in util-crypto. - -[include](index.js) diff --git a/docs/examples/util-crypto/02_sign_verify_message_nacl/index.js b/docs/examples/util-crypto/02_sign_verify_message_nacl/index.js deleted file mode 100755 index 2f1a37ea2..000000000 --- a/docs/examples/util-crypto/02_sign_verify_message_nacl/index.js +++ /dev/null @@ -1,33 +0,0 @@ -/* eslint-disable header/header */ -/* eslint-disable @typescript-eslint/require-await */ -/* eslint-disable @typescript-eslint/unbound-method */ - -const { stringToU8a, u8aToHex } = require('@polkadot/util'); -const { naclEncrypt, naclKeypairFromSeed, naclSign, naclVerify, randomAsU8a } = require('@polkadot/util-crypto'); - -async function main () { - // Create account seed for Alice as fallback if generated mnemonic not valid - const seedAlice = 'Alice'.padEnd(32, ' '); - - // Generate new public/secret keypair for Alice from the supplied seed - const { publicKey, secretKey } = naclKeypairFromSeed(stringToU8a(seedAlice)); - - // Encrypt message. Create Uint8Array's filled with random bytes of specified length - const secret = randomAsU8a(32); - const messagePreEncryption = stringToU8a('please send me DOTs'); - const noncePreEncryption = randomAsU8a(24); - - const { encrypted } = naclEncrypt(messagePreEncryption, secret, noncePreEncryption); - - // Sign the message with a valid signature - const messageSignature = naclSign(encrypted, secretKey); - - console.log(`Message signature: ${u8aToHex(messageSignature)}`); - - // Validate that the message was correctly signed - const isValidSignature = naclVerify(encrypted, messageSignature, publicKey); - - console.log(`Was the message correctly signed? ${isValidSignature}`); -} - -main().catch(console.error).finally(() => process.exit()); diff --git a/docs/examples/util-crypto/02_sign_verify_message_nacl/package.json b/docs/examples/util-crypto/02_sign_verify_message_nacl/package.json deleted file mode 100644 index 956608339..000000000 --- a/docs/examples/util-crypto/02_sign_verify_message_nacl/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "02_sign_verify_message_nacl", - "version": "0.1.0", - "description": "Example showing how to sign and verify a message using NaCl", - "main": "index.js", - "author": "ltfschoen", - "license": "MIT", - "scripts": { - "clean": "rimraf node_modules", - "start": "node index.js" - }, - "dependencies": { - "@polkadot/util-crypto": "^0.32.10" - }, - "devDependencies": { - "rimraf": "^2.6.2" - } -} diff --git a/docs/examples/util-crypto/03_mnemonic_generate_validate_bip39/README.md b/docs/examples/util-crypto/03_mnemonic_generate_validate_bip39/README.md deleted file mode 100644 index 9cf5bdbd1..000000000 --- a/docs/examples/util-crypto/03_mnemonic_generate_validate_bip39/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Create & Generate Mnemonic using BIP39 - -The following example shows how to create and generate mnemonics using BIP39. - -[include](index.js) diff --git a/docs/examples/util-crypto/03_mnemonic_generate_validate_bip39/index.js b/docs/examples/util-crypto/03_mnemonic_generate_validate_bip39/index.js deleted file mode 100755 index 8797b7e02..000000000 --- a/docs/examples/util-crypto/03_mnemonic_generate_validate_bip39/index.js +++ /dev/null @@ -1,29 +0,0 @@ -/* eslint-disable header/header */ -/* eslint-disable @typescript-eslint/unbound-method */ -/* eslint-disable @typescript-eslint/require-await */ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -const { mnemonicGenerate, mnemonicToSeed, mnemonicValidate, naclKeypairFromSeed } = require('@polkadot/util-crypto'); - -async function main () { - // Create mnemonic string for Alice using BIP39 - const mnemonicAlice = mnemonicGenerate(); - - console.log(`Generated mnemonic: ${mnemonicAlice}`); - - // Validate the mnemic string that was generated - const isValidMnemonic = mnemonicValidate(mnemonicAlice); - - console.log(`isValidMnemonic: ${isValidMnemonic}`); - - // Create valid seed from mnemonic as u8a and convert it to a string - // FIXME - Replace with mnemonicToSeed once exposed - const seedAlice = mnemonicToSeed(mnemonicAlice); - - // Generate new public/secret keypair for Alice from the supplied seed - const { publicKey, secretKey } = naclKeypairFromSeed(seedAlice); - - // Encrypt, Sign and Validate the message. See Example 'Sign & Verify Message' -} - -main().catch(console.error).finally(() => process.exit()); diff --git a/docs/examples/util-crypto/03_mnemonic_generate_validate_bip39/package.json b/docs/examples/util-crypto/03_mnemonic_generate_validate_bip39/package.json deleted file mode 100644 index bbf4a448c..000000000 --- a/docs/examples/util-crypto/03_mnemonic_generate_validate_bip39/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "03_mnemonic_generate_validate_bip39", - "version": "0.1.0", - "description": "Example showing how to sign and verify a message using NaCl", - "main": "index.js", - "author": "ltfschoen", - "license": "MIT", - "scripts": { - "clean": "rimraf node_modules", - "start": "node index.js" - }, - "dependencies": { - "@polkadot/util-crypto": "^0.32.10" - }, - "devDependencies": { - "rimraf": "^2.6.2" - } -} diff --git a/docs/examples/util-crypto/04_generate_multisig_address/README.md b/docs/examples/util-crypto/04_generate_multisig_address/README.md deleted file mode 100644 index 439f2f939..000000000 --- a/docs/examples/util-crypto/04_generate_multisig_address/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Generate a Multisig Account - -Substrate provides a multisig dispatch function in its -[Utility pallet](https://crates.parity.io/pallet_utility/index.html). This example generates the -address that would correspond to a set of addresses and threshold. diff --git a/docs/examples/util-crypto/04_generate_multisig_address/index.js b/docs/examples/util-crypto/04_generate_multisig_address/index.js deleted file mode 100644 index b98e2d731..000000000 --- a/docs/examples/util-crypto/04_generate_multisig_address/index.js +++ /dev/null @@ -1,40 +0,0 @@ -/* eslint-disable header/header */ -import { createKeyMulti, encodeAddress, sortAddresses } from '@polkadot/util-crypto'; - -const SS58Prefix = 0; - -// Input the addresses that will make up the multisig account. -const addresses = [ - '1nUC7afqmo7zwRFWxDjrUQu9skk6fk99pafb4SiyGSRc8z3', - '1ZX2XntfLEHrBPy73DpfQp9rG7pbLyvrFjEpi7mNKQgyga5', - '14b1kB7CrqzRUeMsKc26FJ73f8FCpxAX6sNieu9gfYSfJuoL' -]; - -// The number of accounts that must approve. Must be greater than 0 and less than -// or equal to the total number of addresses. -const threshold = 2; - -// The address (as index in `addresses`) that will submit a transaction. -const index = 0; - -function main () { - // Address as a byte array. - const multiAddress = createKeyMulti(addresses, threshold); - - // Convert byte array to SS58 encoding. - const Ss58Address = encodeAddress(multiAddress, SS58Prefix); - - console.log(`\nMultisig Address: ${Ss58Address}`); - - // Take addresses and remove the sender. - const otherSignatories = addresses.filter((who) => who !== addresses[index]); - - // Sort them by public key. - const otherSignatoriesSorted = sortAddresses(otherSignatories, SS58Prefix); - - console.log(`\nOther Signatories: ${otherSignatoriesSorted}\n`); - - process.exit(); -} - -main(); diff --git a/docs/examples/util-crypto/04_generate_multisig_address/package.json b/docs/examples/util-crypto/04_generate_multisig_address/package.json deleted file mode 100644 index f8d09e52a..000000000 --- a/docs/examples/util-crypto/04_generate_multisig_address/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "04_generate_multisig_address", - "version": "0.1.0", - "description": "Example showing how to generate a multisig address for Substrate's Utility pallet", - "main": "index.js", - "author": "joepetrowski", - "license": "MIT", - "scripts": { - "start": "node index.js" - }, - "dependencies": { - "@polkadot/util-crypto": "^2.9.0-beta.1" - } -} diff --git a/docs/examples/util-crypto/README.md b/docs/examples/util-crypto/README.md deleted file mode 100644 index 7aff9985a..000000000 --- a/docs/examples/util-crypto/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# Util-Crypto Examples - -Here you will find a list of examples that takes you through the basics of encrypting and decrypting messages using NaCl, signing a message with a seed and verifying it using NaCl, and generating and validating mnemonics for account seeds. - -## Running the examples - -From within each folder run the following to install required dependencies and to execute the example: -```shell -yarn; -yarn start -``` - - diff --git a/docs/logo.png b/docs/logo.png deleted file mode 100644 index d96e7fccd2639a99a3c2c866f8fcb4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