Created
July 28, 2016 09:15
-
-
Save 0x4445565A/7f3b69a6417ec2ef581d2e2443c4ef4e to your computer and use it in GitHub Desktop.
Using import_from_p3skb to export private keys from KeyBase.io
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var username = 'testuser'; | |
var passphrase = 'foxtrot:unicorn:charlie:kilo'; | |
$.get("https://keybase.io/_/api/1.0/user/lookup.json", | |
{ | |
usernames: username, | |
fields: 'private_keys' | |
}, | |
function(account) { | |
private_key = account.them[0].private_keys.primary; | |
kbpgp.KeyManager.import_from_p3skb({armored: private_key.bundle}, function (err, keyManager) { | |
keyManager.unlock_p3skb({passphrase: passphrase}, function(err) { | |
var params = { | |
msg: "Here is my manifesto", | |
sign_with: keyManager, | |
}; | |
kbpgp.box (params, function(err, result_string, result_buffer) { | |
console.log(err, result_string); | |
}); | |
}); | |
}); | |
}).fail(function(error) { | |
// Oh no... | |
console.log(error); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment