UNPKG

kbpgp

Version:

Keybase's PGP Implementation

107 lines (97 loc) 3.08 kB
// Generated by IcedCoffeeScript 108.0.11 (function() { var iced, is_pgp_sig, kb, pgp, pgp_sig, __iced_k, __iced_k_noop; iced = require('iced-runtime'); __iced_k = __iced_k_noop = function() {}; pgp = require('./openpgp/keymanager'); pgp_sig = require('./openpgp/sigeng'); kb = require('./keybase/hilev'); exports.import_armored_public = function(_arg, cb) { var armored, asp, err, opts, ret, warnings, ___iced_passed_deferral, __iced_deferrals, __iced_k; __iced_k = __iced_k_noop; ___iced_passed_deferral = iced.findDeferral(arguments); armored = _arg.armored, asp = _arg.asp, opts = _arg.opts; warnings = null; (function(_this) { return (function(__iced_k) { if (armored.match(/^-{5}BEGIN PGP PUBLIC KEY BLOCK-{5}/)) { (function(__iced_k) { __iced_deferrals = new iced.Deferrals(__iced_k, { parent: ___iced_passed_deferral, filename: "/Users/max/src/keybase/kbpgp/src/ukm.iced", funcname: "import_armored_public" }); pgp.KeyManager.import_from_armored_pgp({ armored: armored, asp: asp, opts: opts }, __iced_deferrals.defer({ assign_fn: (function() { return function() { err = arguments[0]; ret = arguments[1]; return warnings = arguments[2]; }; })(), lineno: 12 })); __iced_deferrals._fulfill(); })(__iced_k); } else { (function(__iced_k) { __iced_deferrals = new iced.Deferrals(__iced_k, { parent: ___iced_passed_deferral, filename: "/Users/max/src/keybase/kbpgp/src/ukm.iced", funcname: "import_armored_public" }); kb.KeyManager.import_public({ hex: armored }, __iced_deferrals.defer({ assign_fn: (function() { return function() { err = arguments[0]; return ret = arguments[1]; }; })(), lineno: 14 })); __iced_deferrals._fulfill(); })(__iced_k); } }); })(this)((function(_this) { return function() { return cb(err, ret, warnings); }; })(this)); }; is_pgp_sig = function(x) { return x.match(/^-{5}BEGIN PGP MESSAGE-{5}/); }; exports.decode_sig = function(_arg) { var armored; armored = _arg.armored; if (is_pgp_sig(armored)) { return pgp_sig.decode_sig({ armored: armored }); } else { return kb.decode_sig({ armored: armored }); } }; exports.get_sig_body = function(_arg) { var armored; armored = _arg.armored; if (is_pgp_sig(armored)) { return pgp_sig.get_sig_body({ armored: armored }); } else { return kb.get_sig_body({ armored: armored }); } }; }).call(this);