@nmshd/crypto 1.0.9 → 2.0.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 (106) hide show
  1. package/dist/CoreBuffer.d.ts +0 -1
  2. package/dist/CoreBuffer.js +1 -4
  3. package/dist/CoreBuffer.js.map +1 -1
  4. package/dist/CryptoDerivation.js +2 -2
  5. package/dist/CryptoDerivation.js.map +1 -1
  6. package/dist/CryptoPrivateKey.d.ts +7 -10
  7. package/dist/CryptoPrivateKey.js +18 -33
  8. package/dist/CryptoPrivateKey.js.map +1 -1
  9. package/dist/CryptoPublicKey.d.ts +6 -9
  10. package/dist/CryptoPublicKey.js +16 -31
  11. package/dist/CryptoPublicKey.js.map +1 -1
  12. package/dist/CryptoSerializable.js.map +1 -1
  13. package/dist/CryptoValidation.d.ts +4 -6
  14. package/dist/CryptoValidation.js +16 -29
  15. package/dist/CryptoValidation.js.map +1 -1
  16. package/dist/buildInformation.js +4 -4
  17. package/dist/encryption/CryptoCipher.d.ts +5 -6
  18. package/dist/encryption/CryptoCipher.js +59 -56
  19. package/dist/encryption/CryptoCipher.js.map +1 -1
  20. package/dist/encryption/CryptoEncryption.js +10 -12
  21. package/dist/encryption/CryptoEncryption.js.map +1 -1
  22. package/dist/encryption/CryptoSecretKey.d.ts +3 -4
  23. package/dist/encryption/CryptoSecretKey.js +34 -30
  24. package/dist/encryption/CryptoSecretKey.js.map +1 -1
  25. package/dist/exchange/CryptoExchange.d.ts +0 -2
  26. package/dist/exchange/CryptoExchange.js +3 -20
  27. package/dist/exchange/CryptoExchange.js.map +1 -1
  28. package/dist/exchange/CryptoExchangeKeypair.d.ts +3 -4
  29. package/dist/exchange/CryptoExchangeKeypair.js +29 -22
  30. package/dist/exchange/CryptoExchangeKeypair.js.map +1 -1
  31. package/dist/exchange/CryptoExchangePrivateKey.d.ts +3 -5
  32. package/dist/exchange/CryptoExchangePrivateKey.js +50 -31
  33. package/dist/exchange/CryptoExchangePrivateKey.js.map +1 -1
  34. package/dist/exchange/CryptoExchangePublicKey.d.ts +3 -4
  35. package/dist/exchange/CryptoExchangePublicKey.js +28 -29
  36. package/dist/exchange/CryptoExchangePublicKey.js.map +1 -1
  37. package/dist/exchange/CryptoExchangeSecrets.d.ts +4 -5
  38. package/dist/exchange/CryptoExchangeSecrets.js +32 -34
  39. package/dist/exchange/CryptoExchangeSecrets.js.map +1 -1
  40. package/dist/exchange/CryptoExchangeValidation.d.ts +7 -10
  41. package/dist/exchange/CryptoExchangeValidation.js +9 -36
  42. package/dist/exchange/CryptoExchangeValidation.js.map +1 -1
  43. package/dist/index.d.ts +1 -0
  44. package/dist/index.js +1 -0
  45. package/dist/index.js.map +1 -1
  46. package/dist/relationship/CryptoRelationshipPublicRequest.d.ts +1 -2
  47. package/dist/relationship/CryptoRelationshipPublicRequest.js +19 -34
  48. package/dist/relationship/CryptoRelationshipPublicRequest.js.map +1 -1
  49. package/dist/relationship/CryptoRelationshipPublicResponse.d.ts +1 -2
  50. package/dist/relationship/CryptoRelationshipPublicResponse.js +20 -30
  51. package/dist/relationship/CryptoRelationshipPublicResponse.js.map +1 -1
  52. package/dist/relationship/CryptoRelationshipRequestSecrets.d.ts +0 -1
  53. package/dist/relationship/CryptoRelationshipRequestSecrets.js +1 -4
  54. package/dist/relationship/CryptoRelationshipRequestSecrets.js.map +1 -1
  55. package/dist/relationship/CryptoRelationshipSecrets.d.ts +0 -1
  56. package/dist/relationship/CryptoRelationshipSecrets.js +1 -4
  57. package/dist/relationship/CryptoRelationshipSecrets.js.map +1 -1
  58. package/dist/signature/CryptoSignature.d.ts +5 -6
  59. package/dist/signature/CryptoSignature.js +36 -32
  60. package/dist/signature/CryptoSignature.js.map +1 -1
  61. package/dist/signature/CryptoSignatureAlgorithm.d.ts +5 -0
  62. package/dist/signature/CryptoSignatureAlgorithm.js +3 -0
  63. package/dist/signature/CryptoSignatureAlgorithm.js.map +1 -0
  64. package/dist/signature/CryptoSignatureKeypair.d.ts +3 -4
  65. package/dist/signature/CryptoSignatureKeypair.js +32 -30
  66. package/dist/signature/CryptoSignatureKeypair.js.map +1 -1
  67. package/dist/signature/CryptoSignaturePrivateKey.d.ts +5 -8
  68. package/dist/signature/CryptoSignaturePrivateKey.js +24 -35
  69. package/dist/signature/CryptoSignaturePrivateKey.js.map +1 -1
  70. package/dist/signature/CryptoSignaturePublicKey.d.ts +4 -7
  71. package/dist/signature/CryptoSignaturePublicKey.js +19 -41
  72. package/dist/signature/CryptoSignaturePublicKey.js.map +1 -1
  73. package/dist/signature/CryptoSignatureValidation.d.ts +10 -12
  74. package/dist/signature/CryptoSignatureValidation.js +13 -35
  75. package/dist/signature/CryptoSignatureValidation.js.map +1 -1
  76. package/dist/signature/CryptoSignatures.d.ts +1 -5
  77. package/dist/signature/CryptoSignatures.js +4 -4
  78. package/dist/signature/CryptoSignatures.js.map +1 -1
  79. package/dist/state/CryptoPrivateState.d.ts +7 -15
  80. package/dist/state/CryptoPrivateState.js +72 -76
  81. package/dist/state/CryptoPrivateState.js.map +1 -1
  82. package/dist/state/CryptoPrivateStateReceive.d.ts +2 -4
  83. package/dist/state/CryptoPrivateStateReceive.js +27 -39
  84. package/dist/state/CryptoPrivateStateReceive.js.map +1 -1
  85. package/dist/state/CryptoPrivateStateTransmit.d.ts +1 -2
  86. package/dist/state/CryptoPrivateStateTransmit.js +14 -40
  87. package/dist/state/CryptoPrivateStateTransmit.js.map +1 -1
  88. package/dist/state/CryptoPublicState.d.ts +5 -10
  89. package/dist/state/CryptoPublicState.js +42 -51
  90. package/dist/state/CryptoPublicState.js.map +1 -1
  91. package/dist/stream/CryptoStream.js +5 -2
  92. package/dist/stream/CryptoStream.js.map +1 -1
  93. package/dist/stream/CryptoStreamAddress.d.ts +3 -6
  94. package/dist/stream/CryptoStreamAddress.js +13 -29
  95. package/dist/stream/CryptoStreamAddress.js.map +1 -1
  96. package/dist/stream/CryptoStreamHeader.d.ts +5 -8
  97. package/dist/stream/CryptoStreamHeader.js +15 -18
  98. package/dist/stream/CryptoStreamHeader.js.map +1 -1
  99. package/dist/stream/CryptoStreamState.d.ts +3 -7
  100. package/dist/stream/CryptoStreamState.js +14 -32
  101. package/dist/stream/CryptoStreamState.js.map +1 -1
  102. package/lib-web/nmshd.crypto.js +701 -914
  103. package/lib-web/nmshd.crypto.js.map +1 -1
  104. package/lib-web/nmshd.crypto.min.js +1 -1
  105. package/lib-web/nmshd.crypto.min.js.map +1 -1
  106. package/package.json +3 -3
