mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 19:28:09 +00:00
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:
@@ -23,6 +23,7 @@ Prerequisites:
|
|||||||
```js
|
```js
|
||||||
const crypto = require('crypto');
|
const crypto = require('crypto');
|
||||||
const axios = require('axios');
|
const axios = require('axios');
|
||||||
|
const nacl = require('tweetnacl');
|
||||||
|
|
||||||
const ALGORITHM = 'aes-256-gcm';
|
const ALGORITHM = 'aes-256-gcm';
|
||||||
const BLOCK_SIZE_BYTES = 16;
|
const BLOCK_SIZE_BYTES = 16;
|
||||||
@@ -94,9 +95,9 @@ const createSecrets = async () => {
|
|||||||
// 4. decrypt the project key with your private key
|
// 4. decrypt the project key with your private key
|
||||||
const projectKey = nacl.box.open(
|
const projectKey = nacl.box.open(
|
||||||
util.decodeBase64(encryptedProjectKey),
|
util.decodeBase64(encryptedProjectKey),
|
||||||
util.decodeBase64(projectKey.nonce),
|
util.decodeBase64(encryptedProjectKey.nonce),
|
||||||
util.decodeBase64(projectKey.sender.publicKey),
|
util.decodeBase64(encryptedProjectKey.sender.publicKey),
|
||||||
util.decodeBase64(privateKey)
|
util.decodeBase64(PSWD)
|
||||||
);
|
);
|
||||||
|
|
||||||
// 5. encrypt your secret(s) with the project key
|
// 5. encrypt your secret(s) with the project key
|
||||||
|
|||||||
Reference in New Issue
Block a user