Update create-secrets.mdx

I am making this change to draw your attention to this as it seems that some variables are used wrong.

- Specifically this section:


		util.decodeBase64(encryptedProjectKey),
		util.decodeBase64(encryptedProjectKey.nonce),
		util.decodeBase64(encryptedProjectKey.sender.publicKey),
		util.decodeBase64(PSWD)



- Imported tweetnacl as well so it's easier to understand and for the code to make sense from the get go.
This commit is contained in:
ha-sante
2023-02-28 13:03:32 +00:00
committed by GitHub
parent a89fccdc1f
commit 7dd28a5941

View File

@@ -23,6 +23,7 @@ Prerequisites:
```js
const crypto = require('crypto');
const axios = require('axios');
const nacl = require('tweetnacl');
const ALGORITHM = 'aes-256-gcm';
const BLOCK_SIZE_BYTES = 16;
@@ -94,9 +95,9 @@ const createSecrets = async () => {
// 4. decrypt the project key with your private key
const projectKey = nacl.box.open(
util.decodeBase64(encryptedProjectKey),
util.decodeBase64(projectKey.nonce),
util.decodeBase64(projectKey.sender.publicKey),
util.decodeBase64(privateKey)
util.decodeBase64(encryptedProjectKey.nonce),
util.decodeBase64(encryptedProjectKey.sender.publicKey),
util.decodeBase64(PSWD)
);
// 5. encrypt your secret(s) with the project key