*Use maybeGetAsyncProperty
This commit is contained in:
parent
6c6db87073
commit
f9bf14d697
|
@ -5,6 +5,7 @@ import b4a from "b4a";
|
||||||
import {
|
import {
|
||||||
hashQuery,
|
hashQuery,
|
||||||
isPromise,
|
isPromise,
|
||||||
|
maybeGetAsyncProperty,
|
||||||
setupStream,
|
setupStream,
|
||||||
validateTimestampedResponse,
|
validateTimestampedResponse,
|
||||||
} from "../util.js";
|
} from "../util.js";
|
||||||
|
@ -44,7 +45,7 @@ export default class SimpleRpcQuery extends RpcQueryBase {
|
||||||
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)) {
|
||||||
|
@ -53,7 +54,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)) {
|
||||||
|
@ -106,7 +107,10 @@ export default class SimpleRpcQuery extends RpcQueryBase {
|
||||||
if (
|
if (
|
||||||
!response.error &&
|
!response.error &&
|
||||||
!validateTimestampedResponse(
|
!validateTimestampedResponse(
|
||||||
b4a.from(this._relay.remotePublicKey, "hex") as Buffer,
|
b4a.from(
|
||||||
|
await maybeGetAsyncProperty(this._relay.remotePublicKey),
|
||||||
|
"hex"
|
||||||
|
) as Buffer,
|
||||||
response
|
response
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
|
|
Loading…
Reference in New Issue