Esempio n. 1
0
        /// \\
        ///
        /// \\
        /// \\\\
        /// \\\\
        /// \\Thrown when provided Json transaction is not valid.\\
        public SignedTx SignJson(JObject tx)
        {
            StObject so;

            try
            {
                so = StObject.FromJson(tx, strict: true);
            } catch (InvalidJsonException ex)
            {
                throw new InvalidTxException("Transaction is not valid.", nameof(tx), ex);
            }
            return(SignStObject(so));
        }
Esempio n. 2
0
        public void TransactionSigningTest()
        {
            var json = JObject.Parse(TxJson);
            var obj  = StObject.FromJson(json);
            var hex  = obj.ToHex();

            // The MessageBytes includes the HashPrefix
            Assert.AreEqual(MessageBytes.Substring(8), hex);
            Seed seed = Seed.FromPassPhrase("niq").SetEd25519();

            // The ed25519 Signature
            var sig         = seed.KeyPair().Sign(B16.Decode(MessageBytes));
            var expectedSig = ExpectedSig;

            Assert.AreEqual(expectedSig, B16.Encode(sig));
        }