コード例 #1
0
        public static async Task <PublicKey> GetPublicKey(this IValueStore r, byte[] pkhash,
                                                          CancellationToken cancellationToken)
        {
            var dht = r as IPublicKeyFetcher;

            if (dht != null)
            {
                return(await dht.GetPublicKey(new PeerId(pkhash), cancellationToken));
            }

            var key   = $"/pk/{Encoding.UTF8.GetString(pkhash)}";
            var pkval = await r.GetValue(key, cancellationToken);

            return(pkval != null?PublicKey.Unmarshal(pkval) : null);
        }
コード例 #2
0
 public string GetValue(IValueStore store, Guid id)
 {
     return(store.GetValue(id));
 }