How to sign a message offline with your private key?

Is there a javascript library that lets you sign and verify a message offline with a bitcoin private key?

e.g.
Code:
import ecc from “ecc-library”;

const privateKey = “5K9Rx5LtXrTCo7Rb1ZsE3rKYxinzE5Ge8Rm3xeuyXm8LyjApqyH”;
const address = “1EheWoBDtpU46ioGrycKnxAkJZR7xRQ6Bt”;
const message = “My message”;
const signature = ecc.sign(message, privateKey); //Signs the message
ecc.isValidSignature(signature, message, address); //Checks if signature is valide