@waku/message-encryption 0.0.14 → 0.0.16
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/CHANGELOG.md +36 -0
- package/bundle/ecies.js +1 -1
- package/bundle/{index-a56f7af2.js → index-f77add72.js} +55 -23
- package/bundle/index.js +1 -1
- package/bundle/symmetric.js +1 -1
- package/dist/decoded_message.js +3 -0
- package/dist/decoded_message.js.map +1 -1
- package/dist/ecies.js +9 -0
- package/dist/ecies.js.map +1 -1
- package/dist/symmetric.js +9 -0
- package/dist/symmetric.js.map +1 -1
- package/package.json +10 -12
- package/src/ecies.ts +5 -1
- package/src/symmetric.ts +5 -1
package/CHANGELOG.md
CHANGED
@@ -35,6 +35,42 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
35
35
|
* @waku/interfaces bumped from 0.0.10 to 0.0.11
|
36
36
|
* @waku/utils bumped from 0.0.3 to 0.0.4
|
37
37
|
|
38
|
+
## [0.0.16](https://github.com/waku-org/js-waku/compare/message-encryption-v0.0.15...message-encryption-v0.0.16) (2023-05-18)
|
39
|
+
|
40
|
+
|
41
|
+
### ⚠ BREAKING CHANGES
|
42
|
+
|
43
|
+
* @waku/relay ([#1316](https://github.com/waku-org/js-waku/issues/1316))
|
44
|
+
|
45
|
+
### Features
|
46
|
+
|
47
|
+
* @waku/relay ([#1316](https://github.com/waku-org/js-waku/issues/1316)) ([50c2c25](https://github.com/waku-org/js-waku/commit/50c2c2540f3c5ff78d93f3fea646da0eee246e17))
|
48
|
+
|
49
|
+
|
50
|
+
### Dependencies
|
51
|
+
|
52
|
+
* The following workspace dependencies were updated
|
53
|
+
* dependencies
|
54
|
+
* @waku/core bumped from * to 0.0.18
|
55
|
+
* @waku/interfaces bumped from * to 0.0.13
|
56
|
+
* @waku/utils bumped from * to 0.0.6
|
57
|
+
|
58
|
+
## [0.0.15](https://github.com/waku-org/js-waku/compare/message-encryption-v0.0.14...message-encryption-v0.0.15) (2023-05-09)
|
59
|
+
|
60
|
+
|
61
|
+
### Features
|
62
|
+
|
63
|
+
* Ensure content topic is defined ([bd9d073](https://github.com/waku-org/js-waku/commit/bd9d07394fc2dcad573dd7f3b44ee692d0ea93e8))
|
64
|
+
|
65
|
+
|
66
|
+
### Dependencies
|
67
|
+
|
68
|
+
* The following workspace dependencies were updated
|
69
|
+
* dependencies
|
70
|
+
* @waku/core bumped from 0.0.16 to 0.0.17
|
71
|
+
* @waku/interfaces bumped from 0.0.11 to 0.0.12
|
72
|
+
* @waku/utils bumped from 0.0.4 to 0.0.5
|
73
|
+
|
38
74
|
## [0.0.10](https://github.com/waku-org/js-waku/compare/message-encryption-v0.0.9...message-encryption-v0.0.10) (2023-03-16)
|
39
75
|
|
40
76
|
|
package/bundle/ecies.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export { b as createDecoder, c as createEncoder, g as generatePrivateKey, a as getPublicKey } from './index-
|
1
|
+
export { b as createDecoder, c as createEncoder, g as generatePrivateKey, a as getPublicKey } from './index-f77add72.js';
|
@@ -1807,6 +1807,9 @@ var base256emoji$1 = /*#__PURE__*/Object.freeze({
|
|
1807
1807
|
new TextEncoder();
|
1808
1808
|
new TextDecoder();
|
1809
1809
|
|
1810
|
+
/** @type {WeakMap<API.UnknownLink, Map<string, string>>} */
|
1811
|
+
new WeakMap();
|
1812
|
+
|
1810
1813
|
// @ts-check
|
1811
1814
|
|
1812
1815
|
const bases = { ...identityBase, ...base2$1, ...base8$1, ...base10$1, ...base16$1, ...base32$1, ...base36$1, ...base58, ...base64$3, ...base256emoji$1 };
|
@@ -1930,11 +1933,7 @@ function getDefaultExportFromCjs (x) {
|
|
1930
1933
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
1931
1934
|
}
|
1932
1935
|
|
1933
|
-
var
|
1934
|
-
var sha3$1 = {
|
1935
|
-
get exports(){ return sha3Exports; },
|
1936
|
-
set exports(v){ sha3Exports = v; },
|
1937
|
-
};
|
1936
|
+
var sha3$1 = {exports: {}};
|
1938
1937
|
|
1939
1938
|
/**
|
1940
1939
|
* [js-sha3]{@link https://github.com/emn178/js-sha3}
|
@@ -2586,10 +2585,11 @@ var sha3$1 = {
|
|
2586
2585
|
root[methodNames[i]] = methods[methodNames[i]];
|
2587
2586
|
}
|
2588
2587
|
}
|
2589
|
-
})();
|
2588
|
+
})();
|
2590
2589
|
} (sha3$1));
|
2591
2590
|
|
2592
|
-
var
|
2591
|
+
var sha3Exports = sha3$1.exports;
|
2592
|
+
var sha3 = /*@__PURE__*/getDefaultExportFromCjs(sha3Exports);
|
2593
2593
|
|
2594
2594
|
const Symmetric = {
|
2595
2595
|
keySize: 32,
|
@@ -2850,7 +2850,7 @@ var base64$1 = {};
|
|
2850
2850
|
*/
|
2851
2851
|
base64.test = function test(string) {
|
2852
2852
|
return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(string);
|
2853
|
-
};
|
2853
|
+
};
|
2854
2854
|
} (base64$1));
|
2855
2855
|
|
2856
2856
|
var eventemitter = EventEmitter;
|
@@ -3386,7 +3386,7 @@ var utf8$2 = {};
|
|
3386
3386
|
}
|
3387
3387
|
}
|
3388
3388
|
return offset - start;
|
3389
|
-
};
|
3389
|
+
};
|
3390
3390
|
} (utf8$2));
|
3391
3391
|
|
3392
3392
|
var pool_1 = pool;
|
@@ -4087,8 +4087,8 @@ function requireMinimal () {
|
|
4087
4087
|
function Buffer_allocUnsafe(size) {
|
4088
4088
|
return new Buffer(size);
|
4089
4089
|
};
|
4090
|
-
};
|
4091
|
-
} (minimal));
|
4090
|
+
};
|
4091
|
+
} (minimal));
|
4092
4092
|
return minimal;
|
4093
4093
|
}
|
4094
4094
|
|
@@ -4503,6 +4503,8 @@ Reader$1._configure = function(BufferReader_) {
|
|
4503
4503
|
});
|
4504
4504
|
};
|
4505
4505
|
|
4506
|
+
var ReaderClass = /*@__PURE__*/getDefaultExportFromCjs(reader$1);
|
4507
|
+
|
4506
4508
|
var reader_buffer = BufferReader;
|
4507
4509
|
|
4508
4510
|
// extends Reader
|
@@ -4554,6 +4556,8 @@ BufferReader.prototype.string = function read_string_buffer() {
|
|
4554
4556
|
|
4555
4557
|
BufferReader._configure();
|
4556
4558
|
|
4559
|
+
var ReaderBufferClass = /*@__PURE__*/getDefaultExportFromCjs(reader_buffer);
|
4560
|
+
|
4557
4561
|
var minimalExports = requireMinimal();
|
4558
4562
|
var util$2 = /*@__PURE__*/getDefaultExportFromCjs(minimalExports);
|
4559
4563
|
|
@@ -5022,6 +5026,8 @@ Writer$1._configure = function(BufferWriter_) {
|
|
5022
5026
|
BufferWriter$1._configure();
|
5023
5027
|
};
|
5024
5028
|
|
5029
|
+
var WriterClass = /*@__PURE__*/getDefaultExportFromCjs(writer$1);
|
5030
|
+
|
5025
5031
|
var writer_buffer = BufferWriter;
|
5026
5032
|
|
5027
5033
|
// extends Writer
|
@@ -5107,11 +5113,13 @@ BufferWriter.prototype.string = function write_string_buffer(value) {
|
|
5107
5113
|
|
5108
5114
|
BufferWriter._configure();
|
5109
5115
|
|
5116
|
+
var WriterBufferClass = /*@__PURE__*/getDefaultExportFromCjs(writer_buffer);
|
5117
|
+
|
5110
5118
|
// @ts-expect-error no types
|
5111
5119
|
function configure() {
|
5112
5120
|
util$2._configure();
|
5113
|
-
|
5114
|
-
|
5121
|
+
ReaderClass._configure(ReaderBufferClass);
|
5122
|
+
WriterClass._configure(WriterBufferClass);
|
5115
5123
|
}
|
5116
5124
|
// Set up buffer utility according to the environment
|
5117
5125
|
configure();
|
@@ -5132,7 +5140,7 @@ function patchReader(obj) {
|
|
5132
5140
|
return obj;
|
5133
5141
|
}
|
5134
5142
|
function reader(buf) {
|
5135
|
-
return patchReader(new
|
5143
|
+
return patchReader(new ReaderClass(buf));
|
5136
5144
|
}
|
5137
5145
|
function patchWriter(obj) {
|
5138
5146
|
for (const method of methods) {
|
@@ -5147,7 +5155,7 @@ function patchWriter(obj) {
|
|
5147
5155
|
return obj;
|
5148
5156
|
}
|
5149
5157
|
function writer() {
|
5150
|
-
return patchWriter(
|
5158
|
+
return patchWriter(WriterClass.create());
|
5151
5159
|
}
|
5152
5160
|
|
5153
5161
|
function decodeMessage(buf, codec) {
|
@@ -6917,11 +6925,7 @@ var PeerExchangeRPC;
|
|
6917
6925
|
};
|
6918
6926
|
})(PeerExchangeRPC || (PeerExchangeRPC = {}));
|
6919
6927
|
|
6920
|
-
var
|
6921
|
-
var browser = {
|
6922
|
-
get exports(){ return browserExports; },
|
6923
|
-
set exports(v){ browserExports = v; },
|
6924
|
-
};
|
6928
|
+
var browser = {exports: {}};
|
6925
6929
|
|
6926
6930
|
/**
|
6927
6931
|
* Helpers.
|
@@ -7637,15 +7641,18 @@ var common = setup;
|
|
7637
7641
|
} catch (error) {
|
7638
7642
|
return '[UnexpectedJSONParseError]: ' + error.message;
|
7639
7643
|
}
|
7640
|
-
};
|
7641
|
-
} (browser,
|
7644
|
+
};
|
7645
|
+
} (browser, browser.exports));
|
7642
7646
|
|
7643
|
-
var
|
7647
|
+
var browserExports = browser.exports;
|
7648
|
+
var debug = /*@__PURE__*/getDefaultExportFromCjs(browserExports);
|
7644
7649
|
|
7645
7650
|
const log$2 = debug("waku:message:version-0");
|
7646
7651
|
const OneMillion$1 = BigInt(1000000);
|
7647
7652
|
const Version$1 = 0;
|
7648
7653
|
let DecodedMessage$1 = class DecodedMessage {
|
7654
|
+
pubSubTopic;
|
7655
|
+
proto;
|
7649
7656
|
constructor(pubSubTopic, proto) {
|
7650
7657
|
this.pubSubTopic = pubSubTopic;
|
7651
7658
|
this.proto = proto;
|
@@ -7690,8 +7697,12 @@ let DecodedMessage$1 = class DecodedMessage {
|
|
7690
7697
|
}
|
7691
7698
|
};
|
7692
7699
|
let Decoder$2 = class Decoder {
|
7700
|
+
contentTopic;
|
7693
7701
|
constructor(contentTopic) {
|
7694
7702
|
this.contentTopic = contentTopic;
|
7703
|
+
if (!contentTopic || contentTopic === "") {
|
7704
|
+
throw new Error("Content topic must be specified");
|
7705
|
+
}
|
7695
7706
|
}
|
7696
7707
|
fromWireToProtoObj(bytes) {
|
7697
7708
|
const protoMessage = WakuMessage$3.decode(bytes);
|
@@ -7718,6 +7729,9 @@ let Decoder$2 = class Decoder {
|
|
7718
7729
|
};
|
7719
7730
|
|
7720
7731
|
class DecodedMessage extends DecodedMessage$1 {
|
7732
|
+
signature;
|
7733
|
+
signaturePublicKey;
|
7734
|
+
_decodedPayload;
|
7721
7735
|
constructor(pubSubTopic, proto, decodedPayload, signature, signaturePublicKey) {
|
7722
7736
|
super(pubSubTopic, proto);
|
7723
7737
|
this.signature = signature;
|
@@ -8042,12 +8056,20 @@ function postCipher(message) {
|
|
8042
8056
|
|
8043
8057
|
const log$1 = debug("waku:message-encryption:ecies");
|
8044
8058
|
let Encoder$1 = class Encoder {
|
8059
|
+
contentTopic;
|
8060
|
+
publicKey;
|
8061
|
+
sigPrivKey;
|
8062
|
+
ephemeral;
|
8063
|
+
metaSetter;
|
8045
8064
|
constructor(contentTopic, publicKey, sigPrivKey, ephemeral = false, metaSetter) {
|
8046
8065
|
this.contentTopic = contentTopic;
|
8047
8066
|
this.publicKey = publicKey;
|
8048
8067
|
this.sigPrivKey = sigPrivKey;
|
8049
8068
|
this.ephemeral = ephemeral;
|
8050
8069
|
this.metaSetter = metaSetter;
|
8070
|
+
if (!contentTopic || contentTopic === "") {
|
8071
|
+
throw new Error("Content topic must be specified");
|
8072
|
+
}
|
8051
8073
|
}
|
8052
8074
|
async toWire(message) {
|
8053
8075
|
const protoMessage = await this.toProtoObj(message);
|
@@ -8091,6 +8113,7 @@ function createEncoder$1({ contentTopic, publicKey, sigPrivKey, ephemeral = fals
|
|
8091
8113
|
return new Encoder$1(contentTopic, publicKey, sigPrivKey, ephemeral, metaSetter);
|
8092
8114
|
}
|
8093
8115
|
let Decoder$1 = class Decoder extends Decoder$2 {
|
8116
|
+
privateKey;
|
8094
8117
|
constructor(contentTopic, privateKey) {
|
8095
8118
|
super(contentTopic);
|
8096
8119
|
this.privateKey = privateKey;
|
@@ -8149,12 +8172,20 @@ var ecies = /*#__PURE__*/Object.freeze({
|
|
8149
8172
|
|
8150
8173
|
const log = debug("waku:message-encryption:symmetric");
|
8151
8174
|
class Encoder {
|
8175
|
+
contentTopic;
|
8176
|
+
symKey;
|
8177
|
+
sigPrivKey;
|
8178
|
+
ephemeral;
|
8179
|
+
metaSetter;
|
8152
8180
|
constructor(contentTopic, symKey, sigPrivKey, ephemeral = false, metaSetter) {
|
8153
8181
|
this.contentTopic = contentTopic;
|
8154
8182
|
this.symKey = symKey;
|
8155
8183
|
this.sigPrivKey = sigPrivKey;
|
8156
8184
|
this.ephemeral = ephemeral;
|
8157
8185
|
this.metaSetter = metaSetter;
|
8186
|
+
if (!contentTopic || contentTopic === "") {
|
8187
|
+
throw new Error("Content topic must be specified");
|
8188
|
+
}
|
8158
8189
|
}
|
8159
8190
|
async toWire(message) {
|
8160
8191
|
const protoMessage = await this.toProtoObj(message);
|
@@ -8199,6 +8230,7 @@ function createEncoder({ contentTopic, symKey, sigPrivKey, ephemeral = false, me
|
|
8199
8230
|
return new Encoder(contentTopic, symKey, sigPrivKey, ephemeral, metaSetter);
|
8200
8231
|
}
|
8201
8232
|
class Decoder extends Decoder$2 {
|
8233
|
+
symKey;
|
8202
8234
|
constructor(contentTopic, symKey) {
|
8203
8235
|
super(contentTopic);
|
8204
8236
|
this.symKey = symKey;
|
package/bundle/index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export { O as OneMillion, V as Version, h as ecies, g as generatePrivateKey, d as generateSymmetricKey, a as getPublicKey, s as symmetric } from './index-
|
1
|
+
export { O as OneMillion, V as Version, h as ecies, g as generatePrivateKey, d as generateSymmetricKey, a as getPublicKey, s as symmetric } from './index-f77add72.js';
|
package/bundle/symmetric.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export { f as createDecoder, e as createEncoder, d as generateSymmetricKey } from './index-
|
1
|
+
export { f as createDecoder, e as createEncoder, d as generateSymmetricKey } from './index-f77add72.js';
|
package/dist/decoded_message.js
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
import { DecodedMessage as DecodedMessageV0, } from "@waku/core/lib/message/version_0";
|
2
2
|
export class DecodedMessage extends DecodedMessageV0 {
|
3
|
+
signature;
|
4
|
+
signaturePublicKey;
|
5
|
+
_decodedPayload;
|
3
6
|
constructor(pubSubTopic, proto, decodedPayload, signature, signaturePublicKey) {
|
4
7
|
super(pubSubTopic, proto);
|
5
8
|
this.signature = signature;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"decoded_message.js","sourceRoot":"","sources":["../src/decoded_message.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,IAAI,gBAAgB,GAEnC,MAAM,kCAAkC,CAAC;AAG1C,MAAM,OAAO,cACX,SAAQ,gBAAgB;
|
1
|
+
{"version":3,"file":"decoded_message.js","sourceRoot":"","sources":["../src/decoded_message.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,IAAI,gBAAgB,GAEnC,MAAM,kCAAkC,CAAC;AAG1C,MAAM,OAAO,cACX,SAAQ,gBAAgB;IASf;IACA;IAPQ,eAAe,CAAa;IAE7C,YACE,WAAmB,EACnB,KAAwB,EACxB,cAA0B,EACnB,SAAsB,EACtB,kBAA+B;QAEtC,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;QAHnB,cAAS,GAAT,SAAS,CAAa;QACtB,uBAAkB,GAAlB,kBAAkB,CAAa;QAGtC,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;IACxC,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;CACF"}
|
package/dist/ecies.js
CHANGED
@@ -7,12 +7,20 @@ import { generatePrivateKey, getPublicKey, OneMillion, Version, } from "./index.
|
|
7
7
|
export { generatePrivateKey, getPublicKey };
|
8
8
|
const log = debug("waku:message-encryption:ecies");
|
9
9
|
class Encoder {
|
10
|
+
contentTopic;
|
11
|
+
publicKey;
|
12
|
+
sigPrivKey;
|
13
|
+
ephemeral;
|
14
|
+
metaSetter;
|
10
15
|
constructor(contentTopic, publicKey, sigPrivKey, ephemeral = false, metaSetter) {
|
11
16
|
this.contentTopic = contentTopic;
|
12
17
|
this.publicKey = publicKey;
|
13
18
|
this.sigPrivKey = sigPrivKey;
|
14
19
|
this.ephemeral = ephemeral;
|
15
20
|
this.metaSetter = metaSetter;
|
21
|
+
if (!contentTopic || contentTopic === "") {
|
22
|
+
throw new Error("Content topic must be specified");
|
23
|
+
}
|
16
24
|
}
|
17
25
|
async toWire(message) {
|
18
26
|
const protoMessage = await this.toProtoObj(message);
|
@@ -56,6 +64,7 @@ export function createEncoder({ contentTopic, publicKey, sigPrivKey, ephemeral =
|
|
56
64
|
return new Encoder(contentTopic, publicKey, sigPrivKey, ephemeral, metaSetter);
|
57
65
|
}
|
58
66
|
class Decoder extends DecoderV0 {
|
67
|
+
privateKey;
|
59
68
|
constructor(contentTopic, privateKey) {
|
60
69
|
super(contentTopic);
|
61
70
|
this.privateKey = privateKey;
|
package/dist/ecies.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ecies.js","sourceRoot":"","sources":["../src/ecies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,kCAAkC,CAAC;AASxE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,UAAU,EACV,SAAS,GACV,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,UAAU,EACV,OAAO,GACR,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,kBAAkB,EAAE,YAA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QAE3B,MAAM,aAAa,GAAG,YAAY,CAAC,OAAO,CAAC;QAE3C,IAAI,YAAY,CAAC,OAAO,KAAK,OAAO,EAAE;YACpC,GAAG,CACD,uDAAuD,EACvD,OAAO,EACP,WAAW,EACX,YAAY,CAAC,OAAO,CACrB,CAAC;YACF,OAAO;SACR;QAED,IAAI,OAAO,CAAC;QAEZ,IAAI;YACF,OAAO,GAAG,MAAM,iBAAiB,CAAC,aAAa,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;SACnE;QAAC,OAAO,CAAC,EAAE;YACV,GAAG,CACD,2EAA2E,IAAI,CAAC,YAAY,EAAE,EAC9F,CAAC,CACF,CAAC;YACF,OAAO;SACR;QAED,IAAI,CAAC,OAAO,EAAE;YACZ,GAAG,CAAC,8CAA8C,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;YACvE,OAAO;SACR;QAED,MAAM,GAAG,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC,CAAC;QAEtC,IAAI,CAAC,GAAG,EAAE;YACR,GAAG,CAAC,6CAA6C,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;YACtE,OAAO;SACR;QAED,GAAG,CAAC,mBAAmB,EAAE,YAAY,CAAC,CAAC;QACvC,OAAO,IAAI,cAAc,CACvB,WAAW,EACX,YAAY,EACZ,GAAG,CAAC,OAAO,EACX,GAAG,CAAC,GAAG,EAAE,SAAS,EAClB,GAAG,CAAC,GAAG,EAAE,SAAS,CACnB,CAAC;IACJ,CAAC;CACF;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,aAAa,CAC3B,YAAoB,EACpB,UAAsB;IAEtB,OAAO,IAAI,OAAO,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;AAC/C,CAAC"}
|
package/dist/symmetric.js
CHANGED
@@ -7,12 +7,20 @@ import { generateSymmetricKey, OneMillion, Version } from "./index.js";
|
|
7
7
|
export { generateSymmetricKey };
|
8
8
|
const log = debug("waku:message-encryption:symmetric");
|
9
9
|
class Encoder {
|
10
|
+
contentTopic;
|
11
|
+
symKey;
|
12
|
+
sigPrivKey;
|
13
|
+
ephemeral;
|
14
|
+
metaSetter;
|
10
15
|
constructor(contentTopic, symKey, sigPrivKey, ephemeral = false, metaSetter) {
|
11
16
|
this.contentTopic = contentTopic;
|
12
17
|
this.symKey = symKey;
|
13
18
|
this.sigPrivKey = sigPrivKey;
|
14
19
|
this.ephemeral = ephemeral;
|
15
20
|
this.metaSetter = metaSetter;
|
21
|
+
if (!contentTopic || contentTopic === "") {
|
22
|
+
throw new Error("Content topic must be specified");
|
23
|
+
}
|
16
24
|
}
|
17
25
|
async toWire(message) {
|
18
26
|
const protoMessage = await this.toProtoObj(message);
|
@@ -57,6 +65,7 @@ export function createEncoder({ contentTopic, symKey, sigPrivKey, ephemeral = fa
|
|
57
65
|
return new Encoder(contentTopic, symKey, sigPrivKey, ephemeral, metaSetter);
|
58
66
|
}
|
59
67
|
class Decoder extends DecoderV0 {
|
68
|
+
symKey;
|
60
69
|
constructor(contentTopic, symKey) {
|
61
70
|
super(contentTopic);
|
62
71
|
this.symKey = symKey;
|
package/dist/symmetric.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"symmetric.js","sourceRoot":"","sources":["../src/symmetric.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,kCAAkC,CAAC;AASxE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EACV,SAAS,GACV,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,oBAAoB,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAEvE,OAAO,EAAE,oBAAoB,EAAE,CAAC;AAGhC,MAAM,GAAG,GAAG,KAAK,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AAI,YAAY,CAAC,OAAO,KAAK,OAAO,EAAE;YACpC,GAAG,CACD,uDAAuD,EACvD,OAAO,EACP,WAAW,EACX,YAAY,CAAC,OAAO,CACrB,CAAC;YACF,OAAO;SACR;QAED,IAAI,OAAO,CAAC;QAEZ,IAAI;YACF,OAAO,GAAG,MAAM,gBAAgB,CAAC,aAAa,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;SAC9D;QAAC,OAAO,CAAC,EAAE;YACV,GAAG,CACD,2EAA2E,IAAI,CAAC,YAAY,EAAE,EAC9F,CAAC,CACF,CAAC;YACF,OAAO;SACR;QAED,IAAI,CAAC,OAAO,EAAE;YACZ,GAAG,CAAC,8CAA8C,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;YACvE,OAAO;SACR;QAED,MAAM,GAAG,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC,CAAC;QAEtC,IAAI,CAAC,GAAG,EAAE;YACR,GAAG,CAAC,6CAA6C,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;YACtE,OAAO;SACR;QAED,GAAG,CAAC,mBAAmB,EAAE,YAAY,CAAC,CAAC;QACvC,OAAO,IAAI,cAAc,CACvB,WAAW,EACX,YAAY,EACZ,GAAG,CAAC,OAAO,EACX,GAAG,CAAC,GAAG,EAAE,SAAS,EAClB,GAAG,CAAC,GAAG,EAAE,SAAS,CACnB,CAAC;IACJ,CAAC;CACF;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,aAAa,CAC3B,YAAoB,EACpB,MAAkB;IAElB,OAAO,IAAI,OAAO,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;AAC3C,CAAC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@waku/message-encryption",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.16",
|
4
4
|
"description": "Waku Message Payload Encryption",
|
5
5
|
"types": "./dist/index.d.ts",
|
6
6
|
"module": "./dist/index.js",
|
@@ -53,11 +53,9 @@
|
|
53
53
|
"build:esm": "tsc",
|
54
54
|
"build:bundle": "rollup --config rollup.config.js",
|
55
55
|
"fix": "run-s fix:*",
|
56
|
-
"fix:prettier": "prettier . --write",
|
57
56
|
"fix:lint": "eslint src *.js --fix",
|
58
57
|
"check": "run-s check:*",
|
59
58
|
"check:lint": "eslint src *.js",
|
60
|
-
"check:prettier": "prettier . --list-different",
|
61
59
|
"check:spelling": "cspell \"{README.md,src/**/*.ts}\"",
|
62
60
|
"check:tsc": "tsc -p tsconfig.dev.json",
|
63
61
|
"test": "run-s test:*",
|
@@ -74,10 +72,10 @@
|
|
74
72
|
},
|
75
73
|
"dependencies": {
|
76
74
|
"@noble/secp256k1": "^1.7.1",
|
77
|
-
"@waku/core": "0.0.
|
78
|
-
"@waku/interfaces": "0.0.
|
79
|
-
"@waku/proto": "
|
80
|
-
"@waku/utils": "0.0.
|
75
|
+
"@waku/core": "0.0.18",
|
76
|
+
"@waku/interfaces": "0.0.13",
|
77
|
+
"@waku/proto": "*",
|
78
|
+
"@waku/utils": "0.0.6",
|
81
79
|
"debug": "^4.3.4",
|
82
80
|
"js-sha3": "^0.8.0"
|
83
81
|
},
|
@@ -90,7 +88,7 @@
|
|
90
88
|
"@libp2p/interface-registrar": "^2.0.8",
|
91
89
|
"@rollup/plugin-commonjs": "^24.0.1",
|
92
90
|
"@rollup/plugin-json": "^6.0.0",
|
93
|
-
"@rollup/plugin-node-resolve": "^15.0.
|
91
|
+
"@rollup/plugin-node-resolve": "^15.0.2",
|
94
92
|
"@types/chai": "^4.3.4",
|
95
93
|
"@types/mocha": "^10.0.1",
|
96
94
|
"@typescript-eslint/eslint-plugin": "^5.57.0",
|
@@ -104,19 +102,19 @@
|
|
104
102
|
"eslint-plugin-functional": "^5.0.4",
|
105
103
|
"eslint-plugin-import": "^2.27.5",
|
106
104
|
"eslint-plugin-prettier": "^4.2.1",
|
107
|
-
"fast-check": "^3.
|
105
|
+
"fast-check": "^3.8.1",
|
108
106
|
"karma": "^6.4.1",
|
109
107
|
"karma-chrome-launcher": "^3.1.1",
|
110
108
|
"karma-mocha": "^2.0.1",
|
111
109
|
"karma-webpack": "^5.0.0",
|
112
110
|
"mocha": "^10.2.0",
|
113
111
|
"npm-run-all": "^4.1.5",
|
114
|
-
"prettier": "^2.8.
|
112
|
+
"prettier": "^2.8.8",
|
115
113
|
"process": "^0.11.10",
|
116
114
|
"puppeteer": "^19.8.2",
|
117
|
-
"rollup": "^3.
|
115
|
+
"rollup": "^3.21.3",
|
118
116
|
"ts-loader": "^9.4.2",
|
119
|
-
"typescript": "^
|
117
|
+
"typescript": "^5.0.4"
|
120
118
|
},
|
121
119
|
"typedoc": {
|
122
120
|
"entryPoint": "./src/index.ts"
|
package/src/ecies.ts
CHANGED
@@ -37,7 +37,11 @@ class Encoder implements IEncoder {
|
|
37
37
|
private sigPrivKey?: Uint8Array,
|
38
38
|
public ephemeral: boolean = false,
|
39
39
|
public metaSetter?: IMetaSetter
|
40
|
-
) {
|
40
|
+
) {
|
41
|
+
if (!contentTopic || contentTopic === "") {
|
42
|
+
throw new Error("Content topic must be specified");
|
43
|
+
}
|
44
|
+
}
|
41
45
|
|
42
46
|
async toWire(message: IMessage): Promise<Uint8Array | undefined> {
|
43
47
|
const protoMessage = await this.toProtoObj(message);
|
package/src/symmetric.ts
CHANGED
@@ -32,7 +32,11 @@ class Encoder implements IEncoder {
|
|
32
32
|
private sigPrivKey?: Uint8Array,
|
33
33
|
public ephemeral: boolean = false,
|
34
34
|
public metaSetter?: IMetaSetter
|
35
|
-
) {
|
35
|
+
) {
|
36
|
+
if (!contentTopic || contentTopic === "") {
|
37
|
+
throw new Error("Content topic must be specified");
|
38
|
+
}
|
39
|
+
}
|
36
40
|
|
37
41
|
async toWire(message: IMessage): Promise<Uint8Array | undefined> {
|
38
42
|
const protoMessage = await this.toProtoObj(message);
|