core-3nweb-client-lib 0.38.0 → 0.38.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.
@@ -167,12 +167,14 @@ declare namespace web3n.keys {
167
167
  interface IntroductorySendingPairInfo {
168
168
  type: 'intro';
169
169
  recipientKId: string;
170
+ alg: string;
170
171
  }
171
172
 
172
173
  interface RatchetedSendingPairInfo {
173
174
  type: 'ratcheted';
174
175
  pids: string[];
175
176
  timestamp: number;
177
+ alg: string;
176
178
  senderKId: string;
177
179
  recipientKId: string;
178
180
  sentMsgs?: {
@@ -183,6 +185,7 @@ declare namespace web3n.keys {
183
185
 
184
186
  interface ReceptionPairInfo {
185
187
  pids: string[];
188
+ alg: string;
186
189
  recipientKId: string;
187
190
  isSenderIntroKey?: boolean,
188
191
  senderKId: string;
@@ -21,23 +21,6 @@ export interface ReceptionPair {
21
21
  };
22
22
  timestamp: number;
23
23
  }
24
- /**
25
- * Sending pairs are a rotating public key cryptography key material for sending
26
- * messages.
27
- *
28
- * Let's note naming convention. Since this is a sending pair, this side of
29
- * communication is called a sender, while the other side is a recipient.
30
- */
31
- export interface BaseSendingPair {
32
- /**
33
- * This is recipients' public key, to which encryption is done.
34
- * If this is an introductory pair, this key is recipient's published intro
35
- * public key.
36
- * Else, if this is an ratcheted pair, this key comes from crypto material
37
- * that recipients suggests from time to time for further use.
38
- */
39
- recipientPKey: JsonKeyShort;
40
- }
41
24
  /**
42
25
  * Introductory pair appears when the first message is sent to a new
43
26
  * correspondent. By nature it is an introductory message that uses recipient's
@@ -48,14 +31,22 @@ export interface BaseSendingPair {
48
31
  * a flag that allows to distinguish it from ratcheted pair with a clean
49
32
  * if-statement.
50
33
  */
51
- export interface IntroductorySendingPair extends BaseSendingPair {
34
+ export interface IntroductorySendingPair {
52
35
  type: 'intro';
36
+ /**
37
+ * This is recipients' public key, to which encryption is done.
38
+ * If this is an introductory pair, this key is recipient's published intro
39
+ * public key.
40
+ * Else, if this is an ratcheted pair, this key comes from crypto material
41
+ * that recipients suggests from time to time for further use.
42
+ */
43
+ recipientPKey: JsonKey;
53
44
  }
54
45
  /**
55
46
  * Ratcheted sending pair is a sending pair with pair ids (pids), attached to
56
47
  * it. These ids are used to identify correct key material.
57
48
  */
58
- export interface RatchetedSendingPair extends BaseSendingPair {
49
+ export interface RatchetedSendingPair {
59
50
  type: 'ratcheted';
60
51
  pids: string[];
61
52
  timestamp: number;
@@ -67,6 +58,14 @@ export interface RatchetedSendingPair extends BaseSendingPair {
67
58
  * and is moved to the sending pair when it is used by the other side.
68
59
  */
69
60
  senderKey: JWKeyPair;
61
+ /**
62
+ * This is recipients' public key, to which encryption is done.
63
+ * If this is an introductory pair, this key is recipient's published intro
64
+ * public key.
65
+ * Else, if this is an ratcheted pair, this key comes from crypto material
66
+ * that recipients suggests from time to time for further use.
67
+ */
68
+ recipientPKey: JsonKeyShort;
70
69
  /**
71
70
  * This is a precomputed message master key that comes from a given pair.
72
71
  * This exist only as a speedup measure, to save time of public key crypto
@@ -370,6 +370,7 @@ function turnSendingPairToInfo(sp) {
370
370
  type: 'ratcheted',
371
371
  recipientKId: sp.recipientPKey.kid,
372
372
  senderKId: sp.senderKey.pkey.kid,
373
+ alg: sp.senderKey.pkey.alg,
373
374
  pids,
374
375
  timestamp,
375
376
  sentMsgs
@@ -378,7 +379,8 @@ function turnSendingPairToInfo(sp) {
378
379
  else if (sp.type === 'intro') {
379
380
  return {
380
381
  type: 'intro',
381
- recipientKId: sp.recipientPKey.kid
382
+ recipientKId: sp.recipientPKey.kid,
383
+ alg: sp.recipientPKey.alg
382
384
  };
383
385
  }
384
386
  else {
@@ -389,6 +391,7 @@ function turnReceptionPairToInfo(rp) {
389
391
  const { pids, timestamp, receivedMsgs, isSenderIntroKey } = rp;
390
392
  return {
391
393
  pids, timestamp, receivedMsgs, isSenderIntroKey,
394
+ alg: rp.recipientKey.pkey.alg,
392
395
  recipientKId: rp.recipientKey.pkey.kid,
393
396
  senderKId: rp.senderPKey.kid
394
397
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "core-3nweb-client-lib",
3
- "version": "0.38.0",
3
+ "version": "0.38.1",
4
4
  "description": "3NWeb client core library, embeddable into different environments",
5
5
  "main": "build/lib-index.js",
6
6
  "types": "build/lib-index.d.ts",