/// <summary> /// Creates a claim request for the specified claim offer and stores it in the provided wallet. /// </summary> /// <remarks> /// <para> /// The JSON of a claim definition that is associated with the issuer_did and schema_seq_no in the /// claim_offer must be provided in the <paramref name="claimDefJson"/> parameter. Claim /// definitions can be retrieved from the ledger using the /// <see cref="Ledger.BuildGetClaimDefTxnAsync(string, int, string, string)"/>method. /// </para> /// <para> /// The JSON in the <paramref name="claimOfferJson"/> parameter contains information about the /// issuer of the claim offer: /// <code> /// { /// "issuer_did": string, /// "schema_seq_no": string /// } /// </code> /// This method gets the public key and schema the <c>issuer_did</c> from the ledger for and /// stores them in the provided wallet. Once this is complete a blinded master secret is for the /// master secret specified by the <paramref name="masterSecretName"/> parameter. /// <note type="note"> /// The master secret identified by the name must be already stored in the secure wallet using the /// <see cref="ProverCreateMasterSecretAsync(Wallet, string)"/> method. /// </note> /// The blinded master secret becomes a part of the claim request. /// </para> /// </remarks> /// <param name="wallet">The target wallet.</param> /// <param name="proverDid">The DID of the prover.</param> /// <param name="claimOfferJson">The claim offer JSON to generate a claim request for.</param> /// <param name="claimDefJson">The claim definition JSON.</param> /// <param name="masterSecretName">The name of the master secret in the wallet to use for generating the blinded secret.</param> /// <returns>An asynchronous <see cref="Task{T}"/> that, when the operation completes, resolves /// to a JSON string containing the claim request.</returns> public static Task <string> ProverCreateAndStoreClaimReqAsync(Wallet wallet, string proverDid, string claimOfferJson, string claimDefJson, string masterSecretName) { ParamGuard.NotNull(wallet, "wallet"); ParamGuard.NotNullOrWhiteSpace(proverDid, "proverDid"); ParamGuard.NotNullOrWhiteSpace(claimOfferJson, "claimOfferJson"); ParamGuard.NotNullOrWhiteSpace(claimDefJson, "claimDefJson"); ParamGuard.NotNullOrWhiteSpace(masterSecretName, "masterSecretName"); var taskCompletionSource = new TaskCompletionSource <string>(); var commandHandle = PendingCommands.Add(taskCompletionSource); var commandResult = IndyNativeMethods.indy_prover_create_and_store_claim_req( commandHandle, wallet.Handle, proverDid, claimOfferJson, claimDefJson, masterSecretName, _proverCreateAndStoreClaimReqCallback ); CallbackHelper.CheckResult(commandResult); return(taskCompletionSource.Task); }
/// <summary> /// Creates and stores a claim request for a prover. /// </summary> /// <param name="wallet">The target wallet.</param> /// <param name="proverDid">The DID of the prover.</param> /// <param name="claimOfferJson">The claim offer JSON.</param> /// <param name="claimDefJson">The claim definition JSON.</param> /// <param name="masterSecretName">The master secret name.</param> /// <returns>An asynchronous task that returns a claim request JSON.</returns> public static Task <string> ProverCreateAndStoreClaimReqAsync(Wallet wallet, string proverDid, string claimOfferJson, string claimDefJson, string masterSecretName) { var taskCompletionSource = new TaskCompletionSource <string>(); var commandHandle = AddTaskCompletionSource(taskCompletionSource); var commandResult = IndyNativeMethods.indy_prover_create_and_store_claim_req( commandHandle, wallet.Handle, proverDid, claimOfferJson, claimDefJson, masterSecretName, _proverCreateAndStoreClaimReqCallback ); CheckResult(commandResult); return(taskCompletionSource.Task); }