diff --git a/CHANGELOG.md b/CHANGELOG.md index ce675d7..611815f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,7 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - `get_encryption_keys`, `decrypt_amount`, and `combine_encrypted_amounts` functions for handling encrypted amounts. -- `prove_statement_v1` for producing proofs related to Concordium identities. +- `prove_identity_statement` for producing proofs related to Concordium identities. - `Network` type to represent different concordium network variants. - `AttributeTag` to represent the different identity attribute variants. - A number of types including `VerifiablePresentation`, `Web3IdCredential`, `VerifiableCredentialStatement`, diff --git a/src/id_proofs.rs b/src/id_proofs.rs index 50a46da..33de59d 100644 --- a/src/id_proofs.rs +++ b/src/id_proofs.rs @@ -1,10 +1,7 @@ -use concordium_base::{ - common::VERSION_0, - id::{ - constants::{ArCurve, AttributeKind, IpPairing}, - id_proof_types::{ProofVersion, StatementWithContext}, - types::IdentityObjectV1, - }, +use concordium_base::id::{ + constants::{ArCurve, AttributeKind, IpPairing}, + id_proof_types::{ProofVersion, StatementWithContext}, + types::IdentityObjectV1, }; use key_derivation::CredentialContext; use serde::{Deserialize, Serialize}; @@ -219,9 +216,10 @@ pub fn prove_identity_statement( credential: cred_id, }; + let proof_version = ProofVersion::Version2; let proof = statement .prove( - ProofVersion::Version2, + proof_version, &global_context, challenge.as_ref(), &id_object.alist, @@ -229,6 +227,12 @@ pub fn prove_identity_statement( ) .context("Could not produce proof.") .map_err(|e| e.to_call_failed(fn_name.to_string()))?; - VersionedIdentityProof::try_from(concordium_base::common::Versioned::new(VERSION_0, proof)) - .map_err(|e| e.to_call_failed(fn_name.to_string())) + + // We tag the proof with version 1 for `Versioned`, as 0 is used for `Proof` produced with + // `ProofVersion::Version1` + VersionedIdentityProof::try_from(concordium_base::common::Versioned::new( + (proof_version as u32).into(), + proof, + )) + .map_err(|e| e.to_call_failed(fn_name.to_string())) }