Skip to content

Commit

Permalink
fix local marbles with kvs
Browse files Browse the repository at this point in the history
  • Loading branch information
dshuffma-ibm committed Aug 18, 2017
1 parent ad23b0e commit ab3992d
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 8 deletions.
6 changes: 3 additions & 3 deletions config/blockchain_creds_local.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@
},
"registrar": [
{
"enrollId": "admin",
"enrollSecret": "adminpw"
"enrollId": "PeerAdmin",
"enrollSecret": "-"
}
],
"caName": "PeerOrg1CA"
"caName": null
}
}
}
1 change: 0 additions & 1 deletion config/crypto/prebaked/Org1MSP

This file was deleted.

1 change: 1 addition & 0 deletions config/crypto/prebaked/PeerAdmin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"name":"PeerAdmin","mspid":"Org1MSP","roles":null,"affiliation":"","enrollmentSecret":"","enrollment":{"signingIdentity":"5890f0061619c06fb29dea8cb304edecc020fe63f41a6db109f1e227cc1cb2a8","identity":{"certificate":"-----BEGIN CERTIFICATE-----\nMIICGTCCAb+gAwIBAgIQKKKdQSzsDoUYn/LPAuRWGTAKBggqhkjOPQQDAjBzMQsw\nCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy\nYW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEcMBoGA1UEAxMTY2Eu\nb3JnMS5leGFtcGxlLmNvbTAeFw0xNzA2MjMxMjMzMTlaFw0yNzA2MjExMjMzMTla\nMFsxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1T\nYW4gRnJhbmNpc2NvMR8wHQYDVQQDDBZBZG1pbkBvcmcxLmV4YW1wbGUuY29tMFkw\nEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAECmbzUDozIrLKjp3OAzItSG7m7Flw76rT\n8VO8E6otlCwxKtBRkPpZL7norC3NsjyE339J5O4pXCqhIApQyRRsRqNNMEswDgYD\nVR0PAQH/BAQDAgeAMAwGA1UdEwEB/wQCMAAwKwYDVR0jBCQwIoAgDnKSJOiz8xeE\nyKk8W4729MHJHZ5uV3xFwzFjYJ/kABEwCgYIKoZIzj0EAwIDSAAwRQIhALT02pc/\nyfE/4wUJfUBQ32GifUEh8JktAXzL/73S0rjYAiACNSp6zAQBX9SBxTOGMk4cGGAy\nCKqf8052NVUs2CvPzA==\n-----END CERTIFICATE-----\n"}}}
1 change: 0 additions & 1 deletion config/crypto/prebaked/admin

This file was deleted.

1 change: 1 addition & 0 deletions utils/fc_wrangler/enrollment.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ module.exports = function (logger) {
enroll_id: options.enroll_id,
enroll_secret: options.enroll_secret,
msp_id: options.msp_id,
kvs_path: options.kvs_path
};
logger.info('[fcw] Going to enroll', debug);

Expand Down
20 changes: 17 additions & 3 deletions utils/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,12 +367,26 @@ module.exports = function (config_filename, logger) {
return default_path; //do the default one
}

if (helper.config.client && helper.config.client.credentialStore) {
const kvs_path = helper.config.client.credentialStore.path;
return path.join(__dirname, kvs_path); //use the kvs provided in the json
// -- Using Custom KVS -- //
if (helper.creds.client && helper.creds.client.credentialStore) {
const kvs_path = helper.creds.client.credentialStore.path;
const ret = path.join(__dirname, '../config/' + kvs_path + '/');
copy_keys_over(ret);
return ret; //use the kvs provided in the json
} else {
return default_path; //make a new kvs folder in the home dir
}

// copy over private and public keys to the hfc key value store
function copy_keys_over(custom_path) {
try {
const default_path2 = path.join(os.homedir(), '.hfc-key-store/');
const private_key = '5890f0061619c06fb29dea8cb304edecc020fe63f41a6db109f1e227cc1cb2a8-priv'; //todo make this generic
const public_key = '5890f0061619c06fb29dea8cb304edecc020fe63f41a6db109f1e227cc1cb2a8-pub';
fs.createReadStream(custom_path + private_key).pipe(fs.createWriteStream(default_path2 + private_key));
fs.createReadStream(custom_path + public_key).pipe(fs.createWriteStream(default_path2 + public_key));
} catch (e) { }
}
};


Expand Down

0 comments on commit ab3992d

Please sign in to comment.