[mainnet] Add signing/verifying Aleo values #38
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Same as #37 but for mainnet
Description
Signing/verifying aleo values is present in the snarkOS CLI and the leo CLI. Verification is present in leo.
As Aleo does not natively support byte-encoded messages, this feature is necessary for generating signatures programmatically for Aleo/Leo programs. The original
sign
andverify
functions have not been altered for backwards compatibility.Features
This PR add the following functions (where
5field
is a valid Aleo valueAccount.sign_value("5field")
Account.verify_value(Signature, "5field")
Signature.sign_value(PrivateKey, "5field")
Signature.verify_value(Address, "5field")
PrivateKey.sign_value("5field")
These functions automatically convert the string value into an Aleo value, then the Aleo value into Fields, which can be signed/verified natively. This is in part to bring parity closer to the CLI implementations, but also so a
Value
would not need to be constructed for every sign/verify.Docs & Testing
Docs were updated to include a copy of the sign/verify function usage, but with
sign_value
andverify_value
. Tests were also updated to include the new functions.Validation
Signatures produced by this code have additionally been tested against the following program on Leo Playground:
Signature generation: