keygen.js 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. // Generated by IcedCoffeeScript 1.7.1-c
  2. (function() {
  3. var Command, E, add_option_dict, iced, make_esc, pg, prompt_yn, __iced_k, __iced_k_noop,
  4. __hasProp = {}.hasOwnProperty,
  5. __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; };
  6. iced = require('iced-runtime').iced;
  7. __iced_k = __iced_k_noop = function() {};
  8. pg = require('./push_and_keygen');
  9. E = require('../err').E;
  10. make_esc = require('iced-error').make_esc;
  11. add_option_dict = require('./argparse').add_option_dict;
  12. prompt_yn = require('../prompter').prompt_yn;
  13. exports.Command = Command = (function(_super) {
  14. __extends(Command, _super);
  15. function Command() {
  16. return Command.__super__.constructor.apply(this, arguments);
  17. }
  18. Command.prototype.OPTS = {
  19. p: {
  20. alias: "push",
  21. action: "storeTrue",
  22. help: "true if we should push"
  23. }
  24. };
  25. Command.prototype.add_subcommand_parser = function(scp) {
  26. var name, opts, sub;
  27. opts = {
  28. aliases: ['gen', 'generate'],
  29. help: "generate a new PGP public key and optionally push it to the server"
  30. };
  31. name = "keygen";
  32. sub = scp.addParser(name, opts);
  33. add_option_dict(sub, this.OPTS);
  34. add_option_dict(sub, pg.Command.OPTS);
  35. return opts.aliases.concat([name]);
  36. };
  37. Command.prototype.check_args = function(cb) {
  38. var err;
  39. err = null;
  40. if (this.argv.search && this.argv.gen) {
  41. err = new E.ArgsError("Can't both search and generate; pick one or the other!");
  42. }
  43. return cb(err);
  44. };
  45. Command.prototype.should_push = function(cb) {
  46. var err, ret, ___iced_passed_deferral, __iced_deferrals, __iced_k;
  47. __iced_k = __iced_k_noop;
  48. ___iced_passed_deferral = iced.findDeferral(arguments);
  49. err = ret = null;
  50. (function(_this) {
  51. return (function(__iced_k) {
  52. if (_this.argv.push) {
  53. return __iced_k(ret = true);
  54. } else {
  55. (function(__iced_k) {
  56. __iced_deferrals = new iced.Deferrals(__iced_k, {
  57. parent: ___iced_passed_deferral,
  58. filename: "/Users/max/src/keybase/node-client/src/command/keygen.iced",
  59. funcname: "Command.should_push"
  60. });
  61. prompt_yn({
  62. prompt: "Push your public key to the server?",
  63. defval: true
  64. }, __iced_deferrals.defer({
  65. assign_fn: (function() {
  66. return function() {
  67. err = arguments[0];
  68. return ret = arguments[1];
  69. };
  70. })(),
  71. lineno: 42
  72. }));
  73. __iced_deferrals._fulfill();
  74. })(__iced_k);
  75. }
  76. });
  77. })(this)((function(_this) {
  78. return function() {
  79. return cb(err, ret);
  80. };
  81. })(this));
  82. };
  83. Command.prototype.should_push_secret = function(cb) {
  84. var err, ret, ___iced_passed_deferral, __iced_deferrals, __iced_k;
  85. __iced_k = __iced_k_noop;
  86. ___iced_passed_deferral = iced.findDeferral(arguments);
  87. err = ret = null;
  88. (function(_this) {
  89. return (function(__iced_k) {
  90. if (_this.argv.secret) {
  91. return __iced_k(ret = true);
  92. } else {
  93. (function(__iced_k) {
  94. __iced_deferrals = new iced.Deferrals(__iced_k, {
  95. parent: ___iced_passed_deferral,
  96. filename: "/Users/max/src/keybase/node-client/src/command/keygen.iced",
  97. funcname: "Command.should_push_secret"
  98. });
  99. prompt_yn({
  100. prompt: "Push your encrypted private key to the server?",
  101. defval: true
  102. }, __iced_deferrals.defer({
  103. assign_fn: (function() {
  104. return function() {
  105. err = arguments[0];
  106. return ret = arguments[1];
  107. };
  108. })(),
  109. lineno: 51
  110. }));
  111. __iced_deferrals._fulfill();
  112. })(__iced_k);
  113. }
  114. });
  115. })(this)((function(_this) {
  116. return function() {
  117. return cb(err, ret);
  118. };
  119. })(this));
  120. };
  121. Command.prototype.prepare_key = function(cb) {
  122. var err, ___iced_passed_deferral, __iced_deferrals, __iced_k;
  123. __iced_k = __iced_k_noop;
  124. ___iced_passed_deferral = iced.findDeferral(arguments);
  125. (function(_this) {
  126. return (function(__iced_k) {
  127. __iced_deferrals = new iced.Deferrals(__iced_k, {
  128. parent: ___iced_passed_deferral,
  129. filename: "/Users/max/src/keybase/node-client/src/command/keygen.iced",
  130. funcname: "Command.prepare_key"
  131. });
  132. _this.do_key_gen(__iced_deferrals.defer({
  133. assign_fn: (function() {
  134. return function() {
  135. return err = arguments[0];
  136. };
  137. })(),
  138. lineno: 57
  139. }));
  140. __iced_deferrals._fulfill();
  141. });
  142. })(this)((function(_this) {
  143. return function() {
  144. return cb(err);
  145. };
  146. })(this));
  147. };
  148. return Command;
  149. })(pg.Command);
  150. }).call(this);