@cmts-dev/carmentis-sdk-core 1.2.35 → 1.3.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.
@@ -9633,7 +9633,11 @@ var vy = ny.exports, yy = /* @__PURE__ */ ty(vy), by = class {
9633
9633
  payload: s
9634
9634
  };
9635
9635
  }
9636
- }, By = class {
9636
+ }, By = class e {
9637
+ static createEmpty() {
9638
+ let t = new e();
9639
+ return t.clear(), t;
9640
+ }
9637
9641
  encoders = [new Ay()];
9638
9642
  decoders = [
9639
9643
  new zy(),
@@ -9678,6 +9682,15 @@ var vy = ny.exports, yy = /* @__PURE__ */ ty(vy), by = class {
9678
9682
  encodeSignature(e) {
9679
9683
  return this.bytesEncoder.encode(e);
9680
9684
  }
9685
+ clear() {
9686
+ this.clearEncoders(), this.clearDecoders();
9687
+ }
9688
+ clearEncoders() {
9689
+ this.encoders = [];
9690
+ }
9691
+ clearDecoders() {
9692
+ this.decoders = [];
9693
+ }
9681
9694
  }, Vy;
9682
9695
  try {
9683
9696
  Vy = new TextDecoder();
@@ -9,18 +9,72 @@ import { BinaryToStringEncoderInterface } from '../../../utils/BinaryToStringEnc
9
9
  */
10
10
  export declare class HandlerBasedSignatureEncoder implements SignatureEncoderInterface<string> {
11
11
  private bytesEncoder;
12
+ /**
13
+ * Creates and returns a newly instantiated empty instance of `HandlerBasedSignatureEncoder`.
14
+ *
15
+ * @return {HandlerBasedSignatureEncoder} An empty instance of `HandlerBasedSignatureEncoder`.
16
+ */
17
+ static createEmpty(): HandlerBasedSignatureEncoder;
12
18
  private encoders;
13
19
  private decoders;
14
20
  constructor(bytesEncoder?: BinaryToStringEncoderInterface);
21
+ /**
22
+ * Registers a new encoder to the list of available encoders.
23
+ * @param encoder - The encoder to be registered.
24
+ */
15
25
  registerEncoder(encoder: ISignatureEncoderHandler): void;
26
+ /**
27
+ * Registers a new decoder to the list of available decoders.
28
+ * @param decoder
29
+ */
16
30
  registerDecoder(decoder: ISignatureDecodeHandler): void;
17
31
  decodeMessage(message: string): Uint8Array;
32
+ /**
33
+ * Decodes a given private key using an appropriate decoder from the available decoders.
34
+ *
35
+ * @param {string} privateKey - The private key string to be decoded.
36
+ * @return {Promise<PrivateSignatureKey>} A promise that resolves with the decoded private key, or rejects with an error if no suitable decoder is found.
37
+ */
18
38
  decodePrivateKey(privateKey: string): Promise<PrivateSignatureKey>;
39
+ /**
40
+ * Decodes the provided public key string into a `PublicSignatureKey` object.
41
+ * Iterates through available decoders to find a compatible one for decoding.
42
+ *
43
+ * @param {string} publicKey - The public key string to be decoded.
44
+ * @return {Promise<PublicSignatureKey>} A promise that resolves to the decoded `PublicSignatureKey` object.
45
+ * @throws {Error} If no compatible decoder is found for the provided public key.
46
+ */
19
47
  decodePublicKey(publicKey: string): Promise<PublicSignatureKey>;
20
48
  decodeSignature(signature: string): Uint8Array;
21
49
  encodeMessage(message: Uint8Array): string;
50
+ /**
51
+ * Encodes a given private key using the first suitable encoder available.
52
+ *
53
+ * @param {PrivateSignatureKey} privateKey - The private key to be encoded.
54
+ * @return {Promise<string>} A promise that resolves to the encoded private key as a string.
55
+ * @throws {Error} Throws an error if no encoder is found to handle the encoding request.
56
+ */
22
57
  encodePrivateKey(privateKey: PrivateSignatureKey): Promise<string>;
58
+ /**
59
+ * Encodes a given public key using the first suitable encoder available.
60
+ *
61
+ * @param {PublicSignatureKey} publicKey - The public key to be encoded.
62
+ * @return {Promise<string>} A promise that resolves to the encoded public key as a string.
63
+ * @throws {Error} Throws an error if no encoder is found to handle the encoding request.
64
+ */
23
65
  encodePublicKey(publicKey: PublicSignatureKey): Promise<string>;
24
66
  encodeSignature(signature: Uint8Array): string;
67
+ /**
68
+ * Removes all encoders and decoders.
69
+ */
70
+ clear(): void;
71
+ /**
72
+ * Removes all encoders.
73
+ */
74
+ clearEncoders(): void;
75
+ /**
76
+ * Removes all decoders.
77
+ */
78
+ clearDecoders(): void;
25
79
  }
26
80
  //# sourceMappingURL=HandlerBasedSignatureEncoder.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"HandlerBasedSignatureEncoder.d.ts","sourceRoot":"","sources":["../../../../src/crypto/encoder/signature/HandlerBasedSignatureEncoder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,yBAAyB,EAAC,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAC,uBAAuB,EAAE,wBAAwB,EAAC,MAAM,4BAA4B,CAAC;AAC7F,OAAO,EAAC,mBAAmB,EAAC,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAC,kBAAkB,EAAC,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAC,8BAA8B,EAAC,MAAM,+CAA+C,CAAC;AAQ7F;;;GAGG;AACH,qBAAa,4BAA6B,YAAW,yBAAyB,CAAC,MAAM,CAAC;IAa9E,OAAO,CAAC,YAAY;IAZxB,OAAO,CAAC,QAAQ,CAEd;IAEF,OAAO,CAAC,QAAQ,CAKd;gBAGU,YAAY,GAAE,8BAAmE;IAG7F,eAAe,CAAC,OAAO,EAAE,wBAAwB;IAIjD,eAAe,CAAC,OAAO,EAAE,uBAAuB;IAIhD,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU;IAIpC,gBAAgB,CAAC,UAAU,EAAE,MAAM;IASnC,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IASrE,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,UAAU;IAI9C,aAAa,CAAC,OAAO,EAAE,UAAU,GAAG,MAAM;IAIpC,gBAAgB,CAAC,UAAU,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC;IASlE,eAAe,CAAC,SAAS,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IASrE,eAAe,CAAC,SAAS,EAAE,UAAU,GAAG,MAAM;CAGjD"}
1
+ {"version":3,"file":"HandlerBasedSignatureEncoder.d.ts","sourceRoot":"","sources":["../../../../src/crypto/encoder/signature/Handler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CAGhB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmts-dev/carmentis-sdk-core",
3
- "version": "1.2.35",
3
+ "version": "1.3.0",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/carmentis-sdk-core.cjs",
6
6
  "module": "./dist/carmentis-sdk-core.js",