public static Task <SecretKey> NewSignedPublicKeySecretKey(PublicServiceAccountKey publicAccountKey, Key key)
        {
            if (!key.IsPrivate || key.PublicKey != publicAccountKey.PublicKey)
            {
                throw new ArgumentException("Key is wrong", nameof(key));
            }

            var passphrase = $"{"SignedPublicKey"}.{Hex.ToString(key.RawData)}.{publicAccountKey.ChainId.ToString("X8")}.{publicAccountKey.AccountId.ToString("X8")}.{publicAccountKey.KeyIndex.ToString("X8")}";

            return(SecretKey.NewSecretKey(new PublicServiceAccountKeySecretKeyInfo(publicAccountKey), passphrase));
        }
Beispiel #2
0
        public static Task <SecretKey> NewKeyExchangeSecetKey(long account1, short keyIndex1, long account2, short keyIndex2, int chainId, Key key)
        {
            if (!key.IsPrivate)
            {
                throw new ArgumentException("Key is wrong", nameof(key));
            }

            var keyInfo    = new KeyExchageSecretKeyInfo(account1, keyIndex1, account2, keyIndex2, chainId);
            var passphrase = $"KeyExchange.{Hex.ToString(key.RawData)}.{keyInfo.Account1.ToString("X8")}.{keyInfo.KeyIndex1.ToString("X8")}.{keyInfo.Account2.ToString("X8")}.{keyInfo.KeyIndex2.ToString("X8")}.{chainId.ToString("X8")}";

            return(SecretKey.NewSecretKey(keyInfo, passphrase));
        }
 public static Task <SecretKey> NewRandomSecretKey(int chainId)
 {
     return(SecretKey.NewSecretKey(new RandomSecretKeyInfo(chainId), Rand.NextSeed(64)));
 }
 public static Task <SecretKey> NewPassphraseSecretKey(int chainId, string passphrase)
 {
     return(SecretKey.NewSecretKey(new PassphraseSecretKeyInfo(chainId), $"{"Passphrase"}.{passphrase}.{chainId.ToString("X8")}"));
 }