Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private async tryToConnect(identity: string, psk: string): Promise {
// initialize CoAP client
coap.reset();
coap.setSecurityParams(this.hostname, {
psk: { [identity]: psk },
});
log(`Attempting connection. Identity = ${identity}, psk = ${psk}`, "debug");
const result = await coap.tryToConnect(this.requestBase);
log(`Connection ${result ? "" : "un"}successful`, "debug");
return result;
}