> For the complete documentation index, see [llms.txt](https://docs.elixir.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.elixir.app/api-docs/api-docs-1/rsa-signature/node.js-example.md).

# Node.js Example

```javascript
const { createSign, createVerify } = require('crypto')
/** *
* @param {string} privateKey
* @param {number} token
* @param {string | object} data
* @returns 
*/
function signRSARequest ( 
   privateKey,
   token = Date.now(), 
   data = {}
){
   const info = JSON.stringify(data) 
try {
   const signer = createSign('rsa-sha256' ) 
   signer.update(`${info}.${token}`)
   return signer.sign(privateKey, 'hex')

 } catch (err) {
   throw new Error(`Could not perform signature: ${err.message}`)
}
```
