In my usecase, i want to attach a public key to a proof generated by a circom circuit. If my circuit is like follows:
template Example() {
signal input secret;
signal input hash;
signal input salt;
signal output verified;
// Hash the secret and the salt, compare it to hash and assign it to the verified output
// Omitted for brevity
}
component main {public [hash]} = Example();
If i just generate a proof that i know the secret and the salt, and then sign it, other party can take the proof and sign it with a different key without knowing the secret, defeating the purpose.
Would it be possible to add a public key to the inputs, even though it's unused in the circuit in a way that nobody can generate a proof swapping the public key with other different key without knowing the secret?
template Example() {
signal input secret;
signal input hash;
signal input salt;
signal input publicIdentity; // Unused
signal output verified;
// Hash the secret and the salt, compare it to hash and assign it to the verified output
// Omitted for brevity
}
component main {public [hash, publicIdentity]} = Example();
Do I need to add a artificial constraint like publicIdentity * 0 === 0
? If so, why?