@wireapp/wire-apps-js-sdk 0.0.1-alpha
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 +674 -0
- package/README.md +141 -0
- package/build/WireAppSdk.d.ts +31 -0
- package/build/WireAppSdk.d.ts.map +1 -0
- package/build/WireAppSdk.js +159 -0
- package/build/WireAppSdk.js.map +1 -0
- package/build/api/AssetsApiClient.d.ts +12 -0
- package/build/api/AssetsApiClient.d.ts.map +1 -0
- package/build/api/AssetsApiClient.js +67 -0
- package/build/api/AssetsApiClient.js.map +1 -0
- package/build/api/AssetsTransferService.d.ts +12 -0
- package/build/api/AssetsTransferService.d.ts.map +1 -0
- package/build/api/AssetsTransferService.js +80 -0
- package/build/api/AssetsTransferService.js.map +1 -0
- package/build/api/ClientsApiClient.d.ts +13 -0
- package/build/api/ClientsApiClient.d.ts.map +1 -0
- package/build/api/ClientsApiClient.js +59 -0
- package/build/api/ClientsApiClient.js.map +1 -0
- package/build/api/ClientsService.d.ts +10 -0
- package/build/api/ClientsService.d.ts.map +1 -0
- package/build/api/ClientsService.js +45 -0
- package/build/api/ClientsService.js.map +1 -0
- package/build/api/ConversationService.d.ts +83 -0
- package/build/api/ConversationService.d.ts.map +1 -0
- package/build/api/ConversationService.js +534 -0
- package/build/api/ConversationService.js.map +1 -0
- package/build/api/ConversationsApiClient.d.ts +23 -0
- package/build/api/ConversationsApiClient.d.ts.map +1 -0
- package/build/api/ConversationsApiClient.js +113 -0
- package/build/api/ConversationsApiClient.js.map +1 -0
- package/build/api/FeatureConfigsApiClient.d.ts +9 -0
- package/build/api/FeatureConfigsApiClient.d.ts.map +1 -0
- package/build/api/FeatureConfigsApiClient.js +43 -0
- package/build/api/FeatureConfigsApiClient.js.map +1 -0
- package/build/api/FeatureConfigsService.d.ts +8 -0
- package/build/api/FeatureConfigsService.d.ts.map +1 -0
- package/build/api/FeatureConfigsService.js +45 -0
- package/build/api/FeatureConfigsService.js.map +1 -0
- package/build/api/MlsApiClient.d.ts +23 -0
- package/build/api/MlsApiClient.d.ts.map +1 -0
- package/build/api/MlsApiClient.js +77 -0
- package/build/api/MlsApiClient.js.map +1 -0
- package/build/api/MlsService.d.ts +17 -0
- package/build/api/MlsService.d.ts.map +1 -0
- package/build/api/MlsService.js +87 -0
- package/build/api/MlsService.js.map +1 -0
- package/build/api/NotificationsApiClient.d.ts +17 -0
- package/build/api/NotificationsApiClient.d.ts.map +1 -0
- package/build/api/NotificationsApiClient.js +60 -0
- package/build/api/NotificationsApiClient.js.map +1 -0
- package/build/api/OneToOneConversationsApiClient.d.ts +11 -0
- package/build/api/OneToOneConversationsApiClient.d.ts.map +1 -0
- package/build/api/OneToOneConversationsApiClient.js +45 -0
- package/build/api/OneToOneConversationsApiClient.js.map +1 -0
- package/build/api/SearchApiClient.d.ts +9 -0
- package/build/api/SearchApiClient.d.ts.map +1 -0
- package/build/api/SearchApiClient.js +61 -0
- package/build/api/SearchApiClient.js.map +1 -0
- package/build/api/TeamsApiClient.d.ts +11 -0
- package/build/api/TeamsApiClient.d.ts.map +1 -0
- package/build/api/TeamsApiClient.js +47 -0
- package/build/api/TeamsApiClient.js.map +1 -0
- package/build/api/UserService.d.ts +28 -0
- package/build/api/UserService.d.ts.map +1 -0
- package/build/api/UserService.js +90 -0
- package/build/api/UserService.js.map +1 -0
- package/build/api/UsersApiClient.d.ts +12 -0
- package/build/api/UsersApiClient.d.ts.map +1 -0
- package/build/api/UsersApiClient.js +63 -0
- package/build/api/UsersApiClient.js.map +1 -0
- package/build/api/model/AddMembersToConversationResult.d.ts +6 -0
- package/build/api/model/AddMembersToConversationResult.d.ts.map +1 -0
- package/build/api/model/AddMembersToConversationResult.js +17 -0
- package/build/api/model/AddMembersToConversationResult.js.map +1 -0
- package/build/api/model/ConversationIdsPaginationConfig.d.ts +5 -0
- package/build/api/model/ConversationIdsPaginationConfig.d.ts.map +1 -0
- package/build/api/model/ConversationIdsPaginationConfig.js +17 -0
- package/build/api/model/ConversationIdsPaginationConfig.js.map +1 -0
- package/build/api/model/ConversationMemberOtherResponse.d.ts +7 -0
- package/build/api/model/ConversationMemberOtherResponse.d.ts.map +1 -0
- package/build/api/model/ConversationMemberOtherResponse.js +17 -0
- package/build/api/model/ConversationMemberOtherResponse.js.map +1 -0
- package/build/api/model/ConversationMemberSelfResponse.d.ts +7 -0
- package/build/api/model/ConversationMemberSelfResponse.d.ts.map +1 -0
- package/build/api/model/ConversationMemberSelfResponse.js +17 -0
- package/build/api/model/ConversationMemberSelfResponse.js.map +1 -0
- package/build/api/model/ConversationMembersResponse.d.ts +7 -0
- package/build/api/model/ConversationMembersResponse.d.ts.map +1 -0
- package/build/api/model/ConversationMembersResponse.js +17 -0
- package/build/api/model/ConversationMembersResponse.js.map +1 -0
- package/build/api/model/ConversationTeamInfo.d.ts +5 -0
- package/build/api/model/ConversationTeamInfo.d.ts.map +1 -0
- package/build/api/model/ConversationTeamInfo.js +17 -0
- package/build/api/model/ConversationTeamInfo.js.map +1 -0
- package/build/api/model/RemoveMembersFromConversationResult.d.ts +5 -0
- package/build/api/model/RemoveMembersFromConversationResult.d.ts.map +1 -0
- package/build/api/model/RemoveMembersFromConversationResult.js +17 -0
- package/build/api/model/RemoveMembersFromConversationResult.js.map +1 -0
- package/build/api/model/UserClientResponse.d.ts +4 -0
- package/build/api/model/UserClientResponse.d.ts.map +1 -0
- package/build/api/model/UserClientResponse.js +17 -0
- package/build/api/model/UserClientResponse.js.map +1 -0
- package/build/api/model/UserResponse.d.ts +12 -0
- package/build/api/model/UserResponse.d.ts.map +1 -0
- package/build/api/model/UserResponse.js +17 -0
- package/build/api/model/UserResponse.js.map +1 -0
- package/build/api/model/asset/AssetUploadData.d.ts +5 -0
- package/build/api/model/asset/AssetUploadData.d.ts.map +1 -0
- package/build/api/model/asset/AssetUploadData.js +17 -0
- package/build/api/model/asset/AssetUploadData.js.map +1 -0
- package/build/api/model/asset/AssetUploadResponse.d.ts +7 -0
- package/build/api/model/asset/AssetUploadResponse.d.ts.map +1 -0
- package/build/api/model/asset/AssetUploadResponse.js +17 -0
- package/build/api/model/asset/AssetUploadResponse.js.map +1 -0
- package/build/api/request/CapabilitiesRequest.d.ts +4 -0
- package/build/api/request/CapabilitiesRequest.d.ts.map +1 -0
- package/build/api/request/CapabilitiesRequest.js +20 -0
- package/build/api/request/CapabilitiesRequest.js.map +1 -0
- package/build/api/request/ClientUpdateRequest.d.ts +5 -0
- package/build/api/request/ClientUpdateRequest.d.ts.map +1 -0
- package/build/api/request/ClientUpdateRequest.js +17 -0
- package/build/api/request/ClientUpdateRequest.js.map +1 -0
- package/build/api/request/ConversationIdsRequest.d.ts +5 -0
- package/build/api/request/ConversationIdsRequest.d.ts.map +1 -0
- package/build/api/request/ConversationIdsRequest.js +17 -0
- package/build/api/request/ConversationIdsRequest.js.map +1 -0
- package/build/api/request/CreateConversationRequest.d.ts +30 -0
- package/build/api/request/CreateConversationRequest.d.ts.map +1 -0
- package/build/api/request/CreateConversationRequest.js +57 -0
- package/build/api/request/CreateConversationRequest.js.map +1 -0
- package/build/api/request/MlsKeyPackagesRequest.d.ts +4 -0
- package/build/api/request/MlsKeyPackagesRequest.d.ts.map +1 -0
- package/build/api/request/MlsKeyPackagesRequest.js +17 -0
- package/build/api/request/MlsKeyPackagesRequest.js.map +1 -0
- package/build/api/request/PreKeyRequest.d.ts +6 -0
- package/build/api/request/PreKeyRequest.d.ts.map +1 -0
- package/build/api/request/PreKeyRequest.js +24 -0
- package/build/api/request/PreKeyRequest.js.map +1 -0
- package/build/api/request/RegisterClientRequest.d.ts +14 -0
- package/build/api/request/RegisterClientRequest.d.ts.map +1 -0
- package/build/api/request/RegisterClientRequest.js +36 -0
- package/build/api/request/RegisterClientRequest.js.map +1 -0
- package/build/api/response/AccessResponse.d.ts +7 -0
- package/build/api/response/AccessResponse.d.ts.map +1 -0
- package/build/api/response/AccessResponse.js +17 -0
- package/build/api/response/AccessResponse.js.map +1 -0
- package/build/api/response/ClaimedKeyPackageList.d.ts +14 -0
- package/build/api/response/ClaimedKeyPackageList.d.ts.map +1 -0
- package/build/api/response/ClaimedKeyPackageList.js +17 -0
- package/build/api/response/ClaimedKeyPackageList.js.map +1 -0
- package/build/api/response/ConversationIdsResponse.d.ts +7 -0
- package/build/api/response/ConversationIdsResponse.d.ts.map +1 -0
- package/build/api/response/ConversationIdsResponse.js +17 -0
- package/build/api/response/ConversationIdsResponse.js.map +1 -0
- package/build/api/response/ConversationResponse.d.ts +16 -0
- package/build/api/response/ConversationResponse.d.ts.map +1 -0
- package/build/api/response/ConversationResponse.js +17 -0
- package/build/api/response/ConversationResponse.js.map +1 -0
- package/build/api/response/ConversationsResponse.d.ts +8 -0
- package/build/api/response/ConversationsResponse.d.ts.map +1 -0
- package/build/api/response/ConversationsResponse.js +17 -0
- package/build/api/response/ConversationsResponse.js.map +1 -0
- package/build/api/response/EventResponse.d.ts +7 -0
- package/build/api/response/EventResponse.d.ts.map +1 -0
- package/build/api/response/EventResponse.js +17 -0
- package/build/api/response/EventResponse.js.map +1 -0
- package/build/api/response/FeatureConfigsResponse.d.ts +19 -0
- package/build/api/response/FeatureConfigsResponse.d.ts.map +1 -0
- package/build/api/response/FeatureConfigsResponse.js +17 -0
- package/build/api/response/FeatureConfigsResponse.js.map +1 -0
- package/build/api/response/MlsPublicKeysResponse.d.ts +7 -0
- package/build/api/response/MlsPublicKeysResponse.d.ts.map +1 -0
- package/build/api/response/MlsPublicKeysResponse.js +42 -0
- package/build/api/response/MlsPublicKeysResponse.js.map +1 -0
- package/build/api/response/NotificationsResponse.d.ts +7 -0
- package/build/api/response/NotificationsResponse.d.ts.map +1 -0
- package/build/api/response/NotificationsResponse.js +17 -0
- package/build/api/response/NotificationsResponse.js.map +1 -0
- package/build/api/response/OneToOneConversationResponse.d.ts +7 -0
- package/build/api/response/OneToOneConversationResponse.d.ts.map +1 -0
- package/build/api/response/OneToOneConversationResponse.js +17 -0
- package/build/api/response/OneToOneConversationResponse.js.map +1 -0
- package/build/api/response/RegisterClientResponse.d.ts +4 -0
- package/build/api/response/RegisterClientResponse.d.ts.map +1 -0
- package/build/api/response/RegisterClientResponse.js +17 -0
- package/build/api/response/RegisterClientResponse.js.map +1 -0
- package/build/api/response/SearchContactsResponse.d.ts +15 -0
- package/build/api/response/SearchContactsResponse.d.ts.map +1 -0
- package/build/api/response/SearchContactsResponse.js +17 -0
- package/build/api/response/SearchContactsResponse.js.map +1 -0
- package/build/core/CoreCryptoClient.d.ts +48 -0
- package/build/core/CoreCryptoClient.d.ts.map +1 -0
- package/build/core/CoreCryptoClient.js +219 -0
- package/build/core/CoreCryptoClient.js.map +1 -0
- package/build/core/CoreCryptoMlsTransport.d.ts +19 -0
- package/build/core/CoreCryptoMlsTransport.d.ts.map +1 -0
- package/build/core/CoreCryptoMlsTransport.js +64 -0
- package/build/core/CoreCryptoMlsTransport.js.map +1 -0
- package/build/core/CoreCryptoService.d.ts +59 -0
- package/build/core/CoreCryptoService.d.ts.map +1 -0
- package/build/core/CoreCryptoService.js +233 -0
- package/build/core/CoreCryptoService.js.map +1 -0
- package/build/core/HttpClient.d.ts +47 -0
- package/build/core/HttpClient.d.ts.map +1 -0
- package/build/core/HttpClient.js +258 -0
- package/build/core/HttpClient.js.map +1 -0
- package/build/core/HttpRetryHelper.d.ts +16 -0
- package/build/core/HttpRetryHelper.d.ts.map +1 -0
- package/build/core/HttpRetryHelper.js +49 -0
- package/build/core/HttpRetryHelper.js.map +1 -0
- package/build/core/HttpRetryPolicy.d.ts +7 -0
- package/build/core/HttpRetryPolicy.d.ts.map +1 -0
- package/build/core/HttpRetryPolicy.js +29 -0
- package/build/core/HttpRetryPolicy.js.map +1 -0
- package/build/core/WebSocketClient.d.ts +37 -0
- package/build/core/WebSocketClient.d.ts.map +1 -0
- package/build/core/WebSocketClient.js +244 -0
- package/build/core/WebSocketClient.js.map +1 -0
- package/build/core/WireApplicationManager.d.ts +39 -0
- package/build/core/WireApplicationManager.d.ts.map +1 -0
- package/build/core/WireApplicationManager.js +142 -0
- package/build/core/WireApplicationManager.js.map +1 -0
- package/build/core/WireEventsHandler.d.ts +33 -0
- package/build/core/WireEventsHandler.d.ts.map +1 -0
- package/build/core/WireEventsHandler.js +78 -0
- package/build/core/WireEventsHandler.js.map +1 -0
- package/build/core/event/DeleteConversationEventProcessor.d.ts +13 -0
- package/build/core/event/DeleteConversationEventProcessor.d.ts.map +1 -0
- package/build/core/event/DeleteConversationEventProcessor.js +58 -0
- package/build/core/event/DeleteConversationEventProcessor.js.map +1 -0
- package/build/core/event/EventProcessor.d.ts +6 -0
- package/build/core/event/EventProcessor.d.ts.map +1 -0
- package/build/core/event/EventProcessor.js +17 -0
- package/build/core/event/EventProcessor.js.map +1 -0
- package/build/core/event/EventRouter.d.ts +10 -0
- package/build/core/event/EventRouter.d.ts.map +1 -0
- package/build/core/event/EventRouter.js +58 -0
- package/build/core/event/EventRouter.js.map +1 -0
- package/build/core/event/MemberJoinEventProcessor.d.ts +13 -0
- package/build/core/event/MemberJoinEventProcessor.d.ts.map +1 -0
- package/build/core/event/MemberJoinEventProcessor.js +63 -0
- package/build/core/event/MemberJoinEventProcessor.js.map +1 -0
- package/build/core/event/MemberLeaveEventProcessor.d.ts +13 -0
- package/build/core/event/MemberLeaveEventProcessor.d.ts.map +1 -0
- package/build/core/event/MemberLeaveEventProcessor.js +58 -0
- package/build/core/event/MemberLeaveEventProcessor.js.map +1 -0
- package/build/core/event/MemberUpdateEventProcessor.d.ts +11 -0
- package/build/core/event/MemberUpdateEventProcessor.d.ts.map +1 -0
- package/build/core/event/MemberUpdateEventProcessor.js +50 -0
- package/build/core/event/MemberUpdateEventProcessor.js.map +1 -0
- package/build/core/event/MlsMessageEventProcessor.d.ts +18 -0
- package/build/core/event/MlsMessageEventProcessor.d.ts.map +1 -0
- package/build/core/event/MlsMessageEventProcessor.js +134 -0
- package/build/core/event/MlsMessageEventProcessor.js.map +1 -0
- package/build/core/event/MlsResetEventProcessor.d.ts +11 -0
- package/build/core/event/MlsResetEventProcessor.d.ts.map +1 -0
- package/build/core/event/MlsResetEventProcessor.js +48 -0
- package/build/core/event/MlsResetEventProcessor.js.map +1 -0
- package/build/core/event/MlsWelcomeEventProcessor.d.ts +18 -0
- package/build/core/event/MlsWelcomeEventProcessor.d.ts.map +1 -0
- package/build/core/event/MlsWelcomeEventProcessor.js +77 -0
- package/build/core/event/MlsWelcomeEventProcessor.js.map +1 -0
- package/build/core/event/NewConversationEventProcessor.d.ts +11 -0
- package/build/core/event/NewConversationEventProcessor.d.ts.map +1 -0
- package/build/core/event/NewConversationEventProcessor.js +49 -0
- package/build/core/event/NewConversationEventProcessor.js.map +1 -0
- package/build/core/event/processors.index.d.ts +9 -0
- package/build/core/event/processors.index.d.ts.map +1 -0
- package/build/core/event/processors.index.js +24 -0
- package/build/core/event/processors.index.js.map +1 -0
- package/build/db/AppPropertiesRepository.d.ts +16 -0
- package/build/db/AppPropertiesRepository.d.ts.map +1 -0
- package/build/db/AppPropertiesRepository.js +64 -0
- package/build/db/AppPropertiesRepository.js.map +1 -0
- package/build/db/ConversationMemberRepository.d.ts +23 -0
- package/build/db/ConversationMemberRepository.d.ts.map +1 -0
- package/build/db/ConversationMemberRepository.js +125 -0
- package/build/db/ConversationMemberRepository.js.map +1 -0
- package/build/db/ConversationRepository.d.ts +17 -0
- package/build/db/ConversationRepository.d.ts.map +1 -0
- package/build/db/ConversationRepository.js +100 -0
- package/build/db/ConversationRepository.js.map +1 -0
- package/build/db/DatabaseService.d.ts +12 -0
- package/build/db/DatabaseService.d.ts.map +1 -0
- package/build/db/DatabaseService.js +73 -0
- package/build/db/DatabaseService.js.map +1 -0
- package/build/db/migrations/0000_pink_lord_tyger.sql +27 -0
- package/build/db/migrations/0001_steady_selene.sql +16 -0
- package/build/db/migrations/meta/0000_snapshot.json +194 -0
- package/build/db/migrations/meta/0001_snapshot.json +197 -0
- package/build/db/migrations/meta/_journal.json +20 -0
- package/build/db/model/AppEntity.d.ts +5 -0
- package/build/db/model/AppEntity.d.ts.map +1 -0
- package/build/db/model/AppEntity.js +17 -0
- package/build/db/model/AppEntity.js.map +1 -0
- package/build/db/model/ConversationEntity.d.ts +11 -0
- package/build/db/model/ConversationEntity.d.ts.map +1 -0
- package/build/db/model/ConversationEntity.js +17 -0
- package/build/db/model/ConversationEntity.js.map +1 -0
- package/build/db/model/ConversationMemberEntity.d.ts +9 -0
- package/build/db/model/ConversationMemberEntity.d.ts.map +1 -0
- package/build/db/model/ConversationMemberEntity.js +17 -0
- package/build/db/model/ConversationMemberEntity.js.map +1 -0
- package/build/db/relations.d.ts +7 -0
- package/build/db/relations.d.ts.map +1 -0
- package/build/db/relations.js +12 -0
- package/build/db/relations.js.map +1 -0
- package/build/db/schema.d.ts +324 -0
- package/build/db/schema.d.ts.map +1 -0
- package/build/db/schema.js +34 -0
- package/build/db/schema.js.map +1 -0
- package/build/generated/messages.d.ts +5517 -0
- package/build/generated/messages.d.ts.map +1 -0
- package/build/generated/messages.js +14470 -0
- package/build/generated/messages.js.map +1 -0
- package/build/generated/package.json +3 -0
- package/build/index.d.ts +14 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +34 -0
- package/build/index.js.map +1 -0
- package/build/mappers/PreKeyMapper.d.ts +4 -0
- package/build/mappers/PreKeyMapper.d.ts.map +1 -0
- package/build/mappers/PreKeyMapper.js +22 -0
- package/build/mappers/PreKeyMapper.js.map +1 -0
- package/build/mappers/conversation/ConversationMapper.d.ts +6 -0
- package/build/mappers/conversation/ConversationMapper.d.ts.map +1 -0
- package/build/mappers/conversation/ConversationMapper.js +27 -0
- package/build/mappers/conversation/ConversationMapper.js.map +1 -0
- package/build/mappers/conversation/ConversationMemberMapper.d.ts +6 -0
- package/build/mappers/conversation/ConversationMemberMapper.d.ts.map +1 -0
- package/build/mappers/conversation/ConversationMemberMapper.js +25 -0
- package/build/mappers/conversation/ConversationMemberMapper.js.map +1 -0
- package/build/mappers/protobuf/EncryptionAlgorithmMapper.d.ts +7 -0
- package/build/mappers/protobuf/EncryptionAlgorithmMapper.d.ts.map +1 -0
- package/build/mappers/protobuf/EncryptionAlgorithmMapper.js +35 -0
- package/build/mappers/protobuf/EncryptionAlgorithmMapper.js.map +1 -0
- package/build/mappers/protobuf/MessageContentEncoder.d.ts +9 -0
- package/build/mappers/protobuf/MessageContentEncoder.d.ts.map +1 -0
- package/build/mappers/protobuf/MessageContentEncoder.js +85 -0
- package/build/mappers/protobuf/MessageContentEncoder.js.map +1 -0
- package/build/mappers/protobuf/MessageLinkPreviewMapper.d.ts +7 -0
- package/build/mappers/protobuf/MessageLinkPreviewMapper.d.ts.map +1 -0
- package/build/mappers/protobuf/MessageLinkPreviewMapper.js +79 -0
- package/build/mappers/protobuf/MessageLinkPreviewMapper.js.map +1 -0
- package/build/mappers/protobuf/MessageMentionMapper.d.ts +7 -0
- package/build/mappers/protobuf/MessageMentionMapper.d.ts.map +1 -0
- package/build/mappers/protobuf/MessageMentionMapper.js +39 -0
- package/build/mappers/protobuf/MessageMentionMapper.js.map +1 -0
- package/build/mappers/protobuf/ProtobufDeserializer.d.ts +12 -0
- package/build/mappers/protobuf/ProtobufDeserializer.d.ts.map +1 -0
- package/build/mappers/protobuf/ProtobufDeserializer.js +343 -0
- package/build/mappers/protobuf/ProtobufDeserializer.js.map +1 -0
- package/build/mappers/protobuf/ProtobufSerializer.d.ts +15 -0
- package/build/mappers/protobuf/ProtobufSerializer.d.ts.map +1 -0
- package/build/mappers/protobuf/ProtobufSerializer.js +331 -0
- package/build/mappers/protobuf/ProtobufSerializer.js.map +1 -0
- package/build/model/Asset.d.ts +9 -0
- package/build/model/Asset.d.ts.map +1 -0
- package/build/model/Asset.js +17 -0
- package/build/model/Asset.js.map +1 -0
- package/build/model/ClaimedKeyPackagesResult.d.ts +7 -0
- package/build/model/ClaimedKeyPackagesResult.d.ts.map +1 -0
- package/build/model/ClaimedKeyPackagesResult.js +17 -0
- package/build/model/ClaimedKeyPackagesResult.js.map +1 -0
- package/build/model/CryptoClientId.d.ts +8 -0
- package/build/model/CryptoClientId.d.ts.map +1 -0
- package/build/model/CryptoClientId.js +29 -0
- package/build/model/CryptoClientId.js.map +1 -0
- package/build/model/CryptoProtocol.d.ts +6 -0
- package/build/model/CryptoProtocol.d.ts.map +1 -0
- package/build/model/CryptoProtocol.js +22 -0
- package/build/model/CryptoProtocol.js.map +1 -0
- package/build/model/EventContentDTO.d.ts +84 -0
- package/build/model/EventContentDTO.d.ts.map +1 -0
- package/build/model/EventContentDTO.js +17 -0
- package/build/model/EventContentDTO.js.map +1 -0
- package/build/model/MlsPublicKeys.d.ts +7 -0
- package/build/model/MlsPublicKeys.d.ts.map +1 -0
- package/build/model/MlsPublicKeys.js +17 -0
- package/build/model/MlsPublicKeys.js.map +1 -0
- package/build/model/PreKeyCrypto.d.ts +6 -0
- package/build/model/PreKeyCrypto.d.ts.map +1 -0
- package/build/model/PreKeyCrypto.js +24 -0
- package/build/model/PreKeyCrypto.js.map +1 -0
- package/build/model/QualifiedId.d.ts +17 -0
- package/build/model/QualifiedId.d.ts.map +1 -0
- package/build/model/QualifiedId.js +43 -0
- package/build/model/QualifiedId.js.map +1 -0
- package/build/model/TeamId.d.ts +6 -0
- package/build/model/TeamId.d.ts.map +1 -0
- package/build/model/TeamId.js +26 -0
- package/build/model/TeamId.js.map +1 -0
- package/build/model/WireMessage.d.ts +336 -0
- package/build/model/WireMessage.d.ts.map +1 -0
- package/build/model/WireMessage.js +270 -0
- package/build/model/WireMessage.js.map +1 -0
- package/build/model/WireUser.d.ts +12 -0
- package/build/model/WireUser.d.ts.map +1 -0
- package/build/model/WireUser.js +32 -0
- package/build/model/WireUser.js.map +1 -0
- package/build/model/conversation/ChannelAddPermissionType.d.ts +7 -0
- package/build/model/conversation/ChannelAddPermissionType.d.ts.map +1 -0
- package/build/model/conversation/ChannelAddPermissionType.js +23 -0
- package/build/model/conversation/ChannelAddPermissionType.js.map +1 -0
- package/build/model/conversation/Conversation.d.ts +9 -0
- package/build/model/conversation/Conversation.d.ts.map +1 -0
- package/build/model/conversation/Conversation.js +17 -0
- package/build/model/conversation/Conversation.js.map +1 -0
- package/build/model/conversation/ConversationAccess.d.ts +8 -0
- package/build/model/conversation/ConversationAccess.d.ts.map +1 -0
- package/build/model/conversation/ConversationAccess.js +24 -0
- package/build/model/conversation/ConversationAccess.js.map +1 -0
- package/build/model/conversation/ConversationAccessRole.d.ts +8 -0
- package/build/model/conversation/ConversationAccessRole.d.ts.map +1 -0
- package/build/model/conversation/ConversationAccessRole.js +24 -0
- package/build/model/conversation/ConversationAccessRole.js.map +1 -0
- package/build/model/conversation/ConversationMember.d.ts +7 -0
- package/build/model/conversation/ConversationMember.d.ts.map +1 -0
- package/build/model/conversation/ConversationMember.js +17 -0
- package/build/model/conversation/ConversationMember.js.map +1 -0
- package/build/model/conversation/ConversationRole.d.ts +6 -0
- package/build/model/conversation/ConversationRole.d.ts.map +1 -0
- package/build/model/conversation/ConversationRole.js +29 -0
- package/build/model/conversation/ConversationRole.js.map +1 -0
- package/build/model/conversation/ConversationType.d.ts +6 -0
- package/build/model/conversation/ConversationType.d.ts.map +1 -0
- package/build/model/conversation/ConversationType.js +22 -0
- package/build/model/conversation/ConversationType.js.map +1 -0
- package/build/model/conversation/GroupConversationType.d.ts +5 -0
- package/build/model/conversation/GroupConversationType.d.ts.map +1 -0
- package/build/model/conversation/GroupConversationType.js +21 -0
- package/build/model/conversation/GroupConversationType.js.map +1 -0
- package/build/model/conversation/ReceiptMode.d.ts +5 -0
- package/build/model/conversation/ReceiptMode.d.ts.map +1 -0
- package/build/model/conversation/ReceiptMode.js +21 -0
- package/build/model/conversation/ReceiptMode.js.map +1 -0
- package/build/model/exception/CoreCryptoMlsException.d.ts +5 -0
- package/build/model/exception/CoreCryptoMlsException.d.ts.map +1 -0
- package/build/model/exception/CoreCryptoMlsException.js +25 -0
- package/build/model/exception/CoreCryptoMlsException.js.map +1 -0
- package/build/model/exception/MlsException.d.ts +5 -0
- package/build/model/exception/MlsException.d.ts.map +1 -0
- package/build/model/exception/MlsException.js +25 -0
- package/build/model/exception/MlsException.js.map +1 -0
- package/build/model/exception/WireApiError.d.ts +6 -0
- package/build/model/exception/WireApiError.d.ts.map +1 -0
- package/build/model/exception/WireApiError.js +17 -0
- package/build/model/exception/WireApiError.js.map +1 -0
- package/build/model/exception/WireApiException.d.ts +8 -0
- package/build/model/exception/WireApiException.d.ts.map +1 -0
- package/build/model/exception/WireApiException.js +29 -0
- package/build/model/exception/WireApiException.js.map +1 -0
- package/build/model/protobuf/MessageEncryptionAlgorithm.d.ts +5 -0
- package/build/model/protobuf/MessageEncryptionAlgorithm.d.ts.map +1 -0
- package/build/model/protobuf/MessageEncryptionAlgorithm.js +21 -0
- package/build/model/protobuf/MessageEncryptionAlgorithm.js.map +1 -0
- package/build/service/AppProperties.d.ts +25 -0
- package/build/service/AppProperties.d.ts.map +1 -0
- package/build/service/AppProperties.js +105 -0
- package/build/service/AppProperties.js.map +1 -0
- package/build/service/MlsFallbackStrategy.d.ts +11 -0
- package/build/service/MlsFallbackStrategy.d.ts.map +1 -0
- package/build/service/MlsFallbackStrategy.js +57 -0
- package/build/service/MlsFallbackStrategy.js.map +1 -0
- package/build/service/NotificationsService.d.ts +14 -0
- package/build/service/NotificationsService.d.ts.map +1 -0
- package/build/service/NotificationsService.js +71 -0
- package/build/service/NotificationsService.js.map +1 -0
- package/build/utils/AESUtils.d.ts +11 -0
- package/build/utils/AESUtils.d.ts.map +1 -0
- package/build/utils/AESUtils.js +47 -0
- package/build/utils/AESUtils.js.map +1 -0
- package/build/utils/BufferUtils.d.ts +2 -0
- package/build/utils/BufferUtils.d.ts.map +1 -0
- package/build/utils/BufferUtils.js +17 -0
- package/build/utils/BufferUtils.js.map +1 -0
- package/build/utils/DependencyInjectionTokens.d.ts +8 -0
- package/build/utils/DependencyInjectionTokens.d.ts.map +1 -0
- package/build/utils/DependencyInjectionTokens.js +23 -0
- package/build/utils/DependencyInjectionTokens.js.map +1 -0
- package/build/utils/HashUtils.d.ts +5 -0
- package/build/utils/HashUtils.d.ts.map +1 -0
- package/build/utils/HashUtils.js +25 -0
- package/build/utils/HashUtils.js.map +1 -0
- package/build/utils/ObfuscateUtil.d.ts +3 -0
- package/build/utils/ObfuscateUtil.d.ts.map +1 -0
- package/build/utils/ObfuscateUtil.js +30 -0
- package/build/utils/ObfuscateUtil.js.map +1 -0
- package/build/utils/StoragePaths.d.ts +4 -0
- package/build/utils/StoragePaths.d.ts.map +1 -0
- package/build/utils/StoragePaths.js +22 -0
- package/build/utils/StoragePaths.js.map +1 -0
- package/build/utils/logger/ConsoleLogger.d.ts +12 -0
- package/build/utils/logger/ConsoleLogger.d.ts.map +1 -0
- package/build/utils/logger/ConsoleLogger.js +31 -0
- package/build/utils/logger/ConsoleLogger.js.map +1 -0
- package/build/utils/logger/LogLevel.d.ts +7 -0
- package/build/utils/logger/LogLevel.d.ts.map +1 -0
- package/build/utils/logger/LogLevel.js +8 -0
- package/build/utils/logger/LogLevel.js.map +1 -0
- package/build/utils/logger/Logger.d.ts +27 -0
- package/build/utils/logger/Logger.d.ts.map +1 -0
- package/build/utils/logger/Logger.js +2 -0
- package/build/utils/logger/Logger.js.map +1 -0
- package/build/utils/logger/LoggerFactory.d.ts +7 -0
- package/build/utils/logger/LoggerFactory.d.ts.map +1 -0
- package/build/utils/logger/LoggerFactory.js +19 -0
- package/build/utils/logger/LoggerFactory.js.map +1 -0
- package/package.json +105 -0
- package/src/WireAppSdk.ts +224 -0
- package/src/api/AssetsApiClient.ts +77 -0
- package/src/api/AssetsTransferService.ts +96 -0
- package/src/api/ClientsApiClient.ts +71 -0
- package/src/api/ClientsService.ts +40 -0
- package/src/api/ConversationService.ts +654 -0
- package/src/api/ConversationsApiClient.ts +141 -0
- package/src/api/FeatureConfigsApiClient.ts +31 -0
- package/src/api/FeatureConfigsService.ts +33 -0
- package/src/api/MlsApiClient.ts +81 -0
- package/src/api/MlsService.ts +99 -0
- package/src/api/NotificationsApiClient.ts +58 -0
- package/src/api/OneToOneConversationsApiClient.ts +39 -0
- package/src/api/SearchApiClient.ts +58 -0
- package/src/api/TeamsApiClient.ts +40 -0
- package/src/api/UserService.ts +111 -0
- package/src/api/UsersApiClient.ts +61 -0
- package/src/api/model/AddMembersToConversationResult.ts +22 -0
- package/src/api/model/ConversationIdsPaginationConfig.ts +20 -0
- package/src/api/model/ConversationMemberOtherResponse.ts +23 -0
- package/src/api/model/ConversationMemberSelfResponse.ts +23 -0
- package/src/api/model/ConversationMembersResponse.ts +23 -0
- package/src/api/model/ConversationTeamInfo.ts +20 -0
- package/src/api/model/RemoveMembersFromConversationResult.ts +21 -0
- package/src/api/model/UserClientResponse.ts +19 -0
- package/src/api/model/UserResponse.ts +28 -0
- package/src/api/model/asset/AssetUploadData.ts +20 -0
- package/src/api/model/asset/AssetUploadResponse.ts +22 -0
- package/src/api/request/CapabilitiesRequest.ts +19 -0
- package/src/api/request/ClientUpdateRequest.ts +21 -0
- package/src/api/request/ConversationIdsRequest.ts +21 -0
- package/src/api/request/CreateConversationRequest.ts +86 -0
- package/src/api/request/MlsKeyPackagesRequest.ts +19 -0
- package/src/api/request/PreKeyRequest.ts +28 -0
- package/src/api/request/RegisterClientRequest.ts +46 -0
- package/src/api/response/AccessResponse.ts +22 -0
- package/src/api/response/ClaimedKeyPackageList.ts +30 -0
- package/src/api/response/ConversationIdsResponse.ts +23 -0
- package/src/api/response/ConversationResponse.ts +32 -0
- package/src/api/response/ConversationsResponse.ts +24 -0
- package/src/api/response/EventResponse.ts +23 -0
- package/src/api/response/FeatureConfigsResponse.ts +37 -0
- package/src/api/response/MlsPublicKeysResponse.ts +58 -0
- package/src/api/response/NotificationsResponse.ts +23 -0
- package/src/api/response/OneToOneConversationResponse.ts +24 -0
- package/src/api/response/RegisterClientResponse.ts +19 -0
- package/src/api/response/SearchContactsResponse.ts +32 -0
- package/src/core/CoreCryptoClient.ts +361 -0
- package/src/core/CoreCryptoMlsTransport.ts +58 -0
- package/src/core/CoreCryptoService.ts +276 -0
- package/src/core/HttpClient.ts +363 -0
- package/src/core/HttpRetryHelper.ts +57 -0
- package/src/core/HttpRetryPolicy.ts +40 -0
- package/src/core/WebSocketClient.ts +245 -0
- package/src/core/WireApplicationManager.ts +162 -0
- package/src/core/WireEventsHandler.ts +118 -0
- package/src/core/event/DeleteConversationEventProcessor.ts +47 -0
- package/src/core/event/EventProcessor.ts +22 -0
- package/src/core/event/EventRouter.ts +54 -0
- package/src/core/event/MemberJoinEventProcessor.ts +54 -0
- package/src/core/event/MemberLeaveEventProcessor.ts +47 -0
- package/src/core/event/MemberUpdateEventProcessor.ts +44 -0
- package/src/core/event/MlsMessageEventProcessor.ts +124 -0
- package/src/core/event/MlsResetEventProcessor.ts +42 -0
- package/src/core/event/MlsWelcomeEventProcessor.ts +68 -0
- package/src/core/event/NewConversationEventProcessor.ts +42 -0
- package/src/core/event/processors.index.ts +24 -0
- package/src/db/AppPropertiesRepository.ts +62 -0
- package/src/db/ConversationMemberRepository.ts +163 -0
- package/src/db/ConversationRepository.ts +119 -0
- package/src/db/DatabaseService.ts +69 -0
- package/src/db/migrations/0000_pink_lord_tyger.sql +27 -0
- package/src/db/migrations/0001_steady_selene.sql +16 -0
- package/src/db/migrations/meta/0000_snapshot.json +194 -0
- package/src/db/migrations/meta/0001_snapshot.json +197 -0
- package/src/db/migrations/meta/_journal.json +20 -0
- package/src/db/model/AppEntity.ts +20 -0
- package/src/db/model/ConversationEntity.ts +27 -0
- package/src/db/model/ConversationMemberEntity.ts +24 -0
- package/src/db/relations.ts +13 -0
- package/src/db/schema.ts +38 -0
- package/src/index.ts +67 -0
- package/src/mappers/PreKeyMapper.ts +25 -0
- package/src/mappers/conversation/ConversationMapper.ts +30 -0
- package/src/mappers/conversation/ConversationMemberMapper.ts +30 -0
- package/src/mappers/protobuf/EncryptionAlgorithmMapper.ts +39 -0
- package/src/mappers/protobuf/MessageContentEncoder.ts +121 -0
- package/src/mappers/protobuf/MessageLinkPreviewMapper.ts +89 -0
- package/src/mappers/protobuf/MessageMentionMapper.ts +43 -0
- package/src/mappers/protobuf/ProtobufDeserializer.ts +470 -0
- package/src/mappers/protobuf/ProtobufSerializer.ts +449 -0
- package/src/model/Asset.ts +26 -0
- package/src/model/ClaimedKeyPackagesResult.ts +23 -0
- package/src/model/CryptoClientId.ts +40 -0
- package/src/model/CryptoProtocol.ts +21 -0
- package/src/model/EventContentDTO.ts +123 -0
- package/src/model/MlsPublicKeys.ts +22 -0
- package/src/model/PreKeyCrypto.ts +25 -0
- package/src/model/QualifiedId.ts +45 -0
- package/src/model/TeamId.ts +25 -0
- package/src/model/WireMessage.ts +632 -0
- package/src/model/WireUser.ts +30 -0
- package/src/model/conversation/ChannelAddPermissionType.ts +23 -0
- package/src/model/conversation/Conversation.ts +25 -0
- package/src/model/conversation/ConversationAccess.ts +24 -0
- package/src/model/conversation/ConversationAccessRole.ts +24 -0
- package/src/model/conversation/ConversationMember.ts +23 -0
- package/src/model/conversation/ConversationRole.ts +30 -0
- package/src/model/conversation/ConversationType.ts +21 -0
- package/src/model/conversation/GroupConversationType.ts +21 -0
- package/src/model/conversation/ReceiptMode.ts +21 -0
- package/src/model/exception/CoreCryptoMlsException.ts +26 -0
- package/src/model/exception/MlsException.ts +26 -0
- package/src/model/exception/WireApiError.ts +21 -0
- package/src/model/exception/WireApiException.ts +33 -0
- package/src/model/protobuf/MessageEncryptionAlgorithm.ts +17 -0
- package/src/proto/messages.proto +383 -0
- package/src/service/AppProperties.ts +110 -0
- package/src/service/MlsFallbackStrategy.ts +52 -0
- package/src/service/NotificationsService.ts +65 -0
- package/src/utils/AESUtils.ts +62 -0
- package/src/utils/BufferUtils.ts +18 -0
- package/src/utils/DependencyInjectionTokens.ts +25 -0
- package/src/utils/HashUtils.ts +27 -0
- package/src/utils/ObfuscateUtil.ts +31 -0
- package/src/utils/StoragePaths.ts +23 -0
- package/src/utils/logger/ConsoleLogger.ts +35 -0
- package/src/utils/logger/LogLevel.ts +6 -0
- package/src/utils/logger/Logger.ts +29 -0
- package/src/utils/logger/LoggerFactory.ts +27 -0
package/README.md
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# Wire™
|
|
2
|
+
|
|
3
|
+
[](https://wire.com/jobs/)
|
|
4
|
+
|
|
5
|
+
This repository is part of the source code of Wire. You can find more information at [wire.com](https://wire.com) or by contacting opensource@wire.com.
|
|
6
|
+
|
|
7
|
+
You can find the published source code at [github.com/wireapp/wire](https://github.com/wireapp/wire), and the apk of the latest release at [https://wire.com/en/download/](https://wire.com/en/download/).
|
|
8
|
+
|
|
9
|
+
For licensing information, see the attached LICENSE file and the list of third-party licenses at [wire.com/legal/licenses/](https://wire.com/legal/licenses/).
|
|
10
|
+
|
|
11
|
+
If you compile the open source software that we make available from time to time to develop your own mobile, desktop or web application, and cause that application to connect to our servers for any purposes, we refer to that resulting application as an “Open Source App”. All Open Source Apps are subject to, and may only be used and/or commercialized in accordance with, the Terms of Use applicable to the Wire Application, which can be found at https://wire.com/legal/#terms. Additionally, if you choose to build an Open Source App, certain restrictions apply, as follows:
|
|
12
|
+
|
|
13
|
+
a. You agree not to change the way the Open Source App connects and interacts with our servers;
|
|
14
|
+
|
|
15
|
+
b. You agree not to weaken any of the security features of the Open Source App;
|
|
16
|
+
|
|
17
|
+
c. You agree not to use our servers to store data for purposes other than the intended and original functionality of the Open Source App;
|
|
18
|
+
|
|
19
|
+
d. You acknowledge that you are solely responsible for any and all updates to your Open Source App.
|
|
20
|
+
|
|
21
|
+
For clarity, if you compile the open source software that we make available from time to time to develop your own mobile, desktop or web application, and do not cause that application to connect to our servers for any purposes, then that application will not be deemed an Open Source App and the foregoing will not apply to that application.
|
|
22
|
+
|
|
23
|
+
No license is granted to the Wire trademark and its associated logos, all of which will continue to be owned exclusively by Wire Swiss GmbH. Any use of the Wire trademark and/or its associated logos is expressly prohibited without the express prior written consent of Wire Swiss GmbH.
|
|
24
|
+
|
|
25
|
+
# Wire Applications JS SDK
|
|
26
|
+
|
|
27
|
+
SDK for Wire third-party applications written in Typescript, supporting Typescript and Javascript languages.
|
|
28
|
+
Import the SDK in your project to build your application and interact with the Wire backend and serve your users.
|
|
29
|
+
|
|
30
|
+
This will create a full-fledged client. It can send or receive
|
|
31
|
+
messages, place or receive calls, for example.
|
|
32
|
+
|
|
33
|
+
After completing the onboarding process, the Wire platform will provide an APP_TOKEN,
|
|
34
|
+
required to authenticate your application via the SDK.
|
|
35
|
+
|
|
36
|
+
Deploying the application and initializing the SDK will enable it to receive invites to Team and then reading/writing
|
|
37
|
+
messages to it.
|
|
38
|
+
|
|
39
|
+
## How to use it
|
|
40
|
+
|
|
41
|
+
Install the SDK in a Node application:
|
|
42
|
+
|
|
43
|
+
```shell
|
|
44
|
+
npm install @wireapp/wire-apps-js-sdk
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Create an app-specific `WireEventsHandler`, then initialize the SDK with the Wire application credentials and cryptography storage key provided by your app configuration.
|
|
48
|
+
|
|
49
|
+
## Requirements
|
|
50
|
+
|
|
51
|
+
- Node v22
|
|
52
|
+
- Access to the file system to store cryptographic keys and data
|
|
53
|
+
|
|
54
|
+
## Runtime storage
|
|
55
|
+
|
|
56
|
+
The SDK manages its own local storage under `./storage`, relative to the host process working directory.
|
|
57
|
+
|
|
58
|
+
It creates and uses:
|
|
59
|
+
|
|
60
|
+
```text
|
|
61
|
+
storage/
|
|
62
|
+
├── apps.db
|
|
63
|
+
└── cryptography
|
|
64
|
+
├── <App_ID>
|
|
65
|
+
├── <App_ID>-shm
|
|
66
|
+
└── <App_ID>-wal
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
The SQLite schema is initialized by SDK startup through migrations shipped with the package. If you bundle the SDK with tools such as webpack, esbuild, or Rollup, make sure `build/db/migrations/**` is copied and preserved next to `build/db/DatabaseService.js`. Bundlers often do not include `.sql` files automatically.
|
|
70
|
+
|
|
71
|
+
## Import with
|
|
72
|
+
|
|
73
|
+
The SDK is published as an ESM package. Import it with standard `import` syntax:
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
import {
|
|
77
|
+
WireAppSdk,
|
|
78
|
+
WireEventsHandler,
|
|
79
|
+
TextMessage
|
|
80
|
+
} from '@wireapp/wire-apps-js-sdk'
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
CommonJS `require()` is not the supported integration path for this alpha release.
|
|
84
|
+
|
|
85
|
+
## Environment Variables
|
|
86
|
+
|
|
87
|
+
Environment Variables can be checked from: `.env.example` file
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
WIRE_SDK_USER_ID=your-user-ID-UUID-format
|
|
91
|
+
WIRE_SDK_API_TOKEN=your-api-token
|
|
92
|
+
WIRE_SDK_USER_DOMAIN=yourdomain
|
|
93
|
+
WIRE_SDK_API_HOST=https://your-api.host
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Running the sample App
|
|
97
|
+
|
|
98
|
+
For a clean local run, install dependencies after cleaning the repository:
|
|
99
|
+
|
|
100
|
+
```shell
|
|
101
|
+
npm run clean:all
|
|
102
|
+
npm install
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Then build the SDK and start the sample app:
|
|
106
|
+
|
|
107
|
+
```shell
|
|
108
|
+
npm run build
|
|
109
|
+
npm run sample
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
The `sample` script builds the sample workspace and starts it. It expects the environment variables listed above to be available from the repository `.env` file.
|
|
113
|
+
|
|
114
|
+
## Troubleshooting
|
|
115
|
+
|
|
116
|
+
If the SDK fails to start because a native module cannot be loaded, check that Node was installed for the same CPU architecture as the native dependencies. On Apple Silicon, mixing an x64 Node binary with arm64 native libraries, or the reverse, can cause `dlopen` architecture errors. Reinstalling dependencies with the intended Node binary usually fixes this.
|
|
117
|
+
|
|
118
|
+
If database migrations fail at startup, verify that the package was built before running and that `build/db/migrations/**` exists. Published npm installs include these files, but local development builds need `npm run build` to copy them into `build`.
|
|
119
|
+
|
|
120
|
+
If environment variables are missing, confirm that `.env` exists at the repository root when running the bundled sample app. The sample validates `WIRE_SDK_USER_ID`, `WIRE_SDK_API_TOKEN`, `WIRE_SDK_USER_DOMAIN`, and `WIRE_SDK_API_HOST` on startup.
|
|
121
|
+
|
|
122
|
+
### Testing the SDK
|
|
123
|
+
|
|
124
|
+
Run the SDK typecheck and test suite with:
|
|
125
|
+
|
|
126
|
+
```shell
|
|
127
|
+
npm run test:typecheck
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
To build the SDK and run the sample app:
|
|
131
|
+
|
|
132
|
+
```shell
|
|
133
|
+
npm run build
|
|
134
|
+
npm run sample
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Before publishing, verify the package artifact with:
|
|
138
|
+
|
|
139
|
+
```shell
|
|
140
|
+
npm pack --dry-run
|
|
141
|
+
```
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import "reflect-metadata";
|
|
2
|
+
import './core/event/processors.index.js';
|
|
3
|
+
import { WireEventsHandler } from "./core/WireEventsHandler.js";
|
|
4
|
+
import type { Logger } from "./utils/logger/Logger.js";
|
|
5
|
+
export declare class WireAppSdk {
|
|
6
|
+
private readonly CRYPTOGRAPHY_STORAGE_KEY_BYTES;
|
|
7
|
+
private userId;
|
|
8
|
+
private apiToken;
|
|
9
|
+
private userDomain;
|
|
10
|
+
private apiHost;
|
|
11
|
+
private cryptographyStorageKey;
|
|
12
|
+
private isShuttingDown;
|
|
13
|
+
private isWebSocketRunning;
|
|
14
|
+
private webSocketClient?;
|
|
15
|
+
private conversationService?;
|
|
16
|
+
private appProperties?;
|
|
17
|
+
private wireEventsHandler;
|
|
18
|
+
private logger;
|
|
19
|
+
private constructor();
|
|
20
|
+
static create(userId: string, apiToken: string, userDomain: string, apiHost: string, cryptographyStorageKey: Uint8Array, wireEventsHandler: WireEventsHandler, logger?: Logger): Promise<WireAppSdk>;
|
|
21
|
+
private init;
|
|
22
|
+
private prepareStorage;
|
|
23
|
+
private configureDependencies;
|
|
24
|
+
private initCryptoClient;
|
|
25
|
+
startListening(): Promise<void>;
|
|
26
|
+
stopListening(): void;
|
|
27
|
+
close(): Promise<void>;
|
|
28
|
+
private registerExitHandlers;
|
|
29
|
+
private handleExit;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=WireAppSdk.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WireAppSdk.d.ts","sourceRoot":"","sources":["../src/WireAppSdk.ts"],"names":[],"mappings":"AAgBA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,kCAAkC,CAAA;AAYzC,OAAO,EAAC,iBAAiB,EAAC,MAAM,6BAA6B,CAAC;AAG9D,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,0BAA0B,CAAC;AAOrD,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,8BAA8B,CAAK;IACpD,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,QAAQ,CAAQ;IACxB,OAAO,CAAC,UAAU,CAAQ;IAC1B,OAAO,CAAC,OAAO,CAAQ;IACvB,OAAO,CAAC,sBAAsB,CAAY;IAE1C,OAAO,CAAC,cAAc,CAAQ;IAE9B,OAAO,CAAC,kBAAkB,CAAiB;IAC3C,OAAO,CAAC,eAAe,CAAC,CAAiB;IACzC,OAAO,CAAC,mBAAmB,CAAC,CAAqB;IACjD,OAAO,CAAC,aAAa,CAAC,CAAe;IAErC,OAAO,CAAC,iBAAiB,CAAmB;IAC5C,OAAO,CAAC,MAAM,CAAQ;IAEtB,OAAO;WA0BM,MAAM,CACjB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,sBAAsB,EAAE,UAAU,EAClC,iBAAiB,EAAE,iBAAiB,EACpC,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,UAAU,CAAC;YAgBR,IAAI;IAUlB,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,qBAAqB;YAcf,gBAAgB;IAQxB,cAAc;IAkBpB,aAAa;IAUP,KAAK;IAgBX,OAAO,CAAC,oBAAoB;YAkBd,UAAU;CAiBzB"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Wire
|
|
3
|
+
* Copyright (C) 2025 Wire Swiss GmbH
|
|
4
|
+
*
|
|
5
|
+
* This program is free software: you can redistribute it and/or modify
|
|
6
|
+
* it under the terms of the GNU General Public License as published by
|
|
7
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
+
* (at your option) any later version.
|
|
9
|
+
* This program is distributed in the hope that it will be useful,
|
|
10
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
* GNU General Public License for more details.
|
|
13
|
+
* You should have received a copy of the GNU General Public License
|
|
14
|
+
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
15
|
+
*/
|
|
16
|
+
import "reflect-metadata";
|
|
17
|
+
import './core/event/processors.index.js';
|
|
18
|
+
import { mkdirSync } from "node:fs";
|
|
19
|
+
import { CoreCryptoService } from "./core/CoreCryptoService.js";
|
|
20
|
+
import { WIRE_API_HOST, WIRE_CRYPTOGRAPHY_STORAGE_KEY, WIRE_EVENTS_HANDLER, WIRE_USER_DOMAIN, WIRE_USER_ID, WIRE_SDK_API_TOKEN } from "./utils/DependencyInjectionTokens.js";
|
|
21
|
+
import { WebSocketClient } from "./core/WebSocketClient.js";
|
|
22
|
+
import { WireEventsHandler } from "./core/WireEventsHandler.js";
|
|
23
|
+
import { DatabaseService } from "./db/DatabaseService.js";
|
|
24
|
+
import { container } from "tsyringe";
|
|
25
|
+
import { LoggerFactory } from "./utils/logger/LoggerFactory.js";
|
|
26
|
+
import { ConsoleLogger } from "./utils/logger/ConsoleLogger.js";
|
|
27
|
+
import { ConversationService } from "./api/ConversationService.js";
|
|
28
|
+
import { AppProperties } from "./service/AppProperties.js";
|
|
29
|
+
import { CRYPTOGRAPHY_STORAGE_PATH, STORAGE_PATH } from "./utils/StoragePaths.js";
|
|
30
|
+
export class WireAppSdk {
|
|
31
|
+
CRYPTOGRAPHY_STORAGE_KEY_BYTES = 32;
|
|
32
|
+
userId;
|
|
33
|
+
apiToken;
|
|
34
|
+
userDomain;
|
|
35
|
+
apiHost;
|
|
36
|
+
cryptographyStorageKey;
|
|
37
|
+
isShuttingDown = false;
|
|
38
|
+
isWebSocketRunning = false;
|
|
39
|
+
webSocketClient;
|
|
40
|
+
conversationService;
|
|
41
|
+
appProperties;
|
|
42
|
+
wireEventsHandler;
|
|
43
|
+
logger;
|
|
44
|
+
constructor(userId, apiToken, userDomain, apiHost, cryptographyStorageKey, wireEventsHandler, logger) {
|
|
45
|
+
if (cryptographyStorageKey.length !== this.CRYPTOGRAPHY_STORAGE_KEY_BYTES) {
|
|
46
|
+
throw new Error(`cryptographyStorageKey must be exactly ${this.CRYPTOGRAPHY_STORAGE_KEY_BYTES} bytes long`);
|
|
47
|
+
}
|
|
48
|
+
this.userId = userId;
|
|
49
|
+
this.apiToken = apiToken;
|
|
50
|
+
this.userDomain = userDomain;
|
|
51
|
+
this.apiHost = apiHost;
|
|
52
|
+
this.cryptographyStorageKey = cryptographyStorageKey;
|
|
53
|
+
this.wireEventsHandler = wireEventsHandler;
|
|
54
|
+
LoggerFactory.setRootLogger(logger ?? new ConsoleLogger());
|
|
55
|
+
this.logger = LoggerFactory.getLogger(this.constructor.name);
|
|
56
|
+
}
|
|
57
|
+
static async create(userId, apiToken, userDomain, apiHost, cryptographyStorageKey, wireEventsHandler, logger) {
|
|
58
|
+
const wireAppSdk = new WireAppSdk(userId, apiToken, userDomain, apiHost, cryptographyStorageKey, wireEventsHandler, logger);
|
|
59
|
+
wireAppSdk.registerExitHandlers();
|
|
60
|
+
await wireAppSdk.init();
|
|
61
|
+
return wireAppSdk;
|
|
62
|
+
}
|
|
63
|
+
async init() {
|
|
64
|
+
this.prepareStorage();
|
|
65
|
+
this.configureDependencies();
|
|
66
|
+
// Save cookie from constructor parameter only at first application start.
|
|
67
|
+
// Once BE provides new token, the one stored in `apiToken` will be obsolete.
|
|
68
|
+
this.appProperties.saveBackendCookieIfMissing(this.apiToken);
|
|
69
|
+
await this.initCryptoClient();
|
|
70
|
+
}
|
|
71
|
+
prepareStorage() {
|
|
72
|
+
mkdirSync(STORAGE_PATH, { recursive: true });
|
|
73
|
+
mkdirSync(CRYPTOGRAPHY_STORAGE_PATH, { recursive: true });
|
|
74
|
+
}
|
|
75
|
+
configureDependencies() {
|
|
76
|
+
container.registerInstance(WIRE_API_HOST, this.apiHost);
|
|
77
|
+
container.registerInstance(WIRE_SDK_API_TOKEN, this.apiToken);
|
|
78
|
+
container.registerInstance(WIRE_USER_ID, this.userId);
|
|
79
|
+
container.registerInstance(WIRE_USER_DOMAIN, this.userDomain);
|
|
80
|
+
container.registerInstance(WIRE_CRYPTOGRAPHY_STORAGE_KEY, this.cryptographyStorageKey);
|
|
81
|
+
container.registerInstance(WIRE_EVENTS_HANDLER, this.wireEventsHandler);
|
|
82
|
+
this.webSocketClient = container.resolve(WebSocketClient);
|
|
83
|
+
this.conversationService = container.resolve(ConversationService);
|
|
84
|
+
this.appProperties = container.resolve(AppProperties);
|
|
85
|
+
}
|
|
86
|
+
async initCryptoClient() {
|
|
87
|
+
const coreCryptoService = container.resolve(CoreCryptoService);
|
|
88
|
+
await coreCryptoService.initCoreCryptoClient();
|
|
89
|
+
await coreCryptoService.initOrRegisterClient();
|
|
90
|
+
this.logger.info(`CoreCrypto initialized.`);
|
|
91
|
+
}
|
|
92
|
+
async startListening() {
|
|
93
|
+
if (this.isWebSocketRunning) {
|
|
94
|
+
this.logger.info("Wire Apps SDK is already running.");
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
this.isWebSocketRunning = true;
|
|
98
|
+
if (!this.webSocketClient || !this.conversationService) {
|
|
99
|
+
throw new Error("Wire Apps SDK dependencies are not initialized.");
|
|
100
|
+
}
|
|
101
|
+
this.webSocketClient.connect().finally(() => {
|
|
102
|
+
this.isWebSocketRunning = false;
|
|
103
|
+
});
|
|
104
|
+
await this.conversationService.establishOrRejoinConversations();
|
|
105
|
+
}
|
|
106
|
+
stopListening() {
|
|
107
|
+
if (!this.isWebSocketRunning) {
|
|
108
|
+
this.logger.info("Wire Apps SDK is not running.");
|
|
109
|
+
}
|
|
110
|
+
this.logger.info("Wire Apps SDK shutting down.");
|
|
111
|
+
this.isWebSocketRunning = false;
|
|
112
|
+
this.webSocketClient?.close();
|
|
113
|
+
}
|
|
114
|
+
async close() {
|
|
115
|
+
this.logger.debug("Closing Websocket connections.");
|
|
116
|
+
this.stopListening();
|
|
117
|
+
this.logger.debug("Closing Database connections.");
|
|
118
|
+
try {
|
|
119
|
+
const databaseService = container.resolve(DatabaseService);
|
|
120
|
+
databaseService.close();
|
|
121
|
+
}
|
|
122
|
+
catch (exception) {
|
|
123
|
+
this.logger.debug("Database service was not initialized or could not be closed.", exception);
|
|
124
|
+
}
|
|
125
|
+
// Clear container to prevent memory leaks
|
|
126
|
+
container.clearInstances();
|
|
127
|
+
}
|
|
128
|
+
registerExitHandlers() {
|
|
129
|
+
// SIGINT: Ctrl+C in terminal
|
|
130
|
+
process.on('SIGINT', () => this.handleExit('SIGINT'));
|
|
131
|
+
// SIGTERM: Termination signal (e.g., from Docker, Kubernetes)
|
|
132
|
+
process.on('SIGTERM', () => this.handleExit('SIGTERM'));
|
|
133
|
+
process.on('uncaughtException', (error) => {
|
|
134
|
+
this.logger.error('Uncaught exception:', error);
|
|
135
|
+
this.handleExit('uncaughtException');
|
|
136
|
+
});
|
|
137
|
+
process.on('unhandledRejection', (reason) => {
|
|
138
|
+
this.logger.error('Unhandled rejection:', reason);
|
|
139
|
+
this.handleExit('unhandledRejection');
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
async handleExit(signal) {
|
|
143
|
+
if (this.isShuttingDown) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
this.isShuttingDown = true;
|
|
147
|
+
this.logger.info(`Received ${signal}, cleaning up...`);
|
|
148
|
+
try {
|
|
149
|
+
await this.close();
|
|
150
|
+
this.logger.info('Cleanup completed successfully');
|
|
151
|
+
process.exit(0);
|
|
152
|
+
}
|
|
153
|
+
catch (exception) {
|
|
154
|
+
this.logger.error('Error during cleanup:', exception);
|
|
155
|
+
process.exit(1);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
//# sourceMappingURL=WireAppSdk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WireAppSdk.js","sourceRoot":"","sources":["../src/WireAppSdk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;EAcE;AAEF,OAAO,kBAAkB,CAAC;AAC1B,OAAO,kCAAkC,CAAA;AACzC,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAClC,OAAO,EAAC,iBAAiB,EAAC,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EACL,aAAa,EACb,6BAA6B,EAC7B,mBAAmB,EACnB,gBAAgB,EAChB,YAAY,EACZ,kBAAkB,EACnB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAC,eAAe,EAAC,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAC,iBAAiB,EAAC,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAC,eAAe,EAAC,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAC,SAAS,EAAC,MAAM,UAAU,CAAC;AAEnC,OAAO,EAAC,aAAa,EAAC,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAC,aAAa,EAAC,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAC,mBAAmB,EAAC,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAC,aAAa,EAAC,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAC,yBAAyB,EAAE,YAAY,EAAC,MAAM,yBAAyB,CAAC;AAEhF,MAAM,OAAO,UAAU;IACJ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AC,cAAc,EAAE,CAAC;YACxB,OAAM;QACR,CAAC;QAED,IAAI,CAAC,cAAc,GAAG,IAAI,CAAA;QAC1B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,MAAM,kBAAkB,CAAC,CAAA;QAEtD,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,KAAK,EAAE,CAAA;YAClB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAA;YAClD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QACjB,CAAC;QAAC,OAAO,SAAS,EAAE,CAAC;YACnB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,uBAAuB,EAAE,SAAS,CAAC,CAAA;YACrD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QACjB,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { HttpClient } from "../core/HttpClient.js";
|
|
2
|
+
import type { AssetUploadData } from "./model/asset/AssetUploadData.js";
|
|
3
|
+
import type { AssetUploadResponse } from "./model/asset/AssetUploadResponse.js";
|
|
4
|
+
import type { AssetData } from "../model/Asset.js";
|
|
5
|
+
export declare class AssetsApiClient {
|
|
6
|
+
private httpClient;
|
|
7
|
+
constructor(httpClient: HttpClient);
|
|
8
|
+
private static readonly BASE_PATH;
|
|
9
|
+
downloadAsset(assetId: string, assetDomain: string, assetToken?: string | null): Promise<AssetData>;
|
|
10
|
+
uploadAsset(asset: AssetData, assetUploadData: AssetUploadData): Promise<AssetUploadResponse>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=AssetsApiClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AssetsApiClient.d.ts","sourceRoot":"","sources":["../../src/api/AssetsApiClient.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAGhF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,qBACa,eAAe;IACd,OAAO,CAAC,UAAU;gBAAV,UAAU,EAAE,UAAU;IAG1C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAY;IAEvC,aAAa,CACjB,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,GACzB,OAAO,CAAC,SAAS,CAAC;IAYf,WAAW,CACf,KAAK,EAAE,SAAS,EAChB,eAAe,EAAE,eAAe,GAC/B,OAAO,CAAC,mBAAmB,CAAC;CA0BhC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Wire
|
|
3
|
+
* Copyright (C) 2025 Wire Swiss GmbH
|
|
4
|
+
*
|
|
5
|
+
* This program is free software: you can redistribute it and/or modify
|
|
6
|
+
* it under the terms of the GNU General Public License as published by
|
|
7
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
+
* (at your option) any later version.
|
|
9
|
+
* This program is distributed in the hope that it will be useful,
|
|
10
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
* GNU General Public License for more details.
|
|
13
|
+
* You should have received a copy of the GNU General Public License
|
|
14
|
+
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
15
|
+
*/
|
|
16
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
17
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
18
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
19
|
+
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;
|
|
20
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
21
|
+
};
|
|
22
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
23
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
24
|
+
};
|
|
25
|
+
var AssetsApiClient_1;
|
|
26
|
+
import { HttpClient } from "../core/HttpClient.js";
|
|
27
|
+
import { singleton } from "tsyringe";
|
|
28
|
+
import { randomUUID } from "crypto";
|
|
29
|
+
import { concatToBuffer } from "../utils/BufferUtils.js";
|
|
30
|
+
let AssetsApiClient = class AssetsApiClient {
|
|
31
|
+
static { AssetsApiClient_1 = this; }
|
|
32
|
+
httpClient;
|
|
33
|
+
constructor(httpClient) {
|
|
34
|
+
this.httpClient = httpClient;
|
|
35
|
+
}
|
|
36
|
+
static BASE_PATH = "assets";
|
|
37
|
+
async downloadAsset(assetId, assetDomain, assetToken) {
|
|
38
|
+
const path = `${AssetsApiClient_1.BASE_PATH}/${assetDomain}/${assetId}`;
|
|
39
|
+
const headerAssetToken = assetToken ? { "Asset-Token": assetToken } : {};
|
|
40
|
+
return await this.httpClient.getRequest(path, {
|
|
41
|
+
additionalHeaders: headerAssetToken
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
async uploadAsset(asset, assetUploadData) {
|
|
45
|
+
const boundary = `Frontier${randomUUID()}`;
|
|
46
|
+
const metadata = JSON.stringify(assetUploadData);
|
|
47
|
+
const body = `--${boundary}\r\n` +
|
|
48
|
+
'Content-Type: application/json;charset=utf-8\r\n' +
|
|
49
|
+
`Content-length: ${metadata.length}\r\n` +
|
|
50
|
+
'\r\n' +
|
|
51
|
+
`${metadata}\r\n` +
|
|
52
|
+
`--${boundary}\r\n` +
|
|
53
|
+
'Content-Type: application/octet-stream\r\n' +
|
|
54
|
+
`Content-length: ${asset.length}\r\n` +
|
|
55
|
+
'\r\n';
|
|
56
|
+
const footer = `\r\n--${boundary}--\r\n`;
|
|
57
|
+
return await this.httpClient.postRequest(AssetsApiClient_1.BASE_PATH, concatToBuffer(body, asset, footer), {
|
|
58
|
+
headerContentType: `multipart/mixed; boundary=${boundary}`,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
AssetsApiClient = AssetsApiClient_1 = __decorate([
|
|
63
|
+
singleton(),
|
|
64
|
+
__metadata("design:paramtypes", [HttpClient])
|
|
65
|
+
], AssetsApiClient);
|
|
66
|
+
export { AssetsApiClient };
|
|
67
|
+
//# sourceMappingURL=AssetsApiClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AssetsApiClient.js","sourceRoot":"","sources":["../../src/api/AssetsApiClient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAGrC,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAIlD,IAAM,eAAe,GAArB,MAAM,eAAe;;IACN;IAApB,YAAoB,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;IAC1C,CAAC;IAEO,MAAM,CAAU,SAAS,GAAG,QAAQ,CAAC;IAE7C,KAAK,CAAC,aAAa,CACjB,OAAe,EACf,WAAmB,EACnB,UAA0B;QAE1B,MAAM,IAAI,GAAG,GAAG,iBAAe,CAAC,SAAS,IAAI,WAAW,IAAI,OAAO,EAAE,CAAA;QACrE,MAAM,gBAAgB,GAA2B,UAAU,CAAC,CAAC,CAAC,EAAC,aAAa,EAAE,UAAU,EAAC,CAAC,CAAC,CAAC,EAAE,CAAA;QAE9F,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,UAAU,CACrC,IAAI,EACJ;YACE,iBAAiB,EAAE,gBAAgB;SACpC,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,WAAW,CACf,KAAgB,EAChB,eAAgC;QAEhC,MAAM,QAAQ,GAAG,WAAW,UAAU,EAAE,EAAE,CAAA;QAE1C,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,CAAA;QAEhD,MAAM,IAAI,GACR,KAAK,QAAQ,MAAM;YACnB,kDAAkD;YAClD,mBAAmB,QAAQ,CAAC,MAAM,MAAM;YACxC,MAAM;YACN,GAAG,QAAQ,MAAM;YACjB,KAAK,QAAQ,MAAM;YACnB,4CAA4C;YAC5C,mBAAmB,KAAK,CAAC,MAAM,MAAM;YACrC,MAAM,CAAC;QAET,MAAM,MAAM,GAAG,SAAS,QAAQ,QAAQ,CAAC;QAEzC,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,WAAW,CACtC,iBAAe,CAAC,SAAS,EACzB,cAAc,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,EACnC;YACE,iBAAiB,EAAE,6BAA6B,QAAQ,EAAE;SAC3D,CACF,CAAA;IACH,CAAC;;AAlDU,eAAe;IAD3B,SAAS,EAAE;qCAEsB,UAAU;GAD/B,eAAe,CAmD3B"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AssetsApiClient } from "./AssetsApiClient.js";
|
|
2
|
+
import type { AssetRemoteData } from "../model/WireMessage.js";
|
|
3
|
+
import type { AssetData } from "../model/Asset.js";
|
|
4
|
+
export declare class AssetsTransferService {
|
|
5
|
+
private assetsApiClient;
|
|
6
|
+
constructor(assetsApiClient: AssetsApiClient);
|
|
7
|
+
private readonly MAX_DATA_SIZE;
|
|
8
|
+
downloadAsset(assetRemoteData: AssetRemoteData): Promise<Uint8Array>;
|
|
9
|
+
uploadAssetForSending(asset: AssetData): Promise<AssetRemoteData>;
|
|
10
|
+
private uploadAsset;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=AssetsTransferService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AssetsTransferService.d.ts","sourceRoot":"","sources":["../../src/api/AssetsTransferService.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAM/D,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,mBAAmB,CAAC;AAEjD,qBACa,qBAAqB;IACpB,OAAO,CAAC,eAAe;gBAAf,eAAe,EAAE,eAAe;IAGpD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAoB;IAE5C,aAAa,CAAC,eAAe,EAAE,eAAe,GAAG,OAAO,CAAC,UAAU,CAAC;IAgBpE,qBAAqB,CACzB,KAAK,EAAE,SAAS,GACf,OAAO,CAAC,eAAe,CAAC;YAuBb,WAAW;CAc1B"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Wire
|
|
3
|
+
* Copyright (C) 2025 Wire Swiss GmbH
|
|
4
|
+
*
|
|
5
|
+
* This program is free software: you can redistribute it and/or modify
|
|
6
|
+
* it under the terms of the GNU General Public License as published by
|
|
7
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
+
* (at your option) any later version.
|
|
9
|
+
* This program is distributed in the hope that it will be useful,
|
|
10
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
* GNU General Public License for more details.
|
|
13
|
+
* You should have received a copy of the GNU General Public License
|
|
14
|
+
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
15
|
+
*/
|
|
16
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
17
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
18
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
19
|
+
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;
|
|
20
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
21
|
+
};
|
|
22
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
23
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
24
|
+
};
|
|
25
|
+
import { singleton } from "tsyringe";
|
|
26
|
+
import { AssetsApiClient } from "./AssetsApiClient.js";
|
|
27
|
+
import { AESUtils } from "../utils/AESUtils.js";
|
|
28
|
+
import { HashUtils } from "../utils/HashUtils.js";
|
|
29
|
+
import { obfuscateId } from "../utils/ObfuscateUtil.js";
|
|
30
|
+
let AssetsTransferService = class AssetsTransferService {
|
|
31
|
+
assetsApiClient;
|
|
32
|
+
constructor(assetsApiClient) {
|
|
33
|
+
this.assetsApiClient = assetsApiClient;
|
|
34
|
+
}
|
|
35
|
+
MAX_DATA_SIZE = 100 * 1024 * 1024;
|
|
36
|
+
async downloadAsset(assetRemoteData) {
|
|
37
|
+
const encryptedAsset = await this.assetsApiClient.downloadAsset(assetRemoteData.assetId, assetRemoteData.assetDomain, assetRemoteData.assetToken);
|
|
38
|
+
const calculatedSha256 = HashUtils.calculateSha256Hash(encryptedAsset);
|
|
39
|
+
if (!HashUtils.isHashEqual(assetRemoteData.sha256, calculatedSha256)) {
|
|
40
|
+
// TODO: Map to WireException
|
|
41
|
+
throw new Error(`The sha256 doesn't match for asset with ID ${obfuscateId(assetRemoteData.assetId)}`);
|
|
42
|
+
}
|
|
43
|
+
return AESUtils.decryptData(encryptedAsset, assetRemoteData.otrKey);
|
|
44
|
+
}
|
|
45
|
+
async uploadAssetForSending(asset) {
|
|
46
|
+
const cryptoKeyInfo = AESUtils.generateRandomAES256Key();
|
|
47
|
+
const encryptedAsset = AESUtils.encryptData(asset, cryptoKeyInfo.keyMaterial);
|
|
48
|
+
const assetUploadData = {
|
|
49
|
+
retention: ETERNAL_INFREQUENT_ACCESS,
|
|
50
|
+
public: false
|
|
51
|
+
};
|
|
52
|
+
const assetUploadResponse = await this.uploadAsset(encryptedAsset, assetUploadData);
|
|
53
|
+
return {
|
|
54
|
+
otrKey: cryptoKeyInfo.keyMaterial,
|
|
55
|
+
encryptionAlgorithm: cryptoKeyInfo.algorithm,
|
|
56
|
+
sha256: HashUtils.calculateSha256Hash(encryptedAsset),
|
|
57
|
+
assetId: assetUploadResponse.key,
|
|
58
|
+
assetToken: assetUploadResponse.token ?? null,
|
|
59
|
+
assetDomain: assetUploadResponse.domain
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
async uploadAsset(asset, assetUploadData) {
|
|
63
|
+
if (asset.length > this.MAX_DATA_SIZE) {
|
|
64
|
+
// TODO: Map to WireException
|
|
65
|
+
throw new Error("AssetData size exceeds the maximum limit of 100MB");
|
|
66
|
+
}
|
|
67
|
+
return await this.assetsApiClient.uploadAsset(asset, assetUploadData);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
AssetsTransferService = __decorate([
|
|
71
|
+
singleton(),
|
|
72
|
+
__metadata("design:paramtypes", [AssetsApiClient])
|
|
73
|
+
], AssetsTransferService);
|
|
74
|
+
export { AssetsTransferService };
|
|
75
|
+
/**
|
|
76
|
+
* The asset is retained indefinitely, storage is optimized
|
|
77
|
+
* for infrequent access after 30 days of creation.
|
|
78
|
+
*/
|
|
79
|
+
const ETERNAL_INFREQUENT_ACCESS = "eternal-infrequent_access";
|
|
80
|
+
//# sourceMappingURL=AssetsTransferService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AssetsTransferService.js","sourceRoot":"","sources":["../../src/api/AssetsTransferService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAc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B;YACpC,MAAM,EAAE,KAAK;SACd,CAAA;QAED,MAAM,mBAAmB,GAAG,MAAM,IAAI,CAAC,WAAW,CAChD,cAAc,EACd,eAAe,CAChB,CAAA;QAED,OAAO;YACL,MAAM,EAAE,aAAa,CAAC,WAAW;YACjC,mBAAmB,EAAE,aAAa,CAAC,SAAS;YAC5C,MAAM,EAAE,SAAS,CAAC,mBAAmB,CAAC,cAAc,CAAC;YACrD,OAAO,EAAE,mBAAmB,CAAC,GAAG;YAChC,UAAU,EAAE,mBAAmB,CAAC,KAAK,IAAI,IAAI;YAC7C,WAAW,EAAE,mBAAmB,CAAC,MAAM;SACxC,CAAA;IACH,CAAC;IAEO,KAAK,CAAC,WAAW,CACvB,KAAgB,EAChB,eAAgC;QAEhC,IAAI,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;YACtC,6BAA6B;YAC7B,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAA;QACtE,CAAC;QAED,OAAO,MAAM,IAAI,CAAC,eAAe,CAAC,WAAW,CAC3C,KAAK,EACL,eAAe,CAChB,CAAA;IACH,CAAC;CACF,CAAA;AA7DY,qBAAqB;IADjC,SAAS,EAAE;qCAE2B,eAAe;GADzC,qBAAqB,CA6DjC;;AAED;;;GAGG;AACH,MAAM,yBAAyB,GAAG,2BAA2B,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { HttpClient } from "../core/HttpClient.js";
|
|
2
|
+
import type { MlsPublicKeys } from "../model/MlsPublicKeys.js";
|
|
3
|
+
import type { PreKeyCrypto } from "../model/PreKeyCrypto.js";
|
|
4
|
+
import { AppProperties } from "../service/AppProperties.js";
|
|
5
|
+
export declare class ClientsApiClient {
|
|
6
|
+
private httpClient;
|
|
7
|
+
private appProperties;
|
|
8
|
+
constructor(httpClient: HttpClient, appProperties: AppProperties);
|
|
9
|
+
private readonly basePath;
|
|
10
|
+
registerClient(proteusPreKeys: PreKeyCrypto[], proteusLastPreKey: PreKeyCrypto): Promise<string>;
|
|
11
|
+
updateClientWithMlsPublicKey(mlsPublicKeys: MlsPublicKeys): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=ClientsApiClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClientsApiClient.d.ts","sourceRoot":"","sources":["../../src/api/ClientsApiClient.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;AAGjD,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,2BAA2B,CAAC;AAG7D,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,0BAA0B,CAAC;AAE3D,OAAO,EAAC,aAAa,EAAC,MAAM,6BAA6B,CAAC;AAE1D,qBACa,gBAAgB;IAEzB,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,aAAa;gBADb,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,aAAa;IAGtC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAa;IAEhC,cAAc,CAClB,cAAc,EAAE,YAAY,EAAE,EAC9B,iBAAiB,EAAE,YAAY,GAC9B,OAAO,CAAC,MAAM,CAAC;IAqBZ,4BAA4B,CAAC,aAAa,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;CAWhF"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Wire
|
|
3
|
+
* Copyright (C) 2025 Wire Swiss GmbH
|
|
4
|
+
*
|
|
5
|
+
* This program is free software: you can redistribute it and/or modify
|
|
6
|
+
* it under the terms of the GNU General Public License as published by
|
|
7
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
+
* (at your option) any later version.
|
|
9
|
+
* This program is distributed in the hope that it will be useful,
|
|
10
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
* GNU General Public License for more details.
|
|
13
|
+
* You should have received a copy of the GNU General Public License
|
|
14
|
+
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
15
|
+
*/
|
|
16
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
17
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
18
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
19
|
+
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;
|
|
20
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
21
|
+
};
|
|
22
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
23
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
24
|
+
};
|
|
25
|
+
import { HttpClient } from "../core/HttpClient.js";
|
|
26
|
+
import { RegisterClientRequest } from "./request/RegisterClientRequest.js";
|
|
27
|
+
import { mapToPreKeyRequest } from "../mappers/PreKeyMapper.js";
|
|
28
|
+
import { singleton } from "tsyringe";
|
|
29
|
+
import { AppProperties } from "../service/AppProperties.js";
|
|
30
|
+
let ClientsApiClient = class ClientsApiClient {
|
|
31
|
+
httpClient;
|
|
32
|
+
appProperties;
|
|
33
|
+
constructor(httpClient, appProperties) {
|
|
34
|
+
this.httpClient = httpClient;
|
|
35
|
+
this.appProperties = appProperties;
|
|
36
|
+
}
|
|
37
|
+
basePath = "clients";
|
|
38
|
+
async registerClient(proteusPreKeys, proteusLastPreKey) {
|
|
39
|
+
const requestPayload = new RegisterClientRequest(mapToPreKeyRequest(proteusLastPreKey), proteusPreKeys.map((preKey) => mapToPreKeyRequest(preKey)));
|
|
40
|
+
const response = await this.httpClient.postRequest(this.basePath, requestPayload);
|
|
41
|
+
// Register client is performed with an access_token having limited scope.
|
|
42
|
+
// Clear the token to force a refresh with the full-scope token for next requests.
|
|
43
|
+
this.httpClient.clearAuthorizationToken();
|
|
44
|
+
return response.id;
|
|
45
|
+
}
|
|
46
|
+
async updateClientWithMlsPublicKey(mlsPublicKeys) {
|
|
47
|
+
const requestPayload = {
|
|
48
|
+
mls_public_keys: mlsPublicKeys,
|
|
49
|
+
};
|
|
50
|
+
await this.httpClient.putRequest(`${this.basePath}/${this.appProperties.getDeviceId()}`, requestPayload);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
ClientsApiClient = __decorate([
|
|
54
|
+
singleton(),
|
|
55
|
+
__metadata("design:paramtypes", [HttpClient,
|
|
56
|
+
AppProperties])
|
|
57
|
+
], ClientsApiClient);
|
|
58
|
+
export { ClientsApiClient };
|
|
59
|
+
//# sourceMappingURL=ClientsApiClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClientsApiClient.js","sourceRoot":"","sources":["../../src/api/ClientsApiClient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;AAEH,OAAO,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;AAEjD,OAAO,EAAC,qBAAqB,EAAC,MAAM,oCAAoC,CAAC;AAGzE,OAAO,EAAC,kBAAkB,EAAC,MAAM,4BAA4B,CAAC;AAE9D,OAAO,EAAC,SAAS,EAAC,MAAM,UAAU,CAAC;AACnC,OAAO,EAAC,aAAa,EAAC,MAAM,6BAA6B,CAAC;AAGnD,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAEjB;IACA;IAFV,YACU,UAAsB,EACtB,aAA4B;QAD5B,eAAU,GAAV,UAAU,CAAY;QACtB,kBAAa,GAAb,aAAa,CAAe;IAClC,CAAC;IAEY,QAAQ,GAAG,SAAS,CAAC;IAEtC,KAAK,CAAC,cAAc,CAClB,cAA8B,EAC9B,iBAA+B;QAG/B,MAAM,cAAc,GAAG,IAAI,qBAAqB,CAC9C,kBAAkB,CAAC,iBAAiB,CAAC,EACrC,cAAc,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAC5B,kBAAkB,CAAC,MAAM,CAAC,CAC3B,CACF,CAAA;QAED,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,WAAW,CAChD,IAAI,CAAC,QAAQ,EACb,cAAc,CACf,CAAA;QAED,0EAA0E;QAC1E,kFAAkF;QAClF,IAAI,CAAC,UAAU,CAAC,uBAAuB,EAAE,CAAA;QAEzC,OAAO,QAAQ,CAAC,EAAE,CAAA;IACpB,CAAC;IAED,KAAK,CAAC,4BAA4B,CAAC,aAA4B;QAC7D,MAAM,cAAc,GAAwB;YAC1C,eAAe,EAAE,aAAa;SAC/B,CAAA;QAED,MAAM,IAAI,CAAC,UAAU,CAAC,UAAU,CAC9B,GAAG,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,EAAE,EACtD,cAAc,CACf,CAAA;IACH,CAAC;CAEF,CAAA;AA3CY,gBAAgB;IAD5B,SAAS,EAAE;qCAGY,UAAU;QACP,aAAa;GAH3B,gBAAgB,CA2C5B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { MlsPublicKeys } from "../model/MlsPublicKeys.js";
|
|
2
|
+
import { ClientsApiClient } from "./ClientsApiClient.js";
|
|
3
|
+
import { PreKeyCrypto } from "../model/PreKeyCrypto.js";
|
|
4
|
+
export declare class ClientsService {
|
|
5
|
+
private clientsApiClient;
|
|
6
|
+
constructor(clientsApiClient: ClientsApiClient);
|
|
7
|
+
registerClient(proteusPreKeys: PreKeyCrypto[], proteusLastPreKey: PreKeyCrypto): Promise<string>;
|
|
8
|
+
updateClientWithMlsPublicKey(mlsPublicKeys: MlsPublicKeys): Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=ClientsService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClientsService.d.ts","sourceRoot":"","sources":["../../src/api/ClientsService.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAC,gBAAgB,EAAC,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAC,YAAY,EAAC,MAAM,0BAA0B,CAAC;AAGtD,qBACa,cAAc;IAEvB,OAAO,CAAC,gBAAgB;gBAAhB,gBAAgB,EAAE,gBAAgB;IAGtC,cAAc,CAClB,cAAc,EAAE,YAAY,EAAE,EAC9B,iBAAiB,EAAE,YAAY,GAC9B,OAAO,CAAC,MAAM,CAAC;IAIZ,4BAA4B,CAChC,aAAa,EAAE,aAAa,GAC3B,OAAO,CAAC,IAAI,CAAC;CAGjB"}
|