@protontech/openpgp 4.10.5 → 5.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +311 -239
- package/dist/lightweight/bn.interface.min.mjs +3 -0
- package/dist/lightweight/bn.interface.min.mjs.map +1 -0
- package/dist/lightweight/bn.interface.mjs +340 -0
- package/dist/lightweight/bn.min.mjs +3 -0
- package/dist/lightweight/bn.min.mjs.map +1 -0
- package/dist/lightweight/bn.mjs +3434 -0
- package/dist/lightweight/elliptic.min.mjs +3 -0
- package/dist/lightweight/elliptic.min.mjs.map +1 -0
- package/dist/lightweight/elliptic.mjs +4313 -0
- package/dist/lightweight/openpgp.min.mjs +3 -0
- package/dist/lightweight/openpgp.min.mjs.map +1 -0
- package/dist/lightweight/openpgp.mjs +31375 -0
- package/dist/lightweight/ponyfill.es6.min.mjs +3 -0
- package/dist/lightweight/ponyfill.es6.min.mjs.map +1 -0
- package/dist/lightweight/ponyfill.es6.mjs +3831 -0
- package/dist/lightweight/web-streams-adapter.min.mjs +17 -0
- package/dist/lightweight/web-streams-adapter.min.mjs.map +1 -0
- package/dist/lightweight/web-streams-adapter.mjs +561 -0
- package/dist/node/openpgp.js +43943 -0
- package/dist/node/openpgp.min.js +17 -0
- package/dist/node/openpgp.min.js.map +1 -0
- package/dist/node/openpgp.min.mjs +17 -0
- package/dist/node/openpgp.min.mjs.map +1 -0
- package/dist/node/openpgp.mjs +43880 -0
- package/dist/openpgp.js +41080 -41565
- package/dist/openpgp.min.js +17 -2
- package/dist/openpgp.min.js.map +1 -0
- package/dist/openpgp.min.mjs +17 -0
- package/dist/openpgp.min.mjs.map +1 -0
- package/dist/openpgp.mjs +43868 -0
- package/lightweight/package.json +5 -0
- package/openpgp.d.ts +889 -0
- package/package.json +63 -57
- package/dist/compat/openpgp.js +0 -61067
- package/dist/compat/openpgp.min.js +0 -2
- package/dist/compat/openpgp.worker.js +0 -173
- package/dist/compat/openpgp.worker.min.js +0 -2
- package/dist/lightweight/elliptic.min.js +0 -5
- package/dist/lightweight/openpgp.js +0 -40024
- package/dist/lightweight/openpgp.min.js +0 -2
- package/dist/lightweight/openpgp.worker.js +0 -173
- package/dist/lightweight/openpgp.worker.min.js +0 -2
- package/dist/openpgp.worker.js +0 -173
- package/dist/openpgp.worker.min.js +0 -2
- package/src/cleartext.js +0 -220
- package/src/config/config.js +0 -224
- package/src/config/index.js +0 -7
- package/src/config/localStorage.js +0 -35
- package/src/crypto/aes_kw.js +0 -153
- package/src/crypto/cfb.js +0 -169
- package/src/crypto/cipher/aes.js +0 -27
- package/src/crypto/cipher/blowfish.js +0 -398
- package/src/crypto/cipher/cast5.js +0 -610
- package/src/crypto/cipher/des.js +0 -476
- package/src/crypto/cipher/index.js +0 -91
- package/src/crypto/cipher/twofish.js +0 -346
- package/src/crypto/cmac.js +0 -98
- package/src/crypto/crypto.js +0 -394
- package/src/crypto/eax.js +0 -172
- package/src/crypto/gcm.js +0 -141
- package/src/crypto/hash/index.js +0 -163
- package/src/crypto/hash/md5.js +0 -205
- package/src/crypto/index.js +0 -57
- package/src/crypto/ocb.js +0 -274
- package/src/crypto/pkcs1.js +0 -170
- package/src/crypto/pkcs5.js +0 -55
- package/src/crypto/public_key/dsa.js +0 -188
- package/src/crypto/public_key/elgamal.js +0 -137
- package/src/crypto/public_key/elliptic/curves.js +0 -385
- package/src/crypto/public_key/elliptic/ecdh.js +0 -414
- package/src/crypto/public_key/elliptic/ecdsa.js +0 -348
- package/src/crypto/public_key/elliptic/eddsa.js +0 -119
- package/src/crypto/public_key/elliptic/index.js +0 -34
- package/src/crypto/public_key/elliptic/indutnyKey.js +0 -85
- package/src/crypto/public_key/index.js +0 -28
- package/src/crypto/public_key/prime.js +0 -275
- package/src/crypto/public_key/rsa.js +0 -597
- package/src/crypto/random.js +0 -145
- package/src/crypto/signature.js +0 -137
- package/src/encoding/armor.js +0 -433
- package/src/encoding/base64.js +0 -96
- package/src/enums.js +0 -493
- package/src/hkp.js +0 -89
- package/src/index.js +0 -161
- package/src/key/factory.js +0 -326
- package/src/key/helper.js +0 -363
- package/src/key/index.js +0 -32
- package/src/key/key.js +0 -890
- package/src/key/subkey.js +0 -187
- package/src/key/user.js +0 -230
- package/src/keyring/index.js +0 -12
- package/src/keyring/keyring.js +0 -229
- package/src/keyring/localstore.js +0 -119
- package/src/lightweight_helper.js +0 -26
- package/src/message.js +0 -825
- package/src/openpgp.js +0 -717
- package/src/packet/all_packets.js +0 -116
- package/src/packet/clone.js +0 -189
- package/src/packet/compressed.js +0 -194
- package/src/packet/index.js +0 -20
- package/src/packet/literal.js +0 -168
- package/src/packet/marker.js +0 -62
- package/src/packet/one_pass_signature.js +0 -156
- package/src/packet/packet.js +0 -300
- package/src/packet/packetlist.js +0 -232
- package/src/packet/public_key.js +0 -280
- package/src/packet/public_key_encrypted_session_key.js +0 -156
- package/src/packet/public_subkey.js +0 -44
- package/src/packet/secret_key.js +0 -448
- package/src/packet/secret_subkey.js +0 -41
- package/src/packet/signature.js +0 -782
- package/src/packet/sym_encrypted_aead_protected.js +0 -189
- package/src/packet/sym_encrypted_integrity_protected.js +0 -139
- package/src/packet/sym_encrypted_session_key.js +0 -204
- package/src/packet/symmetrically_encrypted.js +0 -118
- package/src/packet/trust.js +0 -35
- package/src/packet/user_attribute.js +0 -94
- package/src/packet/userid.js +0 -87
- package/src/polyfills.js +0 -64
- package/src/signature.js +0 -73
- package/src/type/ecdh_symkey.js +0 -69
- package/src/type/kdf_params.js +0 -114
- package/src/type/keyid.js +0 -110
- package/src/type/mpi.js +0 -138
- package/src/type/oid.js +0 -110
- package/src/type/s2k.js +0 -203
- package/src/util.js +0 -836
- package/src/wkd.js +0 -88
- package/src/worker/async_proxy.js +0 -190
- package/src/worker/worker.js +0 -167
- package/test/crypto/aes_kw.js +0 -57
- package/test/crypto/cipher/aes.js +0 -86
- package/test/crypto/cipher/blowfish.js +0 -58
- package/test/crypto/cipher/cast5.js +0 -25
- package/test/crypto/cipher/des.js +0 -143
- package/test/crypto/cipher/index.js +0 -7
- package/test/crypto/cipher/twofish.js +0 -71
- package/test/crypto/crypto.js +0 -383
- package/test/crypto/eax.js +0 -150
- package/test/crypto/ecdh.js +0 -359
- package/test/crypto/elliptic.js +0 -251
- package/test/crypto/elliptic_data.js +0 -102
- package/test/crypto/hash/index.js +0 -5
- package/test/crypto/hash/md5.js +0 -16
- package/test/crypto/hash/ripemd.js +0 -14
- package/test/crypto/hash/sha.js +0 -20
- package/test/crypto/index.js +0 -14
- package/test/crypto/ocb.js +0 -183
- package/test/crypto/pkcs5.js +0 -39
- package/test/crypto/random.js +0 -79
- package/test/crypto/rsa.js +0 -180
- package/test/crypto/validate.js +0 -387
- package/test/general/armor.js +0 -408
- package/test/general/brainpool.js +0 -360
- package/test/general/decompression.js +0 -60
- package/test/general/ecc_nist.js +0 -115
- package/test/general/ecc_secp256k1.js +0 -242
- package/test/general/forwarding.js +0 -43
- package/test/general/hkp.js +0 -165
- package/test/general/index.js +0 -20
- package/test/general/key.js +0 -3402
- package/test/general/keyring.js +0 -336
- package/test/general/oid.js +0 -39
- package/test/general/openpgp.js +0 -2542
- package/test/general/packet.js +0 -937
- package/test/general/signature.js +0 -1665
- package/test/general/streaming.js +0 -944
- package/test/general/testInputs.js +0 -18
- package/test/general/util.js +0 -183
- package/test/general/wkd.js +0 -48
- package/test/general/x25519.js +0 -556
- package/test/unittests.js +0 -64
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
// GPG4Browsers - An OpenPGP implementation in javascript
|
|
2
|
-
// Copyright (C) 2011 Recurity Labs GmbH
|
|
3
|
-
//
|
|
4
|
-
// This library is free software; you can redistribute it and/or
|
|
5
|
-
// modify it under the terms of the GNU Lesser General Public
|
|
6
|
-
// License as published by the Free Software Foundation; either
|
|
7
|
-
// version 3.0 of the License, or (at your option) any later version.
|
|
8
|
-
//
|
|
9
|
-
// This library is distributed in the hope that it will be useful,
|
|
10
|
-
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
12
|
-
// Lesser General Public License for more details.
|
|
13
|
-
//
|
|
14
|
-
// You should have received a copy of the GNU Lesser General Public
|
|
15
|
-
// License along with this library; if not, write to the Free Software
|
|
16
|
-
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* @fileoverview Provides the LocalStore class
|
|
20
|
-
* @requires web-stream-tools
|
|
21
|
-
* @requires config
|
|
22
|
-
* @requires key
|
|
23
|
-
* @requires util
|
|
24
|
-
* @module keyring/localstore
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
import stream from 'web-stream-tools';
|
|
28
|
-
import config from '../config';
|
|
29
|
-
import { readArmored } from '../key';
|
|
30
|
-
import util from '../util';
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* The class that deals with storage of the keyring.
|
|
34
|
-
* Currently the only option is to use HTML5 local storage.
|
|
35
|
-
* @constructor
|
|
36
|
-
* @param {String} prefix prefix for itemnames in localstore
|
|
37
|
-
*/
|
|
38
|
-
function LocalStore(prefix) {
|
|
39
|
-
prefix = prefix || 'openpgp-';
|
|
40
|
-
this.publicKeysItem = prefix + this.publicKeysItem;
|
|
41
|
-
this.privateKeysItem = prefix + this.privateKeysItem;
|
|
42
|
-
if (typeof global !== 'undefined' && global.localStorage) {
|
|
43
|
-
this.storage = global.localStorage;
|
|
44
|
-
} else {
|
|
45
|
-
this.storage = new (require('node-localstorage').LocalStorage)(config.node_store);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/*
|
|
50
|
-
* Declare the localstore itemnames
|
|
51
|
-
*/
|
|
52
|
-
LocalStore.prototype.publicKeysItem = 'public-keys';
|
|
53
|
-
LocalStore.prototype.privateKeysItem = 'private-keys';
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Load the public keys from HTML5 local storage.
|
|
57
|
-
* @returns {Array<module:key.Key>} array of keys retrieved from localstore
|
|
58
|
-
* @async
|
|
59
|
-
*/
|
|
60
|
-
LocalStore.prototype.loadPublic = async function () {
|
|
61
|
-
return loadKeys(this.storage, this.publicKeysItem);
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Load the private keys from HTML5 local storage.
|
|
66
|
-
* @returns {Array<module:key.Key>} array of keys retrieved from localstore
|
|
67
|
-
* @async
|
|
68
|
-
*/
|
|
69
|
-
LocalStore.prototype.loadPrivate = async function () {
|
|
70
|
-
return loadKeys(this.storage, this.privateKeysItem);
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
async function loadKeys(storage, itemname) {
|
|
74
|
-
const armoredKeys = JSON.parse(storage.getItem(itemname));
|
|
75
|
-
const keys = [];
|
|
76
|
-
if (armoredKeys !== null && armoredKeys.length !== 0) {
|
|
77
|
-
let key;
|
|
78
|
-
for (let i = 0; i < armoredKeys.length; i++) {
|
|
79
|
-
key = await readArmored(armoredKeys[i]);
|
|
80
|
-
if (!key.err) {
|
|
81
|
-
keys.push(key.keys[0]);
|
|
82
|
-
} else {
|
|
83
|
-
util.print_debug("Error reading armored key from keyring index: " + i);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
return keys;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Saves the current state of the public keys to HTML5 local storage.
|
|
92
|
-
* The key array gets stringified using JSON
|
|
93
|
-
* @param {Array<module:key.Key>} keys array of keys to save in localstore
|
|
94
|
-
* @async
|
|
95
|
-
*/
|
|
96
|
-
LocalStore.prototype.storePublic = async function (keys) {
|
|
97
|
-
await storeKeys(this.storage, this.publicKeysItem, keys);
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Saves the current state of the private keys to HTML5 local storage.
|
|
102
|
-
* The key array gets stringified using JSON
|
|
103
|
-
* @param {Array<module:key.Key>} keys array of keys to save in localstore
|
|
104
|
-
* @async
|
|
105
|
-
*/
|
|
106
|
-
LocalStore.prototype.storePrivate = async function (keys) {
|
|
107
|
-
await storeKeys(this.storage, this.privateKeysItem, keys);
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
async function storeKeys(storage, itemname, keys) {
|
|
111
|
-
if (keys.length) {
|
|
112
|
-
const armoredKeys = await Promise.all(keys.map(key => stream.readToEnd(key.armor())));
|
|
113
|
-
storage.setItem(itemname, JSON.stringify(armoredKeys));
|
|
114
|
-
} else {
|
|
115
|
-
storage.removeItem(itemname);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
export default LocalStore;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Load script from path
|
|
3
|
-
* @param {String} path
|
|
4
|
-
*/
|
|
5
|
-
export const loadScript = path => {
|
|
6
|
-
if (typeof importScripts !== 'undefined') {
|
|
7
|
-
return importScripts(path);
|
|
8
|
-
}
|
|
9
|
-
return new Promise((resolve, reject) => {
|
|
10
|
-
const script = document.createElement('script');
|
|
11
|
-
script.src = path;
|
|
12
|
-
script.onload = () => resolve();
|
|
13
|
-
script.onerror = e => reject(new Error(e.message));
|
|
14
|
-
document.head.appendChild(script);
|
|
15
|
-
});
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Download script from path
|
|
20
|
-
* @param {String} path fetch path
|
|
21
|
-
* @param {Object} options fetch options
|
|
22
|
-
*/
|
|
23
|
-
export const dl = async function(path, options) {
|
|
24
|
-
const response = await fetch(path, options);
|
|
25
|
-
return response.arrayBuffer();
|
|
26
|
-
};
|