-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
💰 USD 200 BOUNTY: Create example showing in-browser file encryption with private key #72
Comments
The correct title should be "Create example showing in-browser file encryption with public key and decryption with private key". |
@xpepermint @fulldecent so the problem here is with Line 21 in ee25185
as mentioned in #48 (comment) If you are not using browserify we cant have a and for CDN we can use unpkg's eccrypto-js which supports file integrity and here is the codepen for working version below is HTML that is working <head>
<title>LET's ENCRYPT</title>
<script src="https://bundle.run/[email protected]"></script>
<script>
window.Buffer = buffer.Buffer
</script>
<script src="https://unpkg.com/[email protected]/dist/umd/index.min.js"></script>
<script>
function hexToString(hexString) {
return new Buffer.from(hexString.match(/.{1,2}/g).map(byte => parseInt(byte, 16)));
}
(async function(){
let eccryptoJS = window.eccryptoJS;
let privateKey = hexToString("8da4ef21b864d2cc526dbdb2a120bd2874c36c9d0a1fb7f8c63d7f7a8b41de8f");
let publicKey = eccryptoJS.getPublic(privateKey);
keyPair = { publicKey, privateKey};
const str = 'test message to encrypt';
const msg = eccryptoJS.utf8ToBuffer(str);
const encrypted = await eccryptoJS.encrypt(keyPair.publicKey, msg);
console.log('encrypted:', encrypted);
const decrypted = await eccryptoJS.decrypt(keyPair.privateKey, encrypted);
console.log('decrypted:', decrypted);
let decryptedstring = new TextDecoder("utf-8").decode(decrypted);
console.log(decryptedstring)
})()</script>
</head>
<body>
OPEN CONSOLE
</body> PS: https://bundle.run/[email protected] this CDN is recommended in https://github.com/feross/buffer |
Thank you for the fast reply! @xpepermint please confirm works. |
Confirmed! |
@ChaituVR thank you for all your help. Please let me know your PayPal email address, or you can send it to me at [email protected]. |
Thank you for your help. Bounty paid by PayPal. Closing issue. |
@ChaituVR please confirm here receipt of payment. |
Received it 👍 thank you so much |
I am committing a USD 200 bounty for help that solves this issue.
Work plan
Details
The text was updated successfully, but these errors were encountered: