one step closer

This commit is contained in:
AJ ONeal 2015-12-15 13:21:26 +00:00
parent 3af1523a35
commit 65ea5fbe2a
1 changed files with 6 additions and 3 deletions

View File

@ -77,6 +77,9 @@ function createAccount(args, handlers) {
} }
, accountPrivateKeyPem: pems.privateKeyPem , accountPrivateKeyPem: pems.privateKeyPem
}).then(function (body) { }).then(function (body) {
if (body instanceof Buffer) {
body = body.toString('utf8');
}
if ('string' === typeof body) { if ('string' === typeof body) {
try { try {
body = JSON.parse(body); body = JSON.parse(body);
@ -85,9 +88,10 @@ function createAccount(args, handlers) {
} }
} }
return mkdirpAsync(args.accountDir, function () { var accountDir = path.join(args.accountsDir, pems.publicKeyMd5);
return mkdirpAsync(accountDir).then(function () {
var accountDir = path.join(args.accountsDir, pems.publicKeyMd5);
var isoDate = new Date().toISOString(); var isoDate = new Date().toISOString();
var accountMeta = { var accountMeta = {
creation_host: localname creation_host: localname
@ -119,7 +123,6 @@ function createAccount(args, handlers) {
} }
function getAccount(accountId, args, handlers) { function getAccount(accountId, args, handlers) {
console.log(args.accountsDir, accountId);
var accountDir = path.join(args.accountsDir, accountId); var accountDir = path.join(args.accountsDir, accountId);
var files = {}; var files = {};
var configs = ['meta.json', 'private_key.json', 'regr.json']; var configs = ['meta.json', 'private_key.json', 'regr.json'];