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.