@protontech/openpgp 4.10.6 → 5.4.0
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 +31379 -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 +43947 -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 +43884 -0
- package/dist/openpgp.js +41082 -41563
- 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 +43872 -0
- package/lightweight/package.json +5 -0
- package/openpgp.d.ts +890 -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,18 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* Generates a 64 character long javascript string out of the whole utf-8 range.
|
|
4
|
-
*/
|
|
5
|
-
function createSomeMessage(){
|
|
6
|
-
let arr = [];
|
|
7
|
-
for (let i = 0; i < 30; i++) {
|
|
8
|
-
arr.push(Math.floor(Math.random() * 10174) + 1);
|
|
9
|
-
}
|
|
10
|
-
for (let i = 0; i < 10; i++) {
|
|
11
|
-
arr.push(0x1F600 + Math.floor(Math.random() * (0x1F64F - 0x1F600)) + 1);
|
|
12
|
-
}
|
|
13
|
-
return ' \t' + String.fromCodePoint(...arr).replace(/\r/g, '\n') + ' \t\n한국어/조선말';
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
module.exports = {
|
|
17
|
-
createSomeMessage: createSomeMessage
|
|
18
|
-
};
|
package/test/general/util.js
DELETED
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
const openpgp = typeof window !== 'undefined' && window.openpgp ? window.openpgp : require('../../dist/openpgp');
|
|
2
|
-
|
|
3
|
-
const chai = require('chai');
|
|
4
|
-
|
|
5
|
-
const { expect } = chai;
|
|
6
|
-
|
|
7
|
-
describe('Util unit tests', function() {
|
|
8
|
-
|
|
9
|
-
describe('isString', function() {
|
|
10
|
-
it('should return true for type "string"', function() {
|
|
11
|
-
const data = 'foo';
|
|
12
|
-
expect(openpgp.util.isString(data)).to.be.true;
|
|
13
|
-
});
|
|
14
|
-
it('should return true for type String', function() {
|
|
15
|
-
const data = String('foo');
|
|
16
|
-
expect(openpgp.util.isString(data)).to.be.true;
|
|
17
|
-
});
|
|
18
|
-
it('should return true for inherited type of String', function() {
|
|
19
|
-
function MyString() {}
|
|
20
|
-
MyString.prototype = Object.create(String.prototype);
|
|
21
|
-
const data = new MyString();
|
|
22
|
-
expect(openpgp.util.isString(data)).to.be.true;
|
|
23
|
-
});
|
|
24
|
-
it('should return true for empty string', function() {
|
|
25
|
-
const data = '';
|
|
26
|
-
expect(openpgp.util.isString(data)).to.be.true;
|
|
27
|
-
});
|
|
28
|
-
it('should return false for undefined', function() {
|
|
29
|
-
let data;
|
|
30
|
-
expect(openpgp.util.isString(data)).to.be.false;
|
|
31
|
-
});
|
|
32
|
-
it('should return false for Object', function() {
|
|
33
|
-
const data = {};
|
|
34
|
-
expect(openpgp.util.isString(data)).to.be.false;
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
describe('isArray', function() {
|
|
39
|
-
it('should return true for []', function() {
|
|
40
|
-
const data = [];
|
|
41
|
-
expect(openpgp.util.isArray(data)).to.be.true;
|
|
42
|
-
});
|
|
43
|
-
it('should return true for type Array', function() {
|
|
44
|
-
const data = Array();
|
|
45
|
-
expect(openpgp.util.isArray(data)).to.be.true;
|
|
46
|
-
});
|
|
47
|
-
it('should return true for inherited type of Array', function() {
|
|
48
|
-
function MyArray() {}
|
|
49
|
-
MyArray.prototype = Object.create(Array.prototype);
|
|
50
|
-
const data = new MyArray();
|
|
51
|
-
expect(openpgp.util.isArray(data)).to.be.true;
|
|
52
|
-
});
|
|
53
|
-
it('should return false for undefined', function() {
|
|
54
|
-
let data;
|
|
55
|
-
expect(openpgp.util.isArray(data)).to.be.false;
|
|
56
|
-
});
|
|
57
|
-
it('should return false for Object', function() {
|
|
58
|
-
const data = {};
|
|
59
|
-
expect(openpgp.util.isArray(data)).to.be.false;
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
describe('isUint8Array', function() {
|
|
64
|
-
it('should return true for type Uint8Array', function() {
|
|
65
|
-
const data = new Uint8Array();
|
|
66
|
-
expect(openpgp.util.isUint8Array(data)).to.be.true;
|
|
67
|
-
});
|
|
68
|
-
it('should return true for inherited type of Uint8Array', function() {
|
|
69
|
-
function MyUint8Array() {}
|
|
70
|
-
MyUint8Array.prototype = new Uint8Array();
|
|
71
|
-
const data = new MyUint8Array();
|
|
72
|
-
expect(openpgp.util.isUint8Array(data)).to.be.true;
|
|
73
|
-
});
|
|
74
|
-
it('should return false for undefined', function() {
|
|
75
|
-
let data;
|
|
76
|
-
expect(openpgp.util.isUint8Array(data)).to.be.false;
|
|
77
|
-
});
|
|
78
|
-
it('should return false for Object', function() {
|
|
79
|
-
const data = {};
|
|
80
|
-
expect(openpgp.util.isUint8Array(data)).to.be.false;
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
describe('isEmailAddress', function() {
|
|
85
|
-
it('should return true for valid email address', function() {
|
|
86
|
-
const data = 'test@example.com';
|
|
87
|
-
expect(openpgp.util.isEmailAddress(data)).to.be.true;
|
|
88
|
-
});
|
|
89
|
-
it('should return true for valid email address', function() {
|
|
90
|
-
const data = 'test@xn--wgv.xn--q9jyb4c';
|
|
91
|
-
expect(openpgp.util.isEmailAddress(data)).to.be.true;
|
|
92
|
-
});
|
|
93
|
-
it('should return false for invalid email address', function() {
|
|
94
|
-
const data = 'Test User <test@example.com>';
|
|
95
|
-
expect(openpgp.util.isEmailAddress(data)).to.be.false;
|
|
96
|
-
});
|
|
97
|
-
it('should return false for invalid email address', function() {
|
|
98
|
-
const data = 'test@examplecom';
|
|
99
|
-
expect(openpgp.util.isEmailAddress(data)).to.be.false;
|
|
100
|
-
});
|
|
101
|
-
it('should return false for invalid email address', function() {
|
|
102
|
-
const data = 'testexamplecom';
|
|
103
|
-
expect(openpgp.util.isEmailAddress(data)).to.be.false;
|
|
104
|
-
});
|
|
105
|
-
it('should return false for empty string', function() {
|
|
106
|
-
const data = '';
|
|
107
|
-
expect(openpgp.util.isEmailAddress(data)).to.be.false;
|
|
108
|
-
});
|
|
109
|
-
it('should return false for undefined', function() {
|
|
110
|
-
let data;
|
|
111
|
-
expect(openpgp.util.isEmailAddress(data)).to.be.false;
|
|
112
|
-
});
|
|
113
|
-
it('should return false for Object', function() {
|
|
114
|
-
const data = {};
|
|
115
|
-
expect(openpgp.util.isEmailAddress(data)).to.be.false;
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
describe('parseUserID', function() {
|
|
120
|
-
it('should parse email address', function() {
|
|
121
|
-
const email = "TestName Test <test@example.com>";
|
|
122
|
-
const result = openpgp.util.parseUserId(email);
|
|
123
|
-
expect(result.name).to.equal('TestName Test');
|
|
124
|
-
expect(result.email).to.equal('test@example.com');
|
|
125
|
-
});
|
|
126
|
-
it('should parse email address with @ in display name and comment', function() {
|
|
127
|
-
const email = "Test@Name Test (a comment) <test@example.com>";
|
|
128
|
-
const result = openpgp.util.parseUserId(email);
|
|
129
|
-
expect(result.name).to.equal('Test@Name Test');
|
|
130
|
-
expect(result.email).to.equal('test@example.com');
|
|
131
|
-
expect(result.comment).to.equal('a comment');
|
|
132
|
-
});
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
describe('getTransferables', function() {
|
|
136
|
-
const buf1 = new Uint8Array(1);
|
|
137
|
-
const buf2 = new Uint8Array(1);
|
|
138
|
-
const obj = {
|
|
139
|
-
data1: buf1,
|
|
140
|
-
data2: buf1,
|
|
141
|
-
data3: {
|
|
142
|
-
data4: buf2
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
it('should return undefined when zero_copy is false', function() {
|
|
147
|
-
openpgp.config.zero_copy = false;
|
|
148
|
-
expect(openpgp.util.getTransferables(obj, false)).to.be.undefined;
|
|
149
|
-
});
|
|
150
|
-
it('should return undefined for no input', function() {
|
|
151
|
-
expect(openpgp.util.getTransferables(undefined, true)).to.be.undefined;
|
|
152
|
-
});
|
|
153
|
-
it('should return undefined for an empty oject', function() {
|
|
154
|
-
expect(openpgp.util.getTransferables({}, true)).to.be.undefined;
|
|
155
|
-
});
|
|
156
|
-
if (typeof navigator !== 'undefined') {
|
|
157
|
-
it('should return two buffers', function() {
|
|
158
|
-
expect(openpgp.util.getTransferables(obj, true)).to.deep.equal(
|
|
159
|
-
navigator.userAgent.indexOf('Safari') !== -1 && (navigator.userAgent.indexOf('Version/11.1') !== -1 || (navigator.userAgent.match(/Chrome\/(\d+)/) || [])[1] < 56) ?
|
|
160
|
-
undefined :
|
|
161
|
-
[buf1.buffer, buf2.buffer]
|
|
162
|
-
);
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
describe("Misc.", function() {
|
|
168
|
-
it('util.readNumber should not overflow until full range of uint32', function () {
|
|
169
|
-
const ints = [Math.pow(2, 20), Math.pow(2, 25), Math.pow(2, 30), Math.pow(2, 32) - 1];
|
|
170
|
-
for(let i = 0; i < ints.length; i++) {
|
|
171
|
-
expect(openpgp.util.readNumber(openpgp.util.writeNumber(ints[i], 4))).to.equal(ints[i]);
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
describe("Zbase32", function() {
|
|
177
|
-
it('util.encodeZBase32 encodes correctly', function() {
|
|
178
|
-
const encoded = openpgp.util.encodeZBase32(openpgp.util.str_to_Uint8Array('test-wkd'));
|
|
179
|
-
expect(encoded).to.equal('qt1zg7bpq7ise');
|
|
180
|
-
})
|
|
181
|
-
})
|
|
182
|
-
|
|
183
|
-
});
|
package/test/general/wkd.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
const openpgp = typeof window !== 'undefined' && window.openpgp ? window.openpgp : require('../../dist/openpgp');
|
|
2
|
-
|
|
3
|
-
const chai = require('chai');
|
|
4
|
-
|
|
5
|
-
const { expect } = chai;
|
|
6
|
-
|
|
7
|
-
describe.skip('WKD unit tests', function() {
|
|
8
|
-
this.timeout(60000);
|
|
9
|
-
|
|
10
|
-
let wkd;
|
|
11
|
-
|
|
12
|
-
beforeEach(function() {
|
|
13
|
-
wkd = new openpgp.WKD();
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
afterEach(function() {});
|
|
17
|
-
|
|
18
|
-
describe('lookup', function() {
|
|
19
|
-
it('by email address should work', function() {
|
|
20
|
-
return wkd.lookup({
|
|
21
|
-
email: 'test-wkd@metacode.biz',
|
|
22
|
-
rawBytes: true
|
|
23
|
-
}).then(function(key) {
|
|
24
|
-
expect(key).to.exist;
|
|
25
|
-
expect(key).to.be.an.instanceof(Uint8Array);
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
it('by email address should work', function() {
|
|
30
|
-
return wkd.lookup({
|
|
31
|
-
email: 'test-wkd@metacode.biz'
|
|
32
|
-
}).then(function(key) {
|
|
33
|
-
expect(key).to.exist;
|
|
34
|
-
expect(key).to.have.property('keys');
|
|
35
|
-
expect(key.keys).to.have.length(1);
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it('by email address should not find a key', function() {
|
|
40
|
-
return wkd.lookup({
|
|
41
|
-
email: 'test-wkd-does-not-exist@metacode.biz'
|
|
42
|
-
}).then(function(key) {
|
|
43
|
-
expect(key).to.be.undefined;
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
});
|