@matter/protocol 0.16.0-alpha.0-20250812-285b75d83 → 0.16.0-alpha.0-20250815-ac9fd6eb0
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/advertisement/ble/BleAdvertisement.js +1 -1
- package/dist/cjs/advertisement/ble/BleAdvertiser.d.ts +2 -2
- package/dist/cjs/advertisement/ble/BleAdvertiser.d.ts.map +1 -1
- package/dist/cjs/ble/Ble.d.ts +2 -2
- package/dist/cjs/ble/Ble.d.ts.map +1 -1
- package/dist/cjs/ble/Ble.js.map +1 -1
- package/dist/cjs/ble/BtpSessionHandler.d.ts +6 -6
- package/dist/cjs/ble/BtpSessionHandler.d.ts.map +1 -1
- package/dist/cjs/ble/BtpSessionHandler.js +9 -9
- package/dist/cjs/ble/BtpSessionHandler.js.map +1 -1
- package/dist/cjs/certificate/AttestationCertificateManager.d.ts +5 -5
- package/dist/cjs/certificate/AttestationCertificateManager.d.ts.map +1 -1
- package/dist/cjs/certificate/AttestationCertificateManager.js +2 -2
- package/dist/cjs/certificate/AttestationCertificateManager.js.map +1 -1
- package/dist/cjs/certificate/CertificateAuthority.d.ts +5 -5
- package/dist/cjs/certificate/CertificateAuthority.d.ts.map +1 -1
- package/dist/cjs/certificate/CertificateAuthority.js +6 -3
- package/dist/cjs/certificate/CertificateAuthority.js.map +1 -1
- package/dist/cjs/certificate/ChipPAAuthorities.d.ts +8 -8
- package/dist/cjs/certificate/DeviceCertification.d.ts +9 -9
- package/dist/cjs/certificate/DeviceCertification.d.ts.map +1 -1
- package/dist/cjs/certificate/DeviceCertification.js +2 -3
- package/dist/cjs/certificate/DeviceCertification.js.map +1 -1
- package/dist/cjs/certificate/kinds/AttestationCertificates.d.ts +1 -1
- package/dist/cjs/certificate/kinds/AttestationCertificates.d.ts.map +1 -1
- package/dist/cjs/certificate/kinds/AttestationCertificates.js.map +1 -1
- package/dist/cjs/certificate/kinds/CertificationDeclaration.d.ts +4 -4
- package/dist/cjs/certificate/kinds/CertificationDeclaration.d.ts.map +1 -1
- package/dist/cjs/certificate/kinds/CertificationDeclaration.js.map +1 -1
- package/dist/cjs/certificate/kinds/Icac.d.ts +3 -3
- package/dist/cjs/certificate/kinds/Icac.d.ts.map +1 -1
- package/dist/cjs/certificate/kinds/Icac.js +2 -2
- package/dist/cjs/certificate/kinds/Icac.js.map +1 -1
- package/dist/cjs/certificate/kinds/Noc.d.ts +3 -3
- package/dist/cjs/certificate/kinds/Noc.d.ts.map +1 -1
- package/dist/cjs/certificate/kinds/Noc.js +2 -2
- package/dist/cjs/certificate/kinds/Noc.js.map +1 -1
- package/dist/cjs/certificate/kinds/OperationalBase.d.ts +2 -1
- package/dist/cjs/certificate/kinds/OperationalBase.d.ts.map +1 -1
- package/dist/cjs/certificate/kinds/OperationalBase.js +2 -2
- package/dist/cjs/certificate/kinds/OperationalBase.js.map +1 -1
- package/dist/cjs/certificate/kinds/Rcac.d.ts +3 -3
- package/dist/cjs/certificate/kinds/Rcac.d.ts.map +1 -1
- package/dist/cjs/certificate/kinds/Rcac.js +2 -2
- package/dist/cjs/certificate/kinds/Rcac.js.map +1 -1
- package/dist/cjs/certificate/kinds/X509Base.d.ts +11 -11
- package/dist/cjs/certificate/kinds/X509Base.d.ts.map +1 -1
- package/dist/cjs/certificate/kinds/X509Base.js +1 -1
- package/dist/cjs/certificate/kinds/X509Base.js.map +1 -1
- package/dist/cjs/certificate/kinds/common.d.ts +2 -2
- package/dist/cjs/certificate/kinds/common.d.ts.map +1 -1
- package/dist/cjs/certificate/kinds/common.js +2 -2
- package/dist/cjs/certificate/kinds/common.js.map +1 -1
- package/dist/cjs/certificate/kinds/definitions/base.d.ts +7 -6
- package/dist/cjs/certificate/kinds/definitions/base.d.ts.map +1 -1
- package/dist/cjs/certificate/kinds/definitions/base.js.map +1 -1
- package/dist/cjs/certificate/kinds/definitions/certification-declaration.d.ts +1 -1
- package/dist/cjs/certificate/kinds/definitions/operational.d.ts +21 -21
- package/dist/cjs/codec/BtpCodec.d.ts +12 -11
- package/dist/cjs/codec/BtpCodec.d.ts.map +1 -1
- package/dist/cjs/codec/BtpCodec.js +1 -1
- package/dist/cjs/codec/BtpCodec.js.map +1 -1
- package/dist/cjs/codec/MessageCodec.d.ts +8 -8
- package/dist/cjs/codec/MessageCodec.d.ts.map +1 -1
- package/dist/cjs/codec/MessageCodec.js +2 -2
- package/dist/cjs/codec/MessageCodec.js.map +1 -1
- package/dist/cjs/common/FailsafeContext.d.ts +8 -8
- package/dist/cjs/common/FailsafeContext.d.ts.map +1 -1
- package/dist/cjs/common/FailsafeContext.js.map +1 -1
- package/dist/cjs/common/OperationalCredentialsTypes.d.ts +8 -8
- package/dist/cjs/fabric/Fabric.d.ts +27 -27
- package/dist/cjs/fabric/Fabric.d.ts.map +1 -1
- package/dist/cjs/fabric/Fabric.js +3 -6
- package/dist/cjs/fabric/Fabric.js.map +1 -1
- package/dist/cjs/fabric/FabricManager.d.ts +2 -2
- package/dist/cjs/fabric/FabricManager.d.ts.map +1 -1
- package/dist/cjs/fabric/FabricManager.js.map +1 -1
- package/dist/cjs/groups/FabricGroups.d.ts +4 -4
- package/dist/cjs/groups/FabricGroups.d.ts.map +1 -1
- package/dist/cjs/groups/Groups.d.ts +1 -1
- package/dist/cjs/groups/KeySets.d.ts +12 -12
- package/dist/cjs/groups/KeySets.d.ts.map +1 -1
- package/dist/cjs/groups/KeySets.js.map +1 -1
- package/dist/cjs/groups/MessagingState.d.ts +4 -4
- package/dist/cjs/groups/MessagingState.d.ts.map +1 -1
- package/dist/cjs/groups/MessagingState.js.map +1 -1
- package/dist/cjs/interaction/InteractionMessenger.d.ts +3 -2
- package/dist/cjs/interaction/InteractionMessenger.d.ts.map +1 -1
- package/dist/cjs/interaction/InteractionMessenger.js +9 -9
- package/dist/cjs/interaction/InteractionMessenger.js.map +1 -1
- package/dist/cjs/mdns/MdnsClient.d.ts +2 -2
- package/dist/cjs/mdns/MdnsClient.d.ts.map +1 -1
- package/dist/cjs/mdns/MdnsClient.js.map +1 -1
- package/dist/cjs/mdns/MdnsSocket.d.ts.map +1 -1
- package/dist/cjs/mdns/MdnsSocket.js +5 -5
- package/dist/cjs/mdns/MdnsSocket.js.map +1 -1
- package/dist/cjs/peer/ControllerCommissioner.d.ts.map +1 -1
- package/dist/cjs/peer/ControllerCommissioner.js.map +1 -1
- package/dist/cjs/peer/ControllerCommissioningFlow.js +2 -2
- package/dist/cjs/peer/ControllerCommissioningFlow.js.map +1 -1
- package/dist/cjs/protocol/ChannelManager.d.ts +2 -2
- package/dist/cjs/protocol/ChannelManager.d.ts.map +1 -1
- package/dist/cjs/protocol/ChannelManager.js.map +1 -1
- package/dist/cjs/protocol/ExchangeManager.d.ts.map +1 -1
- package/dist/cjs/protocol/ExchangeManager.js +4 -3
- package/dist/cjs/protocol/ExchangeManager.js.map +1 -1
- package/dist/cjs/protocol/MessageChannel.d.ts +3 -3
- package/dist/cjs/protocol/MessageChannel.d.ts.map +1 -1
- package/dist/cjs/protocol/MessageChannel.js +2 -2
- package/dist/cjs/protocol/MessageChannel.js.map +1 -1
- package/dist/cjs/protocol/MessageExchange.d.ts +2 -2
- package/dist/cjs/protocol/MessageExchange.d.ts.map +1 -1
- package/dist/cjs/protocol/MessageExchange.js.map +1 -1
- package/dist/cjs/protocol/ProtocolStatusMessage.d.ts +6 -5
- package/dist/cjs/protocol/ProtocolStatusMessage.d.ts.map +1 -1
- package/dist/cjs/protocol/ProtocolStatusMessage.js +1 -1
- package/dist/cjs/protocol/ProtocolStatusMessage.js.map +1 -1
- package/dist/cjs/securechannel/SecureChannelMessenger.d.ts +1 -1
- package/dist/cjs/session/GroupSession.d.ts +5 -4
- package/dist/cjs/session/GroupSession.d.ts.map +1 -1
- package/dist/cjs/session/GroupSession.js.map +1 -1
- package/dist/cjs/session/InsecureSession.d.ts +1 -1
- package/dist/cjs/session/InsecureSession.d.ts.map +1 -1
- package/dist/cjs/session/InsecureSession.js.map +1 -1
- package/dist/cjs/session/NodeSession.d.ts +8 -8
- package/dist/cjs/session/NodeSession.d.ts.map +1 -1
- package/dist/cjs/session/NodeSession.js +7 -5
- package/dist/cjs/session/NodeSession.js.map +1 -1
- package/dist/cjs/session/Session.d.ts +4 -4
- package/dist/cjs/session/Session.d.ts.map +1 -1
- package/dist/cjs/session/Session.js.map +1 -1
- package/dist/cjs/session/SessionManager.d.ts +8 -8
- package/dist/cjs/session/SessionManager.d.ts.map +1 -1
- package/dist/cjs/session/SessionManager.js +1 -2
- package/dist/cjs/session/SessionManager.js.map +1 -1
- package/dist/cjs/session/case/CaseMessages.d.ts +30 -30
- package/dist/cjs/session/case/CaseMessages.d.ts.map +1 -1
- package/dist/cjs/session/case/CaseMessenger.d.ts +18 -18
- package/dist/cjs/session/pase/PaseClient.d.ts +1 -1
- package/dist/cjs/session/pase/PaseMessages.d.ts +8 -8
- package/dist/cjs/session/pase/PaseMessenger.d.ts +16 -16
- package/dist/cjs/session/pase/PaseMessenger.d.ts.map +1 -1
- package/dist/cjs/session/pase/PaseServer.d.ts +3 -3
- package/dist/cjs/session/pase/PaseServer.d.ts.map +1 -1
- package/dist/cjs/session/pase/PaseServer.js +3 -2
- package/dist/cjs/session/pase/PaseServer.js.map +1 -1
- package/dist/esm/advertisement/ble/BleAdvertisement.js +1 -1
- package/dist/esm/advertisement/ble/BleAdvertiser.d.ts +2 -2
- package/dist/esm/advertisement/ble/BleAdvertiser.d.ts.map +1 -1
- package/dist/esm/ble/Ble.d.ts +2 -2
- package/dist/esm/ble/Ble.d.ts.map +1 -1
- package/dist/esm/ble/Ble.js.map +1 -1
- package/dist/esm/ble/BtpSessionHandler.d.ts +6 -6
- package/dist/esm/ble/BtpSessionHandler.d.ts.map +1 -1
- package/dist/esm/ble/BtpSessionHandler.js +9 -9
- package/dist/esm/ble/BtpSessionHandler.js.map +1 -1
- package/dist/esm/certificate/AttestationCertificateManager.d.ts +5 -5
- package/dist/esm/certificate/AttestationCertificateManager.d.ts.map +1 -1
- package/dist/esm/certificate/AttestationCertificateManager.js +2 -2
- package/dist/esm/certificate/AttestationCertificateManager.js.map +1 -1
- package/dist/esm/certificate/CertificateAuthority.d.ts +5 -5
- package/dist/esm/certificate/CertificateAuthority.d.ts.map +1 -1
- package/dist/esm/certificate/CertificateAuthority.js +6 -3
- package/dist/esm/certificate/CertificateAuthority.js.map +1 -1
- package/dist/esm/certificate/ChipPAAuthorities.d.ts +8 -8
- package/dist/esm/certificate/DeviceCertification.d.ts +9 -9
- package/dist/esm/certificate/DeviceCertification.d.ts.map +1 -1
- package/dist/esm/certificate/DeviceCertification.js +3 -4
- package/dist/esm/certificate/DeviceCertification.js.map +1 -1
- package/dist/esm/certificate/kinds/AttestationCertificates.d.ts +1 -1
- package/dist/esm/certificate/kinds/AttestationCertificates.d.ts.map +1 -1
- package/dist/esm/certificate/kinds/AttestationCertificates.js.map +1 -1
- package/dist/esm/certificate/kinds/CertificationDeclaration.d.ts +4 -4
- package/dist/esm/certificate/kinds/CertificationDeclaration.d.ts.map +1 -1
- package/dist/esm/certificate/kinds/CertificationDeclaration.js.map +1 -1
- package/dist/esm/certificate/kinds/Icac.d.ts +3 -3
- package/dist/esm/certificate/kinds/Icac.d.ts.map +1 -1
- package/dist/esm/certificate/kinds/Icac.js +2 -2
- package/dist/esm/certificate/kinds/Icac.js.map +1 -1
- package/dist/esm/certificate/kinds/Noc.d.ts +3 -3
- package/dist/esm/certificate/kinds/Noc.d.ts.map +1 -1
- package/dist/esm/certificate/kinds/Noc.js +2 -2
- package/dist/esm/certificate/kinds/Noc.js.map +1 -1
- package/dist/esm/certificate/kinds/OperationalBase.d.ts +2 -1
- package/dist/esm/certificate/kinds/OperationalBase.d.ts.map +1 -1
- package/dist/esm/certificate/kinds/OperationalBase.js +2 -2
- package/dist/esm/certificate/kinds/OperationalBase.js.map +1 -1
- package/dist/esm/certificate/kinds/Rcac.d.ts +3 -3
- package/dist/esm/certificate/kinds/Rcac.d.ts.map +1 -1
- package/dist/esm/certificate/kinds/Rcac.js +2 -2
- package/dist/esm/certificate/kinds/Rcac.js.map +1 -1
- package/dist/esm/certificate/kinds/X509Base.d.ts +11 -11
- package/dist/esm/certificate/kinds/X509Base.d.ts.map +1 -1
- package/dist/esm/certificate/kinds/X509Base.js +1 -1
- package/dist/esm/certificate/kinds/X509Base.js.map +1 -1
- package/dist/esm/certificate/kinds/common.d.ts +2 -2
- package/dist/esm/certificate/kinds/common.d.ts.map +1 -1
- package/dist/esm/certificate/kinds/common.js +2 -2
- package/dist/esm/certificate/kinds/common.js.map +1 -1
- package/dist/esm/certificate/kinds/definitions/base.d.ts +7 -6
- package/dist/esm/certificate/kinds/definitions/base.d.ts.map +1 -1
- package/dist/esm/certificate/kinds/definitions/base.js.map +1 -1
- package/dist/esm/certificate/kinds/definitions/certification-declaration.d.ts +1 -1
- package/dist/esm/certificate/kinds/definitions/operational.d.ts +21 -21
- package/dist/esm/codec/BtpCodec.d.ts +12 -11
- package/dist/esm/codec/BtpCodec.d.ts.map +1 -1
- package/dist/esm/codec/BtpCodec.js +1 -1
- package/dist/esm/codec/BtpCodec.js.map +1 -1
- package/dist/esm/codec/MessageCodec.d.ts +8 -8
- package/dist/esm/codec/MessageCodec.d.ts.map +1 -1
- package/dist/esm/codec/MessageCodec.js +2 -2
- package/dist/esm/codec/MessageCodec.js.map +1 -1
- package/dist/esm/common/FailsafeContext.d.ts +8 -8
- package/dist/esm/common/FailsafeContext.d.ts.map +1 -1
- package/dist/esm/common/FailsafeContext.js.map +1 -1
- package/dist/esm/common/OperationalCredentialsTypes.d.ts +8 -8
- package/dist/esm/fabric/Fabric.d.ts +27 -27
- package/dist/esm/fabric/Fabric.d.ts.map +1 -1
- package/dist/esm/fabric/Fabric.js +3 -6
- package/dist/esm/fabric/Fabric.js.map +1 -1
- package/dist/esm/fabric/FabricManager.d.ts +2 -2
- package/dist/esm/fabric/FabricManager.d.ts.map +1 -1
- package/dist/esm/fabric/FabricManager.js.map +1 -1
- package/dist/esm/groups/FabricGroups.d.ts +4 -4
- package/dist/esm/groups/FabricGroups.d.ts.map +1 -1
- package/dist/esm/groups/Groups.d.ts +1 -1
- package/dist/esm/groups/KeySets.d.ts +12 -12
- package/dist/esm/groups/KeySets.d.ts.map +1 -1
- package/dist/esm/groups/KeySets.js.map +1 -1
- package/dist/esm/groups/MessagingState.d.ts +4 -4
- package/dist/esm/groups/MessagingState.d.ts.map +1 -1
- package/dist/esm/groups/MessagingState.js.map +1 -1
- package/dist/esm/interaction/InteractionMessenger.d.ts +3 -2
- package/dist/esm/interaction/InteractionMessenger.d.ts.map +1 -1
- package/dist/esm/interaction/InteractionMessenger.js +9 -9
- package/dist/esm/interaction/InteractionMessenger.js.map +1 -1
- package/dist/esm/mdns/MdnsClient.d.ts +2 -2
- package/dist/esm/mdns/MdnsClient.d.ts.map +1 -1
- package/dist/esm/mdns/MdnsClient.js.map +1 -1
- package/dist/esm/mdns/MdnsSocket.d.ts.map +1 -1
- package/dist/esm/mdns/MdnsSocket.js +5 -5
- package/dist/esm/mdns/MdnsSocket.js.map +1 -1
- package/dist/esm/peer/ControllerCommissioner.d.ts.map +1 -1
- package/dist/esm/peer/ControllerCommissioner.js.map +1 -1
- package/dist/esm/peer/ControllerCommissioningFlow.js +2 -2
- package/dist/esm/peer/ControllerCommissioningFlow.js.map +1 -1
- package/dist/esm/protocol/ChannelManager.d.ts +2 -2
- package/dist/esm/protocol/ChannelManager.d.ts.map +1 -1
- package/dist/esm/protocol/ChannelManager.js.map +1 -1
- package/dist/esm/protocol/ExchangeManager.d.ts.map +1 -1
- package/dist/esm/protocol/ExchangeManager.js +5 -3
- package/dist/esm/protocol/ExchangeManager.js.map +1 -1
- package/dist/esm/protocol/MessageChannel.d.ts +3 -3
- package/dist/esm/protocol/MessageChannel.d.ts.map +1 -1
- package/dist/esm/protocol/MessageChannel.js +2 -2
- package/dist/esm/protocol/MessageChannel.js.map +1 -1
- package/dist/esm/protocol/MessageExchange.d.ts +2 -2
- package/dist/esm/protocol/MessageExchange.d.ts.map +1 -1
- package/dist/esm/protocol/MessageExchange.js.map +1 -1
- package/dist/esm/protocol/ProtocolStatusMessage.d.ts +6 -5
- package/dist/esm/protocol/ProtocolStatusMessage.d.ts.map +1 -1
- package/dist/esm/protocol/ProtocolStatusMessage.js +1 -1
- package/dist/esm/protocol/ProtocolStatusMessage.js.map +1 -1
- package/dist/esm/securechannel/SecureChannelMessenger.d.ts +1 -1
- package/dist/esm/session/GroupSession.d.ts +5 -4
- package/dist/esm/session/GroupSession.d.ts.map +1 -1
- package/dist/esm/session/GroupSession.js.map +1 -1
- package/dist/esm/session/InsecureSession.d.ts +1 -1
- package/dist/esm/session/InsecureSession.d.ts.map +1 -1
- package/dist/esm/session/InsecureSession.js.map +1 -1
- package/dist/esm/session/NodeSession.d.ts +8 -8
- package/dist/esm/session/NodeSession.d.ts.map +1 -1
- package/dist/esm/session/NodeSession.js +7 -5
- package/dist/esm/session/NodeSession.js.map +1 -1
- package/dist/esm/session/Session.d.ts +4 -4
- package/dist/esm/session/Session.d.ts.map +1 -1
- package/dist/esm/session/Session.js.map +1 -1
- package/dist/esm/session/SessionManager.d.ts +8 -8
- package/dist/esm/session/SessionManager.d.ts.map +1 -1
- package/dist/esm/session/SessionManager.js +1 -2
- package/dist/esm/session/SessionManager.js.map +1 -1
- package/dist/esm/session/case/CaseMessages.d.ts +30 -30
- package/dist/esm/session/case/CaseMessages.d.ts.map +1 -1
- package/dist/esm/session/case/CaseMessenger.d.ts +18 -18
- package/dist/esm/session/pase/PaseClient.d.ts +1 -1
- package/dist/esm/session/pase/PaseMessages.d.ts +8 -8
- package/dist/esm/session/pase/PaseMessenger.d.ts +16 -16
- package/dist/esm/session/pase/PaseMessenger.d.ts.map +1 -1
- package/dist/esm/session/pase/PaseServer.d.ts +3 -3
- package/dist/esm/session/pase/PaseServer.d.ts.map +1 -1
- package/dist/esm/session/pase/PaseServer.js +3 -2
- package/dist/esm/session/pase/PaseServer.js.map +1 -1
- package/package.json +6 -6
- package/src/advertisement/ble/BleAdvertisement.ts +1 -1
- package/src/advertisement/ble/BleAdvertiser.ts +1 -1
- package/src/ble/Ble.ts +2 -2
- package/src/ble/BtpSessionHandler.ts +20 -20
- package/src/certificate/AttestationCertificateManager.ts +5 -5
- package/src/certificate/CertificateAuthority.ts +14 -11
- package/src/certificate/DeviceCertification.ts +11 -13
- package/src/certificate/kinds/AttestationCertificates.ts +1 -1
- package/src/certificate/kinds/CertificationDeclaration.ts +3 -6
- package/src/certificate/kinds/Icac.ts +3 -3
- package/src/certificate/kinds/Noc.ts +3 -3
- package/src/certificate/kinds/OperationalBase.ts +4 -4
- package/src/certificate/kinds/Rcac.ts +3 -3
- package/src/certificate/kinds/X509Base.ts +7 -7
- package/src/certificate/kinds/common.ts +4 -4
- package/src/certificate/kinds/definitions/base.ts +7 -6
- package/src/codec/BtpCodec.ts +13 -13
- package/src/codec/MessageCodec.ts +10 -10
- package/src/common/FailsafeContext.ts +6 -5
- package/src/fabric/Fabric.ts +31 -34
- package/src/fabric/FabricManager.ts +1 -1
- package/src/groups/KeySets.ts +6 -6
- package/src/groups/MessagingState.ts +3 -3
- package/src/interaction/InteractionMessenger.ts +12 -11
- package/src/mdns/MdnsClient.ts +2 -2
- package/src/mdns/MdnsSocket.ts +7 -6
- package/src/peer/ControllerCommissioner.ts +2 -1
- package/src/peer/ControllerCommissioningFlow.ts +5 -5
- package/src/protocol/ChannelManager.ts +3 -3
- package/src/protocol/ExchangeManager.ts +7 -5
- package/src/protocol/MessageChannel.ts +4 -4
- package/src/protocol/MessageExchange.ts +2 -1
- package/src/protocol/ProtocolStatusMessage.ts +6 -6
- package/src/session/GroupSession.ts +7 -7
- package/src/session/InsecureSession.ts +1 -1
- package/src/session/NodeSession.ts +17 -15
- package/src/session/Session.ts +3 -3
- package/src/session/SessionManager.ts +9 -10
- package/src/session/case/CaseServer.ts +8 -8
- package/src/session/pase/PaseServer.ts +5 -4
|
@@ -46,8 +46,8 @@ export interface PayloadHeader {
|
|
|
46
46
|
|
|
47
47
|
export interface Packet {
|
|
48
48
|
header: PacketHeader;
|
|
49
|
-
messageExtension?:
|
|
50
|
-
applicationPayload:
|
|
49
|
+
messageExtension?: Bytes;
|
|
50
|
+
applicationPayload: Bytes;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
export interface DecodedPacket extends Packet {
|
|
@@ -56,8 +56,8 @@ export interface DecodedPacket extends Packet {
|
|
|
56
56
|
export interface Message {
|
|
57
57
|
packetHeader: PacketHeader;
|
|
58
58
|
payloadHeader: PayloadHeader;
|
|
59
|
-
securityExtension?:
|
|
60
|
-
payload:
|
|
59
|
+
securityExtension?: Bytes;
|
|
60
|
+
payload: Bytes;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
export interface DecodedMessage extends Message {
|
|
@@ -113,11 +113,11 @@ function mapProtocolAndMessageType(protocolId: number, messageType: number): { t
|
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
export class MessageCodec {
|
|
116
|
-
static decodePacket(data:
|
|
116
|
+
static decodePacket(data: Bytes): DecodedPacket {
|
|
117
117
|
const reader = new DataReader(data, Endian.Little);
|
|
118
118
|
const header = this.decodePacketHeader(reader);
|
|
119
119
|
|
|
120
|
-
let messageExtension:
|
|
120
|
+
let messageExtension: Bytes | undefined = undefined;
|
|
121
121
|
if (header.hasMessageExtensions) {
|
|
122
122
|
const extensionLength = reader.readUInt16();
|
|
123
123
|
messageExtension = reader.readByteArray(extensionLength);
|
|
@@ -134,7 +134,7 @@ export class MessageCodec {
|
|
|
134
134
|
static decodePayload({ header, applicationPayload }: DecodedPacket): DecodedMessage {
|
|
135
135
|
const reader = new DataReader(applicationPayload, Endian.Little);
|
|
136
136
|
const payloadHeader = this.decodePayloadHeader(reader);
|
|
137
|
-
let securityExtension:
|
|
137
|
+
let securityExtension: Bytes | undefined = undefined;
|
|
138
138
|
if (payloadHeader.hasSecuredExtension) {
|
|
139
139
|
const extensionLength = reader.readUInt16();
|
|
140
140
|
securityExtension = reader.readByteArray(extensionLength);
|
|
@@ -165,7 +165,7 @@ export class MessageCodec {
|
|
|
165
165
|
};
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
-
static encodePacket({ header, applicationPayload, messageExtension }: Packet):
|
|
168
|
+
static encodePacket({ header, applicationPayload, messageExtension }: Packet): Bytes {
|
|
169
169
|
if (messageExtension !== undefined || header.hasMessageExtensions) {
|
|
170
170
|
throw new NotImplementedError(`Message extensions not supported when encoding a packet.`);
|
|
171
171
|
}
|
|
@@ -316,8 +316,8 @@ export class MessageCodec {
|
|
|
316
316
|
reqAck: requiresAck,
|
|
317
317
|
dup: duplicate,
|
|
318
318
|
}),
|
|
319
|
-
size: payload.
|
|
320
|
-
payload: payload.
|
|
319
|
+
size: payload.byteLength ? payload.byteLength : undefined,
|
|
320
|
+
payload: payload.byteLength ? payload : undefined,
|
|
321
321
|
},
|
|
322
322
|
true,
|
|
323
323
|
);
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
8
|
AsyncObservable,
|
|
9
|
+
Bytes,
|
|
9
10
|
Construction,
|
|
10
11
|
Logger,
|
|
11
12
|
MatterFlowError,
|
|
@@ -193,7 +194,7 @@ export abstract class FailsafeContext {
|
|
|
193
194
|
}
|
|
194
195
|
|
|
195
196
|
/** Handles adding a trusted root certificate from Operational Credentials cluster. */
|
|
196
|
-
async setRootCert(rootCert:
|
|
197
|
+
async setRootCert(rootCert: Bytes) {
|
|
197
198
|
await this.#builder.setRootCert(rootCert);
|
|
198
199
|
this.#rootCertSet = true;
|
|
199
200
|
}
|
|
@@ -202,7 +203,7 @@ export abstract class FailsafeContext {
|
|
|
202
203
|
* Build a new Fabric object based on an existing fabric for the "UpdateNoc" case of the Operational Credentials
|
|
203
204
|
* cluster.
|
|
204
205
|
*/
|
|
205
|
-
async buildUpdatedFabric(nocValue:
|
|
206
|
+
async buildUpdatedFabric(nocValue: Bytes, icacValue: Bytes | undefined) {
|
|
206
207
|
if (this.associatedFabric === undefined) {
|
|
207
208
|
throw new MatterFlowError("No fabric associated with failsafe context, but we prepare an Fabric update.");
|
|
208
209
|
}
|
|
@@ -213,10 +214,10 @@ export abstract class FailsafeContext {
|
|
|
213
214
|
|
|
214
215
|
/** Build a new Fabric object for a new fabric for the "AddNoc" case of the Operational Credentials cluster. */
|
|
215
216
|
async buildFabric(nocData: {
|
|
216
|
-
nocValue:
|
|
217
|
-
icacValue:
|
|
217
|
+
nocValue: Bytes;
|
|
218
|
+
icacValue: Bytes | undefined;
|
|
218
219
|
adminVendorId: VendorId;
|
|
219
|
-
ipkValue:
|
|
220
|
+
ipkValue: Bytes;
|
|
220
221
|
caseAdminSubject: NodeId;
|
|
221
222
|
}) {
|
|
222
223
|
const builder = this.#builder;
|
package/src/fabric/Fabric.ts
CHANGED
|
@@ -52,14 +52,14 @@ export class Fabric {
|
|
|
52
52
|
readonly fabricId: FabricId;
|
|
53
53
|
readonly nodeId: NodeId;
|
|
54
54
|
readonly rootNodeId: NodeId;
|
|
55
|
-
readonly operationalId:
|
|
56
|
-
readonly rootPublicKey:
|
|
55
|
+
readonly operationalId: Bytes;
|
|
56
|
+
readonly rootPublicKey: Bytes;
|
|
57
57
|
readonly rootVendorId: VendorId;
|
|
58
|
-
readonly rootCert:
|
|
59
|
-
readonly identityProtectionKey:
|
|
60
|
-
readonly operationalIdentityProtectionKey:
|
|
61
|
-
readonly intermediateCACert:
|
|
62
|
-
readonly operationalCert:
|
|
58
|
+
readonly rootCert: Bytes;
|
|
59
|
+
readonly identityProtectionKey: Bytes;
|
|
60
|
+
readonly operationalIdentityProtectionKey: Bytes;
|
|
61
|
+
readonly intermediateCACert: Bytes | undefined;
|
|
62
|
+
readonly operationalCert: Bytes;
|
|
63
63
|
readonly #keyPair: Key;
|
|
64
64
|
readonly #sessions = new Set<Session>();
|
|
65
65
|
readonly #groups: FabricGroups;
|
|
@@ -148,11 +148,11 @@ export class Fabric {
|
|
|
148
148
|
return this.#keyPair.publicKey;
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
sign(data:
|
|
151
|
+
sign(data: Bytes) {
|
|
152
152
|
return this.crypto.signEcdsa(this.#keyPair, data);
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
-
async verifyCredentials(operationalCert:
|
|
155
|
+
async verifyCredentials(operationalCert: Bytes, intermediateCACert?: Bytes) {
|
|
156
156
|
const rootCert = Rcac.fromTlv(this.rootCert);
|
|
157
157
|
const nocCert = Noc.fromTlv(operationalCert);
|
|
158
158
|
const icaCert = intermediateCACert !== undefined ? Icac.fromTlv(intermediateCACert) : undefined;
|
|
@@ -164,7 +164,7 @@ export class Fabric {
|
|
|
164
164
|
await nocCert.verify(this.#crypto, rootCert, icaCert);
|
|
165
165
|
}
|
|
166
166
|
|
|
167
|
-
matchesFabricIdAndRootPublicKey(fabricId: FabricId, rootPublicKey:
|
|
167
|
+
matchesFabricIdAndRootPublicKey(fabricId: FabricId, rootPublicKey: Bytes) {
|
|
168
168
|
return this.fabricId === fabricId && Bytes.areEqual(this.rootPublicKey, rootPublicKey);
|
|
169
169
|
}
|
|
170
170
|
|
|
@@ -175,7 +175,7 @@ export class Fabric {
|
|
|
175
175
|
);
|
|
176
176
|
}
|
|
177
177
|
|
|
178
|
-
#generateSalt(nodeId: NodeId, random:
|
|
178
|
+
#generateSalt(nodeId: NodeId, random: Bytes) {
|
|
179
179
|
const writer = new DataWriter(Endian.Little);
|
|
180
180
|
writer.writeByteArray(random);
|
|
181
181
|
writer.writeByteArray(this.rootPublicKey);
|
|
@@ -188,18 +188,15 @@ export class Fabric {
|
|
|
188
188
|
* Returns the destination IDs for a given nodeId, random value and optional groupId. When groupId is provided, it
|
|
189
189
|
* returns the time-wise valid operational keys for that groupId.
|
|
190
190
|
*/
|
|
191
|
-
async currentDestinationIdFor(nodeId: NodeId, random:
|
|
192
|
-
return
|
|
193
|
-
this.groups.keySets.currentKeyForId(0).key,
|
|
194
|
-
this.#generateSalt(nodeId, random),
|
|
195
|
-
);
|
|
191
|
+
async currentDestinationIdFor(nodeId: NodeId, random: Bytes) {
|
|
192
|
+
return this.#crypto.signHmac(this.groups.keySets.currentKeyForId(0).key, this.#generateSalt(nodeId, random));
|
|
196
193
|
}
|
|
197
194
|
|
|
198
195
|
/**
|
|
199
196
|
* Returns the destination IDs for a given nodeId, random value and optional groupId. When groupId is provided, it
|
|
200
197
|
* returns all operational keys for that groupId.
|
|
201
198
|
*/
|
|
202
|
-
async destinationIdsFor(nodeId: NodeId, random:
|
|
199
|
+
async destinationIdsFor(nodeId: NodeId, random: Bytes) {
|
|
203
200
|
const salt = this.#generateSalt(nodeId, random);
|
|
204
201
|
// Check all keys of keyset 0 - typically it is only the IPK
|
|
205
202
|
const destinationIds = this.groups.keySets.allKeysForId(0).map(({ key }) => this.#crypto.signHmac(key, salt));
|
|
@@ -277,14 +274,14 @@ export class FabricBuilder {
|
|
|
277
274
|
#crypto: Crypto;
|
|
278
275
|
#keyPair: PrivateKey;
|
|
279
276
|
#rootVendorId?: VendorId;
|
|
280
|
-
#rootCert?:
|
|
281
|
-
#intermediateCACert?:
|
|
282
|
-
#operationalCert?:
|
|
277
|
+
#rootCert?: Bytes;
|
|
278
|
+
#intermediateCACert?: Bytes;
|
|
279
|
+
#operationalCert?: Bytes;
|
|
283
280
|
#fabricId?: FabricId;
|
|
284
281
|
#nodeId?: NodeId;
|
|
285
282
|
#rootNodeId?: NodeId;
|
|
286
|
-
#rootPublicKey?:
|
|
287
|
-
#identityProtectionKey?:
|
|
283
|
+
#rootPublicKey?: Bytes;
|
|
284
|
+
#identityProtectionKey?: Bytes;
|
|
288
285
|
#fabricIndex?: FabricIndex;
|
|
289
286
|
#label = "";
|
|
290
287
|
|
|
@@ -309,7 +306,7 @@ export class FabricBuilder {
|
|
|
309
306
|
return X509Base.createCertificateSigningRequest(this.#crypto, this.#keyPair);
|
|
310
307
|
}
|
|
311
308
|
|
|
312
|
-
async setRootCert(rootCert:
|
|
309
|
+
async setRootCert(rootCert: Bytes) {
|
|
313
310
|
const root = Rcac.fromTlv(rootCert);
|
|
314
311
|
await root.verify(this.#crypto);
|
|
315
312
|
this.#rootCert = rootCert;
|
|
@@ -321,8 +318,8 @@ export class FabricBuilder {
|
|
|
321
318
|
return this.#rootCert;
|
|
322
319
|
}
|
|
323
320
|
|
|
324
|
-
async setOperationalCert(operationalCert:
|
|
325
|
-
if (intermediateCACert !== undefined && intermediateCACert.
|
|
321
|
+
async setOperationalCert(operationalCert: Bytes, intermediateCACert?: Bytes) {
|
|
322
|
+
if (intermediateCACert !== undefined && intermediateCACert.byteLength === 0) {
|
|
326
323
|
intermediateCACert = undefined;
|
|
327
324
|
}
|
|
328
325
|
const {
|
|
@@ -371,7 +368,7 @@ export class FabricBuilder {
|
|
|
371
368
|
return this;
|
|
372
369
|
}
|
|
373
370
|
|
|
374
|
-
setIdentityProtectionKey(key:
|
|
371
|
+
setIdentityProtectionKey(key: Bytes) {
|
|
375
372
|
this.#identityProtectionKey = key;
|
|
376
373
|
return this;
|
|
377
374
|
}
|
|
@@ -426,7 +423,7 @@ export class FabricBuilder {
|
|
|
426
423
|
const saltWriter = new DataWriter();
|
|
427
424
|
saltWriter.writeUInt64(this.#fabricId);
|
|
428
425
|
const operationalId = await this.#crypto.createHkdfKey(
|
|
429
|
-
this.#rootPublicKey.slice(1),
|
|
426
|
+
Bytes.of(this.#rootPublicKey).slice(1),
|
|
430
427
|
saltWriter.toByteArray(),
|
|
431
428
|
COMPRESSED_FABRIC_ID_INFO,
|
|
432
429
|
8,
|
|
@@ -461,15 +458,15 @@ export namespace Fabric {
|
|
|
461
458
|
fabricId: FabricId;
|
|
462
459
|
nodeId: NodeId;
|
|
463
460
|
rootNodeId: NodeId;
|
|
464
|
-
operationalId:
|
|
465
|
-
rootPublicKey:
|
|
461
|
+
operationalId: Bytes;
|
|
462
|
+
rootPublicKey: Bytes;
|
|
466
463
|
keyPair: BinaryKeyPair;
|
|
467
464
|
rootVendorId: VendorId;
|
|
468
|
-
rootCert:
|
|
469
|
-
identityProtectionKey:
|
|
470
|
-
operationalIdentityProtectionKey:
|
|
471
|
-
intermediateCACert:
|
|
472
|
-
operationalCert:
|
|
465
|
+
rootCert: Bytes;
|
|
466
|
+
identityProtectionKey: Bytes;
|
|
467
|
+
operationalIdentityProtectionKey: Bytes;
|
|
468
|
+
intermediateCACert: Bytes | undefined;
|
|
469
|
+
operationalCert: Bytes;
|
|
473
470
|
label: string;
|
|
474
471
|
};
|
|
475
472
|
}
|
|
@@ -225,7 +225,7 @@ export class FabricManager {
|
|
|
225
225
|
return this.fabrics.map(translator);
|
|
226
226
|
}
|
|
227
227
|
|
|
228
|
-
async findFabricFromDestinationId(destinationId:
|
|
228
|
+
async findFabricFromDestinationId(destinationId: Bytes, initiatorRandom: Bytes) {
|
|
229
229
|
this.#construction.assert();
|
|
230
230
|
|
|
231
231
|
for (const fabric of this.#fabrics.values()) {
|
package/src/groups/KeySets.ts
CHANGED
|
@@ -11,7 +11,7 @@ export const GROUP_KEY_INFO = Bytes.fromString("GroupKeyHash");
|
|
|
11
11
|
|
|
12
12
|
export class KeySets<T extends OperationalKeySet> extends BasicSet<T> {
|
|
13
13
|
/** Operational enhanced structure for fast access based on the group session id. */
|
|
14
|
-
readonly #sessions = new Map<number, { keySetId: number; key:
|
|
14
|
+
readonly #sessions = new Map<number, { keySetId: number; key: Bytes }[]>();
|
|
15
15
|
|
|
16
16
|
get sessions() {
|
|
17
17
|
return this.#sessions;
|
|
@@ -44,7 +44,7 @@ export class KeySets<T extends OperationalKeySet> extends BasicSet<T> {
|
|
|
44
44
|
if (groupKeySet === undefined) {
|
|
45
45
|
throw new MatterFlowError(`GroupKeySet for groupKeySet ${keySetId} not found.`);
|
|
46
46
|
}
|
|
47
|
-
const operationalKeys = Array<{ key:
|
|
47
|
+
const operationalKeys = Array<{ key: Bytes; sessionId?: number; startTime: number | bigint }>();
|
|
48
48
|
const {
|
|
49
49
|
operationalEpochKey0,
|
|
50
50
|
groupSessionId0,
|
|
@@ -141,7 +141,7 @@ export class KeySets<T extends OperationalKeySet> extends BasicSet<T> {
|
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
/** Calculates a group session id based on the operational group key. */
|
|
144
|
-
async sessionIdFromKey(crypto: Crypto, operationalGroupKey:
|
|
144
|
+
async sessionIdFromKey(crypto: Crypto, operationalGroupKey: Bytes) {
|
|
145
145
|
// GroupKeyHash is an array of 2 bytes (16 bits) per Crypto_KDF
|
|
146
146
|
const groupKeyHash = await crypto.createHkdfKey(operationalGroupKey, new Uint8Array(), GROUP_KEY_INFO, 2);
|
|
147
147
|
|
|
@@ -185,10 +185,10 @@ export type GroupKeySet = GroupKeyManagement.GroupKeySet;
|
|
|
185
185
|
|
|
186
186
|
/** Enhanced structure of GroupKeySet to include operational data for easier operational processing. */
|
|
187
187
|
export type OperationalKeySet = GroupKeySet & {
|
|
188
|
-
operationalEpochKey0:
|
|
188
|
+
operationalEpochKey0: Bytes;
|
|
189
189
|
groupSessionId0: number | null;
|
|
190
|
-
operationalEpochKey1:
|
|
190
|
+
operationalEpochKey1: Bytes | null;
|
|
191
191
|
groupSessionId1: number | null;
|
|
192
|
-
operationalEpochKey2:
|
|
192
|
+
operationalEpochKey2: Bytes | null;
|
|
193
193
|
groupSessionId2: number | null;
|
|
194
194
|
};
|
|
@@ -40,7 +40,7 @@ export class MessagingState {
|
|
|
40
40
|
/**
|
|
41
41
|
* Return the message counter for sending messages to a group with the given operational key.
|
|
42
42
|
*/
|
|
43
|
-
counterFor(operationalKey:
|
|
43
|
+
counterFor(operationalKey: Bytes) {
|
|
44
44
|
if (!this.#storage) {
|
|
45
45
|
throw new ImplementationError("Group session cannot be created without storage context.");
|
|
46
46
|
}
|
|
@@ -53,7 +53,7 @@ export class MessagingState {
|
|
|
53
53
|
return counter;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
async removeCounter(key:
|
|
56
|
+
async removeCounter(key: Bytes, forDelete = false) {
|
|
57
57
|
const operationalKeyHex = Bytes.toHex(key);
|
|
58
58
|
this.#groupDataCounters.delete(operationalKeyHex);
|
|
59
59
|
if (forDelete) {
|
|
@@ -65,7 +65,7 @@ export class MessagingState {
|
|
|
65
65
|
/**
|
|
66
66
|
* Returns the message reception state for a given source node id and operational key.
|
|
67
67
|
*/
|
|
68
|
-
receptionStateFor(sourceNodeId: NodeId, operationalKey:
|
|
68
|
+
receptionStateFor(sourceNodeId: NodeId, operationalKey: Bytes) {
|
|
69
69
|
const operationalKeyHex = Bytes.toHex(operationalKey);
|
|
70
70
|
let receptionState = this.#messageDataReceptionState.get(operationalKeyHex)?.get(sourceNodeId);
|
|
71
71
|
if (receptionState === undefined) {
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import { ReadResult } from "#action/response/ReadResult.js";
|
|
8
8
|
import {
|
|
9
|
+
Bytes,
|
|
9
10
|
Diagnostic,
|
|
10
11
|
InternalError,
|
|
11
12
|
Logger,
|
|
@@ -98,7 +99,7 @@ const DATA_REPORT_MIN_AVAILABLE_BYTES_BEFORE_SENDING = 40;
|
|
|
98
99
|
class InteractionMessenger {
|
|
99
100
|
constructor(protected exchange: MessageExchange) {}
|
|
100
101
|
|
|
101
|
-
send(messageType: number, payload:
|
|
102
|
+
send(messageType: number, payload: Bytes, options?: ExchangeSendOptions) {
|
|
102
103
|
return this.exchange.send(messageType, payload, options);
|
|
103
104
|
}
|
|
104
105
|
|
|
@@ -366,12 +367,12 @@ export class InteractionServerMessenger extends InteractionMessenger {
|
|
|
366
367
|
// Empty the dataReport data fields for the next chunk and reset the messageSize
|
|
367
368
|
delete dataReport.attributeReports;
|
|
368
369
|
delete dataReport.eventReports;
|
|
369
|
-
messageSize = emptyDataReportBytes.
|
|
370
|
+
messageSize = emptyDataReportBytes.byteLength;
|
|
370
371
|
processQueueFirst = true; // After sending a message we first try to process queue
|
|
371
372
|
};
|
|
372
373
|
|
|
373
374
|
/** Current size of the message */
|
|
374
|
-
let messageSize = emptyDataReportBytes.
|
|
375
|
+
let messageSize = emptyDataReportBytes.byteLength;
|
|
375
376
|
|
|
376
377
|
/** Queue of attribute reports to send */
|
|
377
378
|
const attributeReportsToSend = new Array<{
|
|
@@ -608,7 +609,7 @@ export class InteractionServerMessenger extends InteractionMessenger {
|
|
|
608
609
|
attributeReportsToSend.push(attributeToSend);
|
|
609
610
|
continue;
|
|
610
611
|
}
|
|
611
|
-
if (encodedSize > this.exchange.maxPayloadSize - emptyDataReportBytes.
|
|
612
|
+
if (encodedSize > this.exchange.maxPayloadSize - emptyDataReportBytes.byteLength - 3) {
|
|
612
613
|
// We sent the message but the current attribute is too big for a message alone so needs to
|
|
613
614
|
// be chunked, so add it to the queue at the beginning
|
|
614
615
|
attributeReportsToSend.unshift(attributeToSend);
|
|
@@ -657,9 +658,9 @@ export class InteractionServerMessenger extends InteractionMessenger {
|
|
|
657
658
|
suppressResponse: dataReport.moreChunkedMessages ? false : dataReport.suppressResponse, // always false when moreChunkedMessages is true
|
|
658
659
|
};
|
|
659
660
|
const encodedMessage = TlvDataReportForSend.encode(dataReportToSend);
|
|
660
|
-
if (encodedMessage.
|
|
661
|
+
if (encodedMessage.byteLength > this.exchange.maxPayloadSize) {
|
|
661
662
|
throw new MatterFlowError(
|
|
662
|
-
`DataReport with ${encodedMessage.
|
|
663
|
+
`DataReport with ${encodedMessage.byteLength}bytes is too long to fit in a single chunk (${this.exchange.maxPayloadSize}bytes), This should not happen! Data: ${Diagnostic.json(
|
|
663
664
|
dataReportToSend,
|
|
664
665
|
)}`,
|
|
665
666
|
);
|
|
@@ -915,7 +916,7 @@ export class InteractionClientMessenger extends IncomingInteractionClientMesseng
|
|
|
915
916
|
}
|
|
916
917
|
|
|
917
918
|
/** Implements a send method with an automatic reconnection mechanism */
|
|
918
|
-
override async send(messageType: number, payload:
|
|
919
|
+
override async send(messageType: number, payload: Bytes, options?: ExchangeSendOptions) {
|
|
919
920
|
try {
|
|
920
921
|
if (this.exchange.channel.closed) {
|
|
921
922
|
throw new ChannelNotConnectedError("The exchange channel is closed. Please connect the device first.");
|
|
@@ -950,7 +951,7 @@ export class InteractionClientMessenger extends IncomingInteractionClientMesseng
|
|
|
950
951
|
|
|
951
952
|
#encodeReadingRequest<T extends TlvSchema<any>>(schema: T, request: TypeFromSchema<T>) {
|
|
952
953
|
const encoded = schema.encode(request);
|
|
953
|
-
if (encoded.
|
|
954
|
+
if (encoded.byteLength <= this.exchange.maxPayloadSize) {
|
|
954
955
|
return encoded;
|
|
955
956
|
}
|
|
956
957
|
|
|
@@ -960,7 +961,7 @@ export class InteractionClientMessenger extends IncomingInteractionClientMesseng
|
|
|
960
961
|
...request,
|
|
961
962
|
dataVersionFilters: [],
|
|
962
963
|
});
|
|
963
|
-
if (requestWithoutDataVersionFilters.
|
|
964
|
+
if (requestWithoutDataVersionFilters.byteLength > this.exchange.maxPayloadSize) {
|
|
964
965
|
throw new MatterFlowError(
|
|
965
966
|
`Request is too long to fit in a single chunk, This should not happen! Data: ${Diagnostic.json(request)}`,
|
|
966
967
|
);
|
|
@@ -970,7 +971,7 @@ export class InteractionClientMessenger extends IncomingInteractionClientMesseng
|
|
|
970
971
|
...request,
|
|
971
972
|
dataVersionFilters: this.#shortenDataVersionFilters(
|
|
972
973
|
originalDataVersionFilters,
|
|
973
|
-
this.exchange.maxPayloadSize - requestWithoutDataVersionFilters.
|
|
974
|
+
this.exchange.maxPayloadSize - requestWithoutDataVersionFilters.byteLength,
|
|
974
975
|
),
|
|
975
976
|
});
|
|
976
977
|
}
|
|
@@ -987,7 +988,7 @@ export class InteractionClientMessenger extends IncomingInteractionClientMesseng
|
|
|
987
988
|
break;
|
|
988
989
|
}
|
|
989
990
|
const encodedDataVersionFilter = TlvDataVersionFilter.encode(dataVersionFilter);
|
|
990
|
-
const encodedDataVersionFilterLength = encodedDataVersionFilter.
|
|
991
|
+
const encodedDataVersionFilterLength = encodedDataVersionFilter.byteLength;
|
|
991
992
|
if (encodedDataVersionFilterLength > availableBytes) {
|
|
992
993
|
originalDataVersionFilters.unshift(dataVersionFilter);
|
|
993
994
|
break;
|
package/src/mdns/MdnsClient.ts
CHANGED
|
@@ -104,7 +104,7 @@ export interface MdnsScannerTargetCriteria {
|
|
|
104
104
|
|
|
105
105
|
/** List of operational targets. */
|
|
106
106
|
operationalTargets: {
|
|
107
|
-
operationalId:
|
|
107
|
+
operationalId: Bytes;
|
|
108
108
|
nodeId?: NodeId;
|
|
109
109
|
}[];
|
|
110
110
|
}
|
|
@@ -470,7 +470,7 @@ export class MdnsClient implements Scanner {
|
|
|
470
470
|
return this.#recordWaiters.has(queryId);
|
|
471
471
|
}
|
|
472
472
|
|
|
473
|
-
#createOperationalMatterQName(operationalId:
|
|
473
|
+
#createOperationalMatterQName(operationalId: Bytes, nodeId: NodeId) {
|
|
474
474
|
const operationalIdString = Bytes.toHex(operationalId).toUpperCase();
|
|
475
475
|
return getOperationalDeviceQname(operationalIdString, NodeId.toHexString(nodeId));
|
|
476
476
|
}
|
package/src/mdns/MdnsSocket.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
8
|
BasicObservable,
|
|
9
|
+
Bytes,
|
|
9
10
|
Diagnostic,
|
|
10
11
|
DnsCodec,
|
|
11
12
|
DnsMessage,
|
|
@@ -83,13 +84,13 @@ export class MdnsSocket {
|
|
|
83
84
|
|
|
84
85
|
// Note - for size calculations we assume queries are relatively small. We only split answers across messages
|
|
85
86
|
let encodedChunkWithoutAnswers = DnsCodec.encode(chunk);
|
|
86
|
-
let chunkSize = encodedChunkWithoutAnswers.
|
|
87
|
+
let chunkSize = encodedChunkWithoutAnswers.byteLength;
|
|
87
88
|
|
|
88
89
|
// Add answers, splitting message as necessary
|
|
89
90
|
for (const answer of message.answers ?? []) {
|
|
90
91
|
const answerEncoded = DnsCodec.encodeRecord(answer);
|
|
91
92
|
|
|
92
|
-
if (chunkSize + answerEncoded.
|
|
93
|
+
if (chunkSize + answerEncoded.byteLength > MAX_MDNS_MESSAGE_SIZE) {
|
|
93
94
|
if (chunk.answers.length === 0) {
|
|
94
95
|
// The first answer is already too big, log at least a warning
|
|
95
96
|
logger.warn(
|
|
@@ -108,9 +109,9 @@ export class MdnsSocket {
|
|
|
108
109
|
encodedChunkWithoutAnswers = DnsCodec.encode(chunk);
|
|
109
110
|
}
|
|
110
111
|
chunk.answers.length = 0;
|
|
111
|
-
chunkSize = encodedChunkWithoutAnswers.
|
|
112
|
+
chunkSize = encodedChunkWithoutAnswers.byteLength + answerEncoded.byteLength;
|
|
112
113
|
} else {
|
|
113
|
-
chunkSize += answerEncoded.
|
|
114
|
+
chunkSize += answerEncoded.byteLength;
|
|
114
115
|
}
|
|
115
116
|
|
|
116
117
|
chunk.answers.push(answerEncoded);
|
|
@@ -120,7 +121,7 @@ export class MdnsSocket {
|
|
|
120
121
|
const additionalRecords = message.additionalRecords ?? [];
|
|
121
122
|
for (const additionalRecord of additionalRecords) {
|
|
122
123
|
const additionalRecordEncoded = DnsCodec.encodeRecord(additionalRecord);
|
|
123
|
-
chunkSize += additionalRecordEncoded.
|
|
124
|
+
chunkSize += additionalRecordEncoded.byteLength;
|
|
124
125
|
if (chunkSize > MAX_MDNS_MESSAGE_SIZE) {
|
|
125
126
|
break;
|
|
126
127
|
}
|
|
@@ -142,7 +143,7 @@ export class MdnsSocket {
|
|
|
142
143
|
}
|
|
143
144
|
}
|
|
144
145
|
|
|
145
|
-
#handleMessage(bytes:
|
|
146
|
+
#handleMessage(bytes: Bytes, sourceIp: string, sourceIntf: string) {
|
|
146
147
|
// Ignore if closed
|
|
147
148
|
if (this.#isClosed) {
|
|
148
149
|
return;
|
|
@@ -9,6 +9,7 @@ import { GeneralCommissioning } from "#clusters/general-commissioning";
|
|
|
9
9
|
import { CommissionableDevice, CommissionableDeviceIdentifiers, DiscoveryData, ScannerSet } from "#common/Scanner.js";
|
|
10
10
|
import { Fabric } from "#fabric/Fabric.js";
|
|
11
11
|
import {
|
|
12
|
+
Bytes,
|
|
12
13
|
Channel,
|
|
13
14
|
ChannelType,
|
|
14
15
|
ClassExtends,
|
|
@@ -304,7 +305,7 @@ export class ControllerCommissioner {
|
|
|
304
305
|
passcode: number,
|
|
305
306
|
device?: DiscoveryData,
|
|
306
307
|
): Promise<MessageChannel> {
|
|
307
|
-
let paseChannel: Channel<
|
|
308
|
+
let paseChannel: Channel<Bytes>;
|
|
308
309
|
if (device !== undefined) {
|
|
309
310
|
logger.info(`Establish PASE to device`, MdnsClient.discoveryDataDiagnostics(device));
|
|
310
311
|
}
|
|
@@ -781,10 +781,10 @@ export class ControllerCommissioningFlow {
|
|
|
781
781
|
);
|
|
782
782
|
// TODO: validate attestationSignature using device public key
|
|
783
783
|
if (
|
|
784
|
-
deviceAttestation.
|
|
785
|
-
productAttestation.
|
|
786
|
-
attestationElements.
|
|
787
|
-
attestationSignature.
|
|
784
|
+
deviceAttestation.byteLength === 0 ||
|
|
785
|
+
productAttestation.byteLength === 0 ||
|
|
786
|
+
attestationElements.byteLength === 0 ||
|
|
787
|
+
attestationSignature.byteLength === 0
|
|
788
788
|
) {
|
|
789
789
|
// TODO: validate the data really
|
|
790
790
|
throw new CommissioningError("Device Attestation data missing from device");
|
|
@@ -820,7 +820,7 @@ export class ControllerCommissioningFlow {
|
|
|
820
820
|
{ csrNonce: this.fabric.crypto.randomBytes(32) },
|
|
821
821
|
{ useExtendedFailSafeMessageResponseTimeout: true },
|
|
822
822
|
);
|
|
823
|
-
if (nocsrElements.
|
|
823
|
+
if (nocsrElements.byteLength === 0 || csrSignature.byteLength === 0) {
|
|
824
824
|
// TODO: validate the data really
|
|
825
825
|
throw new UnexpectedDataError("Invalid response from device");
|
|
826
826
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { AsyncObservable, Channel, Environment, Environmental, Logger } from "#general";
|
|
7
|
+
import { AsyncObservable, Bytes, Channel, Environment, Environmental, Logger } from "#general";
|
|
8
8
|
import { PeerAddress, PeerAddressMap } from "#peer/PeerAddress.js";
|
|
9
9
|
import { MessageChannel } from "#protocol/MessageChannel.js";
|
|
10
10
|
import { NoChannelError, NodeSession } from "#session/NodeSession.js";
|
|
@@ -124,7 +124,7 @@ export class ChannelManager {
|
|
|
124
124
|
this.#channels.set(address, fabricChannels);
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
private getOrCreateAsPaseChannel(byteArrayChannel: Channel<
|
|
127
|
+
private getOrCreateAsPaseChannel(byteArrayChannel: Channel<Bytes>, session: Session) {
|
|
128
128
|
const msgChannel = new MessageChannel(
|
|
129
129
|
byteArrayChannel,
|
|
130
130
|
session,
|
|
@@ -138,7 +138,7 @@ export class ChannelManager {
|
|
|
138
138
|
return msgChannel;
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
async getOrCreateChannel(byteArrayChannel: Channel<
|
|
141
|
+
async getOrCreateChannel(byteArrayChannel: Channel<Bytes>, session: Session) {
|
|
142
142
|
if (!NodeSession.is(session)) {
|
|
143
143
|
return this.getOrCreateAsPaseChannel(byteArrayChannel, session);
|
|
144
144
|
}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import { DecodedMessage, MessageCodec, SessionType } from "#codec/MessageCodec.js";
|
|
8
8
|
import {
|
|
9
|
+
Bytes,
|
|
9
10
|
Channel,
|
|
10
11
|
Crypto,
|
|
11
12
|
Diagnostic,
|
|
@@ -146,9 +147,10 @@ export class ExchangeManager {
|
|
|
146
147
|
this.#exchanges.clear();
|
|
147
148
|
}
|
|
148
149
|
|
|
149
|
-
private async onMessage(channel: Channel<
|
|
150
|
+
private async onMessage(channel: Channel<Bytes>, messageBytes: Bytes) {
|
|
150
151
|
const packet = MessageCodec.decodePacket(messageBytes);
|
|
151
|
-
const
|
|
152
|
+
const bytes = Bytes.of(messageBytes);
|
|
153
|
+
const aad = bytes.slice(0, bytes.length - packet.applicationPayload.byteLength); // Header+Extensions
|
|
152
154
|
|
|
153
155
|
const messageId = packet.header.messageId;
|
|
154
156
|
|
|
@@ -193,7 +195,7 @@ export class ExchangeManager {
|
|
|
193
195
|
throw new UnexpectedDataError("Group session message must include a source NodeId");
|
|
194
196
|
}
|
|
195
197
|
|
|
196
|
-
let key:
|
|
198
|
+
let key: Bytes;
|
|
197
199
|
({ session, message, key } = this.#sessionManager.groupSessionFromPacket(packet, aad));
|
|
198
200
|
|
|
199
201
|
try {
|
|
@@ -431,9 +433,9 @@ export class ExchangeManager {
|
|
|
431
433
|
this.#listeners.set(
|
|
432
434
|
transportInterface,
|
|
433
435
|
transportInterface.onData((socket, data) => {
|
|
434
|
-
if (udpInterface && data.
|
|
436
|
+
if (udpInterface && data.byteLength > socket.maxPayloadSize) {
|
|
435
437
|
logger.warn(
|
|
436
|
-
`Ignoring UDP message on channel ${socket.name} with size ${data.
|
|
438
|
+
`Ignoring UDP message on channel ${socket.name} with size ${data.byteLength} from ${socket.name}, which is larger than the maximum allowed size of ${socket.maxPayloadSize}.`,
|
|
437
439
|
);
|
|
438
440
|
return;
|
|
439
441
|
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { Message, MessageCodec } from "#codec/MessageCodec.js";
|
|
8
|
-
import { Channel, Logger, MatterError, MatterFlowError } from "#general";
|
|
8
|
+
import { Bytes, Channel, Logger, MatterError, MatterFlowError } from "#general";
|
|
9
9
|
import type { ExchangeLogContext } from "#protocol/MessageExchange.js";
|
|
10
10
|
import { Session, SessionParameters } from "#session/Session.js";
|
|
11
11
|
|
|
@@ -55,7 +55,7 @@ export class MessageChannel implements Channel<Message> {
|
|
|
55
55
|
// When the session is supporting MRP and the channel is not reliable, use MRP handling
|
|
56
56
|
|
|
57
57
|
constructor(
|
|
58
|
-
readonly channel: Channel<
|
|
58
|
+
readonly channel: Channel<Bytes>,
|
|
59
59
|
readonly session: Session,
|
|
60
60
|
closeCallback?: () => Promise<void>,
|
|
61
61
|
) {
|
|
@@ -91,9 +91,9 @@ export class MessageChannel implements Channel<Message> {
|
|
|
91
91
|
logger.debug("Message »", MessageCodec.messageDiagnostics(message, logContext));
|
|
92
92
|
const packet = this.session.encode(message);
|
|
93
93
|
const bytes = MessageCodec.encodePacket(packet);
|
|
94
|
-
if (bytes.
|
|
94
|
+
if (bytes.byteLength > this.maxPayloadSize) {
|
|
95
95
|
logger.warn(
|
|
96
|
-
`Matter message to send to ${this.name} is ${bytes.
|
|
96
|
+
`Matter message to send to ${this.name} is ${bytes.byteLength}bytes long, which is larger than the maximum allowed size of ${this.maxPayloadSize}. This only works if both nodes support it.`,
|
|
97
97
|
);
|
|
98
98
|
}
|
|
99
99
|
|