@sudoplatform/sudo-common 7.1.3 → 8.0.2

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 (100) hide show
  1. package/bin/outdated-with-suppression.sh +203 -0
  2. package/bin/suppress-audit.sh +15 -0
  3. package/bin/suppress-outdated.sh +60 -0
  4. package/bin/yarn-audit-with-suppression.sh +19 -0
  5. package/cjs/configurationManager/defaultConfigurationManager.js +122 -0
  6. package/cjs/configurationManager/defaultConfigurationManager.js.map +1 -0
  7. package/cjs/errors/error.js +442 -0
  8. package/cjs/errors/error.js.map +1 -0
  9. package/cjs/index.js +13 -0
  10. package/cjs/index.js.map +1 -0
  11. package/cjs/logging/bunyanLogger.js +36 -0
  12. package/cjs/logging/bunyanLogger.js.map +1 -0
  13. package/cjs/logging/logger.js +77 -0
  14. package/cjs/logging/logger.js.map +1 -0
  15. package/cjs/sudoKeyArchive/index.js +8 -0
  16. package/cjs/sudoKeyArchive/index.js.map +1 -0
  17. package/cjs/sudoKeyArchive/keyArchive.js +84 -0
  18. package/cjs/sudoKeyArchive/keyArchive.js.map +1 -0
  19. package/cjs/sudoKeyArchive/keyInfo.js +17 -0
  20. package/cjs/sudoKeyArchive/keyInfo.js.map +1 -0
  21. package/cjs/sudoKeyArchive/keyType.js +39 -0
  22. package/cjs/sudoKeyArchive/keyType.js.map +1 -0
  23. package/cjs/sudoKeyArchive/sudoKeyArchive.js +373 -0
  24. package/cjs/sudoKeyArchive/sudoKeyArchive.js.map +1 -0
  25. package/cjs/sudoKeyManager/index.js +8 -0
  26. package/cjs/sudoKeyManager/index.js.map +1 -0
  27. package/cjs/sudoKeyManager/keyData.js +46 -0
  28. package/cjs/sudoKeyManager/keyData.js.map +1 -0
  29. package/cjs/sudoKeyManager/publicKey.js +9 -0
  30. package/cjs/sudoKeyManager/publicKey.js.map +1 -0
  31. package/cjs/sudoKeyManager/sudoCryptoProvider.js +12 -0
  32. package/cjs/sudoKeyManager/sudoCryptoProvider.js.map +1 -0
  33. package/cjs/sudoKeyManager/sudoKeyManager.js +140 -0
  34. package/cjs/sudoKeyManager/sudoKeyManager.js.map +1 -0
  35. package/cjs/types/types.js +45 -0
  36. package/cjs/types/types.js.map +1 -0
  37. package/cjs/utils/base64.js +71 -0
  38. package/cjs/utils/base64.js.map +1 -0
  39. package/cjs/utils/buffer.js +37 -0
  40. package/cjs/utils/buffer.js.map +1 -0
  41. package/cjs/utils/stream.js +70 -0
  42. package/cjs/utils/stream.js.map +1 -0
  43. package/lib/configurationManager/defaultConfigurationManager.js +106 -156
  44. package/lib/configurationManager/defaultConfigurationManager.js.map +1 -0
  45. package/lib/errors/error.js +226 -438
  46. package/lib/errors/error.js.map +1 -0
  47. package/lib/index.js +10 -109
  48. package/lib/index.js.map +1 -0
  49. package/lib/logging/bunyanLogger.js +29 -41
  50. package/lib/logging/bunyanLogger.js.map +1 -0
  51. package/lib/logging/logger.js +66 -92
  52. package/lib/logging/logger.js.map +1 -0
  53. package/lib/sudoKeyArchive/index.js +5 -57
  54. package/lib/sudoKeyArchive/index.js.map +1 -0
  55. package/lib/sudoKeyArchive/keyArchive.js +69 -96
  56. package/lib/sudoKeyArchive/keyArchive.js.map +1 -0
  57. package/lib/sudoKeyArchive/keyInfo.js +11 -49
  58. package/lib/sudoKeyArchive/keyInfo.js.map +1 -0
  59. package/lib/sudoKeyArchive/keyType.js +27 -37
  60. package/lib/sudoKeyArchive/keyType.js.map +1 -0
  61. package/lib/sudoKeyArchive/sudoKeyArchive.js +351 -444
  62. package/lib/sudoKeyArchive/sudoKeyArchive.js.map +1 -0
  63. package/lib/sudoKeyManager/index.js +5 -57
  64. package/lib/sudoKeyManager/index.js.map +1 -0
  65. package/lib/sudoKeyManager/keyData.js +38 -33
  66. package/lib/sudoKeyManager/keyData.js.map +1 -0
  67. package/lib/sudoKeyManager/publicKey.js +5 -12
  68. package/lib/sudoKeyManager/publicKey.js.map +1 -0
  69. package/lib/sudoKeyManager/sudoCryptoProvider.js +8 -26
  70. package/lib/sudoKeyManager/sudoCryptoProvider.js.map +1 -0
  71. package/lib/sudoKeyManager/sudoKeyManager.js +135 -173
  72. package/lib/sudoKeyManager/sudoKeyManager.js.map +1 -0
  73. package/lib/types/types.js +27 -33
  74. package/lib/types/types.js.map +1 -0
  75. package/lib/utils/base64.js +63 -93
  76. package/lib/utils/base64.js.map +1 -0
  77. package/lib/utils/buffer.js +28 -46
  78. package/lib/utils/buffer.js.map +1 -0
  79. package/lib/utils/stream.js +63 -0
  80. package/lib/utils/stream.js.map +1 -0
  81. package/package.json +45 -28
  82. package/{lib → types}/configurationManager/defaultConfigurationManager.d.ts +0 -0
  83. package/{lib → types}/errors/error.d.ts +0 -0
  84. package/{lib → types}/index.d.ts +1 -0
  85. package/{lib → types}/logging/bunyanLogger.d.ts +0 -0
  86. package/{lib → types}/logging/logger.d.ts +0 -0
  87. package/{lib → types}/sudoKeyArchive/index.d.ts +0 -0
  88. package/{lib → types}/sudoKeyArchive/keyArchive.d.ts +8 -8
  89. package/{lib → types}/sudoKeyArchive/keyInfo.d.ts +0 -0
  90. package/{lib → types}/sudoKeyArchive/keyType.d.ts +0 -0
  91. package/{lib → types}/sudoKeyArchive/sudoKeyArchive.d.ts +0 -0
  92. package/{lib → types}/sudoKeyManager/index.d.ts +0 -0
  93. package/{lib → types}/sudoKeyManager/keyData.d.ts +0 -0
  94. package/{lib → types}/sudoKeyManager/publicKey.d.ts +0 -0
  95. package/{lib → types}/sudoKeyManager/sudoCryptoProvider.d.ts +0 -0
  96. package/{lib → types}/sudoKeyManager/sudoKeyManager.d.ts +0 -0
  97. package/{lib → types}/types/types.d.ts +1 -1
  98. package/{lib → types}/utils/base64.d.ts +0 -0
  99. package/{lib → types}/utils/buffer.d.ts +0 -0
  100. package/types/utils/stream.d.ts +6 -0
@@ -1,51 +1,13 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.KeyArchiveKeyInfoCodec = exports.KeyArchiveKeyInfoArrayCodec = void 0;
7
-
8
- var t = _interopRequireWildcard(require("io-ts"));
9
-
10
- var _keyType = require("./keyType");
11
-
12
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
13
-
14
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
15
-
1
+ import * as t from 'io-ts';
2
+ import { KeyArchiveKeyTypeCodec } from './keyType';
16
3
  const KeyArchiveKeyInfoRequiredProps = {
17
- Name: t.string,
18
- Type: _keyType.KeyArchiveKeyTypeCodec,
19
- Data: t.string,
20
- Synchronizable: t.boolean,
21
- Exportable: t.boolean,
22
- NameSpace: t.string
4
+ Name: t.string,
5
+ Type: KeyArchiveKeyTypeCodec,
6
+ Data: t.string,
7
+ Synchronizable: t.boolean,
8
+ Exportable: t.boolean,
9
+ NameSpace: t.string,
23
10
  };
24
- const KeyArchiveKeyInfoCodec = t.type(KeyArchiveKeyInfoRequiredProps, 'KeyArchiveKeyInfo');
25
- exports.KeyArchiveKeyInfoCodec = KeyArchiveKeyInfoCodec;
26
- const KeyArchiveKeyInfoArrayCodec = t.array(KeyArchiveKeyInfoCodec, 'KeyArchiveKeyInfoArray');
27
- /**
28
- * Record of key in a key archive
29
- *
30
- * @property NameSpace
31
- * NameSpace to which the key belongs.
32
- *
33
- * @property Name
34
- * Name of the key within the namespace
35
- *
36
- * @property Type
37
- * Type of the key (also implies key format)
38
- *
39
- * @property Data
40
- * Base64 encoded key data
41
- *
42
- * @property Synchronizable
43
- * Whether key should be synced out of band of archiving.
44
- * For future use - always false for now.
45
- *
46
- * @property Exportable
47
- * Whether restored key should be exportable. Always true on archive.
48
- * For future use on unarchive.
49
- */
50
-
51
- exports.KeyArchiveKeyInfoArrayCodec = KeyArchiveKeyInfoArrayCodec;
11
+ export const KeyArchiveKeyInfoCodec = t.type(KeyArchiveKeyInfoRequiredProps, 'KeyArchiveKeyInfo');
12
+ export const KeyArchiveKeyInfoArrayCodec = t.array(KeyArchiveKeyInfoCodec, 'KeyArchiveKeyInfoArray');
13
+ //# sourceMappingURL=keyInfo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyInfo.js","sourceRoot":"","sources":["../../src/sudoKeyArchive/keyInfo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,OAAO,CAAA;AAE1B,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAA;AAElD,MAAM,8BAA8B,GAAG;IACrC,IAAI,EAAE,CAAC,CAAC,MAAM;IACd,IAAI,EAAE,sBAAsB;IAC5B,IAAI,EAAE,CAAC,CAAC,MAAM;IACd,cAAc,EAAE,CAAC,CAAC,OAAO;IACzB,UAAU,EAAE,CAAC,CAAC,OAAO;IACrB,SAAS,EAAE,CAAC,CAAC,MAAM;CACpB,CAAA;AAED,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,IAAI,CAC1C,8BAA8B,EAC9B,mBAAmB,CACpB,CAAA;AAED,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAChD,sBAAsB,EACtB,wBAAwB,CACzB,CAAA"}
@@ -1,45 +1,35 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.KeyArchiveKeyTypeCodec = exports.KeyArchiveKeyType = void 0;
7
-
8
- var t = _interopRequireWildcard(require("io-ts"));
9
-
10
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
11
-
12
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
13
-
1
+ import * as t from 'io-ts';
14
2
  /**
15
3
  * Key types supported in key archives
16
4
  *
17
5
  * These form part of the interoperable secure key archive format.
18
6
  */
