diff --git a/lib/parse3.js b/lib/parse3.js index e388ef9..b58fe9f 100644 --- a/lib/parse3.js +++ b/lib/parse3.js @@ -1,4 +1,4 @@ -// Generated by IcedCoffeeScript 108.0.11 +// Generated by IcedCoffeeScript 108.0.12 (function() { var bufeq_fast, constants, is_dict, is_hex, is_int, pack, unpack, unpack_strict, __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; diff --git a/lib/wot.js b/lib/wot.js index e052044..7ad44de 100644 --- a/lib/wot.js +++ b/lib/wot.js @@ -47,19 +47,21 @@ if (obj == null) { return cb(null); } - proof_schema = schema.dict({ - check_data_json: schema.or([ - schema.dict({ - name: schema.string(), - username: schema.string() - }), schema.dict({ - domain: schema.string(), - protocol: schema.string() - }) - ]), - state: schema.int(), - proof_type: schema.int() - }); + 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(), @@ -76,10 +78,10 @@ }), confidence: schema.dict({ username_verified_via: schema.string_enum(["in_person", "proofs", "video", "audio", "other_chat", "familiar", "other"]).optional(), - proofs: schema.array(schema.string()).optional(), + proofs: schema.array(proof_schema).optional(), other: schema.string().optional() }), - failing_proofs: schema.array(schema.string()).optional(), + failing_proofs: schema.array(proof_schema).optional(), vouch_text: schema.array(schema.string()) }); err = schm.check(obj); diff --git a/src/wot.iced b/src/wot.iced index 4bfa86d..c30118c 100644 --- a/src/wot.iced +++ b/src/wot.iced @@ -24,14 +24,23 @@ exports.Vouch = class Vouch extends Base obj = json.body.wot_vouch if not obj? then return cb null - proof_schema = schema.dict({ - check_data_json : schema.or([ - schema.dict({name : schema.string(), username : schema.string() }), - schema.dict({domain : schema.string(), protocol : schema.string() }) - ]) - state : schema.int() - proof_type : schema.int() - }) + 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({ @@ -49,10 +58,10 @@ exports.Vouch = class Vouch extends Base }) confidence : schema.dict({ username_verified_via : schema.string_enum(["in_person", "proofs", "video", "audio", "other_chat", "familiar", "other"]).optional() - proofs : schema.array(schema.string()).optional() + proofs: schema.array(proof_schema).optional() other : schema.string().optional() }) - failing_proofs : schema.array(schema.string()).optional() + failing_proofs : schema.array(proof_schema).optional() vouch_text : schema.array(schema.string()) }) err = schm.check(obj) diff --git a/test/files/wot.iced b/test/files/wot.iced index 7209e67..4752e03 100644 --- a/test/files/wot.iced +++ b/test/files/wot.iced @@ -10,7 +10,10 @@ 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 - sig_id = "24786764ee0861eb134925fe967c03975fba5df02edfabcf4048c71d8cb8623c0f" + 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 : @@ -26,8 +29,8 @@ exports.wot_vouch_happy = (T,cb) -> confidence : username_verified_via : "audio" other : "lorem ipsum" - proofs : [ sig_id, sig_id] - failing_proofs : [ sig_id, sig_id ] + proofs : [ proof1, proof2] + failing_proofs : [ proof3, proof4 ] vouch_text : [ "darn rootin tootin" ]