@nmshd/transport 1.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.
- package/LICENSE +1 -0
- package/README.md +18 -0
- package/dist/TransportBuildInformation.d.ts +13 -0
- package/dist/TransportBuildInformation.js +25 -0
- package/dist/TransportBuildInformation.js.map +1 -0
- package/dist/core/CoreCrypto.d.ts +108 -0
- package/dist/core/CoreCrypto.js +205 -0
- package/dist/core/CoreCrypto.js.map +1 -0
- package/dist/core/CoreError.d.ts +18 -0
- package/dist/core/CoreError.js +63 -0
- package/dist/core/CoreError.js.map +1 -0
- package/dist/core/CoreIdHelper.d.ts +9 -0
- package/dist/core/CoreIdHelper.js +23 -0
- package/dist/core/CoreIdHelper.js.map +1 -0
- package/dist/core/CoreIds.d.ts +9 -0
- package/dist/core/CoreIds.js +14 -0
- package/dist/core/CoreIds.js.map +1 -0
- package/dist/core/CoreSerializable.d.ts +18 -0
- package/dist/core/CoreSerializable.js +44 -0
- package/dist/core/CoreSerializable.js.map +1 -0
- package/dist/core/CoreSerializableAsync.d.ts +18 -0
- package/dist/core/CoreSerializableAsync.js +44 -0
- package/dist/core/CoreSerializableAsync.js.map +1 -0
- package/dist/core/CoreSynchronizable.d.ts +11 -0
- package/dist/core/CoreSynchronizable.js +30 -0
- package/dist/core/CoreSynchronizable.js.map +1 -0
- package/dist/core/CoreUtil.d.ts +6 -0
- package/dist/core/CoreUtil.js +38 -0
- package/dist/core/CoreUtil.js.map +1 -0
- package/dist/core/DbCollectionNames.d.ts +11 -0
- package/dist/core/DbCollectionNames.js +16 -0
- package/dist/core/DbCollectionNames.js.map +1 -0
- package/dist/core/ICacheable.d.ts +4 -0
- package/dist/core/ICacheable.js +14 -0
- package/dist/core/ICacheable.js.map +1 -0
- package/dist/core/Transport.d.ts +47 -0
- package/dist/core/Transport.js +71 -0
- package/dist/core/Transport.js.map +1 -0
- package/dist/core/TransportContext.d.ts +8 -0
- package/dist/core/TransportContext.js +29 -0
- package/dist/core/TransportContext.js.map +1 -0
- package/dist/core/TransportController.d.ts +51 -0
- package/dist/core/TransportController.js +99 -0
- package/dist/core/TransportController.js.map +1 -0
- package/dist/core/TransportErrors.d.ts +125 -0
- package/dist/core/TransportErrors.js +255 -0
- package/dist/core/TransportErrors.js.map +1 -0
- package/dist/core/TransportLoggerFactory.d.ts +7 -0
- package/dist/core/TransportLoggerFactory.js +23 -0
- package/dist/core/TransportLoggerFactory.js.map +1 -0
- package/dist/core/backbone/AuthClient.d.ts +17 -0
- package/dist/core/backbone/AuthClient.js +47 -0
- package/dist/core/backbone/AuthClient.js.map +1 -0
- package/dist/core/backbone/Authenticator.d.ts +16 -0
- package/dist/core/backbone/Authenticator.js +62 -0
- package/dist/core/backbone/Authenticator.js.map +1 -0
- package/dist/core/backbone/BackboneIds.d.ts +11 -0
- package/dist/core/backbone/BackboneIds.js +16 -0
- package/dist/core/backbone/BackboneIds.js.map +1 -0
- package/dist/core/backbone/ClientResult.d.ts +19 -0
- package/dist/core/backbone/ClientResult.js +58 -0
- package/dist/core/backbone/ClientResult.js.map +1 -0
- package/dist/core/backbone/Paginator.d.ts +17 -0
- package/dist/core/backbone/Paginator.js +44 -0
- package/dist/core/backbone/Paginator.js.map +1 -0
- package/dist/core/backbone/PlatformError.d.ts +9 -0
- package/dist/core/backbone/PlatformError.js +3 -0
- package/dist/core/backbone/PlatformError.js.map +1 -0
- package/dist/core/backbone/PlatformParameters.d.ts +6 -0
- package/dist/core/backbone/PlatformParameters.js +3 -0
- package/dist/core/backbone/PlatformParameters.js.map +1 -0
- package/dist/core/backbone/PlatformResponse.d.ts +16 -0
- package/dist/core/backbone/PlatformResponse.js +3 -0
- package/dist/core/backbone/PlatformResponse.js.map +1 -0
- package/dist/core/backbone/RESTClient.d.ts +46 -0
- package/dist/core/backbone/RESTClient.js +425 -0
- package/dist/core/backbone/RESTClient.js.map +1 -0
- package/dist/core/backbone/RESTClientAuthenticate.d.ts +23 -0
- package/dist/core/backbone/RESTClientAuthenticate.js +72 -0
- package/dist/core/backbone/RESTClientAuthenticate.js.map +1 -0
- package/dist/core/backbone/RequestError.d.ts +24 -0
- package/dist/core/backbone/RequestError.js +101 -0
- package/dist/core/backbone/RequestError.js.map +1 -0
- package/dist/core/backbone/index.d.ts +6 -0
- package/dist/core/backbone/index.js +19 -0
- package/dist/core/backbone/index.js.map +1 -0
- package/dist/core/index.d.ts +16 -0
- package/dist/core/index.js +29 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/logging/logExecutionTime.d.ts +26 -0
- package/dist/core/logging/logExecutionTime.js +58 -0
- package/dist/core/logging/logExecutionTime.js.map +1 -0
- package/dist/core/types/CoreAddress.d.ts +15 -0
- package/dist/core/types/CoreAddress.js +56 -0
- package/dist/core/types/CoreAddress.js.map +1 -0
- package/dist/core/types/CoreDate.d.ts +37 -0
- package/dist/core/types/CoreDate.js +156 -0
- package/dist/core/types/CoreDate.js.map +1 -0
- package/dist/core/types/CoreHash.d.ts +37 -0
- package/dist/core/types/CoreHash.js +75 -0
- package/dist/core/types/CoreHash.js.map +1 -0
- package/dist/core/types/CoreId.d.ts +16 -0
- package/dist/core/types/CoreId.js +57 -0
- package/dist/core/types/CoreId.js.map +1 -0
- package/dist/core/types/TransportVersion.d.ts +4 -0
- package/dist/core/types/TransportVersion.js +9 -0
- package/dist/core/types/TransportVersion.js.map +1 -0
- package/dist/core/types/index.d.ts +5 -0
- package/dist/core/types/index.js +18 -0
- package/dist/core/types/index.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/modules/accounts/AccountController.d.ts +77 -0
- package/dist/modules/accounts/AccountController.js +337 -0
- package/dist/modules/accounts/AccountController.js.map +1 -0
- package/dist/modules/accounts/IdentityController.d.ts +21 -0
- package/dist/modules/accounts/IdentityController.js +67 -0
- package/dist/modules/accounts/IdentityController.js.map +1 -0
- package/dist/modules/accounts/IdentityUtil.d.ts +6 -0
- package/dist/modules/accounts/IdentityUtil.js +56 -0
- package/dist/modules/accounts/IdentityUtil.js.map +1 -0
- package/dist/modules/accounts/backbone/IdentityClient.d.ts +23 -0
- package/dist/modules/accounts/backbone/IdentityClient.js +15 -0
- package/dist/modules/accounts/backbone/IdentityClient.js.map +1 -0
- package/dist/modules/accounts/data/Identity.d.ts +34 -0
- package/dist/modules/accounts/data/Identity.js +69 -0
- package/dist/modules/accounts/data/Identity.js.map +1 -0
- package/dist/modules/accounts/data/IdentitySecretCredentials.d.ts +16 -0
- package/dist/modules/accounts/data/IdentitySecretCredentials.js +47 -0
- package/dist/modules/accounts/data/IdentitySecretCredentials.js.map +1 -0
- package/dist/modules/certificates/CertificateController.d.ts +14 -0
- package/dist/modules/certificates/CertificateController.js +20 -0
- package/dist/modules/certificates/CertificateController.js.map +1 -0
- package/dist/modules/certificates/CertificateIssuer.d.ts +27 -0
- package/dist/modules/certificates/CertificateIssuer.js +42 -0
- package/dist/modules/certificates/CertificateIssuer.js.map +1 -0
- package/dist/modules/certificates/CertificateValidator.d.ts +14 -0
- package/dist/modules/certificates/CertificateValidator.js +20 -0
- package/dist/modules/certificates/CertificateValidator.js.map +1 -0
- package/dist/modules/certificates/data/Certificate.d.ts +34 -0
- package/dist/modules/certificates/data/Certificate.js +65 -0
- package/dist/modules/certificates/data/Certificate.js.map +1 -0
- package/dist/modules/certificates/data/CertificateConstraint.d.ts +10 -0
- package/dist/modules/certificates/data/CertificateConstraint.js +28 -0
- package/dist/modules/certificates/data/CertificateConstraint.js.map +1 -0
- package/dist/modules/certificates/data/CertificateContent.d.ts +28 -0
- package/dist/modules/certificates/data/CertificateContent.js +70 -0
- package/dist/modules/certificates/data/CertificateContent.js.map +1 -0
- package/dist/modules/certificates/data/CertificateItem.d.ts +11 -0
- package/dist/modules/certificates/data/CertificateItem.js +29 -0
- package/dist/modules/certificates/data/CertificateItem.js.map +1 -0
- package/dist/modules/certificates/data/constraints/CertificateBorderConstraint.d.ts +29 -0
- package/dist/modules/certificates/data/constraints/CertificateBorderConstraint.js +57 -0
- package/dist/modules/certificates/data/constraints/CertificateBorderConstraint.js.map +1 -0
- package/dist/modules/certificates/data/constraints/CertificateCityConstraint.d.ts +31 -0
- package/dist/modules/certificates/data/constraints/CertificateCityConstraint.js +60 -0
- package/dist/modules/certificates/data/constraints/CertificateCityConstraint.js.map +1 -0
- package/dist/modules/certificates/data/constraints/CertificateIdentityConstraint.d.ts +9 -0
- package/dist/modules/certificates/data/constraints/CertificateIdentityConstraint.js +31 -0
- package/dist/modules/certificates/data/constraints/CertificateIdentityConstraint.js.map +1 -0
- package/dist/modules/certificates/data/constraints/CertificateTimeConstraint.d.ts +16 -0
- package/dist/modules/certificates/data/constraints/CertificateTimeConstraint.js +41 -0
- package/dist/modules/certificates/data/constraints/CertificateTimeConstraint.js.map +1 -0
- package/dist/modules/certificates/data/items/CertificateAuthorizationItem.d.ts +17 -0
- package/dist/modules/certificates/data/items/CertificateAuthorizationItem.js +39 -0
- package/dist/modules/certificates/data/items/CertificateAuthorizationItem.js.map +1 -0
- package/dist/modules/certificates/data/items/CertificateDelegateItem.d.ts +18 -0
- package/dist/modules/certificates/data/items/CertificateDelegateItem.js +46 -0
- package/dist/modules/certificates/data/items/CertificateDelegateItem.js.map +1 -0
- package/dist/modules/certificates/data/items/CertificatePrivateAttributeItem.d.ts +19 -0
- package/dist/modules/certificates/data/items/CertificatePrivateAttributeItem.js +42 -0
- package/dist/modules/certificates/data/items/CertificatePrivateAttributeItem.js.map +1 -0
- package/dist/modules/certificates/data/items/CertificatePrivateAttributeItemSource.d.ts +25 -0
- package/dist/modules/certificates/data/items/CertificatePrivateAttributeItemSource.js +55 -0
- package/dist/modules/certificates/data/items/CertificatePrivateAttributeItemSource.js.map +1 -0
- package/dist/modules/certificates/data/items/CertificatePublicAttributeItem.d.ts +14 -0
- package/dist/modules/certificates/data/items/CertificatePublicAttributeItem.js +39 -0
- package/dist/modules/certificates/data/items/CertificatePublicAttributeItem.js.map +1 -0
- package/dist/modules/certificates/data/items/CertificateRoleItem.d.ts +16 -0
- package/dist/modules/certificates/data/items/CertificateRoleItem.js +38 -0
- package/dist/modules/certificates/data/items/CertificateRoleItem.js.map +1 -0
- package/dist/modules/challenges/ChallengeController.d.ts +16 -0
- package/dist/modules/challenges/ChallengeController.js +123 -0
- package/dist/modules/challenges/ChallengeController.js.map +1 -0
- package/dist/modules/challenges/backbone/ChallengeAuthClient.d.ts +18 -0
- package/dist/modules/challenges/backbone/ChallengeAuthClient.js +14 -0
- package/dist/modules/challenges/backbone/ChallengeAuthClient.js.map +1 -0
- package/dist/modules/challenges/backbone/ChallengeClient.d.ts +6 -0
- package/dist/modules/challenges/backbone/ChallengeClient.js +11 -0
- package/dist/modules/challenges/backbone/ChallengeClient.js.map +1 -0
- package/dist/modules/challenges/data/Challenge.d.ts +22 -0
- package/dist/modules/challenges/data/Challenge.js +59 -0
- package/dist/modules/challenges/data/Challenge.js.map +1 -0
- package/dist/modules/challenges/data/ChallengeSigned.d.ts +18 -0
- package/dist/modules/challenges/data/ChallengeSigned.js +50 -0
- package/dist/modules/challenges/data/ChallengeSigned.js.map +1 -0
- package/dist/modules/devices/DeviceController.d.ts +27 -0
- package/dist/modules/devices/DeviceController.js +120 -0
- package/dist/modules/devices/DeviceController.js.map +1 -0
- package/dist/modules/devices/DeviceSecretController.d.ts +36 -0
- package/dist/modules/devices/DeviceSecretController.js +163 -0
- package/dist/modules/devices/DeviceSecretController.js.map +1 -0
- package/dist/modules/devices/DevicesController.d.ts +20 -0
- package/dist/modules/devices/DevicesController.js +96 -0
- package/dist/modules/devices/DevicesController.js.map +1 -0
- package/dist/modules/devices/backbone/BackbonePostDevices.d.ts +11 -0
- package/dist/modules/devices/backbone/BackbonePostDevices.js +3 -0
- package/dist/modules/devices/backbone/BackbonePostDevices.js.map +1 -0
- package/dist/modules/devices/backbone/DeviceAuthClient.d.ts +18 -0
- package/dist/modules/devices/backbone/DeviceAuthClient.js +21 -0
- package/dist/modules/devices/backbone/DeviceAuthClient.js.map +1 -0
- package/dist/modules/devices/backbone/DeviceClient.d.ts +7 -0
- package/dist/modules/devices/backbone/DeviceClient.js +15 -0
- package/dist/modules/devices/backbone/DeviceClient.js.map +1 -0
- package/dist/modules/devices/local/Device.d.ts +46 -0
- package/dist/modules/devices/local/Device.js +115 -0
- package/dist/modules/devices/local/Device.js.map +1 -0
- package/dist/modules/devices/local/DeviceSecretCredentials.d.ts +12 -0
- package/dist/modules/devices/local/DeviceSecretCredentials.js +40 -0
- package/dist/modules/devices/local/DeviceSecretCredentials.js.map +1 -0
- package/dist/modules/devices/local/SendDeviceParameters.d.ts +13 -0
- package/dist/modules/devices/local/SendDeviceParameters.js +43 -0
- package/dist/modules/devices/local/SendDeviceParameters.js.map +1 -0
- package/dist/modules/devices/transmission/DeviceSharedSecret.d.ts +33 -0
- package/dist/modules/devices/transmission/DeviceSharedSecret.js +90 -0
- package/dist/modules/devices/transmission/DeviceSharedSecret.js.map +1 -0
- package/dist/modules/files/FileController.d.ts +25 -0
- package/dist/modules/files/FileController.js +196 -0
- package/dist/modules/files/FileController.js.map +1 -0
- package/dist/modules/files/backbone/BackboneGetFiles.d.ts +21 -0
- package/dist/modules/files/backbone/BackboneGetFiles.js +3 -0
- package/dist/modules/files/backbone/BackboneGetFiles.js.map +1 -0
- package/dist/modules/files/backbone/BackbonePostFiles.d.ts +25 -0
- package/dist/modules/files/backbone/BackbonePostFiles.js +3 -0
- package/dist/modules/files/backbone/BackbonePostFiles.js.map +1 -0
- package/dist/modules/files/backbone/FileClient.d.ts +12 -0
- package/dist/modules/files/backbone/FileClient.js +23 -0
- package/dist/modules/files/backbone/FileClient.js.map +1 -0
- package/dist/modules/files/local/CachedFile.d.ts +47 -0
- package/dist/modules/files/local/CachedFile.js +140 -0
- package/dist/modules/files/local/CachedFile.js.map +1 -0
- package/dist/modules/files/local/File.d.ts +27 -0
- package/dist/modules/files/local/File.js +88 -0
- package/dist/modules/files/local/File.js.map +1 -0
- package/dist/modules/files/local/SendFileParameters.d.ts +23 -0
- package/dist/modules/files/local/SendFileParameters.js +65 -0
- package/dist/modules/files/local/SendFileParameters.js.map +1 -0
- package/dist/modules/files/transmission/FileMetadata.d.ts +24 -0
- package/dist/modules/files/transmission/FileMetadata.js +69 -0
- package/dist/modules/files/transmission/FileMetadata.js.map +1 -0
- package/dist/modules/files/transmission/FileReference.d.ts +15 -0
- package/dist/modules/files/transmission/FileReference.js +66 -0
- package/dist/modules/files/transmission/FileReference.js.map +1 -0
- package/dist/modules/index.d.ts +110 -0
- package/dist/modules/index.js +123 -0
- package/dist/modules/index.js.map +1 -0
- package/dist/modules/messages/MessageController.d.ts +29 -0
- package/dist/modules/messages/MessageController.js +316 -0
- package/dist/modules/messages/MessageController.js.map +1 -0
- package/dist/modules/messages/backbone/BackboneGetMessages.d.ts +25 -0
- package/dist/modules/messages/backbone/BackboneGetMessages.js +3 -0
- package/dist/modules/messages/backbone/BackboneGetMessages.js.map +1 -0
- package/dist/modules/messages/backbone/BackbonePostMessages.d.ts +16 -0
- package/dist/modules/messages/backbone/BackbonePostMessages.js +3 -0
- package/dist/modules/messages/backbone/BackbonePostMessages.js.map +1 -0
- package/dist/modules/messages/backbone/MessageClient.d.ts +12 -0
- package/dist/modules/messages/backbone/MessageClient.js +23 -0
- package/dist/modules/messages/backbone/MessageClient.js.map +1 -0
- package/dist/modules/messages/local/CachedMessage.d.ts +23 -0
- package/dist/modules/messages/local/CachedMessage.js +67 -0
- package/dist/modules/messages/local/CachedMessage.js.map +1 -0
- package/dist/modules/messages/local/Message.d.ts +26 -0
- package/dist/modules/messages/local/Message.js +87 -0
- package/dist/modules/messages/local/Message.js.map +1 -0
- package/dist/modules/messages/local/SendMessageParameters.d.ts +15 -0
- package/dist/modules/messages/local/SendMessageParameters.js +44 -0
- package/dist/modules/messages/local/SendMessageParameters.js.map +1 -0
- package/dist/modules/messages/transmission/MessageEnvelope.d.ts +24 -0
- package/dist/modules/messages/transmission/MessageEnvelope.js +81 -0
- package/dist/modules/messages/transmission/MessageEnvelope.js.map +1 -0
- package/dist/modules/messages/transmission/MessageEnvelopeRecipient.d.ts +16 -0
- package/dist/modules/messages/transmission/MessageEnvelopeRecipient.js +47 -0
- package/dist/modules/messages/transmission/MessageEnvelopeRecipient.js.map +1 -0
- package/dist/modules/messages/transmission/MessagePlain.d.ts +29 -0
- package/dist/modules/messages/transmission/MessagePlain.js +68 -0
- package/dist/modules/messages/transmission/MessagePlain.js.map +1 -0
- package/dist/modules/messages/transmission/MessageSignature.d.ts +11 -0
- package/dist/modules/messages/transmission/MessageSignature.js +36 -0
- package/dist/modules/messages/transmission/MessageSignature.js.map +1 -0
- package/dist/modules/messages/transmission/MessageSigned.d.ts +15 -0
- package/dist/modules/messages/transmission/MessageSigned.js +43 -0
- package/dist/modules/messages/transmission/MessageSigned.js.map +1 -0
- package/dist/modules/relationshipTemplates/RelationshipTemplateController.d.ts +26 -0
- package/dist/modules/relationshipTemplates/RelationshipTemplateController.js +156 -0
- package/dist/modules/relationshipTemplates/RelationshipTemplateController.js.map +1 -0
- package/dist/modules/relationshipTemplates/backbone/BackboneGetRelationshipTemplates.d.ts +17 -0
- package/dist/modules/relationshipTemplates/backbone/BackboneGetRelationshipTemplates.js +3 -0
- package/dist/modules/relationshipTemplates/backbone/BackboneGetRelationshipTemplates.js.map +1 -0
- package/dist/modules/relationshipTemplates/backbone/BackbonePostRelationshipTemplates.d.ts +9 -0
- package/dist/modules/relationshipTemplates/backbone/BackbonePostRelationshipTemplates.js +3 -0
- package/dist/modules/relationshipTemplates/backbone/BackbonePostRelationshipTemplates.js.map +1 -0
- package/dist/modules/relationshipTemplates/backbone/RelationshipTemplateClient.d.ts +11 -0
- package/dist/modules/relationshipTemplates/backbone/RelationshipTemplateClient.js +20 -0
- package/dist/modules/relationshipTemplates/backbone/RelationshipTemplateClient.js.map +1 -0
- package/dist/modules/relationshipTemplates/local/CachedRelationshipTemplate.d.ts +29 -0
- package/dist/modules/relationshipTemplates/local/CachedRelationshipTemplate.js +80 -0
- package/dist/modules/relationshipTemplates/local/CachedRelationshipTemplate.js.map +1 -0
- package/dist/modules/relationshipTemplates/local/RelationshipTemplate.d.ts +26 -0
- package/dist/modules/relationshipTemplates/local/RelationshipTemplate.js +85 -0
- package/dist/modules/relationshipTemplates/local/RelationshipTemplate.js.map +1 -0
- package/dist/modules/relationshipTemplates/local/SendRelationshipTemplateParameters.d.ts +14 -0
- package/dist/modules/relationshipTemplates/local/SendRelationshipTemplateParameters.js +44 -0
- package/dist/modules/relationshipTemplates/local/SendRelationshipTemplateParameters.js.map +1 -0
- package/dist/modules/relationshipTemplates/transmission/RelationshipTemplateContent.d.ts +16 -0
- package/dist/modules/relationshipTemplates/transmission/RelationshipTemplateContent.js +45 -0
- package/dist/modules/relationshipTemplates/transmission/RelationshipTemplateContent.js.map +1 -0
- package/dist/modules/relationshipTemplates/transmission/RelationshipTemplatePublicKey.d.ts +19 -0
- package/dist/modules/relationshipTemplates/transmission/RelationshipTemplatePublicKey.js +61 -0
- package/dist/modules/relationshipTemplates/transmission/RelationshipTemplatePublicKey.js.map +1 -0
- package/dist/modules/relationshipTemplates/transmission/RelationshipTemplateSigned.d.ts +12 -0
- package/dist/modules/relationshipTemplates/transmission/RelationshipTemplateSigned.js +39 -0
- package/dist/modules/relationshipTemplates/transmission/RelationshipTemplateSigned.js.map +1 -0
- package/dist/modules/relationships/RelationshipSecretController.d.ts +31 -0
- package/dist/modules/relationships/RelationshipSecretController.js +161 -0
- package/dist/modules/relationships/RelationshipSecretController.js.map +1 -0
- package/dist/modules/relationships/RelationshipsController.d.ts +47 -0
- package/dist/modules/relationships/RelationshipsController.js +472 -0
- package/dist/modules/relationships/RelationshipsController.js.map +1 -0
- package/dist/modules/relationships/backbone/BackboneGetRelationships.d.ts +18 -0
- package/dist/modules/relationships/backbone/BackboneGetRelationships.js +3 -0
- package/dist/modules/relationships/backbone/BackboneGetRelationships.js.map +1 -0
- package/dist/modules/relationships/backbone/BackboneGetRelationshipsChanges.d.ts +23 -0
- package/dist/modules/relationships/backbone/BackboneGetRelationshipsChanges.js +3 -0
- package/dist/modules/relationships/backbone/BackboneGetRelationshipsChanges.js.map +1 -0
- package/dist/modules/relationships/backbone/BackbonePostRelationshipsChanges.d.ts +8 -0
- package/dist/modules/relationships/backbone/BackbonePostRelationshipsChanges.js +3 -0
- package/dist/modules/relationships/backbone/BackbonePostRelationshipsChanges.js.map +1 -0
- package/dist/modules/relationships/backbone/RelationshipClient.d.ts +17 -0
- package/dist/modules/relationships/backbone/RelationshipClient.js +42 -0
- package/dist/modules/relationships/backbone/RelationshipClient.js.map +1 -0
- package/dist/modules/relationships/local/CachedRelationship.d.ts +18 -0
- package/dist/modules/relationships/local/CachedRelationship.js +53 -0
- package/dist/modules/relationships/local/CachedRelationship.js.map +1 -0
- package/dist/modules/relationships/local/Relationship.d.ts +37 -0
- package/dist/modules/relationships/local/Relationship.js +140 -0
- package/dist/modules/relationships/local/Relationship.js.map +1 -0
- package/dist/modules/relationships/local/SendRelationshipParameters.d.ts +13 -0
- package/dist/modules/relationships/local/SendRelationshipParameters.js +39 -0
- package/dist/modules/relationships/local/SendRelationshipParameters.js.map +1 -0
- package/dist/modules/relationships/transmission/RelationshipStatus.d.ts +8 -0
- package/dist/modules/relationships/transmission/RelationshipStatus.js +13 -0
- package/dist/modules/relationships/transmission/RelationshipStatus.js.map +1 -0
- package/dist/modules/relationships/transmission/changes/RelationshipChange.d.ts +27 -0
- package/dist/modules/relationships/transmission/changes/RelationshipChange.js +72 -0
- package/dist/modules/relationships/transmission/changes/RelationshipChange.js.map +1 -0
- package/dist/modules/relationships/transmission/changes/RelationshipChangeRequest.d.ts +20 -0
- package/dist/modules/relationships/transmission/changes/RelationshipChangeRequest.js +53 -0
- package/dist/modules/relationships/transmission/changes/RelationshipChangeRequest.js.map +1 -0
- package/dist/modules/relationships/transmission/changes/RelationshipChangeResponse.d.ts +20 -0
- package/dist/modules/relationships/transmission/changes/RelationshipChangeResponse.js +53 -0
- package/dist/modules/relationships/transmission/changes/RelationshipChangeResponse.js.map +1 -0
- package/dist/modules/relationships/transmission/changes/RelationshipChangeStatus.d.ts +6 -0
- package/dist/modules/relationships/transmission/changes/RelationshipChangeStatus.js +11 -0
- package/dist/modules/relationships/transmission/changes/RelationshipChangeStatus.js.map +1 -0
- package/dist/modules/relationships/transmission/changes/RelationshipChangeType.d.ts +5 -0
- package/dist/modules/relationships/transmission/changes/RelationshipChangeType.js +10 -0
- package/dist/modules/relationships/transmission/changes/RelationshipChangeType.js.map +1 -0
- package/dist/modules/relationships/transmission/requests/RelationshipCreationChangeRequestCipher.d.ts +13 -0
- package/dist/modules/relationships/transmission/requests/RelationshipCreationChangeRequestCipher.js +42 -0
- package/dist/modules/relationships/transmission/requests/RelationshipCreationChangeRequestCipher.js.map +1 -0
- package/dist/modules/relationships/transmission/requests/RelationshipCreationChangeRequestContent.d.ts +15 -0
- package/dist/modules/relationships/transmission/requests/RelationshipCreationChangeRequestContent.js +44 -0
- package/dist/modules/relationships/transmission/requests/RelationshipCreationChangeRequestContent.js.map +1 -0
- package/dist/modules/relationships/transmission/requests/RelationshipCreationChangeRequestSigned.d.ts +14 -0
- package/dist/modules/relationships/transmission/requests/RelationshipCreationChangeRequestSigned.js +44 -0
- package/dist/modules/relationships/transmission/requests/RelationshipCreationChangeRequestSigned.js.map +1 -0
- package/dist/modules/relationships/transmission/responses/RelationshipCreationChangeResponseCipher.d.ts +13 -0
- package/dist/modules/relationships/transmission/responses/RelationshipCreationChangeResponseCipher.js +42 -0
- package/dist/modules/relationships/transmission/responses/RelationshipCreationChangeResponseCipher.js.map +1 -0
- package/dist/modules/relationships/transmission/responses/RelationshipCreationChangeResponseContent.d.ts +12 -0
- package/dist/modules/relationships/transmission/responses/RelationshipCreationChangeResponseContent.js +38 -0
- package/dist/modules/relationships/transmission/responses/RelationshipCreationChangeResponseContent.js.map +1 -0
- package/dist/modules/relationships/transmission/responses/RelationshipCreationChangeResponseSigned.d.ts +14 -0
- package/dist/modules/relationships/transmission/responses/RelationshipCreationChangeResponseSigned.js +44 -0
- package/dist/modules/relationships/transmission/responses/RelationshipCreationChangeResponseSigned.js.map +1 -0
- package/dist/modules/secrets/SecretController.d.ts +39 -0
- package/dist/modules/secrets/SecretController.js +168 -0
- package/dist/modules/secrets/SecretController.js.map +1 -0
- package/dist/modules/secrets/data/SecretContainerCipher.d.ts +25 -0
- package/dist/modules/secrets/data/SecretContainerCipher.js +87 -0
- package/dist/modules/secrets/data/SecretContainerCipher.js.map +1 -0
- package/dist/modules/secrets/data/SecretContainerPlain.d.ts +25 -0
- package/dist/modules/secrets/data/SecretContainerPlain.js +76 -0
- package/dist/modules/secrets/data/SecretContainerPlain.js.map +1 -0
- package/dist/modules/sync/ChangedItems.d.ts +9 -0
- package/dist/modules/sync/ChangedItems.js +17 -0
- package/dist/modules/sync/ChangedItems.js.map +1 -0
- package/dist/modules/sync/DatawalletModificationMapper.d.ts +7 -0
- package/dist/modules/sync/DatawalletModificationMapper.js +62 -0
- package/dist/modules/sync/DatawalletModificationMapper.js.map +1 -0
- package/dist/modules/sync/DatawalletModificationsProcessor.d.ts +21 -0
- package/dist/modules/sync/DatawalletModificationsProcessor.js +111 -0
- package/dist/modules/sync/DatawalletModificationsProcessor.js.map +1 -0
- package/dist/modules/sync/ExternalEventsProcessor.d.ts +19 -0
- package/dist/modules/sync/ExternalEventsProcessor.js +83 -0
- package/dist/modules/sync/ExternalEventsProcessor.js.map +1 -0
- package/dist/modules/sync/SyncController.d.ts +37 -0
- package/dist/modules/sync/SyncController.js +214 -0
- package/dist/modules/sync/SyncController.js.map +1 -0
- package/dist/modules/sync/SynchronizedCollection.d.ts +18 -0
- package/dist/modules/sync/SynchronizedCollection.js +163 -0
- package/dist/modules/sync/SynchronizedCollection.js.map +1 -0
- package/dist/modules/sync/WhatToSync.d.ts +1 -0
- package/dist/modules/sync/WhatToSync.js +3 -0
- package/dist/modules/sync/WhatToSync.js.map +1 -0
- package/dist/modules/sync/backbone/BackboneDatawalletModification.d.ts +11 -0
- package/dist/modules/sync/backbone/BackboneDatawalletModification.js +3 -0
- package/dist/modules/sync/backbone/BackboneDatawalletModification.js.map +1 -0
- package/dist/modules/sync/backbone/BackboneExternalEvent.d.ts +8 -0
- package/dist/modules/sync/backbone/BackboneExternalEvent.js +3 -0
- package/dist/modules/sync/backbone/BackboneExternalEvent.js.map +1 -0
- package/dist/modules/sync/backbone/BackboneSyncRun.d.ts +9 -0
- package/dist/modules/sync/backbone/BackboneSyncRun.js +3 -0
- package/dist/modules/sync/backbone/BackboneSyncRun.js.map +1 -0
- package/dist/modules/sync/backbone/CreateDatawalletModifications.d.ts +19 -0
- package/dist/modules/sync/backbone/CreateDatawalletModifications.js +3 -0
- package/dist/modules/sync/backbone/CreateDatawalletModifications.js.map +1 -0
- package/dist/modules/sync/backbone/FinalizeSyncRun.d.ts +23 -0
- package/dist/modules/sync/backbone/FinalizeSyncRun.js +3 -0
- package/dist/modules/sync/backbone/FinalizeSyncRun.js.map +1 -0
- package/dist/modules/sync/backbone/GetDatawalletModifications.d.ts +3 -0
- package/dist/modules/sync/backbone/GetDatawalletModifications.js +3 -0
- package/dist/modules/sync/backbone/GetDatawalletModifications.js.map +1 -0
- package/dist/modules/sync/backbone/StartSyncRun.d.ts +9 -0
- package/dist/modules/sync/backbone/StartSyncRun.js +9 -0
- package/dist/modules/sync/backbone/StartSyncRun.js.map +1 -0
- package/dist/modules/sync/backbone/SyncClient.d.ts +15 -0
- package/dist/modules/sync/backbone/SyncClient.js +23 -0
- package/dist/modules/sync/backbone/SyncClient.js.map +1 -0
- package/dist/modules/sync/local/DatawalletModification.d.ts +30 -0
- package/dist/modules/sync/local/DatawalletModification.js +71 -0
- package/dist/modules/sync/local/DatawalletModification.js.map +1 -0
- package/dist/modules/tokens/AnonymousTokenController.d.ts +11 -0
- package/dist/modules/tokens/AnonymousTokenController.js +47 -0
- package/dist/modules/tokens/AnonymousTokenController.js.map +1 -0
- package/dist/modules/tokens/TokenController.d.ts +24 -0
- package/dist/modules/tokens/TokenController.js +137 -0
- package/dist/modules/tokens/TokenController.js.map +1 -0
- package/dist/modules/tokens/backbone/AnonymousTokenClient.d.ts +6 -0
- package/dist/modules/tokens/backbone/AnonymousTokenClient.js +11 -0
- package/dist/modules/tokens/backbone/AnonymousTokenClient.js.map +1 -0
- package/dist/modules/tokens/backbone/BackboneGetTokens.d.ts +11 -0
- package/dist/modules/tokens/backbone/BackboneGetTokens.js +3 -0
- package/dist/modules/tokens/backbone/BackboneGetTokens.js.map +1 -0
- package/dist/modules/tokens/backbone/BackbonePostTokens.d.ts +9 -0
- package/dist/modules/tokens/backbone/BackbonePostTokens.js +3 -0
- package/dist/modules/tokens/backbone/BackbonePostTokens.js.map +1 -0
- package/dist/modules/tokens/backbone/TokenClient.d.ts +11 -0
- package/dist/modules/tokens/backbone/TokenClient.js +20 -0
- package/dist/modules/tokens/backbone/TokenClient.js.map +1 -0
- package/dist/modules/tokens/local/CachedToken.d.ts +18 -0
- package/dist/modules/tokens/local/CachedToken.js +53 -0
- package/dist/modules/tokens/local/CachedToken.js.map +1 -0
- package/dist/modules/tokens/local/SendTokenParameters.d.ts +14 -0
- package/dist/modules/tokens/local/SendTokenParameters.js +43 -0
- package/dist/modules/tokens/local/SendTokenParameters.js.map +1 -0
- package/dist/modules/tokens/local/Token.d.ts +28 -0
- package/dist/modules/tokens/local/Token.js +91 -0
- package/dist/modules/tokens/local/Token.js.map +1 -0
- package/dist/modules/tokens/transmission/TokenContentDeviceSharedSecret.d.ts +10 -0
- package/dist/modules/tokens/transmission/TokenContentDeviceSharedSecret.js +34 -0
- package/dist/modules/tokens/transmission/TokenContentDeviceSharedSecret.js.map +1 -0
- package/dist/modules/tokens/transmission/TokenContentFile.d.ts +12 -0
- package/dist/modules/tokens/transmission/TokenContentFile.js +39 -0
- package/dist/modules/tokens/transmission/TokenContentFile.js.map +1 -0
- package/dist/modules/tokens/transmission/TokenContentRelationshipTemplate.d.ts +12 -0
- package/dist/modules/tokens/transmission/TokenContentRelationshipTemplate.js +39 -0
- package/dist/modules/tokens/transmission/TokenContentRelationshipTemplate.js.map +1 -0
- package/dist/modules/tokens/transmission/TokenReference.d.ts +14 -0
- package/dist/modules/tokens/transmission/TokenReference.js +71 -0
- package/dist/modules/tokens/transmission/TokenReference.js.map +1 -0
- package/dist/util/PasswordGenerator.d.ts +28 -0
- package/dist/util/PasswordGenerator.js +179 -0
- package/dist/util/PasswordGenerator.js.map +1 -0
- package/dist/util/Random.d.ts +50 -0
- package/dist/util/Random.js +129 -0
- package/dist/util/Random.js.map +1 -0
- package/dist/util/index.d.ts +2 -0
- package/dist/util/index.js +15 -0
- package/dist/util/index.js.map +1 -0
- package/lib-web/nmshd.transport.js +54733 -0
- package/lib-web/nmshd.transport.js.map +1 -0
- package/lib-web/nmshd.transport.min.js +3 -0
- package/lib-web/nmshd.transport.min.js.map +1 -0
- package/package.json +109 -0
- package/ui5.yaml +9 -0
package/LICENSE
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
UNLICENSED
|
package/README.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Transport Library
|
|
2
|
+
|
|
3
|
+
[](https://github.com/nmshd/cns-transport/actions?query=workflow%3APublish)
|
|
4
|
+
[](https://www.npmjs.com/package/@nmshd/transport)
|
|
5
|
+
|
|
6
|
+
The transport library handles backbone communication and content encryption.
|
|
7
|
+
|
|
8
|
+
## Documentation
|
|
9
|
+
|
|
10
|
+
The documentation for this project is currently under construction.
|
|
11
|
+
|
|
12
|
+
## Contribute
|
|
13
|
+
|
|
14
|
+
Currently contribution to this project is not possible. This will change soon.
|
|
15
|
+
|
|
16
|
+
## License
|
|
17
|
+
|
|
18
|
+
[UNLICENSED](LICENSE)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ServalBuildInformation } from "@js-soft/ts-serval";
|
|
2
|
+
import { CryptoBuildInformation } from "@nmshd/crypto";
|
|
3
|
+
export declare class TransportBuildInformation {
|
|
4
|
+
readonly version: string;
|
|
5
|
+
readonly build: string;
|
|
6
|
+
readonly date: string;
|
|
7
|
+
readonly commit: string;
|
|
8
|
+
readonly dependencies: object;
|
|
9
|
+
readonly crypto: CryptoBuildInformation;
|
|
10
|
+
readonly serval: ServalBuildInformation;
|
|
11
|
+
private constructor();
|
|
12
|
+
static readonly info: TransportBuildInformation;
|
|
13
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TransportBuildInformation = void 0;
|
|
4
|
+
const ts_serval_1 = require("@js-soft/ts-serval");
|
|
5
|
+
const crypto_1 = require("@nmshd/crypto");
|
|
6
|
+
class TransportBuildInformation {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.version = "1.0.0";
|
|
9
|
+
this.build = "";
|
|
10
|
+
this.date = "2021-09-27T12:58:14+00:00";
|
|
11
|
+
this.commit = "fe88cbb6f98878a3c7de0fc731101f8fbf40602e";
|
|
12
|
+
this.crypto = crypto_1.CryptoBuildInformation.info;
|
|
13
|
+
this.serval = ts_serval_1.ServalBuildInformation.info;
|
|
14
|
+
try {
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/quotes
|
|
16
|
+
this.dependencies = JSON.parse(`{"@js-soft/docdb-access-abstractions":"1.0.1","@js-soft/logging-abstractions":"1.0.0","@js-soft/simple-logger":"1.0.0","@js-soft/ts-utils":"1.0.1","axios":"^0.21.4","deep-equal":"^2.0.5","fast-json-patch":"^3.1.0","form-data":"^4.0.0","json-stringify-safe":"^5.0.1","lodash":"^4.17.21","luxon":"^2.0.2","qs":"^6.10.1","reflect-metadata":"^0.1.13","ts-simple-nameof":"^1.3.1","uuid":"^8.3.2"}`);
|
|
17
|
+
}
|
|
18
|
+
catch (e) {
|
|
19
|
+
this.dependencies = {};
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.TransportBuildInformation = TransportBuildInformation;
|
|
24
|
+
TransportBuildInformation.info = new TransportBuildInformation();
|
|
25
|
+
//# sourceMappingURL=TransportBuildInformation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TransportBuildInformation.js","sourceRoot":"","sources":["../src/TransportBuildInformation.ts"],"names":[],"mappings":";;;AAAA,kDAA2D;AAC3D,0CAAsD;AAEtD,MAAa,yBAAyB;IAUlC;QATgB,YAAO,GAAW,aAAa,CAAA;QAC/B,UAAK,GAAW,WAAW,CAAA;QAC3B,SAAI,GAAW,UAAU,CAAA;QACzB,WAAM,GAAW,YAAY,CAAA;QAG7B,WAAM,GAAG,+BAAsB,CAAC,IAAI,CAAA;QACpC,WAAM,GAAG,kCAAsB,CAAC,IAAI,CAAA;QAGhD,IAAI;YACA,qDAAqD;YACrD,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAA;SACrD;QAAC,OAAO,CAAC,EAAE;YACR,IAAI,CAAC,YAAY,GAAG,EAAE,CAAA;SACzB;IACL,CAAC;;AAjBL,8DAoBC;AAD0B,8BAAI,GAA8B,IAAI,yBAAyB,EAAE,CAAA"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { CoreBuffer, CryptoCipher, CryptoEncryptionAlgorithm, CryptoExchangeKeypair, CryptoExchangePublicKey, CryptoExchangeSecrets, CryptoSecretKey, CryptoSignature, CryptoSignatureKeypair, CryptoSignaturePrivateKey, CryptoSignaturePublicKey } from "@nmshd/crypto";
|
|
2
|
+
import { TransportVersion } from "./types/TransportVersion";
|
|
3
|
+
export declare abstract class CoreCrypto {
|
|
4
|
+
/**
|
|
5
|
+
* Generates a keypair for digital signatures. Depending on the given version, different algorithms are used:
|
|
6
|
+
*
|
|
7
|
+
* v1: ECDSA_P521
|
|
8
|
+
*
|
|
9
|
+
* @param version The version which should be used, "latest" is the default.
|
|
10
|
+
* @returns A Promise object resolving into a new CryptoKeypair
|
|
11
|
+
*/
|
|
12
|
+
static generateSignatureKeypair(version?: TransportVersion): Promise<CryptoSignatureKeypair>;
|
|
13
|
+
/**
|
|
14
|
+
* Generates a keypair for key exchange (public key encryption).
|
|
15
|
+
* Depending on the given version, different algorithms are used:
|
|
16
|
+
*
|
|
17
|
+
* v1: ECDH_P521
|
|
18
|
+
*
|
|
19
|
+
* @param version The version which should be used, "latest" is the default.
|
|
20
|
+
* @returns A Promise object resolving into a new CryptoKeypair
|
|
21
|
+
*/
|
|
22
|
+
static generateExchangeKeypair(version?: TransportVersion): Promise<CryptoExchangeKeypair>;
|
|
23
|
+
/**
|
|
24
|
+
* Generates a secret key for symmetric encryption. Depending on the given version, different algorithms are used:
|
|
25
|
+
*
|
|
26
|
+
* v1: AES256_GCM
|
|
27
|
+
*
|
|
28
|
+
* @param version The version which should be used, "latest" is the default.
|
|
29
|
+
* @returns A Promise object resolving into a new CryptoSecretKey
|
|
30
|
+
*/
|
|
31
|
+
static generateSecretKey(version?: TransportVersion): Promise<CryptoSecretKey>;
|
|
32
|
+
/**
|
|
33
|
+
* Generates a password derived from a human readable/memorable master password, a unique salt, the given symmetric
|
|
34
|
+
* algorithm and the version. Depending on the given version, different key derivation algorithms are used.
|
|
35
|
+
* Careful, the symmetric algorithm possibly needs to be manually changed depending on the version in addition to
|
|
36
|
+
* the version.
|
|
37
|
+
*
|
|
38
|
+
* v1: blake2b with 150000 iterations
|
|
39
|
+
*
|
|
40
|
+
* @param master The master password as utf-8 encoded string
|
|
41
|
+
* @param salt A salt which is unique to this user/password instance.
|
|
42
|
+
* @param keyAlgorithm The [[CryptoSymmetricAlgorithm]] for which the key should be generated.
|
|
43
|
+
* Default is AES256_GCM.
|
|
44
|
+
* @param version The version which should be used, "latest" is the default.
|
|
45
|
+
* @returns A Promise object resolving in a [[CryptoSecretKey]].
|
|
46
|
+
*/
|
|
47
|
+
static generatePassword(master: string, salt?: string, keyAlgorithm?: CryptoEncryptionAlgorithm, version?: TransportVersion): Promise<CryptoSecretKey>;
|
|
48
|
+
static deriveKeyFromBase(secret: CryptoSecretKey | CoreBuffer, keyId: number, context: string, keyAlgorithm?: CryptoEncryptionAlgorithm): Promise<CryptoSecretKey>;
|
|
49
|
+
static deriveClient(client: CryptoExchangeKeypair, serverPublicKey: CryptoExchangePublicKey, keyAlgorithm?: CryptoEncryptionAlgorithm, version?: TransportVersion): Promise<CryptoExchangeSecrets>;
|
|
50
|
+
static deriveServer(server: CryptoExchangeKeypair, clientPublicKey: CryptoExchangePublicKey, keyAlgorithm?: CryptoEncryptionAlgorithm, version?: TransportVersion): Promise<CryptoExchangeSecrets>;
|
|
51
|
+
/**
|
|
52
|
+
* Digitally signs the given content with the given private key.
|
|
53
|
+
*
|
|
54
|
+
* v1: ECDSA_ED25519 with SHA512 hashes
|
|
55
|
+
*
|
|
56
|
+
* @param content The content object which should be signed
|
|
57
|
+
* @param privateKey The private key to sign
|
|
58
|
+
* @param version The version which should be used, "latest" is the default.
|
|
59
|
+
* @returns A Promise object resolving in a [[CryptoSignature]] object.
|
|
60
|
+
*/
|
|
61
|
+
static sign(content: CoreBuffer, privateKey: CryptoSignaturePrivateKey, version?: TransportVersion): Promise<CryptoSignature>;
|
|
62
|
+
/**
|
|
63
|
+
* Verifies the digital signature of a given content with the given digital
|
|
64
|
+
* signature and public key.
|
|
65
|
+
*
|
|
66
|
+
* @param content The content object which digital signature should be verified
|
|
67
|
+
* @param signature The digital signature itself
|
|
68
|
+
* @param publicKey The public key which should be verified
|
|
69
|
+
* @param version The version which should be used, "latest" is the default.
|
|
70
|
+
* @returns A Promise object resolving in either true or false, depending whether or not the
|
|
71
|
+
* digital signature is correct or wrong
|
|
72
|
+
*/
|
|
73
|
+
static verify(content: CoreBuffer, signature: CryptoSignature, publicKey: CryptoSignaturePublicKey, version?: TransportVersion): Promise<boolean>;
|
|
74
|
+
/**
|
|
75
|
+
* Encrypt the given content with the given secret key.
|
|
76
|
+
*
|
|
77
|
+
* Please use [[deriveKey]], [[generateEncryptionkey]], or [[generatePassword]] to
|
|
78
|
+
* get a secret key. Never transfer secret key over the wire, the key exchange
|
|
79
|
+
* algorithms should take care of that.
|
|
80
|
+
*
|
|
81
|
+
* @param content The content object which should be encrypted
|
|
82
|
+
* @param secretKey The secret key for the encryption
|
|
83
|
+
* @param version The version which should be used, "latest" is the default.
|
|
84
|
+
* @returns A Promise object resolving in a [[CryptoCipher]] object.
|
|
85
|
+
*/
|
|
86
|
+
static encrypt(content: CoreBuffer, secretKey: CryptoSecretKey, version?: TransportVersion): Promise<CryptoCipher>;
|
|
87
|
+
/**
|
|
88
|
+
* Decrypts the given cipher with the given secret key.
|
|
89
|
+
*
|
|
90
|
+
* Please use [[deriveKey]], [[generateEncryptionkey]], or [[generatePassword]] to
|
|
91
|
+
* get a secret key. Never transfer secret key over the wire, the key exchange
|
|
92
|
+
* algorithms should take care of that.
|
|
93
|
+
*
|
|
94
|
+
* @param cipher The content object which should be encrypted.
|
|
95
|
+
* @param secretKey The secret key for the encryption
|
|
96
|
+
* @param version The version which should be used, "latest" is the default.
|
|
97
|
+
* @returns A Promise object resolving with the decrypted content
|
|
98
|
+
*/
|
|
99
|
+
static decrypt(cipher: CryptoCipher, secretKey: CryptoSecretKey, version?: TransportVersion): Promise<CoreBuffer>;
|
|
100
|
+
/**
|
|
101
|
+
* Creates a random buffer with the given size
|
|
102
|
+
*
|
|
103
|
+
* @param size The length of bytes which should be randomly filled.
|
|
104
|
+
* @returns A Promise object resolving in a randomly filled Buffer of given length.
|
|
105
|
+
*/
|
|
106
|
+
static random(size: number): Promise<CoreBuffer>;
|
|
107
|
+
static createAccountPassword(): Promise<string>;
|
|
108
|
+
}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CoreCrypto = void 0;
|
|
4
|
+
const crypto_1 = require("@nmshd/crypto");
|
|
5
|
+
const util_1 = require("../util");
|
|
6
|
+
const TransportErrors_1 = require("./TransportErrors");
|
|
7
|
+
const TransportVersion_1 = require("./types/TransportVersion");
|
|
8
|
+
class CoreCrypto {
|
|
9
|
+
/**
|
|
10
|
+
* Generates a keypair for digital signatures. Depending on the given version, different algorithms are used:
|
|
11
|
+
*
|
|
12
|
+
* v1: ECDSA_P521
|
|
13
|
+
*
|
|
14
|
+
* @param version The version which should be used, "latest" is the default.
|
|
15
|
+
* @returns A Promise object resolving into a new CryptoKeypair
|
|
16
|
+
*/
|
|
17
|
+
static async generateSignatureKeypair(version = TransportVersion_1.TransportVersion.Latest) {
|
|
18
|
+
switch (version) {
|
|
19
|
+
case TransportVersion_1.TransportVersion.V1:
|
|
20
|
+
return await crypto_1.CryptoSignatures.generateKeypair(3 /* ECDSA_ED25519 */);
|
|
21
|
+
default:
|
|
22
|
+
throw TransportErrors_1.TransportErrors.util.crypto.invalidVersion(version);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Generates a keypair for key exchange (public key encryption).
|
|
27
|
+
* Depending on the given version, different algorithms are used:
|
|
28
|
+
*
|
|
29
|
+
* v1: ECDH_P521
|
|
30
|
+
*
|
|
31
|
+
* @param version The version which should be used, "latest" is the default.
|
|
32
|
+
* @returns A Promise object resolving into a new CryptoKeypair
|
|
33
|
+
*/
|
|
34
|
+
static async generateExchangeKeypair(version = TransportVersion_1.TransportVersion.Latest) {
|
|
35
|
+
switch (version) {
|
|
36
|
+
case TransportVersion_1.TransportVersion.V1:
|
|
37
|
+
return await crypto_1.CryptoExchange.generateKeypair(3 /* ECDH_X25519 */);
|
|
38
|
+
default:
|
|
39
|
+
throw TransportErrors_1.TransportErrors.util.crypto.invalidVersion(version);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Generates a secret key for symmetric encryption. Depending on the given version, different algorithms are used:
|
|
44
|
+
*
|
|
45
|
+
* v1: AES256_GCM
|
|
46
|
+
*
|
|
47
|
+
* @param version The version which should be used, "latest" is the default.
|
|
48
|
+
* @returns A Promise object resolving into a new CryptoSecretKey
|
|
49
|
+
*/
|
|
50
|
+
static async generateSecretKey(version = TransportVersion_1.TransportVersion.Latest) {
|
|
51
|
+
switch (version) {
|
|
52
|
+
case TransportVersion_1.TransportVersion.V1:
|
|
53
|
+
return await crypto_1.CryptoEncryption.generateKey(3 /* XCHACHA20_POLY1305 */);
|
|
54
|
+
default:
|
|
55
|
+
throw TransportErrors_1.TransportErrors.util.crypto.invalidVersion(version);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Generates a password derived from a human readable/memorable master password, a unique salt, the given symmetric
|
|
60
|
+
* algorithm and the version. Depending on the given version, different key derivation algorithms are used.
|
|
61
|
+
* Careful, the symmetric algorithm possibly needs to be manually changed depending on the version in addition to
|
|
62
|
+
* the version.
|
|
63
|
+
*
|
|
64
|
+
* v1: blake2b with 150000 iterations
|
|
65
|
+
*
|
|
66
|
+
* @param master The master password as utf-8 encoded string
|
|
67
|
+
* @param salt A salt which is unique to this user/password instance.
|
|
68
|
+
* @param keyAlgorithm The [[CryptoSymmetricAlgorithm]] for which the key should be generated.
|
|
69
|
+
* Default is AES256_GCM.
|
|
70
|
+
* @param version The version which should be used, "latest" is the default.
|
|
71
|
+
* @returns A Promise object resolving in a [[CryptoSecretKey]].
|
|
72
|
+
*/
|
|
73
|
+
static async generatePassword(master, salt = "enmeshed", keyAlgorithm = 3 /* XCHACHA20_POLY1305 */, version = TransportVersion_1.TransportVersion.Latest) {
|
|
74
|
+
const masterBuffer = crypto_1.CoreBuffer.fromString(master, crypto_1.Encoding.Utf8);
|
|
75
|
+
const saltBuffer = crypto_1.CoreBuffer.fromString(salt, crypto_1.Encoding.Utf8);
|
|
76
|
+
switch (version) {
|
|
77
|
+
case TransportVersion_1.TransportVersion.V1:
|
|
78
|
+
return await crypto_1.CryptoDerivation.deriveKeyFromMaster(masterBuffer, 150000, keyAlgorithm, saltBuffer);
|
|
79
|
+
default:
|
|
80
|
+
throw TransportErrors_1.TransportErrors.util.crypto.invalidVersion(version);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
static async deriveKeyFromBase(secret, keyId, context, keyAlgorithm = 3 /* XCHACHA20_POLY1305 */) {
|
|
84
|
+
let buffer;
|
|
85
|
+
if (secret instanceof crypto_1.CryptoSecretKey) {
|
|
86
|
+
buffer = secret.secretKey;
|
|
87
|
+
}
|
|
88
|
+
else if (secret instanceof crypto_1.CoreBuffer) {
|
|
89
|
+
buffer = secret;
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
throw TransportErrors_1.TransportErrors.util.crypto.invalidSecretType();
|
|
93
|
+
}
|
|
94
|
+
return await crypto_1.CryptoDerivation.deriveKeyFromBase(buffer, keyId, context, keyAlgorithm);
|
|
95
|
+
}
|
|
96
|
+
static async deriveClient(client, serverPublicKey, keyAlgorithm = 3 /* XCHACHA20_POLY1305 */, version = TransportVersion_1.TransportVersion.Latest) {
|
|
97
|
+
switch (version) {
|
|
98
|
+
case TransportVersion_1.TransportVersion.V1:
|
|
99
|
+
const base = await crypto_1.CryptoExchange.deriveTemplator(client, serverPublicKey, keyAlgorithm);
|
|
100
|
+
return base;
|
|
101
|
+
default:
|
|
102
|
+
throw TransportErrors_1.TransportErrors.util.crypto.invalidVersion(version);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
static async deriveServer(server, clientPublicKey, keyAlgorithm = 3 /* XCHACHA20_POLY1305 */, version = TransportVersion_1.TransportVersion.Latest) {
|
|
106
|
+
switch (version) {
|
|
107
|
+
case TransportVersion_1.TransportVersion.V1:
|
|
108
|
+
const base = await crypto_1.CryptoExchange.deriveRequestor(server, clientPublicKey, keyAlgorithm);
|
|
109
|
+
return base;
|
|
110
|
+
default:
|
|
111
|
+
throw TransportErrors_1.TransportErrors.util.crypto.invalidVersion(version);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Digitally signs the given content with the given private key.
|
|
116
|
+
*
|
|
117
|
+
* v1: ECDSA_ED25519 with SHA512 hashes
|
|
118
|
+
*
|
|
119
|
+
* @param content The content object which should be signed
|
|
120
|
+
* @param privateKey The private key to sign
|
|
121
|
+
* @param version The version which should be used, "latest" is the default.
|
|
122
|
+
* @returns A Promise object resolving in a [[CryptoSignature]] object.
|
|
123
|
+
*/
|
|
124
|
+
static async sign(content, privateKey, version = TransportVersion_1.TransportVersion.Latest) {
|
|
125
|
+
switch (version) {
|
|
126
|
+
case TransportVersion_1.TransportVersion.V1:
|
|
127
|
+
return await crypto_1.CryptoSignatures.sign(content, privateKey, 2 /* SHA512 */);
|
|
128
|
+
default:
|
|
129
|
+
throw TransportErrors_1.TransportErrors.util.crypto.invalidVersion(version);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Verifies the digital signature of a given content with the given digital
|
|
134
|
+
* signature and public key.
|
|
135
|
+
*
|
|
136
|
+
* @param content The content object which digital signature should be verified
|
|
137
|
+
* @param signature The digital signature itself
|
|
138
|
+
* @param publicKey The public key which should be verified
|
|
139
|
+
* @param version The version which should be used, "latest" is the default.
|
|
140
|
+
* @returns A Promise object resolving in either true or false, depending whether or not the
|
|
141
|
+
* digital signature is correct or wrong
|
|
142
|
+
*/
|
|
143
|
+
static async verify(content, signature, publicKey, version = TransportVersion_1.TransportVersion.Latest) {
|
|
144
|
+
switch (version) {
|
|
145
|
+
case TransportVersion_1.TransportVersion.V1:
|
|
146
|
+
return await crypto_1.CryptoSignatures.verify(content, signature, publicKey);
|
|
147
|
+
default:
|
|
148
|
+
throw TransportErrors_1.TransportErrors.util.crypto.invalidVersion(version);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Encrypt the given content with the given secret key.
|
|
153
|
+
*
|
|
154
|
+
* Please use [[deriveKey]], [[generateEncryptionkey]], or [[generatePassword]] to
|
|
155
|
+
* get a secret key. Never transfer secret key over the wire, the key exchange
|
|
156
|
+
* algorithms should take care of that.
|
|
157
|
+
*
|
|
158
|
+
* @param content The content object which should be encrypted
|
|
159
|
+
* @param secretKey The secret key for the encryption
|
|
160
|
+
* @param version The version which should be used, "latest" is the default.
|
|
161
|
+
* @returns A Promise object resolving in a [[CryptoCipher]] object.
|
|
162
|
+
*/
|
|
163
|
+
static async encrypt(content, secretKey, version = TransportVersion_1.TransportVersion.Latest) {
|
|
164
|
+
switch (version) {
|
|
165
|
+
case TransportVersion_1.TransportVersion.V1:
|
|
166
|
+
return await crypto_1.CryptoEncryption.encrypt(content, secretKey);
|
|
167
|
+
default:
|
|
168
|
+
throw TransportErrors_1.TransportErrors.util.crypto.invalidVersion(version);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Decrypts the given cipher with the given secret key.
|
|
173
|
+
*
|
|
174
|
+
* Please use [[deriveKey]], [[generateEncryptionkey]], or [[generatePassword]] to
|
|
175
|
+
* get a secret key. Never transfer secret key over the wire, the key exchange
|
|
176
|
+
* algorithms should take care of that.
|
|
177
|
+
*
|
|
178
|
+
* @param cipher The content object which should be encrypted.
|
|
179
|
+
* @param secretKey The secret key for the encryption
|
|
180
|
+
* @param version The version which should be used, "latest" is the default.
|
|
181
|
+
* @returns A Promise object resolving with the decrypted content
|
|
182
|
+
*/
|
|
183
|
+
static async decrypt(cipher, secretKey, version = TransportVersion_1.TransportVersion.Latest) {
|
|
184
|
+
switch (version) {
|
|
185
|
+
case TransportVersion_1.TransportVersion.V1:
|
|
186
|
+
return await crypto_1.CryptoEncryption.decrypt(cipher, secretKey);
|
|
187
|
+
default:
|
|
188
|
+
throw TransportErrors_1.TransportErrors.util.crypto.invalidVersion(version);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Creates a random buffer with the given size
|
|
193
|
+
*
|
|
194
|
+
* @param size The length of bytes which should be randomly filled.
|
|
195
|
+
* @returns A Promise object resolving in a randomly filled Buffer of given length.
|
|
196
|
+
*/
|
|
197
|
+
static async random(size) {
|
|
198
|
+
return await crypto_1.CryptoRandom.bytes(size);
|
|
199
|
+
}
|
|
200
|
+
static async createAccountPassword() {
|
|
201
|
+
return await util_1.PasswordGenerator.createStrongPassword(100, 100);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
exports.CoreCrypto = CoreCrypto;
|
|
205
|
+
//# sourceMappingURL=CoreCrypto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CoreCrypto.js","sourceRoot":"","sources":["../../src/core/CoreCrypto.ts"],"names":[],"mappings":";;;AAAA,0CAqBsB;AACtB,kCAA2C;AAC3C,uDAAmD;AACnD,+DAA2D;AAE3D,MAAsB,UAAU;IAC5B;;;;;;;OAOG;IACI,MAAM,CAAC,KAAK,CAAC,wBAAwB,CACxC,UAA4B,mCAAgB,CAAC,MAAM;QAEnD,QAAQ,OAAO,EAAE;YACb,KAAK,mCAAgB,CAAC,EAAE;gBACpB,OAAO,MAAM,yBAAgB,CAAC,eAAe,uBAAwC,CAAA;YACzF;gBACI,MAAM,iCAAe,CAAC,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,CAAA;SAChE;IACL,CAAC;IAED;;;;;;;;OAQG;IACI,MAAM,CAAC,KAAK,CAAC,uBAAuB,CACvC,UAA4B,mCAAgB,CAAC,MAAM;QAEnD,QAAQ,OAAO,EAAE;YACb,KAAK,mCAAgB,CAAC,EAAE;gBACpB,OAAO,MAAM,uBAAc,CAAC,eAAe,qBAAqC,CAAA;YACpF;gBACI,MAAM,iCAAe,CAAC,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,CAAA;SAChE;IACL,CAAC;IAED;;;;;;;OAOG;IACI,MAAM,CAAC,KAAK,CAAC,iBAAiB,CACjC,UAA4B,mCAAgB,CAAC,MAAM;QAEnD,QAAQ,OAAO,EAAE;YACb,KAAK,mCAAgB,CAAC,EAAE;gBACpB,OAAO,MAAM,yBAAgB,CAAC,WAAW,4BAA8C,CAAA;YAC3F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@@
|
|
|
1
|
+
import { ILogger } from "@js-soft/logging-abstractions";
|
|
2
|
+
export declare class CoreError extends Error {
|
|
3
|
+
private readonly _code;
|
|
4
|
+
get code(): string;
|
|
5
|
+
private readonly _reason;
|
|
6
|
+
get reason(): string;
|
|
7
|
+
private readonly _data;
|
|
8
|
+
get data(): string;
|
|
9
|
+
private readonly _time;
|
|
10
|
+
get time(): Date;
|
|
11
|
+
private readonly _rootError?;
|
|
12
|
+
get rootError(): Error | undefined;
|
|
13
|
+
private readonly _context?;
|
|
14
|
+
get context(): Function | undefined;
|
|
15
|
+
constructor(code?: string, reason?: string, data?: any, time?: Date, rootError?: Error, context?: Function);
|
|
16
|
+
equals(error: CoreError): boolean;
|
|
17
|
+
logWith(logger: ILogger): this;
|
|
18
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CoreError = void 0;
|
|
7
|
+
const json_stringify_safe_1 = __importDefault(require("json-stringify-safe"));
|
|
8
|
+
class CoreError extends Error {
|
|
9
|
+
constructor(code = "error.unknown", reason = "Operation failed unexpectedly.", data = null, time = new Date(), rootError, context) {
|
|
10
|
+
const message = [];
|
|
11
|
+
message.push(code);
|
|
12
|
+
if (reason) {
|
|
13
|
+
message.push(": '", reason, "'");
|
|
14
|
+
}
|
|
15
|
+
message.push(" at ", time.toISOString());
|
|
16
|
+
if (data) {
|
|
17
|
+
if (typeof data["toJSON"] === "function") {
|
|
18
|
+
message.push(` with data ${data.toJSON(false)}`);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
message.push(` with data ${(0, json_stringify_safe_1.default)(data)}`);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
super(message.join(""));
|
|
25
|
+
this._code = code;
|
|
26
|
+
this._reason = reason;
|
|
27
|
+
this._time = time;
|
|
28
|
+
this._data = data;
|
|
29
|
+
this.name = "CoreError";
|
|
30
|
+
this._rootError = rootError;
|
|
31
|
+
this._context = context;
|
|
32
|
+
if (typeof Error.captureStackTrace !== "undefined") {
|
|
33
|
+
Error.captureStackTrace(this, context !== null && context !== void 0 ? context : CoreError);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
get code() {
|
|
37
|
+
return this._code;
|
|
38
|
+
}
|
|
39
|
+
get reason() {
|
|
40
|
+
return this._reason;
|
|
41
|
+
}
|
|
42
|
+
get data() {
|
|
43
|
+
return this._data;
|
|
44
|
+
}
|
|
45
|
+
get time() {
|
|
46
|
+
return this._time;
|
|
47
|
+
}
|
|
48
|
+
get rootError() {
|
|
49
|
+
return this._rootError;
|
|
50
|
+
}
|
|
51
|
+
get context() {
|
|
52
|
+
return this._context;
|
|
53
|
+
}
|
|
54
|
+
equals(error) {
|
|
55
|
+
return this.code === error.code;
|
|
56
|
+
}
|
|
57
|
+
logWith(logger) {
|
|
58
|
+
logger.error(this);
|
|
59
|
+
return this;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.CoreError = CoreError;
|
|
63
|
+
//# sourceMappingURL=CoreError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CoreError.js","sourceRoot":"","sources":["../../src/core/CoreError.ts"],"names":[],"mappings":";;;;;;AACA,8EAA2C;AAE3C,MAAa,SAAU,SAAQ,KAAK;IAgChC,YACI,IAAI,GAAG,eAAe,EACtB,MAAM,GAAG,gCAAgC,EACzC,OAAY,IAAI,EAChB,OAAa,IAAI,IAAI,EAAE,EACvB,SAAiB,EACjB,OAAkB;QAElB,MAAM,OAAO,GAAG,EAAE,CAAA;QAClB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAClB,IAAI,MAAM,EAAE;YACR,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,EA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,CAAA;IAC1B,CAAC;IAGD,IAAW,OAAO;QACd,OAAO,IAAI,CAAC,QAAQ,CAAA;IACxB,CAAC;IAuCM,MAAM,CAAC,KAAgB;QAC1B,OAAO,IAAI,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI,CAAA;IACnC,CAAC;IAEM,OAAO,CAAC,MAAe;QAC1B,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAClB,OAAO,IAAI,CAAA;IACf,CAAC;CACJ;AA7ED,8BA6EC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CoreId } from "./types/CoreId";
|
|
2
|
+
export declare class CoreIdHelper {
|
|
3
|
+
private readonly prefix;
|
|
4
|
+
private readonly validateOnly;
|
|
5
|
+
private readonly coreIdRegex;
|
|
6
|
+
constructor(prefix: string, validateOnly?: boolean);
|
|
7
|
+
generate(): Promise<CoreId>;
|
|
8
|
+
validate(id: string): boolean;
|
|
9
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CoreIdHelper = void 0;
|
|
4
|
+
const Random_1 = require("../util/Random");
|
|
5
|
+
const CoreId_1 = require("./types/CoreId");
|
|
6
|
+
class CoreIdHelper {
|
|
7
|
+
constructor(prefix, validateOnly = false) {
|
|
8
|
+
this.prefix = prefix;
|
|
9
|
+
this.validateOnly = validateOnly;
|
|
10
|
+
this.coreIdRegex = new RegExp(`${prefix}[${Random_1.RandomCharacterRange.Alphanumeric}]{${20 - prefix.length}}`);
|
|
11
|
+
}
|
|
12
|
+
async generate() {
|
|
13
|
+
if (this.validateOnly) {
|
|
14
|
+
throw new Error("This CoreIdHelper is set up for validation only.");
|
|
15
|
+
}
|
|
16
|
+
return await CoreId_1.CoreId.generate(this.prefix);
|
|
17
|
+
}
|
|
18
|
+
validate(id) {
|
|
19
|
+
return this.coreIdRegex.test(id);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.CoreIdHelper = CoreIdHelper;
|
|
23
|
+
//# sourceMappingURL=CoreIdHelper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CoreIdHelper.js","sourceRoot":"","sources":["../../src/core/CoreIdHelper.ts"],"names":[],"mappings":";;;AAAA,2CAAqD;AACrD,2CAAuC;AAEvC,MAAa,YAAY;IAGrB,YAAoC,MAAc,EAAmB,eAAwB,KAAK;QAA9D,WAAM,GAAN,MAAM,CAAQ;QAAmB,iBAAY,GAAZ,YAAY,CAAiB;QAC9F,IAAI,CAAC,WAAW,GAAG,IAAI,MAAM,CAAC,GAAG,MAAM,IAAI,6BAAoB,CAAC,YAAY,KAAK,EAAE,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,CAAA;IAC3G,CAAC;IAEM,KAAK,CAAC,QAAQ;QACjB,IAAI,IAAI,CAAC,YAAY,EAAE;YACnB,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAA;SACtE;QAED,OAAO,MAAM,eAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAC7C,CAAC;IAEM,QAAQ,CAAC,EAAU;QACtB,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACpC,CAAC;CACJ;AAlBD,oCAkBC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CoreIdHelper } from "./CoreIdHelper";
|
|
2
|
+
export declare class TransportIds {
|
|
3
|
+
static readonly generic: CoreIdHelper;
|
|
4
|
+
static readonly secret: CoreIdHelper;
|
|
5
|
+
static readonly relationshipSecret: CoreIdHelper;
|
|
6
|
+
static readonly relationshipTemplateKey: CoreIdHelper;
|
|
7
|
+
static readonly datawalletModification: CoreIdHelper;
|
|
8
|
+
static readonly fileReference: CoreIdHelper;
|
|
9
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TransportIds = void 0;
|
|
4
|
+
const CoreIdHelper_1 = require("./CoreIdHelper");
|
|
5
|
+
class TransportIds {
|
|
6
|
+
}
|
|
7
|
+
exports.TransportIds = TransportIds;
|
|
8
|
+
TransportIds.generic = new CoreIdHelper_1.CoreIdHelper("");
|
|
9
|
+
TransportIds.secret = new CoreIdHelper_1.CoreIdHelper("TRPSEC");
|
|
10
|
+
TransportIds.relationshipSecret = new CoreIdHelper_1.CoreIdHelper("TRPRSE");
|
|
11
|
+
TransportIds.relationshipTemplateKey = new CoreIdHelper_1.CoreIdHelper("TRPRTK");
|
|
12
|
+
TransportIds.datawalletModification = new CoreIdHelper_1.CoreIdHelper("TRPDWM");
|
|
13
|
+
TransportIds.fileReference = new CoreIdHelper_1.CoreIdHelper("TRPFRF");
|
|
14
|
+
//# sourceMappingURL=CoreIds.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CoreIds.js","sourceRoot":"","sources":["../../src/core/CoreIds.ts"],"names":[],"mappings":";;;AAAA,iDAA6C;AAE7C,MAAa,YAAY;;AAAzB,oCAOC;AAN0B,oBAAO,GAAG,IAAI,2BAAY,CAAC,EAAE,CAAC,CAAA;AAC9B,mBAAM,GAAG,IAAI,2BAAY,CAAC,QAAQ,CAAC,CAAA;AACnC,+BAAkB,GAAG,IAAI,2BAAY,CAAC,QAAQ,CAAC,CAAA;AAC/C,oCAAuB,GAAG,IAAI,2BAAY,CAAC,QAAQ,CAAC,CAAA;AACpD,mCAAsB,GAAG,IAAI,2BAAY,CAAC,QAAQ,CAAC,CAAA;AACnD,0BAAa,GAAG,IAAI,2BAAY,CAAC,QAAQ,CAAC,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ISerializable, Serializable } from "@js-soft/ts-serval";
|
|
2
|
+
export interface ICoreSerializable extends ISerializable {
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* CoreSerializable is the local pendant of the Serializable class which
|
|
6
|
+
* automatically validates, serializes, deserializes and validates again.
|
|
7
|
+
*
|
|
8
|
+
* With the synchronous class, the deserialize methods (from and deserialize)
|
|
9
|
+
* are called synchronous. Please be aware, that CoreSerializable classes should
|
|
10
|
+
* have no CoreSerializableAsync properties.
|
|
11
|
+
*/
|
|
12
|
+
export declare class CoreSerializable extends Serializable implements ISerializable {
|
|
13
|
+
toBase64(): string;
|
|
14
|
+
static from(value: ICoreSerializable, type: new () => CoreSerializable): CoreSerializable;
|
|
15
|
+
static fromT<T>(value: ICoreSerializable, type: new () => T): T;
|
|
16
|
+
static fromBase64T<T>(value: string, type: new () => T): T;
|
|
17
|
+
static fromBase64Unknown(value: string): Serializable;
|
|
18
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var CoreSerializable_1;
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.CoreSerializable = void 0;
|
|
11
|
+
const ts_serval_1 = require("@js-soft/ts-serval");
|
|
12
|
+
const crypto_1 = require("@nmshd/crypto");
|
|
13
|
+
/**
|
|
14
|
+
* CoreSerializable is the local pendant of the Serializable class which
|
|
15
|
+
* automatically validates, serializes, deserializes and validates again.
|
|
16
|
+
*
|
|
17
|
+
* With the synchronous class, the deserialize methods (from and deserialize)
|
|
18
|
+
* are called synchronous. Please be aware, that CoreSerializable classes should
|
|
19
|
+
* have no CoreSerializableAsync properties.
|
|
20
|
+
*/
|
|
21
|
+
let CoreSerializable = CoreSerializable_1 = class CoreSerializable extends ts_serval_1.Serializable {
|
|
22
|
+
toBase64() {
|
|
23
|
+
return crypto_1.CoreBuffer.fromUtf8(this.serialize()).toBase64URL();
|
|
24
|
+
}
|
|
25
|
+
static from(value, type) {
|
|
26
|
+
return super.fromT(value, type);
|
|
27
|
+
}
|
|
28
|
+
static fromT(value, type) {
|
|
29
|
+
return super.fromT(value, type);
|
|
30
|
+
}
|
|
31
|
+
static fromBase64T(value, type) {
|
|
32
|
+
const serialized = crypto_1.CoreBuffer.fromBase64URL(value).toUtf8();
|
|
33
|
+
return CoreSerializable_1.deserializeT(serialized, type);
|
|
34
|
+
}
|
|
35
|
+
static fromBase64Unknown(value) {
|
|
36
|
+
const serialized = crypto_1.CoreBuffer.fromBase64URL(value).toUtf8();
|
|
37
|
+
return ts_serval_1.Serializable.deserializeUnknown(serialized);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
CoreSerializable = CoreSerializable_1 = __decorate([
|
|
41
|
+
(0, ts_serval_1.type)("CoreSerializable")
|
|
42
|
+
], CoreSerializable);
|
|
43
|
+
exports.CoreSerializable = CoreSerializable;
|
|
44
|
+
//# sourceMappingURL=CoreSerializable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CoreSerializable.js","sourceRoot":"","sources":["../../src/core/CoreSerializable.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,kDAAsE;AACtE,0CAA0C;AAI1C;;;;;;;GAOG;AAGH,IAAa,gBAAgB,wBAA7B,MAAa,gBAAiB,SAAQ,wBAAY;IACvC,QAAQ;QACX,OAAO,mBAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,WAAW,EAAE,CAAA;IAC9D,CAAC;IAEM,MAAM,CAAC,IAAI,CAAC,KAAwB,EAAE,IAAgC;QACzE,OAAO,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;IACnC,CAAC;IAEM,MAAM,CAAC,KAAK,CAAI,KAAwB,EAAE,IAAiB;QAC9D,OAAO,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;IACnC,CAAC;IAEM,MAAM,CAAC,WAAW,CAAI,KAAa,EAAE,IAAiB;QACzD,MAAM,UAAU,GAAG,mBAAU,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,CAAA;QAC3D,OAAO,kBAAgB,CAAC,YAAY,CAAC,UAAU,EAAE,IAAI,CAAC,CAAA;IAC1D,CAAC;IAEM,MAAM,CAAC,iBAAiB,CAAC,KAAa;QACzC,MAAM,UAAU,GAAG,mBAAU,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,CAAA;QAC3D,OAAO,wBAAY,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAA;IACtD,CAAC;CACJ,CAAA;AAtBY,gBAAgB;IAD5B,IAAA,gBAAI,EAAC,kBAAkB,CAAC;GACZ,gBAAgB,CAsB5B;AAtBY,4CAAgB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ISerializableAsync, SerializableAsync } from "@js-soft/ts-serval";
|
|
2
|
+
export interface ICoreSerializableAsync extends ISerializableAsync {
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* CoreSerializableAsync is the local pendant of the SerializableAsync class which
|
|
6
|
+
* automatically validates, serializes, deserializes and validates again.
|
|
7
|
+
*
|
|
8
|
+
* With the asynchronous class, the deserialize methods (from and deserialize)
|
|
9
|
+
* are called asynchronous (returning a Promise). You should only use CoreSerializableAsync
|
|
10
|
+
* classes if properties with CoreSerializableAsync types are used.
|
|
11
|
+
*/
|
|
12
|
+
export declare class CoreSerializableAsync extends SerializableAsync implements ISerializableAsync {
|
|
13
|
+
toBase64(): string;
|
|
14
|
+
static from(value: ICoreSerializableAsync, type: new () => CoreSerializableAsync): Promise<CoreSerializableAsync>;
|
|
15
|
+
static fromT<T>(value: ICoreSerializableAsync, type: new () => T): Promise<T>;
|
|
16
|
+
static fromBase64T<T>(value: string, type: new () => T): Promise<T>;
|
|
17
|
+
static fromBase64Unknown(value: string): Promise<SerializableAsync>;
|
|
18
|
+
}
|