This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const nacl = require('tweetnacl'); | |
| nacl.util = require('tweetnacl-util'); | |
| app.get('/decrypt',(req, res, next) => { | |
| const publicKeyString = 'pwrtyyHkzJ40KVQvnvTxhMR0/Xz7Y3Rh/CWbVphb9E8='; | |
| const secretKeyString = '2JvMGAPQM6o78brjJGI8Ak2DUK0FOJIoGcZuy7/4mO8='; | |
| const nonceString = 'YVK397arydNB2d+bhWXItAm8HYITPtqY'; | |
| const encryptedData = "Y8lc/J839IEKOB23thIwfQsjq0lMu1yMQl8VeuSfZQ=="; | |
| const publicKeyUint8 = nacl.util.decodeBase64(publicKeyString); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const nacl = require('tweetnacl'); | |
| nacl.util = require('tweetnacl-util'); | |
| app.get('/encrypt',(req, res, next) => { | |
| const exampleForEncryptData = "Hello There!!!!"; | |
| const keyPairObj = nacl.box.keyPair(); | |
| //publicKey: Uint8Array(32) [167, 10, 237, 203, 33, 228, 204, 158, 52, 41, 84, 47, 158, 244, 241, 132, 196, 116, 253, 124, 251, 99, 116, 97, 252, 37, 155, 86, 152, 91, 244, 79] | |
| //secretKey: Uint8Array(32) [216, 155, 204, 24, 3, 208, 51, 170, 59, 241, 186, 227, 36, 98, 60, 2, 77, 131, 80, 173, 5, 56, 146, 40, 25, 198, 110, 203, 191, 248, 152, 239] |