19
- let KeyArchiveKeyType; // Android is tolerating the following case insensitive alias key type
20
- // names so we will do the same
21
-
22
- exports.KeyArchiveKeyType = KeyArchiveKeyType;
23
-
7
+ export var KeyArchiveKeyType;
24
8
  (function (KeyArchiveKeyType) {
25
- KeyArchiveKeyType["Password"] = "password";
26
- KeyArchiveKeyType["PrivateKey"] = "privateKey";
27
- KeyArchiveKeyType["PublicKey"] = "publicKey";
28
- KeyArchiveKeyType["SymmetricKey"] = "symmetricKey";
29
- })(KeyArchiveKeyType || (exports.KeyArchiveKeyType = KeyArchiveKeyType = {}));
30
-
9
+ // Byte array of secret data - to be stored and retrievable using *Password
10
+ // methods on key managers
11
+ KeyArchiveKeyType["Password"] = "password";
12
+ // PKCS8 PrivateKey encoded RSA private key
13
+ KeyArchiveKeyType["PrivateKey"] = "privateKey";
14
+ // SPKI encoded RSA public key
15
+ KeyArchiveKeyType["PublicKey"] = "publicKey";
16
+ // Byte array of AES symmetric key
17
+ KeyArchiveKeyType["SymmetricKey"] = "symmetricKey";
18
+ })(KeyArchiveKeyType || (KeyArchiveKeyType = {}));
19
+ // Android is tolerating the following case insensitive alias key type
20
+ // names so we will do the same
31
21
  const keyArchiveKeyTypeAlternatives = {
32
- password: KeyArchiveKeyType.Password,
33
- privatekey: KeyArchiveKeyType.PrivateKey,
34
- private_key: KeyArchiveKeyType.PrivateKey,
35
- publickey: KeyArchiveKeyType.PublicKey,
36
- public_key: KeyArchiveKeyType.PublicKey,
37
- symmetrickey: KeyArchiveKeyType.SymmetricKey,
38
- symmetric_key: KeyArchiveKeyType.SymmetricKey
22
+ password: KeyArchiveKeyType.Password,
23
+ privatekey: KeyArchiveKeyType.PrivateKey,
24
+ private_key: KeyArchiveKeyType.PrivateKey,
25
+ publickey: KeyArchiveKeyType.PublicKey,
26
+ public_key: KeyArchiveKeyType.PublicKey,
27
+ symmetrickey: KeyArchiveKeyType.SymmetricKey,
28
+ symmetric_key: KeyArchiveKeyType.SymmetricKey,
39
29
  };
