| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274 |
- // Generated by IcedCoffeeScript 1.7.1-c
- (function() {
- var ArgumentParser, Base, Command, E, PackageJson, RevokeProofSigGen, S, ST, User, add_option_dict, assert, constants, iced, log, make_esc, prompt_yn, proofs, req, session, __iced_k, __iced_k_noop,
- __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;
- __iced_k = __iced_k_noop = function() {};
- Base = require('./base').Base;
- log = require('../log');
- ArgumentParser = require('argparse').ArgumentParser;
- add_option_dict = require('./argparse').add_option_dict;
- PackageJson = require('../package').PackageJson;
- E = require('../err').E;
- make_esc = require('iced-error').make_esc;
- prompt_yn = require('../prompter').prompt_yn;
- RevokeProofSigGen = require('../sigs').RevokeProofSigGen;
- User = require('../user').User;
- req = require('../req').req;
- assert = require('assert');
- session = require('../session');
- S = require('../services');
- constants = require('../constants').constants;
- ST = constants.signature_types;
- prompt_yn = require('../prompter').prompt_yn;
- proofs = require('keybase-proofs');
- assert = require('assert');
- exports.Command = Command = (function(_super) {
- __extends(Command, _super);
- function Command() {
- return Command.__super__.constructor.apply(this, arguments);
- }
- Command.prototype.OPTS = {
- q: {
- alias: 'seqno',
- action: 'storeTrue',
- help: 'specify signature as a sequence number'
- }
- };
- Command.prototype.use_session = function() {
- return true;
- };
- Command.prototype.needs_configuration = function() {
- return true;
- };
- Command.prototype.parse_args = function(cb) {
- var err, key;
- key = this.argv.sig[0];
- err = null;
- if (this.argv.seqno) {
- if (key.match(/^\d+$/)) {
- this.seqno = parseInt(key, 10);
- } else {
- err = new E.ArgsError("bad integer: " + key);
- }
- } else if (!key.match(/^[A-Fa-f0-9]+$/)) {
- err = new E.ArgsError("bad signature ID: " + key);
- } else if (key.length < 4) {
- err = new E.ArgsError("bad signature ID " + key + "; must provide at least a 4-char prefix");
- } else {
- this.sig_id = key.toLowerCase();
- }
- return cb(err);
- };
- Command.prototype.add_subcommand_parser = function(scp) {
- var name, opts, sub;
- opts = {
- help: "revoke a proof or signature",
- aliases: ["revoke-sig"]
- };
- name = "revoke-signatures";
- sub = scp.addParser(name, opts);
- sub.addArgument(["sig"], {
- nargs: 1,
- help: "the ID or seqno of the sig the revoke"
- });
- add_option_dict(sub, this.OPTS);
- return [name].concat(opts.aliases);
- };
- Command.prototype.allocate_proof_gen = function(cb) {
- var err, klass, ___iced_passed_deferral, __iced_deferrals, __iced_k;
- __iced_k = __iced_k_noop;
- ___iced_passed_deferral = iced.findDeferral(arguments);
- klass = RevokeProofSigGen;
- (function(_this) {
- return (function(__iced_k) {
- __iced_deferrals = new iced.Deferrals(__iced_k, {
- parent: ___iced_passed_deferral,
- filename: "/Users/max/src/keybase/node-client/src/command/revoke_sig.iced",
- funcname: "Command.allocate_proof_gen"
- });
- _this.me.gen_remote_proof_gen({
- klass: klass,
- sig_id: _this.sig_id
- }, __iced_deferrals.defer({
- assign_fn: (function(__slot_1) {
- return function() {
- err = arguments[0];
- return __slot_1.gen = arguments[1];
- };
- })(_this),
- lineno: 69
- }));
- __iced_deferrals._fulfill();
- });
- })(this)((function(_this) {
- return function() {
- return cb(err);
- };
- })(this));
- };
- Command.prototype.find_sig_by_prefix = function(p) {
- var err, found, k, v, _ref;
- found = null;
- err = null;
- _ref = this.me.sig_chain.index;
- for (k in _ref) {
- v = _ref[k];
- if (k.indexOf(p) !== 0) {
- } else if (found != null) {
- err = new E.DuplicateError("Key '" + p + "' matches more than one signature");
- found = null;
- break;
- } else {
- found = v;
- }
- }
- return [err, found];
- };
- Command.prototype.find_sig = function(cb) {
- var err, key, sig, _ref;
- key = this.argv.sig[0];
- if (this.seqno) {
- sig = this.me.sig_chain.seq[this.seqno];
- } else {
- _ref = this.find_sig_by_prefix(this.sig_id), err = _ref[0], sig = _ref[1];
- }
- err = err != null ? err : sig == null ? new E.NotFoundError("Signature not found (key=" + key + ")") : sig.is_revoked() ? new E.RevokedError("Signature already revoked") : !sig.is_revocable() ? new E.RevokeError("signature is not revocable") : null;
- if (err == null) {
- this.sig_id = sig.sig_id();
- }
- return cb(err);
- };
- Command.prototype.run = function(cb) {
- var esc, ___iced_passed_deferral, __iced_deferrals, __iced_k;
- __iced_k = __iced_k_noop;
- ___iced_passed_deferral = iced.findDeferral(arguments);
- esc = make_esc(cb, "Command::run");
- (function(_this) {
- return (function(__iced_k) {
- __iced_deferrals = new iced.Deferrals(__iced_k, {
- parent: ___iced_passed_deferral,
- filename: "/Users/max/src/keybase/node-client/src/command/revoke_sig.iced",
- funcname: "Command.run"
- });
- _this.parse_args(esc(__iced_deferrals.defer({
- lineno: 105
- })));
- __iced_deferrals._fulfill();
- });
- })(this)((function(_this) {
- return function() {
- (function(__iced_k) {
- __iced_deferrals = new iced.Deferrals(__iced_k, {
- parent: ___iced_passed_deferral,
- filename: "/Users/max/src/keybase/node-client/src/command/revoke_sig.iced",
- funcname: "Command.run"
- });
- session.login(esc(__iced_deferrals.defer({
- lineno: 106
- })));
- __iced_deferrals._fulfill();
- })(function() {
- (function(__iced_k) {
- __iced_deferrals = new iced.Deferrals(__iced_k, {
- parent: ___iced_passed_deferral,
- filename: "/Users/max/src/keybase/node-client/src/command/revoke_sig.iced",
- funcname: "Command.run"
- });
- User.load_me({
- secret: true,
- verify_opts: {
- show_perm_failures: true
- }
- }, esc(__iced_deferrals.defer({
- assign_fn: (function(__slot_1) {
- return function() {
- return __slot_1.me = arguments[0];
- };
- })(_this),
- lineno: 107
- })));
- __iced_deferrals._fulfill();
- })(function() {
- (function(__iced_k) {
- __iced_deferrals = new iced.Deferrals(__iced_k, {
- parent: ___iced_passed_deferral,
- filename: "/Users/max/src/keybase/node-client/src/command/revoke_sig.iced",
- funcname: "Command.run"
- });
- _this.find_sig(esc(__iced_deferrals.defer({
- lineno: 108
- })));
- __iced_deferrals._fulfill();
- })(function() {
- (function(__iced_k) {
- __iced_deferrals = new iced.Deferrals(__iced_k, {
- parent: ___iced_passed_deferral,
- filename: "/Users/max/src/keybase/node-client/src/command/revoke_sig.iced",
- funcname: "Command.run"
- });
- _this.allocate_proof_gen(esc(__iced_deferrals.defer({
- lineno: 109
- })));
- __iced_deferrals._fulfill();
- })(function() {
- (function(__iced_k) {
- __iced_deferrals = new iced.Deferrals(__iced_k, {
- parent: ___iced_passed_deferral,
- filename: "/Users/max/src/keybase/node-client/src/command/revoke_sig.iced",
- funcname: "Command.run"
- });
- _this.gen.run(esc(__iced_deferrals.defer({
- lineno: 110
- })));
- __iced_deferrals._fulfill();
- })(function() {
- log.info("Success!");
- return cb(null);
- });
- });
- });
- });
- });
- };
- })(this));
- };
- return Command;
- })(Base);
- }).call(this);
|