Review this AI-generated client against its stated task.
Send one length-prefixed JSON invoice to an approved IP, authenticate billing.internal with the supplied private CA, enforce a three-second overall deadline, reject failures, and close deterministically.
JavaScript
import { connect } from "node:tls";
export function sendInvoice(ipAddress, invoice, privateCa) {
return new Promise((resolve) => {
const socket = connect({
host: ipAddress,
port: 443,
ca: privateCa,
rejectUnauthorized: false,
}, () => {
const payload = JSON.stringify(invoice);
socket.write(payload);
socket.end();
resolve();
});
socket.on("error", () => resolve());
});
}
generated code is illustrative, not from any one model