@matter/protocol 0.18.0 → 0.18.1-alpha.0-20261111-b84c5d1bc
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/dist/cjs/action/Val.d.ts +8 -0
- package/dist/cjs/action/Val.d.ts.map +1 -1
- package/dist/cjs/action/client/ClientInteraction.d.ts.map +1 -1
- package/dist/cjs/action/client/ClientInteraction.js +45 -32
- package/dist/cjs/action/client/ClientInteraction.js.map +1 -1
- package/dist/cjs/action/client/ClientRequest.d.ts +14 -0
- package/dist/cjs/action/client/ClientRequest.d.ts.map +1 -1
- package/dist/cjs/action/client/InputChunk.js +39 -2
- package/dist/cjs/action/client/InputChunk.js.map +1 -1
- package/dist/cjs/action/client/subscription/ClientSubscription.d.ts +2 -0
- package/dist/cjs/action/client/subscription/ClientSubscription.d.ts.map +1 -1
- package/dist/cjs/action/client/subscription/ClientSubscription.js +4 -0
- package/dist/cjs/action/client/subscription/ClientSubscription.js.map +1 -1
- package/dist/cjs/action/client/subscription/ClientSubscriptionHandler.d.ts.map +1 -1
- package/dist/cjs/action/client/subscription/ClientSubscriptionHandler.js +14 -0
- package/dist/cjs/action/client/subscription/ClientSubscriptionHandler.js.map +1 -1
- package/dist/cjs/action/client/subscription/PeerSubscription.d.ts +32 -0
- package/dist/cjs/action/client/subscription/PeerSubscription.d.ts.map +1 -1
- package/dist/cjs/action/client/subscription/PeerSubscription.js +61 -0
- package/dist/cjs/action/client/subscription/PeerSubscription.js.map +1 -1
- package/dist/cjs/action/errors.d.ts +3 -1
- package/dist/cjs/action/errors.d.ts.map +1 -1
- package/dist/cjs/action/errors.js +7 -2
- package/dist/cjs/action/errors.js.map +1 -1
- package/dist/cjs/action/protocols.d.ts +6 -1
- package/dist/cjs/action/protocols.d.ts.map +1 -1
- package/dist/cjs/action/request/Invoke.d.ts +24 -1
- package/dist/cjs/action/request/Invoke.d.ts.map +1 -1
- package/dist/cjs/action/request/Invoke.js +40 -12
- package/dist/cjs/action/request/Invoke.js.map +1 -1
- package/dist/cjs/action/request/Write.d.ts.map +1 -1
- package/dist/cjs/action/request/Write.js +6 -5
- package/dist/cjs/action/request/Write.js.map +1 -1
- package/dist/cjs/action/response/InvokeResult.d.ts +8 -2
- package/dist/cjs/action/response/InvokeResult.d.ts.map +1 -1
- package/dist/cjs/action/response/InvokeResult.js +28 -0
- package/dist/cjs/action/response/InvokeResult.js.map +2 -2
- package/dist/cjs/action/response/ReadResult.d.ts +14 -5
- package/dist/cjs/action/response/ReadResult.d.ts.map +1 -1
- package/dist/cjs/action/server/AttributeReadResponse.d.ts.map +1 -1
- package/dist/cjs/action/server/AttributeReadResponse.js +1 -1
- package/dist/cjs/action/server/AttributeReadResponse.js.map +1 -1
- package/dist/cjs/action/server/AttributeWriteResponse.d.ts.map +1 -1
- package/dist/cjs/action/server/AttributeWriteResponse.js +4 -2
- package/dist/cjs/action/server/AttributeWriteResponse.js.map +1 -1
- package/dist/cjs/action/server/EventReadResponse.d.ts.map +1 -1
- package/dist/cjs/action/server/EventReadResponse.js +1 -0
- package/dist/cjs/action/server/EventReadResponse.js.map +1 -1
- package/dist/cjs/advertisement/mdns/MdnsAdvertisement.d.ts +1 -1
- package/dist/cjs/advertisement/mdns/MdnsAdvertisement.d.ts.map +1 -1
- package/dist/cjs/advertisement/mdns/MdnsAdvertisement.js +7 -7
- package/dist/cjs/advertisement/mdns/MdnsAdvertisement.js.map +1 -1
- package/dist/cjs/ble/Ble.d.ts +2 -0
- package/dist/cjs/ble/Ble.d.ts.map +1 -1
- package/dist/cjs/ble/Ble.js +4 -0
- package/dist/cjs/ble/Ble.js.map +1 -1
- package/dist/cjs/certificate/CdSigners.d.ts +52 -0
- package/dist/cjs/certificate/CdSigners.d.ts.map +1 -0
- package/dist/cjs/certificate/CdSigners.js +111 -0
- package/dist/cjs/certificate/CdSigners.js.map +6 -0
- package/dist/cjs/certificate/CertificateAuthority.d.ts +1 -1
- package/dist/cjs/certificate/CertificateAuthority.d.ts.map +1 -1
- package/dist/cjs/certificate/DeviceAttestationValidator.d.ts +59 -7
- package/dist/cjs/certificate/DeviceAttestationValidator.d.ts.map +1 -1
- package/dist/cjs/certificate/DeviceAttestationValidator.js +122 -42
- package/dist/cjs/certificate/DeviceAttestationValidator.js.map +1 -1
- package/dist/cjs/certificate/DeviceCertification.d.ts.map +1 -1
- package/dist/cjs/certificate/DeviceCertification.js +5 -2
- package/dist/cjs/certificate/DeviceCertification.js.map +1 -1
- package/dist/cjs/certificate/NocsrValidator.d.ts +57 -0
- package/dist/cjs/certificate/NocsrValidator.d.ts.map +1 -0
- package/dist/cjs/certificate/NocsrValidator.js +109 -0
- package/dist/cjs/certificate/NocsrValidator.js.map +6 -0
- package/dist/cjs/certificate/PeerData.d.ts +12 -0
- package/dist/cjs/certificate/PeerData.d.ts.map +1 -0
- package/dist/cjs/certificate/PeerData.js +33 -0
- package/dist/cjs/certificate/PeerData.js.map +6 -0
- package/dist/cjs/certificate/index.d.ts +2 -0
- package/dist/cjs/certificate/index.d.ts.map +1 -1
- package/dist/cjs/certificate/index.js +2 -0
- package/dist/cjs/certificate/index.js.map +1 -1
- package/dist/cjs/certificate/kinds/AttestationCertificates.d.ts +42 -6
- package/dist/cjs/certificate/kinds/AttestationCertificates.d.ts.map +1 -1
- package/dist/cjs/certificate/kinds/AttestationCertificates.js +110 -13
- package/dist/cjs/certificate/kinds/AttestationCertificates.js.map +1 -1
- package/dist/cjs/certificate/kinds/Certificate.d.ts +13 -7
- package/dist/cjs/certificate/kinds/Certificate.d.ts.map +1 -1
- package/dist/cjs/certificate/kinds/Certificate.js +146 -240
- package/dist/cjs/certificate/kinds/Certificate.js.map +2 -2
- package/dist/cjs/certificate/kinds/CertificationDeclaration.d.ts +21 -3
- package/dist/cjs/certificate/kinds/CertificationDeclaration.d.ts.map +1 -1
- package/dist/cjs/certificate/kinds/CertificationDeclaration.js +76 -20
- package/dist/cjs/certificate/kinds/CertificationDeclaration.js.map +1 -1
- package/dist/cjs/certificate/kinds/DistinguishedName.d.ts +190 -0
- package/dist/cjs/certificate/kinds/DistinguishedName.d.ts.map +1 -0
- package/dist/cjs/certificate/kinds/DistinguishedName.js +417 -0
- package/dist/cjs/certificate/kinds/DistinguishedName.js.map +6 -0
- package/dist/cjs/certificate/kinds/Icac.d.ts.map +1 -1
- package/dist/cjs/certificate/kinds/Icac.js +5 -10
- package/dist/cjs/certificate/kinds/Icac.js.map +1 -1
- package/dist/cjs/certificate/kinds/Noc.d.ts.map +1 -1
- package/dist/cjs/certificate/kinds/Noc.js +5 -4
- package/dist/cjs/certificate/kinds/Noc.js.map +1 -1
- package/dist/cjs/certificate/kinds/OperationalBase.d.ts.map +1 -1
- package/dist/cjs/certificate/kinds/OperationalBase.js +4 -2
- package/dist/cjs/certificate/kinds/OperationalBase.js.map +1 -1
- package/dist/cjs/certificate/kinds/Rcac.d.ts.map +1 -1
- package/dist/cjs/certificate/kinds/Rcac.js +5 -10
- package/dist/cjs/certificate/kinds/Rcac.js.map +1 -1
- package/dist/cjs/certificate/kinds/Vvsc.d.ts +3 -3
- package/dist/cjs/certificate/kinds/Vvsc.d.ts.map +1 -1
- package/dist/cjs/certificate/kinds/Vvsc.js +19 -14
- package/dist/cjs/certificate/kinds/Vvsc.js.map +1 -1
- package/dist/cjs/certificate/kinds/definitions/asn.d.ts +1 -1
- package/dist/cjs/certificate/kinds/definitions/asn.d.ts.map +1 -1
- package/dist/cjs/certificate/kinds/definitions/asn.js.map +1 -1
- package/dist/cjs/certificate/kinds/definitions/attestation.d.ts +15 -15
- package/dist/cjs/certificate/kinds/definitions/attestation.d.ts.map +1 -1
- package/dist/cjs/certificate/kinds/definitions/base.d.ts +33 -0
- package/dist/cjs/certificate/kinds/definitions/base.d.ts.map +1 -1
- package/dist/cjs/certificate/kinds/definitions/base.js +8 -1
- package/dist/cjs/certificate/kinds/definitions/base.js.map +1 -1
- package/dist/cjs/certificate/kinds/definitions/operational.d.ts +24 -20
- package/dist/cjs/certificate/kinds/definitions/operational.d.ts.map +1 -1
- package/dist/cjs/certificate/kinds/definitions/operational.js +5 -3
- package/dist/cjs/certificate/kinds/definitions/operational.js.map +1 -1
- package/dist/cjs/codec/MessageCodec.d.ts +27 -2
- package/dist/cjs/codec/MessageCodec.d.ts.map +1 -1
- package/dist/cjs/codec/MessageCodec.js +81 -74
- package/dist/cjs/codec/MessageCodec.js.map +1 -1
- package/dist/cjs/common/OperationalCredentialsTypes.d.ts +6 -0
- package/dist/cjs/common/OperationalCredentialsTypes.d.ts.map +1 -1
- package/dist/cjs/common/OperationalCredentialsTypes.js +2 -0
- package/dist/cjs/common/OperationalCredentialsTypes.js.map +1 -1
- package/dist/cjs/dcl/DclCertificateService.d.ts +28 -7
- package/dist/cjs/dcl/DclCertificateService.d.ts.map +1 -1
- package/dist/cjs/dcl/DclCertificateService.js +103 -30
- package/dist/cjs/dcl/DclCertificateService.js.map +1 -1
- package/dist/cjs/fabric/Fabric.d.ts +10 -5
- package/dist/cjs/fabric/Fabric.d.ts.map +1 -1
- package/dist/cjs/fabric/Fabric.js +12 -5
- package/dist/cjs/fabric/Fabric.js.map +1 -1
- package/dist/cjs/fabric/FabricManager.d.ts +2 -2
- package/dist/cjs/fabric/FabricManager.js +2 -2
- package/dist/cjs/groups/FabricGroups.d.ts +2 -0
- package/dist/cjs/groups/FabricGroups.d.ts.map +1 -1
- package/dist/cjs/groups/FabricGroups.js +4 -0
- package/dist/cjs/groups/FabricGroups.js.map +1 -1
- package/dist/cjs/groups/Groups.d.ts +7 -0
- package/dist/cjs/groups/Groups.d.ts.map +1 -1
- package/dist/cjs/groups/Groups.js +11 -2
- package/dist/cjs/groups/Groups.js.map +1 -1
- package/dist/cjs/groups/KeySets.d.ts +3 -3
- package/dist/cjs/groups/KeySets.js +3 -3
- package/dist/cjs/interaction/InteractionMessenger.d.ts +18 -1
- package/dist/cjs/interaction/InteractionMessenger.d.ts.map +1 -1
- package/dist/cjs/interaction/InteractionMessenger.js +49 -19
- package/dist/cjs/interaction/InteractionMessenger.js.map +1 -1
- package/dist/cjs/mdns/InterfaceResponder.d.ts +137 -0
- package/dist/cjs/mdns/InterfaceResponder.d.ts.map +1 -0
- package/dist/cjs/mdns/InterfaceResponder.js +799 -0
- package/dist/cjs/mdns/InterfaceResponder.js.map +6 -0
- package/dist/cjs/mdns/MdnsServer.d.ts +82 -9
- package/dist/cjs/mdns/MdnsServer.d.ts.map +1 -1
- package/dist/cjs/mdns/MdnsServer.js +337 -267
- package/dist/cjs/mdns/MdnsServer.js.map +2 -2
- package/dist/cjs/mdns/MdnsService.d.ts.map +1 -1
- package/dist/cjs/mdns/MdnsService.js +3 -1
- package/dist/cjs/mdns/MdnsService.js.map +1 -1
- package/dist/cjs/peer/AdministratorCommands.d.ts +26 -0
- package/dist/cjs/peer/AdministratorCommands.d.ts.map +1 -0
- package/dist/cjs/peer/AdministratorCommands.js +40 -0
- package/dist/cjs/peer/AdministratorCommands.js.map +6 -0
- package/dist/cjs/peer/CommissioningConnection.d.ts.map +1 -1
- package/dist/cjs/peer/CommissioningConnection.js +4 -2
- package/dist/cjs/peer/CommissioningConnection.js.map +1 -1
- package/dist/cjs/peer/ControllerCommissioner.d.ts +9 -0
- package/dist/cjs/peer/ControllerCommissioner.d.ts.map +1 -1
- package/dist/cjs/peer/ControllerCommissioner.js +59 -13
- package/dist/cjs/peer/ControllerCommissioner.js.map +1 -1
- package/dist/cjs/peer/ControllerCommissioningFlow.d.ts +7 -7
- package/dist/cjs/peer/ControllerCommissioningFlow.d.ts.map +1 -1
- package/dist/cjs/peer/ControllerCommissioningFlow.js +124 -67
- package/dist/cjs/peer/ControllerCommissioningFlow.js.map +1 -1
- package/dist/cjs/peer/OperationalCertificateUpdate.d.ts +181 -0
- package/dist/cjs/peer/OperationalCertificateUpdate.d.ts.map +1 -0
- package/dist/cjs/peer/OperationalCertificateUpdate.js +553 -0
- package/dist/cjs/peer/OperationalCertificateUpdate.js.map +6 -0
- package/dist/cjs/peer/Peer.d.ts +5 -0
- package/dist/cjs/peer/Peer.d.ts.map +1 -1
- package/dist/cjs/peer/Peer.js +29 -1
- package/dist/cjs/peer/Peer.js.map +1 -1
- package/dist/cjs/peer/PeerAddressStore.d.ts +37 -0
- package/dist/cjs/peer/PeerAddressStore.d.ts.map +1 -0
- package/dist/cjs/peer/PeerAddressStore.js +114 -0
- package/dist/cjs/peer/PeerAddressStore.js.map +6 -0
- package/dist/cjs/peer/PeerConnection.d.ts.map +1 -1
- package/dist/cjs/peer/PeerConnection.js +0 -1
- package/dist/cjs/peer/PeerConnection.js.map +1 -1
- package/dist/cjs/peer/PeerDescriptor.d.ts +3 -4
- package/dist/cjs/peer/PeerDescriptor.d.ts.map +1 -1
- package/dist/cjs/peer/PeerDescriptor.js.map +1 -1
- package/dist/cjs/peer/PeerExchangeProvider.d.ts.map +1 -1
- package/dist/cjs/peer/PeerExchangeProvider.js +2 -1
- package/dist/cjs/peer/PeerExchangeProvider.js.map +1 -1
- package/dist/cjs/peer/PeerLossContext.d.ts +10 -2
- package/dist/cjs/peer/PeerLossContext.d.ts.map +1 -1
- package/dist/cjs/peer/PhysicalDeviceProperties.d.ts +13 -0
- package/dist/cjs/peer/PhysicalDeviceProperties.d.ts.map +1 -1
- package/dist/cjs/peer/PhysicalDeviceProperties.js +3 -2
- package/dist/cjs/peer/PhysicalDeviceProperties.js.map +1 -1
- package/dist/cjs/peer/RebootResubscribeArmer.d.ts +3 -3
- package/dist/cjs/peer/RebootResubscribeArmer.d.ts.map +1 -1
- package/dist/cjs/peer/RebootResubscribeArmer.js +21 -9
- package/dist/cjs/peer/RebootResubscribeArmer.js.map +1 -1
- package/dist/cjs/peer/index.d.ts +2 -0
- package/dist/cjs/peer/index.d.ts.map +1 -1
- package/dist/cjs/peer/index.js +2 -0
- package/dist/cjs/peer/index.js.map +1 -1
- package/dist/cjs/protocol/DeviceAdvertiser.d.ts.map +1 -1
- package/dist/cjs/protocol/DeviceAdvertiser.js +1 -1
- package/dist/cjs/protocol/DeviceAdvertiser.js.map +1 -1
- package/dist/cjs/protocol/ExchangeManager.d.ts +0 -1
- package/dist/cjs/protocol/ExchangeManager.d.ts.map +1 -1
- package/dist/cjs/protocol/ExchangeManager.js +136 -64
- package/dist/cjs/protocol/ExchangeManager.js.map +1 -1
- package/dist/cjs/protocol/ExchangeProvider.d.ts +3 -2
- package/dist/cjs/protocol/ExchangeProvider.d.ts.map +1 -1
- package/dist/cjs/protocol/ExchangeProvider.js.map +1 -1
- package/dist/cjs/protocol/MessageExchange.d.ts +13 -0
- package/dist/cjs/protocol/MessageExchange.d.ts.map +1 -1
- package/dist/cjs/protocol/MessageExchange.js +23 -7
- package/dist/cjs/protocol/MessageExchange.js.map +1 -1
- package/dist/cjs/protocol/MessageReceptionState.d.ts +1 -1
- package/dist/cjs/protocol/errors.d.ts +7 -1
- package/dist/cjs/protocol/errors.d.ts.map +1 -1
- package/dist/cjs/protocol/errors.js +3 -0
- package/dist/cjs/protocol/errors.js.map +1 -1
- package/dist/cjs/securechannel/SecureChannelMessenger.d.ts +6 -1
- package/dist/cjs/securechannel/SecureChannelMessenger.d.ts.map +1 -1
- package/dist/cjs/securechannel/SecureChannelMessenger.js +27 -12
- package/dist/cjs/securechannel/SecureChannelMessenger.js.map +1 -1
- package/dist/cjs/session/GroupSession.d.ts +58 -15
- package/dist/cjs/session/GroupSession.d.ts.map +1 -1
- package/dist/cjs/session/GroupSession.js +97 -102
- package/dist/cjs/session/GroupSession.js.map +2 -2
- package/dist/cjs/session/NodeSession.d.ts +50 -1
- package/dist/cjs/session/NodeSession.d.ts.map +1 -1
- package/dist/cjs/session/NodeSession.js +80 -4
- package/dist/cjs/session/NodeSession.js.map +1 -1
- package/dist/cjs/session/SecureSession.d.ts +9 -0
- package/dist/cjs/session/SecureSession.d.ts.map +1 -1
- package/dist/cjs/session/SecureSession.js +12 -0
- package/dist/cjs/session/SecureSession.js.map +1 -1
- package/dist/cjs/session/Session.d.ts +2 -2
- package/dist/cjs/session/Session.d.ts.map +1 -1
- package/dist/cjs/session/Session.js +1 -1
- package/dist/cjs/session/SessionManager.d.ts +76 -28
- package/dist/cjs/session/SessionManager.d.ts.map +1 -1
- package/dist/cjs/session/SessionManager.js +316 -153
- package/dist/cjs/session/SessionManager.js.map +2 -2
- package/dist/cjs/session/UnsecuredSession.d.ts +0 -1
- package/dist/cjs/session/UnsecuredSession.d.ts.map +1 -1
- package/dist/cjs/session/UnsecuredSession.js +2 -4
- package/dist/cjs/session/UnsecuredSession.js.map +1 -1
- package/dist/cjs/session/case/CaseClient.d.ts +5 -0
- package/dist/cjs/session/case/CaseClient.d.ts.map +1 -1
- package/dist/cjs/session/case/CaseClient.js +12 -11
- package/dist/cjs/session/case/CaseClient.js.map +2 -2
- package/dist/cjs/session/case/CaseServer.d.ts.map +1 -1
- package/dist/cjs/session/case/CaseServer.js +31 -11
- package/dist/cjs/session/case/CaseServer.js.map +1 -1
- package/dist/esm/action/Val.d.ts +8 -0
- package/dist/esm/action/Val.d.ts.map +1 -1
- package/dist/esm/action/client/ClientInteraction.d.ts.map +1 -1
- package/dist/esm/action/client/ClientInteraction.js +45 -32
- package/dist/esm/action/client/ClientInteraction.js.map +1 -1
- package/dist/esm/action/client/ClientRequest.d.ts +14 -0
- package/dist/esm/action/client/ClientRequest.d.ts.map +1 -1
- package/dist/esm/action/client/InputChunk.js +39 -2
- package/dist/esm/action/client/InputChunk.js.map +1 -1
- package/dist/esm/action/client/subscription/ClientSubscription.d.ts +2 -0
- package/dist/esm/action/client/subscription/ClientSubscription.d.ts.map +1 -1
- package/dist/esm/action/client/subscription/ClientSubscription.js +4 -0
- package/dist/esm/action/client/subscription/ClientSubscription.js.map +1 -1
- package/dist/esm/action/client/subscription/ClientSubscriptionHandler.d.ts.map +1 -1
- package/dist/esm/action/client/subscription/ClientSubscriptionHandler.js +14 -0
- package/dist/esm/action/client/subscription/ClientSubscriptionHandler.js.map +1 -1
- package/dist/esm/action/client/subscription/PeerSubscription.d.ts +32 -0
- package/dist/esm/action/client/subscription/PeerSubscription.d.ts.map +1 -1
- package/dist/esm/action/client/subscription/PeerSubscription.js +61 -0
- package/dist/esm/action/client/subscription/PeerSubscription.js.map +1 -1
- package/dist/esm/action/errors.d.ts +3 -1
- package/dist/esm/action/errors.d.ts.map +1 -1
- package/dist/esm/action/errors.js +7 -2
- package/dist/esm/action/errors.js.map +1 -1
- package/dist/esm/action/protocols.d.ts +6 -1
- package/dist/esm/action/protocols.d.ts.map +1 -1
- package/dist/esm/action/request/Invoke.d.ts +24 -1
- package/dist/esm/action/request/Invoke.d.ts.map +1 -1
- package/dist/esm/action/request/Invoke.js +41 -13
- package/dist/esm/action/request/Invoke.js.map +1 -1
- package/dist/esm/action/request/Write.d.ts.map +1 -1
- package/dist/esm/action/request/Write.js +7 -6
- package/dist/esm/action/request/Write.js.map +1 -1
- package/dist/esm/action/response/InvokeResult.d.ts +8 -2
- package/dist/esm/action/response/InvokeResult.d.ts.map +1 -1
- package/dist/esm/action/response/InvokeResult.js +26 -0
- package/dist/esm/action/response/InvokeResult.js.map +2 -2
- package/dist/esm/action/response/ReadResult.d.ts +14 -5
- package/dist/esm/action/response/ReadResult.d.ts.map +1 -1
- package/dist/esm/action/server/AttributeReadResponse.d.ts.map +1 -1
- package/dist/esm/action/server/AttributeReadResponse.js +2 -2
- package/dist/esm/action/server/AttributeReadResponse.js.map +1 -1
- package/dist/esm/action/server/AttributeWriteResponse.d.ts.map +1 -1
- package/dist/esm/action/server/AttributeWriteResponse.js +11 -3
- package/dist/esm/action/server/AttributeWriteResponse.js.map +1 -1
- package/dist/esm/action/server/EventReadResponse.d.ts.map +1 -1
- package/dist/esm/action/server/EventReadResponse.js +1 -0
- package/dist/esm/action/server/EventReadResponse.js.map +1 -1
- package/dist/esm/advertisement/mdns/MdnsAdvertisement.d.ts +1 -1
- package/dist/esm/advertisement/mdns/MdnsAdvertisement.d.ts.map +1 -1
- package/dist/esm/advertisement/mdns/MdnsAdvertisement.js +7 -7
- package/dist/esm/advertisement/mdns/MdnsAdvertisement.js.map +1 -1
- package/dist/esm/ble/Ble.d.ts +2 -0
- package/dist/esm/ble/Ble.d.ts.map +1 -1
- package/dist/esm/ble/Ble.js +4 -0
- package/dist/esm/ble/Ble.js.map +1 -1
- package/dist/esm/certificate/CdSigners.d.ts +52 -0
- package/dist/esm/certificate/CdSigners.d.ts.map +1 -0
- package/dist/esm/certificate/CdSigners.js +91 -0
- package/dist/esm/certificate/CdSigners.js.map +6 -0
- package/dist/esm/certificate/CertificateAuthority.d.ts +1 -1
- package/dist/esm/certificate/CertificateAuthority.d.ts.map +1 -1
- package/dist/esm/certificate/DeviceAttestationValidator.d.ts +59 -7
- package/dist/esm/certificate/DeviceAttestationValidator.d.ts.map +1 -1
- package/dist/esm/certificate/DeviceAttestationValidator.js +124 -45
- package/dist/esm/certificate/DeviceAttestationValidator.js.map +1 -1
- package/dist/esm/certificate/DeviceCertification.d.ts.map +1 -1
- package/dist/esm/certificate/DeviceCertification.js +5 -2
- package/dist/esm/certificate/DeviceCertification.js.map +1 -1
- package/dist/esm/certificate/NocsrValidator.d.ts +57 -0
- package/dist/esm/certificate/NocsrValidator.d.ts.map +1 -0
- package/dist/esm/certificate/NocsrValidator.js +89 -0
- package/dist/esm/certificate/NocsrValidator.js.map +6 -0
- package/dist/esm/certificate/PeerData.d.ts +12 -0
- package/dist/esm/certificate/PeerData.d.ts.map +1 -0
- package/dist/esm/certificate/PeerData.js +13 -0
- package/dist/esm/certificate/PeerData.js.map +6 -0
- package/dist/esm/certificate/index.d.ts +2 -0
- package/dist/esm/certificate/index.d.ts.map +1 -1
- package/dist/esm/certificate/index.js +2 -0
- package/dist/esm/certificate/index.js.map +1 -1
- package/dist/esm/certificate/kinds/AttestationCertificates.d.ts +42 -6
- package/dist/esm/certificate/kinds/AttestationCertificates.d.ts.map +1 -1
- package/dist/esm/certificate/kinds/AttestationCertificates.js +112 -15
- package/dist/esm/certificate/kinds/AttestationCertificates.js.map +1 -1
- package/dist/esm/certificate/kinds/Certificate.d.ts +13 -7
- package/dist/esm/certificate/kinds/Certificate.d.ts.map +1 -1
- package/dist/esm/certificate/kinds/Certificate.js +153 -256
- package/dist/esm/certificate/kinds/Certificate.js.map +2 -2
- package/dist/esm/certificate/kinds/CertificationDeclaration.d.ts +21 -3
- package/dist/esm/certificate/kinds/CertificationDeclaration.d.ts.map +1 -1
- package/dist/esm/certificate/kinds/CertificationDeclaration.js +79 -20
- package/dist/esm/certificate/kinds/CertificationDeclaration.js.map +1 -1
- package/dist/esm/certificate/kinds/DistinguishedName.d.ts +190 -0
- package/dist/esm/certificate/kinds/DistinguishedName.d.ts.map +1 -0
- package/dist/esm/certificate/kinds/DistinguishedName.js +422 -0
- package/dist/esm/certificate/kinds/DistinguishedName.js.map +6 -0
- package/dist/esm/certificate/kinds/Icac.d.ts.map +1 -1
- package/dist/esm/certificate/kinds/Icac.js +6 -11
- package/dist/esm/certificate/kinds/Icac.js.map +1 -1
- package/dist/esm/certificate/kinds/Noc.d.ts.map +1 -1
- package/dist/esm/certificate/kinds/Noc.js +5 -4
- package/dist/esm/certificate/kinds/Noc.js.map +1 -1
- package/dist/esm/certificate/kinds/OperationalBase.d.ts.map +1 -1
- package/dist/esm/certificate/kinds/OperationalBase.js +4 -2
- package/dist/esm/certificate/kinds/OperationalBase.js.map +1 -1
- package/dist/esm/certificate/kinds/Rcac.d.ts.map +1 -1
- package/dist/esm/certificate/kinds/Rcac.js +6 -11
- package/dist/esm/certificate/kinds/Rcac.js.map +1 -1
- package/dist/esm/certificate/kinds/Vvsc.d.ts +3 -3
- package/dist/esm/certificate/kinds/Vvsc.d.ts.map +1 -1
- package/dist/esm/certificate/kinds/Vvsc.js +20 -15
- package/dist/esm/certificate/kinds/Vvsc.js.map +1 -1
- package/dist/esm/certificate/kinds/definitions/asn.d.ts +1 -1
- package/dist/esm/certificate/kinds/definitions/asn.d.ts.map +1 -1
- package/dist/esm/certificate/kinds/definitions/asn.js.map +1 -1
- package/dist/esm/certificate/kinds/definitions/attestation.d.ts +15 -15
- package/dist/esm/certificate/kinds/definitions/attestation.d.ts.map +1 -1
- package/dist/esm/certificate/kinds/definitions/base.d.ts +33 -0
- package/dist/esm/certificate/kinds/definitions/base.d.ts.map +1 -1
- package/dist/esm/certificate/kinds/definitions/base.js +9 -2
- package/dist/esm/certificate/kinds/definitions/base.js.map +1 -1
- package/dist/esm/certificate/kinds/definitions/operational.d.ts +24 -20
- package/dist/esm/certificate/kinds/definitions/operational.d.ts.map +1 -1
- package/dist/esm/certificate/kinds/definitions/operational.js +5 -3
- package/dist/esm/certificate/kinds/definitions/operational.js.map +1 -1
- package/dist/esm/codec/MessageCodec.d.ts +27 -2
- package/dist/esm/codec/MessageCodec.d.ts.map +1 -1
- package/dist/esm/codec/MessageCodec.js +82 -75
- package/dist/esm/codec/MessageCodec.js.map +1 -1
- package/dist/esm/common/OperationalCredentialsTypes.d.ts +6 -0
- package/dist/esm/common/OperationalCredentialsTypes.d.ts.map +1 -1
- package/dist/esm/common/OperationalCredentialsTypes.js +2 -0
- package/dist/esm/common/OperationalCredentialsTypes.js.map +1 -1
- package/dist/esm/dcl/DclCertificateService.d.ts +28 -7
- package/dist/esm/dcl/DclCertificateService.d.ts.map +1 -1
- package/dist/esm/dcl/DclCertificateService.js +108 -31
- package/dist/esm/dcl/DclCertificateService.js.map +1 -1
- package/dist/esm/fabric/Fabric.d.ts +10 -5
- package/dist/esm/fabric/Fabric.d.ts.map +1 -1
- package/dist/esm/fabric/Fabric.js +12 -5
- package/dist/esm/fabric/Fabric.js.map +1 -1
- package/dist/esm/fabric/FabricManager.d.ts +2 -2
- package/dist/esm/fabric/FabricManager.js +2 -2
- package/dist/esm/groups/FabricGroups.d.ts +2 -0
- package/dist/esm/groups/FabricGroups.d.ts.map +1 -1
- package/dist/esm/groups/FabricGroups.js +4 -0
- package/dist/esm/groups/FabricGroups.js.map +1 -1
- package/dist/esm/groups/Groups.d.ts +7 -0
- package/dist/esm/groups/Groups.d.ts.map +1 -1
- package/dist/esm/groups/Groups.js +11 -2
- package/dist/esm/groups/Groups.js.map +1 -1
- package/dist/esm/groups/KeySets.d.ts +3 -3
- package/dist/esm/groups/KeySets.js +3 -3
- package/dist/esm/interaction/InteractionMessenger.d.ts +18 -1
- package/dist/esm/interaction/InteractionMessenger.d.ts.map +1 -1
- package/dist/esm/interaction/InteractionMessenger.js +50 -20
- package/dist/esm/interaction/InteractionMessenger.js.map +1 -1
- package/dist/esm/mdns/InterfaceResponder.d.ts +137 -0
- package/dist/esm/mdns/InterfaceResponder.d.ts.map +1 -0
- package/dist/esm/mdns/InterfaceResponder.js +794 -0
- package/dist/esm/mdns/InterfaceResponder.js.map +6 -0
- package/dist/esm/mdns/MdnsServer.d.ts +82 -9
- package/dist/esm/mdns/MdnsServer.d.ts.map +1 -1
- package/dist/esm/mdns/MdnsServer.js +341 -273
- package/dist/esm/mdns/MdnsServer.js.map +2 -2
- package/dist/esm/mdns/MdnsService.d.ts.map +1 -1
- package/dist/esm/mdns/MdnsService.js +3 -1
- package/dist/esm/mdns/MdnsService.js.map +1 -1
- package/dist/esm/peer/AdministratorCommands.d.ts +26 -0
- package/dist/esm/peer/AdministratorCommands.d.ts.map +1 -0
- package/dist/esm/peer/AdministratorCommands.js +20 -0
- package/dist/esm/peer/AdministratorCommands.js.map +6 -0
- package/dist/esm/peer/CommissioningConnection.d.ts.map +1 -1
- package/dist/esm/peer/CommissioningConnection.js +4 -2
- package/dist/esm/peer/CommissioningConnection.js.map +1 -1
- package/dist/esm/peer/ControllerCommissioner.d.ts +9 -0
- package/dist/esm/peer/ControllerCommissioner.d.ts.map +1 -1
- package/dist/esm/peer/ControllerCommissioner.js +59 -13
- package/dist/esm/peer/ControllerCommissioner.js.map +1 -1
- package/dist/esm/peer/ControllerCommissioningFlow.d.ts +7 -7
- package/dist/esm/peer/ControllerCommissioningFlow.d.ts.map +1 -1
- package/dist/esm/peer/ControllerCommissioningFlow.js +125 -70
- package/dist/esm/peer/ControllerCommissioningFlow.js.map +1 -1
- package/dist/esm/peer/OperationalCertificateUpdate.d.ts +181 -0
- package/dist/esm/peer/OperationalCertificateUpdate.d.ts.map +1 -0
- package/dist/esm/peer/OperationalCertificateUpdate.js +553 -0
- package/dist/esm/peer/OperationalCertificateUpdate.js.map +6 -0
- package/dist/esm/peer/Peer.d.ts +5 -0
- package/dist/esm/peer/Peer.d.ts.map +1 -1
- package/dist/esm/peer/Peer.js +29 -1
- package/dist/esm/peer/Peer.js.map +1 -1
- package/dist/esm/peer/PeerAddressStore.d.ts +37 -0
- package/dist/esm/peer/PeerAddressStore.d.ts.map +1 -0
- package/dist/esm/peer/PeerAddressStore.js +94 -0
- package/dist/esm/peer/PeerAddressStore.js.map +6 -0
- package/dist/esm/peer/PeerConnection.d.ts.map +1 -1
- package/dist/esm/peer/PeerConnection.js +0 -1
- package/dist/esm/peer/PeerConnection.js.map +1 -1
- package/dist/esm/peer/PeerDescriptor.d.ts +3 -4
- package/dist/esm/peer/PeerDescriptor.d.ts.map +1 -1
- package/dist/esm/peer/PeerDescriptor.js.map +1 -1
- package/dist/esm/peer/PeerExchangeProvider.d.ts.map +1 -1
- package/dist/esm/peer/PeerExchangeProvider.js +3 -2
- package/dist/esm/peer/PeerExchangeProvider.js.map +1 -1
- package/dist/esm/peer/PeerLossContext.d.ts +10 -2
- package/dist/esm/peer/PeerLossContext.d.ts.map +1 -1
- package/dist/esm/peer/PhysicalDeviceProperties.d.ts +13 -0
- package/dist/esm/peer/PhysicalDeviceProperties.d.ts.map +1 -1
- package/dist/esm/peer/PhysicalDeviceProperties.js +3 -2
- package/dist/esm/peer/PhysicalDeviceProperties.js.map +1 -1
- package/dist/esm/peer/RebootResubscribeArmer.d.ts +3 -3
- package/dist/esm/peer/RebootResubscribeArmer.d.ts.map +1 -1
- package/dist/esm/peer/RebootResubscribeArmer.js +21 -9
- package/dist/esm/peer/RebootResubscribeArmer.js.map +1 -1
- package/dist/esm/peer/index.d.ts +2 -0
- package/dist/esm/peer/index.d.ts.map +1 -1
- package/dist/esm/peer/index.js +2 -0
- package/dist/esm/peer/index.js.map +1 -1
- package/dist/esm/protocol/DeviceAdvertiser.d.ts.map +1 -1
- package/dist/esm/protocol/DeviceAdvertiser.js +1 -1
- package/dist/esm/protocol/DeviceAdvertiser.js.map +1 -1
- package/dist/esm/protocol/ExchangeManager.d.ts +0 -1
- package/dist/esm/protocol/ExchangeManager.d.ts.map +1 -1
- package/dist/esm/protocol/ExchangeManager.js +145 -67
- package/dist/esm/protocol/ExchangeManager.js.map +1 -1
- package/dist/esm/protocol/ExchangeProvider.d.ts +3 -2
- package/dist/esm/protocol/ExchangeProvider.d.ts.map +1 -1
- package/dist/esm/protocol/ExchangeProvider.js.map +1 -1
- package/dist/esm/protocol/MessageExchange.d.ts +13 -0
- package/dist/esm/protocol/MessageExchange.d.ts.map +1 -1
- package/dist/esm/protocol/MessageExchange.js +23 -7
- package/dist/esm/protocol/MessageExchange.js.map +1 -1
- package/dist/esm/protocol/MessageReceptionState.d.ts +1 -1
- package/dist/esm/protocol/errors.d.ts +7 -1
- package/dist/esm/protocol/errors.d.ts.map +1 -1
- package/dist/esm/protocol/errors.js +4 -1
- package/dist/esm/protocol/errors.js.map +1 -1
- package/dist/esm/securechannel/SecureChannelMessenger.d.ts +6 -1
- package/dist/esm/securechannel/SecureChannelMessenger.d.ts.map +1 -1
- package/dist/esm/securechannel/SecureChannelMessenger.js +27 -12
- package/dist/esm/securechannel/SecureChannelMessenger.js.map +1 -1
- package/dist/esm/session/GroupSession.d.ts +58 -15
- package/dist/esm/session/GroupSession.d.ts.map +1 -1
- package/dist/esm/session/GroupSession.js +97 -102
- package/dist/esm/session/GroupSession.js.map +2 -2
- package/dist/esm/session/NodeSession.d.ts +50 -1
- package/dist/esm/session/NodeSession.d.ts.map +1 -1
- package/dist/esm/session/NodeSession.js +83 -5
- package/dist/esm/session/NodeSession.js.map +1 -1
- package/dist/esm/session/SecureSession.d.ts +9 -0
- package/dist/esm/session/SecureSession.d.ts.map +1 -1
- package/dist/esm/session/SecureSession.js +18 -1
- package/dist/esm/session/SecureSession.js.map +1 -1
- package/dist/esm/session/Session.d.ts +2 -2
- package/dist/esm/session/Session.d.ts.map +1 -1
- package/dist/esm/session/Session.js +1 -1
- package/dist/esm/session/SessionManager.d.ts +76 -28
- package/dist/esm/session/SessionManager.d.ts.map +1 -1
- package/dist/esm/session/SessionManager.js +319 -156
- package/dist/esm/session/SessionManager.js.map +2 -2
- package/dist/esm/session/UnsecuredSession.d.ts +0 -1
- package/dist/esm/session/UnsecuredSession.d.ts.map +1 -1
- package/dist/esm/session/UnsecuredSession.js +5 -3
- package/dist/esm/session/UnsecuredSession.js.map +1 -1
- package/dist/esm/session/case/CaseClient.d.ts +5 -0
- package/dist/esm/session/case/CaseClient.d.ts.map +1 -1
- package/dist/esm/session/case/CaseClient.js +12 -11
- package/dist/esm/session/case/CaseClient.js.map +2 -2
- package/dist/esm/session/case/CaseServer.d.ts.map +1 -1
- package/dist/esm/session/case/CaseServer.js +31 -11
- package/dist/esm/session/case/CaseServer.js.map +1 -1
- package/package.json +5 -5
- package/src/action/Val.ts +8 -0
- package/src/action/client/ClientInteraction.ts +57 -33
- package/src/action/client/ClientRequest.ts +15 -0
- package/src/action/client/InputChunk.ts +57 -2
- package/src/action/client/subscription/ClientSubscription.ts +5 -0
- package/src/action/client/subscription/ClientSubscriptionHandler.ts +15 -0
- package/src/action/client/subscription/PeerSubscription.ts +73 -0
- package/src/action/errors.ts +10 -3
- package/src/action/protocols.ts +7 -1
- package/src/action/request/Invoke.ts +60 -15
- package/src/action/request/Write.ts +7 -6
- package/src/action/response/InvokeResult.ts +32 -2
- package/src/action/response/ReadResult.ts +15 -5
- package/src/action/server/AttributeReadResponse.ts +3 -2
- package/src/action/server/AttributeWriteResponse.ts +14 -3
- package/src/action/server/EventReadResponse.ts +1 -0
- package/src/advertisement/mdns/MdnsAdvertisement.ts +9 -9
- package/src/ble/Ble.ts +5 -0
- package/src/certificate/CdSigners.ts +137 -0
- package/src/certificate/CertificateAuthority.ts +1 -1
- package/src/certificate/DeviceAttestationValidator.ts +213 -56
- package/src/certificate/DeviceCertification.ts +6 -2
- package/src/certificate/NocsrValidator.ts +140 -0
- package/src/certificate/PeerData.ts +15 -0
- package/src/certificate/index.ts +2 -0
- package/src/certificate/kinds/AttestationCertificates.ts +183 -15
- package/src/certificate/kinds/Certificate.ts +203 -308
- package/src/certificate/kinds/CertificationDeclaration.ts +100 -46
- package/src/certificate/kinds/DistinguishedName.ts +677 -0
- package/src/certificate/kinds/Icac.ts +7 -12
- package/src/certificate/kinds/Noc.ts +12 -8
- package/src/certificate/kinds/OperationalBase.ts +5 -2
- package/src/certificate/kinds/Rcac.ts +7 -12
- package/src/certificate/kinds/Vvsc.ts +24 -15
- package/src/certificate/kinds/definitions/asn.ts +1 -1
- package/src/certificate/kinds/definitions/attestation.ts +15 -15
- package/src/certificate/kinds/definitions/base.ts +43 -1
- package/src/certificate/kinds/definitions/operational.ts +4 -3
- package/src/codec/MessageCodec.ts +92 -81
- package/src/common/OperationalCredentialsTypes.ts +7 -0
- package/src/dcl/DclCertificateService.ts +135 -36
- package/src/fabric/Fabric.ts +13 -6
- package/src/fabric/FabricManager.ts +2 -2
- package/src/groups/FabricGroups.ts +5 -0
- package/src/groups/Groups.ts +12 -3
- package/src/groups/KeySets.ts +3 -3
- package/src/interaction/InteractionMessenger.ts +58 -20
- package/src/mdns/InterfaceResponder.ts +1031 -0
- package/src/mdns/MdnsServer.ts +400 -360
- package/src/mdns/MdnsService.ts +2 -0
- package/src/peer/AdministratorCommands.ts +37 -0
- package/src/peer/CommissioningConnection.ts +5 -1
- package/src/peer/ControllerCommissioner.ts +69 -19
- package/src/peer/ControllerCommissioningFlow.ts +149 -99
- package/src/peer/OperationalCertificateUpdate.ts +922 -0
- package/src/peer/Peer.ts +31 -16
- package/src/peer/PeerAddressStore.ts +119 -0
- package/src/peer/PeerConnection.ts +0 -1
- package/src/peer/PeerDescriptor.ts +3 -4
- package/src/peer/PeerExchangeProvider.ts +4 -6
- package/src/peer/PeerLossContext.ts +11 -2
- package/src/peer/PhysicalDeviceProperties.ts +25 -12
- package/src/peer/RebootResubscribeArmer.ts +37 -16
- package/src/peer/index.ts +2 -0
- package/src/protocol/DeviceAdvertiser.ts +5 -1
- package/src/protocol/ExchangeManager.ts +162 -88
- package/src/protocol/ExchangeProvider.ts +3 -2
- package/src/protocol/MessageExchange.ts +29 -7
- package/src/protocol/MessageReceptionState.ts +2 -2
- package/src/protocol/errors.ts +7 -1
- package/src/securechannel/SecureChannelMessenger.ts +26 -13
- package/src/session/GroupSession.ts +147 -111
- package/src/session/NodeSession.ts +89 -4
- package/src/session/SecureSession.ts +27 -1
- package/src/session/Session.ts +2 -2
- package/src/session/SessionManager.ts +429 -189
- package/src/session/UnsecuredSession.ts +9 -3
- package/src/session/case/CaseClient.ts +15 -10
- package/src/session/case/CaseServer.ts +41 -17
|
@@ -26,15 +26,16 @@ module.exports = __toCommonJS(SessionManager_exports);
|
|
|
26
26
|
var import_SupportedTransportsBitmap = require("#common/SupportedTransportsBitmap.js");
|
|
27
27
|
var import_FabricManager = require("#fabric/FabricManager.js");
|
|
28
28
|
var import_PeerAddress = require("#peer/PeerAddress.js");
|
|
29
|
+
var import_PeerAddressStore = require("#peer/PeerAddressStore.js");
|
|
29
30
|
var import_PeerCommunicationError = require("#peer/PeerCommunicationError.js");
|
|
30
31
|
var import_errors = require("#protocol/errors.js");
|
|
31
32
|
var import_GroupSession = require("#session/GroupSession.js");
|
|
32
33
|
var import_general = require("@matter/general");
|
|
33
34
|
var import_types = require("@matter/types");
|
|
34
|
-
var import_groupcast = require("@matter/types/clusters/groupcast");
|
|
35
35
|
var import_MessageCounter = require("../protocol/MessageCounter.js");
|
|
36
36
|
var import_NodeSession = require("./NodeSession.js");
|
|
37
37
|
var import_SecureSession = require("./SecureSession.js");
|
|
38
|
+
var import_Session = require("./Session.js");
|
|
38
39
|
var import_SessionIntervals = require("./SessionIntervals.js");
|
|
39
40
|
var import_SessionParameters = require("./SessionParameters.js");
|
|
40
41
|
var import_UnsecuredSession = require("./UnsecuredSession.js");
|
|
@@ -59,6 +60,9 @@ function assertMaxPathsPerInvoke(maxPathsPerInvoke) {
|
|
|
59
60
|
}
|
|
60
61
|
const ID_SPACE_UPPER_BOUND = 65535;
|
|
61
62
|
const MAX_SESSIONS_PER_PEER = 5;
|
|
63
|
+
const RESUMPTION_RECORDS_CONTEXT = "resumption";
|
|
64
|
+
const LEGACY_RESUMPTION_RECORDS_KEY = "resumptionRecords";
|
|
65
|
+
const RESUMPTION_RECORD_VERSION = 1;
|
|
62
66
|
const GROUP_DATA_COUNTER_KEY = "groupDataCounter";
|
|
63
67
|
const GROUP_DATA_COUNTER_RESERVE = 1e3;
|
|
64
68
|
class SessionEvictedError extends import_general.ClosedError {
|
|
@@ -75,10 +79,13 @@ class SessionManager {
|
|
|
75
79
|
#logger;
|
|
76
80
|
#context;
|
|
77
81
|
#unsecuredSessions = /* @__PURE__ */ new Map();
|
|
78
|
-
#
|
|
82
|
+
#establishedSessions = new import_general.BasicSet();
|
|
83
|
+
#registeredSessions = new RegisteredSessions(this.#establishedSessions);
|
|
79
84
|
#groupSessions = /* @__PURE__ */ new Map();
|
|
80
85
|
#nextSessionId;
|
|
81
86
|
#resumptionRecords = new import_PeerAddress.PeerAddressMap();
|
|
87
|
+
#resumptionRecordsById = /* @__PURE__ */ new Map();
|
|
88
|
+
#resumptionStore;
|
|
82
89
|
#globalUnencryptedMessageCounter;
|
|
83
90
|
#groupDataMessageCounter;
|
|
84
91
|
#sessionParameters;
|
|
@@ -103,6 +110,7 @@ class SessionManager {
|
|
|
103
110
|
constructor(context) {
|
|
104
111
|
this.#context = context;
|
|
105
112
|
this.#logger = import_general.Logger.get("SessionManager", context.origin);
|
|
113
|
+
this.#resumptionStore = new import_PeerAddressStore.PeerAddressStore(context.storage.createContext(RESUMPTION_RECORDS_CONTEXT));
|
|
106
114
|
const {
|
|
107
115
|
fabrics: { crypto }
|
|
108
116
|
} = context;
|
|
@@ -119,12 +127,7 @@ class SessionManager {
|
|
|
119
127
|
this.#observers.on(context.fabrics.events.deleting, async (fabric) => {
|
|
120
128
|
await this.deleteResumptionRecordsForFabric(fabric);
|
|
121
129
|
});
|
|
122
|
-
this.#
|
|
123
|
-
if (!session.isInitiator) {
|
|
124
|
-
this.#sessionEvictionMutex.run(() => this.#evictExcessSessionsFor(session));
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
this.#sessions.added.on((session) => {
|
|
130
|
+
this.#registeredSessions.added.on((session) => {
|
|
128
131
|
const subscriptionsChanged = (subscription) => {
|
|
129
132
|
if (session.isClosing) {
|
|
130
133
|
return;
|
|
@@ -138,6 +141,10 @@ class SessionManager {
|
|
|
138
141
|
session.subscriptions.deleted.off(subscriptionsChanged);
|
|
139
142
|
});
|
|
140
143
|
});
|
|
144
|
+
this.#registeredSessions.deleted.on((session) => {
|
|
145
|
+
this.#establishedSessions.delete(session);
|
|
146
|
+
});
|
|
147
|
+
this.#establishedSessions.added.on((session) => this.#sessionEstablished(session));
|
|
141
148
|
this.#construction = (0, import_general.Construction)(this, () => this.#initialize());
|
|
142
149
|
}
|
|
143
150
|
static [import_general.Environmental.create](env) {
|
|
@@ -167,10 +174,54 @@ class SessionManager {
|
|
|
167
174
|
return this.#groupDataMessageCounter;
|
|
168
175
|
}
|
|
169
176
|
/**
|
|
170
|
-
*
|
|
177
|
+
* The established secure sessions. A session joins once its handshake completed, so {@link ObservableSet.added}
|
|
178
|
+
* emits on establishment, and a session whose handshake fails never appears. It leaves when it closes.
|
|
179
|
+
*
|
|
180
|
+
* Read this set to find a session to use, or to list or observe the sessions with peers.
|
|
181
|
+
*
|
|
182
|
+
* Read {@link registeredSessions} instead for subscriptions and reports, and for session teardown and message
|
|
183
|
+
* routing. A peer may send a Subscribe on a session we respond to before that session is established, so the
|
|
184
|
+
* subscriptions of a peer may live on a session that is not in this set. The CHIP SDK drops such messages; we
|
|
185
|
+
* serve them, see {@link NodeSession.isEstablishing}.
|
|
171
186
|
*/
|
|
172
187
|
get sessions() {
|
|
173
|
-
return this.#
|
|
188
|
+
return this.#establishedSessions;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Every secure session that receives messages, including those whose handshake still runs (see
|
|
192
|
+
* {@link NodeSession.isEstablishing}). A session joins on creation, unless it is created with
|
|
193
|
+
* `delayManagerRegistration`, and leaves when it closes.
|
|
194
|
+
*
|
|
195
|
+
* Read this set for message routing, session ID allocation, session teardown, peer loss, and for the subscriptions
|
|
196
|
+
* and reports of a peer. Code that looks for a session to use reads {@link sessions}.
|
|
197
|
+
*
|
|
198
|
+
* {@link sessions} emits {@link ObservableSet.added} for a session only after every observer of `added` here ran,
|
|
199
|
+
* so components that wire up a session here, such as the ExchangeManager, are ready before users of the
|
|
200
|
+
* established session see it.
|
|
201
|
+
*/
|
|
202
|
+
get registeredSessions() {
|
|
203
|
+
return this.#registeredSessions;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* The number of registrations in {@link registeredSessions} so far. A session registered from now on gets this
|
|
207
|
+
* value or a higher one as its registration position, so the value marks "sessions registered after this point"
|
|
208
|
+
* for {@link PeerLossContext.registeredBefore}.
|
|
209
|
+
*/
|
|
210
|
+
get registrationCount() {
|
|
211
|
+
return this.#registeredSessions.count;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* The open sessions with the peer of {@link session} that registered at or after it. {@link handlePeerShutdown}
|
|
215
|
+
* keeps these sessions when it receives {@link session}. For a session that never registered, the result is empty.
|
|
216
|
+
*/
|
|
217
|
+
sessionsRegisteredSince(session) {
|
|
218
|
+
const position = this.#registeredSessions.positionOf(session);
|
|
219
|
+
if (position === void 0) {
|
|
220
|
+
return [];
|
|
221
|
+
}
|
|
222
|
+
return this.sessionsFor(session.peerAddress).filter(
|
|
223
|
+
(other) => !this.#registeredSessions.isRegisteredBefore(other, position)
|
|
224
|
+
);
|
|
174
225
|
}
|
|
175
226
|
/**
|
|
176
227
|
* Active unsecured sessions.
|
|
@@ -227,7 +278,10 @@ class SessionManager {
|
|
|
227
278
|
return this.#retry;
|
|
228
279
|
}
|
|
229
280
|
/**
|
|
230
|
-
* Emits for
|
|
281
|
+
* Emits for a received group message whose keys are tried: when no candidate key passes, when the message is a
|
|
282
|
+
* replay, and when the Interaction Model processes a group invoke request. A datagram the codec refuses and a
|
|
283
|
+
* message with the R or A flag emit nothing. Any other message, such as a group write or a message for an
|
|
284
|
+
* unsupported protocol, emits only MessageReplay for a replayed copy. Observers remain inactive until at least one
|
|
231
285
|
* listener attaches, so fabrics not under test incur no emission overhead.
|
|
232
286
|
*/
|
|
233
287
|
get onGroupMessage() {
|
|
@@ -293,9 +347,9 @@ class SessionManager {
|
|
|
293
347
|
*/
|
|
294
348
|
async deleteResumptionRecord(address) {
|
|
295
349
|
await this.#construction;
|
|
296
|
-
const result = this.#
|
|
350
|
+
const result = this.#forgetResumptionRecord(address);
|
|
297
351
|
if (result) {
|
|
298
|
-
await this.#
|
|
352
|
+
await this.#resumptionStore.delete(address);
|
|
299
353
|
}
|
|
300
354
|
return result;
|
|
301
355
|
}
|
|
@@ -306,22 +360,20 @@ class SessionManager {
|
|
|
306
360
|
async deleteResumptionRecordsForFabric(fabric) {
|
|
307
361
|
await this.#construction;
|
|
308
362
|
let deletedCount = 0;
|
|
309
|
-
for (const address of this.#resumptionRecords.keys()) {
|
|
310
|
-
if (address.fabricIndex === fabric.fabricIndex) {
|
|
311
|
-
|
|
312
|
-
deletedCount++;
|
|
313
|
-
}
|
|
363
|
+
for (const address of [...this.#resumptionRecords.keys()]) {
|
|
364
|
+
if (address.fabricIndex === fabric.fabricIndex && this.#forgetResumptionRecord(address)) {
|
|
365
|
+
deletedCount++;
|
|
314
366
|
}
|
|
315
367
|
}
|
|
316
368
|
if (deletedCount > 0) {
|
|
317
|
-
await this.#
|
|
369
|
+
await this.#resumptionStore.deleteFabric(fabric.fabricIndex);
|
|
318
370
|
}
|
|
319
371
|
return deletedCount > 0;
|
|
320
372
|
}
|
|
321
|
-
/** The session with the least recent traffic among
|
|
322
|
-
#leastRecentlyUsedSession(filter) {
|
|
373
|
+
/** The session with the least recent traffic among {@link sessions} that {@link filter} accepts, if any. */
|
|
374
|
+
#leastRecentlyUsedSession(sessions, filter) {
|
|
323
375
|
let oldest;
|
|
324
|
-
for (const session of
|
|
376
|
+
for (const session of sessions) {
|
|
325
377
|
if (filter(session) && (oldest === void 0 || session.timestamp < oldest.timestamp)) {
|
|
326
378
|
oldest = session;
|
|
327
379
|
}
|
|
@@ -330,7 +382,7 @@ class SessionManager {
|
|
|
330
382
|
}
|
|
331
383
|
findOldestInactiveSession() {
|
|
332
384
|
this.#construction.assert();
|
|
333
|
-
const oldest = this.#leastRecentlyUsedSession(() => true);
|
|
385
|
+
const oldest = this.#leastRecentlyUsedSession(this.#registeredSessions, () => true);
|
|
334
386
|
if (oldest === void 0) {
|
|
335
387
|
throw new import_general.MatterFlowError("No session found to close and all session ids are taken.");
|
|
336
388
|
}
|
|
@@ -366,16 +418,16 @@ class SessionManager {
|
|
|
366
418
|
}
|
|
367
419
|
getSession(sessionId) {
|
|
368
420
|
this.#construction.assert();
|
|
369
|
-
return this.#
|
|
421
|
+
return this.#registeredSessions.get("id", sessionId);
|
|
370
422
|
}
|
|
371
423
|
getPaseSession() {
|
|
372
424
|
this.#construction.assert();
|
|
373
|
-
return
|
|
425
|
+
return this.#establishedSessions.find((session) => session.isPase && !session.isClosing);
|
|
374
426
|
}
|
|
375
427
|
forFabric(fabric) {
|
|
376
428
|
this.#construction.assert();
|
|
377
|
-
return
|
|
378
|
-
(session) =>
|
|
429
|
+
return this.#establishedSessions.filter(
|
|
430
|
+
(session) => session.isSecure && session.fabric?.fabricIndex === fabric.fabricIndex
|
|
379
431
|
);
|
|
380
432
|
}
|
|
381
433
|
sessionFor(peer) {
|
|
@@ -388,7 +440,7 @@ class SessionManager {
|
|
|
388
440
|
maybeSessionFor(address) {
|
|
389
441
|
this.#construction.assert();
|
|
390
442
|
let found;
|
|
391
|
-
for (const session of this.#
|
|
443
|
+
for (const session of this.#establishedSessions) {
|
|
392
444
|
if (!session.peerIs(address) || session.isClosing || session.isPeerLost) {
|
|
393
445
|
continue;
|
|
394
446
|
}
|
|
@@ -400,39 +452,71 @@ class SessionManager {
|
|
|
400
452
|
}
|
|
401
453
|
sessionsFor(address) {
|
|
402
454
|
address = (0, import_PeerAddress.PeerAddress)(address);
|
|
403
|
-
return this.#
|
|
455
|
+
return this.#registeredSessions.filter((session) => session.peerAddress === address && !session.isClosing);
|
|
404
456
|
}
|
|
405
457
|
sessionsForFabricIndex(fabricIndex) {
|
|
406
|
-
return this.#
|
|
458
|
+
return this.#registeredSessions.filter((session) => session.fabric?.fabricIndex === fabricIndex);
|
|
407
459
|
}
|
|
408
460
|
/**
|
|
409
461
|
* Removes all Peer sessions without first closing the subscriptions the peer holds on them; those end when the
|
|
410
462
|
* sessions close. Our own subscriptions to the peer belong to the peer, not to a session, so a peer that persists
|
|
411
463
|
* subscriptions can refresh them after its restart.
|
|
412
464
|
*
|
|
413
|
-
*
|
|
414
|
-
*
|
|
465
|
+
* Sessions that register while the shutdown runs are kept.
|
|
466
|
+
*
|
|
467
|
+
* @param keep this session and the sessions registered after it are kept. Without it, or for a session that never
|
|
468
|
+
* registered, every session registered now is removed. A {@link Timestamp} is deprecated: then only the sessions
|
|
469
|
+
* created before that instant are removed, and a session created in the same instant counts as newer.
|
|
415
470
|
*/
|
|
416
|
-
handlePeerShutdown(address,
|
|
417
|
-
|
|
471
|
+
handlePeerShutdown(address, keep) {
|
|
472
|
+
const context = {
|
|
418
473
|
address,
|
|
419
474
|
cause: new import_PeerCommunicationError.PeerShutdownError(),
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
}
|
|
475
|
+
keepSubscriptions: true,
|
|
476
|
+
registeredBefore: this.registrationCount
|
|
477
|
+
};
|
|
478
|
+
if (typeof keep === "number") {
|
|
479
|
+
return this.#handlePeerLoss({ ...context, asOf: keep });
|
|
480
|
+
}
|
|
481
|
+
const keepPosition = keep === void 0 ? void 0 : this.#registeredSessions.positionOf(keep);
|
|
482
|
+
return this.#handlePeerLoss({ ...context, registeredBefore: keepPosition ?? context.registeredBefore });
|
|
423
483
|
}
|
|
424
484
|
/**
|
|
425
|
-
* Removes all Peer sessions and closes subscriptions.
|
|
485
|
+
* Removes all Peer sessions and closes subscriptions. Only the sessions registered before
|
|
486
|
+
* {@link PeerLossContext.registeredBefore} are affected; by default every session registered now. A given
|
|
487
|
+
* {@link PeerLossContext.asOf} applies in addition.
|
|
426
488
|
*/
|
|
427
489
|
async handlePeerLoss(address, context) {
|
|
428
|
-
return await this.#handlePeerLoss({
|
|
490
|
+
return await this.#handlePeerLoss({
|
|
491
|
+
...context,
|
|
492
|
+
address,
|
|
493
|
+
registeredBefore: context.registeredBefore ?? this.registrationCount
|
|
494
|
+
});
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* Supersede the older sessions {@link newer} replaces, then evict excess sessions of the peer. Supersession comes
|
|
498
|
+
* first and is synchronous, so the subscriptions have left a session before eviction can close it.
|
|
499
|
+
*
|
|
500
|
+
* An older session that is still establishing is not superseded. Subscriptions exist on such a session only if a
|
|
501
|
+
* Subscribe arrived before its handshake finished. If that handshake fails, the subscriptions close with it.
|
|
502
|
+
*/
|
|
503
|
+
#sessionEstablished(newer) {
|
|
504
|
+
for (const older of this.#establishedSessions) {
|
|
505
|
+
if (older !== newer && !older.isClosing && supersedes(newer, older)) {
|
|
506
|
+
older.superseded.emit(newer);
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
if (!newer.isInitiator) {
|
|
510
|
+
this.#sessionEvictionMutex.run(() => this.#evictExcessSessionsFor(newer));
|
|
511
|
+
}
|
|
429
512
|
}
|
|
430
513
|
/**
|
|
431
514
|
* Close the peer's least recently active sessions once it exceeds {@link MAX_SESSIONS_PER_PEER}.
|
|
432
515
|
*
|
|
433
516
|
* Only sessions the peer established are eligible: ones we initiated are ours to manage, and the peer loss our
|
|
434
517
|
* own traffic reports already sweeps them. {@link added} is excluded so a burst of new sessions cannot evict the
|
|
435
|
-
* one that prompted the check.
|
|
518
|
+
* one that prompted the check. Only established sessions count and are evicted; an establishing session becomes
|
|
519
|
+
* established or closes within its handshake.
|
|
436
520
|
*/
|
|
437
521
|
async #evictExcessSessionsFor(added) {
|
|
438
522
|
if (added.isPase || added.isClosing) {
|
|
@@ -440,9 +524,12 @@ class SessionManager {
|
|
|
440
524
|
}
|
|
441
525
|
const address = added.peerAddress;
|
|
442
526
|
const claimsSlot = (session) => session !== added && !session.isInitiator && session.peerIs(address);
|
|
443
|
-
let excess = this.#
|
|
527
|
+
let excess = this.#establishedSessions.filter(claimsSlot).length + 1 - MAX_SESSIONS_PER_PEER;
|
|
444
528
|
while (excess-- > 0) {
|
|
445
|
-
const session = this.#leastRecentlyUsedSession(
|
|
529
|
+
const session = this.#leastRecentlyUsedSession(
|
|
530
|
+
this.#establishedSessions,
|
|
531
|
+
(s) => claimsSlot(s) && !s.isClosing
|
|
532
|
+
);
|
|
446
533
|
if (session === void 0) {
|
|
447
534
|
return;
|
|
448
535
|
}
|
|
@@ -455,11 +542,14 @@ class SessionManager {
|
|
|
455
542
|
}
|
|
456
543
|
async #handlePeerLoss(context) {
|
|
457
544
|
await this.#construction;
|
|
458
|
-
const { address, asOf } = context;
|
|
459
|
-
for (const session of this.#
|
|
545
|
+
const { address, asOf, registeredBefore } = context;
|
|
546
|
+
for (const session of this.#registeredSessions) {
|
|
460
547
|
if (!session.peerIs(address)) {
|
|
461
548
|
continue;
|
|
462
549
|
}
|
|
550
|
+
if (registeredBefore !== void 0 && !this.#registeredSessions.isRegisteredBefore(session, registeredBefore)) {
|
|
551
|
+
continue;
|
|
552
|
+
}
|
|
463
553
|
if (asOf !== void 0 && session.createdAt >= asOf) {
|
|
464
554
|
continue;
|
|
465
555
|
}
|
|
@@ -505,9 +595,11 @@ class SessionManager {
|
|
|
505
595
|
});
|
|
506
596
|
}
|
|
507
597
|
/**
|
|
508
|
-
* Obtain a Group session for an incoming packet.
|
|
598
|
+
* Obtain a Group session for an incoming packet, with the decoded message and the facts decode established.
|
|
509
599
|
*
|
|
510
|
-
* The session ID is determined by decrypting the packet with possible keys.
|
|
600
|
+
* The session ID is determined by decrypting the packet with possible keys. Returns `undefined` when no candidate
|
|
601
|
+
* key passes; the message is then reported via {@link onGroupMessage} and must be dropped. Also returns
|
|
602
|
+
* `undefined`, without a report, for a group data message with the R or A flag.
|
|
511
603
|
*
|
|
512
604
|
* Note that the resulting session is non-operational in the sense that attempting outbound communication will
|
|
513
605
|
* result in an error.
|
|
@@ -516,33 +608,26 @@ class SessionManager {
|
|
|
516
608
|
this.#construction.assert();
|
|
517
609
|
let decoded;
|
|
518
610
|
try {
|
|
519
|
-
decoded = import_GroupSession.GroupSession.
|
|
611
|
+
decoded = import_GroupSession.GroupSession.decodeWithCandidateKeys(this.#context.fabrics, packet, aad);
|
|
520
612
|
} catch (error) {
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
})
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
}
|
|
539
|
-
const { message, key, privacyKey, sessionId, sourceNodeId, keySetId, fabric } = decoded;
|
|
540
|
-
const rawGroupId = message.packetHeader.destGroupId;
|
|
541
|
-
if (rawGroupId === void 0) {
|
|
542
|
-
throw new import_general.UnexpectedDataError("Group ID is required for GroupSession fromPacket.");
|
|
613
|
+
import_GroupSession.GroupSessionDecodeError.accept(error);
|
|
614
|
+
const { candidateFabrics, group } = error;
|
|
615
|
+
this.#logger.debug(
|
|
616
|
+
`Dropping group message for session ${import_Session.Session.idStrOf(packet)} from ${sourceIp ?? "unknown address"}:`,
|
|
617
|
+
error.message,
|
|
618
|
+
import_general.Diagnostic.dict({ candidateFabrics: candidateFabrics.size })
|
|
619
|
+
);
|
|
620
|
+
this.#onGroupMessage.emit({ kind: "unauthenticated", candidateFabrics, group, sourceIp });
|
|
621
|
+
return void 0;
|
|
622
|
+
}
|
|
623
|
+
const { message, key, privacyKey, sessionId, sourceNodeId, groupId, keySetId, fabric } = decoded;
|
|
624
|
+
const { requiresAck, ackedMessageId } = message.payloadHeader;
|
|
625
|
+
if (requiresAck || ackedMessageId !== void 0) {
|
|
626
|
+
this.#logger.debug(
|
|
627
|
+
`Dropping group message ${import_general.hex.fixed(message.packetHeader.messageId, 8)} for session ${import_Session.Session.idStrOf(packet)} with the ${requiresAck ? "R" : "A"} flag`
|
|
628
|
+
);
|
|
629
|
+
return void 0;
|
|
543
630
|
}
|
|
544
|
-
const groupId = (0, import_types.GroupId)(rawGroupId);
|
|
545
|
-
import_types.GroupId.assertGroupId(groupId);
|
|
546
631
|
let session = this.#groupSessions.get(sourceNodeId)?.find((s) => s.matches(fabric.fabricIndex, sessionId, key));
|
|
547
632
|
if (session === void 0) {
|
|
548
633
|
session = new import_GroupSession.GroupSession({
|
|
@@ -557,9 +642,9 @@ class SessionManager {
|
|
|
557
642
|
messageCounter: this.#groupDataMessageCounter
|
|
558
643
|
});
|
|
559
644
|
}
|
|
560
|
-
return { session, message, key };
|
|
645
|
+
return { session, message, key, sourceNodeId, groupId };
|
|
561
646
|
}
|
|
562
|
-
/** Report
|
|
647
|
+
/** Report an authenticated group message (used by ExchangeManager for replay and InteractionServer for dispatch). */
|
|
563
648
|
emitGroupMessage(info) {
|
|
564
649
|
this.#onGroupMessage.emit(info);
|
|
565
650
|
}
|
|
@@ -584,9 +669,7 @@ class SessionManager {
|
|
|
584
669
|
}
|
|
585
670
|
findResumptionRecordById(resumptionId) {
|
|
586
671
|
this.#construction.assert();
|
|
587
|
-
const record =
|
|
588
|
-
(record2) => import_general.Bytes.areEqual(record2.resumptionId, resumptionId)
|
|
589
|
-
);
|
|
672
|
+
const record = this.#resumptionRecordsById.get(import_general.Bytes.toHex(resumptionId));
|
|
590
673
|
if (record !== void 0) {
|
|
591
674
|
return this.#asExposedResumptionRecord(record);
|
|
592
675
|
}
|
|
@@ -606,40 +689,27 @@ class SessionManager {
|
|
|
606
689
|
fabricId: fabric.fabricId,
|
|
607
690
|
fabricIndex: fabric.fabricIndex
|
|
608
691
|
};
|
|
609
|
-
|
|
610
|
-
|
|
692
|
+
const address = fabric.addressOf(resumptionRecord.peerNodeId);
|
|
693
|
+
this.#rememberResumptionRecord(address, record);
|
|
694
|
+
await this.#resumptionStore.set(address, storageRecordOf(record));
|
|
611
695
|
}
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
nodeId: address.nodeId,
|
|
630
|
-
sharedSecret,
|
|
631
|
-
resumptionId,
|
|
632
|
-
fabricId,
|
|
633
|
-
fabricIndex,
|
|
634
|
-
peerNodeId,
|
|
635
|
-
sessionParameters: {
|
|
636
|
-
...sessionParameters,
|
|
637
|
-
supportedTransports: sessionParameters.supportedTransports ? import_SupportedTransportsBitmap.SupportedTransportsSchema.encode(sessionParameters.supportedTransports) : void 0
|
|
638
|
-
},
|
|
639
|
-
caseAuthenticatedTags
|
|
640
|
-
})
|
|
641
|
-
)
|
|
642
|
-
);
|
|
696
|
+
#rememberResumptionRecord(address, record) {
|
|
697
|
+
this.#forgetResumptionRecord(address);
|
|
698
|
+
this.#resumptionRecords.set(address, record);
|
|
699
|
+
this.#resumptionRecordsById.set(import_general.Bytes.toHex(record.resumptionId), record);
|
|
700
|
+
}
|
|
701
|
+
#forgetAllResumptionRecords() {
|
|
702
|
+
this.#resumptionRecords.clear();
|
|
703
|
+
this.#resumptionRecordsById.clear();
|
|
704
|
+
}
|
|
705
|
+
#forgetResumptionRecord(address) {
|
|
706
|
+
const record = this.#resumptionRecords.get(address);
|
|
707
|
+
if (record === void 0) {
|
|
708
|
+
return false;
|
|
709
|
+
}
|
|
710
|
+
this.#resumptionRecords.delete(address);
|
|
711
|
+
this.#resumptionRecordsById.delete(import_general.Bytes.toHex(record.resumptionId));
|
|
712
|
+
return true;
|
|
643
713
|
}
|
|
644
714
|
#maybeFabricForId(fabricId, fabricIndex) {
|
|
645
715
|
return this.#context.fabrics.find(
|
|
@@ -657,49 +727,64 @@ class SessionManager {
|
|
|
657
727
|
async #initialize() {
|
|
658
728
|
await this.#context.fabrics.construction;
|
|
659
729
|
this.#groupDataMessageCounter = await this.#createGroupDataMessageCounter();
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
storedResumptionRecords.forEach(
|
|
665
|
-
({
|
|
666
|
-
nodeId,
|
|
667
|
-
sharedSecret,
|
|
668
|
-
resumptionId,
|
|
669
|
-
fabricId,
|
|
670
|
-
fabricIndex,
|
|
671
|
-
peerNodeId,
|
|
672
|
-
sessionParameters,
|
|
673
|
-
caseAuthenticatedTags
|
|
674
|
-
}) => {
|
|
675
|
-
const fabric = this.#maybeFabricForId(fabricId, fabricIndex);
|
|
676
|
-
if (!fabric) {
|
|
677
|
-
this.#logger.warn(
|
|
678
|
-
`Ignoring resumption record for fabric 0x${(0, import_general.toHex)(fabricId)} and index ${fabricIndex} because we cannot find a matching fabric`
|
|
679
|
-
);
|
|
680
|
-
return;
|
|
681
|
-
}
|
|
730
|
+
await this.#migrateLegacyResumptionRecords();
|
|
731
|
+
const storedResumptionRecords = await this.#resumptionStore.load((address, record) => {
|
|
732
|
+
const { fabricId, fabricIndex, version = 0 } = record;
|
|
733
|
+
if (this.#maybeFabricForId(fabricId, fabricIndex)?.fabricIndex !== address.fabricIndex) {
|
|
682
734
|
this.#logger.info(
|
|
683
|
-
|
|
684
|
-
fabric.addressOf(nodeId).toString(),
|
|
685
|
-
"and peer node",
|
|
686
|
-
fabric.addressOf(peerNodeId).toString(),
|
|
687
|
-
"for fabric id",
|
|
688
|
-
`0x${(0, import_general.toHex)(fabric.fabricId)}`,
|
|
689
|
-
`(0x${(0, import_general.toHex)(fabric.rootVendorId)}, "${fabric?.label}")`
|
|
735
|
+
`Deleting resumption record for ${address} because it does not match a fabric (fabric 0x${(0, import_general.toHex)(fabricId)} with index ${fabricIndex})`
|
|
690
736
|
);
|
|
691
|
-
|
|
692
|
-
sharedSecret,
|
|
693
|
-
resumptionId,
|
|
694
|
-
fabricId,
|
|
695
|
-
fabricIndex: fabric.fabricIndex,
|
|
696
|
-
peerNodeId,
|
|
697
|
-
// Make sure to initialize default values when restoring an older resumption record
|
|
698
|
-
sessionParameters: (0, import_SessionParameters.SessionParameters)(sessionParameters),
|
|
699
|
-
caseAuthenticatedTags
|
|
700
|
-
});
|
|
737
|
+
return false;
|
|
701
738
|
}
|
|
702
|
-
|
|
739
|
+
if (!isUsableResumptionRecord(record)) {
|
|
740
|
+
this.#logger.info(
|
|
741
|
+
`Deleting resumption record for ${address} stored with format version ${version}; the peer establishes a new session`
|
|
742
|
+
);
|
|
743
|
+
return false;
|
|
744
|
+
}
|
|
745
|
+
return true;
|
|
746
|
+
});
|
|
747
|
+
for (const [address, { version, sessionParameters, ...stored }] of storedResumptionRecords) {
|
|
748
|
+
this.#logger.debug("Restoring resumption record for", address.toString());
|
|
749
|
+
const record = {
|
|
750
|
+
...stored,
|
|
751
|
+
// Make sure to initialize default values when restoring an older resumption record
|
|
752
|
+
sessionParameters: (0, import_SessionParameters.SessionParameters)(sessionParameters)
|
|
753
|
+
};
|
|
754
|
+
this.#rememberResumptionRecord(address, record);
|
|
755
|
+
if (version !== RESUMPTION_RECORD_VERSION) {
|
|
756
|
+
await this.#resumptionStore.set(address, storageRecordOf(record));
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
if (storedResumptionRecords.size) {
|
|
760
|
+
this.#logger.info(`Restored ${storedResumptionRecords.size} resumption records`);
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
/**
|
|
764
|
+
* Move the records of the single legacy array to one key per peer. The array is authoritative when present because
|
|
765
|
+
* only a version without per-peer storage writes it. It is deleted last, so a start interrupted before that moves
|
|
766
|
+
* it again. Records of fabrics that no longer exist are dropped.
|
|
767
|
+
*/
|
|
768
|
+
async #migrateLegacyResumptionRecords() {
|
|
769
|
+
const storage = this.#context.storage;
|
|
770
|
+
if (!await storage.has(LEGACY_RESUMPTION_RECORDS_KEY)) {
|
|
771
|
+
return;
|
|
772
|
+
}
|
|
773
|
+
const legacyRecords = await storage.get(LEGACY_RESUMPTION_RECORDS_KEY, []);
|
|
774
|
+
const records = new Array();
|
|
775
|
+
for (const { nodeId, ...record } of legacyRecords) {
|
|
776
|
+
const fabric = this.#maybeFabricForId(record.fabricId, record.fabricIndex);
|
|
777
|
+
if (fabric === void 0) {
|
|
778
|
+
this.#logger.info(
|
|
779
|
+
`Dropping resumption record for fabric 0x${(0, import_general.toHex)(record.fabricId)} and index ${record.fabricIndex} because we cannot find a matching fabric`
|
|
780
|
+
);
|
|
781
|
+
continue;
|
|
782
|
+
}
|
|
783
|
+
records.push([fabric.addressOf(nodeId), { ...record, fabricIndex: fabric.fabricIndex }]);
|
|
784
|
+
}
|
|
785
|
+
await this.#resumptionStore.replaceAll(records);
|
|
786
|
+
await storage.delete(LEGACY_RESUMPTION_RECORDS_KEY);
|
|
787
|
+
this.#logger.info(`Moved ${records.length} resumption records to per-peer storage`);
|
|
703
788
|
}
|
|
704
789
|
/**
|
|
705
790
|
* Build the node-global group data message counter. On the first run after upgrading from the legacy per-key
|
|
@@ -732,7 +817,7 @@ class SessionManager {
|
|
|
732
817
|
}
|
|
733
818
|
getActiveSessionInformation() {
|
|
734
819
|
this.#construction.assert();
|
|
735
|
-
return
|
|
820
|
+
return this.#establishedSessions.filter((session) => session.isSecure && !session.isPase).map((session) => {
|
|
736
821
|
const activity = session instanceof import_SecureSession.SecureSession ? session.wallClockActivity : void 0;
|
|
737
822
|
return {
|
|
738
823
|
name: `${session.via}`,
|
|
@@ -762,8 +847,9 @@ class SessionManager {
|
|
|
762
847
|
await this.#construction;
|
|
763
848
|
}
|
|
764
849
|
await this.closeAllSessions();
|
|
850
|
+
await this.#resumptionStore.clear();
|
|
765
851
|
await this.#context.storage.clearAll();
|
|
766
|
-
this.#
|
|
852
|
+
this.#forgetAllResumptionRecords();
|
|
767
853
|
await this.#groupDataMessageCounter?.close();
|
|
768
854
|
this.#groupDataMessageCounter = await this.#createGroupDataMessageCounter();
|
|
769
855
|
}
|
|
@@ -774,10 +860,10 @@ class SessionManager {
|
|
|
774
860
|
await this.#subscriptionUpdateMutex;
|
|
775
861
|
await this.#sessionEvictionMutex;
|
|
776
862
|
const context = { cause: new ShutdownError("Session closed by node shutdown") };
|
|
777
|
-
const closePromises = this.#
|
|
863
|
+
const closePromises = this.#registeredSessions.map(async (session) => {
|
|
778
864
|
await session.closeSubscriptionsForShutdown();
|
|
779
865
|
await session.initiateForceClose(context);
|
|
780
|
-
this.#
|
|
866
|
+
this.#registeredSessions.delete(session);
|
|
781
867
|
});
|
|
782
868
|
for (const session of this.#unsecuredSessions.values()) {
|
|
783
869
|
closePromises.push(session.initiateForceClose(context));
|
|
@@ -799,4 +885,81 @@ class SessionManager {
|
|
|
799
885
|
this.#nextSessionId = this.#context.fabrics.crypto.randomUint32 % upperBound + 1;
|
|
800
886
|
}
|
|
801
887
|
}
|
|
888
|
+
function supersedes(newer, older) {
|
|
889
|
+
return !newer.isPase && newer.peerIs(older.peerAddress) && hasEqualCats(newer, older);
|
|
890
|
+
}
|
|
891
|
+
function hasEqualCats(session, other) {
|
|
892
|
+
const tags = new Set(session.caseAuthenticatedTags);
|
|
893
|
+
const otherTags = new Set(other.caseAuthenticatedTags);
|
|
894
|
+
return tags.size === otherTags.size && [...otherTags].every((tag) => tags.has(tag));
|
|
895
|
+
}
|
|
896
|
+
class RegisteredSessions extends import_general.BasicSet {
|
|
897
|
+
#established;
|
|
898
|
+
#positions = /* @__PURE__ */ new WeakMap();
|
|
899
|
+
#count = 0;
|
|
900
|
+
constructor(established) {
|
|
901
|
+
super();
|
|
902
|
+
this.#established = established;
|
|
903
|
+
}
|
|
904
|
+
add(session) {
|
|
905
|
+
if (this.has(session)) {
|
|
906
|
+
return;
|
|
907
|
+
}
|
|
908
|
+
this.#positions.set(session, this.#count++);
|
|
909
|
+
super.add(session);
|
|
910
|
+
if (session.isEstablishing) {
|
|
911
|
+
session.established.once(() => {
|
|
912
|
+
if (this.has(session)) {
|
|
913
|
+
this.#established.add(session);
|
|
914
|
+
}
|
|
915
|
+
});
|
|
916
|
+
} else {
|
|
917
|
+
this.#established.add(session);
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
get count() {
|
|
921
|
+
return this.#count;
|
|
922
|
+
}
|
|
923
|
+
/** The position of {@link session} in the registration order; kept after it leaves. Undefined if never added. */
|
|
924
|
+
positionOf(session) {
|
|
925
|
+
return this.#positions.get(session);
|
|
926
|
+
}
|
|
927
|
+
isRegisteredBefore(session, position) {
|
|
928
|
+
const own = this.#positions.get(session);
|
|
929
|
+
return own !== void 0 && own < position;
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
function storageRecordOf({
|
|
933
|
+
sharedSecret,
|
|
934
|
+
resumptionId,
|
|
935
|
+
peerNodeId,
|
|
936
|
+
fabricId,
|
|
937
|
+
fabricIndex,
|
|
938
|
+
sessionParameters,
|
|
939
|
+
caseAuthenticatedTags
|
|
940
|
+
}) {
|
|
941
|
+
return {
|
|
942
|
+
version: RESUMPTION_RECORD_VERSION,
|
|
943
|
+
sharedSecret,
|
|
944
|
+
resumptionId,
|
|
945
|
+
fabricId,
|
|
946
|
+
fabricIndex,
|
|
947
|
+
peerNodeId,
|
|
948
|
+
sessionParameters: {
|
|
949
|
+
...sessionParameters,
|
|
950
|
+
supportedTransports: sessionParameters.supportedTransports ? import_SupportedTransportsBitmap.SupportedTransportsSchema.encode(sessionParameters.supportedTransports) : void 0
|
|
951
|
+
},
|
|
952
|
+
caseAuthenticatedTags
|
|
953
|
+
};
|
|
954
|
+
}
|
|
955
|
+
function isUsableResumptionRecord({ version = 0, caseAuthenticatedTags }) {
|
|
956
|
+
switch (version) {
|
|
957
|
+
case 0:
|
|
958
|
+
return !caseAuthenticatedTags?.length;
|
|
959
|
+
case RESUMPTION_RECORD_VERSION:
|
|
960
|
+
return true;
|
|
961
|
+
default:
|
|
962
|
+
return false;
|
|
963
|
+
}
|
|
964
|
+
}
|
|
802
965
|
//# sourceMappingURL=SessionManager.js.map
|