@@ -8,63 +8,82 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
8
8
  var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
- var CryptoExchangePrivateKey_1;
12
11
  Object.defineProperty(exports, "__esModule", { value: true });
13
12
  exports.CryptoExchangePrivateKey = void 0;
14
13
  const ts_serval_1 = require("@js-soft/ts-serval");
15
14
  const CoreBuffer_1 = require("../CoreBuffer");
15
+ const CryptoError_1 = require("../CryptoError");
16
+ const CryptoErrorCode_1 = require("../CryptoErrorCode");
16
17
  const CryptoPrivateKey_1 = require("../CryptoPrivateKey");
17
- const CryptoExchange_1 = require("./CryptoExchange");
18
+ const SodiumWrapper_1 = require("../SodiumWrapper");
19
+ const CryptoExchangePublicKey_1 = require("./CryptoExchangePublicKey");
18
20
  const CryptoExchangeValidation_1 = require("./CryptoExchangeValidation");
19
- let CryptoExchangePrivateKey = CryptoExchangePrivateKey_1 = class CryptoExchangePrivateKey extends CryptoPrivateKey_1.CryptoPrivateKey {
20
- constructor(algorithm, privateKey) {
21
- CryptoExchangeValidation_1.CryptoExchangeValidation.checkExchangeAlgorithm(algorithm);
22
- CryptoExchangeValidation_1.CryptoExchangeValidation.checkExchangePrivateKeyAsBuffer(privateKey, algorithm);
23
- super(algorithm, privateKey);
24
- this.algorithm = algorithm;
25
- this.privateKey = privateKey;
26
- }
21
+ let CryptoExchangePrivateKey = class CryptoExchangePrivateKey extends CryptoPrivateKey_1.CryptoPrivateKey {
27
22
  toJSON(verbose = true) {
28
- const obj = {
23
+ return {
29
24
  prv: this.privateKey.toBase64URL(),
30
- alg: this.algorithm
25
+ alg: this.algorithm,
26
+ "@type": verbose ? "CryptoExchangePrivateKey" : undefined
31
27
  };
32
- if (verbose) {
33
- obj["@type"] = "CryptoExchangePrivateKey";
34
- }
35
- return obj;
36
28
  }
37
29
  clear() {
38
30
  this.privateKey.clear();
39
31
  }
40
- serialize(verbose = true) {
41
- return JSON.stringify(this.toJSON(verbose));
42
- }
43
32
  toBase64(verbose = true) {
44
33
  return CoreBuffer_1.CoreBuffer.utf8_base64(this.serialize(verbose));
45
34
  }
46
35
  async toPublicKey() {
47
- return await CryptoExchange_1.CryptoExchange.privateKeyToPublicKey(this);
36
+ let publicKey;
37
+ switch (this.algorithm) {
38
+ case 3 /* ECDH_X25519 */:
39
+ try {
40
+ publicKey = (await SodiumWrapper_1.SodiumWrapper.ready()).crypto_scalarmult_base(this.privateKey.buffer);
41
+ }
42
+ catch (e) {
43
+ throw new CryptoError_1.CryptoError(CryptoErrorCode_1.CryptoErrorCode.ExchangeKeyGeneration, `${e}`);
44
+ }
45
+ break;
46
+ default:
47
+ throw new CryptoError_1.CryptoError(CryptoErrorCode_1.CryptoErrorCode.NotYetImplemented);
48
+ }
49
+ return CryptoExchangePublicKey_1.CryptoExchangePublicKey.from({
50
+ algorithm: this.algorithm,
51
+ publicKey: CoreBuffer_1.CoreBuffer.from(publicKey)
52
+ });
48
53
  }
49
54
  static from(value) {
50
- return new CryptoExchangePrivateKey_1(value.algorithm, CoreBuffer_1.CoreBuffer.from(value.privateKey));
55
+ return this.fromAny(value);
56
+ }
57
+ static preFrom(value) {
58
+ if (value.alg) {
59
+ value = {
60
+ algorithm: value.alg,
61
+ privateKey: CoreBuffer_1.CoreBuffer.fromBase64URL(value.prv)
62
+ };
63
+ }
64
+ CryptoExchangeValidation_1.CryptoExchangeValidation.checkExchangeAlgorithm(value.algorithm);
65
+ CryptoExchangeValidation_1.CryptoExchangeValidation.checkExchangePrivateKey(value.privateKey, value.algorithm, "privateKey");
66
+ return value;
51
67
  }
52
68
  static fromJSON(value) {
53
- CryptoExchangeValidation_1.CryptoExchangeValidation.checkExchangeAlgorithm(value.alg);
54
- CryptoExchangeValidation_1.CryptoExchangeValidation.checkExchangePrivateKeyAsNumber(value.prv, value.alg, "privateKey");
55
- const buffer = CoreBuffer_1.CoreBuffer.fromBase64URL(value.prv);
56
- return new CryptoExchangePrivateKey_1(value.alg, buffer);
69
+ return this.fromAny(value);
57
70
  }
58
71
  static fromBase64(value) {
59
72
  return this.deserialize(CoreBuffer_1.CoreBuffer.base64_utf8(value));
60
73
  }
61
- static deserialize(value) {
62
- return this.fromJSON(JSON.parse(value));
63
- }
64
74
  };
65
- CryptoExchangePrivateKey = CryptoExchangePrivateKey_1 = __decorate([
66
- (0, ts_serval_1.type)("CryptoExchangePrivateKey"),
67
- __metadata("design:paramtypes", [Number, CoreBuffer_1.CoreBuffer])
75
+ __decorate([
76
+ (0, ts_serval_1.validate)(),
77
+ (0, ts_serval_1.serialize)(),
78
+ __metadata("design:type", Number)
79
+ ], CryptoExchangePrivateKey.prototype, "algorithm", void 0);
80
+ __decorate([
81
+ (0, ts_serval_1.validate)(),
82
+ (0, ts_serval_1.serialize)(),
83
+ __metadata("design:type", CoreBuffer_1.CoreBuffer)
84
+ ], CryptoExchangePrivateKey.prototype, "privateKey", void 0);
85
+ CryptoExchangePrivateKey = __decorate([
86
+ (0, ts_serval_1.type)("CryptoExchangePrivateKey")
68
87
  ], CryptoExchangePrivateKey);
69
88
  exports.CryptoExchangePrivateKey = CryptoExchangePrivateKey;
70
89
  //# sourceMappingURL=CryptoExchangePrivateKey.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CryptoExchangePrivateKey.js","sourceRoot":"","sources":["../../src/exchange/CryptoExchangePrivateKey.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,kDAAsE;AACtE,8CAAo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AC;aAClD,CAAC;SACL;QAED,mDAAwB,CAAC,sBAAsB,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QACjE,mDAAwB,CAAC,uBAAuB,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;QAElG,OAAO,KAAK,CAAC;IACjB,CAAC;IAEM,MAAM,CAAC,QAAQ,CAAC,KAA0C;QAC7D,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IAEM,MAAM,CAAU,UAAU,CAAC,KAAa;QAC3C,OAAO,IAAI,CAAC,WAAW,CAAC,uBAAU,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;IAC3D,CAAC;CACJ,CAAA;AAnEG;IAFC,IAAA,oBAAQ,GAAE;IACV,IAAA,qBAAS,GAAE;;2DACuC;AAInD;IAFC,IAAA,oBAAQ,GAAE;IACV,IAAA,qBAAS,GAAE;8BACgB,uBAAU;4DAAC;AAP9B,wBAAwB;IADpC,IAAA,gBAAI,EAAC,0BAA0B,CAAC;GACpB,wBAAwB,CAsEpC;AAtEY,4DAAwB"}
@@ -11,13 +11,12 @@ export interface ICryptoExchangePublicKey {
11
11
  publicKey: CoreBuffer;
12
12
  }
13
13
  export declare class CryptoExchangePublicKey extends CryptoPublicKey implements ICryptoExchangePublicKey, IClearable {
14
- readonly algorithm: CryptoExchangeAlgorithm;
15
- readonly publicKey: CoreBuffer;
16
- constructor(algorithm: CryptoExchangeAlgorithm, publicKey: CoreBuffer);
14
+ algorithm: CryptoExchangeAlgorithm;
15
+ publicKey: CoreBuffer;
17
16
  toJSON(verbose?: boolean): ICryptoExchangePublicKeySerialized;
18
17
  clear(): void;
18
+ protected static preFrom(value: any): any;
19
19
  static from(value: CryptoExchangePublicKey | ICryptoExchangePublicKey): CryptoExchangePublicKey;
20
20
  static fromJSON(value: ICryptoExchangePublicKeySerialized): CryptoExchangePublicKey;
21
21
  static fromBase64(value: string): CryptoExchangePublicKey;
22
- static deserialize(value: string): CryptoExchangePublicKey;
23
22
  }
@@ -8,57 +8,56 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
8
8
  var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
- var CryptoExchangePublicKey_1;
12
11
  Object.defineProperty(exports, "__esModule", { value: true });
13
12
  exports.CryptoExchangePublicKey = void 0;
14
13
  const ts_serval_1 = require("@js-soft/ts-serval");
15
14
  const CoreBuffer_1 = require("../CoreBuffer");
16
15
  const CryptoPublicKey_1 = require("../CryptoPublicKey");
17
16
  const CryptoExchangeValidation_1 = require("./CryptoExchangeValidation");
18
- let CryptoExchangePublicKey = CryptoExchangePublicKey_1 = class CryptoExchangePublicKey extends CryptoPublicKey_1.CryptoPublicKey {
19
- constructor(algorithm, publicKey) {
20
- CryptoExchangeValidation_1.CryptoExchangeValidation.checkExchangeAlgorithm(algorithm);
21
- CryptoExchangeValidation_1.CryptoExchangeValidation.checkExchangePublicKeyAsBuffer(publicKey, algorithm);
22
- super(algorithm, publicKey);
23
- this.algorithm = algorithm;
24
- this.publicKey = publicKey;
25
- }
17
+ let CryptoExchangePublicKey = class CryptoExchangePublicKey extends CryptoPublicKey_1.CryptoPublicKey {
26
18
  toJSON(verbose = true) {
27
- const obj = {
19
+ return {
20
+ "@type": verbose ? "CryptoExchangePublicKey" : undefined,
28
21
  pub: this.publicKey.toBase64URL(),
29
22
  alg: this.algorithm
30
23
  };
31
- if (verbose) {
32
- obj["@type"] = "CryptoExchangePublicKey";
33
- }
34
- return obj;
35
24
  }
36
25
  clear() {
37
26
  this.publicKey.clear();
38
27
  }
28
+ static preFrom(value) {
29
+ if (value.alg) {
30
+ value = {
31
+ algorithm: value.alg,
32
+ publicKey: value.pub
33
+ };
34
+ }
35
+ CryptoExchangeValidation_1.CryptoExchangeValidation.checkExchangeAlgorithm(value.algorithm);
36
+ CryptoExchangeValidation_1.CryptoExchangeValidation.checkExchangePublicKey(value.publicKey, value.algorithm);
37
+ return value;
38
+ }
39
39
  static from(value) {
40
- return new CryptoExchangePublicKey_1(value.algorithm, value.publicKey);
40
+ return this.fromAny(value);
41
41
  }
42
42
  static fromJSON(value) {
43
- CryptoExchangeValidation_1.CryptoExchangeValidation.checkExchangeAlgorithm(value.alg);
44
- CryptoExchangeValidation_1.CryptoExchangeValidation.checkExchangePrivateKeyAsNumber(value.pub, value.alg, "publicKey");
45
- const buffer = CoreBuffer_1.CoreBuffer.fromBase64URL(value.pub);
46
- return this.from({
47
- algorithm: value.alg,
48
- publicKey: buffer
49
- });
43
+ return this.fromAny(value);
50
44
  }
51
45
  static fromBase64(value) {
52
46
  return this.deserialize(CoreBuffer_1.CoreBuffer.base64_utf8(value));
53
47
  }
54
- static deserialize(value) {
55
- const obj = JSON.parse(value);
56
- return this.fromJSON(obj);
57
- }
58
48
  };
59
- CryptoExchangePublicKey = CryptoExchangePublicKey_1 = __decorate([
60
- (0, ts_serval_1.type)("CryptoExchangePublicKey"),
61
- __metadata("design:paramtypes", [Number, CoreBuffer_1.CoreBuffer])
49
+ __decorate([
50
+ (0, ts_serval_1.validate)(),
51
+ (0, ts_serval_1.serialize)(),
52
+ __metadata("design:type", Number)
53
+ ], CryptoExchangePublicKey.prototype, "algorithm", void 0);
54
+ __decorate([
55
+ (0, ts_serval_1.validate)(),
56
+ (0, ts_serval_1.serialize)(),
57
+ __metadata("design:type", CoreBuffer_1.CoreBuffer)
58
+ ], CryptoExchangePublicKey.prototype, "publicKey", void 0);
59
+ CryptoExchangePublicKey = __decorate([
60
+ (0, ts_serval_1.type)("CryptoExchangePublicKey")
62
61
  ], CryptoExchangePublicKey);
63
62
  exports.CryptoExchangePublicKey = CryptoExchangePublicKey;
64
63
  //# sourceMappingURL=CryptoExchangePublicKey.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CryptoExchangePublicKey.js","sourceRoot":"","sources":["../../src/exchange/Crypto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AAK,CAAC,GAAG;aACvB,CAAC;SACL;QAED,mDAAwB,CAAC,sBAAsB,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QACjE,mDAAwB,CAAC,sBAAsB,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;QAElF,OAAO,KAAK,CAAC;IACjB,CAAC;IAEM,MAAM,CAAU,IAAI,CAAC,KAAyD;QACjF,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IAEM,MAAM,CAAC,QAAQ,CAAC,KAAyC;QAC5D,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IAEM,MAAM,CAAU,UAAU,CAAC,KAAa;QAC3C,OAAO,IAAI,CAAC,WAAW,CAAC,uBAAU,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;IAC3D,CAAC;CACJ,CAAA;AA3CG;IAFC,IAAA,oBAAQ,GAAE;IACV,IAAA,qBAAS,GAAE;;0DACuC;AAInD;IAFC,IAAA,oBAAQ,GAAE;IACV,IAAA,qBAAS,GAAE;8BACe,uBAAU;0DAAC;AAP7B,uBAAuB;IADnC,IAAA,gBAAI,EAAC,yBAAyB,CAAC;GACnB,uBAAuB,CA8CnC;AA9CY,0DAAuB"}
@@ -13,16 +13,15 @@ export interface ICryptoExchangeSecrets extends ISerializable {
13
13
  transmissionKey: ICoreBuffer;
14
14
  }
15
15
  export declare class CryptoExchangeSecrets extends CryptoSerializable implements ICryptoExchangeSecrets, IClearable {
16
- readonly algorithm: CryptoEncryptionAlgorithm;
17
- readonly receivingKey: CoreBuffer;
18
- readonly transmissionKey: CoreBuffer;
19
- constructor(receivingKey: CoreBuffer, transmissionKey: CoreBuffer, algorithm: CryptoEncryptionAlgorithm);
16
+ algorithm: CryptoEncryptionAlgorithm;
17
+ receivingKey: CoreBuffer;
18
+ transmissionKey: CoreBuffer;
20
19
  toJSON(verbose?: boolean): ICryptoExchangeSecretsSerialized;
21
20
  clear(): void;
22
21
  serialize(verbose?: boolean): string;
23
22
  toBase64(verbose?: boolean): string;
24
23
  static from(value: CryptoExchangeSecrets | ICryptoExchangeSecrets): CryptoExchangeSecrets;
24
+ static preFrom(value: any): any;
25
25
  static fromJSON(value: ICryptoExchangeSecretsSerialized): CryptoExchangeSecrets;
26
26
  static fromBase64(value: string): Promise<CryptoExchangeSecrets>;
27
- static deserialize(value: string): CryptoExchangeSecrets;
28
27
  }
@@ -8,29 +8,19 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
8
8
  var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
- var CryptoExchangeSecrets_1;
12
11
  Object.defineProperty(exports, "__esModule", { value: true });
13
12
  exports.CryptoExchangeSecrets = void 0;
14
13
  const ts_serval_1 = require("@js-soft/ts-serval");
15
14
  const CoreBuffer_1 = require("../CoreBuffer");
16
15
  const CryptoSerializable_1 = require("../CryptoSerializable");
17
- let CryptoExchangeSecrets = CryptoExchangeSecrets_1 = class CryptoExchangeSecrets extends CryptoSerializable_1.CryptoSerializable {
18
- constructor(receivingKey, transmissionKey, algorithm) {
19
- super();
20
- this.receivingKey = receivingKey;
21
- this.transmissionKey = transmissionKey;
22
- this.algorithm = algorithm;
23
- }
16
+ let CryptoExchangeSecrets = class CryptoExchangeSecrets extends CryptoSerializable_1.CryptoSerializable {
24
17
  toJSON(verbose = true) {
25
- const obj = {
18
+ return {
26
19
  rx: this.receivingKey.toBase64URL(),
27
20
  tx: this.transmissionKey.toBase64URL(),
28
- alg: this.algorithm
21
+ alg: this.algorithm,
22
+ "@type": verbose ? "CryptoExchangeSecrets" : undefined
29
23
  };
30
- if (verbose) {
31
- obj["@type"] = "CryptoExchangeSecrets";
32
- }
33
- return obj;
34
24
  }
35
25
  clear() {
36
26
  this.receivingKey.clear();
@@ -43,34 +33,42 @@ let CryptoExchangeSecrets = CryptoExchangeSecrets_1 = class CryptoExchangeSecret
43
33
  return CoreBuffer_1.CoreBuffer.utf8_base64(this.serialize(verbose));
44
34
  }
45
35
  static from(value) {
46
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
47
- if (!value.algorithm || !value.receivingKey || !value.transmissionKey) {
48
- throw new Error("No algorithm, receivingKey or transmissionKey property set.");
36
+ return this.fromAny(value);
37
+ }
38
+ static preFrom(value) {
39
+ if (value.rx) {
40
+ value = {
41
+ algorithm: value.alg,
42
+ receivingKey: value.rx,
43
+ transmissionKey: value.tx
44
+ };
49
45
  }
50
- const receivingKey = CoreBuffer_1.CoreBuffer.from(value.receivingKey);
51
- const transmissionKey = CoreBuffer_1.CoreBuffer.from(value.transmissionKey);
52
- return new CryptoExchangeSecrets_1(receivingKey, transmissionKey, value.algorithm);
46
+ return value;
53
47
  }
54
48
  static fromJSON(value) {
55
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
56
- if (!value.alg || !value.rx || !value.tx) {
57
- throw new Error("No algorithm, receivingKey or transmissionKey property set.");
58
- }
59
- const receivingKey = CoreBuffer_1.CoreBuffer.fromBase64URL(value.rx);
60
- const transmissionKey = CoreBuffer_1.CoreBuffer.fromBase64URL(value.tx);
61
- return new CryptoExchangeSecrets_1(receivingKey, transmissionKey, value.alg);
49
+ return this.fromAny(value);
62
50
  }
63
51
  static fromBase64(value) {
64
52
  return Promise.resolve(this.deserialize(CoreBuffer_1.CoreBuffer.base64_utf8(value)));
65
53
  }
66
- static deserialize(value) {
67
- const obj = JSON.parse(value);
68
- return this.fromJSON(obj);
69
- }
70
54
  };
71
- CryptoExchangeSecrets = CryptoExchangeSecrets_1 = __decorate([
72
- (0, ts_serval_1.type)("CryptoExchangeSecrets"),
73
- __metadata("design:paramtypes", [CoreBuffer_1.CoreBuffer, CoreBuffer_1.CoreBuffer, Number])
55
+ __decorate([
56
+ (0, ts_serval_1.validate)(),
57
+ (0, ts_serval_1.serialize)(),
58
+ __metadata("design:type", Number)
59
+ ], CryptoExchangeSecrets.prototype, "algorithm", void 0);
60
+ __decorate([
61
+ (0, ts_serval_1.validate)(),
62
+ (0, ts_serval_1.serialize)(),
63
+ __metadata("design:type", CoreBuffer_1.CoreBuffer)
64
+ ], CryptoExchangeSecrets.prototype, "receivingKey", void 0);
65
+ __decorate([
66
+ (0, ts_serval_1.validate)(),
67
+ (0, ts_serval_1.serialize)(),
68
+ __metadata("design:type", CoreBuffer_1.CoreBuffer)
69
+ ], CryptoExchangeSecrets.prototype, "transmissionKey", void 0);
70
+ CryptoExchangeSecrets = __decorate([
71
+ (0, ts_serval_1.type)("CryptoExchangeSecrets")
74
72
  ], CryptoExchangeSecrets);
75
73
  exports.CryptoExchangeSecrets = CryptoExchangeSecrets;
76
74
  //# sourceMappingURL=CryptoExchangeSecrets.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CryptoExchangeSecrets.js","sourceRoot":"","sources":["../../src/exchange/CryptoExchangeSecrets.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,kDAAsE;AACtE,8CAAoE;AACpE,8DAA2D;AAgB3D,IAAa,qBAAqB,6BAAlC,MAAa,qBAAsB,SAAQ,uCAAkB;IAKzD,YAAmB,YAAwB,EAAE,eAA2B,EAAE,SAAoC;QAC1G,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC/B,CAAC;IAEM,MAAM,CAAC,OAAO,GAAG,IAAI;QACxB,MAAM,GAAG,GAAqC;YAC1C,EAAE,EAAE,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE;YACnC,EAAE,EAAE,IAAI,CAAC,eAAe,CAAC,WAAW,EAAE;YACtC,GAAG,EAAE,IAAI,CAAC,SAAS;SACtB,CAAC;QACF,IAAI,OAAO,EAAE;YACT,GAAG,CAAC,OAAO,CAAC,GAAG,uBA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DAAqB"}
@@ -2,19 +2,16 @@ import { CoreBuffer } from "../CoreBuffer";
2
2
  import { CryptoError } from "../CryptoError";
3
3
  import { CryptoValidation } from "../CryptoValidation";
4
4
  import { CryptoExchangeAlgorithm } from "./CryptoExchange";
5
- import { CryptoExchangePrivateKey } from "./CryptoExchangePrivateKey";
6
- import { CryptoExchangePublicKey } from "./CryptoExchangePublicKey";
7
5
  export declare class CryptoExchangeValidation extends CryptoValidation {
8
- static readonly PRIVATE_KEY_MIN_BYTES: number;
9
- static readonly PRIVATE_KEY_MAX_BYTES: number;
10
- static readonly PUBLIC_KEY_MIN_BYTES: number;
11
- static readonly PUBLIC_KEY_MAX_BYTES: number;
6
+ static readonly PRIVATE_KEY_MIN_BYTES = 20;
7
+ static readonly PRIVATE_KEY_MAX_BYTES = 40;
8
+ static readonly PUBLIC_KEY_MIN_BYTES = 20;
9
+ static readonly PUBLIC_KEY_MAX_BYTES = 40;
12
10
  static checkExchangeAlgorithm(algorithm: number, throwError?: boolean): CryptoError | undefined;
13
- static checkExchangePrivateKeyAsNumber(privateKey: string, algorithm: CryptoExchangeAlgorithm, propertyName?: string, throwError?: boolean): CryptoError | undefined;
11
+ static checkExchangePrivateKeyAsString(privateKey: string, algorithm: CryptoExchangeAlgorithm, propertyName?: string, throwError?: boolean): CryptoError | undefined;
14
12
  static checkExchangePrivateKeyAsBuffer(privateKey: CoreBuffer, algorithm: CryptoExchangeAlgorithm, propertyName?: string, throwError?: boolean): CryptoError | undefined;
15
- static checkExchangePrivateKey(privateKey: CryptoExchangePrivateKey, throwError?: boolean): CryptoError | undefined;
13
+ static checkExchangePrivateKey(privateKey: string | CoreBuffer, algorithm: CryptoExchangeAlgorithm, propertyName?: string, throwError?: boolean): CryptoError | undefined;
16
14
  static checkExchangePublicKeyAsString(publicKey: string, algorithm: CryptoExchangeAlgorithm, propertyName?: string, throwError?: boolean): CryptoError | undefined;
17
15
  static checkExchangePublicKeyAsBuffer(publicKey: CoreBuffer, algorithm: CryptoExchangeAlgorithm, propertyName?: string, throwError?: boolean): CryptoError | undefined;
18
- static checkExchangePublicKey(publicKey: CryptoExchangePublicKey, throwError?: boolean): CryptoError | undefined;
19
- static checkExchangeKeypair(privateKey: CryptoExchangePrivateKey, publicKey: CryptoExchangePublicKey, throwError?: boolean): CryptoError | undefined;
16
+ static checkExchangePublicKey(publicKey: string | CoreBuffer, algorithm: CryptoExchangeAlgorithm, propertyName?: string, throwError?: boolean): CryptoError | undefined;
20
17
  }
@@ -4,8 +4,6 @@ exports.CryptoExchangeValidation = void 0;
4
4
  const CryptoError_1 = require("../CryptoError");
5
5
  const CryptoErrorCode_1 = require("../CryptoErrorCode");
6
6
  const CryptoValidation_1 = require("../CryptoValidation");
7
- const CryptoExchangePrivateKey_1 = require("./CryptoExchangePrivateKey");
8
- const CryptoExchangePublicKey_1 = require("./CryptoExchangePublicKey");
9
7
  class CryptoExchangeValidation extends CryptoValidation_1.CryptoValidation {
10
8
  static checkExchangeAlgorithm(algorithm, throwError = true) {
11
9
  let error;
@@ -22,20 +20,17 @@ class CryptoExchangeValidation extends CryptoValidation_1.CryptoValidation {
22
20
  throw error;
23
21
  return error;
24
22
  }
25
- static checkExchangePrivateKeyAsNumber(privateKey, algorithm, propertyName = "privateKey", throwError = true) {
23
+ static checkExchangePrivateKeyAsString(privateKey, algorithm, propertyName = "privateKey", throwError = true) {
26
24
  return super.checkSerializedBuffer(privateKey, this.PRIVATE_KEY_MIN_BYTES, this.PRIVATE_KEY_MAX_BYTES, propertyName, throwError);
27
25
  }
28
26
  static checkExchangePrivateKeyAsBuffer(privateKey, algorithm, propertyName = "privateKey", throwError = true) {
29
27
  return super.checkBuffer(privateKey, this.PRIVATE_KEY_MIN_BYTES, this.PRIVATE_KEY_MAX_BYTES, propertyName, throwError);
30
28
  }
31
- static checkExchangePrivateKey(privateKey, throwError = true) {
32
- let error;
33
- if (!(privateKey instanceof CryptoExchangePrivateKey_1.CryptoExchangePrivateKey)) {
34
- error = new CryptoError_1.CryptoError(CryptoErrorCode_1.CryptoErrorCode.ExchangeWrongPrivateKey, "PrivateKey is not set or supported.");
29
+ static checkExchangePrivateKey(privateKey, algorithm, propertyName = "privateKey", throwError = true) {
30
+ if (typeof privateKey === "string") {
31
+ return this.checkExchangePrivateKeyAsString(privateKey, algorithm, propertyName, throwError);
35
32
  }
36
- if (error && throwError)
37
- throw error;
38
- return error;
33
+ return this.checkExchangePrivateKeyAsBuffer(privateKey, algorithm, propertyName, throwError);
39
34
  }
40
35
  static checkExchangePublicKeyAsString(publicKey, algorithm, propertyName = "publicKey", throwError = true) {
41
36
  return super.checkSerializedBuffer(publicKey, this.PRIVATE_KEY_MIN_BYTES, this.PRIVATE_KEY_MAX_BYTES, propertyName, throwError);
@@ -43,33 +38,11 @@ class CryptoExchangeValidation extends CryptoValidation_1.CryptoValidation {
43
38
  static checkExchangePublicKeyAsBuffer(publicKey, algorithm, propertyName = "publicKey", throwError = true) {
44
39
  return super.checkBuffer(publicKey, this.PRIVATE_KEY_MIN_BYTES, this.PRIVATE_KEY_MAX_BYTES, propertyName, throwError);
45
40
  }
46
- static checkExchangePublicKey(publicKey, throwError = true) {
47
- let error;
48
- if (!(publicKey instanceof CryptoExchangePublicKey_1.CryptoExchangePublicKey)) {
49
- error = new CryptoError_1.CryptoError(CryptoErrorCode_1.CryptoErrorCode.ExchangeWrongPublicKey, "PublicKey is not set or supported.");
50
- }
51
- if (error && throwError)
52
- throw error;
53
- return error;
54
- }
55
- static checkExchangeKeypair(privateKey, publicKey, throwError = true) {
56
- let error;
57
- error = this.checkExchangePublicKey(publicKey);
58
- if (error && throwError)
59
- throw error;
60
- else if (error)
61
- return error;
62
- error = this.checkExchangePrivateKey(privateKey);
63
- if (error && throwError)
64
- throw error;
65
- else if (error)
66
- return error;
67
- if (privateKey.algorithm !== publicKey.algorithm) {
68
- error = new CryptoError_1.CryptoError(CryptoErrorCode_1.CryptoErrorCode.ExchangeWrongAlgorithm, "Algorithms of private and public key do not match.");
41
+ static checkExchangePublicKey(publicKey, algorithm, propertyName = "publicKey", throwError = true) {
42
+ if (typeof publicKey === "string") {
43
+ return this.checkExchangePublicKeyAsString(publicKey, algorithm, propertyName, throwError);
69
44
  }
70
- if (error && throwError)
71
- throw error;
72
- return error;
45
+ return this.checkExchangePublicKeyAsBuffer(publicKey, algorithm, propertyName, throwError);
73
46
  }
74
47
  }
75
48
  exports.CryptoExchangeValidation = CryptoExchangeValidation;
@@ -1 +1 @@
1
- {"version":3,"file":"CryptoExchangeValidation.js","sourceRoot":"","sources":["../../src/exchange/CryptoExchangeValidation.ts"],"names":[],"mappings":";;;AACA,gDAA6C;AAC7C,wDAAqD;AACrD,0DAAuD;AAEvD,yEAAsE;AACtE,uEAAoE;AAEpE,MAAa,wBAAyB,SAAQ,mCAAgB;IAMnD,MAAM,CAAC,sBAAsB,CAAC,SAAiB,EAAE,UAAU,GAAG,IAAI;QACrE,IAAI,KAAK,CAAC;QACV,QAAQ,SAAS,EAAE;YACf,uBAAuC;YACvC,uBAAuC;YACvC;gBACI,MAAM;YACV;gBACI,KAAK,GAAG,IAAI,yBAAW,CACnB,iCAAe,CAAC,sBAAsB,EACtC,6CAA6C,CAChD,CAAC;gBACF,MAAM;SACb;QACD,IAAI,KAAK,IAAI,UAAU;YAAE,MAAM,KAAK,CAAC;QACrC,OAAO,KAAK,CAAC;IACjB,CAAC;IAEM,MAAM,CAAC,+BAA+B,CACzC,UAAkB,EAClB,SAAkC,EAClC,YAAY,GAAG,YAAY,EAC3B,UAAU,GAAG,IAAI;QAEjB,OAAO,KAAK,CAAC,qBAAqB,CAC9B,UAAU,EACV,IAAI,CAAC,qBAAqB,EAC1B,IAAI,CAAC,qBAAqB,EAC1B,YAAY,EACZ,UAAU,CACb,CAAC;IACN,CAAC;IAEM,MAAM,CAAC,+BAA+B,CACzC,UAAsB,EACtB,SAAkC,EAClC,YAAY,GAAG,YAAY,EAC3B,UAAU,GAAG,IAAI;QAEjB,OAAO,KAAK,CAAC,WAAW,CACpB,UAA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AC;IACjB,CAAC;IAEM,MAAM,CAAC,oBAAoB,CAC9B,UAAoC,EACpC,SAAkC,EAClC,UAAU,GAAG,IAAI;QAEjB,IAAI,KAAK,CAAC;QACV,KAAK,GAAG,IAAI,CAAC,sBAAsB,CAAC,SAAS,CAAC,CAAC;QAC/C,IAAI,KAAK,IAAI,UAAU;YAAE,MAAM,KAAK,CAAC;aAChC,IAAI,KAAK;YAAE,OAAO,KAAK,CAAC;QAC7B,KAAK,GAAG,IAAI,CAAC,uBAAuB,CAAC,UAAU,CAAC,CAAC;QACjD,IAAI,KAAK,IAAI,UAAU;YAAE,MAAM,KAAK,CAAC;aAChC,IAAI,KAAK;YAAE,OAAO,KAAK,CAAC;QAE7B,IAAI,UAAU,CAAC,SAAS,KAAK,SAAS,CAAC,SAAS,EAAE;YAC9C,KAAK,GAAG,IAAI,yBAAW,CACnB,iCAAe,CAAC,sBAAsB,EACtC,oDAAoD,CACvD,CAAC;SACL;QACD,IAAI,KAAK,IAAI,UAAU;YAAE,MAAM,KAAK,CAAC;QACrC,OAAO,KAAK,CAAC;IACjB,CAAC;;AAjIL,4DAkIC;AAjI0B,8CAAqB,GAAW,EAAE,CAAC;AACnC,8CAAqB,GAAW,EAAE,CAAC;AACnC,6CAAoB,GAAW,EAAE,CAAC;AAClC,6CAAoB,GAAW,EAAE,CAAC"}
1
+ {"version":3,"file":"CryptoExchangeValidation.js","sourceRoot":"","sources":["../../src/exchange/CryptoExchangeValidation.ts"],"names":[],"mappings":";;;AACA,gDAA6C;AAC7C,wDAAqD;AACrD,0DAAuD;AAGvD,MAAa,wBAAyB,SAAQ,mCAAgB;IAMnD,MAAM,CAAC,sBAAsB,CAAC,SAAiB,EAAE,UAAU,GAAG,IAAI;QACrE,IAAI,KAAK,CAAC;QACV,QAAQ,SAAS,EAAE;YACf,uBAAuC;YACvC,uBAAuC;YACvC;gBACI,MAAM;YACV;gBACI,KAAK,GAAG,IAAI,yBAAW,CACnB,iCAAe,CAAC,sBAAsB,EACt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M,CAAC,8BAA8B,CACxC,SAAqB,EACrB,SAAkC,EAClC,YAAY,GAAG,WAAW,EAC1B,UAAU,GAAG,IAAI;QAEjB,OAAO,KAAK,CAAC,WAAW,CACpB,SAAS,EACT,IAAI,CAAC,qBAAqB,EAC1B,IAAI,CAAC,qBAAqB,EAC1B,YAAY,EACZ,UAAU,CACb,CAAC;IACN,CAAC;IAEM,MAAM,CAAC,sBAAsB,CAChC,SAA8B,EAC9B,SAAkC,EAClC,YAAY,GAAG,WAAW,EAC1B,UAAU,GAAG,IAAI;QAEjB,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE;YAC/B,OAAO,IAAI,CAAC,8BAA8B,CAAC,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC;SAC9F;QAED,OAAO,IAAI,CAAC,8BAA8B,CAAC,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC;IAC/F,CAAC;;AA5GL,4DA6GC;AA5G0B,8CAAqB,GAAG,EAAE,CAAC;AAC3B,8CAAqB,GAAG,EAAE,CAAC;AAC3B,6CAAoB,GAAG,EAAE,CAAC;AAC1B,6CAAoB,GAAG,EAAE,CAAC"}
package/dist/index.d.ts CHANGED
@@ -25,6 +25,7 @@ export * from "./relationship/CryptoRelationshipRequestSecrets";
25
25
  export * from "./relationship/CryptoRelationshipSecrets";
26
26
  export * from "./relationship/CryptoRelationshipType";
27
27
  export * from "./signature/CryptoSignature";
28
+ export * from "./signature/CryptoSignatureAlgorithm";
28
29
  export * from "./signature/CryptoSignatureKeypair";
29
30
  export * from "./signature/CryptoSignaturePrivateKey";
30
31
  export * from "./signature/CryptoSignaturePublicKey";
package/dist/index.js CHANGED
@@ -41,6 +41,7 @@ __exportStar(require("./relationship/CryptoRelationshipRequestSecrets"), exports
41
41
  __exportStar(require("./relationship/CryptoRelationshipSecrets"), exports);
42
42
  __exportStar(require("./relationship/CryptoRelationshipType"), exports);
43
43
  __exportStar(require("./signature/CryptoSignature"), exports);
44
+ __exportStar(require("./signature/CryptoSignatureAlgorithm"), exports);
44
45
  __exportStar(require("./signature/CryptoSignatureKeypair"), exports);
45
46
  __exportStar(require("./signature/CryptoSignaturePrivateKey"), exports);
46
47
  __exportStar(require("./signature/CryptoSignaturePublicKey"), exports);
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,qDAAmC;AACnC,+CAA6B;AAC7B,qDAAmC;AACnC,gDAA8B;AAC9B,oDAAkC;AAClC,qDAAmC;AACnC,oDAAkC;AAClC,qDAAmC;AACnC,4DAA0C;AAC1C,gEAA8C;AAC9C,+DAA6C;AAC7C,4DAA0C;AAC1C,mEAAiD;AACjD,sEAAoD;AACpD,qEAAmD;AACnD,mEAAiD;AACjD,sEAAoD;AACpD,oDAAkC;AAClC,mEAAiD;AACjD,wDAAsC;AACtC,iFAA+D;AAC/D,kFAAgE;AAChE,kFAAgE;AAChE,2EAAyD;AACzD,wEAAsD;AACtD,8DAA4C;AAC5C,qEAAmD;AACnD,wEAAsD;AACtD,uEAAqD;AACrD,+DAA6C;AAC7C,wEAAsD;AACtD,kDAAgC;AAChC,6DAA2C;AAC3C,oEAAkD;AAClD,qEAAmD;AACnD,4DAA0C;AAC1C,0DAAwC;AACxC,wDAAsC;AACtC,+DAA6C;AAC7C,6DAA2C"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,qDAAmC;AACnC,+CAA6B;AAC7B,qDAAmC;AACnC,gDAA8B;AAC9B,oDAAkC;AAClC,qDAAmC;AACnC,oDAAkC;AAClC,qDAAmC;AACnC,4DAA0C;AAC1C,gEAA8C;AAC9C,+DAA6C;AAC7C,4DAA0C;AAC1C,mEAAiD;AACjD,sEAAoD;AACpD,qEAAmD;AACnD,mEAAiD;AACjD,sEAAoD;AACpD,oDAAkC;AAClC,mEAAiD;AACjD,wDAAsC;AACtC,iFAA+D;AAC/D,kFAAgE;AAChE,kFAAgE;AAChE,2EAAyD;AACzD,wEAAsD;AACtD,8DAA4C;AAC5C,uEAAqD;AACrD,qEAAmD;AACnD,wEAAsD;AACtD,uEAAqD;AACrD,+DAA6C;AAC7C,wEAAsD;AACtD,kDAAgC;AAChC,6DAA2C;AAC3C,oEAAkD;AAClD,qEAAmD;AACnD,4DAA0C;AAC1C,0DAAwC;AACxC,wDAAsC;AACtC,+DAA6C;AAC7C,6DAA2C"}
@@ -23,11 +23,10 @@ export declare class CryptoRelationshipPublicRequest extends CryptoSerializable
23
23
  exchangeKey: CryptoExchangePublicKey;
24
24
  ephemeralKey: CryptoExchangePublicKey;
25
25
  nonce: CoreBuffer;
26
- constructor(signatureKey: CryptoSignaturePublicKey, exchangeKey: CryptoExchangePublicKey, ephemeralKey: CryptoExchangePublicKey, nonce: CoreBuffer);
27
26
  toJSON(verbose?: boolean): ICryptoRelationshipPublicRequestSerialized;
28
27
  clear(): void;
29
28
  static from(value: CryptoRelationshipPublicRequest | ICryptoRelationshipPublicRequest): CryptoRelationshipPublicRequest;
29
+ protected static preFrom(value: any): any;
30
30
  static fromJSON(value: ICryptoRelationshipPublicRequestSerialized): CryptoRelationshipPublicRequest;
31
31
  static fromBase64(value: string): CryptoRelationshipPublicRequest;
32
- static deserialize(value: string): CryptoRelationshipPublicRequest;
33
32
  }