UNPKG

keybase-proofs

Version:

Publicly-verifiable proofs of identity

154 lines (130 loc) 5.61 kB
// Generated by IcedCoffeeScript 108.0.11 (function() { var Base, EncKeyManager, KeyManager, PerUserKey, SubkeyBase, constants, iced, make_esc, __iced_k, __iced_k_noop, _ref, __hasProp = {}.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; iced = require('iced-runtime'); __iced_k = __iced_k_noop = function() {}; Base = require('./base').Base; constants = require('./constants').constants; SubkeyBase = require('./subkey').SubkeyBase; _ref = require('kbpgp').kb, EncKeyManager = _ref.EncKeyManager, KeyManager = _ref.KeyManager; make_esc = require('iced-error').make_esc; exports.PerUserKey = PerUserKey = (function(_super) { __extends(PerUserKey, _super); PerUserKey.prototype.get_key_field = function() { return "per_user_key"; }; PerUserKey.prototype.get_new_key_section = function() { return this.per_user_key; }; PerUserKey.prototype.set_new_key_section = function(m) { m.generation = this.generation; m.encryption_kid = this.kms.encryption.get_ekid().toString('hex'); return this.per_user_key = m; }; PerUserKey.prototype.get_new_km = function() { return this.kms.signing; }; PerUserKey.prototype.sibkid_slot = function() { return "signing_kid"; }; PerUserKey.prototype.need_reverse_sig = function() { return true; }; PerUserKey.prototype._type = function() { return constants.sig_types.per_user_key; }; PerUserKey.prototype._type_v2 = function() { return constants.sig_types_v2.per_user_key; }; PerUserKey.prototype._v_include_pgp_details = function() { return false; }; PerUserKey.prototype._required_sections = function() { return PerUserKey.__super__._required_sections.call(this).concat(["per_user_key"]); }; PerUserKey.prototype._find_fields = function(_arg) { var json, v, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6; json = _arg.json; if ((typeof (v = json != null ? (_ref1 = json.body) != null ? (_ref2 = _ref1.per_user_key) != null ? _ref2.generation : void 0 : void 0 : void 0) !== 'number') || (parseInt(v) <= 0)) { return new Error("Need per_user_key.generation to be an integer > 0 (got " + v + ")"); } else if ((json != null ? (_ref3 = json.body) != null ? (_ref4 = _ref3.per_user_key) != null ? _ref4.signing_kid : void 0 : void 0 : void 0) == null) { return new Error("need a signing kid"); } else if ((json != null ? (_ref5 = json.body) != null ? (_ref6 = _ref5.per_user_key) != null ? _ref6.encryption_kid : void 0 : void 0 : void 0) == null) { return new Error("need an encryption kid"); } else { return null; } }; PerUserKey.prototype._v_check = function(_arg, cb) { var err, esc, json, ___iced_passed_deferral, __iced_deferrals, __iced_k; __iced_k = __iced_k_noop; ___iced_passed_deferral = iced.findDeferral(arguments); json = _arg.json; esc = make_esc(cb, "_v_check"); err = this._find_fields({ json: json }); (function(_this) { return (function(__iced_k) { if (err == null) { (function(__iced_k) { __iced_deferrals = new iced.Deferrals(__iced_k, { parent: ___iced_passed_deferral, filename: "/Users/max/src/keybase/proofs/src/per_user_key.iced", funcname: "PerUserKey._v_check" }); KeyManager.import_public({ hex: json.body.per_user_key.signing_kid }, esc(__iced_deferrals.defer({ lineno: 39 }))); __iced_deferrals._fulfill(); })(function() { (function(__iced_k) { __iced_deferrals = new iced.Deferrals(__iced_k, { parent: ___iced_passed_deferral, filename: "/Users/max/src/keybase/proofs/src/per_user_key.iced", funcname: "PerUserKey._v_check" }); EncKeyManager.import_public({ hex: json.body.per_user_key.encryption_kid }, esc(__iced_deferrals.defer({ lineno: 40 }))); __iced_deferrals._fulfill(); })(function() { (function(__iced_k) { __iced_deferrals = new iced.Deferrals(__iced_k, { parent: ___iced_passed_deferral, filename: "/Users/max/src/keybase/proofs/src/per_user_key.iced", funcname: "PerUserKey._v_check" }); PerUserKey.__super__._v_check.call(_this, { json: json }, esc(__iced_deferrals.defer({ lineno: 41 }))); __iced_deferrals._fulfill(); })(__iced_k); }); }); } else { return __iced_k(); } }); })(this)((function(_this) { return function() { return cb(err); }; })(this)); }; function PerUserKey(obj) { this.kms = obj.kms; this.generation = obj.generation; PerUserKey.__super__.constructor.call(this, obj); } return PerUserKey; })(SubkeyBase); }).call(this);