40
- const failureMessage = `Key type is not one of: ${Object.keys(keyArchiveKeyTypeAlternatives).join(',')}`;
41
-
42
- const isKeyArchiveKeyType = u => t.string.is(u) && keyArchiveKeyTypeAlternatives[u.toLowerCase()] !== undefined;
43
-
44
- const KeyArchiveKeyTypeCodec = new t.Type('KeyArchiveKeyType', isKeyArchiveKeyType, (u, c) => isKeyArchiveKeyType(u) ? t.success(keyArchiveKeyTypeAlternatives[u.toLowerCase()]) : t.failure(u, c, failureMessage), t.identity);
45
- exports.KeyArchiveKeyTypeCodec = KeyArchiveKeyTypeCodec;
30
+ const failureMessage = `Key type is not one of: ${Object.keys(keyArchiveKeyTypeAlternatives).join(',')}`; // eslint-disable-line tree-shaking/no-side-effects-in-initialization
31
+ const isKeyArchiveKeyType = (u) => t.string.is(u) && keyArchiveKeyTypeAlternatives[u.toLowerCase()] !== undefined;
32
+ export const KeyArchiveKeyTypeCodec = new t.Type('KeyArchiveKeyType', isKeyArchiveKeyType, (u, c) => isKeyArchiveKeyType(u)
33
+ ? t.success(keyArchiveKeyTypeAlternatives[u.toLowerCase()])
34
+ : t.failure(u, c, failureMessage), t.identity);
35
+ //# sourceMappingURL=keyType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyType.js","sourceRoot":"","sources":["../../src/sudoKeyArchive/keyType.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,OAAO,CAAA;AAE1B;;;;GAIG;AACH,MAAM,CAAN,IAAY,iBAaX;AAbD,WAAY,iBAAiB;IAC3B,2EAA2E;IAC3E,0BAA0B;IAC1B,0CAAqB,CAAA;IAErB,2CAA2C;IAC3C,8CAAyB,CAAA;IAEzB,8BAA8B;IAC9B,4CAAuB,CAAA;IAEvB,kCAAkC;IAClC,kDAA6B,CAAA;AAC/B,CAAC,EAbW,iBAAiB,KAAjB,iBAAiB,QAa5B;AAED,sEAAsE;AACtE,+BAA+B;AAC/B,MAAM,6BAA6B,GAAsC;IACvE,QAAQ,EAAE,iBAAiB,CAAC,QAAQ;IACpC,UAAU,EAAE,iBAAiB,CAAC,UAAU;IACxC,WAAW,EAAE,iBAAiB,CAAC,UAAU;IACzC,SAAS,EAAE,iBAAiB,CAAC,SAAS;IACtC,UAAU,EAAE,iBAAiB,CAAC,SAAS;IACvC,YAAY,EAAE,iBAAiB,CAAC,YAAY;IAC5C,aAAa,EAAE,iBAAiB,CAAC,YAAY;CAC9C,CAAA;AAED,MAAM,cAAc,GAAG,2BAA2B,MAAM,CAAC,IAAI,CAC3D,6BAA6B,CAC9B,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAA,CAAC,qEAAqE;AAEnF,MAAM,mBAAmB,GAAG,CAAC,CAAU,EAA0B,EAAE,CACjE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,6BAA6B,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,KAAK,SAAS,CAAA;AAEhF,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAC,CAAC,IAAI,CAC9C,mBAAmB,EACnB,mBAAmB,EACnB,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CACP,mBAAmB,CAAC,CAAC,CAAC;IACpB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,6BAA6B,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;IAC3D,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,cAAc,CAAC,EACrC,CAAC,CAAC,QAAQ,CACX,CAAA"}