Exemplo n.º 1
0
        public async Task Wrong_Passphrase()
        {
            var ipfs1 = TestFixture.Ipfs;
            await ipfs1.KeyChain();

            var ipfs2 = new IpfsEngine("the wrong pass phrase".ToCharArray())
            {
                Options = ipfs1.Options
            };

            ExceptionAssert.Throws <UnauthorizedAccessException>(() =>
            {
                var _ = ipfs2.KeyChain().Result;
            });
        }
Exemplo n.º 2
0
        public async Task SecureString_Passphrase()
        {
            var secret = "this is not a secure pass phrase";
            var ipfs   = new IpfsEngine(secret.ToCharArray());

            ipfs.Options = TestFixture.Ipfs.Options;
            await ipfs.KeyChain();

            var passphrase = new SecureString();

            foreach (var c in secret)
            {
                passphrase.AppendChar(c);
            }
            ipfs         = new IpfsEngine(passphrase);
            ipfs.Options = TestFixture.Ipfs.Options;
            await ipfs.KeyChain();
        }
Exemplo n.º 3
0
        public async Task IpfsPass_Passphrase()
        {
            var secret = "this is not a secure pass phrase";
            var ipfs   = new IpfsEngine(secret.ToCharArray());

            ipfs.Options = TestFixture.Ipfs.Options;
            await ipfs.KeyChain();

            Environment.SetEnvironmentVariable("IPFS_PASS", secret);
            try
            {
                ipfs         = new IpfsEngine();
                ipfs.Options = TestFixture.Ipfs.Options;
                await ipfs.KeyChain();
            }
            finally
            {
                Environment.SetEnvironmentVariable("IPFS_PASS", null);
            }
        }