UNPKG

keybase-proofs

Version:

Publicly-verifiable proofs of identity

89 lines (72 loc) 3.26 kB
// Generated by IcedCoffeeScript 108.0.11 (function() { var Base, Cryptocurrency, address, constants, iced, make_esc, __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_k = __iced_k_noop = function() {}; Base = require('./base').Base; constants = require('./constants').constants; address = require('bitcoyne').address; make_esc = require('iced-error').make_esc; exports.Cryptocurrency = Cryptocurrency = (function(_super) { __extends(Cryptocurrency, _super); function Cryptocurrency(obj) { this.cryptocurrency = obj.cryptocurrency; Cryptocurrency.__super__.constructor.call(this, obj); } Cryptocurrency.prototype._type = function() { return constants.sig_types.cryptocurrency; }; Cryptocurrency.prototype._type_v2 = function(revoke_flag) { if ((this.revoke != null) || revoke_flag) { return constants.sig_types_v2.cryptocurrency_with_revoke; } else { return constants.sig_types_v2.cryptocurrency; } }; Cryptocurrency.prototype._required_sections = function() { return Cryptocurrency.__super__._required_sections.call(this).concat(["cryptocurrency"]); }; Cryptocurrency.prototype._optional_sections = function() { return Cryptocurrency.__super__._optional_sections.call(this).concat(["revoke"]); }; Cryptocurrency.prototype._v_customize_json = function(ret) { return ret.body.cryptocurrency = this.cryptocurrency; }; Cryptocurrency.prototype._v_check = function(args, cb) { var err, esc, json, ret, section, ___iced_passed_deferral, __iced_deferrals, __iced_k; __iced_k = __iced_k_noop; ___iced_passed_deferral = iced.findDeferral(arguments); json = args.json; esc = make_esc(cb, "Cryptocurrency::_v_check"); (function(_this) { return (function(__iced_k) { __iced_deferrals = new iced.Deferrals(__iced_k, { parent: ___iced_passed_deferral, filename: "/Users/max/src/keybase/proofs/src/cryptocurrency.iced", funcname: "Cryptocurrency._v_check" }); Cryptocurrency.__super__._v_check.call(_this, args, esc(__iced_deferrals.defer({ lineno: 29 }))); __iced_deferrals._fulfill(); }); })(this)((function(_this) { return function() { var _ref; if ((section = json.body.cryptocurrency) == null) { err = new Error("needed a cryptocurrency section"); } else { _ref = address.check_btc_or_zcash(section.address), err = _ref[0], ret = _ref[1]; if ((err == null) && (ret.type !== section.type)) { err = new Error("wrong cryptocurrency type: wanted " + ret.type + " to match given address"); } } return cb(err); }; })(this)); }; return Cryptocurrency; })(Base); }).call(this);