@matter/protocol 0.18.0 → 0.18.1-alpha.0-20261111-b89790712
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 +19 -20
- 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/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/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 +53 -7
- package/dist/cjs/certificate/DeviceAttestationValidator.d.ts.map +1 -1
- package/dist/cjs/certificate/DeviceAttestationValidator.js +114 -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/index.d.ts +1 -0
- package/dist/cjs/certificate/index.d.ts.map +1 -1
- package/dist/cjs/certificate/index.js +1 -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/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/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/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.map +1 -1
- package/dist/cjs/peer/ControllerCommissioner.js +48 -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 +109 -32
- package/dist/cjs/peer/ControllerCommissioningFlow.js.map +1 -1
- 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 +1 -0
- package/dist/cjs/peer/index.d.ts.map +1 -1
- package/dist/cjs/peer/index.js +1 -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 +16 -6
- 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 +19 -20
- 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/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/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 +53 -7
- package/dist/esm/certificate/DeviceAttestationValidator.d.ts.map +1 -1
- package/dist/esm/certificate/DeviceAttestationValidator.js +115 -43
- 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/index.d.ts +1 -0
- package/dist/esm/certificate/index.d.ts.map +1 -1
- package/dist/esm/certificate/index.js +1 -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/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/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/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.map +1 -1
- package/dist/esm/peer/ControllerCommissioner.js +48 -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 +109 -32
- package/dist/esm/peer/ControllerCommissioningFlow.js.map +1 -1
- 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 +1 -0
- package/dist/esm/peer/index.d.ts.map +1 -1
- package/dist/esm/peer/index.js +1 -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 +16 -6
- 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 +19 -21
- package/src/action/client/ClientRequest.ts +15 -0
- package/src/action/client/InputChunk.ts +57 -2
- 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/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 +202 -54
- package/src/certificate/DeviceCertification.ts +6 -2
- package/src/certificate/index.ts +1 -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/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/mdns/InterfaceResponder.ts +1031 -0
- package/src/mdns/MdnsServer.ts +400 -360
- package/src/peer/CommissioningConnection.ts +5 -1
- package/src/peer/ControllerCommissioner.ts +57 -19
- package/src/peer/ControllerCommissioningFlow.ts +132 -56
- 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 +1 -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 +22 -6
- 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
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
import { BleError } from "#ble/Ble.js";
|
|
7
8
|
import { CommissionableDevice } from "#common/Scanner.js";
|
|
8
9
|
import { CommissioningError, PairRetransmissionLimitReachedError } from "#peer/CommissioningError.js";
|
|
9
10
|
import { NodeSession } from "#session/NodeSession.js";
|
|
@@ -175,7 +176,9 @@ export async function CommissioningConnection(
|
|
|
175
176
|
asErr.message,
|
|
176
177
|
);
|
|
177
178
|
lastNonRetryableError = asErr;
|
|
178
|
-
} else if (
|
|
179
|
+
} else if (
|
|
180
|
+
causedBy(asErr, NoResponseTimeoutError, TransientPeerCommunicationError, NetworkError, BleError)
|
|
181
|
+
) {
|
|
179
182
|
lastError = asErr;
|
|
180
183
|
logger.warn(
|
|
181
184
|
`Address ${ServerAddress.urlFor(candidate.address)} unreachable for ${candidate.device.deviceIdentifier}`,
|
|
@@ -234,6 +237,7 @@ export async function CommissioningConnection(
|
|
|
234
237
|
if (lastError !== undefined) {
|
|
235
238
|
throw new PairRetransmissionLimitReachedError(
|
|
236
239
|
`Failed to connect on any discovered server: ${lastError.message}`,
|
|
240
|
+
{ cause: lastError },
|
|
237
241
|
);
|
|
238
242
|
}
|
|
239
243
|
throw new PairRetransmissionLimitReachedError("Failed to connect on any discovered server");
|
|
@@ -22,6 +22,7 @@ import { DedicatedChannelExchangeProvider } from "#protocol/ExchangeProvider.js"
|
|
|
22
22
|
import { ChannelStatusResponseError } from "#securechannel/SecureChannelMessenger.js";
|
|
23
23
|
import { NodeSession } from "#session/NodeSession.js";
|
|
24
24
|
import { PaseClient } from "#session/pase/PaseClient.js";
|
|
25
|
+
import { Session } from "#session/Session.js";
|
|
25
26
|
import { SessionManager } from "#session/SessionManager.js";
|
|
26
27
|
import { SessionParameters } from "#session/SessionParameters.js";
|
|
27
28
|
import {
|
|
@@ -403,7 +404,7 @@ export class ControllerCommissioner {
|
|
|
403
404
|
options.retryFailureAsPeerCommunication !== undefined &&
|
|
404
405
|
causedBy(error, PairRetransmissionLimitReachedError)
|
|
405
406
|
) {
|
|
406
|
-
throw new PeerCommunicationError(options.retryFailureAsPeerCommunication);
|
|
407
|
+
throw new PeerCommunicationError(options.retryFailureAsPeerCommunication, { cause: error });
|
|
407
408
|
}
|
|
408
409
|
throw error;
|
|
409
410
|
}
|
|
@@ -466,16 +467,23 @@ export class ControllerCommissioner {
|
|
|
466
467
|
SECURE_CHANNEL_PROTOCOL_ID,
|
|
467
468
|
);
|
|
468
469
|
|
|
470
|
+
const unsecuredBleClose =
|
|
471
|
+
paseChannel instanceof BleChannel ? this.#closeOnBleLoss(unsecuredSession, paseChannel) : undefined;
|
|
472
|
+
|
|
473
|
+
let paseSession: NodeSession;
|
|
474
|
+
let paseBleClose: (() => Promise<void> | undefined) | undefined;
|
|
469
475
|
try {
|
|
470
|
-
|
|
476
|
+
paseSession = await this.#paseClient.pair(
|
|
471
477
|
this.#context.sessions.sessionParameters,
|
|
472
478
|
paseExchange,
|
|
473
479
|
paseChannel,
|
|
474
480
|
passcode,
|
|
475
481
|
{ abort: signal, suppressPeerLoss, onPbkdfParamResponse },
|
|
476
482
|
);
|
|
483
|
+
if (paseChannel instanceof BleChannel) {
|
|
484
|
+
paseBleClose = this.#closeOnBleLoss(paseSession, paseChannel);
|
|
485
|
+
}
|
|
477
486
|
await unsecuredSession.detachChannel()?.release();
|
|
478
|
-
return caseSession;
|
|
479
487
|
} catch (e) {
|
|
480
488
|
// Close the exchange and rethrow
|
|
481
489
|
if (causedBy(e, ChannelStatusResponseError)) {
|
|
@@ -485,10 +493,56 @@ export class ControllerCommissioner {
|
|
|
485
493
|
}
|
|
486
494
|
throw e;
|
|
487
495
|
} finally {
|
|
496
|
+
await unsecuredBleClose?.();
|
|
488
497
|
await unsecuredSession.initiateForceClose({
|
|
489
498
|
cause: new CommissioningTransitionError("PASE session has transitioned to CASE"),
|
|
490
499
|
});
|
|
491
500
|
}
|
|
501
|
+
|
|
502
|
+
// Keep after the last await: a session the BLE watch closed must not win the candidate race
|
|
503
|
+
const bleClosing = paseBleClose?.();
|
|
504
|
+
if (bleClosing !== undefined) {
|
|
505
|
+
await bleClosing;
|
|
506
|
+
throw new BleChannelClosedError(`BLE transport closed while PASE completed on ${paseSession.via}`);
|
|
507
|
+
}
|
|
508
|
+
return paseSession;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
/**
|
|
512
|
+
* Force-closes `session` with a {@link BleChannelClosedError} once `channel` closes, so its pending exchanges reject
|
|
513
|
+
* at once instead of waiting out PASE response or MRP timeouts. A channel that already closed closes the session
|
|
514
|
+
* immediately. The watch ends when the session starts closing.
|
|
515
|
+
*
|
|
516
|
+
* {@link ControllerCommissioningFlow} treats the resulting `BleDisconnectedError` as a commissioning-channel
|
|
517
|
+
* drop, so a non-concurrent device that leaves BLE after ConnectNetwork continues over its operational network.
|
|
518
|
+
*
|
|
519
|
+
* @returns a function returning the force-close a channel loss started, or `undefined`; that promise never rejects
|
|
520
|
+
*/
|
|
521
|
+
#closeOnBleLoss(session: Session, channel: BleChannel) {
|
|
522
|
+
let forceClose: Promise<void> | undefined;
|
|
523
|
+
const stopWatching = () => {
|
|
524
|
+
channel.closed.off(onChannelClosed);
|
|
525
|
+
session.closing.off(onSessionClosing);
|
|
526
|
+
};
|
|
527
|
+
const onSessionClosing = (closing: boolean) => {
|
|
528
|
+
if (closing) {
|
|
529
|
+
stopWatching();
|
|
530
|
+
}
|
|
531
|
+
};
|
|
532
|
+
const onChannelClosed = () => {
|
|
533
|
+
stopWatching();
|
|
534
|
+
forceClose = session
|
|
535
|
+
.initiateForceClose({ cause: new BleChannelClosedError(`BLE transport closed on ${session.via}`) })
|
|
536
|
+
.catch(error => logger.warn(session.via, "Error while force-closing PASE session on BLE close", error));
|
|
537
|
+
};
|
|
538
|
+
|
|
539
|
+
if (channel.isClosed) {
|
|
540
|
+
onChannelClosed();
|
|
541
|
+
} else {
|
|
542
|
+
channel.closed.on(onChannelClosed);
|
|
543
|
+
session.closing.on(onSessionClosing);
|
|
544
|
+
}
|
|
545
|
+
return () => forceClose;
|
|
492
546
|
}
|
|
493
547
|
|
|
494
548
|
/** Validate if a Peer Address is already known and commissioned */
|
|
@@ -634,22 +688,6 @@ export class ControllerCommissioner {
|
|
|
634
688
|
logger.info(`Start commissioning of node ${address.toString()} into fabric ${fabric.fabricId}`);
|
|
635
689
|
const exchangeProvider = new DedicatedChannelExchangeProvider(this.#context.exchanges, ephemeralSession);
|
|
636
690
|
|
|
637
|
-
// BLE-only: BTP MRP retrans blocks pending invokes for ~45s when a non-concurrent device
|
|
638
|
-
// drops BLE after connectNetwork. Force-close on BLE-lost so the awaited invoke rejects
|
|
639
|
-
// immediately and the commissioning flow can flip to the non-concurrent CASE path.
|
|
640
|
-
if (!ephemeralSession.isClosed) {
|
|
641
|
-
const paseChannel = ephemeralSession.channel.transportChannel;
|
|
642
|
-
if (paseChannel instanceof BleChannel) {
|
|
643
|
-
paseChannel.closed.once(() => {
|
|
644
|
-
ephemeralSession
|
|
645
|
-
.initiateForceClose({
|
|
646
|
-
cause: new BleChannelClosedError(`BLE transport closed on ${ephemeralSession.via}`),
|
|
647
|
-
})
|
|
648
|
-
.catch(error => logger.warn("Error while force-closing PASE session on BLE close", error));
|
|
649
|
-
});
|
|
650
|
-
}
|
|
651
|
-
}
|
|
652
|
-
|
|
653
691
|
await using commissioner = new commissioningFlowImpl(
|
|
654
692
|
new ClientInteraction({
|
|
655
693
|
environment: this.#context.environment,
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import { ClientInteraction } from "#action/client/ClientInteraction.js";
|
|
8
8
|
import { ClientRead } from "#action/client/ClientRead.js";
|
|
9
|
+
import { ClientRequest } from "#action/client/ClientRequest.js";
|
|
9
10
|
import { WriteResult } from "#action/index.js";
|
|
10
11
|
import { Invoke } from "#action/request/Invoke.js";
|
|
11
12
|
import { Read } from "#action/request/Read.js";
|
|
@@ -139,13 +140,13 @@ export type ControllerCommissioningFlowOptions = {
|
|
|
139
140
|
* - throw any error to reject by rethrowing that error verbatim (no wrapping)
|
|
140
141
|
* - `undefined`: accept with warning logging (backward compatibility)
|
|
141
142
|
*
|
|
142
|
-
* The callback receives
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
143
|
+
* The callback receives the findings collected during validation: warning/info-level findings
|
|
144
|
+
* (e.g. provisional CD, test CD, no revocation data) and the recoverable error-level findings
|
|
145
|
+
* `TrustedAsTestCertificate` and `CertificationDeclarationFieldMismatch` for the BasicInformation
|
|
146
|
+
* VendorID and ProductID, which the commissioner must decide on like a hard failure. When a hard
|
|
147
|
+
* failure (invalid chain, bad signature, revoked certificate, untrusted PAA, DCL service
|
|
148
|
+
* unavailable) stops validation, its error-level finding comes last, after the findings collected
|
|
149
|
+
* until then.
|
|
149
150
|
*
|
|
150
151
|
* TODO: Make required in next breaking version and remove undefined backward-compatible accept
|
|
151
152
|
*/
|
|
@@ -329,6 +330,7 @@ export class ControllerCommissioningFlow {
|
|
|
329
330
|
protected collectedCommissioningData: CollectedCommissioningData = {};
|
|
330
331
|
#defaultFailSafeTime = DEFAULT_FAILSAFE_TIME;
|
|
331
332
|
#armFailsafeInterval?: Timer;
|
|
333
|
+
#periodicArm?: Promise<unknown>;
|
|
332
334
|
|
|
333
335
|
constructor(
|
|
334
336
|
/** ClientInteraction for the initiated PASE session */
|
|
@@ -354,7 +356,7 @@ export class ControllerCommissioningFlow {
|
|
|
354
356
|
this.fabric = fabric;
|
|
355
357
|
this.transitionToCase = transitionToCase;
|
|
356
358
|
this.commissioningOptions = commissioningOptions;
|
|
357
|
-
logger.debug(
|
|
359
|
+
logger.debug("Commissioning options", Diagnostic.dict(loggedOptionsOf(commissioningOptions)));
|
|
358
360
|
this.#initializeCommissioningSteps();
|
|
359
361
|
}
|
|
360
362
|
|
|
@@ -434,35 +436,25 @@ export class ControllerCommissioningFlow {
|
|
|
434
436
|
Diagnostic.errorMessage(error),
|
|
435
437
|
Diagnostic.weak("(continuing commissioning)"),
|
|
436
438
|
);
|
|
437
|
-
|
|
438
|
-
|
|
439
|
+
continue;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
const isCommissioningFailure = causedBy(error, CommissioningError, StatusResponseError);
|
|
443
|
+
if (isCommissioningFailure) {
|
|
444
|
+
logger.warn(
|
|
439
445
|
`Commissioning step ${step.stepNumber}.${step.subStepNumber}: ${step.name} failed with error:`,
|
|
440
446
|
Diagnostic.errorMessage(error),
|
|
441
447
|
Diagnostic.weak("(terminating commissioning)"),
|
|
442
448
|
);
|
|
443
|
-
|
|
444
|
-
// SHALL result in the Commissioner and Commissionee returning to step 2 (device discovery and
|
|
445
|
-
// commissioning channel establishment) and repeating each step. The failure of any of the steps
|
|
446
|
-
// 11 through 15 in concurrent connection commissioning flow SHALL result in the Commissioner and
|
|
447
|
-
// Commissionee returning to step 11 (configuration of operational network information). In the
|
|
448
|
-
// case of failure of any of the steps 11 through 15 in concurrent connection commissioning flow,
|
|
449
|
-
// the Commissioner and Commissionee SHALL reuse the existing PASE-derived encryption keys over
|
|
450
|
-
// the commissioning channel and all steps up to and including step 10 are considered to have
|
|
451
|
-
// been successfully completed.
|
|
452
|
-
|
|
453
|
-
// Commissioners that need to restart from step 2 MAY immediately expire the fail-safe by invoking
|
|
454
|
-
// the ArmFailSafe command with an ExpiryLengthSeconds field set to 0. Otherwise, Commissioners
|
|
455
|
-
// will need to wait until the current fail-safe timer has expired for the Commissionee to begin
|
|
456
|
-
// accepting PASE again.
|
|
457
|
-
await this.#resetFailsafeTimer();
|
|
449
|
+
}
|
|
458
450
|
|
|
459
|
-
|
|
451
|
+
await this.#expireFailsafe(error);
|
|
460
452
|
|
|
461
|
-
|
|
453
|
+
if (isCommissioningFailure) {
|
|
454
|
+
StatusResponseError.accept(error);
|
|
462
455
|
throw repackErrorAs(error, CommissioningError);
|
|
463
|
-
} else {
|
|
464
|
-
throw error;
|
|
465
456
|
}
|
|
457
|
+
throw error;
|
|
466
458
|
}
|
|
467
459
|
}
|
|
468
460
|
}
|
|
@@ -485,6 +477,10 @@ export class ControllerCommissioningFlow {
|
|
|
485
477
|
}
|
|
486
478
|
for await (const data of this.interaction.read(request)) {
|
|
487
479
|
for await (const entry of data) {
|
|
480
|
+
if (entry.kind === "attr-status") {
|
|
481
|
+
logger.debug("Commissioning read returned status", entry.status, "for", entry.path);
|
|
482
|
+
continue;
|
|
483
|
+
}
|
|
488
484
|
if (entry.kind !== "attr-value") {
|
|
489
485
|
continue;
|
|
490
486
|
}
|
|
@@ -506,13 +502,15 @@ export class ControllerCommissioningFlow {
|
|
|
506
502
|
async #invokeCommand<const C extends ClusterType.Concrete>(
|
|
507
503
|
request: Invoke.ConcreteCommandRequest<C>,
|
|
508
504
|
options: Omit<Invoke.Definition, "commands"> = {},
|
|
505
|
+
transmission?: ClientRequest,
|
|
509
506
|
) {
|
|
510
|
-
for await (const data of this.interaction.invoke(
|
|
511
|
-
Invoke({
|
|
507
|
+
for await (const data of this.interaction.invoke({
|
|
508
|
+
...Invoke({
|
|
512
509
|
commands: [request],
|
|
513
510
|
...options,
|
|
514
511
|
}),
|
|
515
|
-
|
|
512
|
+
...transmission,
|
|
513
|
+
})) {
|
|
516
514
|
for (const entry of data) {
|
|
517
515
|
// We send only one command, so we only get one response back
|
|
518
516
|
switch (entry.kind) {
|
|
@@ -795,6 +793,10 @@ export class ControllerCommissioningFlow {
|
|
|
795
793
|
|
|
796
794
|
for await (const data of networkData) {
|
|
797
795
|
for await (const entry of data) {
|
|
796
|
+
if (entry.kind === "attr-status") {
|
|
797
|
+
logger.debug("Commissioning read returned status", entry.status, "for", entry.path);
|
|
798
|
+
continue;
|
|
799
|
+
}
|
|
798
800
|
if (entry.kind !== "attr-value") {
|
|
799
801
|
continue;
|
|
800
802
|
}
|
|
@@ -937,13 +939,13 @@ export class ControllerCommissioningFlow {
|
|
|
937
939
|
logger.debug(
|
|
938
940
|
`Re-Arm Failsafe Timer during longer actions with device. Time left: ${Duration.format(Timespan(now, this.#commissioningExpiryTime).duration)}`,
|
|
939
941
|
);
|
|
940
|
-
this.#
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
);
|
|
942
|
+
this.#periodicArm = this.#armFailsafe(
|
|
943
|
+
Duration.max(this.#defaultFailSafeTime, this.#failSafeTimeLeft),
|
|
944
|
+
).catch(error => {
|
|
945
|
+
logger.warn("Error while re-arming failsafe during reconnect", error);
|
|
946
|
+
this.#armFailsafeInterval?.stop();
|
|
947
|
+
this.#armFailsafeInterval = undefined;
|
|
948
|
+
});
|
|
947
949
|
} else {
|
|
948
950
|
// Stop as soon as we are over the maximum commissioning time
|
|
949
951
|
this.#armFailsafeInterval?.stop();
|
|
@@ -1011,6 +1013,15 @@ export class ControllerCommissioningFlow {
|
|
|
1011
1013
|
);
|
|
1012
1014
|
}
|
|
1013
1015
|
|
|
1016
|
+
/**
|
|
1017
|
+
* Whether {@link failure} reports that the device stopped answering on the channel commissioning runs on, so a
|
|
1018
|
+
* further command would only wait for its own timeout. A failed operational reconnect does not count: it reports
|
|
1019
|
+
* that CASE could not be established, while the commissioning channel may still work.
|
|
1020
|
+
*/
|
|
1021
|
+
#deviceStoppedResponding(failure: Error) {
|
|
1022
|
+
return !(failure instanceof OperativeConnectionFailedError) && this.#isCommissioningChannelDrop(failure);
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1014
1025
|
/**
|
|
1015
1026
|
* Respond to a commissioning-channel drop by treating the device as non-concurrent: stop the
|
|
1016
1027
|
* periodic failsafe re-arm timer (BLE is gone anyway) and flip the flag so `#reconnectWithDevice`
|
|
@@ -1089,21 +1100,54 @@ export class ControllerCommissioningFlow {
|
|
|
1089
1100
|
return { transportFailure: false, networkingStatus, debugText };
|
|
1090
1101
|
}
|
|
1091
1102
|
|
|
1092
|
-
|
|
1103
|
+
/**
|
|
1104
|
+
* End the device's fail-safe after commissioning failed, so the device accepts a new PASE session right away.
|
|
1105
|
+
* Commissioning does not resume after a failure, so it always restarts from initial phase step 2, and the spec
|
|
1106
|
+
* allows this: "Commissioners that need to restart from initial phase step 2 MAY immediately expire the fail-safe
|
|
1107
|
+
* by invoking the ArmFailSafe command with an ExpiryLengthSeconds field set to 0."
|
|
1108
|
+
*
|
|
1109
|
+
* Stops the periodic re-arm, so it cannot arm the fail-safe again. Sends nothing when the device stopped
|
|
1110
|
+
* responding (see {@link #deviceStoppedResponding}). Otherwise it waits for a re-arm already sent, then sends over
|
|
1111
|
+
* the PASE session, or after the operational reconnect only over a session that exists now, so a device that
|
|
1112
|
+
* dropped the session is not reconnected only to end its fail-safe. A failure only logs: the device ends the
|
|
1113
|
+
* fail-safe itself when it expires.
|
|
1114
|
+
*
|
|
1115
|
+
* @see {@link MatterSpecification.v161.Core} § 5.5.1
|
|
1116
|
+
*/
|
|
1117
|
+
async #expireFailsafe(failure: Error) {
|
|
1118
|
+
this.#armFailsafeInterval?.stop();
|
|
1119
|
+
this.#armFailsafeInterval = undefined;
|
|
1120
|
+
|
|
1093
1121
|
if (this.#currentFailSafeEndTime === undefined) return;
|
|
1122
|
+
if (this.#deviceStoppedResponding(failure)) {
|
|
1123
|
+
logger.debug("Device stopped responding, leaving the failsafe to expire");
|
|
1124
|
+
return;
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
await this.#periodicArm;
|
|
1094
1128
|
try {
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1129
|
+
this.#ensureGeneralCommissioningSuccess(
|
|
1130
|
+
"armFailSafe",
|
|
1131
|
+
await this.#invokeCommand(
|
|
1132
|
+
{
|
|
1133
|
+
endpoint: RootEndpointNumber,
|
|
1134
|
+
cluster: GeneralCommissioning,
|
|
1135
|
+
command: "armFailSafe",
|
|
1136
|
+
fields: {
|
|
1137
|
+
breadcrumb: this.lastBreadcrumb,
|
|
1138
|
+
expiryLengthSeconds: 0,
|
|
1139
|
+
},
|
|
1140
|
+
},
|
|
1141
|
+
{},
|
|
1142
|
+
{ requireExistingSession: true },
|
|
1143
|
+
),
|
|
1144
|
+
);
|
|
1145
|
+
this.#currentFailSafeEndTime = undefined;
|
|
1105
1146
|
} catch (error) {
|
|
1106
|
-
logger.
|
|
1147
|
+
logger.info(
|
|
1148
|
+
"Could not end the failsafe, the device stays in commissioning until its failsafe expires:",
|
|
1149
|
+
Diagnostic.errorMessage(asError(error)),
|
|
1150
|
+
);
|
|
1107
1151
|
}
|
|
1108
1152
|
}
|
|
1109
1153
|
|
|
@@ -1292,8 +1336,8 @@ export class ControllerCommissioningFlow {
|
|
|
1292
1336
|
attestationElements,
|
|
1293
1337
|
attestationSignature,
|
|
1294
1338
|
attestationNonce,
|
|
1295
|
-
vendorId: this.collectedCommissioningData.vendorId
|
|
1296
|
-
productId: this.collectedCommissioningData.productId
|
|
1339
|
+
vendorId: this.collectedCommissioningData.vendorId,
|
|
1340
|
+
productId: this.collectedCommissioningData.productId,
|
|
1297
1341
|
},
|
|
1298
1342
|
);
|
|
1299
1343
|
findings = result.findings;
|
|
@@ -1306,7 +1350,10 @@ export class ControllerCommissioningFlow {
|
|
|
1306
1350
|
}
|
|
1307
1351
|
baseError = asError(error);
|
|
1308
1352
|
if (error instanceof DeviceAttestationError) {
|
|
1309
|
-
findings = [
|
|
1353
|
+
findings = [
|
|
1354
|
+
...error.precedingFindings,
|
|
1355
|
+
{ level: "error", type: error.failure, message: error.message },
|
|
1356
|
+
];
|
|
1310
1357
|
} else {
|
|
1311
1358
|
// Unexpected validation error (e.g. an unrecoverably corrupt trust-store certificate).
|
|
1312
1359
|
// Surface it as an error finding so the onFailure policy can still judge it, instead of
|
|
@@ -1320,8 +1367,11 @@ export class ControllerCommissioningFlow {
|
|
|
1320
1367
|
if (findings.length > 0) {
|
|
1321
1368
|
const decision = await this.#resolveAttestationFindings(findings);
|
|
1322
1369
|
if (!decision.proceed) {
|
|
1370
|
+
const errorMessages = findings.filter(({ level }) => level === "error").map(({ message }) => message);
|
|
1323
1371
|
baseError ??= new CommissioningError(
|
|
1324
|
-
|
|
1372
|
+
errorMessages.length
|
|
1373
|
+
? `Device attestation rejected by policy: ${errorMessages.join("; ")}`
|
|
1374
|
+
: `Device attestation produced ${findings.length} finding(s) and was rejected by policy`,
|
|
1325
1375
|
);
|
|
1326
1376
|
if (decision.reason !== undefined) {
|
|
1327
1377
|
throw new CommissioningError(decision.reason, { cause: baseError });
|
|
@@ -1336,7 +1386,10 @@ export class ControllerCommissioningFlow {
|
|
|
1336
1386
|
if (dacPublicKey === undefined) {
|
|
1337
1387
|
// Attestation failed but policy accepted it, so the key the validator would have returned is missing
|
|
1338
1388
|
try {
|
|
1339
|
-
dacPublicKey = PublicKey(
|
|
1389
|
+
dacPublicKey = PublicKey(
|
|
1390
|
+
Dac.fromAsn1(deviceAttestation, { acceptProfileViolation: true, acceptMalformedVidPid: true }).cert
|
|
1391
|
+
.ellipticCurvePublicKey,
|
|
1392
|
+
);
|
|
1340
1393
|
} catch (cause) {
|
|
1341
1394
|
throw new CommissioningError(
|
|
1342
1395
|
"Device attestation was accepted but the DAC cannot be parsed, so the CSR signature cannot be verified",
|
|
@@ -2154,3 +2207,26 @@ export class ControllerCommissioningFlow {
|
|
|
2154
2207
|
this.#armFailsafeInterval?.stop();
|
|
2155
2208
|
}
|
|
2156
2209
|
}
|
|
2210
|
+
|
|
2211
|
+
/**
|
|
2212
|
+
* The fields of {@link options} that hold no secret, for logging. The options the caller passes may carry more, such as
|
|
2213
|
+
* the fabric with its identity protection key or the passcode.
|
|
2214
|
+
*/
|
|
2215
|
+
function loggedOptionsOf(options: ControllerCommissioningFlowOptions) {
|
|
2216
|
+
const {
|
|
2217
|
+
regulatoryLocation,
|
|
2218
|
+
regulatoryCountryCode,
|
|
2219
|
+
adminVendorId,
|
|
2220
|
+
wifiNetwork,
|
|
2221
|
+
threadNetwork,
|
|
2222
|
+
otaUpdateProviderLocation,
|
|
2223
|
+
} = options;
|
|
2224
|
+
return {
|
|
2225
|
+
regulatoryLocation,
|
|
2226
|
+
regulatoryCountryCode,
|
|
2227
|
+
adminVendorId,
|
|
2228
|
+
wifiSsid: wifiNetwork?.wifiSsid,
|
|
2229
|
+
threadNetwork: threadNetwork && (threadNetwork.networkName ?? "(dataset only)"),
|
|
2230
|
+
otaUpdateProviderLocation,
|
|
2231
|
+
};
|
|
2232
|
+
}
|
package/src/peer/Peer.ts
CHANGED
|
@@ -256,13 +256,18 @@ export class Peer {
|
|
|
256
256
|
return this.#descriptor;
|
|
257
257
|
}
|
|
258
258
|
|
|
259
|
+
/**
|
|
260
|
+
* The open sessions with the peer. The set holds established sessions only, as it is filled from
|
|
261
|
+
* `SessionManager.sessions`. So {@link hasSession}, {@link newestSession} and observers of `peer.sessions.added`
|
|
262
|
+
* never see a session whose handshake still runs.
|
|
263
|
+
*/
|
|
259
264
|
get sessions() {
|
|
260
265
|
return this.#sessions;
|
|
261
266
|
}
|
|
262
267
|
|
|
263
268
|
get subscriptions() {
|
|
264
269
|
// TODO - this should just be #subscriptions
|
|
265
|
-
return
|
|
270
|
+
return this.#context.sessions.sessionsFor(this.address).flatMap(session => [...session.subscriptions]);
|
|
266
271
|
}
|
|
267
272
|
|
|
268
273
|
get exchangeProvider() {
|
|
@@ -422,21 +427,6 @@ export class Peer {
|
|
|
422
427
|
|
|
423
428
|
while (true) {
|
|
424
429
|
const { transports } = this.#transportDecision(options?.requiredTransport, options?.preferredTransport);
|
|
425
|
-
/* Debug aid (one line per connect — noisy); uncomment to trace transport selection:
|
|
426
|
-
{
|
|
427
|
-
const { reason, diag } = this.#transportDecision(options?.requiredTransport, options?.preferredTransport);
|
|
428
|
-
logger.debug(
|
|
429
|
-
"Transport resolution",
|
|
430
|
-
Diagnostic.dict({
|
|
431
|
-
peer: this.address.toString(),
|
|
432
|
-
result: transports === undefined ? "UDP (no constraint)" : transports.join("+"),
|
|
433
|
-
reason,
|
|
434
|
-
peerPreference: this.transportPreference ?? "none",
|
|
435
|
-
...diag,
|
|
436
|
-
}),
|
|
437
|
-
);
|
|
438
|
-
}
|
|
439
|
-
*/
|
|
440
430
|
let session: NodeSession | undefined;
|
|
441
431
|
if (transports === undefined) {
|
|
442
432
|
session = this.newestSession();
|
|
@@ -634,6 +624,8 @@ export class Peer {
|
|
|
634
624
|
return;
|
|
635
625
|
}
|
|
636
626
|
|
|
627
|
+
this.#logTransportDecision(options);
|
|
628
|
+
|
|
637
629
|
const abort = new Abort({ abort: this.#abort });
|
|
638
630
|
|
|
639
631
|
// Abort connection if a session is established from any source
|
|
@@ -672,6 +664,29 @@ export class Peer {
|
|
|
672
664
|
};
|
|
673
665
|
this.#workers.add(this.#connecting);
|
|
674
666
|
}
|
|
667
|
+
|
|
668
|
+
/**
|
|
669
|
+
* Log the transport decision once per connection process, so a log shows why TCP or UDP was tried.
|
|
670
|
+
*
|
|
671
|
+
* {@link PeerConnection} resolves the transports again for each address, so a later mDNS update can still change
|
|
672
|
+
* them. The address URL in each "Connecting" line shows the transport actually used.
|
|
673
|
+
*/
|
|
674
|
+
#logTransportDecision(options?: Peer.ConnectOptions) {
|
|
675
|
+
const { transports, reason, diag } = this.#transportDecision(
|
|
676
|
+
options?.requiredTransport,
|
|
677
|
+
options?.preferredTransport,
|
|
678
|
+
);
|
|
679
|
+
logger.debug(
|
|
680
|
+
Diagnostic.via(this.address.toString()),
|
|
681
|
+
"Transport decision",
|
|
682
|
+
Diagnostic.dict({
|
|
683
|
+
transports: transports === undefined ? "no constraint" : transports.join("+"),
|
|
684
|
+
reason,
|
|
685
|
+
peerPreference: this.transportPreference ?? "none",
|
|
686
|
+
...diag,
|
|
687
|
+
}),
|
|
688
|
+
);
|
|
689
|
+
}
|
|
675
690
|
}
|
|
676
691
|
|
|
677
692
|
export namespace Peer {
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022-2026 Matter.js Authors
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { Logger, Mutex, StorageContext, SupportedStorageTypes } from "@matter/general";
|
|
8
|
+
import { FabricIndex, NodeId } from "@matter/types";
|
|
9
|
+
import { PeerAddress, PeerAddressMap } from "./PeerAddress.js";
|
|
10
|
+
|
|
11
|
+
const logger = Logger.get("PeerAddressStore");
|
|
12
|
+
|
|
13
|
+
const FABRIC_CONTEXT_PATTERN = /^[1-9]\d*$/;
|
|
14
|
+
const NODE_KEY_PATTERN = /^[0-9a-f]+$/;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Persistent storage keyed by {@link PeerAddress}: one value per peer, so a change for one peer writes only that peer's
|
|
18
|
+
* key instead of the whole collection.
|
|
19
|
+
*
|
|
20
|
+
* Layout: one sub-context per fabric index (decimal), one key per node ID (lowercase hex). This class owns the format
|
|
21
|
+
* in both directions. It holds no values in memory; callers keep their own view and use {@link load} once at startup.
|
|
22
|
+
*
|
|
23
|
+
* Operations run one after another in call order, so after concurrent calls for one address the stored value is the
|
|
24
|
+
* one passed last.
|
|
25
|
+
*/
|
|
26
|
+
export class PeerAddressStore<T extends SupportedStorageTypes> {
|
|
27
|
+
readonly #storage: StorageContext;
|
|
28
|
+
readonly #operations = new Mutex(this);
|
|
29
|
+
|
|
30
|
+
constructor(storage: StorageContext) {
|
|
31
|
+
this.#storage = storage;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
set(address: PeerAddress, value: T) {
|
|
35
|
+
return this.#operations.produce(async () => this.#set(address, value));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
delete(address: PeerAddress) {
|
|
39
|
+
return this.#operations.produce(async () => this.#fabricContext(address.fabricIndex).delete(keyOf(address)));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
deleteFabric(fabricIndex: FabricIndex) {
|
|
43
|
+
return this.#operations.produce(async () => this.#fabricContext(fabricIndex).clearAll());
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
clear() {
|
|
47
|
+
return this.#operations.produce(async () => this.#storage.clearAll());
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Replace all stored values with {@link entries}.
|
|
52
|
+
*/
|
|
53
|
+
replaceAll(entries: Iterable<[PeerAddress, T]>) {
|
|
54
|
+
return this.#operations.produce(async () => {
|
|
55
|
+
await this.#storage.clearAll();
|
|
56
|
+
for (const [address, value] of entries) {
|
|
57
|
+
await this.#set(address, value);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Read all stored values. Entries {@link keep} rejects and entries the driver cannot read are deleted from storage
|
|
64
|
+
* and left out of the result.
|
|
65
|
+
*/
|
|
66
|
+
load(keep?: (address: PeerAddress, value: T) => boolean) {
|
|
67
|
+
return this.#operations.produce(async () => {
|
|
68
|
+
const result = new PeerAddressMap<T>();
|
|
69
|
+
|
|
70
|
+
for (const fabricName of await this.#storage.contexts()) {
|
|
71
|
+
if (!FABRIC_CONTEXT_PATTERN.test(fabricName)) {
|
|
72
|
+
logger.info(`Ignoring stored context ${fabricName} in ${this}: not a fabric index`);
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
const fabricIndex = FabricIndex(Number.parseInt(fabricName, 10));
|
|
76
|
+
const fabricContext = this.#storage.createContext(fabricName);
|
|
77
|
+
|
|
78
|
+
// keys() and has() list a value the driver cannot decode, but values() has no value for it
|
|
79
|
+
const stored = await fabricContext.values();
|
|
80
|
+
for (const key of await fabricContext.keys()) {
|
|
81
|
+
if (!NODE_KEY_PATTERN.test(key)) {
|
|
82
|
+
logger.info(`Ignoring stored key ${key} in ${this}: not a node ID`);
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
const address = PeerAddress({ fabricIndex, nodeId: NodeId(BigInt(`0x${key}`)) });
|
|
86
|
+
const value = stored[key] as T | undefined;
|
|
87
|
+
if (value === undefined) {
|
|
88
|
+
logger.warn(`Deleting stored value of ${address} in ${this}: not readable`);
|
|
89
|
+
await fabricContext.delete(key);
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
if (keep !== undefined && !keep(address, value)) {
|
|
93
|
+
await fabricContext.delete(key);
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
result.set(address, value);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return result;
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
toString() {
|
|
105
|
+
return `storage:${this.#storage.thisContexts.join(".")}`;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
#set(address: PeerAddress, value: T) {
|
|
109
|
+
return this.#fabricContext(address.fabricIndex).set(keyOf(address), value);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
#fabricContext(fabricIndex: FabricIndex) {
|
|
113
|
+
return this.#storage.createContext(fabricIndex.toString());
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function keyOf({ nodeId }: PeerAddress) {
|
|
118
|
+
return nodeId.toString(16);
|
|
119
|
+
}
|
|
@@ -608,7 +608,6 @@ export async function PeerConnection(
|
|
|
608
608
|
const { session } = await caseClient.pair(exchange, fabric, peer.address.nodeId, {
|
|
609
609
|
...options,
|
|
610
610
|
abort: localAbort,
|
|
611
|
-
caseAuthenticatedTags: peer.descriptor.caseAuthenticatedTags,
|
|
612
611
|
...attempt.sendOptions,
|
|
613
612
|
validateSessionParameters: isTcp
|
|
614
613
|
? params => {
|