MCPcopy Create free account
hub / github.com/docknetwork/crypto / init_using_token

Method init_using_token

kvac/src/bbs_sharp/proof.rs:195–237  ·  view source on GitHub ↗

Initialize the protocol using token received in HOL mode. Pass the appropriate type in `hw_sig_type` which corresponds to the signature type generated by user's secure hardware If `verifier_pub_key` is provided, then create a designated verifier proof which only the verifier can verify

(
        rng: &mut R,
        private_data: TokenPrivateData<G>,
        proof_of_validity: ProofOfValidity<G>,
        params: &MACParams<G>,
        messages_and_blindings: MBI,
        user_public

Source from the content-addressed store, hash-verified

193 /// Pass the appropriate type in `hw_sig_type` which corresponds to the signature type generated by user's secure hardware
194 /// If `verifier_pub_key` is provided, then create a designated verifier proof which only the verifier can verify
195 pub fn init_using_token<'a, MBI, R: RngCore>(
196 rng: &mut R,
197 private_data: TokenPrivateData<G>,
198 proof_of_validity: ProofOfValidity<G>,
199 params: &MACParams<G>,
200 messages_and_blindings: MBI,
201 user_public_key: &UserPublicKey<G>,
202 hw_sig_type: HardwareSignatureType,
203 verifier_pub_key: Option<&G>,
204 ) -> Result<Self, KVACError>
205 where
206 MBI: IntoIterator<Item = MessageOrBlinding<'a, G::ScalarField>>,
207 {
208 let (messages, indexed_blindings) =
209 match split_messages_and_blindings(rng, messages_and_blindings, params) {
210 Ok(t) => t,
211 Err(l) => {
212 return Err(KVACError::MessageCountIncompatibleWithMACParams(
213 l,
214 params.supported_message_count(),
215 ))
216 }
217 };
218
219 let TokenPrivateData { D, r1, r3, minus_e } = private_data;
220 let ProofOfValidity { A_hat, B_bar, c, r } = proof_of_validity;
221 Self::_init(
222 rng,
223 A_hat,
224 B_bar,
225 D,
226 r1,
227 r3,
228 minus_e,
229 messages,
230 indexed_blindings,
231 params,
232 user_public_key,
233 hw_sig_type,
234 Some((c, r)),
235 verifier_pub_key,
236 )
237 }
238
239 pub fn challenge_contribution<W: Write>(
240 &self,

Callers

nothing calls this directly

Calls 2

Tested by

no test coverage detected