Let's now write some test scripts to test the smart contract and the data and user flow. We will write Python scripts to encrypt data, decrypt data, generate a re-encryption key, and re-encrypt data. And we will use Node.js to invoke the Python scripts and smart contract functions.
Create a directory named test. In this, create a file named encrypt.py and place the following code into it:
from npre import bbs98pre = bbs98.PRE()import base64import syspublicKey = base64.b64decode(sys.argv)encrypted_message = pre.encrypt(publicKey, sys.argv)print(base64.b64encode(encrypted_message))
This script takes two arguments, publicKey and a raw message. publicKey is passed as a base64 encoded public key. ...