Rename RandomizedCommitment to CredentialPresentation
MODIFY
WalletWasabi.Tests/UnitTests/Crypto/ProofSystemTests.cs
WalletWasabi.Tests/UnitTests/Crypto/ProofSystemTests.cs
@@ -79,14 +79,15 @@ namespace WalletWasabi.Tests.UnitTests.Crypto
// The client randomizes the commitments before presenting them to the coordinator proving to
// the coordinator that a credential is valid (prover knows a valid MAC on non-randomized attribute)
var z = rnd.GetScalar();
- var randomizedCommitments = RandomizedCommitments.RandomizeMAC(mac, z, amount, r, coordinatorParameters);
- var knowledge = ProofSystem.ShowCredential(randomizedCommitments, z, mac.T, amount, r, coordinatorParameters);
+ var credential = CredentialPresentation.FromMAC(mac, z, amount, r);
+ var knowledge = ProofSystem.ShowCredential(credential, z, mac.T, amount, r, coordinatorParameters);
var proofOfMacShow = ProofSystem.Prove(knowledge, rnd);
// The coordinator must verify the received randomized credential is valid.
- Assert.Equal(randomizedCommitments.Z, z * coordinatorParameters.I);
+ var Z = credential.ComputeZ(coordinatorKey);
+ Assert.Equal(Z, z * coordinatorParameters.I);
- var statement = ProofSystem.ShowCredential(randomizedCommitments, coordinatorParameters);
+ var statement = ProofSystem.ShowCredential(credential, Z, coordinatorParameters);
var isValidProof = ProofSystem.Verify(statement, proofOfMacShow);
Assert.True(isValidProof);

MODIFY
WalletWasabi/Crypto/ZeroKnowledge/ProofSystem.cs
WalletWasabi/Crypto/ZeroKnowledge/ProofSystem.cs
@@ -42,15 +42,15 @@ namespace WalletWasabi.Crypto.ZeroKnowledge
{ iparams.Cw, Generators.Gw, Generators.Gwp, O, O, O },
});
- public static Knowledge ShowCredential(RandomizedCommitments c, Scalar z, Scalar t, Scalar a, Scalar r, CoordinatorParameters iparams)
- => new Knowledge(ShowCredential(c, iparams), new ScalarVector(z, (t * z).Negate(), t, a, r));
+ public static Knowledge ShowCredential(CredentialPresentation c, Scalar z, Scalar t, Scalar a, Scalar r, CoordinatorParameters iparams)
+ => new Knowledge(ShowCredential(c, z * iparams.I, iparams), new ScalarVector(z, (t * z).Negate(), t, a, r));
- public static Statement ShowCredential(RandomizedCommitments c, CoordinatorParameters iparams)
+ public static Statement ShowCredential(CredentialPresentation c, GroupElement Z, CoordinatorParameters iparams)
=> new Statement(new GroupElement[,]
{
// public Witness terms:
// point z z0 t a r
- { c.Z, iparams.I, O, O, O, O },
+ { Z, iparams.I, O, O, O, O },
{ c.Cx1, Generators.Gx1, Generators.Gx0, c.Cx0, O, O },
{ c.Ca, Generators.Ga, O, O, Generators.Gg, Generators.Gh },
{ c.S, O, O, O, O, Generators.Gs }

DELETE
WalletWasabi/Crypto/ZeroKnowledge/RandomizedCommitments.cs
-using NBitcoin.Secp256k1;
-using WalletWasabi.Crypto.Groups;
-
-namespace WalletWasabi.Crypto.ZeroKnowledge
-{
- public class RandomizedCommitments
- {
- private RandomizedCommitments(GroupElement Ca, GroupElement Cx0, GroupElement Cx1, GroupElement CV, GroupElement S, GroupElement Z)
- {
- this.Ca = Ca;
- this.Cx0 = Cx0;
- this.Cx1 = Cx1;
- this.CV = CV;
- this.S = S;
- this.Z = Z;
- }
-
- public GroupElement Ca { get; }
- public GroupElement Cx0 { get; }
- public GroupElement Cx1 { get; }
- public GroupElement CV { get; }
- public GroupElement S { get; }
- public GroupElement Z { get; }
-
- public static RandomizedCommitments RandomizeMAC(MAC mac, Scalar z, Scalar a, Scalar r, CoordinatorParameters iparams)
- {
- GroupElement Randomize(GroupElement G, GroupElement M) => M + z * G;
- return new RandomizedCommitments(
- Ca: Randomize(Generators.Ga, a * Generators.Gg + r * Generators.Gh),
- Cx0: Randomize(Generators.Gx0, mac.U),
- Cx1: Randomize(Generators.Gx1, mac.T * mac.U),
- CV: Randomize(Generators.GV, mac.V),
- S: r * Generators.Gs,
- Z: z * iparams.I);
- }
-
- public static RandomizedCommitments RandomizeMAC(GroupElement Ca, GroupElement Cx0, GroupElement Cx1, GroupElement CV, GroupElement S, CoordinatorSecretKey sk)
- => new RandomizedCommitments(Ca, Cx0, Cx1, CV, S, Z: CV - (sk.W * Generators.Gw + sk.X0 * Cx0 + sk.X1 * Cx1 + sk.Ya * Ca));
- }
-}

Rename RandomizedCommitment to CredentialPresentation