You can select a transaction output, and sigma instance to target. If you do not specify a target, the first output and first sigma instance will be assumed.
Here we target output index 1:
Here we target output index 1, sigma instance 2:
Once an instance is targeted, you can use verify like normal:
If you sign a tx and the sign it a again the signature will be replaced. However, you can add additional signatures by incrementing the sigma instance number before signing.
Remote Signatures
This library supports using a remove key server such as starfish or tokenpass. use the sigmaInstance.remoteSign(keyHost) method to sign the message buffer using a remove key service instead of passing in a private key. This will take a second parameter, authTokenHeader object which will be forwarded as a header to the key server. This is useful if you need a signing server in the cloud.
Building the Library:
To build the Sigma Protocol library yourself, follow these steps:
Clone the repository:
Navigate to the project directory and install dependencies:
Build the library:
The compiled JavaScript files will be output to the ./dist directory.
const sigma = new Sigma(tx);
const isValid = sigma.verify()
console.log("Signature is valid:", isValid);
const sigma = new Sigma(tx, 1);
// this means there are 2 signatures on a single output
// this is typical when a user signs, and then a
// platform signs covering the user signature
const sigma = new Sigma(tx, 1);
const isValid = sigma.verify()
console.log("Signature is valid:", isValid);
const sigma = new Sigma(tx, 1, 2);
sigma.sign(privateKey);
const sigma = new Sigma(tx, 1, 2);
sigma.remoteSign("http://localhost:21000", "authToken");