JS Client scripts for signing, witnessing and verifying revisions
Minimum requirement: Node.js 14.x+
But it is recommended to run the latest Node.js.
Install node here
npm installnpm run build- Use
aqua.jsin dist file, follow usage commands in the section below - You can also build a standalone binary using
build:bin. Substitute accordingly in step 2 above; the binaries will be in the binaries folder
By default, aqua.js will look for a credentials file at ~/.aqua/credentials.json. If it doesn't exist, it will create one with the default values.
So you can run ./dist/aqua.js notarize README.md without any arguments.
If you want to create a custom credentials file, you can use the --cred option:
./dist/aqua.js notarize README.md --cred ./NEW/PATH/TO/credentials.jsonTo notarize a file, use the following command:
./dist/aqua.js notarize <FILE_PATH>Example:
./dist/aqua.js notarize ./LICENSETo sign a file, use the following command.
You can only sign aqua.json files. Ensure to notarize using the command above.
./dist/aqua.js notarize [--sign cli | --sign metamask | --sign did] <FILE_PATH>Example:
./dist/aqua.js notarize --sign cli ./LICENSETo witness a file, use the following command.
You can only witness aqua.json files. Ensure to notarize using the command above.
./dist/aqua.js notarize [--witness eth | --witness nostr | --witness tsa] <FILE_PATH>Example:
./dist/aqua.js notarize ./LICENSE --witness ethTo witness multiple aqua chains:
Example:
./dist/aqua.js notarize LICENSE,README.md --witness eth --vtree --network sepoliaTo witness multiple files with specific revision:
Example:
./dist/aqua.js notarize LICENSE@0x_specific_revision_,README.md@0x_specific_revision_ --witness eth --type cli --vtreeTo verify an aqua chain, use the following command:
./dist/aqua.js verify <AQUA_CHAIN_FILE_PATH>Example:
./dist/aqua.js verify LICENSE.aqua.jsonUse the -v flag for result verboseness:
./dist/aqua.js verify LICENSE.aqua.json -vUse the --ignore-merkle-proof flag to ignore verifying merkle proof of each revision. Verification is faster:
./dist/aqua.js verify LICENSE.aqua.json --ignore-merkle-proofThis will delete the last revision from an aqua chain:
./dist/aqua.js notarize --remove <FILE_PATH>Example:
./dist/aqua.js notarize --remove ./LICENSETo link an Aqua chain to another, use the --link option as follows:
./dist/aqua.js notarize <FILE_PATH> --link <FILE_PATH.aqua.json>Example:
./dist/aqua.js notarize --link ./LICENSE ./README.md.aqua.jsonThis will link README.md.aqua.json to the LICENSE file and it will be written into the LICENSE.aqua.json file.
To generate a content revision, run the following command:
./dist/aqua.js notarize --content ./LICENSETo generate a scalar revision, run the following command:
./dist/aqua.js notarize --scalar ./LICENSETo create a genesis form revision:
./notarize.js example-form.json --form example-form.jsonPlease note: for genesis, the filename should be the same as the form name.
To create a form revision:
./notarize.js LICENSE --form example-form.json-
To delete a form entry:
./form_updater.js example-form.json.aqua.json@abcd --delete age
-
To update a form entry (i.e., undelete it):
./form_updater.js example-form.json.aqua.json --update forms_age 200
Features:
- File Validation: Ensures the input file is a .aqua.json file and exists
- Form Key Detection:
- Can find exact matches (e.g., forms-name)
- Can find partial matches (e.g., name will match forms-name)
- Handles deleted fields (e.g., forms-name.deleted)
- Operations:
--delete: Marks a form field as deleted by appending .deleted--update: Updates or restores a form field, removing the .deleted suffix if present
- Error Handling: Provides clear error messages for invalid inputs
- Non-destructive: Preserves the original structure while making changes
- Ensure to install sharness in your local system. The sharness path is set to
~/share/sharness/sharness.sh, then copy the sharness directory to tests. Check out sharness for more instructions - Run
make test - The output will be in test > trash (the last part is dynamic based on the test)
- Hint: Ensure your
tests/test-*.shfiles are executable:chmod +x tests/test-*