diff --git a/dist/query/simple.d.ts.map b/dist/query/simple.d.ts.map index 13845d3..9a78f04 100644 --- a/dist/query/simple.d.ts.map +++ b/dist/query/simple.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"simple.d.ts","sourceRoot":"","sources":["../../src/query/simple.ts"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAe,MAAM,0BAA0B,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAU9C,OAAO,YAAY,MAAM,WAAW,CAAC;AAErC,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,YAAY;IACtD,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;IAChC,UAAkB,MAAM,EAAE,gBAAgB,CAAC;gBAE/B,EACV,OAAO,EACP,KAAK,EACL,KAAK,EACL,OAAO,GACR,EAAE;QACD,OAAO,EAAE,UAAU,CAAC;QACpB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC;QAC9B,KAAK,EAAE,gBAAgB,CAAC;QACxB,OAAO,EAAE,eAAe,CAAC;KAC1B;cASe,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;cAKrB,UAAU,IAAI,OAAO,CAAC,GAAG,CAAC;cAwD1B,cAAc;CAmB/B"} \ No newline at end of file +{"version":3,"file":"simple.d.ts","sourceRoot":"","sources":["../../src/query/simple.ts"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAe,MAAM,0BAA0B,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAW9C,OAAO,YAAY,MAAM,WAAW,CAAC;AAErC,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,YAAY;IACtD,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;IAChC,UAAkB,MAAM,EAAE,gBAAgB,CAAC;gBAE/B,EACV,OAAO,EACP,KAAK,EACL,KAAK,EACL,OAAO,GACR,EAAE;QACD,OAAO,EAAE,UAAU,CAAC;QACpB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC;QAC9B,KAAK,EAAE,gBAAgB,CAAC;QACxB,OAAO,EAAE,eAAe,CAAC;KAC1B;cASe,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;cAKrB,UAAU,IAAI,OAAO,CAAC,GAAG,CAAC;cAwD1B,cAAc;CAsB/B"} \ No newline at end of file diff --git a/dist/query/simple.js b/dist/query/simple.js index 78f95c6..51c67a0 100644 --- a/dist/query/simple.js +++ b/dist/query/simple.js @@ -1,5 +1,5 @@ import b4a from "b4a"; -import { hashQuery, isPromise, setupStream, validateTimestampedResponse, } from "../util.js"; +import { hashQuery, isPromise, maybeGetAsyncProperty, setupStream, validateTimestampedResponse, } from "../util.js"; import { ERR_INVALID_SIGNATURE } from "../error.js"; import RpcQueryBase from "./base.js"; export default class SimpleRpcQuery extends RpcQueryBase { @@ -18,7 +18,7 @@ export default class SimpleRpcQuery extends RpcQueryBase { async queryRelay() { let socket = this._relay; if (socket) { - if (socket === "string") { + if (typeof socket === "string") { try { const relay = this._network.getRelay(socket); if (this._network.getRelay(socket)) { @@ -27,7 +27,7 @@ export default class SimpleRpcQuery extends RpcQueryBase { } catch { } } - if (socket === "string") { + if (typeof socket === "string") { try { socket = this._network.swarm.connect(b4a.from(this._relay, "hex")); if (isPromise(socket)) { @@ -67,7 +67,7 @@ export default class SimpleRpcQuery extends RpcQueryBase { response = { error: this._error }; } if (!response.error && - !validateTimestampedResponse(b4a.from(this._relay.remotePublicKey, "hex"), response)) { + !validateTimestampedResponse(b4a.from(await maybeGetAsyncProperty(this._relay.remotePublicKey), "hex"), response)) { response = { error: ERR_INVALID_SIGNATURE }; } this.resolve(response);