@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
|
@@ -168,11 +168,19 @@ export class SecureChannelMessenger {
|
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
sendError(code: SecureChannelStatusCode, abort?: AbortSignal) {
|
|
171
|
-
return this.#sendStatusReport(GeneralStatusCode.Failure, code, abort);
|
|
171
|
+
return this.#sendStatusReport(GeneralStatusCode.Failure, code, { abort });
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
-
|
|
175
|
-
|
|
174
|
+
/**
|
|
175
|
+
* Send the success status report, which ends a session establishment handshake.
|
|
176
|
+
*
|
|
177
|
+
* {@link onTransmitted} runs once the first transmission of the report went out, before the wait for its ack.
|
|
178
|
+
*/
|
|
179
|
+
sendSuccess(abort?: AbortSignal, onTransmitted?: ExchangeSendOptions["onTransmitted"]) {
|
|
180
|
+
return this.#sendStatusReport(GeneralStatusCode.Success, SecureChannelStatusCode.Success, {
|
|
181
|
+
abort,
|
|
182
|
+
onTransmitted,
|
|
183
|
+
});
|
|
176
184
|
}
|
|
177
185
|
|
|
178
186
|
sendBusy(minimumRetryInterval: Duration, abort?: AbortSignal) {
|
|
@@ -181,17 +189,18 @@ export class SecureChannelMessenger {
|
|
|
181
189
|
}
|
|
182
190
|
const writer = new DataWriter(Endian.Little);
|
|
183
191
|
writer.writeUInt16(Math.min(minimumRetryInterval, 0xffff));
|
|
184
|
-
return this.#sendStatusReport(
|
|
185
|
-
GeneralStatusCode.Busy,
|
|
186
|
-
SecureChannelStatusCode.Busy,
|
|
192
|
+
return this.#sendStatusReport(GeneralStatusCode.Busy, SecureChannelStatusCode.Busy, {
|
|
187
193
|
abort,
|
|
188
|
-
true,
|
|
189
|
-
writer.toByteArray(),
|
|
190
|
-
);
|
|
194
|
+
suppressAck: true,
|
|
195
|
+
protocolData: writer.toByteArray(),
|
|
196
|
+
});
|
|
191
197
|
}
|
|
192
198
|
|
|
193
199
|
sendCloseSession(abort?: AbortSignal) {
|
|
194
|
-
return this.#sendStatusReport(GeneralStatusCode.Success, SecureChannelStatusCode.CloseSession,
|
|
200
|
+
return this.#sendStatusReport(GeneralStatusCode.Success, SecureChannelStatusCode.CloseSession, {
|
|
201
|
+
abort,
|
|
202
|
+
suppressAck: true,
|
|
203
|
+
});
|
|
195
204
|
}
|
|
196
205
|
|
|
197
206
|
get channelName() {
|
|
@@ -209,9 +218,12 @@ export class SecureChannelMessenger {
|
|
|
209
218
|
async #sendStatusReport(
|
|
210
219
|
generalStatus: GeneralStatusCode,
|
|
211
220
|
protocolStatus: SecureChannelStatusCode,
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
221
|
+
{
|
|
222
|
+
abort,
|
|
223
|
+
suppressAck,
|
|
224
|
+
protocolData,
|
|
225
|
+
onTransmitted,
|
|
226
|
+
}: Pick<ExchangeSendOptions, "abort" | "suppressAck" | "onTransmitted"> & { protocolData?: Bytes } = {},
|
|
215
227
|
) {
|
|
216
228
|
await this.exchange.send(
|
|
217
229
|
SecureMessageType.StatusReport,
|
|
@@ -227,6 +239,7 @@ export class SecureChannelMessenger {
|
|
|
227
239
|
protocolStatus: SecureChannelStatusCode[protocolStatus] ?? Diagnostic.hex(protocolStatus),
|
|
228
240
|
},
|
|
229
241
|
abort,
|
|
242
|
+
onTransmitted,
|
|
230
243
|
},
|
|
231
244
|
);
|
|
232
245
|
}
|
|
@@ -29,35 +29,75 @@ import {
|
|
|
29
29
|
UnexpectedDataError,
|
|
30
30
|
} from "@matter/general";
|
|
31
31
|
import { FabricIndex, GroupId, NodeId } from "@matter/types";
|
|
32
|
+
import { Groupcast } from "@matter/types/clusters/groupcast";
|
|
32
33
|
import { SecureSession } from "./SecureSession.js";
|
|
33
34
|
import { Session } from "./Session.js";
|
|
34
35
|
import { SessionManager } from "./SessionManager.js";
|
|
35
36
|
|
|
36
|
-
/**
|
|
37
|
-
|
|
37
|
+
/**
|
|
38
|
+
* What is known about a received group message for which no candidate passed: none authenticated it for its
|
|
39
|
+
* destination group with a payload that parses.
|
|
40
|
+
* Groupcast testing reports it from these facts.
|
|
41
|
+
*/
|
|
42
|
+
export interface GroupMessageRejection {
|
|
43
|
+
/**
|
|
44
|
+
* Fabrics with at least one candidate key: a key with the message's session id whose key set GroupKeyMap maps to a
|
|
45
|
+
* group. Empty when no key was found.
|
|
46
|
+
*/
|
|
47
|
+
readonly candidateFabrics: ReadonlySet<FabricIndex>;
|
|
48
|
+
|
|
38
49
|
/**
|
|
39
|
-
*
|
|
40
|
-
*
|
|
50
|
+
* The group id the message names, to derive the address the message arrived on. It must not be reported as the
|
|
51
|
+
* GroupID. Unset when no candidate authenticated the message and the decoded header has no `destGroupId`, as for
|
|
52
|
+
* a privacy message.
|
|
41
53
|
*/
|
|
42
|
-
readonly
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
readonly group?: GroupMessageRejection.Group;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export namespace GroupMessageRejection {
|
|
58
|
+
export interface Group {
|
|
59
|
+
readonly groupId: GroupId;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* The fabric whose candidate key authenticated the id, so it owns the id; it is not the fabric to report on.
|
|
63
|
+
* Unset for an id from a plain header that no candidate authenticated.
|
|
64
|
+
*/
|
|
65
|
+
readonly fabricIndex?: FabricIndex;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* The Groupcast testing result of a rejected message for the given fabric: FailedAuth when a key of the fabric was a
|
|
70
|
+
* candidate, NoAvailableKey otherwise. The CHIP SDK decides the same way.
|
|
71
|
+
*
|
|
72
|
+
* @see {@link MatterSpecification.v161.Core} § 11.27.7.6.3
|
|
73
|
+
*/
|
|
74
|
+
export function resultFor(
|
|
75
|
+
{ candidateFabrics }: GroupMessageRejection,
|
|
76
|
+
fabricIndex: FabricIndex,
|
|
77
|
+
): Groupcast.GroupcastTestResult.FailedAuth | Groupcast.GroupcastTestResult.NoAvailableKey {
|
|
78
|
+
return candidateFabrics.has(fabricIndex)
|
|
79
|
+
? Groupcast.GroupcastTestResult.FailedAuth
|
|
80
|
+
: Groupcast.GroupcastTestResult.NoAvailableKey;
|
|
54
81
|
}
|
|
55
82
|
}
|
|
56
83
|
|
|
57
|
-
/**
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
84
|
+
/**
|
|
85
|
+
* Thrown by {@link GroupSession.decodeWithCandidateKeys} when no candidate passed for a received group message: none
|
|
86
|
+
* authenticated it for its destination group with a payload that parses, or there was no candidate at all. Any sender
|
|
87
|
+
* can cause it, so it is routine.
|
|
88
|
+
*/
|
|
89
|
+
export class GroupSessionDecodeError extends MatterFlowError implements GroupMessageRejection {
|
|
90
|
+
readonly candidateFabrics: ReadonlySet<FabricIndex>;
|
|
91
|
+
readonly group?: GroupMessageRejection.Group;
|
|
92
|
+
|
|
93
|
+
constructor({ candidateFabrics, group }: GroupMessageRejection) {
|
|
94
|
+
super(
|
|
95
|
+
candidateFabrics.size === 0
|
|
96
|
+
? "No key candidate found for group message"
|
|
97
|
+
: "No candidate key passed for the group message",
|
|
98
|
+
);
|
|
99
|
+
this.candidateFabrics = candidateFabrics;
|
|
100
|
+
this.group = group;
|
|
61
101
|
}
|
|
62
102
|
}
|
|
63
103
|
|
|
@@ -73,6 +113,7 @@ export class GroupSession extends SecureSession {
|
|
|
73
113
|
readonly #operationalPrivacyKey?: Bytes;
|
|
74
114
|
readonly #multicastAddress: string;
|
|
75
115
|
readonly supportsMRP = false;
|
|
116
|
+
readonly isEstablishing = false;
|
|
76
117
|
readonly closingAfterExchangeFinished = false; // Group sessions do not close after exchange finished, they are long-lived
|
|
77
118
|
|
|
78
119
|
readonly keySetId: number;
|
|
@@ -288,7 +329,20 @@ export class GroupSession extends SecureSession {
|
|
|
288
329
|
throw new InternalError("GroupSession does not support decode on instance.");
|
|
289
330
|
}
|
|
290
331
|
|
|
291
|
-
|
|
332
|
+
/**
|
|
333
|
+
* Find the key that authenticates a received group message and decode the message with it. Every key of a mapped
|
|
334
|
+
* key set with the message's session id is a candidate, across all fabrics. A candidate fails when it does not
|
|
335
|
+
* authenticate the message, when GroupKeyMap does not map the message's destination group to a key set holding it,
|
|
336
|
+
* or when the authenticated payload does not parse. The first candidate that passes wins.
|
|
337
|
+
*
|
|
338
|
+
* The message counter is not processed here. The packet must come from {@link MessageCodec.decodePacket}, which
|
|
339
|
+
* guarantees a destination group id and a source node id. A payload that cannot be decrypted with Matter's AES-CCM
|
|
340
|
+
* parameters fails every candidate.
|
|
341
|
+
*
|
|
342
|
+
* @throws GroupSessionDecodeError when no candidate passes
|
|
343
|
+
* @see {@link MatterSpecification.v161.Core} § 4.17.3.6
|
|
344
|
+
*/
|
|
345
|
+
static decodeWithCandidateKeys(
|
|
292
346
|
fabrics: FabricManager,
|
|
293
347
|
{ header, applicationPayload, messageExtension, privacyHeader }: DecodedPacket,
|
|
294
348
|
aad: Bytes,
|
|
@@ -298,137 +352,119 @@ export class GroupSession extends SecureSession {
|
|
|
298
352
|
privacyKey?: Bytes;
|
|
299
353
|
sessionId: number;
|
|
300
354
|
sourceNodeId: NodeId;
|
|
355
|
+
groupId: GroupId;
|
|
301
356
|
keySetId: number;
|
|
302
357
|
fabric: Fabric;
|
|
303
358
|
} {
|
|
304
359
|
if (header.hasMessageExtensions) {
|
|
305
|
-
logger.
|
|
360
|
+
logger.debug(
|
|
306
361
|
`Message extensions are not supported. Ignoring ${messageExtension ? Bytes.toHex(messageExtension) : undefined}`,
|
|
307
362
|
);
|
|
308
363
|
}
|
|
309
364
|
|
|
365
|
+
type CandidateKey = { key: Bytes; privacyKey?: Bytes; keySetId: number; fabric: Fabric };
|
|
310
366
|
const sessionId = header.sessionId;
|
|
311
|
-
const
|
|
312
|
-
const unmappedKeys = new Array<{ key: Bytes; privacyKey?: Bytes; keySetId: number; fabric: Fabric }>();
|
|
367
|
+
const candidates = new Array<CandidateKey>();
|
|
313
368
|
for (const fabric of fabrics) {
|
|
314
369
|
const sessions = fabric.groups.sessions.get(sessionId);
|
|
315
370
|
if (sessions?.length) {
|
|
316
371
|
for (const session of sessions) {
|
|
317
|
-
//
|
|
318
|
-
// Unmapped key sets do not participate in decryption; they only recover the group id for
|
|
319
|
-
// Groupcast testing when nothing is usable.
|
|
372
|
+
// As in the CHIP SDK, a key set that no group maps to is never tried
|
|
320
373
|
if (fabric.groups.isKeySetMapped(session.keySetId)) {
|
|
321
|
-
|
|
322
|
-
} else {
|
|
323
|
-
unmappedKeys.push({ ...session, fabric });
|
|
374
|
+
candidates.push({ ...session, fabric });
|
|
324
375
|
}
|
|
325
376
|
}
|
|
326
377
|
}
|
|
327
378
|
}
|
|
328
379
|
|
|
329
|
-
const messageFlags = Bytes.of(aad)[0];
|
|
330
380
|
const mic = Bytes.of(applicationPayload).slice(-CRYPTO_AEAD_MIC_LENGTH_BYTES);
|
|
331
381
|
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
}
|
|
341
|
-
const privacyNonce = MessagePrivacy.buildNonce(sessionId, mic);
|
|
342
|
-
const deobfuscated = MessagePrivacy.obfuscate(
|
|
343
|
-
candidate.fabric.crypto,
|
|
344
|
-
candidate.privacyKey,
|
|
345
|
-
privacyHeader,
|
|
346
|
-
privacyNonce,
|
|
347
|
-
);
|
|
348
|
-
packetHeader = {
|
|
349
|
-
...header,
|
|
350
|
-
...MessageCodec.decodeObfuscatedHeaderFields(messageFlags, deobfuscated),
|
|
351
|
-
};
|
|
352
|
-
decryptAad = Bytes.concat(Bytes.of(aad).slice(0, 4), deobfuscated);
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
if (packetHeader.sourceNodeId === undefined) {
|
|
356
|
-
throw new UnexpectedDataError("Source Node ID is required for GroupSession decode.");
|
|
382
|
+
/** Deobfuscate the header and decrypt the payload with the key; `undefined` when the key does not authenticate. */
|
|
383
|
+
const authenticate = ({ key, privacyKey, keySetId, fabric }: CandidateKey) => {
|
|
384
|
+
let packetHeader = header;
|
|
385
|
+
let decryptAad = aad;
|
|
386
|
+
if (header.hasPrivacyEnhancements) {
|
|
387
|
+
if (privacyHeader === undefined || privacyKey === undefined) {
|
|
388
|
+
logger.debug(`No privacy key for group session candidate ${keySetId}, skipping`);
|
|
389
|
+
return undefined;
|
|
357
390
|
}
|
|
358
|
-
const
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
391
|
+
const privacyNonce = MessagePrivacy.buildNonce(sessionId, mic);
|
|
392
|
+
const deobfuscated = MessagePrivacy.obfuscate(fabric.crypto, privacyKey, privacyHeader, privacyNonce);
|
|
393
|
+
packetHeader = {
|
|
394
|
+
...header,
|
|
395
|
+
...MessageCodec.decodeObfuscatedHeaderFields(header.messageFlags, deobfuscated),
|
|
396
|
+
};
|
|
397
|
+
decryptAad = Bytes.concat(
|
|
398
|
+
Bytes.of(aad).slice(0, 4),
|
|
399
|
+
deobfuscated,
|
|
400
|
+
Bytes.of(aad).slice(4 + deobfuscated.byteLength),
|
|
362
401
|
);
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
const { sourceNodeId, destGroupId } = packetHeader;
|
|
405
|
+
if (sourceNodeId === undefined) {
|
|
406
|
+
throw new InternalError("Source node id missing although the packet decoder guarantees it");
|
|
407
|
+
}
|
|
408
|
+
if (destGroupId === undefined) {
|
|
409
|
+
throw new InternalError("Destination group id missing although the packet decoder guarantees it");
|
|
410
|
+
}
|
|
411
|
+
const nonce = Session.generateNonce(packetHeader.securityFlags, packetHeader.messageId, sourceNodeId);
|
|
412
|
+
try {
|
|
413
|
+
const payload = fabric.crypto.decrypt(key, applicationPayload, nonce, decryptAad);
|
|
414
|
+
return { packetHeader, payload, sourceNodeId, groupId: GroupId(destGroupId) };
|
|
373
415
|
} catch (error) {
|
|
374
|
-
// A wrong key (including a wrong privacy key, whose garbage header yields a different nonce) fails
|
|
375
|
-
// decryption; skip to the next candidate. Genuine parse errors on an authenticated payload propagate.
|
|
416
|
+
// A wrong key (including a wrong privacy key, whose garbage header yields a different nonce) fails here
|
|
376
417
|
CryptoDecryptError.accept(error);
|
|
377
418
|
}
|
|
378
419
|
};
|
|
379
420
|
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
421
|
+
let group: GroupMessageRejection.Group | undefined;
|
|
422
|
+
// A payload that no key can decrypt fails every candidate; the candidates still count for the report
|
|
423
|
+
const tried = SecureSession.undecryptablePayloadReason(applicationPayload, aad) === undefined ? candidates : [];
|
|
424
|
+
for (const candidate of tried) {
|
|
425
|
+
const authenticated = authenticate(candidate);
|
|
426
|
+
if (authenticated === undefined) {
|
|
427
|
+
continue;
|
|
387
428
|
}
|
|
388
|
-
|
|
429
|
+
const { packetHeader, payload, sourceNodeId, groupId } = authenticated;
|
|
430
|
+
group ??= { groupId, fabricIndex: candidate.fabric.fabricIndex };
|
|
389
431
|
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
throw new GroupSessionNoKeyError(undefined, unmappedAuthentication());
|
|
394
|
-
}
|
|
432
|
+
if (!candidate.fabric.groups.mappingAllows(groupId, candidate.key)) {
|
|
433
|
+
continue;
|
|
434
|
+
}
|
|
395
435
|
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
let found = false;
|
|
403
|
-
for (const candidate of mappedKeys) {
|
|
404
|
-
const decrypted = tryDecrypt(candidate);
|
|
405
|
-
if (decrypted === undefined) {
|
|
436
|
+
let message: DecodedMessage;
|
|
437
|
+
try {
|
|
438
|
+
message = MessageCodec.decodePayload({ header: packetHeader, applicationPayload: payload });
|
|
439
|
+
} catch (error) {
|
|
440
|
+
// As in the CHIP SDK, an authenticated payload that does not parse fails the candidate
|
|
441
|
+
UnexpectedDataError.accept(error);
|
|
406
442
|
continue;
|
|
407
443
|
}
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
if (!found || !message || !key || keySetId === undefined || !fabric || sourceNodeId === undefined) {
|
|
418
|
-
throw new GroupSessionDecodeError();
|
|
444
|
+
|
|
445
|
+
if (message.payloadHeader.hasSecuredExtension) {
|
|
446
|
+
logger.debug(
|
|
447
|
+
`Secured extensions are not supported. Ignoring ${message.securityExtension ? Bytes.toHex(message.securityExtension) : undefined}`,
|
|
448
|
+
);
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
const { key, privacyKey, keySetId, fabric } = candidate;
|
|
452
|
+
return { message, key, privacyKey, sessionId, sourceNodeId, groupId, keySetId, fabric };
|
|
419
453
|
}
|
|
420
454
|
|
|
421
|
-
if (
|
|
422
|
-
|
|
423
|
-
`Secured extensions are not supported. Ignoring ${message.securityExtension ? Bytes.toHex(message.securityExtension) : undefined}`,
|
|
424
|
-
);
|
|
455
|
+
if (group === undefined && header.destGroupId !== undefined) {
|
|
456
|
+
group = { groupId: GroupId(header.destGroupId) };
|
|
425
457
|
}
|
|
426
458
|
|
|
427
|
-
|
|
459
|
+
throw new GroupSessionDecodeError({
|
|
460
|
+
candidateFabrics: new Set(candidates.map(({ fabric }) => fabric.fabricIndex)),
|
|
461
|
+
group,
|
|
462
|
+
});
|
|
428
463
|
}
|
|
429
464
|
|
|
430
465
|
override async close() {
|
|
431
466
|
this.manager?.removeGroupSession(this);
|
|
467
|
+
this.#createdFor.deleteSession(this);
|
|
432
468
|
await super.close();
|
|
433
469
|
}
|
|
434
470
|
}
|
|
@@ -32,8 +32,10 @@ import {
|
|
|
32
32
|
Logger,
|
|
33
33
|
MatterFlowError,
|
|
34
34
|
Mutex,
|
|
35
|
+
Observable,
|
|
35
36
|
Time,
|
|
36
37
|
Timer,
|
|
38
|
+
UnexpectedDataError,
|
|
37
39
|
} from "@matter/general";
|
|
38
40
|
import { CaseAuthenticatedTag, FabricIndex, GlobalFabricId, NodeId } from "@matter/types";
|
|
39
41
|
import { SecureSession } from "./SecureSession.js";
|
|
@@ -65,6 +67,13 @@ export class NodeSession extends SecureSession {
|
|
|
65
67
|
readonly #rolloverClose = new Mutex(this);
|
|
66
68
|
#isPeerLost = false;
|
|
67
69
|
#closingForShutdown = false;
|
|
70
|
+
#isEstablishing: boolean;
|
|
71
|
+
readonly #established = Observable<[]>(error =>
|
|
72
|
+
logger.warn(this.via, "Error in an observer of session establishment:", error),
|
|
73
|
+
);
|
|
74
|
+
readonly #superseded = Observable<[newer: NodeSession]>(error =>
|
|
75
|
+
logger.warn(this.via, "Error in an observer of session supersession:", error),
|
|
76
|
+
);
|
|
68
77
|
|
|
69
78
|
// TODO - remove this; subscriptions should be owned by the peer, not the session
|
|
70
79
|
readonly #subscriptions = new BasicSet<Subscription>();
|
|
@@ -111,6 +120,7 @@ export class NodeSession extends SecureSession {
|
|
|
111
120
|
caseAuthenticatedTags,
|
|
112
121
|
isInitiator,
|
|
113
122
|
delayManagerRegistration,
|
|
123
|
+
establishing,
|
|
114
124
|
suppressPeerLoss = false,
|
|
115
125
|
reportedSessionParameters,
|
|
116
126
|
} = config;
|
|
@@ -135,6 +145,7 @@ export class NodeSession extends SecureSession {
|
|
|
135
145
|
this.#caseAuthenticatedTags = caseAuthenticatedTags ?? [];
|
|
136
146
|
this.#reportedParameters = SessionParameters.reported(reportedSessionParameters);
|
|
137
147
|
this.#isInitiator = isInitiator;
|
|
148
|
+
this.#isEstablishing = establishing === true;
|
|
138
149
|
|
|
139
150
|
if (this.maxTcpMessageSize !== undefined && this.#reportedParameters?.maxTcpMessageSize === 0) {
|
|
140
151
|
logger.info(
|
|
@@ -150,7 +161,7 @@ export class NodeSession extends SecureSession {
|
|
|
150
161
|
);
|
|
151
162
|
|
|
152
163
|
if (!delayManagerRegistration) {
|
|
153
|
-
manager?.
|
|
164
|
+
manager?.registeredSessions.add(this);
|
|
154
165
|
}
|
|
155
166
|
fabric?.addSession(this);
|
|
156
167
|
}
|
|
@@ -195,6 +206,67 @@ export class NodeSession extends SecureSession {
|
|
|
195
206
|
return this.#isInitiator;
|
|
196
207
|
}
|
|
197
208
|
|
|
209
|
+
/**
|
|
210
|
+
* Whether the handshake of this session still has to complete. Only a CASE responder creates a session in this
|
|
211
|
+
* state. A resumed session is established once the peer's SigmaFinished arrives, a new one once our SigmaFinished
|
|
212
|
+
* went out for the first time.
|
|
213
|
+
*
|
|
214
|
+
* | State | Entered by | `SessionManager.sessions` | Eviction | Supersession |
|
|
215
|
+
* | ------------ | -------------------------------------------------- | ------------------------- | -------------------- | ------------------------ |
|
|
216
|
+
* | establishing | creation with `establishing: true` | absent | not counted | neither side |
|
|
217
|
+
* | established | creation without it, {@link completeEstablishment} | present | counted, evictable | supersedes, superseded |
|
|
218
|
+
*
|
|
219
|
+
* Closing ({@link isClosing}) is a flag on top of both states. A closing session is skipped by `maybeSessionFor`,
|
|
220
|
+
* is never superseded and is not evicted again. A closing established session still counts for eviction, a
|
|
221
|
+
* closing establishing session does not. Eviction counts only sessions the peer initiated (we are the responder).
|
|
222
|
+
*
|
|
223
|
+
* The session is in `SessionManager.registeredSessions` and receives messages in every state until it is closed.
|
|
224
|
+
* Unlike the CHIP SDK, which drops messages on a session before it is established, we process them: our
|
|
225
|
+
* controller starts interactions right after it sent SigmaFinished, before the device acknowledged it.
|
|
226
|
+
*
|
|
227
|
+
* @see {@link MatterSpecification.v161.Core} § 4.14.2.3.13
|
|
228
|
+
*/
|
|
229
|
+
get isEstablishing() {
|
|
230
|
+
return this.#isEstablishing;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Mark the handshake as complete and emit {@link established}, which also adds the session to
|
|
235
|
+
* `SessionManager.sessions`. Observers see {@link isEstablishing} as false. An observer that throws is logged, and
|
|
236
|
+
* the other observers still run, so a caller inside a send is not interrupted.
|
|
237
|
+
*
|
|
238
|
+
* @returns true if the session is established, also when it already was and is closing now; false if it is
|
|
239
|
+
* closing and therefore stays establishing
|
|
240
|
+
*/
|
|
241
|
+
completeEstablishment() {
|
|
242
|
+
if (!this.#isEstablishing) {
|
|
243
|
+
return true;
|
|
244
|
+
}
|
|
245
|
+
if (this.isClosing) {
|
|
246
|
+
return false;
|
|
247
|
+
}
|
|
248
|
+
this.#isEstablishing = false;
|
|
249
|
+
this.#established.emit();
|
|
250
|
+
return true;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/** Emits once, when {@link completeEstablishment} marks the session established. */
|
|
254
|
+
get established() {
|
|
255
|
+
return this.#established;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Emits when {@link newer}, an established CASE session with the same peer and equal CASE Authenticated Tags,
|
|
260
|
+
* replaces this session for the peer's subscriptions. The role of either session does not matter. Each
|
|
261
|
+
* subscription on this session then continues on {@link newer}, and the session itself stays open.
|
|
262
|
+
*
|
|
263
|
+
* The move matches `SecureSessionTable::NewerSessionAvailable` of the CHIP SDK. A peer that sets up a new session
|
|
264
|
+
* may drop its older ones without telling us, so reports on an older session may never arrive.
|
|
265
|
+
*/
|
|
266
|
+
get superseded() {
|
|
267
|
+
return this.#superseded;
|
|
268
|
+
}
|
|
269
|
+
|
|
198
270
|
subjectFor(_message?: Message): Subject {
|
|
199
271
|
return Subject.Node({
|
|
200
272
|
id: this.peerNodeId,
|
|
@@ -202,9 +274,19 @@ export class NodeSession extends SecureSession {
|
|
|
202
274
|
});
|
|
203
275
|
}
|
|
204
276
|
|
|
277
|
+
/**
|
|
278
|
+
* Decrypt and decode a received message.
|
|
279
|
+
*
|
|
280
|
+
* @throws UnexpectedDataError when the payload cannot be decrypted with Matter's AES-CCM parameters or does not parse
|
|
281
|
+
* @throws CryptoDecryptError when the payload does not authenticate with this session's key
|
|
282
|
+
*/
|
|
205
283
|
decode({ header, applicationPayload, messageExtension }: DecodedPacket, aad: Bytes): DecodedMessage {
|
|
284
|
+
const undecryptable = SecureSession.undecryptablePayloadReason(applicationPayload, aad);
|
|
285
|
+
if (undecryptable !== undefined) {
|
|
286
|
+
throw new UnexpectedDataError(`Secured message cannot be decrypted: ${undecryptable}`);
|
|
287
|
+
}
|
|
206
288
|
if (header.hasMessageExtensions) {
|
|
207
|
-
logger.
|
|
289
|
+
logger.debug(
|
|
208
290
|
`Message extensions are not supported. Ignoring ${messageExtension ? Bytes.toHex(messageExtension) : undefined}`,
|
|
209
291
|
);
|
|
210
292
|
}
|
|
@@ -215,7 +297,7 @@ export class NodeSession extends SecureSession {
|
|
|
215
297
|
});
|
|
216
298
|
|
|
217
299
|
if (message.payloadHeader.hasSecuredExtension) {
|
|
218
|
-
logger.
|
|
300
|
+
logger.debug(
|
|
219
301
|
`Secured extensions are not supported. Ignoring ${message.securityExtension ? Bytes.toHex(message.securityExtension) : undefined}`,
|
|
220
302
|
);
|
|
221
303
|
}
|
|
@@ -418,7 +500,7 @@ export class NodeSession extends SecureSession {
|
|
|
418
500
|
this.#fabric?.deleteSession(this);
|
|
419
501
|
await super.close();
|
|
420
502
|
|
|
421
|
-
this.manager?.
|
|
503
|
+
this.manager?.registeredSessions.delete(this);
|
|
422
504
|
}
|
|
423
505
|
|
|
424
506
|
/**
|
|
@@ -487,6 +569,9 @@ export namespace NodeSession {
|
|
|
487
569
|
/** @see {@link NodeSession.suppressPeerLoss} */
|
|
488
570
|
suppressPeerLoss?: boolean;
|
|
489
571
|
|
|
572
|
+
/** Create the session in the establishing state, see {@link NodeSession.isEstablishing}. */
|
|
573
|
+
establishing?: true;
|
|
574
|
+
|
|
490
575
|
/** @see {@link NodeSession.reportedParameters} */
|
|
491
576
|
reportedSessionParameters?: SessionParameters.Config;
|
|
492
577
|
}
|
|
@@ -8,7 +8,13 @@ import type { Subject } from "#action/server/Subject.js";
|
|
|
8
8
|
import type { Message } from "#codec/MessageCodec.js";
|
|
9
9
|
import type { Fabric } from "#fabric/Fabric.js";
|
|
10
10
|
import type { PeerAddress } from "#peer/PeerAddress.js";
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
Bytes,
|
|
13
|
+
CRYPTO_AEAD_MAX_AAD_LENGTH_BYTES,
|
|
14
|
+
CRYPTO_AEAD_MAX_CIPHERTEXT_LENGTH_BYTES,
|
|
15
|
+
CRYPTO_AEAD_MIC_LENGTH_BYTES,
|
|
16
|
+
MatterFlowError,
|
|
17
|
+
} from "@matter/general";
|
|
12
18
|
import { Session } from "./Session.js";
|
|
13
19
|
|
|
14
20
|
export abstract class SecureSession extends Session {
|
|
@@ -16,9 +22,29 @@ export abstract class SecureSession extends Session {
|
|
|
16
22
|
abstract fabric: Fabric | undefined;
|
|
17
23
|
abstract peerAddress: PeerAddress;
|
|
18
24
|
abstract subjectFor(message?: Message): Subject;
|
|
25
|
+
|
|
26
|
+
/** Whether the handshake of this session still has to complete. */
|
|
27
|
+
abstract readonly isEstablishing: boolean;
|
|
19
28
|
}
|
|
20
29
|
|
|
21
30
|
export namespace SecureSession {
|
|
31
|
+
/**
|
|
32
|
+
* Why a received payload cannot be decrypted within the AES-CCM limits of `@matter/general`, or `undefined` when it
|
|
33
|
+
* can. A session checks this before it decrypts, so a peer cannot cause the `CryptoInputError` that
|
|
34
|
+
* `Crypto.decrypt` throws for input outside those limits.
|
|
35
|
+
*/
|
|
36
|
+
export function undecryptablePayloadReason(payload: Bytes, aad: Bytes): string | undefined {
|
|
37
|
+
if (payload.byteLength < CRYPTO_AEAD_MIC_LENGTH_BYTES) {
|
|
38
|
+
return `payload of ${payload.byteLength} bytes is shorter than the MIC`;
|
|
39
|
+
}
|
|
40
|
+
if (payload.byteLength > CRYPTO_AEAD_MAX_CIPHERTEXT_LENGTH_BYTES) {
|
|
41
|
+
return `payload of ${payload.byteLength} bytes exceeds the AES-CCM limit`;
|
|
42
|
+
}
|
|
43
|
+
if (aad.byteLength > CRYPTO_AEAD_MAX_AAD_LENGTH_BYTES) {
|
|
44
|
+
return `header of ${aad.byteLength} bytes exceeds the AES-CCM limit`;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
22
48
|
export function assert(session?: Session, errorText?: string): asserts session is SecureSession {
|
|
23
49
|
if (!session?.isSecure) {
|
|
24
50
|
throw new MatterFlowError(errorText ?? "Unsecured session in secure context");
|
package/src/session/Session.ts
CHANGED
|
@@ -56,7 +56,7 @@ export abstract class Session {
|
|
|
56
56
|
/** Last message sent or received, on the clock of {@link Time.nowUs}. */
|
|
57
57
|
timestamp = Time.nowUs;
|
|
58
58
|
|
|
59
|
-
/** Creation time on the clock of {@link Time.nowUs}
|
|
59
|
+
/** Creation time on the clock of {@link Time.nowUs}. */
|
|
60
60
|
readonly createdAt = Time.nowUs;
|
|
61
61
|
|
|
62
62
|
/**
|
|
@@ -461,7 +461,7 @@ export namespace Session {
|
|
|
461
461
|
|
|
462
462
|
/**
|
|
463
463
|
* When setting this to true the session is not automatically registered to a provided session manager.
|
|
464
|
-
* You need to
|
|
464
|
+
* You need to add it to {@link SessionManager.registeredSessions} yourself.
|
|
465
465
|
*/
|
|
466
466
|
delayManagerRegistration?: true;
|
|
467
467
|
channel?: Channel<Bytes>;
|