UNPKG

keybase-proofs

Version:

Publicly-verifiable proofs of identity

533 lines (408 loc) 15.9 kB
// Generated by IcedCoffeeScript 108.0.11 (function() { var Base, BotSettingsettings, ChangeMembership, Delete, DeleteRoot, DeleteUpPointer, EncKeyManager, Index, Invite, KBFS, KeyManager, Leave, NewSubteam, RenameSubteam, RenameUpPointer, Root, RotateKey, Settings, SubkeyBase, SubteamHead, TeamBase, constants, iced, json_stringify_sorted, make_esc, pgp_utils, streq_secure, unix_time, __iced_k, __iced_k_noop, _ref, _ref1, __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; make_esc = require('iced-error').make_esc; pgp_utils = require('pgp-utils'); _ref = pgp_utils.util, json_stringify_sorted = _ref.json_stringify_sorted, unix_time = _ref.unix_time, streq_secure = _ref.streq_secure; SubkeyBase = require('./subkey').SubkeyBase; _ref1 = require('kbpgp').kb, EncKeyManager = _ref1.EncKeyManager, KeyManager = _ref1.KeyManager; exports.TeamBase = TeamBase = (function(_super) { __extends(TeamBase, _super); function TeamBase(obj) { this.team = obj.team; this.kms = obj.kms; TeamBase.__super__.constructor.call(this, obj); } TeamBase.prototype.sibkid_slot = function() { return null; }; TeamBase.prototype.get_key_field = function() { return null; }; TeamBase.prototype._required_sections = function() { return TeamBase.__super__._required_sections.call(this).concat(["team"]); }; TeamBase.prototype._v_customize_json = function(ret) { ret.body.team = this.team; if (this.per_team_key != null) { return ret.body.team.per_team_key = this.per_team_key; } }; TeamBase.prototype._v_generate = function(opts, cb) { var err, ___iced_passed_deferral, __iced_deferrals, __iced_k; __iced_k = __iced_k_noop; ___iced_passed_deferral = iced.findDeferral(arguments); err = null; (function(_this) { return (function(__iced_k) { if (_this.kms != null) { (function(__iced_k) { __iced_deferrals = new iced.Deferrals(__iced_k, { parent: ___iced_passed_deferral, filename: "/Users/max/src/keybase/proofs/src/team.iced", funcname: "TeamBase._v_generate" }); TeamBase.__super__._v_generate.call(_this, opts, __iced_deferrals.defer({ assign_fn: (function() { return function() { return err = arguments[0]; }; })(), lineno: 32 })); __iced_deferrals._fulfill(); })(__iced_k); } else { return __iced_k(); } }); })(this)((function(_this) { return function() { return cb(err); }; })(this)); }; TeamBase.prototype.get_new_key_section = function() { return this.per_team_key; }; TeamBase.prototype.set_new_key_section = function(m) { var v; m.generation = this.kms.generation; m.encryption_kid = this.kms.encryption.get_ekid().toString('hex'); m.signing_kid = this.kms.signing.get_ekid().toString('hex'); if ((v = this.kms.appkey_derivation_version) != null) { m.appkey_derivation_version = v; } return this.per_team_key = m; }; TeamBase.prototype.get_new_km = function() { var _ref2; return (_ref2 = this.kms) != null ? _ref2.signing : void 0; }; TeamBase.prototype.need_reverse_sig = function(json) { var _ref2, _ref3; return (json != null ? (_ref2 = json.body) != null ? (_ref3 = _ref2.team) != null ? _ref3.per_team_key : void 0 : void 0 : void 0) != null; }; TeamBase.prototype._get_reverse_sig = function(json) { var _ref2, _ref3, _ref4; return json != null ? (_ref2 = json.body) != null ? (_ref3 = _ref2.team) != null ? (_ref4 = _ref3.per_team_key) != null ? _ref4.reverse_sig : void 0 : void 0 : void 0 : void 0; }; TeamBase.prototype._get_new_sibkid = function(json) { var _ref2, _ref3, _ref4; return json != null ? (_ref2 = json.body) != null ? (_ref3 = _ref2.team) != null ? (_ref4 = _ref3.per_team_key) != null ? _ref4.signing_kid : void 0 : void 0 : void 0 : void 0; }; TeamBase.prototype._clear_reverse_sig = function(json) { return json.body.team.per_team_key.reverse_sig = null; }; TeamBase.prototype._v_include_pgp_details = function() { return false; }; TeamBase.prototype._find_fields = function(_arg) { var json, v; json = _arg.json; if ((typeof (v = json != null ? json.generation : void 0) !== 'number') || (parseInt(v) <= 0)) { return new Error("Need per_team_key.generation to be an integer > 0 (got " + v + ")"); } else if (((v = json.appkey_derivation_version) != null) && (typeof v !== 'number' || parseInt(v) < 1)) { return new Error("Need per_team_key.appkey_derivation_version to be an integer >= 1 (got " + v + ")"); } else if ((json != null ? json.signing_kid : void 0) == null) { return new Error("need a signing kid"); } else if ((json != null ? json.encryption_kid : void 0) == null) { return new Error("need an encryption kid"); } else { return null; } }; TeamBase.prototype._v_check = function(_arg, cb) { var err, esc, json, o, ___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 = null; (function(_this) { return (function(__iced_k) { var _ref2, _ref3; if ((o = json != null ? (_ref2 = json.body) != null ? (_ref3 = _ref2.team) != null ? _ref3.per_team_key : void 0 : void 0 : void 0) != null) { err = _this._find_fields({ json: o }); (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/team.iced", funcname: "TeamBase._v_check" }); KeyManager.import_public({ hex: o.signing_kid }, esc(__iced_deferrals.defer({ lineno: 68 }))); __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/team.iced", funcname: "TeamBase._v_check" }); EncKeyManager.import_public({ hex: o.encryption_kid }, esc(__iced_deferrals.defer({ lineno: 69 }))); __iced_deferrals._fulfill(); })(__iced_k); }); } else { return __iced_k(); } })(__iced_k); } else { return __iced_k(); } }); })(this)((function(_this) { return function() { (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/team.iced", funcname: "TeamBase._v_check" }); TeamBase.__super__._v_check.call(_this, { json: json }, esc(__iced_deferrals.defer({ lineno: 71 }))); __iced_deferrals._fulfill(); })(__iced_k); } else { return __iced_k(); } })(function() { return cb(err); }); }; })(this)); }; return TeamBase; })(SubkeyBase); exports.Index = Index = (function(_super) { __extends(Index, _super); function Index() { return Index.__super__.constructor.apply(this, arguments); } Index.prototype._type = function() { return constants.sig_types.team.index; }; Index.prototype._type_v2 = function() { return constants.sig_types_v2.team.index; }; return Index; })(TeamBase); exports.Root = Root = (function(_super) { __extends(Root, _super); function Root() { return Root.__super__.constructor.apply(this, arguments); } Root.prototype._type = function() { return constants.sig_types.team.root; }; Root.prototype._type_v2 = function() { return constants.sig_types_v2.team.root; }; return Root; })(TeamBase); exports.ChangeMembership = ChangeMembership = (function(_super) { __extends(ChangeMembership, _super); function ChangeMembership() { return ChangeMembership.__super__.constructor.apply(this, arguments); } ChangeMembership.prototype._type = function() { return constants.sig_types.team.change_membership; }; ChangeMembership.prototype._type_v2 = function() { return constants.sig_types_v2.team.change_membership; }; return ChangeMembership; })(TeamBase); exports.RotateKey = RotateKey = (function(_super) { __extends(RotateKey, _super); function RotateKey() { return RotateKey.__super__.constructor.apply(this, arguments); } RotateKey.prototype._type = function() { return constants.sig_types.team.rotate_key; }; RotateKey.prototype._type_v2 = function() { return constants.sig_types_v2.team.rotate_key; }; return RotateKey; })(TeamBase); exports.Leave = Leave = (function(_super) { __extends(Leave, _super); function Leave() { return Leave.__super__.constructor.apply(this, arguments); } Leave.prototype._type = function() { return constants.sig_types.team.leave; }; Leave.prototype._type_v2 = function() { return constants.sig_types_v2.team.leave; }; return Leave; })(TeamBase); exports.NewSubteam = NewSubteam = (function(_super) { __extends(NewSubteam, _super); function NewSubteam() { return NewSubteam.__super__.constructor.apply(this, arguments); } NewSubteam.prototype._type = function() { return constants.sig_types.team.new_subteam; }; NewSubteam.prototype._type_v2 = function() { return constants.sig_types_v2.team.new_subteam; }; return NewSubteam; })(TeamBase); exports.SubteamHead = SubteamHead = (function(_super) { __extends(SubteamHead, _super); function SubteamHead() { return SubteamHead.__super__.constructor.apply(this, arguments); } SubteamHead.prototype._type = function() { return constants.sig_types.team.subteam_head; }; SubteamHead.prototype._type_v2 = function() { return constants.sig_types_v2.team.subteam_head; }; return SubteamHead; })(TeamBase); exports.RenameSubteam = RenameSubteam = (function(_super) { __extends(RenameSubteam, _super); function RenameSubteam() { return RenameSubteam.__super__.constructor.apply(this, arguments); } RenameSubteam.prototype._type = function() { return constants.sig_types.team.rename_subteam; }; RenameSubteam.prototype._type_v2 = function() { return constants.sig_types_v2.team.rename_subteam; }; return RenameSubteam; })(TeamBase); exports.RenameUpPointer = RenameUpPointer = (function(_super) { __extends(RenameUpPointer, _super); function RenameUpPointer() { return RenameUpPointer.__super__.constructor.apply(this, arguments); } RenameUpPointer.prototype._type = function() { return constants.sig_types.team.rename_up_pointer; }; RenameUpPointer.prototype._type_v2 = function() { return constants.sig_types_v2.team.rename_up_pointer; }; return RenameUpPointer; })(TeamBase); exports.DeleteSubteam = Delete = (function(_super) { __extends(Delete, _super); function Delete() { return Delete.__super__.constructor.apply(this, arguments); } Delete.prototype._type = function() { return constants.sig_types.team.delete_subteam; }; Delete.prototype._type_v2 = function() { return constants.sig_types_v2.team.delete_subteam; }; return Delete; })(TeamBase); exports.DeleteRoot = DeleteRoot = (function(_super) { __extends(DeleteRoot, _super); function DeleteRoot() { return DeleteRoot.__super__.constructor.apply(this, arguments); } DeleteRoot.prototype._type = function() { return constants.sig_types.team.delete_root; }; DeleteRoot.prototype._type_v2 = function() { return constants.sig_types_v2.team.delete_root; }; return DeleteRoot; })(TeamBase); exports.DeleteUpPointer = DeleteUpPointer = (function(_super) { __extends(DeleteUpPointer, _super); function DeleteUpPointer() { return DeleteUpPointer.__super__.constructor.apply(this, arguments); } DeleteUpPointer.prototype._type = function() { return constants.sig_types.team.delete_up_pointer; }; DeleteUpPointer.prototype._type_v2 = function() { return constants.sig_types_v2.team.delete_up_pointer; }; return DeleteUpPointer; })(TeamBase); exports.Invite = Invite = (function(_super) { __extends(Invite, _super); function Invite() { return Invite.__super__.constructor.apply(this, arguments); } Invite.prototype._type = function() { return constants.sig_types.team.invite; }; Invite.prototype._type_v2 = function() { return constants.sig_types_v2.team.invite; }; return Invite; })(TeamBase); exports.KBFS = KBFS = (function(_super) { __extends(KBFS, _super); function KBFS() { return KBFS.__super__.constructor.apply(this, arguments); } KBFS.prototype._type = function() { return constants.sig_types.team.kbfs; }; KBFS.prototype._type_v2 = function() { return constants.sig_types_v2.team.kbfs; }; return KBFS; })(TeamBase); exports.Settings = Settings = (function(_super) { __extends(Settings, _super); function Settings() { return Settings.__super__.constructor.apply(this, arguments); } Settings.prototype._type = function() { return constants.sig_types.team.settings; }; Settings.prototype._type_v2 = function() { return constants.sig_types_v2.team.settings; }; return Settings; })(TeamBase); exports.BotSettings = BotSettingsettings = (function(_super) { __extends(BotSettingsettings, _super); function BotSettingsettings() { return BotSettingsettings.__super__.constructor.apply(this, arguments); } BotSettingsettings.prototype._type = function() { return constants.sig_types.team.bot_settings; }; BotSettingsettings.prototype._type_v2 = function() { return constants.sig_types_v2.team.bot_settings; }; return BotSettingsettings; })(TeamBase); }).call(this);