Beispiel #1
0
        /// <summary>
        /// Gets the pairwise record associated with the specified DID from the provided wallet.
        /// </summary>
        /// <param name="wallet">The wallet to get the pairwise record from.</param>
        /// <param name="theirDid">The DID belonging to another party to get the pairwise record for.</param>
        /// <returns>An asynchronous <see cref="Task{T}"/> that resolves to a JSON string containing
        /// a pairwise record.</returns>
        /// <remarks>
        /// The JSON string that this method resolves to will contain a single pairwise record for two DIDs,
        /// the DID belonging to the record owner (my_did), the associated DID belonging to the other party
        /// (their_did) and any metadata associated with the record (metadata).
        ///
        /// <code>
        /// [
        ///     {"my_did":"my_did_for_A","their_did":"A's_did_for_me","metadata":"some metadata"},
        ///     {"my_did":"my_did_for_B","their_did":"B's_did_for_me"}
        ///     ...
        /// ]
        /// </code>
        ///
        /// Note that if no metadata is present in a record the JSON will omit the <c>metadata</c>key.
        /// </remarks>
        public static Task <string> GetAsync(Wallet wallet, string theirDid)
        {
            var taskCompletionSource = new TaskCompletionSource <string>();
            var commandHandle        = PendingCommands.Add(taskCompletionSource);

            int result = IndyNativeMethods.indy_get_pairwise(
                commandHandle,
                wallet.Handle,
                theirDid,
                _getPairwiseCallback);

            CallbackHelper.CheckResult(result);

            return(taskCompletionSource.Task);
        }