Browse Source

better tests

activeAddress
Matias Alejo Garcia 10 years ago
parent
commit
74d0908aec
  1. 26
      README.md
  2. 33
      test/integration/clientApi.js

26
README.md

@ -95,53 +95,53 @@ bit recreate
### On the Air-gapped device ### On the Air-gapped device
``` ```
git genkey bit genkey
git export -o wallet.dat --readonly (or --nosigning) bit export -o wallet.dat --readonly (or --nosigning)
``` ```
### Proxy machine ### Proxy machine
``` ```
git join secret -i wallet.dat bit join secret -i wallet.dat
git balance bit balance
# Export pending transaction to be signed offline # Export pending transaction to be signed offline
git txproposals -o txproposals.dat bit txproposals -o txproposals.dat
``` ```
## Back to air-gapped device ## Back to air-gapped device
### To check tx proposals: ### To check tx proposals:
``` ```
git txproposals -i txproposals.dat bit txproposals -i txproposals.dat
``` ```
First time txproposals is running on the air gapped devices, the public keys of the copayers will be imported from the txproposals archive. That information is exported automatically by the proxy machine, and encrypted copayer's xpriv derivatives. First time txproposals is running on the air gapped devices, the public keys of the copayers will be imported from the txproposals archive. That information is exported automatically by the proxy machine, and encrypted copayer's xpriv derivatives.
### Sign them ### Sign them
``` ```
git sign -i txproposals.dat -o txproposals-signed.dat bit sign -i txproposals.dat -o txproposals-signed.dat
# Or With filter # Or With filter
git sign e01e -i txproposals.dat -o txproposals-signed.dat bit sign e01e -i txproposals.dat -o txproposals-signed.dat
``` ```
## Back to proxy machine ## Back to proxy machine
``` ```
git sign -i txproposals-signed.dat bit sign -i txproposals-signed.dat
``` ```
# Password protection (TODO) # Password protection (TODO)
### encrypts everything by default ### encrypts everything by default
``` ```
git create myWallet 2-3 -p password bit create myWallet 2-3 -p password
# Or (interactive mode) # Or (interactive mode)
git create myWallet 2-3 -p bit create myWallet 2-3 -p
Enter password: Enter password:
``` ```
### allows readonly operations without password (encrypts xpriv, and leave readonlySigningKey unencrypted) ### allows readonly operations without password (encrypts xpriv, and leave readonlySigningKey unencrypted)
``` ```
git create myWallet 2-3 -p --nopasswd:ro bit create myWallet 2-3 -p --nopasswd:ro
``` ```
### allows readwrite operations without password (only encrypts xpriv) ### allows readwrite operations without password (only encrypts xpriv)
``` ```
git create myWallet 2-3 -p --nopasswd:rw bit create myWallet 2-3 -p --nopasswd:rw
``` ```
# Local data # Local data

33
test/integration/clientApi.js

@ -378,7 +378,6 @@ describe('client API ', function() {
clients[1].import(str, function(err, wallet) { clients[1].import(str, function(err, wallet) {
should.not.exist(err); should.not.exist(err);
console.log('[clientApi.js.380]'); //TODO
clients[1].createAddress(function(err, x0) { clients[1].createAddress(function(err, x0) {
err.code.should.equal('NOTAUTHORIZED'); err.code.should.equal('NOTAUTHORIZED');
clients[0].createAddress(function(err, x0) { clients[0].createAddress(function(err, x0) {
@ -508,17 +507,19 @@ describe('client API ', function() {
}); });
it('should create from proxy from airgapped', function(done) { it('should create from proxy from airgapped', function(done) {
// client0 -> airgapped
// client1 -> proxy var airgapped = clients[0];
clients[0].generateKey('testnet', function(err) { var proxy = clients[1];
airgapped.generateKey('testnet', function(err) {
should.not.exist(err); should.not.exist(err);
clients[0].export({ airgapped.export({
access: 'readwrite' access: 'readwrite'
}, function(err, str) { }, function(err, str) {
clients[1].import(str, function(err) { proxy.import(str, function(err) {
should.not.exist(err); should.not.exist(err);
clients[1].createWallet('1', '2', 1, 1, 'testnet', proxy.createWallet('1', '2', 1, 1, 'testnet',
function(err) { function(err) {
should.not.exist(err); should.not.exist(err);
// should keep cpub // should keep cpub
@ -537,18 +538,22 @@ describe('client API ', function() {
}); });
it('should join from proxy from airgapped', function(done) { it('should join from proxy from airgapped', function(done) {
// client0 -> airgapped
// client1 -> proxy var airgapped = clients[0];
clients[0].generateKey('testnet', function(err) { var proxy = clients[1];
var other = clients[2]; // Other copayer
airgapped.generateKey('testnet', function(err) {
should.not.exist(err); should.not.exist(err);
clients[0].export({ airgapped.export({
access: 'readwrite' access: 'readwrite'
}, function(err, str) { }, function(err, str) {
clients[1].import(str, function(err) { proxy.import(str, function(err) {
should.not.exist(err); should.not.exist(err);
clients[2].createWallet('1', '2', 1, 2, 'testnet', function(err, secret) {
other.createWallet('1', '2', 1, 2, 'testnet', function(err, secret) {
should.not.exist(err); should.not.exist(err);
clients[1].joinWallet(secret, 'john', function(err) { proxy.joinWallet(secret, 'john', function(err) {
should.not.exist(err); should.not.exist(err);
// should keep cpub // should keep cpub
var c0 = JSON.parse(fsmock._get('client0')); var c0 = JSON.parse(fsmock._get('client0'));

Loading…
Cancel
Save