From 080e39a5776ce6623341fa9280a07b4303479cd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Zochniak?= Date: Tue, 22 Sep 2026 11:13:17 +0200 Subject: [PATCH] Remove wot library code --- Makefile | 1 - lib/alloc.js | 8 +-- lib/main.js | 4 +- lib/wot.js | 147 -------------------------------------------- src/alloc.iced | 3 - src/constants.iced | 4 ++ src/main.iced | 2 - src/wot.iced | 96 ----------------------------- test/files/wot.iced | 134 ---------------------------------------- 9 files changed, 7 insertions(+), 392 deletions(-) delete mode 100644 lib/wot.js delete mode 100644 src/wot.iced delete mode 100644 test/files/wot.iced diff --git a/Makefile b/Makefile index 0dc5a43c..a03089e0 100644 --- a/Makefile +++ b/Makefile @@ -48,7 +48,6 @@ $(BUILD_STAMP): \ lib/track.js \ lib/wallet.js \ lib/web_service.js \ - lib/wot.js \ lib/update_passphrase_hash.js \ lib/update_settings.js \ lib/util.js diff --git a/lib/alloc.js b/lib/alloc.js index 4b68836d..a729367b 100644 --- a/lib/alloc.js +++ b/lib/alloc.js @@ -1,6 +1,6 @@ // Generated by IcedCoffeeScript 108.0.11 (function() { - var Announcement, Auth, Cryptocurrency, Device, Eldest, PGPUpdate, PerUserKey, Revoke, Sibkey, Stellar, Subkey, Track, Untrack, UpdatePassphraseHash, UpdateSettings, alloc, base, get_klass, get_own, lookup_tab, team, team_hidden, web_service, wot, _ref; + var Announcement, Auth, Cryptocurrency, Device, Eldest, PGPUpdate, PerUserKey, Revoke, Sibkey, Stellar, Subkey, Track, Untrack, UpdatePassphraseHash, UpdateSettings, alloc, base, get_klass, get_own, lookup_tab, team, team_hidden, web_service, _ref; web_service = require('./web_service'); @@ -40,8 +40,6 @@ team_hidden = require('./team_hidden'); - wot = require('./wot'); - lookup_tab = { "web_service_binding.twitter": web_service.TwitterBinding, "web_service_binding.facebook": web_service.FacebookBinding, @@ -84,9 +82,7 @@ "team.delete_up_pointer": team.DeleteUpPointer, "team.kbfs": team.KBFS, "team.settings": team.Settings, - "team.bot_settings": team.BotSettings, - "wot.vouch": wot.Vouch, - "wot.react": wot.React + "team.bot_settings": team.BotSettings }; get_klass = function(type, extra_lookup_tab) { diff --git a/lib/main.js b/lib/main.js index c735a2a6..95d3998d 100644 --- a/lib/main.js +++ b/lib/main.js @@ -2,7 +2,7 @@ (function() { var k, m, mods, v, _i, _len; - mods = [require('./web_service'), require('./b64extract'), require('./util'), require('./alloc'), require('./alloc3'), require('./constants'), require('./base'), require('./track'), require('./auth'), require('./update_passphrase_hash'), require('./update_settings'), require('./device'), require('./revoke'), require('./cryptocurrency'), require('./per_user_key'), require('./wallet'), require('./subkey'), require('./sibkey'), require('./eldest'), require('./pgp_update'), require('./announcement'), require('./scrapers/twitter'), require('./scrapers/facebook'), require('./scrapers/base'), require('./scrapers/github'), require('./scrapers/reddit'), require('./scrapers/generic_web_site'), require('./scrapers/dns'), require('./scrapers/coinbase'), require('./scrapers/hackernews'), require('./scrapers/generic_social'), require('./errors'), require('./wot')]; + mods = [require('./web_service'), require('./b64extract'), require('./util'), require('./alloc'), require('./alloc3'), require('./constants'), require('./base'), require('./track'), require('./auth'), require('./update_passphrase_hash'), require('./update_settings'), require('./device'), require('./revoke'), require('./cryptocurrency'), require('./per_user_key'), require('./wallet'), require('./subkey'), require('./sibkey'), require('./eldest'), require('./pgp_update'), require('./announcement'), require('./scrapers/twitter'), require('./scrapers/facebook'), require('./scrapers/base'), require('./scrapers/github'), require('./scrapers/reddit'), require('./scrapers/generic_web_site'), require('./scrapers/dns'), require('./scrapers/coinbase'), require('./scrapers/hackernews'), require('./scrapers/generic_social'), require('./errors')]; for (_i = 0, _len = mods.length; _i < _len; _i++) { m = mods[_i]; @@ -20,6 +20,4 @@ exports.schema = require('./schema3'); - exports.wot = require('./wot'); - }).call(this); diff --git a/lib/wot.js b/lib/wot.js deleted file mode 100644 index 958399f2..00000000 --- a/lib/wot.js +++ /dev/null @@ -1,147 +0,0 @@ -// 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); diff --git a/src/alloc.iced b/src/alloc.iced index bee51fba..ffcec90a 100644 --- a/src/alloc.iced +++ b/src/alloc.iced @@ -18,7 +18,6 @@ base = require './base' {get_own} = require './util' team = require './team' team_hidden = require './team_hidden' -wot = require './wot' #======================================================= @@ -66,8 +65,6 @@ lookup_tab = { "team.kbfs" : team.KBFS "team.settings" : team.Settings "team.bot_settings" : team.BotSettings - "wot.vouch" : wot.Vouch - "wot.react" : wot.React } #-------------------------------------------- diff --git a/src/constants.iced b/src/constants.iced index 9549bb24..7ad75eac 100644 --- a/src/constants.iced +++ b/src/constants.iced @@ -44,6 +44,8 @@ exports.constants = constants = kbfs : "team.kbfs" settings : "team.settings" bot_settings : "team.bot_settings" + # wot proofs are deprecated, but constants must remain available to kbweb + # because of existing signatures. wot : vouch : "wot.vouch" react : "wot.react" @@ -83,6 +85,8 @@ exports.constants = constants = bot_settings: 48 wallet : stellar : 15 + # wot proofs are deprecated, but constants must remain available to kbweb + # because of existing signatures. wot : vouch : 16 vouch_with_revoke : 17 diff --git a/src/main.iced b/src/main.iced index 35d2eff5..b6856a92 100644 --- a/src/main.iced +++ b/src/main.iced @@ -32,7 +32,6 @@ mods = [ require('./scrapers/hackernews') require('./scrapers/generic_social') require('./errors') - require('./wot') ] for m in mods @@ -44,4 +43,3 @@ exports.team = require('./team') exports.team_hidden = require('./team_hidden') exports.sig3 = require('./sig3') exports.schema = require('./schema3') -exports.wot = require('./wot') diff --git a/src/wot.iced b/src/wot.iced deleted file mode 100644 index 80ebe990..00000000 --- a/src/wot.iced +++ /dev/null @@ -1,96 +0,0 @@ -{Base} = require './base' -{constants} = require './constants' -{make_esc} = require 'iced-error' -pgp_utils = require('pgp-utils') -{json_stringify_sorted,unix_time,streq_secure} = pgp_utils.util -schema = require './schema3' - -#========================================================================== - -exports.Vouch = class Vouch extends Base - - constructor : (obj) -> - @wot = obj.wot - super obj - - _v_stub_paths : () -> [ "body.wot_vouch" ] - _type : () -> constants.sig_types.wot.vouch - - _type_v2 : (revoke_flag) -> - if @revoke? or revoke_flag then constants.sig_types_v2.wot.vouch_with_revoke - else constants.sig_types_v2.wot.vouch - - _v_check : ({json}, cb) -> - obj = json.body.wot_vouch - if not obj? then return cb null - - proof_schema = schema.or([ - schema.dict({ - proof_type : schema.int(), # keybase1.ProofType - 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) - cb err - - _v_customize_json : (ret) -> - ret.body.wot_vouch = t if (t = @wot?.vouch)? - -#========================================================================== - -exports.React = class React extends Base - - constructor : (obj) -> - @wot = obj.wot - super obj - - _v_stub_paths : () -> [ "body.wot_react" ] - _type : () -> constants.sig_types.wot.react - - _type_v2 : (revoke_flag) -> constants.sig_types_v2.wot.react - - _v_check : ({json}, cb) -> - obj = json.body.wot_react - schm = schema.dict({ - sig_id : schema.sig_id().convert() - reaction : schema.string_enum(["accept", "reject"]) - }) - cb schm.check(obj) - - _v_customize_json : (ret) -> - ret.body.wot_react = t if (t = @wot.react)? - -#========================================================================== diff --git a/test/files/wot.iced b/test/files/wot.iced deleted file mode 100644 index 458fda3a..00000000 --- a/test/files/wot.iced +++ /dev/null @@ -1,134 +0,0 @@ -{alloc,wot,constants} = require '../../' -{EncKeyManager,KeyManager} = require('kbpgp').kb -{make_esc} = require 'iced-error' -{new_uid,new_km_and_sig_arg,new_sig_id,new_payload_hash} = require './util' -pgp_utils = require('pgp-utils') -{json_stringify_sorted} = pgp_utils.util -{unpack} = require 'purepack' - -exports.wot_vouch_happy = (T,cb) -> - esc = make_esc cb - await new_km_and_sig_arg {}, esc defer me - await new_km_and_sig_arg {}, esc defer them - proof1 = { proof_type : 4, name : "reddit", username : "betaveros" } - proof2 = { proof_type : 9, name : "mastodon.social", username : "gammaveros" } - proof3 = { proof_type : 1000, protocol : "https:", hostname : "beta.veros" } - proof4 = { proof_type : 1001, protocol : "dns", hostname : "beta.veros" } - me.wot = - vouch : - user : - username : them.user.local.username - uid : them.user.local.uid - eldest: - kid : them.sig_eng.km.key.ekid().toString('hex') - seqno : 1 - seq_tail : - seqno : 20 - sig_id : new_sig_id() - payload_hash : new_payload_hash() - confidence : - username_verified_via : "audio" - other : "lorem ipsum" - proofs : [ proof1, proof2] - vouch_text : "darn rootin tootin" - obj = new wot.Vouch me - await obj.generate_v2 esc(defer(out)), {dohash:true} - hsh = out.inner.obj.body.wot_vouch - T.assert hsh?, "hash was there" - T.equal hsh.length, 64, "64-byte hex string" - T.assert out.expansions[hsh]?.obj?, "expansion was there" - - verifier = alloc out.inner.obj.body.type, me - varg = { armored : out.armored, skip_ids : true, make_ids : true, inner : out.inner.str, expansions : out.expansions, require_packet_hash :true} - await verifier.verify_v2 varg, esc defer() - - me.wot = - react : - sig_id : new_sig_id() - reaction : "accept" - obj = new wot.React me - await obj.generate_v2 esc(defer(out)), {dohash:true} - verifier = alloc out.inner.obj.body.type, me - varg = { armored : out.armored, skip_ids : true, make_ids : true, inner : out.inner.str, expansions : out.expansions, require_packet_hash :true} - await verifier.verify_v2 varg, esc defer() - - # try to revoke both with and without a replacement... - me.revoke = { sig_ids : [ new_sig_id() ]} - obj = new wot.Vouch me - await obj.generate_v2 esc(defer(out)), {dohash:true} - outer = unpack out.outer - T.equal outer[4], constants.sig_types_v2.wot.vouch_with_revoke, "revoke picked up" - - me.wot = null - obj = new wot.Vouch me - await obj.generate_v2 esc(defer(out)), {dohash:true} - outer = unpack out.outer - T.equal outer[4], constants.sig_types_v2.wot.vouch_with_revoke, "revoke picked up" - - cb null - -exports.wot_vouch_bad = (T,cb) -> - esc = make_esc cb - await new_km_and_sig_arg {}, esc defer me - await new_km_and_sig_arg {}, esc defer them - me.wot = - vouch : - user : - username : them.user.local.username - uid : them.user.local.uid - eldest: - kid : them.sig_eng.km.key.ekid().toString('hex') - seqno : 1 - seq_tail : - seqno : 20 - sig_id : new_sig_id() - payload_hash : new_payload_hash() - confidence : - username_verified_via : "audio" - other : "this string is longer than 90 char this string is longer than 90 char this string is longer than 90 char this string is longer than 90 char" - vouch_text : "darn rootin tootin" - obj = new wot.Vouch me - await obj.generate_v2 esc(defer(out)), {dohash:true} - - verifier = alloc out.inner.obj.body.type, me - varg = { armored : out.armored, skip_ids : true, make_ids : true, inner : out.inner.str, expansions : out.expansions, require_packet_hash :true} - await verifier.verify_v2 varg, defer err - T.assert err?, "got an error back" - T.assert (err.message.indexOf(".confidence.other") >= 0), "found right error message" - - cb null - -exports.wot_vouch_bad_proof = (T,cb) -> - esc = make_esc cb - await new_km_and_sig_arg {}, esc defer me - await new_km_and_sig_arg {}, esc defer them - proof1 = { proof_type : 4, name : "reddit", username : "betaveros" } - bad_proof = { invalid : 1, obj : 2 } - me.wot = - vouch : - user : - username : them.user.local.username - uid : them.user.local.uid - eldest: - kid : them.sig_eng.km.key.ekid().toString('hex') - seqno : 1 - seq_tail : - seqno : 20 - sig_id : new_sig_id() - payload_hash : new_payload_hash() - confidence : - username_verified_via : "audio" - other : "lorem ipsum" - proofs : [ proof1, bad_proof ] - vouch_text : "darn rootin tootin" - - obj = new wot.Vouch me - await obj.generate_v2 esc(defer(out)), {dohash:true} - - verifier = alloc out.inner.obj.body.type, me - varg = { armored : out.armored, skip_ids : true, make_ids : true, inner : out.inner.str, expansions : out.expansions, require_packet_hash :true} - await verifier.verify_v2 varg, defer err - T.assert err?, "got an error back" - T.equal err?.message, "At .confidence.proofs.1: no structure worked" - - cb null \ No newline at end of file