Exemplo n.º 1
0
        /// <summary>
        /// Creates a new pairwise record in the provided wallet between two specified DIDs.
        /// </summary>
        /// <param name="wallet">The wallet to store create the pairwise record in.</param>
        /// <param name="theirDid">The DID of the remote party.</param>
        /// <param name="myDid">The DID belonging to the owner of the wallet.</param>
        /// <param name="metadata">Optional metadata to store with the record.</param>
        /// <returns>An asynchronous <see cref="Task"/> completes once the operation completes.</returns>
        public static Task CreateAsync(Wallet wallet, string theirDid, string myDid, string metadata)
        {
            var taskCompletionSource = new TaskCompletionSource <bool>();
            var commandHandle        = PendingCommands.Add(taskCompletionSource);

            int result = IndyNativeMethods.indy_create_pairwise(
                commandHandle,
                wallet.Handle,
                theirDid,
                myDid,
                metadata,
                CallbackHelper.TaskCompletingNoValueCallback);

            CallbackHelper.CheckResult(result);

            return(taskCompletionSource.Task);
        }