@sudoplatform/sudo-common 7.1.2 → 8.0.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.
- package/cjs/configurationManager/defaultConfigurationManager.js +122 -0
- package/cjs/configurationManager/defaultConfigurationManager.js.map +1 -0
- package/cjs/errors/error.js +442 -0
- package/cjs/errors/error.js.map +1 -0
- package/cjs/index.js +13 -0
- package/cjs/index.js.map +1 -0
- package/cjs/logging/bunyanLogger.js +36 -0
- package/cjs/logging/bunyanLogger.js.map +1 -0
- package/cjs/logging/logger.js +77 -0
- package/cjs/logging/logger.js.map +1 -0
- package/cjs/sudoKeyArchive/index.js +8 -0
- package/cjs/sudoKeyArchive/index.js.map +1 -0
- package/cjs/sudoKeyArchive/keyArchive.js +84 -0
- package/cjs/sudoKeyArchive/keyArchive.js.map +1 -0
- package/cjs/sudoKeyArchive/keyInfo.js +17 -0
- package/cjs/sudoKeyArchive/keyInfo.js.map +1 -0
- package/cjs/sudoKeyArchive/keyType.js +39 -0
- package/cjs/sudoKeyArchive/keyType.js.map +1 -0
- package/cjs/sudoKeyArchive/sudoKeyArchive.js +373 -0
- package/cjs/sudoKeyArchive/sudoKeyArchive.js.map +1 -0
- package/cjs/sudoKeyManager/index.js +8 -0
- package/cjs/sudoKeyManager/index.js.map +1 -0
- package/cjs/sudoKeyManager/keyData.js +46 -0
- package/cjs/sudoKeyManager/keyData.js.map +1 -0
- package/cjs/sudoKeyManager/publicKey.js +9 -0
- package/cjs/sudoKeyManager/publicKey.js.map +1 -0
- package/cjs/sudoKeyManager/sudoCryptoProvider.js +12 -0
- package/cjs/sudoKeyManager/sudoCryptoProvider.js.map +1 -0
- package/cjs/sudoKeyManager/sudoKeyManager.js +140 -0
- package/cjs/sudoKeyManager/sudoKeyManager.js.map +1 -0
- package/cjs/types/types.js +45 -0
- package/cjs/types/types.js.map +1 -0
- package/cjs/utils/base64.js +71 -0
- package/cjs/utils/base64.js.map +1 -0
- package/cjs/utils/buffer.js +37 -0
- package/cjs/utils/buffer.js.map +1 -0
- package/cjs/utils/stream.js +70 -0
- package/cjs/utils/stream.js.map +1 -0
- package/lib/configurationManager/defaultConfigurationManager.js +106 -158
- package/lib/configurationManager/defaultConfigurationManager.js.map +1 -0
- package/lib/errors/error.js +226 -438
- package/lib/errors/error.js.map +1 -0
- package/lib/index.js +10 -109
- package/lib/index.js.map +1 -0
- package/lib/logging/bunyanLogger.js +29 -41
- package/lib/logging/bunyanLogger.js.map +1 -0
- package/lib/logging/logger.js +66 -92
- package/lib/logging/logger.js.map +1 -0
- package/lib/sudoKeyArchive/index.js +5 -57
- package/lib/sudoKeyArchive/index.js.map +1 -0
- package/lib/sudoKeyArchive/keyArchive.js +69 -96
- package/lib/sudoKeyArchive/keyArchive.js.map +1 -0
- package/lib/sudoKeyArchive/keyInfo.js +11 -49
- package/lib/sudoKeyArchive/keyInfo.js.map +1 -0
- package/lib/sudoKeyArchive/keyType.js +27 -37
- package/lib/sudoKeyArchive/keyType.js.map +1 -0
- package/lib/sudoKeyArchive/sudoKeyArchive.js +351 -444
- package/lib/sudoKeyArchive/sudoKeyArchive.js.map +1 -0
- package/lib/sudoKeyManager/index.js +5 -57
- package/lib/sudoKeyManager/index.js.map +1 -0
- package/lib/sudoKeyManager/keyData.js +38 -33
- package/lib/sudoKeyManager/keyData.js.map +1 -0
- package/lib/sudoKeyManager/publicKey.js +5 -12
- package/lib/sudoKeyManager/publicKey.js.map +1 -0
- package/lib/sudoKeyManager/sudoCryptoProvider.js +8 -26
- package/lib/sudoKeyManager/sudoCryptoProvider.js.map +1 -0
- package/lib/sudoKeyManager/sudoKeyManager.js +135 -173
- package/lib/sudoKeyManager/sudoKeyManager.js.map +1 -0
- package/lib/types/types.js +27 -33
- package/lib/types/types.js.map +1 -0
- package/lib/utils/base64.js +63 -93
- package/lib/utils/base64.js.map +1 -0
- package/lib/utils/buffer.js +28 -46
- package/lib/utils/buffer.js.map +1 -0
- package/lib/utils/stream.js +63 -0
- package/lib/utils/stream.js.map +1 -0
- package/package.json +44 -28
- package/{lib → types}/configurationManager/defaultConfigurationManager.d.ts +0 -0
- package/{lib → types}/errors/error.d.ts +0 -0
- package/{lib → types}/index.d.ts +1 -0
- package/{lib → types}/logging/bunyanLogger.d.ts +0 -0
- package/{lib → types}/logging/logger.d.ts +0 -0
- package/{lib → types}/sudoKeyArchive/index.d.ts +0 -0
- package/{lib → types}/sudoKeyArchive/keyArchive.d.ts +8 -8
- package/{lib → types}/sudoKeyArchive/keyInfo.d.ts +0 -0
- package/{lib → types}/sudoKeyArchive/keyType.d.ts +0 -0
- package/{lib → types}/sudoKeyArchive/sudoKeyArchive.d.ts +0 -0
- package/{lib → types}/sudoKeyManager/index.d.ts +0 -0
- package/{lib → types}/sudoKeyManager/keyData.d.ts +0 -0
- package/{lib → types}/sudoKeyManager/publicKey.d.ts +0 -0
- package/{lib → types}/sudoKeyManager/sudoCryptoProvider.d.ts +0 -0
- package/{lib → types}/sudoKeyManager/sudoKeyManager.d.ts +0 -0
- package/{lib → types}/types/types.d.ts +0 -0
- package/{lib → types}/utils/base64.d.ts +0 -0
- package/{lib → types}/utils/buffer.d.ts +0 -0
- package/types/utils/stream.d.ts +6 -0
- package/.babelrc +0 -10
- package/.eslintrc.js +0 -91
- package/.gitignore +0 -14
- package/.gitlab-ci.yml +0 -101
- package/.npmignore +0 -1
- package/.prettierignore +0 -3
- package/.prettierrc.js +0 -7
- package/.publisher.json +0 -7
- package/.vscode/settings.json +0 -5
- package/.yarn/releases/yarn-1.22.19.cjs +0 -147529
- package/.yarnrc +0 -5
- package/dependencies-report.json +0 -640
- package/docs/.nojekyll +0 -1
- package/docs/assets/highlight.css +0 -57
- package/docs/assets/main.js +0 -54
- package/docs/assets/search.js +0 -1
- package/docs/assets/style.css +0 -1224
- package/docs/assets/widgets.png +0 -0
- package/docs/assets/widgets@2x.png +0 -0
- package/docs/classes/AccountLockedError.html +0 -163
- package/docs/classes/AuthenticationError.html +0 -169
- package/docs/classes/Base64.html +0 -245
- package/docs/classes/Buffer.html +0 -158
- package/docs/classes/ConfigurationNotSetError.html +0 -164
- package/docs/classes/ConfigurationSetNotFoundError.html +0 -168
- package/docs/classes/DecodeError.html +0 -168
- package/docs/classes/DefaultConfigurationManager.html +0 -213
- package/docs/classes/DefaultLogger.html +0 -291
- package/docs/classes/DefaultSudoKeyArchive.html +0 -363
- package/docs/classes/DefaultSudoKeyManager.html +0 -814
- package/docs/classes/FatalError.html +0 -169
- package/docs/classes/IllegalArgumentError.html +0 -168
- package/docs/classes/IllegalStateError.html +0 -169
- package/docs/classes/InsufficientEntitlementsError.html +0 -164
- package/docs/classes/InvalidOwnershipProofError.html +0 -163
- package/docs/classes/InvalidTokenError.html +0 -163
- package/docs/classes/KeyArchiveDecodingError.html +0 -168
- package/docs/classes/KeyArchiveIncorrectPasswordError.html +0 -168
- package/docs/classes/KeyArchiveMissingError.html +0 -168
- package/docs/classes/KeyArchiveNoPasswordRequiredError.html +0 -168
- package/docs/classes/KeyArchivePasswordRequiredError.html +0 -168
- package/docs/classes/KeyArchiveTypeError.html +0 -168
- package/docs/classes/KeyArchiveUnknownKeyTypeError.html +0 -168
- package/docs/classes/KeyArchiveVersionError.html +0 -168
- package/docs/classes/KeyNotFoundError.html +0 -168
- package/docs/classes/KeyStoreNotExportableError.html +0 -168
- package/docs/classes/LimitExceededError.html +0 -164
- package/docs/classes/NoEntitlementsError.html +0 -163
- package/docs/classes/NotAuthorizedError.html +0 -169
- package/docs/classes/NotRegisteredError.html +0 -168
- package/docs/classes/NotSignedInError.html +0 -164
- package/docs/classes/OperationNotImplementedError.html +0 -168
- package/docs/classes/RegisterError.html +0 -169
- package/docs/classes/RequestFailedError.html +0 -189
- package/docs/classes/ServiceError.html +0 -170
- package/docs/classes/SignOutError.html +0 -168
- package/docs/classes/SudoCryptoProviderDefaults.html +0 -106
- package/docs/classes/UnknownGraphQLError.html +0 -169
- package/docs/classes/UnrecognizedAlgorithmError.html +0 -168
- package/docs/classes/UserNotConfirmedError.html +0 -164
- package/docs/classes/VersionMismatchError.html +0 -166
- package/docs/enums/CachePolicy.html +0 -72
- package/docs/enums/EncryptionAlgorithm.html +0 -80
- package/docs/enums/KeyArchiveKeyType.html +0 -86
- package/docs/enums/KeyDataKeyFormat.html +0 -92
- package/docs/enums/KeyDataKeyType.html +0 -85
- package/docs/enums/ListOperationResultStatus.html +0 -85
- package/docs/enums/PublicKeyFormat.html +0 -68
- package/docs/functions/isAppSyncNetworkError.html +0 -147
- package/docs/functions/isInsecureKeyArchive.html +0 -147
- package/docs/functions/isSecureKeyArchive.html +0 -147
- package/docs/functions/isUnrecognizedKeyArchive.html +0 -147
- package/docs/functions/keyArchiveInfoFromKeyData.html +0 -147
- package/docs/functions/keyArchiveKeyTypeFromKeyDataKeyType.html +0 -147
- package/docs/functions/mapGraphQLToClientError.html +0 -154
- package/docs/functions/mapNetworkErrorToClientError.html +0 -154
- package/docs/index.html +0 -146
- package/docs/interfaces/AsymmetricEncryptionOptions.html +0 -68
- package/docs/interfaces/BooleanFilter.html +0 -75
- package/docs/interfaces/ConfigurationManager.html +0 -200
- package/docs/interfaces/KeyData.html +0 -106
- package/docs/interfaces/ListOperationFailureResult.html +0 -76
- package/docs/interfaces/ListOperationPartialResult.html +0 -102
- package/docs/interfaces/ListOperationSuccessResult.html +0 -90
- package/docs/interfaces/ListOutput.html +0 -80
- package/docs/interfaces/Logger.html +0 -251
- package/docs/interfaces/Owner.html +0 -72
- package/docs/interfaces/PublicKey.html +0 -72
- package/docs/interfaces/ServiceCompatibilityInfo.html +0 -110
- package/docs/interfaces/StringFilter.html +0 -82
- package/docs/interfaces/SudoCryptoProvider.html +0 -865
- package/docs/interfaces/SudoKeyArchive.html +0 -257
- package/docs/interfaces/SudoKeyManager.html +0 -848
- package/docs/interfaces/SymmetricEncryptionOptions.html +0 -75
- package/docs/interfaces/ValidationResult.html +0 -83
- package/docs/modules.html +0 -248
- package/docs/types/AppSyncError.html +0 -138
- package/docs/types/AppSyncNetworkError.html +0 -138
- package/docs/types/InsecureKeyArchive.html +0 -138
- package/docs/types/KeyArchive.html +0 -138
- package/docs/types/KeyArchiveKeyInfo.html +0 -154
- package/docs/types/KeyArchiveKeyInfoDecoded.html +0 -138
- package/docs/types/ListOperationResult.html +0 -148
- package/docs/types/SecureKeyArchive.html +0 -138
- package/docs/types/Subset.html +0 -144
- package/docs/types/UnrecognizedKeyArchive.html +0 -138
- package/docs/variables/CURRENT_ARCHIVE_VERSION.html +0 -138
- package/docs/variables/InsecureKeyArchiveCodec.html +0 -138
- package/docs/variables/InsecureKeyArchiveType.html +0 -138
- package/docs/variables/KeyArchiveCodec.html +0 -138
- package/docs/variables/KeyArchiveKeyInfoArrayCodec.html +0 -138
- package/docs/variables/KeyArchiveKeyInfoCodec.html +0 -138
- package/docs/variables/KeyArchiveKeyTypeCodec.html +0 -138
- package/docs/variables/SecureKeyArchiveCodec.html +0 -138
- package/docs/variables/SecureKeyArchiveType.html +0 -138
- package/docs/variables/UnrecognizedKeyArchiveCodec.html +0 -138
- package/github/.babelrc +0 -10
- package/github/.eslintrc.js +0 -91
- package/github/.gitignore +0 -14
- package/github/.gitlab-ci.yml +0 -101
- package/github/.npmignore +0 -1
- package/github/.prettierignore +0 -3
- package/github/.prettierrc.js +0 -7
- package/github/.publisher.json +0 -7
- package/github/.vscode/settings.json +0 -5
- package/github/.yarn/releases/yarn-1.22.19.cjs +0 -147529
- package/github/.yarnrc +0 -5
- package/github/CHANGELOG.md +0 -51
- package/github/README.md +0 -8
- package/github/bin/outdated-with-suppression.sh +0 -203
- package/github/bin/suppress-audit.sh +0 -15
- package/github/bin/suppress-outdated.sh +0 -60
- package/github/bin/yarn-audit-with-suppression.sh +0 -19
- package/github/docs/.nojekyll +0 -1
- package/github/docs/assets/highlight.css +0 -57
- package/github/docs/assets/main.js +0 -54
- package/github/docs/assets/search.js +0 -1
- package/github/docs/assets/style.css +0 -1224
- package/github/docs/assets/widgets.png +0 -0
- package/github/docs/assets/widgets@2x.png +0 -0
- package/github/docs/classes/AccountLockedError.html +0 -163
- package/github/docs/classes/AuthenticationError.html +0 -169
- package/github/docs/classes/Base64.html +0 -245
- package/github/docs/classes/Buffer.html +0 -158
- package/github/docs/classes/ConfigurationNotSetError.html +0 -164
- package/github/docs/classes/ConfigurationSetNotFoundError.html +0 -168
- package/github/docs/classes/DecodeError.html +0 -168
- package/github/docs/classes/DefaultConfigurationManager.html +0 -213
- package/github/docs/classes/DefaultLogger.html +0 -291
- package/github/docs/classes/DefaultSudoKeyArchive.html +0 -363
- package/github/docs/classes/DefaultSudoKeyManager.html +0 -814
- package/github/docs/classes/FatalError.html +0 -169
- package/github/docs/classes/IllegalArgumentError.html +0 -168
- package/github/docs/classes/IllegalStateError.html +0 -169
- package/github/docs/classes/InsufficientEntitlementsError.html +0 -164
- package/github/docs/classes/InvalidOwnershipProofError.html +0 -163
- package/github/docs/classes/InvalidTokenError.html +0 -163
- package/github/docs/classes/KeyArchiveDecodingError.html +0 -168
- package/github/docs/classes/KeyArchiveIncorrectPasswordError.html +0 -168
- package/github/docs/classes/KeyArchiveMissingError.html +0 -168
- package/github/docs/classes/KeyArchiveNoPasswordRequiredError.html +0 -168
- package/github/docs/classes/KeyArchivePasswordRequiredError.html +0 -168
- package/github/docs/classes/KeyArchiveTypeError.html +0 -168
- package/github/docs/classes/KeyArchiveUnknownKeyTypeError.html +0 -168
- package/github/docs/classes/KeyArchiveVersionError.html +0 -168
- package/github/docs/classes/KeyNotFoundError.html +0 -168
- package/github/docs/classes/KeyStoreNotExportableError.html +0 -168
- package/github/docs/classes/LimitExceededError.html +0 -164
- package/github/docs/classes/NoEntitlementsError.html +0 -163
- package/github/docs/classes/NotAuthorizedError.html +0 -169
- package/github/docs/classes/NotRegisteredError.html +0 -168
- package/github/docs/classes/NotSignedInError.html +0 -164
- package/github/docs/classes/OperationNotImplementedError.html +0 -168
- package/github/docs/classes/RegisterError.html +0 -169
- package/github/docs/classes/RequestFailedError.html +0 -189
- package/github/docs/classes/ServiceError.html +0 -170
- package/github/docs/classes/SignOutError.html +0 -168
- package/github/docs/classes/SudoCryptoProviderDefaults.html +0 -106
- package/github/docs/classes/UnknownGraphQLError.html +0 -169
- package/github/docs/classes/UnrecognizedAlgorithmError.html +0 -168
- package/github/docs/classes/UserNotConfirmedError.html +0 -164
- package/github/docs/classes/VersionMismatchError.html +0 -166
- package/github/docs/enums/CachePolicy.html +0 -72
- package/github/docs/enums/EncryptionAlgorithm.html +0 -80
- package/github/docs/enums/KeyArchiveKeyType.html +0 -86
- package/github/docs/enums/KeyDataKeyFormat.html +0 -92
- package/github/docs/enums/KeyDataKeyType.html +0 -85
- package/github/docs/enums/ListOperationResultStatus.html +0 -85
- package/github/docs/enums/PublicKeyFormat.html +0 -68
- package/github/docs/functions/isAppSyncNetworkError.html +0 -147
- package/github/docs/functions/isInsecureKeyArchive.html +0 -147
- package/github/docs/functions/isSecureKeyArchive.html +0 -147
- package/github/docs/functions/isUnrecognizedKeyArchive.html +0 -147
- package/github/docs/functions/keyArchiveInfoFromKeyData.html +0 -147
- package/github/docs/functions/keyArchiveKeyTypeFromKeyDataKeyType.html +0 -147
- package/github/docs/functions/mapGraphQLToClientError.html +0 -154
- package/github/docs/functions/mapNetworkErrorToClientError.html +0 -154
- package/github/docs/index.html +0 -146
- package/github/docs/interfaces/AsymmetricEncryptionOptions.html +0 -68
- package/github/docs/interfaces/BooleanFilter.html +0 -75
- package/github/docs/interfaces/ConfigurationManager.html +0 -200
- package/github/docs/interfaces/KeyData.html +0 -106
- package/github/docs/interfaces/ListOperationFailureResult.html +0 -76
- package/github/docs/interfaces/ListOperationPartialResult.html +0 -102
- package/github/docs/interfaces/ListOperationSuccessResult.html +0 -90
- package/github/docs/interfaces/ListOutput.html +0 -80
- package/github/docs/interfaces/Logger.html +0 -251
- package/github/docs/interfaces/Owner.html +0 -72
- package/github/docs/interfaces/PublicKey.html +0 -72
- package/github/docs/interfaces/ServiceCompatibilityInfo.html +0 -110
- package/github/docs/interfaces/StringFilter.html +0 -82
- package/github/docs/interfaces/SudoCryptoProvider.html +0 -865
- package/github/docs/interfaces/SudoKeyArchive.html +0 -257
- package/github/docs/interfaces/SudoKeyManager.html +0 -848
- package/github/docs/interfaces/SymmetricEncryptionOptions.html +0 -75
- package/github/docs/interfaces/ValidationResult.html +0 -83
- package/github/docs/modules.html +0 -248
- package/github/docs/types/AppSyncError.html +0 -138
- package/github/docs/types/AppSyncNetworkError.html +0 -138
- package/github/docs/types/InsecureKeyArchive.html +0 -138
- package/github/docs/types/KeyArchive.html +0 -138
- package/github/docs/types/KeyArchiveKeyInfo.html +0 -154
- package/github/docs/types/KeyArchiveKeyInfoDecoded.html +0 -138
- package/github/docs/types/ListOperationResult.html +0 -148
- package/github/docs/types/SecureKeyArchive.html +0 -138
- package/github/docs/types/Subset.html +0 -144
- package/github/docs/types/UnrecognizedKeyArchive.html +0 -138
- package/github/docs/variables/CURRENT_ARCHIVE_VERSION.html +0 -138
- package/github/docs/variables/InsecureKeyArchiveCodec.html +0 -138
- package/github/docs/variables/InsecureKeyArchiveType.html +0 -138
- package/github/docs/variables/KeyArchiveCodec.html +0 -138
- package/github/docs/variables/KeyArchiveKeyInfoArrayCodec.html +0 -138
- package/github/docs/variables/KeyArchiveKeyInfoCodec.html +0 -138
- package/github/docs/variables/KeyArchiveKeyTypeCodec.html +0 -138
- package/github/docs/variables/SecureKeyArchiveCodec.html +0 -138
- package/github/docs/variables/SecureKeyArchiveType.html +0 -138
- package/github/docs/variables/UnrecognizedKeyArchiveCodec.html +0 -138
- package/github/jest.config.json +0 -14
- package/github/package.json +0 -91
- package/github/src/configurationManager/defaultConfigurationManager.ts +0 -281
- package/github/src/errors/error.ts +0 -469
- package/github/src/index.ts +0 -8
- package/github/src/logging/bunyanLogger.ts +0 -47
- package/github/src/logging/logger.ts +0 -164
- package/github/src/sudoKeyArchive/index.ts +0 -4
- package/github/src/sudoKeyArchive/keyArchive.ts +0 -120
- package/github/src/sudoKeyArchive/keyInfo.ts +0 -47
- package/github/src/sudoKeyArchive/keyType.ts +0 -50
- package/github/src/sudoKeyArchive/sudoKeyArchive.ts +0 -591
- package/github/src/sudoKeyManager/index.ts +0 -4
- package/github/src/sudoKeyManager/keyData.ts +0 -60
- package/github/src/sudoKeyManager/publicKey.ts +0 -9
- package/github/src/sudoKeyManager/sudoCryptoProvider.ts +0 -416
- package/github/src/sudoKeyManager/sudoKeyManager.ts +0 -609
- package/github/src/types/types.ts +0 -129
- package/github/src/utils/base64.ts +0 -75
- package/github/src/utils/buffer.ts +0 -39
- package/github/test/integration/defaultConfigurationManager.spec.ts +0 -85
- package/github/test/matchers.ts +0 -122
- package/github/test/unit/configurationManager/defaultConfigurationManager.spec.ts +0 -506
- package/github/test/unit/errors/error.spec.ts +0 -115
- package/github/test/unit/keyType.spec.ts +0 -54
- package/github/test/unit/logging/logger.spec.ts +0 -182
- package/github/test/unit/sudoKeyArchive.spec.ts +0 -1609
- package/github/test/unit/sudoKeyManager.spec.ts +0 -1045
- package/github/test/unit/utils/base64.spec.ts +0 -45
- package/github/test/unit/utils/buffer.spec.ts +0 -45
- package/github/test/unit/utils/listOperationResult.spec.ts +0 -84
- package/github/tsconfig.json +0 -20
- package/github/tsconfig.test.json +0 -7
- package/github/yarn.lock +0 -5922
- package/jest.config.json +0 -14
- package/src/configurationManager/defaultConfigurationManager.ts +0 -281
- package/src/errors/error.ts +0 -469
- package/src/index.ts +0 -8
- package/src/logging/bunyanLogger.ts +0 -47
- package/src/logging/logger.ts +0 -164
- package/src/sudoKeyArchive/index.ts +0 -4
- package/src/sudoKeyArchive/keyArchive.ts +0 -120
- package/src/sudoKeyArchive/keyInfo.ts +0 -47
- package/src/sudoKeyArchive/keyType.ts +0 -50
- package/src/sudoKeyArchive/sudoKeyArchive.ts +0 -591
- package/src/sudoKeyManager/index.ts +0 -4
- package/src/sudoKeyManager/keyData.ts +0 -60
- package/src/sudoKeyManager/publicKey.ts +0 -9
- package/src/sudoKeyManager/sudoCryptoProvider.ts +0 -416
- package/src/sudoKeyManager/sudoKeyManager.ts +0 -609
- package/src/types/types.ts +0 -129
- package/src/utils/base64.ts +0 -75
- package/src/utils/buffer.ts +0 -39
- package/test/integration/defaultConfigurationManager.spec.ts +0 -85
- package/test/matchers.ts +0 -122
- package/test/unit/configurationManager/defaultConfigurationManager.spec.ts +0 -506
- package/test/unit/errors/error.spec.ts +0 -115
- package/test/unit/keyType.spec.ts +0 -54
- package/test/unit/logging/logger.spec.ts +0 -182
- package/test/unit/sudoKeyArchive.spec.ts +0 -1609
- package/test/unit/sudoKeyManager.spec.ts +0 -1045
- package/test/unit/utils/base64.spec.ts +0 -45
- package/test/unit/utils/buffer.spec.ts +0 -45
- package/test/unit/utils/listOperationResult.spec.ts +0 -84
- package/tsconfig.json +0 -20
- package/tsconfig.test.json +0 -7
- package/yarn.lock +0 -5922
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DefaultConfigurationManager = void 0;
|
|
4
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
5
|
+
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
|
6
|
+
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
|
7
|
+
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
8
|
+
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
9
|
+
const Either_1 = require("fp-ts/lib/Either");
|
|
10
|
+
const pipeable_1 = require("fp-ts/lib/pipeable");
|
|
11
|
+
const PathReporter_1 = require("io-ts/lib/PathReporter");
|
|
12
|
+
const error_1 = require("../errors/error");
|
|
13
|
+
const client_s3_1 = require("@aws-sdk/client-s3");
|
|
14
|
+
const stream_1 = require("../utils/stream");
|
|
15
|
+
/**
|
|
16
|
+
* Singleton to manage configuration
|
|
17
|
+
*/
|
|
18
|
+
class DefaultConfigurationManager {
|
|
19
|
+
constructor() {
|
|
20
|
+
// Do Nothing.
|
|
21
|
+
}
|
|
22
|
+
static getInstance() {
|
|
23
|
+
if (!DefaultConfigurationManager.instance) {
|
|
24
|
+
DefaultConfigurationManager.instance = new DefaultConfigurationManager();
|
|
25
|
+
}
|
|
26
|
+
return DefaultConfigurationManager.instance;
|
|
27
|
+
}
|
|
28
|
+
setConfig(config) {
|
|
29
|
+
this._config = config;
|
|
30
|
+
return DefaultConfigurationManager.instance;
|
|
31
|
+
}
|
|
32
|
+
getConfigSet(namespace) {
|
|
33
|
+
if (!this._config) {
|
|
34
|
+
throw new error_1.ConfigurationNotSetError();
|
|
35
|
+
}
|
|
36
|
+
const parsed = JSON.parse(this._config);
|
|
37
|
+
const configSet = namespace ? parsed[namespace] : parsed;
|
|
38
|
+
return configSet;
|
|
39
|
+
}
|
|
40
|
+
bind(configSet, codec) {
|
|
41
|
+
// Decode and validate config
|
|
42
|
+
return (0, pipeable_1.pipe)(codec.decode(configSet), (0, Either_1.fold)((errors) => {
|
|
43
|
+
throw new error_1.DecodeError(PathReporter_1.PathReporter.report((0, Either_1.left)(errors)).join('\n'));
|
|
44
|
+
}, (v) => v));
|
|
45
|
+
}
|
|
46
|
+
bindConfigSet(codec, namespace) {
|
|
47
|
+
const configSet = this.getConfigSet(namespace);
|
|
48
|
+
if (!configSet) {
|
|
49
|
+
throw new error_1.ConfigurationSetNotFoundError(namespace);
|
|
50
|
+
}
|
|
51
|
+
return this.bind(configSet, codec);
|
|
52
|
+
}
|
|
53
|
+
async validateConfig() {
|
|
54
|
+
if (!this._config) {
|
|
55
|
+
return { incompatible: [], deprecated: [] };
|
|
56
|
+
}
|
|
57
|
+
const config = JSON.parse(this._config);
|
|
58
|
+
const region = config.identityService?.region;
|
|
59
|
+
const bucket = config.identityService?.serviceInfoBucket;
|
|
60
|
+
if (!(region && bucket)) {
|
|
61
|
+
return { incompatible: [], deprecated: [] };
|
|
62
|
+
}
|
|
63
|
+
const s3Client = new client_s3_1.S3Client({
|
|
64
|
+
region: region,
|
|
65
|
+
// We want these request to be unauthenticated
|
|
66
|
+
// so we provide a no-op signer for the requests
|
|
67
|
+
signer: { sign: (request) => Promise.resolve(request) },
|
|
68
|
+
});
|
|
69
|
+
const incompatible = [];
|
|
70
|
+
const deprecated = [];
|
|
71
|
+
const listObjectsCommand = new client_s3_1.ListObjectsCommand({
|
|
72
|
+
Bucket: bucket,
|
|
73
|
+
});
|
|
74
|
+
const objects = await s3Client.send(listObjectsCommand);
|
|
75
|
+
if (!objects.Contents?.length) {
|
|
76
|
+
return { incompatible: [], deprecated: [] };
|
|
77
|
+
}
|
|
78
|
+
const keys = objects.Contents.map((object) => object.Key);
|
|
79
|
+
// Only fetch the service info docs for the services that are present in client config
|
|
80
|
+
// to minimize the network calls.
|
|
81
|
+
const keysToFetch = keys.filter((key) => key.endsWith('.json') && config[key.replace('.json', '')]);
|
|
82
|
+
for (const key of keysToFetch) {
|
|
83
|
+
const getObject = new client_s3_1.GetObjectCommand({
|
|
84
|
+
Key: key,
|
|
85
|
+
Bucket: bucket,
|
|
86
|
+
});
|
|
87
|
+
const object = await s3Client.send(getObject);
|
|
88
|
+
if (!object.Body) {
|
|
89
|
+
throw new error_1.FatalError('No S3 object body');
|
|
90
|
+
}
|
|
91
|
+
const body = await (0, stream_1.bodyToString)(object.Body);
|
|
92
|
+
const json = JSON.parse(body);
|
|
93
|
+
const serviceName = key.replace('.json', '');
|
|
94
|
+
const serviceInfo = json[serviceName];
|
|
95
|
+
const serviceConfig = config[serviceName];
|
|
96
|
+
if (serviceInfo && serviceConfig) {
|
|
97
|
+
const currentVersion = serviceConfig.version ?? 1;
|
|
98
|
+
const deprecationGrace = serviceInfo.deprecationGrace ?? -1;
|
|
99
|
+
const compatibilityInfo = {
|
|
100
|
+
name: serviceName,
|
|
101
|
+
configVersion: currentVersion,
|
|
102
|
+
minSupportedVersion: serviceInfo.minVersion,
|
|
103
|
+
deprecatedVersion: serviceInfo.deprecated,
|
|
104
|
+
deprecationGrace: deprecationGrace != -1 ? new Date(deprecationGrace) : undefined,
|
|
105
|
+
};
|
|
106
|
+
// If the service config in `sudoplatformconfig.json` is less than the
|
|
107
|
+
// minimum supported version then the client is incompatible.
|
|
108
|
+
if (currentVersion < (compatibilityInfo.minSupportedVersion ?? 0)) {
|
|
109
|
+
incompatible.push(compatibilityInfo);
|
|
110
|
+
}
|
|
111
|
+
// If the service config is less than or equal to the deprecated version
|
|
112
|
+
// then it will be made incompatible after the deprecation grace.
|
|
113
|
+
if (currentVersion <= (compatibilityInfo.deprecatedVersion ?? 0)) {
|
|
114
|
+
deprecated.push(compatibilityInfo);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return { incompatible, deprecated };
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
exports.DefaultConfigurationManager = DefaultConfigurationManager;
|
|
122
|
+
//# sourceMappingURL=defaultConfigurationManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaultConfigurationManager.js","sourceRoot":"","sources":["../../src/configurationManager/defaultConfigurationManager.ts"],"names":[],"mappings":";;;AAAA,uDAAuD;AACvD,wDAAwD;AACxD,sDAAsD;AACtD,+DAA+D;AAC/D,4DAA4D;AAC5D,6CAA6C;AAC7C,iDAAyC;AAEzC,yDAAqD;AACrD,2CAKwB;AACxB,kDAI2B;AAC3B,4CAA8C;AAqH9C;;GAEG;AACH,MAAa,2BAA2B;IAKtC;QACE,cAAc;IAChB,CAAC;IAEM,MAAM,CAAC,WAAW;QACvB,IAAI,CAAC,2BAA2B,CAAC,QAAQ,EAAE;YACzC,2BAA2B,CAAC,QAAQ,GAAG,IAAI,2BAA2B,EAAE,CAAA;SACzE;QAED,OAAO,2BAA2B,CAAC,QAAQ,CAAA;IAC7C,CAAC;IAEM,SAAS,CAAC,MAAc;QAC7B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAA;QAErB,OAAO,2BAA2B,CAAC,QAAQ,CAAA;IAC7C,CAAC;IAEM,YAAY,CAAC,SAAk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EAAwE;gBACxE,iEAAiE;gBACjE,IAAI,cAAc,IAAI,CAAC,iBAAiB,CAAC,iBAAiB,IAAI,CAAC,CAAC,EAAE;oBAChE,UAAU,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAA;iBACnC;aACF;SACF;QAED,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,CAAA;IACrC,CAAC;CACF;AA7ID,kEA6IC"}
|
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mapNetworkErrorToClientError = exports.mapGraphQLToClientError = exports.UnrecognizedAlgorithmError = exports.OperationNotImplementedError = exports.KeyArchiveUnknownKeyTypeError = exports.KeyArchiveVersionError = exports.KeyArchiveTypeError = exports.KeyArchiveIncorrectPasswordError = exports.KeyArchiveDecodingError = exports.KeyArchiveNoPasswordRequiredError = exports.KeyArchivePasswordRequiredError = exports.KeyArchiveMissingError = exports.KeyStoreNotExportableError = exports.KeyNotFoundError = exports.InvalidTokenError = exports.NoEntitlementsError = exports.FatalError = exports.RequestFailedError = exports.LimitExceededError = exports.IllegalStateError = exports.IllegalArgumentError = exports.ServiceError = exports.AccountLockedError = exports.InsufficientEntitlementsError = exports.InvalidOwnershipProofError = exports.VersionMismatchError = exports.UserNotConfirmedError = exports.NotSignedInError = exports.NotAuthorizedError = exports.NotRegisteredError = exports.RegisterError = exports.SignOutError = exports.AuthenticationError = exports.DecodeError = exports.ConfigurationNotSetError = exports.ConfigurationSetNotFoundError = exports.UnknownGraphQLError = exports.isAppSyncNetworkError = void 0;
|
|
4
|
+
function isAppSyncNetworkError(u) {
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6
|
+
return !!u.networkError;
|
|
7
|
+
}
|
|
8
|
+
exports.isAppSyncNetworkError = isAppSyncNetworkError;
|
|
9
|
+
/**
|
|
10
|
+
* Indicates the GraphQL API returned an error that's not recognized by
|
|
11
|
+
* the client.
|
|
12
|
+
*/
|
|
13
|
+
class UnknownGraphQLError extends Error {
|
|
14
|
+
constructor(cause) {
|
|
15
|
+
const maybeAppSyncError = cause;
|
|
16
|
+
let message;
|
|
17
|
+
if (maybeAppSyncError?.errorType) {
|
|
18
|
+
message = `type: ${maybeAppSyncError.errorType}, message: ${maybeAppSyncError.message}`;
|
|
19
|
+
}
|
|
20
|
+
else if (maybeAppSyncError?.message) {
|
|
21
|
+
message = maybeAppSyncError?.message;
|
|
22
|
+
}
|
|
23
|
+
else if (maybeAppSyncError?.name) {
|
|
24
|
+
message = maybeAppSyncError.name;
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
message = 'unknown cause';
|
|
28
|
+
}
|
|
29
|
+
super(message);
|
|
30
|
+
this.name = 'UnknownGraphQLError';
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.UnknownGraphQLError = UnknownGraphQLError;
|
|
34
|
+
/**
|
|
35
|
+
* The configuration set was not found by the given key
|
|
36
|
+
*/
|
|
37
|
+
class ConfigurationSetNotFoundError extends Error {
|
|
38
|
+
constructor(key) {
|
|
39
|
+
super('Configuration set not found.');
|
|
40
|
+
if (key) {
|
|
41
|
+
this.message += ` Key: ${key}`;
|
|
42
|
+
}
|
|
43
|
+
this.name = 'ConfigurationSetNotFoundError';
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.ConfigurationSetNotFoundError = ConfigurationSetNotFoundError;
|
|
47
|
+
/**
|
|
48
|
+
* The configuration has not been set on the ConfigurationManager
|
|
49
|
+
* before trying operations that need it
|
|
50
|
+
*/
|
|
51
|
+
class ConfigurationNotSetError extends Error {
|
|
52
|
+
constructor() {
|
|
53
|
+
super('Configuration has not been set.');
|
|
54
|
+
this.name = 'ConfigurationNotSetError';
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.ConfigurationNotSetError = ConfigurationNotSetError;
|
|
58
|
+
/**
|
|
59
|
+
* A decode error message
|
|
60
|
+
*/
|
|
61
|
+
class DecodeError extends Error {
|
|
62
|
+
constructor(message) {
|
|
63
|
+
super(message);
|
|
64
|
+
this.name = 'DecodeError';
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
exports.DecodeError = DecodeError;
|
|
68
|
+
/**
|
|
69
|
+
* An error occurred during the authentication process. This may be due to invalid credentials
|
|
70
|
+
* being supplied, or authentication tokens not able to be retrieved from storage.
|
|
71
|
+
*/
|
|
72
|
+
class AuthenticationError extends Error {
|
|
73
|
+
constructor(message) {
|
|
74
|
+
super(message);
|
|
75
|
+
this.name = 'AuthenticationError';
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
exports.AuthenticationError = AuthenticationError;
|
|
79
|
+
/**
|
|
80
|
+
* An error occurred during the sign out process.
|
|
81
|
+
*/
|
|
82
|
+
class SignOutError extends Error {
|
|
83
|
+
constructor(message) {
|
|
84
|
+
super(message);
|
|
85
|
+
this.name = 'SignOutError';
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
exports.SignOutError = SignOutError;
|
|
89
|
+
/**
|
|
90
|
+
* An error occurred during the registration process.
|
|
91
|
+
* This may be due to the client already being registered.
|
|
92
|
+
*/
|
|
93
|
+
class RegisterError extends Error {
|
|
94
|
+
constructor(message) {
|
|
95
|
+
super(message);
|
|
96
|
+
this.name = 'RegisterError';
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
exports.RegisterError = RegisterError;
|
|
100
|
+
/**
|
|
101
|
+
* An error occurred indicating that the user is not registered.
|
|
102
|
+
*/
|
|
103
|
+
class NotRegisteredError extends Error {
|
|
104
|
+
constructor(message) {
|
|
105
|
+
super(message ?? 'User is not registered.');
|
|
106
|
+
this.name = 'NotRegisteredError';
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
exports.NotRegisteredError = NotRegisteredError;
|
|
110
|
+
/**
|
|
111
|
+
* The user is not authorized to perform the requested operation. This maybe
|
|
112
|
+
* due to specifying the wrong key deriving key or password.
|
|
113
|
+
*/
|
|
114
|
+
class NotAuthorizedError extends Error {
|
|
115
|
+
constructor(message) {
|
|
116
|
+
super(message ?? 'User is not authorized perform the requested operation.');
|
|
117
|
+
this.name = 'NotAuthorizedError';
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
exports.NotAuthorizedError = NotAuthorizedError;
|
|
121
|
+
/**
|
|
122
|
+
* Indicates the operation requires the user to be signed in but the user is
|
|
123
|
+
* currently not signed in.
|
|
124
|
+
*/
|
|
125
|
+
class NotSignedInError extends Error {
|
|
126
|
+
constructor() {
|
|
127
|
+
super('Not signed in.');
|
|
128
|
+
this.name = 'NotSignedInError';
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
exports.NotSignedInError = NotSignedInError;
|
|
132
|
+
/**
|
|
133
|
+
* Indicates that the user was registered but is not confirmed due to not
|
|
134
|
+
* passing all the required validation.
|
|
135
|
+
*/
|
|
136
|
+
class UserNotConfirmedError extends Error {
|
|
137
|
+
constructor() {
|
|
138
|
+
super('User not confirmed.');
|
|
139
|
+
this.name = 'UserNotConfirmedError';
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
exports.UserNotConfirmedError = UserNotConfirmedError;
|
|
143
|
+
/**
|
|
144
|
+
* The version of the vault that's being updated does not match the version
|
|
145
|
+
* stored in the backed. It is likely that another client updated the vault
|
|
146
|
+
* first so the caller should reconcile the changes before attempting to
|
|
147
|
+
* update the vault.
|
|
148
|
+
*/
|
|
149
|
+
class VersionMismatchError extends Error {
|
|
150
|
+
constructor() {
|
|
151
|
+
super('Expected object version does not match the actual object version.');
|
|
152
|
+
this.name = 'VersionMismatchError';
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
exports.VersionMismatchError = VersionMismatchError;
|
|
156
|
+
/**
|
|
157
|
+
* Indicates that the ownership proof was invalid.
|
|
158
|
+
*/
|
|
159
|
+
class InvalidOwnershipProofError extends Error {
|
|
160
|
+
constructor() {
|
|
161
|
+
super('Ownership proof was invalid.');
|
|
162
|
+
this.name = 'InvalidOwnershipProofError';
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
exports.InvalidOwnershipProofError = InvalidOwnershipProofError;
|
|
166
|
+
/**
|
|
167
|
+
* Indicates that the user does not have sufficient entitlements to perform
|
|
168
|
+
* the requested operation.
|
|
169
|
+
*/
|
|
170
|
+
class InsufficientEntitlementsError extends Error {
|
|
171
|
+
constructor() {
|
|
172
|
+
super('The user does not have sufficient entitlements to perform the requested operation.');
|
|
173
|
+
this.name = 'InsufficientEntitlementsError';
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
exports.InsufficientEntitlementsError = InsufficientEntitlementsError;
|
|
177
|
+
/**
|
|
178
|
+
* Indicates the requested operation failed because the user account is locked.
|
|
179
|
+
*/
|
|
180
|
+
class AccountLockedError extends Error {
|
|
181
|
+
constructor() {
|
|
182
|
+
super('The requested operation failed because the user account is locked.');
|
|
183
|
+
this.name = 'AccountLockedError';
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
exports.AccountLockedError = AccountLockedError;
|
|
187
|
+
/**
|
|
188
|
+
* Indicates that an internal server error caused the operation to fail. The error
|
|
189
|
+
* is possibly transient and retrying at a later time may cause the operation to
|
|
190
|
+
* complete successfully.
|
|
191
|
+
*/
|
|
192
|
+
class ServiceError extends Error {
|
|
193
|
+
constructor(message) {
|
|
194
|
+
super(message);
|
|
195
|
+
this.name = 'ServiceError';
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
exports.ServiceError = ServiceError;
|
|
199
|
+
/**
|
|
200
|
+
* Error when expected arguments are missing or invalid
|
|
201
|
+
*/
|
|
202
|
+
class IllegalArgumentError extends Error {
|
|
203
|
+
constructor(message) {
|
|
204
|
+
super(message ?? 'Invalid arguments were specified');
|
|
205
|
+
this.name = 'IllegalArgumentError';
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
exports.IllegalArgumentError = IllegalArgumentError;
|
|
209
|
+
/**
|
|
210
|
+
* Error when the state of the program is expecting a value to
|
|
211
|
+
* be set or available and it is not.
|
|
212
|
+
*/
|
|
213
|
+
class IllegalStateError extends Error {
|
|
214
|
+
constructor(message) {
|
|
215
|
+
super(message);
|
|
216
|
+
this.name = 'IllegalStateError';
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
exports.IllegalStateError = IllegalStateError;
|
|
220
|
+
/**
|
|
221
|
+
* Operation failed due to it exceeding some limits imposed for the API. For example,
|
|
222
|
+
* this error can occur if the resource size exceeds the database record size limit.
|
|
223
|
+
*/
|
|
224
|
+
class LimitExceededError extends Error {
|
|
225
|
+
constructor() {
|
|
226
|
+
super('API limit exceeded.');
|
|
227
|
+
this.name = 'LimitExceededError';
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
exports.LimitExceededError = LimitExceededError;
|
|
231
|
+
/**
|
|
232
|
+
* API request failed due to network error or unexpected server error.
|
|
233
|
+
*/
|
|
234
|
+
class RequestFailedError extends Error {
|
|
235
|
+
constructor(cause, statusCode) {
|
|
236
|
+
super(`API request failed. cause: ${cause?.message ?? '<none>'}, statusCode: ${statusCode ?? '<none>'}`);
|
|
237
|
+
this.name = 'RequestFailedError';
|
|
238
|
+
this.cause = cause;
|
|
239
|
+
this.statusCode = statusCode;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
exports.RequestFailedError = RequestFailedError;
|
|
243
|
+
/**
|
|
244
|
+
* An unexpected error was encountered. This may result from programmatic error
|
|
245
|
+
* and is unlikley to be user recoverable.
|
|
246
|
+
*/
|
|
247
|
+
class FatalError extends Error {
|
|
248
|
+
constructor(message) {
|
|
249
|
+
super(message);
|
|
250
|
+
this.name = 'FatalError';
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
exports.FatalError = FatalError;
|
|
254
|
+
/**
|
|
255
|
+
* No entitlements assigned to user.
|
|
256
|
+
*/
|
|
257
|
+
class NoEntitlementsError extends Error {
|
|
258
|
+
constructor() {
|
|
259
|
+
super('No entitlements assigned to user.');
|
|
260
|
+
this.name = 'NoEntitlementsError';
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
exports.NoEntitlementsError = NoEntitlementsError;
|
|
264
|
+
/**
|
|
265
|
+
* Token presented was not valid for the purpose.
|
|
266
|
+
*/
|
|
267
|
+
class InvalidTokenError extends Error {
|
|
268
|
+
constructor() {
|
|
269
|
+
super('Invalid token.');
|
|
270
|
+
this.name = 'InvalidTokenError';
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
exports.InvalidTokenError = InvalidTokenError;
|
|
274
|
+
/**
|
|
275
|
+
* Key not found from store when using cryptoProvider
|
|
276
|
+
*/
|
|
277
|
+
class KeyNotFoundError extends Error {
|
|
278
|
+
constructor(message) {
|
|
279
|
+
super(message ?? 'Key not found.');
|
|
280
|
+
this.name = 'KeyNotFoundError';
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
exports.KeyNotFoundError = KeyNotFoundError;
|
|
284
|
+
/**
|
|
285
|
+
* Underlying secure key store does not support key export
|
|
286
|
+
*/
|
|
287
|
+
class KeyStoreNotExportableError extends Error {
|
|
288
|
+
constructor(message) {
|
|
289
|
+
super(message ?? 'Key store not exportable.');
|
|
290
|
+
this.name = 'KeyStoreNotExportableError';
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
exports.KeyStoreNotExportableError = KeyStoreNotExportableError;
|
|
294
|
+
/**
|
|
295
|
+
* No key archive provided prior to unarchiving
|
|
296
|
+
*/
|
|
297
|
+
class KeyArchiveMissingError extends Error {
|
|
298
|
+
constructor(message) {
|
|
299
|
+
super(message ?? 'No key archive provided prior to unarchiving');
|
|
300
|
+
this.name = 'KeyArchiveMissingError';
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
exports.KeyArchiveMissingError = KeyArchiveMissingError;
|
|
304
|
+
/**
|
|
305
|
+
* No password provided to unarchive secure archive
|
|
306
|
+
*/
|
|
307
|
+
class KeyArchivePasswordRequiredError extends Error {
|
|
308
|
+
constructor(message) {
|
|
309
|
+
super(message ?? 'No password provided to unarchive secure archive');
|
|
310
|
+
this.name = 'KeyArchivePasswordRequiredError';
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
exports.KeyArchivePasswordRequiredError = KeyArchivePasswordRequiredError;
|
|
314
|
+
/**
|
|
315
|
+
* No password required to unarchive insecure archive
|
|
316
|
+
*/
|
|
317
|
+
class KeyArchiveNoPasswordRequiredError extends Error {
|
|
318
|
+
constructor(message) {
|
|
319
|
+
super(message ?? 'No password required to unarchive insecure archive');
|
|
320
|
+
this.name = 'KeyArchiveNoPasswordRequiredError';
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
exports.KeyArchiveNoPasswordRequiredError = KeyArchiveNoPasswordRequiredError;
|
|
324
|
+
/**
|
|
325
|
+
* Key archive data could not be decoded as expected
|
|
326
|
+
*/
|
|
327
|
+
class KeyArchiveDecodingError extends Error {
|
|
328
|
+
constructor(message) {
|
|
329
|
+
super(message ?? 'Key archive data could not be decoded as expected');
|
|
330
|
+
this.name = 'KeyArchiveDecodingError';
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
exports.KeyArchiveDecodingError = KeyArchiveDecodingError;
|
|
334
|
+
/**
|
|
335
|
+
* Key archive was unable to be decrypted using the provided password
|
|
336
|
+
*/
|
|
337
|
+
class KeyArchiveIncorrectPasswordError extends Error {
|
|
338
|
+
constructor(message) {
|
|
339
|
+
super(message ??
|
|
340
|
+
'Key archive was unable to be decrypted using the provided password');
|
|
341
|
+
this.name = 'KeyArchiveIncorrectPasswordError';
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
exports.KeyArchiveIncorrectPasswordError = KeyArchiveIncorrectPasswordError;
|
|
345
|
+
/**
|
|
346
|
+
* Key archive type is not supported
|
|
347
|
+
*/
|
|
348
|
+
class KeyArchiveTypeError extends Error {
|
|
349
|
+
constructor(keyArchiveType) {
|
|
350
|
+
super(`Key archive type ${keyArchiveType} is not supported`);
|
|
351
|
+
this.name = 'KeyArchiveTypeError';
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
exports.KeyArchiveTypeError = KeyArchiveTypeError;
|
|
355
|
+
/**
|
|
356
|
+
* Key archive version is not supported
|
|
357
|
+
*/
|
|
358
|
+
class KeyArchiveVersionError extends Error {
|
|
359
|
+
constructor(version) {
|
|
360
|
+
super(`Key archive version ${version} is not supported`);
|
|
361
|
+
this.name = 'KeyArchiveVersionError';
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
exports.KeyArchiveVersionError = KeyArchiveVersionError;
|
|
365
|
+
/**
|
|
366
|
+
* Key archive key type is not recognized
|
|
367
|
+
*/
|
|
368
|
+
class KeyArchiveUnknownKeyTypeError extends Error {
|
|
369
|
+
constructor(message) {
|
|
370
|
+
super(message ?? 'Key type is not recognized');
|
|
371
|
+
this.name = 'KeyArchiveUnknownKeyTypeError';
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
exports.KeyArchiveUnknownKeyTypeError = KeyArchiveUnknownKeyTypeError;
|
|
375
|
+
/**
|
|
376
|
+
* Operation not implemented
|
|
377
|
+
*/
|
|
378
|
+
class OperationNotImplementedError extends Error {
|
|
379
|
+
constructor(message) {
|
|
380
|
+
super(message ?? 'Operation is not implemented');
|
|
381
|
+
this.name = 'OperationNotImplementedError';
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
exports.OperationNotImplementedError = OperationNotImplementedError;
|
|
385
|
+
/**
|
|
386
|
+
* Encryption algorithm is not recognized
|
|
387
|
+
*/
|
|
388
|
+
class UnrecognizedAlgorithmError extends Error {
|
|
389
|
+
constructor(message) {
|
|
390
|
+
super(message ?? 'Unrecognized encryption algorithm name.');
|
|
391
|
+
this.name = 'UnrecognizedAlgorithmError';
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
exports.UnrecognizedAlgorithmError = UnrecognizedAlgorithmError;
|
|
395
|
+
/**
|
|
396
|
+
* Helper method for mapping an App Sync error to common errors.
|
|
397
|
+
*
|
|
398
|
+
* For consumption by other Sudo Platform SDKs
|
|
399
|
+
*
|
|
400
|
+
* @param error The App Sync error to map
|
|
401
|
+
* @returns The mapped error
|
|
402
|
+
*/
|
|
403
|
+
function mapGraphQLToClientError(error) {
|
|
404
|
+
switch (error.errorType) {
|
|
405
|
+
case 'sudoplatform.AccountLockedError':
|
|
406
|
+
return new AccountLockedError();
|
|
407
|
+
case 'sudoplatform.InsufficientEntitlementsError':
|
|
408
|
+
return new InsufficientEntitlementsError();
|
|
409
|
+
case 'sudoplatform.InvalidTokenError':
|
|
410
|
+
return new InvalidTokenError();
|
|
411
|
+
case 'sudoplatform.InvalidArgumentError':
|
|
412
|
+
return new IllegalArgumentError();
|
|
413
|
+
case 'sudoplatform.LimitExceededError':
|
|
414
|
+
return new LimitExceededError();
|
|
415
|
+
case 'sudoplatform.NoEntitlementsError':
|
|
416
|
+
return new NoEntitlementsError();
|
|
417
|
+
case 'sudoplatform.ServiceError':
|
|
418
|
+
return new ServiceError(error.message);
|
|
419
|
+
default:
|
|
420
|
+
return new UnknownGraphQLError(error);
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
exports.mapGraphQLToClientError = mapGraphQLToClientError;
|
|
424
|
+
/**
|
|
425
|
+
* Call this in error handling when testing with isAppSyncNetworkError on
|
|
426
|
+
* a caught error from an AppSync operation returns true.
|
|
427
|
+
*
|
|
428
|
+
* @param error AppSyncNetworkError to map
|
|
429
|
+
*
|
|
430
|
+
* @returns Mapped error
|
|
431
|
+
*/
|
|
432
|
+
function mapNetworkErrorToClientError(error) {
|
|
433
|
+
const networkError = error.networkError;
|
|
434
|
+
switch (networkError.statusCode) {
|
|
435
|
+
case 401:
|
|
436
|
+
return new NotAuthorizedError();
|
|
437
|
+
default:
|
|
438
|
+
return new RequestFailedError(networkError, networkError.statusCode);
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
exports.mapNetworkErrorToClientError = mapNetworkErrorToClientError;
|
|
442
|
+
//# sourceMappingURL=error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/errors/error.ts"],"names":[],"mappings":";;;AAYA,SAAgB,qBAAqB,CAAC,CAAQ;IAC5C,8DAA8D;IAC9D,OAAO,CAAC,CAAE,CAAiB,CAAC,YAAY,CAAA;AAC1C,CAAC;AAHD,sDAGC;AAED;;;GAGG;AACH,MAAa,mBAAoB,SAAQ,KAAK;IAC5C,YAAY,KAAc;QACxB,MAAM,iBAAiB,GAAG,KAAqB,CAAA;QAC/C,IAAI,OAAe,CAAA;QACnB,IAAI,iBAAiB,EAAE,SAAS,EAAE;YAChC,OAAO,GAAG,SAAS,iBAAiB,CAAC,SAAS,cAAc,iBAAiB,CAAC,OAAO,EAAE,CAAA;SACxF;aAAM,IAAI,iBAAiB,EAAE,OAAO,EAAE;YACrC,OAAO,GAAG,iBAAiB,EAAE,OAAO,CAAA;SACrC;aAAM,IAAI,iBAAiB,EAAE,IAAI,EAAE;YAClC,OAAO,GAAG,iBAAiB,CAAC,IAAI,CAAA;SACjC;aAAM;YACL,OAAO,GAAG,eAAe,CAAA;SAC1B;QACD,KAAK,CAAC,OAAO,CAAC,CAAA;QAEd,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAA;IACnC,CAAC;CACF;AAjBD,kDAiBC;AAED;;GAEG;AACH,MAAa,6BAA8B,SAAQ,KAAK;IACtD,YAAY,GAAY;QACtB,KAAK,CAAC,8BAA8B,CAAC,CAAA;QACrC,IAAI,GAAG,EAAE;YACP,IAAI,CAAC,OAAO,IAAI,SAAS,GAAG,EAAE,CAAA;SAC/B;QACD,IAAI,CAAC,IAAI,GAAG,+BAA+B,CAAA;IAC7C,CAAC;CACF;AARD,sEAQC;AAED;;;GAGG;AACH,MAAa,wBAAyB,SAAQ,KAAK;IACjD;QACE,KAAK,CAAC,iCAAiC,CAAC,CAAA;QACxC,IAAI,CAAC,IAAI,GAAG,0BAA0B,C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C,KAAK,mCAAmC;YACtC,OAAO,IAAI,oBAAoB,EAAE,CAAA;QACnC,KAAK,iCAAiC;YACpC,OAAO,IAAI,kBAAkB,EAAE,CAAA;QACjC,KAAK,kCAAkC;YACrC,OAAO,IAAI,mBAAmB,EAAE,CAAA;QAClC,KAAK,2BAA2B;YAC9B,OAAO,IAAI,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QACxC;YACE,OAAO,IAAI,mBAAmB,CAAC,KAAK,CAAC,CAAA;KACxC;AACH,CAAC;AArBD,0DAqBC;AAED;;;;;;;GAOG;AACH,SAAgB,4BAA4B,CAC1C,KAA0B;IAE1B,MAAM,YAAY,GAAG,KAAK,CAAC,YAAY,CAAA;IACvC,QAAQ,YAAY,CAAC,UAAU,EAAE;QAC/B,KAAK,GAAG;YACN,OAAO,IAAI,kBAAkB,EAAE,CAAA;QACjC;YACE,OAAO,IAAI,kBAAkB,CAAC,YAAY,EAAE,YAAY,CAAC,UAAU,CAAC,CAAA;KACvE;AACH,CAAC;AAVD,oEAUC"}
|
package/cjs/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./configurationManager/defaultConfigurationManager"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./sudoKeyArchive"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./sudoKeyManager"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./utils/base64"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./utils/buffer"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./utils/stream"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./errors/error"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./logging/logger"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./types/types"), exports);
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
package/cjs/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,6FAAkE;AAClE,2DAAgC;AAChC,2DAAgC;AAChC,yDAA8B;AAC9B,yDAA8B;AAC9B,yDAA8B;AAC9B,yDAA8B;AAC9B,2DAAgC;AAChC,wDAA6B"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createBunyanLogger = exports.getLogLevel = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const browser_bunyan_1 = require("browser-bunyan");
|
|
6
|
+
const console_plain_stream_1 = require("@browser-bunyan/console-plain-stream");
|
|
7
|
+
const t = tslib_1.__importStar(require("io-ts"));
|
|
8
|
+
const pipeable_1 = require("fp-ts/lib/pipeable");
|
|
9
|
+
const Either_1 = require("fp-ts/lib/Either");
|
|
10
|
+
const Level = t.union([
|
|
11
|
+
t.literal('trace'),
|
|
12
|
+
t.literal('debug'),
|
|
13
|
+
t.literal('info'),
|
|
14
|
+
t.literal('warn'),
|
|
15
|
+
t.literal('error'),
|
|
16
|
+
t.literal('fatal'),
|
|
17
|
+
]);
|
|
18
|
+
function getLogLevel(level) {
|
|
19
|
+
if (!level) {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
return (0, pipeable_1.pipe)(Level.decode(level), (0, Either_1.fold)(() => undefined, (v) => v));
|
|
23
|
+
}
|
|
24
|
+
exports.getLogLevel = getLogLevel;
|
|
25
|
+
function createBunyanLogger(identifier, logLevel) {
|
|
26
|
+
const level = getLogLevel(process.env.LOG_LEVEL) || getLogLevel(logLevel) || 'info';
|
|
27
|
+
const log = (0, browser_bunyan_1.createLogger)({
|
|
28
|
+
name: process.env.PROJECT_NAME || identifier || 'rootLogger',
|
|
29
|
+
level,
|
|
30
|
+
serializers: browser_bunyan_1.stdSerializers,
|
|
31
|
+
stream: new console_plain_stream_1.ConsolePlainStream(),
|
|
32
|
+
});
|
|
33
|
+
return log;
|
|
34
|
+
}
|
|
35
|
+
exports.createBunyanLogger = createBunyanLogger;
|
|
36
|
+
//# sourceMappingURL=bunyanLogger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bunyanLogger.js","sourceRoot":"","sources":["../../src/logging/bunyanLogger.ts"],"names":[],"mappings":";;;;AAAA,mDAA6D;AAC7D,+EAAyE;AACzE,iDAA0B;AAC1B,iDAAyC;AACzC,6CAAuC;AAEvC,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC;IACpB,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;IAClB,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;IAClB,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;IACjB,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;IACjB,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;IAClB,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;CACnB,CAAC,CAAA;AAIF,SAAgB,WAAW,CAAC,KAAyB;IACnD,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,SAAS,CAAA;KACjB;IAED,OAAO,IAAA,eAAI,EACT,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EACnB,IAAA,aAAI,EACF,GAAG,EAAE,CAAC,SAAS,EACf,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CACT,CACF,CAAA;AACH,CAAC;AAZD,kCAYC;AAED,SAAgB,kBAAkB,CAChC,UAAmB,EACnB,QAAiB;IAEjB,MAAM,KAAK,GACT,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,WAAW,CAAC,QAAQ,CAAC,IAAI,MAAM,CAAA;IACvE,MAAM,GAAG,GAAG,IAAA,6BAAY,EAAC;QACvB,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,YAAY,I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