mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-09-17 10:34:31 +08:00
Bugfix our modified OpenPGP.js
This commit is contained in:
parent
c012fe09f0
commit
70c55a60be
2 changed files with 8 additions and 34 deletions
|
@ -194,9 +194,14 @@ RainLoop uses the old OpenPGP.js v2
|
|||
SnappyMail v2.12 uses OpenPGP.js v5, GnuPG and Mailvelope.
|
||||
SnappyMail is able to use and generate ECDSA and EDDSA keys, where RainLoop does not.
|
||||
|
||||
Since SnappyMail tries to achieve the best mobile experience, it forked OpenPGP.js to strip it down.
|
||||
* remove all unused Node.js
|
||||
* remove all old browsers support
|
||||
See https://github.com/the-djmaze/openpgpjs for development
|
||||
|
||||
|OpenPGP |RainLoop |Snappy |RL gzip |SM gzip |RL brotli |SM brotli |
|
||||
|--------------- |--------: |--------: |------: |-------: |--------: |--------: |
|
||||
|openpgp.min.js | 330.742 | 550.724 |102.388 | 170.033 | 84.241 | 139.429 |
|
||||
|openpgp.min.js | 330.742 | 540.542 |102.388 | 167.397 | 84.241 | 137.502 |
|
||||
|openpgp.worker | 1.499 | | 824 | | 695 | |
|
||||
|
||||
|
||||
|
|
35
vendors/openpgp-5/dist/openpgp.js
vendored
35
vendors/openpgp-5/dist/openpgp.js
vendored
|
@ -2034,18 +2034,8 @@ var openpgp = (function (exports) {
|
|||
* provided with the application or distribution.
|
||||
*/
|
||||
|
||||
let encodeChunk;
|
||||
let decodeChunk;
|
||||
if (Buffer) {
|
||||
encodeChunk = buf => Buffer.from(buf).toString('base64');
|
||||
decodeChunk = str => {
|
||||
const b = Buffer.from(str, 'base64');
|
||||
return new Uint8Array(b.buffer, b.byteOffset, b.byteLength);
|
||||
};
|
||||
} else {
|
||||
encodeChunk = buf => btoa(util.uint8ArrayToString(buf));
|
||||
decodeChunk = str => util.stringToUint8Array(atob(str));
|
||||
}
|
||||
let encodeChunk = buf => btoa(util.uint8ArrayToString(buf));
|
||||
let decodeChunk = str => util.stringToUint8Array(atob(str));
|
||||
|
||||
/**
|
||||
* Convert binary array to radix-64
|
||||
|
@ -10722,8 +10712,6 @@ var openpgp = (function (exports) {
|
|||
// OpenPGP.js - An OpenPGP implementation in javascript
|
||||
|
||||
const webCrypto$4 = util.getWebCrypto();
|
||||
const nodeCrypto = util.getNodeCrypto();
|
||||
const Buffer$1 = util.getNodeBuffer();
|
||||
|
||||
const blockLength = 16;
|
||||
const ivLength = 12; // size of the IV in bytes
|
||||
|
@ -10776,25 +10764,6 @@ var openpgp = (function (exports) {
|
|||
};
|
||||
}
|
||||
|
||||
if (util.getNodeCrypto()) { // Node crypto library
|
||||
return {
|
||||
encrypt: async function(pt, iv, adata = new Uint8Array()) {
|
||||
const en = new nodeCrypto.createCipheriv('aes-' + (key.length * 8) + '-gcm', key, iv);
|
||||
en.setAAD(adata);
|
||||
const ct = Buffer$1.concat([en.update(pt), en.final(), en.getAuthTag()]); // append auth tag to ciphertext
|
||||
return new Uint8Array(ct);
|
||||
},
|
||||
|
||||
decrypt: async function(ct, iv, adata = new Uint8Array()) {
|
||||
const de = new nodeCrypto.createDecipheriv('aes-' + (key.length * 8) + '-gcm', key, iv);
|
||||
de.setAAD(adata);
|
||||
de.setAuthTag(ct.slice(ct.length - tagLength, ct.length)); // read auth tag at end of ciphertext
|
||||
const pt = Buffer$1.concat([de.update(ct.slice(0, ct.length - tagLength)), de.final()]);
|
||||
return new Uint8Array(pt);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
encrypt: async function(pt, iv, adata) {
|
||||
return AES_GCM.encrypt(pt, key, iv, adata);
|
||||
|
|
Loading…
Add table
Reference in a new issue