UNPKG

keybase-proofs

Version:

Publicly-verifiable proofs of identity

148 lines (122 loc) 4.28 kB
// Generated by IcedCoffeeScript 108.0.11 (function() { var Base, React, Vouch, constants, json_stringify_sorted, make_esc, pgp_utils, schema, streq_secure, unix_time, _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; }; 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; schema = require('./schema3'); exports.Vouch = Vouch = (function(_super) { __extends(Vouch, _super); function Vouch(obj) { this.wot = obj.wot; Vouch.__super__.constructor.call(this, obj); } Vouch.prototype._v_stub_paths = function() { return ["body.wot_vouch"]; }; Vouch.prototype._type = function() { return constants.sig_types.wot.vouch; }; Vouch.prototype._type_v2 = function(revoke_flag) { if ((this.revoke != null) || revoke_flag) { return constants.sig_types_v2.wot.vouch_with_revoke; } else { return constants.sig_types_v2.wot.vouch; } }; Vouch.prototype._v_check = function(_arg, cb) { var err, json, obj, proof_schema, schm; json = _arg.json; obj = json.body.wot_vouch; if (obj == null) { return cb(null); } proof_schema = schema.or([ schema.dict({ proof_type: schema.int(), name: schema.string(), username: schema.string() }), schema.dict({ proof_type: schema.int(), protocol: schema.string(), hostname: schema.string() }), schema.dict({ proof_type: schema.int(), protocol: schema.string(), domain: schema.string() }) ]); schm = schema.dict({ user: schema.dict({ username: schema.string(), uid: schema.uid().convert(), eldest: schema.dict({ seqno: schema.int(), kid: schema.kid().convert() }), seq_tail: schema.dict({ seqno: schema.int(), sig_id: schema.sig_id().convert(), payload_hash: schema.hash().convert() }) }), confidence: schema.dict({ username_verified_via: schema.string_enum(["in_person", "proofs", "video", "audio", "other_chat", "familiar", "other"]).optional(), proofs: schema.array(proof_schema).optional(), other: schema.string({ max_length: 90 }).optional() }), vouch_text: schema.string({ max_length: 700 }) }); err = schm.check(obj); return cb(err); }; Vouch.prototype._v_customize_json = function(ret) { var t, _ref1; if ((t = (_ref1 = this.wot) != null ? _ref1.vouch : void 0) != null) { return ret.body.wot_vouch = t; } }; return Vouch; })(Base); exports.React = React = (function(_super) { __extends(React, _super); function React(obj) { this.wot = obj.wot; React.__super__.constructor.call(this, obj); } React.prototype._v_stub_paths = function() { return ["body.wot_react"]; }; React.prototype._type = function() { return constants.sig_types.wot.react; }; React.prototype._type_v2 = function(revoke_flag) { return constants.sig_types_v2.wot.react; }; React.prototype._v_check = function(_arg, cb) { var json, obj, schm; json = _arg.json; obj = json.body.wot_react; schm = schema.dict({ sig_id: schema.sig_id().convert(), reaction: schema.string_enum(["accept", "reject"]) }); return cb(schm.check(obj)); }; React.prototype._v_customize_json = function(ret) { var t; if ((t = this.wot.react) != null) { return ret.body.wot_react = t; } }; return React; })(Base); }).call(this);