Ejemplo n.º 1
0
        /// <summary>
        /// TODO: this method ignores tempVerkey from ListMyDidsWithMetaAsync result
        /// </summary>
        /// <returns>The all dids.</returns>
        /// <param name="pool">Pool.</param>
        /// <param name="wallet">Wallet.</param>
        public static List <IDid> GetAllMyDids(IPool pool, IWallet wallet)
        {
            // ListMyDidsWithMetaAsync

            List <IDid> dids = new List <IDid>();

            string didsJson = DidAsync.ListMyDidsWithMetaAsync(wallet).Result;

            /*
             *  [{"did":"VsKV7grR1BUE29mG2Fm2kX","verkey":"GjZWsBLgZCR18aL468JAT7w9CZRiBnpxUPPgyQxh4voa","tempVerkey":null,"metadata":null}]
             */

            var didList = JArray.Parse(didsJson);

            foreach (var didObject in didList)
            {
                string did      = didObject["did"].Value <string>();
                string metadata = didObject["metadata"].Value <string>();
                string verkey   = didObject["verkey"].Value <string>();

                DidInstance didType = new DidInstance(pool, wallet, did, verkey, metadata);
                dids.Add(didType);
            }

            return(dids);
        }