@sudoplatform/sudo-common 8.1.1 → 8.2.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.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ListOperationResultStatus = exports.EncryptionAlgorithm = exports.CachePolicy = void 0;
3
+ exports.ListOperationResultStatus = exports.SignatureAlgorithm = exports.EncryptionAlgorithm = exports.CachePolicy = void 0;
4
4
  /**
5
5
  * Cache policy that determines how data is accessed when performing a query method
6
6
  * from the Email Service.
@@ -23,6 +23,15 @@ var EncryptionAlgorithm;
23
23
  EncryptionAlgorithm["AesGcmNoPadding"] = "AES/GCM/NoPadding";
24
24
  EncryptionAlgorithm["RsaOaepSha1"] = "RSA/OAEPWithSHA-1";
25
25
  })(EncryptionAlgorithm = exports.EncryptionAlgorithm || (exports.EncryptionAlgorithm = {}));
26
+ /**
27
+ * Signature algorithm names that are
28
+ * supported by the Sudo Platform and can be used
29
+ * between devices.
30
+ */
31
+ var SignatureAlgorithm;
32
+ (function (SignatureAlgorithm) {
33
+ SignatureAlgorithm["RsaPkcs15Sha256"] = "RSA/SSAPKCS15withSHA-256";
34
+ })(SignatureAlgorithm = exports.SignatureAlgorithm || (exports.SignatureAlgorithm = {}));
26
35
  /**
27
36
  * Status of the list operation result.
28
37
  */
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types/types.ts"],"names":[],"mappings":";;;AAQA;;;GAGG;AACH,IAAY,WAKX;AALD,WAAY,WAAW;IACrB,8BAA8B;IAC9B,uCAAwB,CAAA;IACxB,wCAAwC;IACxC,0CAA2B,CAAA;AAC7B,CAAC,EALW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAKtB;AAwBD;;;;GAIG;AACH,IAAY,mBAIX;AAJD,WAAY,mBAAmB;IAC7B,kEAA2C,CAAA;IAC3C,4DAAqC,CAAA;IACrC,wDAAiC,CAAA;AACnC,CAAC,EAJW,mBAAmB,GAAnB,2BAAmB,KAAnB,2BAAmB,QAI9B;AAID;;GAEG;AACH,IAAY,yBAcX;AAdD,WAAY,yBAAyB;IACnC;;OAEG;IACH,gDAAmB,CAAA;IACnB;;;OAGG;IACH,gDAAmB,CAAA;IACnB;;OAEG;IACH,gDAAmB,CAAA;AACrB,CAAC,EAdW,yBAAyB,GAAzB,iCAAyB,KAAzB,iCAAyB,QAcpC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types/types.ts"],"names":[],"mappings":";;;AAQA;;;GAGG;AACH,IAAY,WAKX;AALD,WAAY,WAAW;IACrB,8BAA8B;IAC9B,uCAAwB,CAAA;IACxB,wCAAwC;IACxC,0CAA2B,CAAA;AAC7B,CAAC,EALW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAKtB;AAwBD;;;;GAIG;AACH,IAAY,mBAIX;AAJD,WAAY,mBAAmB;IAC7B,kEAA2C,CAAA;IAC3C,4DAAqC,CAAA;IACrC,wDAAiC,CAAA;AACnC,CAAC,EAJW,mBAAmB,GAAnB,2BAAmB,KAAnB,2BAAmB,QAI9B;AAED;;;;GAIG;AACH,IAAY,kBAEX;AAFD,WAAY,kBAAkB;IAC5B,kEAA4C,CAAA;AAC9C,CAAC,EAFW,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAE7B;AAID;;GAEG;AACH,IAAY,yBAcX;AAdD,WAAY,yBAAyB;IACnC;;OAEG;IACH,gDAAmB,CAAA;IACnB;;;OAGG;IACH,gDAAmB,CAAA;IACnB;;OAEG;IACH,gDAAmB,CAAA;AACrB,CAAC,EAdW,yBAAyB,GAAzB,iCAAyB,KAAzB,iCAAyB,QAcpC"}
@@ -20,6 +20,15 @@ export var EncryptionAlgorithm;
20
20
  EncryptionAlgorithm["AesGcmNoPadding"] = "AES/GCM/NoPadding";
21
21
  EncryptionAlgorithm["RsaOaepSha1"] = "RSA/OAEPWithSHA-1";
22
22
  })(EncryptionAlgorithm || (EncryptionAlgorithm = {}));
