Beispiel #1
0
        /// <summary>
        /// Returns a seed's public key.
        /// </summary>
        /// <param name="seed"></param>
        /// <returns>A the public key corresponding to Seed</returns>
        public static string PublicKeyFromSeed(string seed)
        {
            byte[] s = Nkeys.Decode(seed);
            if ((s[0] & (31 << 3)) != PrefixByteSeed)
            {
                throw new NATSException("Not a seed");
            }
            // reconstruct prefix byte
            byte prefixByte = (byte)((s[0] & 7) << 5 | ((s[1] >> 3) & 31));

            byte[] pubKey = Ed25519.PublicKeyFromSeed(DecodeSeed(s));
            return(Encode(prefixByte, false, pubKey));
        }
Beispiel #2
0
 internal static byte[] DecodeSeed(string src)
 {
     return(DecodeSeed(Nkeys.Decode(src)));
 }
Beispiel #3
0
 private static byte[] DecodeSeed(string src)
 {
     return(DecodeSeed(Nkeys.Decode(src)));
 }