Beispiel #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);
        }
 public string GetValue(IValueStore store, Guid id)
 {
     return(store.GetValue(id));
 }