js encode code example
Example 1: type script encode url
var encodeURI = encodeURIComponent("&")
Example 2: encrypt js
function getMessageEncoding() {
const messageBox = document.querySelector(".rsa-oaep #message");
let message = messageBox.value;
let enc = new TextEncoder();
return enc.encode(message);
}
function encryptMessage(publicKey) {
let encoded = getMessageEncoding();
return window.crypto.subtle.encrypt(
{
name: "RSA-OAEP"
},
publicKey,
encoded
);
}
Example 3: jq unencode string
jq -r .[0].string FILE.json