Skip to content

Instantly share code, notes, and snippets.

@dotmh
Created January 8, 2024 11:44
Show Gist options
  • Save dotmh/4535b97fefc39b887fe88292671b35f4 to your computer and use it in GitHub Desktop.
Save dotmh/4535b97fefc39b887fe88292671b35f4 to your computer and use it in GitHub Desktop.
DKIM Spliter

If you want to use DKIM with AWS Route 43, you can't just copy and base the security key because Route53 won't accept it. to allow it to accept the value you have to split it. The above script is just an automated way of doing that.

Simply replace with your keys value and then run the script and it will spit out the DKIM key chuncked for route 53.

I normally run this using RunJS

const maxWidth = 250
const string = "<DKIM KEY HERE>"
const chunks = Math.ceil(string.length / maxWidth);
let stringChunked = [];
for (let i = 0; i < chunks; i++) {
stringChunked.push(string.slice(i*maxWidth, (i+1)*maxWidth))
}
const output = `"${stringChunked.join('" "')}"`
console.log(output)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment