keybase-proofs
Version:
Publicly-verifiable proofs of identity
130 lines (103 loc) • 4.32 kB
JavaScript
// Generated by IcedCoffeeScript 108.0.11
(function() {
var Base, Stellar, Subkey, SubkeyBase, assert, bufeq_secure, constants, iced, km_to_base, make_esc, pgp_utils, stellar, __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;
_ref = require('./subkey'), Subkey = _ref.Subkey, SubkeyBase = _ref.SubkeyBase;
stellar = require('bitcoyne').stellar;
assert = require('assert');
pgp_utils = require('pgp-utils');
bufeq_secure = pgp_utils.util.bufeq_secure;
make_esc = require('iced-error').make_esc;
km_to_base = function(k) {
return k.get_ekid().slice(2, -1);
};
exports.Stellar = Stellar = (function(_super) {
__extends(Stellar, _super);
Stellar.prototype.get_key_field = function() {
return "wallet_key";
};
Stellar.prototype.get_new_key_section = function() {
return this.wallet_key;
};
Stellar.prototype.set_new_key_section = function(m) {
return this.wallet_key = m;
};
Stellar.prototype.get_new_km = function() {
return this.wallet.km;
};
Stellar.prototype._type = function() {
return constants.sig_types.wallet.stellar;
};
Stellar.prototype._type_v2 = function() {
return constants.sig_types_v2.wallet.stellar;
};
Stellar.prototype.need_reverse_sig = function() {
return true;
};
Stellar.prototype._v_customize_json = function(ret) {
var wallet_address;
Stellar.__super__._v_customize_json.call(this, ret);
wallet_address = stellar.public_key.encode(km_to_base(this.wallet.km));
assert(stellar.public_key.is_valid(wallet_address));
return ret.body.wallet = {
network: this.wallet.network,
name: this.wallet.name,
address: wallet_address
};
};
Stellar.prototype.reverse_sig_check = function(_arg, cb) {
var a, base_kb, base_stellar, err, esc, json, new_km, subkm, ___iced_passed_deferral, __iced_deferrals, __iced_k;
__iced_k = __iced_k_noop;
___iced_passed_deferral = iced.findDeferral(arguments);
json = _arg.json, new_km = _arg.new_km, subkm = _arg.subkm;
esc = make_esc(cb, "reverse_sig_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/wallet.iced",
funcname: "Stellar.reverse_sig_check"
});
Stellar.__super__.reverse_sig_check.call(_this, {
json: json,
new_km: new_km,
subkm: subkm
}, esc(__iced_deferrals.defer({
lineno: 35
})));
__iced_deferrals._fulfill();
});
})(this)((function(_this) {
return function() {
var _ref1, _ref2;
if ((a = json != null ? (_ref1 = json.body) != null ? (_ref2 = _ref1.wallet) != null ? _ref2.address : void 0 : void 0 : void 0) == null) {
err = new Error("didn't find a needed Stellar wallet address");
} else {
base_stellar = stellar.public_key.decode(a);
base_kb = km_to_base(new_km);
if (!bufeq_secure(base_stellar, base_kb)) {
err = new Error("Stellar Account ID didn't match given KID");
}
}
return cb(err);
};
})(this));
};
Stellar.prototype._required_sections = function() {
return Stellar.__super__._required_sections.call(this).concat(["wallet", "wallet_key"]);
};
Stellar.prototype._optional_sections = function() {
return Stellar.__super__._optional_sections.call(this).concat(["revoke"]);
};
function Stellar(obj) {
this.wallet = obj.wallet;
Stellar.__super__.constructor.call(this, obj);
}
return Stellar;
})(SubkeyBase);
}).call(this);