23
+ /**
24
+ * Signature algorithm names that are
25
+ * supported by the Sudo Platform and can be used
26
+ * between devices.
27
+ */
28
+ export var SignatureAlgorithm;
29
+ (function (SignatureAlgorithm) {
30
+ SignatureAlgorithm["RsaPkcs15Sha256"] = "RSA/SSAPKCS15withSHA-256";
31
+ })(SignatureAlgorithm || (SignatureAlgorithm = {}));
23
32
  /**
24
33
  * Status of the list operation result.
25
34
  */
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types/types.ts"],"names":[],"mappings":"AAQA;;;GAGG;AACH,MAAM,CAAN,IAAY,WAKX;AALD,WAAY,WAAW;IACrB,8BAA8B;IAC9B,uCAAwB,CAAA;IACxB,wCAAwC;IACxC,0CAA2B,CAAA;AAC7B,CAAC,EALW,WAAW,KAAX,WAAW,QAKtB;AAwBD;;;;GAIG;AACH,MAAM,CAAN,IAAY,mBAIX;AAJD,WAAY,mBAAmB;IAC7B,kEAA2C,CAAA;IAC3C,4DAAqC,CAAA;IACrC,wDAAiC,CAAA;AACnC,CAAC,EAJW,mBAAmB,KAAnB,mBAAmB,QAI9B;AAID;;GAEG;AACH,MAAM,CAAN,IAAY,yBAcX;AAdD,WAAY,yBAAyB;IACnC;;OAEG;IACH,gDAAmB,CAAA;IACnB;;;OAGG;IACH,gDAAmB,CAAA;IACnB;;OAEG;IACH,gDAAmB,CAAA;AACrB,CAAC,EAdW,yBAAyB,KAAzB,yBAAyB,QAcpC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types/types.ts"],"names":[],"mappings":"AAQA;;;GAGG;AACH,MAAM,CAAN,IAAY,WAKX;AALD,WAAY,WAAW;IACrB,8BAA8B;IAC9B,uCAAwB,CAAA;IACxB,wCAAwC;IACxC,0CAA2B,CAAA;AAC7B,CAAC,EALW,WAAW,KAAX,WAAW,QAKtB;AAwBD;;;;GAIG;AACH,MAAM,CAAN,IAAY,mBAIX;AAJD,WAAY,mBAAmB;IAC7B,kEAA2C,CAAA;IAC3C,4DAAqC,CAAA;IACrC,wDAAiC,CAAA;AACnC,CAAC,EAJW,mBAAmB,KAAnB,mBAAmB,QAI9B;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAY,kBAEX;AAFD,WAAY,kBAAkB;IAC5B,kEAA4C,CAAA;AAC9C,CAAC,EAFW,kBAAkB,KAAlB,kBAAkB,QAE7B;AAID;;GAEG;AACH,MAAM,CAAN,IAAY,yBAcX;AAdD,WAAY,yBAAyB;IACnC;;OAEG;IACH,gDAAmB,CAAA;IACnB;;;OAGG;IACH,gDAAmB,CAAA;IACnB;;OAEG;IACH,gDAAmB,CAAA;AACrB,CAAC,EAdW,yBAAyB,KAAzB,yBAAyB,QAcpC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sudoplatform/sudo-common",
3
- "version": "8.1.1",
3
+ "version": "8.2.0",
4
4
  "author": "Anonyome Labs, Inc.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,4 +1,4 @@
1
- import { EncryptionAlgorithm } from '../types/types';
1
+ import { EncryptionAlgorithm, SignatureAlgorithm } from '../types/types';
2
2
  import { KeyData } from './keyData';
3
3
  import { PublicKey } from './publicKey';
4
4
  export declare class SudoCryptoProviderDefaults {
@@ -21,6 +21,13 @@ export interface SymmetricEncryptionOptions {
21
21
  export interface AsymmetricEncryptionOptions {
22
22
  algorithm?: EncryptionAlgorithm;
23
23
  }
24
+ /**
25
+ * Optional arguments for private key signature generation
26
+ * and verification
27
+ */
28
+ export interface SignatureOptions {
29
+ algorithm?: SignatureAlgorithm;
30
+ }
24
31
  /**
25
32
  * CryptoProvider instance interface
26
33
  */
@@ -119,22 +126,24 @@ export interface SudoCryptoProvider {
119
126
  *
120
127
  * @param name The name of the private key to use for generation.
121
128
  * @param data The data to sign.
129
+ * @param options Signature options. Defaults to \{ algorithm: SignatureAlgorithm.RsaPkcs15Sha256 \}
122
130
  *
123
131
  * @returns Data signature
124
132
  *
125
133
  * @throws {@link KeyNotFoundError}
126
134
  */
127
- generateSignatureWithPrivateKey(name: string, data: ArrayBuffer): Promise<ArrayBuffer>;
135
+ generateSignatureWithPrivateKey(name: string, data: ArrayBuffer, options?: SignatureOptions): Promise<ArrayBuffer>;
128
136
  /**
129
137
  * Verifies the given data against the provided signature using the specified public key.
130
138
  *
131
139
  * @param name The name of the public key to use for validation.
132
140
  * @param data The data to verify
133
141
  * @param signature The signature to verify against
142
+ * @param options Signature options. Defaults to \{ algorithm: SignatureAlgorithm.RsaPkcs15Sha256 \}
134
143
  *
135
144
  * @returns True if the data and signature could be successfully verified
136
145
  */
137
- verifySignatureWithPublicKey(name: string, data: ArrayBuffer, signature: ArrayBuffer): Promise<boolean>;
146
+ verifySignatureWithPublicKey(name: string, data: ArrayBuffer, signature: ArrayBuffer, options?: SignatureOptions): Promise<boolean>;
138
147
  /**
139
148
  * Adds a private key to the secure store.
140
149
  *
@@ -42,6 +42,14 @@ export declare enum EncryptionAlgorithm {
42
42
  AesGcmNoPadding = "AES/GCM/NoPadding",
43
43
  RsaOaepSha1 = "RSA/OAEPWithSHA-1"
44
44
  }
45
+ /**
46
+ * Signature algorithm names that are
47
+ * supported by the Sudo Platform and can be used
48
+ * between devices.
49
+ */
50
+ export declare enum SignatureAlgorithm {
51
+ RsaPkcs15Sha256 = "RSA/SSAPKCS15withSHA-256"
52
+ }
45
53
  export declare type Subset<T, S> = Pick<T, keyof T & keyof S>;
46
54
  /**
47
55
  * Status of the list operation result.