*Update dist
This commit is contained in:
parent
f9bf14d697
commit
63ce23fa26
|
@ -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"}
|
{"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"}
|
|
@ -1,5 +1,5 @@
|
||||||
import b4a from "b4a";
|
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 { ERR_INVALID_SIGNATURE } from "../error.js";
|
||||||
import RpcQueryBase from "./base.js";
|
import RpcQueryBase from "./base.js";
|
||||||
export default class SimpleRpcQuery extends RpcQueryBase {
|
export default class SimpleRpcQuery extends RpcQueryBase {
|
||||||
|
@ -18,7 +18,7 @@ export default class SimpleRpcQuery extends RpcQueryBase {
|
||||||
async queryRelay() {
|
async queryRelay() {
|
||||||
let socket = this._relay;
|
let socket = this._relay;
|
||||||
if (socket) {
|
if (socket) {
|
||||||
if (socket === "string") {
|
if (typeof socket === "string") {
|
||||||
try {
|
try {
|
||||||
const relay = this._network.getRelay(socket);
|
const relay = this._network.getRelay(socket);
|
||||||
if (this._network.getRelay(socket)) {
|
if (this._network.getRelay(socket)) {
|
||||||
|
@ -27,7 +27,7 @@ export default class SimpleRpcQuery extends RpcQueryBase {
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
}
|
}
|
||||||
if (socket === "string") {
|
if (typeof socket === "string") {
|
||||||
try {
|
try {
|
||||||
socket = this._network.swarm.connect(b4a.from(this._relay, "hex"));
|
socket = this._network.swarm.connect(b4a.from(this._relay, "hex"));
|
||||||
if (isPromise(socket)) {
|
if (isPromise(socket)) {
|
||||||
|
@ -67,7 +67,7 @@ export default class SimpleRpcQuery extends RpcQueryBase {
|
||||||
response = { error: this._error };
|
response = { error: this._error };
|
||||||
}
|
}
|
||||||
if (!response.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 };
|
response = { error: ERR_INVALID_SIGNATURE };
|
||||||
}
|
}
|
||||||
this.resolve(response);
|
this.resolve(response);
|
||||||
|
|
Loading…
Reference in New Issue