Exemplo n.º 1
0
        /// <summary>
        /// Gets all claim offers in the provided wallet matching the specified filter.
        /// </summary>
        /// <remarks>
        /// <para>
        /// Claim offers stored with the <see cref="ProverStoreClaimOfferAsync(Wallet, string)"/> can be
        /// retrieved by searching on the DID of the issuer and/or the schema sequence number.  To filter
        /// the claim offers a <paramref name="filterJson"/> parameter must be provided with a JSON
        /// string which can include the following members:
        /// <code>
        /// {
        ///     "issuer_did": string,
        ///     "schema_seq_no": string
        /// }
        /// </code>
        /// </para>
        /// <para>
        /// The return value from this method is a JSON string that contains the list of matching claim
        /// offers in the following format:
        /// <code>
        /// {
        ///     [
        ///         {
        ///             "issuer_did": string,
        ///             "schema_seq_no": string
        ///         },
        ///         ...
        ///     ]
        /// }
        /// </code>
        /// </para>
        /// </remarks>
        /// <param name="wallet">The wallet containing the claims to get.</param>
        /// <param name="filterJson">The filter JSON.</param>
        /// <returns>An asynchronous <see cref="Task{T}"/> that, when the operation completes, resolves
        /// to a JSON string with a list of claim offers matching the filter.</returns>
        public static Task <string> ProverGetClaimOffersAsync(Wallet wallet, string filterJson)
        {
            var taskCompletionSource = new TaskCompletionSource <string>();
            var commandHandle        = PendingCommands.Add(taskCompletionSource);

            var commandResult = IndyNativeMethods.indy_prover_get_claim_offers(
                commandHandle,
                wallet.Handle,
                filterJson,
                _proverGetClaimOffersCallback
                );

            CallbackHelper.CheckResult(commandResult);

            return(taskCompletionSource.Task);
        }