@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.
Files changed (173) hide show
  1. package/README.md +311 -239
  2. package/dist/lightweight/bn.interface.min.mjs +3 -0
  3. package/dist/lightweight/bn.interface.min.mjs.map +1 -0
  4. package/dist/lightweight/bn.interface.mjs +340 -0
  5. package/dist/lightweight/bn.min.mjs +3 -0
  6. package/dist/lightweight/bn.min.mjs.map +1 -0
  7. package/dist/lightweight/bn.mjs +3434 -0
  8. package/dist/lightweight/elliptic.min.mjs +3 -0
  9. package/dist/lightweight/elliptic.min.mjs.map +1 -0
  10. package/dist/lightweight/elliptic.mjs +4313 -0
  11. package/dist/lightweight/openpgp.min.mjs +3 -0
  12. package/dist/lightweight/openpgp.min.mjs.map +1 -0
  13. package/dist/lightweight/openpgp.mjs +31379 -0
  14. package/dist/lightweight/ponyfill.es6.min.mjs +3 -0
  15. package/dist/lightweight/ponyfill.es6.min.mjs.map +1 -0
  16. package/dist/lightweight/ponyfill.es6.mjs +3831 -0
  17. package/dist/lightweight/web-streams-adapter.min.mjs +17 -0
  18. package/dist/lightweight/web-streams-adapter.min.mjs.map +1 -0
  19. package/dist/lightweight/web-streams-adapter.mjs +561 -0
  20. package/dist/node/openpgp.js +43947 -0
  21. package/dist/node/openpgp.min.js +17 -0
  22. package/dist/node/openpgp.min.js.map +1 -0
  23. package/dist/node/openpgp.min.mjs +17 -0
  24. package/dist/node/openpgp.min.mjs.map +1 -0
  25. package/dist/node/openpgp.mjs +43884 -0
  26. package/dist/openpgp.js +41082 -41563
  27. package/dist/openpgp.min.js +17 -2
  28. package/dist/openpgp.min.js.map +1 -0
  29. package/dist/openpgp.min.mjs +17 -0
  30. package/dist/openpgp.min.mjs.map +1 -0
  31. package/dist/openpgp.mjs +43872 -0
  32. package/lightweight/package.json +5 -0
  33. package/openpgp.d.ts +890 -0
  34. package/package.json +63 -57
  35. package/dist/compat/openpgp.js +0 -61067
  36. package/dist/compat/openpgp.min.js +0 -2
  37. package/dist/compat/openpgp.worker.js +0 -173
  38. package/dist/compat/openpgp.worker.min.js +0 -2
  39. package/dist/lightweight/elliptic.min.js +0 -5
  40. package/dist/lightweight/openpgp.js +0 -40024
  41. package/dist/lightweight/openpgp.min.js +0 -2
  42. package/dist/lightweight/openpgp.worker.js +0 -173
  43. package/dist/lightweight/openpgp.worker.min.js +0 -2
  44. package/dist/openpgp.worker.js +0 -173
  45. package/dist/openpgp.worker.min.js +0 -2
  46. package/src/cleartext.js +0 -220
  47. package/src/config/config.js +0 -224
  48. package/src/config/index.js +0 -7
  49. package/src/config/localStorage.js +0 -35
  50. package/src/crypto/aes_kw.js +0 -153
  51. package/src/crypto/cfb.js +0 -169
  52. package/src/crypto/cipher/aes.js +0 -27
  53. package/src/crypto/cipher/blowfish.js +0 -398
  54. package/src/crypto/cipher/cast5.js +0 -610
  55. package/src/crypto/cipher/des.js +0 -476
  56. package/src/crypto/cipher/index.js +0 -91
  57. package/src/crypto/cipher/twofish.js +0 -346
  58. package/src/crypto/cmac.js +0 -98
  59. package/src/crypto/crypto.js +0 -394
  60. package/src/crypto/eax.js +0 -172
  61. package/src/crypto/gcm.js +0 -141
  62. package/src/crypto/hash/index.js +0 -163
  63. package/src/crypto/hash/md5.js +0 -205
  64. package/src/crypto/index.js +0 -57
  65. package/src/crypto/ocb.js +0 -274
  66. package/src/crypto/pkcs1.js +0 -170
  67. package/src/crypto/pkcs5.js +0 -55
  68. package/src/crypto/public_key/dsa.js +0 -188
  69. package/src/crypto/public_key/elgamal.js +0 -137
  70. package/src/crypto/public_key/elliptic/curves.js +0 -385
  71. package/src/crypto/public_key/elliptic/ecdh.js +0 -414
  72. package/src/crypto/public_key/elliptic/ecdsa.js +0 -348
  73. package/src/crypto/public_key/elliptic/eddsa.js +0 -119
  74. package/src/crypto/public_key/elliptic/index.js +0 -34
  75. package/src/crypto/public_key/elliptic/indutnyKey.js +0 -85
  76. package/src/crypto/public_key/index.js +0 -28
  77. package/src/crypto/public_key/prime.js +0 -275
  78. package/src/crypto/public_key/rsa.js +0 -597
  79. package/src/crypto/random.js +0 -145
  80. package/src/crypto/signature.js +0 -137
  81. package/src/encoding/armor.js +0 -433
  82. package/src/encoding/base64.js +0 -96
  83. package/src/enums.js +0 -493
  84. package/src/hkp.js +0 -89
  85. package/src/index.js +0 -161
  86. package/src/key/factory.js +0 -326
  87. package/src/key/helper.js +0 -363
  88. package/src/key/index.js +0 -32
  89. package/src/key/key.js +0 -890
  90. package/src/key/subkey.js +0 -187
  91. package/src/key/user.js +0 -230
  92. package/src/keyring/index.js +0 -12
  93. package/src/keyring/keyring.js +0 -229
  94. package/src/keyring/localstore.js +0 -119
  95. package/src/lightweight_helper.js +0 -26
  96. package/src/message.js +0 -825
  97. package/src/openpgp.js +0 -717
  98. package/src/packet/all_packets.js +0 -116
  99. package/src/packet/clone.js +0 -189
  100. package/src/packet/compressed.js +0 -194
  101. package/src/packet/index.js +0 -20
  102. package/src/packet/literal.js +0 -168
  103. package/src/packet/marker.js +0 -62
  104. package/src/packet/one_pass_signature.js +0 -156
  105. package/src/packet/packet.js +0 -300
  106. package/src/packet/packetlist.js +0 -232
  107. package/src/packet/public_key.js +0 -280
  108. package/src/packet/public_key_encrypted_session_key.js +0 -156
  109. package/src/packet/public_subkey.js +0 -44
  110. package/src/packet/secret_key.js +0 -448
  111. package/src/packet/secret_subkey.js +0 -41
  112. package/src/packet/signature.js +0 -782
  113. package/src/packet/sym_encrypted_aead_protected.js +0 -189
  114. package/src/packet/sym_encrypted_integrity_protected.js +0 -139
  115. package/src/packet/sym_encrypted_session_key.js +0 -204
  116. package/src/packet/symmetrically_encrypted.js +0 -118
  117. package/src/packet/trust.js +0 -35
  118. package/src/packet/user_attribute.js +0 -94
  119. package/src/packet/userid.js +0 -87
  120. package/src/polyfills.js +0 -64
  121. package/src/signature.js +0 -73
  122. package/src/type/ecdh_symkey.js +0 -69
  123. package/src/type/kdf_params.js +0 -114
  124. package/src/type/keyid.js +0 -110
  125. package/src/type/mpi.js +0 -138
  126. package/src/type/oid.js +0 -110
  127. package/src/type/s2k.js +0 -203
  128. package/src/util.js +0 -836
  129. package/src/wkd.js +0 -88
  130. package/src/worker/async_proxy.js +0 -190
  131. package/src/worker/worker.js +0 -167
  132. package/test/crypto/aes_kw.js +0 -57
  133. package/test/crypto/cipher/aes.js +0 -86
  134. package/test/crypto/cipher/blowfish.js +0 -58
  135. package/test/crypto/cipher/cast5.js +0 -25
  136. package/test/crypto/cipher/des.js +0 -143
  137. package/test/crypto/cipher/index.js +0 -7
  138. package/test/crypto/cipher/twofish.js +0 -71
  139. package/test/crypto/crypto.js +0 -383
  140. package/test/crypto/eax.js +0 -150
  141. package/test/crypto/ecdh.js +0 -359
  142. package/test/crypto/elliptic.js +0 -251
  143. package/test/crypto/elliptic_data.js +0 -102
  144. package/test/crypto/hash/index.js +0 -5
  145. package/test/crypto/hash/md5.js +0 -16
  146. package/test/crypto/hash/ripemd.js +0 -14
  147. package/test/crypto/hash/sha.js +0 -20
  148. package/test/crypto/index.js +0 -14
  149. package/test/crypto/ocb.js +0 -183
  150. package/test/crypto/pkcs5.js +0 -39
  151. package/test/crypto/random.js +0 -79
  152. package/test/crypto/rsa.js +0 -180
  153. package/test/crypto/validate.js +0 -387
  154. package/test/general/armor.js +0 -408
  155. package/test/general/brainpool.js +0 -360
  156. package/test/general/decompression.js +0 -60
  157. package/test/general/ecc_nist.js +0 -115
  158. package/test/general/ecc_secp256k1.js +0 -242
  159. package/test/general/forwarding.js +0 -43
  160. package/test/general/hkp.js +0 -165
  161. package/test/general/index.js +0 -20
  162. package/test/general/key.js +0 -3402
  163. package/test/general/keyring.js +0 -336
  164. package/test/general/oid.js +0 -39
  165. package/test/general/openpgp.js +0 -2542
  166. package/test/general/packet.js +0 -937
  167. package/test/general/signature.js +0 -1665
  168. package/test/general/streaming.js +0 -944
  169. package/test/general/testInputs.js +0 -18
  170. package/test/general/util.js +0 -183
  171. package/test/general/wkd.js +0 -48
  172. package/test/general/x25519.js +0 -556
  173. 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
- };
@@ -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
- });
@@ -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
- });