Exemplo n.º 1
0
        /// <summary>
        /// Lists all pairwise relationships stored in the specified wallet.
        /// </summary>
        /// <param name="wallet">The wallet to get the pairwise records from.</param>
        /// <returns>An asynchronous <see cref="Task{T}"/> that resolves to a JSON string containing
        /// an array of all pairwise relationships stored in the wallet.</returns>
        /// <remarks>
        /// The JSON string that this method resolves to will contain a array of objects each of which
        /// describes a pairwise record for two DIDs, a DID belonging to the record owner (my_did) and the
        /// associated DID belonging to the other party (their_did).
        ///
        /// <code>
        /// [
        ///     {"my_did":"my_did_for_A","their_did":"A's_did_for_me"},
        ///     {"my_did":"my_did_for_B","their_did":"B's_did_for_me"}
        ///     ...
        /// ]
        /// </code>
        ///
        /// Note that this call does not return any metadata associated with the pairwise records; to get the
        /// metadata use the <see cref="GetAsync(Wallet, string)"/> method.
        /// </remarks>
        public static Task <string> ListAsync(Wallet wallet)
        {
            var taskCompletionSource = new TaskCompletionSource <string>();
            var commandHandle        = PendingCommands.Add(taskCompletionSource);

            int result = IndyNativeMethods.indy_list_pairwise(
                commandHandle,
                wallet.Handle,
                _listPairwiseCallback);

            CallbackHelper.CheckResult(result);

            return(taskCompletionSource.Task);
        }