@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
|
@@ -10,19 +10,24 @@ import {
|
|
|
10
10
|
Crypto,
|
|
11
11
|
Diagnostic,
|
|
12
12
|
EcdsaSignature,
|
|
13
|
-
ImplementationError,
|
|
14
13
|
InternalError,
|
|
15
14
|
MaybePromise,
|
|
16
15
|
PublicKey,
|
|
17
16
|
} from "@matter/general";
|
|
18
17
|
import { MATTER_EPOCH_OFFSET_S, VendorId } from "@matter/types";
|
|
19
|
-
import { TlvAttestation } from "../common/OperationalCredentialsTypes.js";
|
|
18
|
+
import { OPERATIONAL_CREDENTIALS_RESP_MAX, TlvAttestation } from "../common/OperationalCredentialsTypes.js";
|
|
20
19
|
import { DclCertificateService } from "../dcl/DclCertificateService.js";
|
|
21
20
|
import { CommissioningError } from "../peer/CommissioningError.js";
|
|
21
|
+
import { CdSigners } from "./CdSigners.js";
|
|
22
22
|
import { Dac, Paa, Pai } from "./kinds/AttestationCertificates.js";
|
|
23
|
+
import { CertificateProfileError } from "./kinds/Certificate.js";
|
|
23
24
|
import { mayIssue } from "./kinds/CertificateSignature.js";
|
|
24
|
-
import { CertificationDeclaration } from "./kinds/CertificationDeclaration.js";
|
|
25
|
+
import { CertificationDeclaration, CertificationDeclarationFormatError } from "./kinds/CertificationDeclaration.js";
|
|
25
26
|
import { CertificationType } from "./kinds/definitions/certification-declaration.js";
|
|
27
|
+
import { isLocalDefect } from "./PeerData.js";
|
|
28
|
+
|
|
29
|
+
/** @see {@link MatterSpecification.v161.Core} § 6.3.1 */
|
|
30
|
+
const CD_FORMAT_VERSION = 1;
|
|
26
31
|
|
|
27
32
|
/** Reasons a device attestation validation can fail or produce warnings. */
|
|
28
33
|
export enum DeviceAttestationCheck {
|
|
@@ -33,6 +38,13 @@ export enum DeviceAttestationCheck {
|
|
|
33
38
|
AttestationSignatureInvalid = "AttestationSignatureInvalid",
|
|
34
39
|
AttestationNonceMismatch = "AttestationNonceMismatch",
|
|
35
40
|
CertificationDeclarationSignatureInvalid = "CertificationDeclarationSignatureInvalid",
|
|
41
|
+
/**
|
|
42
|
+
* A Certification Declaration field does not match the device. Collected as a recoverable error for the
|
|
43
|
+
* BasicInformation VendorID and ProductID, which the device reports about itself, also when it did not report them;
|
|
44
|
+
* thrown for a mismatch with the DAC or PAI.
|
|
45
|
+
*
|
|
46
|
+
* @see {@link MatterSpecification.v161.Core} § 6.2.3.1
|
|
47
|
+
*/
|
|
36
48
|
CertificationDeclarationFieldMismatch = "CertificationDeclarationFieldMismatch",
|
|
37
49
|
CertificateRevoked = "CertificateRevoked",
|
|
38
50
|
FirmwareInfoMismatch = "FirmwareInfoMismatch",
|
|
@@ -40,11 +52,54 @@ export enum DeviceAttestationCheck {
|
|
|
40
52
|
CertificationTypeTest = "CertificationTypeTest",
|
|
41
53
|
CertificateIdNotVerified = "CertificateIdNotVerified",
|
|
42
54
|
CertificateUnparseable = "CertificateUnparseable",
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* The DAC parses but violates the DAC certificate profile.
|
|
58
|
+
*
|
|
59
|
+
* @see {@link MatterSpecification.v161.Core} § 6.2.2.3
|
|
60
|
+
*/
|
|
61
|
+
DacFormatInvalid = "DacFormatInvalid",
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* The PAI parses but violates the PAI certificate profile.
|
|
65
|
+
*
|
|
66
|
+
* @see {@link MatterSpecification.v161.Core} § 6.2.2.4
|
|
67
|
+
*/
|
|
68
|
+
PaiFormatInvalid = "PaiFormatInvalid",
|
|
69
|
+
|
|
43
70
|
AttestationElementsUnparseable = "AttestationElementsUnparseable",
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* AttestationElements is longer than RESP_MAX.
|
|
74
|
+
*
|
|
75
|
+
* @see {@link MatterSpecification.v161.Core} § 11.18.4.1
|
|
76
|
+
*/
|
|
77
|
+
AttestationElementsTooLong = "AttestationElementsTooLong",
|
|
44
78
|
CertificationDeclarationUnparseable = "CertificationDeclarationUnparseable",
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* The CD breaks an encoding rule of § 6.3.1, such as its CMS envelope or `format_version`, or has a reserved
|
|
82
|
+
* `certification_type`, which CHIP refuses.
|
|
83
|
+
*/
|
|
84
|
+
CertificationDeclarationFormatInvalid = "CertificationDeclarationFormatInvalid",
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* The CD's signer is not known to be a CD signer: neither a built-in CSA key, the Matter test CD signer, nor a
|
|
88
|
+
* CSA-issued certificate from the DCL, the store or a seed. See {@link DclCertificateService.lookupCdSigner}.
|
|
89
|
+
*/
|
|
90
|
+
CdSignerUnknown = "CdSignerUnknown",
|
|
91
|
+
|
|
92
|
+
/** A CD of certification_type official is signed by the Matter test CD signer. */
|
|
93
|
+
OfficialCdSignedByTestSigner = "OfficialCdSignedByTestSigner",
|
|
94
|
+
|
|
95
|
+
/** @deprecated The CD signature is always verified; a CD from an unknown signer fails with {@link CdSignerUnknown}. */
|
|
45
96
|
CdSignerVerificationSkipped = "CdSignerVerificationSkipped",
|
|
46
97
|
PaaTrustStoreTimeMismatch = "PaaTrustStoreTimeMismatch",
|
|
47
98
|
DclServiceUnavailable = "DclServiceUnavailable",
|
|
99
|
+
/**
|
|
100
|
+
* A test PAA or the Matter test CD signer while the trust policy does not accept test certificates. Collected as a
|
|
101
|
+
* recoverable error so the policy decides.
|
|
102
|
+
*/
|
|
48
103
|
TrustedAsTestCertificate = "TrustedAsTestCertificate",
|
|
49
104
|
|
|
50
105
|
/** An unexpected error during validation (e.g. an unrecoverably corrupt trust-store certificate). */
|
|
@@ -65,6 +120,12 @@ export interface AttestationFinding {
|
|
|
65
120
|
|
|
66
121
|
/** Error thrown when device attestation validation encounters a hard failure. */
|
|
67
122
|
export class DeviceAttestationError extends CommissioningError {
|
|
123
|
+
/**
|
|
124
|
+
* Findings {@link DeviceAttestationValidator.validate} collected before this failure stopped validation, so a
|
|
125
|
+
* policy can see them next to the failure.
|
|
126
|
+
*/
|
|
127
|
+
readonly precedingFindings = new Array<AttestationFinding>();
|
|
128
|
+
|
|
68
129
|
constructor(
|
|
69
130
|
readonly failure: DeviceAttestationCheck,
|
|
70
131
|
message: string,
|
|
@@ -82,16 +143,43 @@ function parsePeerValue<T>(check: DeviceAttestationCheck, description: string, p
|
|
|
82
143
|
try {
|
|
83
144
|
return parse();
|
|
84
145
|
} catch (cause) {
|
|
85
|
-
|
|
86
|
-
if (cause instanceof InternalError || cause instanceof ImplementationError) {
|
|
146
|
+
if (isLocalDefect(cause) || cause instanceof DeviceAttestationError) {
|
|
87
147
|
throw cause;
|
|
88
148
|
}
|
|
89
149
|
throw new DeviceAttestationError(check, `${description}: ${asError(cause).message}`, { cause });
|
|
90
150
|
}
|
|
91
151
|
}
|
|
92
152
|
|
|
93
|
-
/** Parse
|
|
94
|
-
function
|
|
153
|
+
/** Parse the CD the peer supplied, reporting a broken encoding rule apart from a CD that cannot be decoded. */
|
|
154
|
+
function parsePeerCertificationDeclaration(declaration: Bytes) {
|
|
155
|
+
return parsePeerValue(
|
|
156
|
+
DeviceAttestationCheck.CertificationDeclarationUnparseable,
|
|
157
|
+
"Device returned a Certification Declaration that cannot be parsed",
|
|
158
|
+
() => {
|
|
159
|
+
try {
|
|
160
|
+
return CertificationDeclaration.parse(declaration);
|
|
161
|
+
} catch (cause) {
|
|
162
|
+
if (cause instanceof CertificationDeclarationFormatError) {
|
|
163
|
+
throw new DeviceAttestationError(
|
|
164
|
+
DeviceAttestationCheck.CertificationDeclarationFormatInvalid,
|
|
165
|
+
`Certification Declaration breaks an encoding rule: ${cause.message}`,
|
|
166
|
+
{ cause },
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
throw cause;
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Parse an attestation certificate the peer supplied, rejecting a missing certificate before the decoder sees it.
|
|
177
|
+
*
|
|
178
|
+
* A certificate that parses but violates its profile is reported as {@link DeviceAttestationCheck.DacFormatInvalid} or
|
|
179
|
+
* {@link DeviceAttestationCheck.PaiFormatInvalid}, anything else that fails as
|
|
180
|
+
* {@link DeviceAttestationCheck.CertificateUnparseable}.
|
|
181
|
+
*/
|
|
182
|
+
function parsePeerCertificate<T>(kind: "DAC" | "PAI", der: Bytes, parse: (der: Bytes) => T): T {
|
|
95
183
|
if (Bytes.of(der).byteLength === 0) {
|
|
96
184
|
throw new DeviceAttestationError(
|
|
97
185
|
DeviceAttestationCheck.CertificateUnparseable,
|
|
@@ -101,7 +189,22 @@ function parsePeerCertificate<T>(kind: string, der: Bytes, parse: (der: Bytes) =
|
|
|
101
189
|
return parsePeerValue(
|
|
102
190
|
DeviceAttestationCheck.CertificateUnparseable,
|
|
103
191
|
`Device returned a ${kind} certificate that cannot be parsed`,
|
|
104
|
-
() =>
|
|
192
|
+
() => {
|
|
193
|
+
try {
|
|
194
|
+
return parse(der);
|
|
195
|
+
} catch (cause) {
|
|
196
|
+
if (cause instanceof CertificateProfileError) {
|
|
197
|
+
throw new DeviceAttestationError(
|
|
198
|
+
kind === "DAC"
|
|
199
|
+
? DeviceAttestationCheck.DacFormatInvalid
|
|
200
|
+
: DeviceAttestationCheck.PaiFormatInvalid,
|
|
201
|
+
`Device returned a ${kind} certificate that violates the ${kind} profile: ${cause.message}`,
|
|
202
|
+
{ cause },
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
throw cause;
|
|
206
|
+
}
|
|
207
|
+
},
|
|
105
208
|
);
|
|
106
209
|
}
|
|
107
210
|
|
|
@@ -109,6 +212,10 @@ function idHex(id?: number) {
|
|
|
109
212
|
return id === undefined ? "undefined" : `0x${Diagnostic.hex(id, 4).toUpperCase()}`;
|
|
110
213
|
}
|
|
111
214
|
|
|
215
|
+
function basicInformationValue(id?: number) {
|
|
216
|
+
return id === undefined ? "(not reported by the device)" : idHex(id);
|
|
217
|
+
}
|
|
218
|
+
|
|
112
219
|
export namespace DeviceAttestationValidator {
|
|
113
220
|
export interface Context {
|
|
114
221
|
crypto: Crypto;
|
|
@@ -117,8 +224,8 @@ export namespace DeviceAttestationValidator {
|
|
|
117
224
|
/**
|
|
118
225
|
* DclCertificateService for PAA trust store, chain validation, revocation checks, and
|
|
119
226
|
* CD signer lookup. When absent, DCL-dependent checks are skipped (PAA lookup, chain
|
|
120
|
-
* verification, revocation
|
|
121
|
-
*
|
|
227
|
+
* verification, revocation) but local checks still run (nonce, signature, VendorID, CD fields),
|
|
228
|
+
* and the CD signature is verified with the built-in CSA keys and the Matter test CD signer only.
|
|
122
229
|
*/
|
|
123
230
|
dclCertificateService?: DclCertificateService;
|
|
124
231
|
}
|
|
@@ -129,8 +236,11 @@ export namespace DeviceAttestationValidator {
|
|
|
129
236
|
attestationElements: Bytes;
|
|
130
237
|
attestationSignature: Bytes;
|
|
131
238
|
attestationNonce: Bytes;
|
|
132
|
-
|
|
133
|
-
|
|
239
|
+
/** BasicInformation VendorID; undefined when the device did not report it. */
|
|
240
|
+
vendorId?: VendorId;
|
|
241
|
+
|
|
242
|
+
/** BasicInformation ProductID; undefined when the device did not report it. */
|
|
243
|
+
productId?: number;
|
|
134
244
|
}
|
|
135
245
|
|
|
136
246
|
/** Result of a successful validation, including any non-fatal findings. */
|
|
@@ -163,17 +273,35 @@ export namespace DeviceAttestationValidator {
|
|
|
163
273
|
* is provided.
|
|
164
274
|
*
|
|
165
275
|
* Most error-level failures throw immediately via {@link DeviceAttestationError}. A small
|
|
166
|
-
* set of recoverable error cases
|
|
167
|
-
*
|
|
168
|
-
*
|
|
276
|
+
* set of recoverable error cases are collected in `findings` so the caller can decide via
|
|
277
|
+
* `onFailure` whether to proceed: {@link DeviceAttestationCheck.TrustedAsTestCertificate}, and
|
|
278
|
+
* {@link DeviceAttestationCheck.CertificationDeclarationFieldMismatch} when the CD does not match the
|
|
279
|
+
* BasicInformation VendorID or ProductID the device reported, or the device did not report them.
|
|
280
|
+
* Warning and info findings are always collected. When a hard failure stops validation, the findings collected
|
|
281
|
+
* until then are in {@link DeviceAttestationError.precedingFindings}.
|
|
169
282
|
*/
|
|
170
283
|
export async function validate(context: Context, data: DeviceAttestationData): Promise<ValidationResult> {
|
|
171
|
-
const { crypto, dclCertificateService } = context;
|
|
172
284
|
const findings = new Array<AttestationFinding>();
|
|
285
|
+
try {
|
|
286
|
+
return { dacPublicKey: await validateCollecting(context, data, findings), findings };
|
|
287
|
+
} catch (error) {
|
|
288
|
+
if (error instanceof DeviceAttestationError) {
|
|
289
|
+
error.precedingFindings.push(...findings);
|
|
290
|
+
}
|
|
291
|
+
throw error;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
173
294
|
|
|
174
|
-
|
|
175
|
-
|
|
295
|
+
async function validateCollecting(
|
|
296
|
+
context: Context,
|
|
297
|
+
data: DeviceAttestationData,
|
|
298
|
+
findings: AttestationFinding[],
|
|
299
|
+
): Promise<ReturnType<typeof PublicKey>> {
|
|
300
|
+
const { crypto, dclCertificateService } = context;
|
|
301
|
+
|
|
302
|
+
// Step 1: Parse PAI and DAC from DER; the PAI goes first, as the CHIP SDK checks the PAI format first
|
|
176
303
|
const pai = parsePeerCertificate("PAI", data.pai, der => Pai.fromAsn1(der));
|
|
304
|
+
const dac = parsePeerCertificate("DAC", data.dac, der => Dac.fromAsn1(der));
|
|
177
305
|
|
|
178
306
|
// === Local checks (always run, no DCL needed) ===
|
|
179
307
|
|
|
@@ -185,6 +313,13 @@ export namespace DeviceAttestationValidator {
|
|
|
185
313
|
);
|
|
186
314
|
}
|
|
187
315
|
|
|
316
|
+
if (data.attestationElements.byteLength > OPERATIONAL_CREDENTIALS_RESP_MAX) {
|
|
317
|
+
throw new DeviceAttestationError(
|
|
318
|
+
DeviceAttestationCheck.AttestationElementsTooLong,
|
|
319
|
+
`Device returned attestation elements of ${data.attestationElements.byteLength} bytes, more than RESP_MAX of ${OPERATIONAL_CREDENTIALS_RESP_MAX}`,
|
|
320
|
+
);
|
|
321
|
+
}
|
|
322
|
+
|
|
188
323
|
// Step 6: AttestationNonce match
|
|
189
324
|
const attestationInfo = parsePeerValue(
|
|
190
325
|
DeviceAttestationCheck.AttestationElementsUnparseable,
|
|
@@ -366,44 +501,64 @@ export namespace DeviceAttestationValidator {
|
|
|
366
501
|
// === Remaining local checks (CD validation) ===
|
|
367
502
|
|
|
368
503
|
// Step 8: Certification Declaration signature verification
|
|
369
|
-
const cd =
|
|
370
|
-
DeviceAttestationCheck.CertificationDeclarationUnparseable,
|
|
371
|
-
"Device returned a Certification Declaration that cannot be parsed",
|
|
372
|
-
() => CertificationDeclaration.parse(attestationInfo.declaration),
|
|
373
|
-
);
|
|
504
|
+
const cd = parsePeerCertificationDeclaration(attestationInfo.declaration);
|
|
374
505
|
const cdSignerSkidHex = Bytes.toHex(cd.signerSubjectKeyId);
|
|
375
506
|
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
507
|
+
const cdSigner =
|
|
508
|
+
dclCertificateService === undefined
|
|
509
|
+
? CdSigners.known(cd.signerSubjectKeyId)
|
|
510
|
+
: await dclCertificateService.lookupCdSigner(cd.signerSubjectKeyId);
|
|
511
|
+
if (cdSigner === undefined) {
|
|
512
|
+
throw new DeviceAttestationError(
|
|
513
|
+
DeviceAttestationCheck.CdSignerUnknown,
|
|
514
|
+
`CD signer SKID ${cdSignerSkidHex} is not known to be a CD signer`,
|
|
515
|
+
);
|
|
516
|
+
}
|
|
517
|
+
try {
|
|
518
|
+
await crypto.verifyEcdsa(PublicKey(cdSigner.publicKey), cd.signedData, cd.signature);
|
|
519
|
+
} catch {
|
|
520
|
+
throw new DeviceAttestationError(
|
|
521
|
+
DeviceAttestationCheck.CertificationDeclarationSignatureInvalid,
|
|
522
|
+
"Certification Declaration signature verification failed",
|
|
523
|
+
);
|
|
524
|
+
}
|
|
525
|
+
if (cdSigner.isTestSigner && dclCertificateService?.acceptsTestCertificates === false) {
|
|
395
526
|
findings.push({
|
|
396
|
-
level: "
|
|
397
|
-
type: DeviceAttestationCheck.
|
|
398
|
-
message:
|
|
527
|
+
level: "error",
|
|
528
|
+
type: DeviceAttestationCheck.TrustedAsTestCertificate,
|
|
529
|
+
message:
|
|
530
|
+
`CD is signed by the Matter test CD signer ${cdSignerSkidHex}; ` +
|
|
531
|
+
"the device presented a valid test attestation but production trust policy is in effect",
|
|
399
532
|
});
|
|
400
533
|
}
|
|
401
534
|
|
|
402
535
|
// Step 9: Certification Declaration field validation (Matter spec Section 6.2.3.1)
|
|
403
536
|
const cdContent = cd.content;
|
|
404
537
|
|
|
405
|
-
|
|
538
|
+
if (cdContent.formatVersion !== CD_FORMAT_VERSION) {
|
|
539
|
+
throw new DeviceAttestationError(
|
|
540
|
+
DeviceAttestationCheck.CertificationDeclarationFormatInvalid,
|
|
541
|
+
`CD format_version ${cdContent.formatVersion} is not ${CD_FORMAT_VERSION}`,
|
|
542
|
+
);
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
// Reserved certification_type values are refused like CHIP does; the specification only marks them reserved
|
|
406
546
|
const certType = cdContent.certificationType;
|
|
547
|
+
if (certType > CertificationType.Official) {
|
|
548
|
+
throw new DeviceAttestationError(
|
|
549
|
+
DeviceAttestationCheck.CertificationDeclarationFormatInvalid,
|
|
550
|
+
`CD certification_type ${certType} is a reserved value`,
|
|
551
|
+
);
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
// § 6.3.1 allows a test-signed CD with certification_type 0; CHIP also accepts provisional, so only official fails
|
|
555
|
+
if (certType === CertificationType.Official && cdSigner.isTestSigner) {
|
|
556
|
+
throw new DeviceAttestationError(
|
|
557
|
+
DeviceAttestationCheck.OfficialCdSignedByTestSigner,
|
|
558
|
+
"CD with certification_type=2 (official) is signed by the Matter test CD signer",
|
|
559
|
+
);
|
|
560
|
+
}
|
|
561
|
+
|
|
407
562
|
if (certType === CertificationType.Provisional) {
|
|
408
563
|
findings.push({
|
|
409
564
|
level: "warning",
|
|
@@ -423,18 +578,20 @@ export namespace DeviceAttestationValidator {
|
|
|
423
578
|
|
|
424
579
|
// vendor_id SHALL match BasicInformation VendorID
|
|
425
580
|
if (cdContent.vendorId !== data.vendorId) {
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
581
|
+
findings.push({
|
|
582
|
+
level: "error",
|
|
583
|
+
type: DeviceAttestationCheck.CertificationDeclarationFieldMismatch,
|
|
584
|
+
message: `CD vendor_id ${idHex(cdContent.vendorId)} does not match BasicInformation VendorID ${basicInformationValue(data.vendorId)}`,
|
|
585
|
+
});
|
|
430
586
|
}
|
|
431
587
|
|
|
432
588
|
// product_id_array SHALL contain BasicInformation ProductID
|
|
433
|
-
if (
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
589
|
+
if (cdContent.produceIdArray.every(id => id !== data.productId)) {
|
|
590
|
+
findings.push({
|
|
591
|
+
level: "error",
|
|
592
|
+
type: DeviceAttestationCheck.CertificationDeclarationFieldMismatch,
|
|
593
|
+
message: `CD product_id_array [${cdContent.produceIdArray.map(idHex).join(", ")}] does not contain BasicInformation ProductID ${basicInformationValue(data.productId)}`,
|
|
594
|
+
});
|
|
438
595
|
}
|
|
439
596
|
|
|
440
597
|
// CD SHALL contain both or neither of dac_origin_vendor_id and dac_origin_product_id
|
|
@@ -533,6 +690,6 @@ export namespace DeviceAttestationValidator {
|
|
|
533
690
|
// compare attestationInfo.firmwareInfo bytes against expected value and emit a
|
|
534
691
|
// FirmwareInfoMismatch warning finding on mismatch. Validation is MAY per spec.
|
|
535
692
|
|
|
536
|
-
return
|
|
693
|
+
return dacPublicKey;
|
|
537
694
|
}
|
|
538
695
|
}
|
|
@@ -112,8 +112,12 @@ export class DeviceCertification {
|
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
// Parse DAC and PAI
|
|
115
|
-
|
|
116
|
-
const
|
|
115
|
+
// The commissioner judges the profile; a device only needs VendorID and ProductID to match its product
|
|
116
|
+
const dac = Dac.fromAsn1(certificate, { acceptProfileViolation: true, acceptMalformedVidPid: true });
|
|
117
|
+
const pai = Pai.fromAsn1(intermediateCertificate, {
|
|
118
|
+
acceptProfileViolation: true,
|
|
119
|
+
acceptMalformedVidPid: true,
|
|
120
|
+
});
|
|
117
121
|
|
|
118
122
|
// Validate vendorId from DAC matches product
|
|
119
123
|
const dacVendorId = dac.cert.subject.vendorId;
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022-2026 Matter.js Authors
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { asError, Bytes, Crypto, EcdsaSignature, MaybePromise, PublicKey } from "@matter/general";
|
|
8
|
+
import { OperationalCredentials } from "@matter/types/clusters/operational-credentials";
|
|
9
|
+
import { OPERATIONAL_CREDENTIALS_RESP_MAX, TlvCertSigningRequest } from "../common/OperationalCredentialsTypes.js";
|
|
10
|
+
import { CommissioningError } from "../peer/CommissioningError.js";
|
|
11
|
+
import { Certificate } from "./kinds/Certificate.js";
|
|
12
|
+
import { isLocalDefect } from "./PeerData.js";
|
|
13
|
+
|
|
14
|
+
/** Reasons a CSRResponse fails validation. */
|
|
15
|
+
export enum NocsrCheck {
|
|
16
|
+
/** NOCSRElements or AttestationSignature is missing. */
|
|
17
|
+
FieldMissing = "FieldMissing",
|
|
18
|
+
|
|
19
|
+
/** NOCSRElements or AttestationSignature is empty. */
|
|
20
|
+
ResponseEmpty = "ResponseEmpty",
|
|
21
|
+
|
|
22
|
+
/** NOCSRElements is longer than {@link OPERATIONAL_CREDENTIALS_RESP_MAX}. */
|
|
23
|
+
ElementsTooLong = "ElementsTooLong",
|
|
24
|
+
|
|
25
|
+
/** The AttestationSignature is malformed or does not verify with the DAC public key. */
|
|
26
|
+
AttestationSignatureInvalid = "AttestationSignatureInvalid",
|
|
27
|
+
|
|
28
|
+
/** NOCSRElements is not a valid NOCSR Information structure. */
|
|
29
|
+
ElementsUnparseable = "ElementsUnparseable",
|
|
30
|
+
|
|
31
|
+
/** The CSRNonce in NOCSRElements is not the one sent in CSRRequest. */
|
|
32
|
+
CsrNonceMismatch = "CsrNonceMismatch",
|
|
33
|
+
|
|
34
|
+
/** The PKCS #10 CSR is malformed, uses another algorithm or key type, or its own signature does not verify. */
|
|
35
|
+
CsrInvalid = "CsrInvalid",
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** A CSRResponse failed one of the checks in {@link NocsrCheck}. */
|
|
39
|
+
export class NocsrError extends CommissioningError {
|
|
40
|
+
constructor(
|
|
41
|
+
readonly failure: NocsrCheck,
|
|
42
|
+
message: string,
|
|
43
|
+
options?: ErrorOptions,
|
|
44
|
+
) {
|
|
45
|
+
super(message, options);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export namespace NocsrValidator {
|
|
50
|
+
export interface Context {
|
|
51
|
+
crypto: Crypto;
|
|
52
|
+
|
|
53
|
+
/** The attestation challenge of the secure session the CSRRequest was sent on. */
|
|
54
|
+
attestationChallenge: Bytes;
|
|
55
|
+
|
|
56
|
+
/** The CSRNonce sent in CSRRequest. */
|
|
57
|
+
csrNonce: Bytes;
|
|
58
|
+
|
|
59
|
+
/** The public key of the DAC the device reported, in device attestation or a CertificateChainRequest. */
|
|
60
|
+
dacPublicKey: PublicKey;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** A CSRResponse as decoded, so a mandatory field the device left out is `undefined`. */
|
|
64
|
+
export type Response = Partial<OperationalCredentials.CsrResponse>;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Validate a CSRResponse and return the operational public key of its CSR.
|
|
68
|
+
*
|
|
69
|
+
* Every check is a hard failure; unlike device attestation, no commissioning policy can accept it.
|
|
70
|
+
*
|
|
71
|
+
* Throws {@link NocsrError} with the failed {@link NocsrCheck}. An `InternalError` or `ImplementationError`
|
|
72
|
+
* propagates unchanged, because it is a defect of our own code, not of the device's data.
|
|
73
|
+
*
|
|
74
|
+
* @see {@link MatterSpecification.v161.Core} § 6.4.6.1.1
|
|
75
|
+
* @see {@link MatterSpecification.v161.Core} § 11.18.4.1
|
|
76
|
+
* @see {@link MatterSpecification.v161.Core} § 11.18.4.9
|
|
77
|
+
*/
|
|
78
|
+
export async function validate(
|
|
79
|
+
{ crypto, attestationChallenge, csrNonce, dacPublicKey }: Context,
|
|
80
|
+
{ nocsrElements, attestationSignature }: Response,
|
|
81
|
+
): Promise<Bytes> {
|
|
82
|
+
if (nocsrElements === undefined || attestationSignature === undefined) {
|
|
83
|
+
throw new NocsrError(NocsrCheck.FieldMissing, "CSRResponse lacks NOCSRElements or AttestationSignature");
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (nocsrElements.byteLength === 0 || attestationSignature.byteLength === 0) {
|
|
87
|
+
throw new NocsrError(
|
|
88
|
+
NocsrCheck.ResponseEmpty,
|
|
89
|
+
"CSRResponse has empty NOCSRElements or AttestationSignature",
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (nocsrElements.byteLength > OPERATIONAL_CREDENTIALS_RESP_MAX) {
|
|
94
|
+
throw new NocsrError(
|
|
95
|
+
NocsrCheck.ElementsTooLong,
|
|
96
|
+
`CSRResponse NOCSRElements has ${nocsrElements.byteLength} bytes, more than RESP_MAX of ${OPERATIONAL_CREDENTIALS_RESP_MAX}`,
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
await checkPeerData(
|
|
101
|
+
NocsrCheck.AttestationSignatureInvalid,
|
|
102
|
+
"CSRResponse AttestationSignature does not verify with the DAC public key",
|
|
103
|
+
() =>
|
|
104
|
+
crypto.verifyEcdsa(
|
|
105
|
+
dacPublicKey,
|
|
106
|
+
Bytes.concat(nocsrElements, attestationChallenge),
|
|
107
|
+
new EcdsaSignature(attestationSignature),
|
|
108
|
+
),
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
const info = await checkPeerData(
|
|
112
|
+
NocsrCheck.ElementsUnparseable,
|
|
113
|
+
"CSRResponse NOCSRElements cannot be decoded",
|
|
114
|
+
() => TlvCertSigningRequest.decode(nocsrElements),
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
if (!Bytes.areEqual(info.csrNonce, csrNonce)) {
|
|
118
|
+
throw new NocsrError(
|
|
119
|
+
NocsrCheck.CsrNonceMismatch,
|
|
120
|
+
"CSRNonce in the CSRResponse does not match the nonce sent to the device",
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return checkPeerData(NocsrCheck.CsrInvalid, "CSRResponse contains an invalid CSR", () =>
|
|
125
|
+
Certificate.getPublicKeyFromCsr(crypto, info.certSigningRequest),
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/** Run a step over the device's data and report its failure as {@link check}. */
|
|
131
|
+
async function checkPeerData<T>(check: NocsrCheck, description: string, step: () => MaybePromise<T>): Promise<T> {
|
|
132
|
+
try {
|
|
133
|
+
return await step();
|
|
134
|
+
} catch (cause) {
|
|
135
|
+
if (isLocalDefect(cause)) {
|
|
136
|
+
throw cause;
|
|
137
|
+
}
|
|
138
|
+
throw new NocsrError(check, `${description}: ${asError(cause).message}`, { cause });
|
|
139
|
+
}
|
|
140
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022-2026 Matter.js Authors
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { ImplementationError, InternalError } from "@matter/general";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Whether an error raised while processing data a peer supplied is a defect of our own code. A validator reports any
|
|
11
|
+
* other error as a failure of the peer's data.
|
|
12
|
+
*/
|
|
13
|
+
export function isLocalDefect(error: unknown) {
|
|
14
|
+
return error instanceof InternalError || error instanceof ImplementationError;
|
|
15
|
+
}
|
package/src/certificate/index.ts
CHANGED
|
@@ -5,10 +5,12 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
export * from "./AttestationCertificateManager.js";
|
|
8
|
+
export * from "./CdSigners.js";
|
|
8
9
|
export * from "./CertificateAuthority.js";
|
|
9
10
|
export * from "./ChipPAAuthorities.js";
|
|
10
11
|
export * from "./DeviceAttestationValidator.js";
|
|
11
12
|
export * from "./DeviceCertification.js";
|
|
13
|
+
export * from "./NocsrValidator.js";
|
|
12
14
|
export * from "./kinds/AttestationCertificates.js";
|
|
13
15
|
export * from "./kinds/Certificate.js";
|
|
14
16
|
export * from "./kinds/CertificateSignature.js";
|