@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
|
@@ -8,13 +8,13 @@ import { Mark } from "#common/Mark.js";
|
|
|
8
8
|
import type { ExchangeLogContext } from "#protocol/MessageExchange.js";
|
|
9
9
|
import {
|
|
10
10
|
Bytes,
|
|
11
|
-
CRYPTO_AEAD_MIC_LENGTH_BYTES,
|
|
12
11
|
DataReader,
|
|
13
12
|
DataWriter,
|
|
14
13
|
Diagnostic,
|
|
15
14
|
Endian,
|
|
16
15
|
hex,
|
|
17
16
|
InternalError,
|
|
17
|
+
Logger,
|
|
18
18
|
NotImplementedError,
|
|
19
19
|
UnexpectedDataError,
|
|
20
20
|
} from "@matter/general";
|
|
@@ -29,6 +29,12 @@ import {
|
|
|
29
29
|
} from "@matter/types";
|
|
30
30
|
import { MessageType } from "../interaction/InteractionMessenger.js";
|
|
31
31
|
|
|
32
|
+
/** The session id of unicast messages without a secure session. They carry no MIC. */
|
|
33
|
+
export const UNICAST_UNSECURE_SESSION_ID = 0x0000;
|
|
34
|
+
|
|
35
|
+
/** The obfuscated header region of a privacy message: counter, source node id and destination group id. */
|
|
36
|
+
const PRIVACY_HEADER_LENGTH = 4 + 8 + 2;
|
|
37
|
+
|
|
32
38
|
export interface PacketHeader {
|
|
33
39
|
sessionId: number;
|
|
34
40
|
sessionType: SessionType;
|
|
@@ -42,6 +48,9 @@ export interface PacketHeader {
|
|
|
42
48
|
}
|
|
43
49
|
|
|
44
50
|
export interface DecodedPacketHeader extends PacketHeader {
|
|
51
|
+
/** The message flags byte as received. Privacy never obfuscates it. */
|
|
52
|
+
messageFlags: number;
|
|
53
|
+
|
|
45
54
|
securityFlags: number; // The SecurityFlags as pure data field to be used as nonce
|
|
46
55
|
}
|
|
47
56
|
|
|
@@ -90,7 +99,7 @@ export namespace Message {
|
|
|
90
99
|
export function diagnosticsOf(context: { via: string }, message: Message, logContext?: ExchangeLogContext) {
|
|
91
100
|
const {
|
|
92
101
|
packetHeader: { hasPrivacyEnhancements },
|
|
93
|
-
payloadHeader: { messageType, protocolId, ackedMessageId, requiresAck },
|
|
102
|
+
payloadHeader: { messageType, protocolId, ackedMessageId, isInitiatorMessage, requiresAck },
|
|
94
103
|
payload,
|
|
95
104
|
} = message;
|
|
96
105
|
|
|
@@ -108,12 +117,13 @@ export namespace Message {
|
|
|
108
117
|
type,
|
|
109
118
|
acked: ackedMessageId === undefined ? undefined : hex.fixed(ackedMessageId, 8),
|
|
110
119
|
msgFlags: Diagnostic.asFlags({
|
|
120
|
+
I: isInitiatorMessage,
|
|
111
121
|
reqAck: requiresAck,
|
|
112
122
|
dup: duplicate,
|
|
113
123
|
privacy: hasPrivacyEnhancements,
|
|
114
124
|
}),
|
|
115
125
|
size: payload.byteLength ? payload.byteLength : undefined,
|
|
116
|
-
payload: payload.byteLength ? payload : undefined,
|
|
126
|
+
payload: payload.byteLength && Logger.logPayloads ? payload : undefined,
|
|
117
127
|
},
|
|
118
128
|
true,
|
|
119
129
|
);
|
|
@@ -204,14 +214,14 @@ export class MessageCodec {
|
|
|
204
214
|
const flags = reader.readUInt8();
|
|
205
215
|
const version = (flags & PacketHeaderFlag.VersionMask) >> 4;
|
|
206
216
|
const hasDestNodeId = (flags & PacketHeaderFlag.HasDestNodeId) !== 0;
|
|
207
|
-
const hasDestGroupId = (flags
|
|
217
|
+
const hasDestGroupId = MessageCodec.hasDestGroupId(flags);
|
|
208
218
|
const hasSourceNodeId = (flags & PacketHeaderFlag.HasSourceNodeId) !== 0;
|
|
209
219
|
|
|
210
220
|
if (hasDestNodeId && hasDestGroupId)
|
|
211
221
|
throw new UnexpectedDataError(
|
|
212
222
|
"The header cannot contain destination group and node at the same time. Reserved for future use. Discard message.",
|
|
213
223
|
);
|
|
214
|
-
if (version !== HEADER_VERSION) throw new
|
|
224
|
+
if (version !== HEADER_VERSION) throw new UnexpectedDataError(`Unsupported header version ${version}.`);
|
|
215
225
|
|
|
216
226
|
const sessionId = reader.readUInt16();
|
|
217
227
|
const securityFlags = reader.readUInt8();
|
|
@@ -223,9 +233,16 @@ export class MessageCodec {
|
|
|
223
233
|
if (sessionType === SessionType.Unicast && hasDestGroupId) {
|
|
224
234
|
throw new UnexpectedDataError(`Unicast session cannot have destination group id.`);
|
|
225
235
|
}
|
|
236
|
+
// The CHIP SDK drops these too: only the initiator has a source node id, only the responder a destination
|
|
237
|
+
if (sessionType === SessionType.Unicast && sessionId === UNICAST_UNSECURE_SESSION_ID) {
|
|
238
|
+
if (hasSourceNodeId === hasDestNodeId) {
|
|
239
|
+
throw new UnexpectedDataError(`Unsecured message must have either a source or a destination node id.`);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
226
242
|
if (sessionType === SessionType.Group) {
|
|
227
|
-
|
|
228
|
-
|
|
243
|
+
// A group session message to a destination node is MCSP, which the CHIP SDK does not process either
|
|
244
|
+
if (!hasDestGroupId) {
|
|
245
|
+
throw new UnexpectedDataError(`Group session must have destination group id.`);
|
|
229
246
|
}
|
|
230
247
|
if (!hasSourceNodeId) {
|
|
231
248
|
throw new UnexpectedDataError(`Group session must have source node id.`);
|
|
@@ -233,28 +250,22 @@ export class MessageCodec {
|
|
|
233
250
|
}
|
|
234
251
|
|
|
235
252
|
const hasPrivacyEnhancements = (securityFlags & SecurityFlag.HasPrivacyEnhancements) !== 0;
|
|
253
|
+
if (hasPrivacyEnhancements && sessionType !== SessionType.Group) {
|
|
254
|
+
throw new UnexpectedDataError(`Privacy enhancements are not supported on unicast, as in the CHIP SDK.`);
|
|
255
|
+
}
|
|
236
256
|
const isControlMessage = (securityFlags & SecurityFlag.IsControlMessage) !== 0;
|
|
237
257
|
if (isControlMessage) {
|
|
238
|
-
throw new
|
|
258
|
+
throw new UnexpectedDataError(`Control Messages not supported.`);
|
|
239
259
|
}
|
|
240
260
|
const hasMessageExtensions = (securityFlags & SecurityFlag.HasMessageExtension) !== 0;
|
|
241
261
|
|
|
242
262
|
if (hasPrivacyEnhancements) {
|
|
243
|
-
|
|
244
|
-
throw new NotImplementedError(`Privacy enhancements with message extensions not supported.`);
|
|
245
|
-
}
|
|
246
|
-
const privacyHeaderLength = 4 + (hasSourceNodeId ? 8 : 0) + (hasDestNodeId ? 8 : hasDestGroupId ? 2 : 0);
|
|
247
|
-
if (reader.remainingBytesCount < privacyHeaderLength) {
|
|
248
|
-
throw new UnexpectedDataError(
|
|
249
|
-
`Privacy header length ${privacyHeaderLength} exceeds remaining message size ${reader.remainingBytesCount}.`,
|
|
250
|
-
);
|
|
251
|
-
}
|
|
252
|
-
const obfuscatedRegion = reader.readByteArray(privacyHeaderLength);
|
|
263
|
+
const obfuscatedRegion = reader.readByteArray(PRIVACY_HEADER_LENGTH);
|
|
253
264
|
return {
|
|
254
265
|
flags,
|
|
255
266
|
sessionType,
|
|
256
267
|
hasPrivacyEnhancements: true,
|
|
257
|
-
hasMessageExtensions
|
|
268
|
+
hasMessageExtensions,
|
|
258
269
|
sessionId,
|
|
259
270
|
securityFlags,
|
|
260
271
|
obfuscatedRegion,
|
|
@@ -282,8 +293,27 @@ export class MessageCodec {
|
|
|
282
293
|
};
|
|
283
294
|
}
|
|
284
295
|
|
|
296
|
+
/**
|
|
297
|
+
* Decode the header of a received datagram and split off its payload. Only the header is checked here; the session
|
|
298
|
+
* that decrypts the payload checks the payload. Refuses with {@link UnexpectedDataError} a datagram whose header a
|
|
299
|
+
* session cannot be identified from. These are mostly the cases the CHIP SDK refuses before it tries a key;
|
|
300
|
+
* matter.js also refuses unicast control messages:
|
|
301
|
+
*
|
|
302
|
+
* - an unsupported header version or an unsupported session type
|
|
303
|
+
* - a control message
|
|
304
|
+
* - both destination flags set, or a unicast message with a destination group id
|
|
305
|
+
* - a group session message without destination group id (MCSP is not supported) or without source node id
|
|
306
|
+
* - the privacy flag on a unicast message, which the CHIP SDK does not support either
|
|
307
|
+
* - an unsecured unicast message with both or neither of source and destination node id
|
|
308
|
+
* - a datagram shorter than its header or its message extensions
|
|
309
|
+
*
|
|
310
|
+
* For a privacy message the counter, the source node id and the destination group id are obfuscated: the header
|
|
311
|
+
* then has message id 0 and neither `sourceNodeId` nor `destGroupId`, and {@link DecodedPacket.privacyHeader} holds
|
|
312
|
+
* the obfuscated region for the session to decode.
|
|
313
|
+
*/
|
|
285
314
|
static decodePacket(data: Bytes): DecodedPacket {
|
|
286
315
|
const {
|
|
316
|
+
flags,
|
|
287
317
|
sessionType,
|
|
288
318
|
hasPrivacyEnhancements,
|
|
289
319
|
hasMessageExtensions,
|
|
@@ -297,105 +327,92 @@ export class MessageCodec {
|
|
|
297
327
|
applicationPayload,
|
|
298
328
|
} = MessageCodec.decodeFixedHeader(data);
|
|
299
329
|
|
|
330
|
+
let messageExtension: Bytes | undefined = undefined;
|
|
331
|
+
let payload = applicationPayload;
|
|
332
|
+
if (hasMessageExtensions) {
|
|
333
|
+
const reader = new DataReader(applicationPayload, Endian.Little);
|
|
334
|
+
const extensionLength = reader.readUInt16();
|
|
335
|
+
if (extensionLength > reader.remainingBytesCount) {
|
|
336
|
+
throw new UnexpectedDataError(
|
|
337
|
+
`Message extension length ${extensionLength} exceeds remaining message size ${reader.remainingBytesCount}.`,
|
|
338
|
+
);
|
|
339
|
+
}
|
|
340
|
+
messageExtension = reader.readByteArray(extensionLength);
|
|
341
|
+
payload = reader.remainingBytes;
|
|
342
|
+
}
|
|
343
|
+
|
|
300
344
|
if (hasPrivacyEnhancements) {
|
|
301
345
|
// decodeFixedHeader sets obfuscatedRegion whenever privacy is enabled; assert the invariant for the type.
|
|
302
346
|
if (obfuscatedRegion === undefined) {
|
|
303
|
-
throw new
|
|
304
|
-
}
|
|
305
|
-
// Reject early: the privacy nonce is derived from the MIC, so a packet without a full MIC must not proceed.
|
|
306
|
-
if (applicationPayload.byteLength < CRYPTO_AEAD_MIC_LENGTH_BYTES) {
|
|
307
|
-
throw new UnexpectedDataError(
|
|
308
|
-
`Privacy-enhanced message too short to contain a MIC: ${applicationPayload.byteLength} bytes remaining.`,
|
|
309
|
-
);
|
|
347
|
+
throw new InternalError("Privacy-enhanced packet is missing its obfuscated header region.");
|
|
310
348
|
}
|
|
311
349
|
return {
|
|
312
350
|
header: {
|
|
351
|
+
messageFlags: flags,
|
|
313
352
|
securityFlags,
|
|
314
353
|
sessionId,
|
|
315
354
|
sessionType,
|
|
316
355
|
hasPrivacyEnhancements: true,
|
|
317
356
|
isControlMessage: false,
|
|
318
|
-
hasMessageExtensions
|
|
357
|
+
hasMessageExtensions,
|
|
319
358
|
messageId: 0,
|
|
320
359
|
sourceNodeId: undefined,
|
|
321
360
|
destNodeId: undefined,
|
|
322
361
|
destGroupId: undefined,
|
|
323
362
|
},
|
|
324
363
|
privacyHeader: obfuscatedRegion,
|
|
325
|
-
|
|
364
|
+
messageExtension,
|
|
365
|
+
applicationPayload: payload,
|
|
326
366
|
};
|
|
327
367
|
}
|
|
328
368
|
|
|
329
369
|
// decodeFixedHeader always reads the counter for non-privacy packets; assert the invariant for the type.
|
|
330
370
|
if (messageId === undefined) {
|
|
331
|
-
throw new
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
const header: DecodedPacketHeader = {
|
|
335
|
-
securityFlags,
|
|
336
|
-
sessionId,
|
|
337
|
-
sourceNodeId: sourceNodeId === undefined ? undefined : NodeId(sourceNodeId),
|
|
338
|
-
messageId,
|
|
339
|
-
destGroupId: destGroupId === undefined ? undefined : GroupId(destGroupId),
|
|
340
|
-
destNodeId: destNodeId === undefined ? undefined : NodeId(destNodeId),
|
|
341
|
-
sessionType,
|
|
342
|
-
hasPrivacyEnhancements: false,
|
|
343
|
-
isControlMessage: false,
|
|
344
|
-
hasMessageExtensions,
|
|
345
|
-
};
|
|
346
|
-
|
|
347
|
-
let messageExtension: Bytes | undefined = undefined;
|
|
348
|
-
let payload = applicationPayload;
|
|
349
|
-
if (hasMessageExtensions) {
|
|
350
|
-
const reader = new DataReader(applicationPayload, Endian.Little);
|
|
351
|
-
const extensionLength = reader.readUInt16();
|
|
352
|
-
if (extensionLength > reader.remainingBytesCount) {
|
|
353
|
-
throw new UnexpectedDataError(
|
|
354
|
-
`Message extension length ${extensionLength} exceeds remaining message size ${reader.remainingBytesCount}.`,
|
|
355
|
-
);
|
|
356
|
-
}
|
|
357
|
-
messageExtension = reader.readByteArray(extensionLength);
|
|
358
|
-
payload = reader.remainingBytes;
|
|
371
|
+
throw new InternalError("Message is missing its message counter.");
|
|
359
372
|
}
|
|
360
373
|
|
|
361
374
|
return {
|
|
362
|
-
header
|
|
375
|
+
header: {
|
|
376
|
+
messageFlags: flags,
|
|
377
|
+
securityFlags,
|
|
378
|
+
sessionId,
|
|
379
|
+
sourceNodeId: sourceNodeId === undefined ? undefined : NodeId(sourceNodeId),
|
|
380
|
+
messageId,
|
|
381
|
+
destGroupId: destGroupId === undefined ? undefined : GroupId(destGroupId),
|
|
382
|
+
destNodeId: destNodeId === undefined ? undefined : NodeId(destNodeId),
|
|
383
|
+
sessionType,
|
|
384
|
+
hasPrivacyEnhancements: false,
|
|
385
|
+
isControlMessage: false,
|
|
386
|
+
hasMessageExtensions,
|
|
387
|
+
},
|
|
363
388
|
messageExtension,
|
|
364
389
|
applicationPayload: payload,
|
|
365
390
|
};
|
|
366
391
|
}
|
|
367
392
|
|
|
393
|
+
/** Whether the message flags byte, which privacy never obfuscates, announces a destination group id. */
|
|
394
|
+
static hasDestGroupId(messageFlags: number) {
|
|
395
|
+
return (messageFlags & PacketHeaderFlag.HasDestGroupId) !== 0;
|
|
396
|
+
}
|
|
397
|
+
|
|
368
398
|
/**
|
|
369
399
|
* Decode the message counter and node/group IDs from a deobfuscated privacy header region. Presence of each field
|
|
370
|
-
* is determined from the (cleartext) message flags byte.
|
|
400
|
+
* is determined from the (cleartext) message flags byte. The region must come from {@link decodePacket}, which
|
|
401
|
+
* guarantees its length.
|
|
371
402
|
*/
|
|
372
403
|
static decodeObfuscatedHeaderFields(
|
|
373
404
|
messageFlags: number,
|
|
374
405
|
region: Bytes,
|
|
375
|
-
): Pick<DecodedPacketHeader, "messageId" | "sourceNodeId" | "
|
|
376
|
-
const
|
|
377
|
-
const hasDestGroupId = (messageFlags & PacketHeaderFlag.HasDestGroupId) !== 0;
|
|
406
|
+
): Pick<DecodedPacketHeader, "messageId" | "sourceNodeId" | "destGroupId"> {
|
|
407
|
+
const hasDestGroupId = MessageCodec.hasDestGroupId(messageFlags);
|
|
378
408
|
const hasSourceNodeId = (messageFlags & PacketHeaderFlag.HasSourceNodeId) !== 0;
|
|
379
409
|
|
|
380
|
-
if (hasDestNodeId && hasDestGroupId)
|
|
381
|
-
throw new UnexpectedDataError(
|
|
382
|
-
"The header cannot contain destination group and node at the same time. Reserved for future use. Discard message.",
|
|
383
|
-
);
|
|
384
|
-
|
|
385
|
-
const expectedLength = 4 + (hasSourceNodeId ? 8 : 0) + (hasDestNodeId ? 8 : hasDestGroupId ? 2 : 0);
|
|
386
|
-
if (region.byteLength < expectedLength) {
|
|
387
|
-
throw new UnexpectedDataError(
|
|
388
|
-
`Privacy header region length ${region.byteLength} is shorter than expected ${expectedLength}.`,
|
|
389
|
-
);
|
|
390
|
-
}
|
|
391
|
-
|
|
392
410
|
const reader = new DataReader(region, Endian.Little);
|
|
393
411
|
const messageId = reader.readUInt32();
|
|
394
412
|
const sourceNodeId = hasSourceNodeId ? NodeId(reader.readUInt64()) : undefined;
|
|
395
|
-
const destNodeId = hasDestNodeId ? NodeId(reader.readUInt64()) : undefined;
|
|
396
413
|
const destGroupId = hasDestGroupId ? GroupId(reader.readUInt16()) : undefined;
|
|
397
414
|
|
|
398
|
-
return { messageId, sourceNodeId,
|
|
415
|
+
return { messageId, sourceNodeId, destGroupId };
|
|
399
416
|
}
|
|
400
417
|
|
|
401
418
|
static decodePayload({ header, applicationPayload }: DecodedPacket): DecodedMessage {
|
|
@@ -412,12 +429,6 @@ export class MessageCodec {
|
|
|
412
429
|
securityExtension = reader.readByteArray(extensionLength);
|
|
413
430
|
}
|
|
414
431
|
|
|
415
|
-
if (header.sessionType === SessionType.Group && !header.isControlMessage) {
|
|
416
|
-
if (payloadHeader.requiresAck || payloadHeader.ackedMessageId) {
|
|
417
|
-
throw new UnexpectedDataError(`Group data messages cannot have requiresAck or ackedMessageId set.`);
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
|
|
421
432
|
return {
|
|
422
433
|
packetHeader: header,
|
|
423
434
|
payloadHeader,
|
|
@@ -14,6 +14,13 @@ export const TlvAttestation = TlvObject({
|
|
|
14
14
|
firmwareInfo: TlvOptionalField(4, TlvByteString),
|
|
15
15
|
});
|
|
16
16
|
|
|
17
|
+
/**
|
|
18
|
+
* RESP_MAX, the maximum length in bytes of AttestationElements and NOCSRElements.
|
|
19
|
+
*
|
|
20
|
+
* @see {@link MatterSpecification.v161.Core} § 11.18.4.1
|
|
21
|
+
*/
|
|
22
|
+
export const OPERATIONAL_CREDENTIALS_RESP_MAX = 900;
|
|
23
|
+
|
|
17
24
|
/** @see {@link MatterSpecification.v161.Core} § 11.18.4.8 */
|
|
18
25
|
export const TlvCertSigningRequest = TlvObject({
|
|
19
26
|
certSigningRequest: TlvField(1, TlvByteString),
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
asError,
|
|
9
9
|
AsyncCache,
|
|
10
10
|
Bytes,
|
|
11
|
+
CertificateError,
|
|
11
12
|
ClosedError,
|
|
12
13
|
Construction,
|
|
13
14
|
Crypto,
|
|
@@ -23,6 +24,7 @@ import {
|
|
|
23
24
|
hashAlgorithmForId,
|
|
24
25
|
Hours,
|
|
25
26
|
ImplementationError,
|
|
27
|
+
InternalError,
|
|
26
28
|
isObject,
|
|
27
29
|
Logger,
|
|
28
30
|
LogLevel,
|
|
@@ -34,10 +36,16 @@ import {
|
|
|
34
36
|
Time,
|
|
35
37
|
Timer,
|
|
36
38
|
} from "@matter/general";
|
|
37
|
-
import {
|
|
39
|
+
import {
|
|
40
|
+
DeviceAttestationPkiRevocationDclSchema,
|
|
41
|
+
ProductAttestationDclSchema,
|
|
42
|
+
RevocationTypeEnum,
|
|
43
|
+
} from "@matter/types";
|
|
44
|
+
import { CdSigners } from "../certificate/CdSigners.js";
|
|
38
45
|
import { MlDsaAttestationDisabledError, Paa, Pai } from "../certificate/kinds/AttestationCertificates.js";
|
|
39
46
|
import { Certificate } from "../certificate/kinds/Certificate.js";
|
|
40
47
|
import { certificateSignatureOf, verifyCertificateSignature } from "../certificate/kinds/CertificateSignature.js";
|
|
48
|
+
import { CertificationDeclaration } from "../certificate/kinds/CertificationDeclaration.js";
|
|
41
49
|
import { DclClient, MatterDclError, MatterDclResponseError } from "./DclClient.js";
|
|
42
50
|
import { DclConfig, DclGithubConfig } from "./DclConfig.js";
|
|
43
51
|
import { DclPkiRootCertificateSubjectReference } from "./DclRestApiTypes.js";
|
|
@@ -416,7 +424,7 @@ export class DclCertificateService {
|
|
|
416
424
|
}
|
|
417
425
|
|
|
418
426
|
/**
|
|
419
|
-
* Whether the service trusts test (non-production) certificates
|
|
427
|
+
* Whether the service trusts test (non-production) certificates: test PAAs and the Matter test CD signer.
|
|
420
428
|
*
|
|
421
429
|
* Independent of {@link Options.fetchTestCertificates} (which only governs whether test certs are
|
|
422
430
|
* downloaded). Defaults to {@link Options.acceptTestCertificates}, falling back to
|
|
@@ -820,6 +828,8 @@ export class DclCertificateService {
|
|
|
820
828
|
* @param derBytes DER-encoded X.509 certificate
|
|
821
829
|
* @param kind "PAA" (self-signed root) or "CDSigner" (CMS Certification Declaration signer)
|
|
822
830
|
* @param options.isProduction mark as production-trust; defaults to `false`
|
|
831
|
+
* @throws CertificateError for a "CDSigner" that is neither the Matter test CD signer certificate nor a
|
|
832
|
+
* certificate {@link CdSigners.verifyCertificate} accepts, as only those can sign a CD
|
|
823
833
|
*/
|
|
824
834
|
async addCertificate(
|
|
825
835
|
derBytes: Bytes,
|
|
@@ -829,13 +839,34 @@ export class DclCertificateService {
|
|
|
829
839
|
this.construction.assert();
|
|
830
840
|
|
|
831
841
|
const cert = parseTrustStoreCertificate(derBytes, kind);
|
|
832
|
-
const
|
|
842
|
+
const skidBytes = cert.extensions.subjectKeyIdentifier;
|
|
843
|
+
if (kind === "CDSigner") {
|
|
844
|
+
if (!CdSigners.isTestSigner(skidBytes)) {
|
|
845
|
+
await CdSigners.verifyCertificate(this.#crypto, derBytes, skidBytes);
|
|
846
|
+
} else if (
|
|
847
|
+
!Bytes.areEqual(cert.ellipticCurvePublicKey, CertificationDeclaration.testSignerInfo().publicKey)
|
|
848
|
+
) {
|
|
849
|
+
throw new CertificateError("Certificate has the test CD signer's key identifier but another key");
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
const skid = this.#normalizeSubjectKeyId(skidBytes);
|
|
833
853
|
|
|
834
854
|
if (this.#certificateIndex.has(skid)) {
|
|
835
855
|
return false;
|
|
836
856
|
}
|
|
837
857
|
|
|
838
|
-
|
|
858
|
+
await this.#putCertificate(cert, skid, derBytes, kind, options?.isProduction ?? false);
|
|
859
|
+
return true;
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
/** Write a parsed certificate and its index entry, replacing whatever is stored under `skid`. */
|
|
863
|
+
async #putCertificate(
|
|
864
|
+
cert: ReturnType<typeof parseTrustStoreCertificate>,
|
|
865
|
+
skid: string,
|
|
866
|
+
derBytes: Bytes,
|
|
867
|
+
kind: DclCertificateService.CertificateKind,
|
|
868
|
+
isProduction: boolean,
|
|
869
|
+
) {
|
|
839
870
|
const vid = (cert.subject as { vendorId?: number }).vendorId ?? 0;
|
|
840
871
|
|
|
841
872
|
await this.#storeCertificate(this.#storage!, skid, Bytes.of(derBytes), {
|
|
@@ -850,57 +881,122 @@ export class DclCertificateService {
|
|
|
850
881
|
await this.#saveIndex();
|
|
851
882
|
|
|
852
883
|
logger.info(`Added ${kind} certificate`, Diagnostic.dict({ skid, isProduction }));
|
|
853
|
-
return true;
|
|
854
884
|
}
|
|
855
885
|
|
|
856
886
|
/**
|
|
857
887
|
* Look up a CD signer certificate by its SubjectKeyIdentifier.
|
|
858
888
|
*
|
|
859
|
-
*
|
|
860
|
-
*
|
|
861
|
-
* CDSigner entry with `isProduction: true`.
|
|
889
|
+
* Returns `undefined` unless {@link lookupCdSigner} finds a CD signer. `isProduction` is `false` only for the
|
|
890
|
+
* Matter test CD signer, which this method returns whatever the test certificate policy.
|
|
862
891
|
*
|
|
863
|
-
*
|
|
892
|
+
* @deprecated Use {@link lookupCdSigner}.
|
|
864
893
|
*/
|
|
865
894
|
async getOrFetchCdSigner(
|
|
866
895
|
subjectKeyId: Bytes | string,
|
|
867
896
|
): Promise<{ publicKey: Bytes; isProduction: boolean } | undefined> {
|
|
897
|
+
const signer = await this.lookupCdSigner(subjectKeyId);
|
|
898
|
+
return signer === undefined ? undefined : { publicKey: signer.publicKey, isProduction: !signer.isTestSigner };
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
/**
|
|
902
|
+
* Look up the CD signer a Certification Declaration names by its subject key identifier.
|
|
903
|
+
*
|
|
904
|
+
* | Signer | Result |
|
|
905
|
+
* |-------------------------------------------------------------------------------|-------------------------|
|
|
906
|
+
* | Built-in CSA signing key or Matter test CD signer ({@link CdSigners.known}) | the signer |
|
|
907
|
+
* | Stored or seeded certificate that {@link CdSigners.verifyCertificate} accepts | the signer, also offline |
|
|
908
|
+
* | Online: DCL answer that {@link CdSigners.verifyCertificate} accepts | the signer, then stored |
|
|
909
|
+
* | Anything else, including an unreachable DCL or an offline service | `undefined` |
|
|
910
|
+
*
|
|
911
|
+
* The store is only a cache of DCL answers: a stored or seeded certificate counts only if it verifies. The Matter
|
|
912
|
+
* test CD signer is returned with `isTestSigner` set, also when this service does not accept test certificates; the
|
|
913
|
+
* caller applies that policy.
|
|
914
|
+
*
|
|
915
|
+
* @returns the signer, or `undefined` if the key is not known to be a CD signer
|
|
916
|
+
* @see {@link MatterSpecification.v161.Core} § 6.2.3.1
|
|
917
|
+
*/
|
|
918
|
+
async lookupCdSigner(subjectKeyId: Bytes | string): Promise<CdSigners.Signer | undefined> {
|
|
868
919
|
this.construction.assert();
|
|
869
920
|
|
|
870
921
|
const normalizedSkid = this.#normalizeSubjectKeyId(subjectKeyId);
|
|
922
|
+
if (
|
|
923
|
+
!/^[0-9A-F]+$/.test(normalizedSkid) ||
|
|
924
|
+
normalizedSkid.length !== CertificationDeclaration.SIGNER_SUBJECT_KEY_ID_LENGTH * 2
|
|
925
|
+
) {
|
|
926
|
+
return;
|
|
927
|
+
}
|
|
928
|
+
const skid = Bytes.fromHex(normalizedSkid);
|
|
871
929
|
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
930
|
+
const known = CdSigners.known(skid);
|
|
931
|
+
if (known !== undefined) {
|
|
932
|
+
return known;
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
if ((this.#certificateIndex.get(normalizedSkid)?.kind ?? "PAA") === "CDSigner") {
|
|
936
|
+
const storedDer = await this.#readStoredCdSigner(normalizedSkid);
|
|
937
|
+
const stored = storedDer && (await this.#verifiedCdSigner(storedDer, skid, "store"));
|
|
938
|
+
if (stored !== undefined) {
|
|
939
|
+
return { publicKey: stored.publicKey, isTestSigner: false };
|
|
940
|
+
}
|
|
878
941
|
}
|
|
879
942
|
|
|
880
943
|
if (this.#options.offline) {
|
|
881
|
-
return
|
|
944
|
+
return;
|
|
882
945
|
}
|
|
883
946
|
|
|
884
|
-
|
|
947
|
+
let answer: ProductAttestationDclSchema[];
|
|
885
948
|
try {
|
|
886
|
-
const
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
949
|
+
const dclClient = new DclClient(this.#options.dclConfig ?? DclConfig.production);
|
|
950
|
+
answer = await dclClient.fetchCertificatesBySubjectKeyId(normalizedSkid, this.#options);
|
|
951
|
+
} catch (error) {
|
|
952
|
+
logger.info(
|
|
953
|
+
`Failed to fetch CD signer ${normalizedSkid} from DCL:`,
|
|
954
|
+
Diagnostic.errorMessage(asError(error)),
|
|
955
|
+
);
|
|
956
|
+
return;
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
for (const { pemCert } of answer) {
|
|
960
|
+
const signer = await this.#verifiedCdSigner(pemCert, skid, "DCL");
|
|
961
|
+
if (signer !== undefined) {
|
|
962
|
+
// A stored CD signer that failed verification is replaced; a PAA under the same SKID stays
|
|
963
|
+
if ((this.#certificateIndex.get(normalizedSkid)?.kind ?? "CDSigner") === "CDSigner") {
|
|
964
|
+
const cert = parseTrustStoreCertificate(signer.der, "CDSigner");
|
|
965
|
+
await this.#putCertificate(cert, normalizedSkid, signer.der, "CDSigner", true);
|
|
966
|
+
}
|
|
967
|
+
return { publicKey: signer.publicKey, isTestSigner: false };
|
|
891
968
|
}
|
|
969
|
+
}
|
|
970
|
+
}
|
|
892
971
|
|
|
893
|
-
|
|
894
|
-
|
|
972
|
+
/** The stored DER of a CD signer, or `undefined` if it cannot be read, which then counts as not stored. */
|
|
973
|
+
async #readStoredCdSigner(skid: string) {
|
|
974
|
+
try {
|
|
975
|
+
return await this.#getCertificateDer(skid);
|
|
976
|
+
} catch (error) {
|
|
977
|
+
if (error instanceof InternalError || error instanceof ImplementationError) {
|
|
978
|
+
throw error;
|
|
979
|
+
}
|
|
980
|
+
logger.debug(`Stored CD signer ${skid} cannot be read:`, Diagnostic.errorMessage(asError(error)));
|
|
981
|
+
}
|
|
982
|
+
}
|
|
895
983
|
|
|
896
|
-
|
|
897
|
-
|
|
984
|
+
/**
|
|
985
|
+
* The DER and public key of a certificate, given as DER or PEM, that {@link CdSigners.verifyCertificate} accepts for
|
|
986
|
+
* `skid`, else `undefined`.
|
|
987
|
+
*/
|
|
988
|
+
async #verifiedCdSigner(certificate: Bytes | string, skid: Bytes, source: string) {
|
|
989
|
+
try {
|
|
990
|
+
const der = typeof certificate === "string" ? Pem.asDer(certificate) : certificate;
|
|
991
|
+
return { der, publicKey: await CdSigners.verifyCertificate(this.#crypto, der, skid) };
|
|
898
992
|
} catch (error) {
|
|
899
|
-
|
|
900
|
-
|
|
993
|
+
if (error instanceof InternalError || error instanceof ImplementationError) {
|
|
994
|
+
throw error;
|
|
995
|
+
}
|
|
996
|
+
logger.debug(
|
|
997
|
+
`${source}: certificate for ${Bytes.toHex(skid)} is not a CD signer:`,
|
|
901
998
|
Diagnostic.errorMessage(asError(error)),
|
|
902
999
|
);
|
|
903
|
-
return undefined;
|
|
904
1000
|
}
|
|
905
1001
|
}
|
|
906
1002
|
|
|
@@ -1221,7 +1317,7 @@ export class DclCertificateService {
|
|
|
1221
1317
|
|
|
1222
1318
|
/**
|
|
1223
1319
|
* Fetch CD signer certificates from the configured GitHub directory.
|
|
1224
|
-
* Stores each as a CDSigner entry with isProduction=false
|
|
1320
|
+
* Stores each as a CDSigner entry with isProduction=false; {@link lookupCdSigner} decides whether it is trusted.
|
|
1225
1321
|
*/
|
|
1226
1322
|
async #fetchGitHubCdSignerCertificates(storage: StorageContext, force: boolean) {
|
|
1227
1323
|
if (this.#githubRateLimited) {
|
|
@@ -1652,8 +1748,12 @@ export class DclCertificateService {
|
|
|
1652
1748
|
|
|
1653
1749
|
// Step 2
|
|
1654
1750
|
const signerDer = Pem.asDer(point.crlSignerCertificate);
|
|
1655
|
-
const signer = point.isPAA ? Paa.fromAsn1(signerDer) : Pai.fromAsn1(signerDer);
|
|
1656
1751
|
const delegator = point.crlSignerDelegator ? Pai.fromAsn1(Pem.asDer(point.crlSignerDelegator)) : undefined;
|
|
1752
|
+
// Only a signer on a PAI entry without a delegator must meet the PAI profile; any other signer parses without
|
|
1753
|
+
// one, and a missing basic constraints extension reads as not a CA
|
|
1754
|
+
const signer = point.isPAA
|
|
1755
|
+
? Paa.fromAsn1(signerDer, { acceptProfileViolation: true })
|
|
1756
|
+
: Pai.fromAsn1(signerDer, { acceptProfileViolation: delegator !== undefined });
|
|
1657
1757
|
const selfSigned =
|
|
1658
1758
|
sameName(nameOf(signer, "subject"), nameOf(signer, "issuer")) && (await this.#signsItself(signer));
|
|
1659
1759
|
|
|
@@ -1670,9 +1770,6 @@ export class DclCertificateService {
|
|
|
1670
1770
|
: "A CRL signer that is not delegated must be the PAA or PAI itself",
|
|
1671
1771
|
);
|
|
1672
1772
|
}
|
|
1673
|
-
if (delegator !== undefined && !delegator.cert.extensions.basicConstraints.isCa) {
|
|
1674
|
-
throw new CrlRejectedError("CRLSignerDelegator is not a PAI");
|
|
1675
|
-
}
|
|
1676
1773
|
|
|
1677
1774
|
// Steps 3-4
|
|
1678
1775
|
const vidHolder = point.isPAA ? signer : (delegator ?? signer);
|
|
@@ -2036,8 +2133,8 @@ export namespace DclCertificateService {
|
|
|
2036
2133
|
fetchTestCertificates?: boolean;
|
|
2037
2134
|
|
|
2038
2135
|
/**
|
|
2039
|
-
* Whether to trust test (non-production) certificates
|
|
2040
|
-
*
|
|
2136
|
+
* Whether to trust test (non-production) certificates. Controls whether a matched test PAA and a CD
|
|
2137
|
+
* signed by the Matter test CD signer are accepted during device attestation or flagged via a
|
|
2041
2138
|
* `TrustedAsTestCertificate` finding. Independent of `fetchTestCertificates`. Defaults to the value
|
|
2042
2139
|
* of `fetchTestCertificates` when not set.
|
|
2043
2140
|
*/
|
|
@@ -2070,6 +2167,8 @@ export namespace DclCertificateService {
|
|
|
2070
2167
|
*/
|
|
2071
2168
|
seed?: {
|
|
2072
2169
|
paaRoots?: SeedSource<CertSeedEntry>;
|
|
2170
|
+
|
|
2171
|
+
/** CD signer certificates; like the store, a cache that counts only for certificates the CSA issued. */
|
|
2073
2172
|
cdSigners?: SeedSource<CertSeedEntry>;
|
|
2074
2173
|
};
|
|
2075
2174
|
|