Exemplo n.º 1
0
        /// <summary>
        /// Gets claims matching the provided filter from the specified wallet.
        /// </summary>
        /// <remarks>
        /// <para>
        /// Claims can be filtered by Issuer, claim_def and/or Schema. To filter the results set the
        /// <paramref name="filterJson"/> parameter with a JSON string that conforms to the following
        /// format:
        /// <code>
        /// {
        ///     "issuer_did": string,
        ///     "schema_seq_no": string
        /// }
        /// </code>
        /// If <paramref name="filterJson"/> is null then all claims will be returned.
        /// </para>
        /// <para>
        /// Upon successful completion this method will return a JSON string containing an array of
        /// claims:
        /// <code>
        /// [
        ///     {
        ///         "claim_uuid": string,
        ///         "attrs": [{"attr_name" : "attr_value"}, ...],
        ///         "schema_seq_no": string,
        ///         "issuer_did": string,
        ///         "revoc_reg_seq_no": string,
        ///     },
        ///     ...
        /// ]
        /// </code>
        /// </para>
        /// </remarks>
        /// <param name="wallet">The target wallet.</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 containing the claim request.</returns>
        public static Task <string> ProverGetClaimsAsync(Wallet wallet, string filterJson)
        {
            var taskCompletionSource = new TaskCompletionSource <string>();
            var commandHandle        = PendingCommands.Add(taskCompletionSource);

            var commandResult = IndyNativeMethods.indy_prover_get_claims(
                commandHandle,
                wallet.Handle,
                filterJson,
                _proverGetClaimsCallback
                );

            CallbackHelper.CheckResult(commandResult);

            return(taskCompletionSource.Task);
        }