@matter/thread-br-client 0.0.1 → 0.17.5-alpha.0-20260706-fd4c49e2e
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/LICENSE +201 -0
- package/README.md +5 -5
- package/dist/cjs/coap/CoapClient.d.ts +2 -2
- package/dist/cjs/coap/CoapClient.d.ts.map +1 -1
- package/dist/cjs/coap/CoapClient.js +9 -16
- package/dist/cjs/coap/CoapClient.js.map +1 -1
- package/dist/cjs/coap/CoapMessage.d.ts +11 -6
- package/dist/cjs/coap/CoapMessage.d.ts.map +1 -1
- package/dist/cjs/coap/CoapMessage.js +8 -5
- package/dist/cjs/coap/CoapMessage.js.map +1 -1
- package/dist/cjs/commissioner/Commissioner.d.ts.map +1 -1
- package/dist/cjs/commissioner/Commissioner.js +5 -2
- package/dist/cjs/commissioner/Commissioner.js.map +1 -1
- package/dist/cjs/commissioner/LeadKa.d.ts +3 -3
- package/dist/cjs/commissioner/LeadKa.d.ts.map +1 -1
- package/dist/cjs/commissioner/LeadKa.js +1 -1
- package/dist/cjs/commissioner/LeadKa.js.map +1 -1
- package/dist/cjs/commissioner/LeadPet.d.ts +3 -2
- package/dist/cjs/commissioner/LeadPet.d.ts.map +1 -1
- package/dist/cjs/commissioner/LeadPet.js +4 -3
- package/dist/cjs/commissioner/LeadPet.js.map +1 -1
- package/dist/cjs/credentials/ThreadCredentialsRegistry.d.ts +5 -5
- package/dist/cjs/credentials/ThreadCredentialsRegistry.d.ts.map +1 -1
- package/dist/cjs/credentials/ThreadCredentialsRegistry.js +10 -9
- package/dist/cjs/credentials/ThreadCredentialsRegistry.js.map +1 -1
- package/dist/cjs/credentials/ThreadNetworkCredentials.d.ts +4 -3
- package/dist/cjs/credentials/ThreadNetworkCredentials.d.ts.map +1 -1
- package/dist/cjs/crypto/AesCmacPrf128.d.ts +4 -14
- package/dist/cjs/crypto/AesCmacPrf128.d.ts.map +1 -1
- package/dist/cjs/crypto/AesCmacPrf128.js +7 -71
- package/dist/cjs/crypto/AesCmacPrf128.js.map +2 -2
- package/dist/cjs/crypto/Pbkdf2AesCmac.d.ts +5 -4
- package/dist/cjs/crypto/Pbkdf2AesCmac.d.ts.map +1 -1
- package/dist/cjs/crypto/Pbkdf2AesCmac.js +5 -4
- package/dist/cjs/crypto/Pbkdf2AesCmac.js.map +1 -1
- package/dist/cjs/crypto/Pskc.d.ts +4 -3
- package/dist/cjs/crypto/Pskc.d.ts.map +1 -1
- package/dist/cjs/crypto/Pskc.js +6 -5
- package/dist/cjs/crypto/Pskc.js.map +1 -1
- package/dist/cjs/crypto/index.d.ts +1 -1
- package/dist/cjs/crypto/index.d.ts.map +1 -1
- package/dist/cjs/crypto/index.js +0 -1
- package/dist/cjs/crypto/index.js.map +1 -1
- package/dist/cjs/dataset/OperationalDataset.d.ts +10 -10
- package/dist/cjs/dataset/OperationalDataset.d.ts.map +1 -1
- package/dist/cjs/dataset/OperationalDataset.js +32 -31
- package/dist/cjs/dataset/OperationalDataset.js.map +1 -1
- package/dist/cjs/dataset/SecurityPolicy.d.ts +3 -2
- package/dist/cjs/dataset/SecurityPolicy.d.ts.map +1 -1
- package/dist/cjs/dataset/SecurityPolicy.js +5 -4
- package/dist/cjs/dataset/SecurityPolicy.js.map +1 -1
- package/dist/cjs/diagnostic/DiagnosticResponse.d.ts +5 -4
- package/dist/cjs/diagnostic/DiagnosticResponse.d.ts.map +1 -1
- package/dist/cjs/diagnostic/DiagnosticSource.d.ts +2 -2
- package/dist/cjs/diagnostic/DiagnosticSource.d.ts.map +1 -1
- package/dist/cjs/diagnostic/MeshCopDiagnosticSource.d.ts +7 -3
- package/dist/cjs/diagnostic/MeshCopDiagnosticSource.d.ts.map +1 -1
- package/dist/cjs/diagnostic/MeshCopDiagnosticSource.js +48 -43
- package/dist/cjs/diagnostic/MeshCopDiagnosticSource.js.map +1 -1
- package/dist/cjs/diagnostic/connectMeshcop.d.ts.map +1 -1
- package/dist/cjs/diagnostic/connectMeshcop.js +5 -12
- package/dist/cjs/diagnostic/connectMeshcop.js.map +1 -1
- package/dist/cjs/diagnostic/errors.d.ts +1 -1
- package/dist/cjs/diagnostic/errors.d.ts.map +1 -1
- package/dist/cjs/discovery/BorderRouterRegistry.d.ts.map +1 -1
- package/dist/cjs/discovery/BorderRouterRegistry.js +2 -4
- package/dist/cjs/discovery/BorderRouterRegistry.js.map +1 -1
- package/dist/cjs/dtls/channel/DtlsConnectOpts.d.ts +3 -3
- package/dist/cjs/dtls/channel/DtlsConnectOpts.d.ts.map +1 -1
- package/dist/cjs/dtls/channel/NobleDtlsChannel.d.ts.map +1 -1
- package/dist/cjs/dtls/channel/NobleDtlsChannel.js +89 -58
- package/dist/cjs/dtls/channel/NobleDtlsChannel.js.map +1 -1
- package/dist/cjs/dtls/ecjpake/EcJpakePms.d.ts +5 -4
- package/dist/cjs/dtls/ecjpake/EcJpakePms.d.ts.map +1 -1
- package/dist/cjs/dtls/ecjpake/EcJpakePms.js +4 -5
- package/dist/cjs/dtls/ecjpake/EcJpakePms.js.map +1 -1
- package/dist/cjs/dtls/ecjpake/EcJpakeRound.d.ts +16 -15
- package/dist/cjs/dtls/ecjpake/EcJpakeRound.d.ts.map +1 -1
- package/dist/cjs/dtls/ecjpake/EcJpakeRound.js +40 -29
- package/dist/cjs/dtls/ecjpake/EcJpakeRound.js.map +1 -1
- package/dist/cjs/dtls/ecjpake/SchnorrZkp.d.ts +10 -9
- package/dist/cjs/dtls/ecjpake/SchnorrZkp.d.ts.map +1 -1
- package/dist/cjs/dtls/ecjpake/SchnorrZkp.js +17 -13
- package/dist/cjs/dtls/ecjpake/SchnorrZkp.js.map +1 -1
- package/dist/cjs/dtls/handshake/ChangeCipherSpec.d.ts +2 -1
- package/dist/cjs/dtls/handshake/ChangeCipherSpec.d.ts.map +1 -1
- package/dist/cjs/dtls/handshake/ChangeCipherSpec.js +3 -1
- package/dist/cjs/dtls/handshake/ChangeCipherSpec.js.map +1 -1
- package/dist/cjs/dtls/handshake/ClientHelloMessage.d.ts +27 -4
- package/dist/cjs/dtls/handshake/ClientHelloMessage.d.ts.map +1 -1
- package/dist/cjs/dtls/handshake/ClientHelloMessage.js +3 -1
- package/dist/cjs/dtls/handshake/ClientHelloMessage.js.map +1 -1
- package/dist/cjs/dtls/handshake/ClientKeyExchangeMessage.d.ts +2 -1
- package/dist/cjs/dtls/handshake/ClientKeyExchangeMessage.d.ts.map +1 -1
- package/dist/cjs/dtls/handshake/ClientKeyExchangeMessage.js.map +1 -1
- package/dist/cjs/dtls/handshake/DtlsClient.d.ts +9 -6
- package/dist/cjs/dtls/handshake/DtlsClient.d.ts.map +1 -1
- package/dist/cjs/dtls/handshake/DtlsClient.js +99 -77
- package/dist/cjs/dtls/handshake/DtlsClient.js.map +1 -1
- package/dist/cjs/dtls/handshake/FinishedMessage.d.ts +10 -3
- package/dist/cjs/dtls/handshake/FinishedMessage.d.ts.map +1 -1
- package/dist/cjs/dtls/handshake/FinishedMessage.js +4 -2
- package/dist/cjs/dtls/handshake/FinishedMessage.js.map +1 -1
- package/dist/cjs/dtls/handshake/HandshakeMessage.d.ts +5 -4
- package/dist/cjs/dtls/handshake/HandshakeMessage.d.ts.map +1 -1
- package/dist/cjs/dtls/handshake/HandshakeMessage.js +13 -11
- package/dist/cjs/dtls/handshake/HandshakeMessage.js.map +1 -1
- package/dist/cjs/dtls/handshake/HelloVerifyRequestMessage.d.ts +19 -2
- package/dist/cjs/dtls/handshake/HelloVerifyRequestMessage.d.ts.map +1 -1
- package/dist/cjs/dtls/handshake/HelloVerifyRequestMessage.js +3 -1
- package/dist/cjs/dtls/handshake/HelloVerifyRequestMessage.js.map +1 -1
- package/dist/cjs/dtls/handshake/ServerHelloDoneMessage.d.ts +2 -1
- package/dist/cjs/dtls/handshake/ServerHelloDoneMessage.d.ts.map +1 -1
- package/dist/cjs/dtls/handshake/ServerHelloDoneMessage.js +3 -2
- package/dist/cjs/dtls/handshake/ServerHelloDoneMessage.js.map +1 -1
- package/dist/cjs/dtls/handshake/ServerHelloMessage.d.ts +4 -3
- package/dist/cjs/dtls/handshake/ServerHelloMessage.d.ts.map +1 -1
- package/dist/cjs/dtls/handshake/ServerHelloMessage.js +3 -1
- package/dist/cjs/dtls/handshake/ServerHelloMessage.js.map +1 -1
- package/dist/cjs/dtls/handshake/ServerKeyExchangeMessage.d.ts +2 -1
- package/dist/cjs/dtls/handshake/ServerKeyExchangeMessage.d.ts.map +1 -1
- package/dist/cjs/dtls/handshake/ServerKeyExchangeMessage.js.map +1 -1
- package/dist/cjs/dtls/prf/HandshakeTranscript.d.ts +7 -5
- package/dist/cjs/dtls/prf/HandshakeTranscript.d.ts.map +1 -1
- package/dist/cjs/dtls/prf/HandshakeTranscript.js +14 -9
- package/dist/cjs/dtls/prf/HandshakeTranscript.js.map +1 -1
- package/dist/cjs/dtls/prf/TlsPrf.d.ts +23 -22
- package/dist/cjs/dtls/prf/TlsPrf.d.ts.map +1 -1
- package/dist/cjs/dtls/prf/TlsPrf.js +33 -30
- package/dist/cjs/dtls/prf/TlsPrf.js.map +1 -1
- package/dist/cjs/dtls/record/AesCcm8.d.ts +13 -12
- package/dist/cjs/dtls/record/AesCcm8.d.ts.map +1 -1
- package/dist/cjs/dtls/record/AesCcm8.js +12 -34
- package/dist/cjs/dtls/record/AesCcm8.js.map +1 -1
- package/dist/cjs/dtls/record/DtlsCipherState.d.ts +11 -10
- package/dist/cjs/dtls/record/DtlsCipherState.d.ts.map +1 -1
- package/dist/cjs/dtls/record/DtlsCipherState.js +10 -6
- package/dist/cjs/dtls/record/DtlsCipherState.js.map +1 -1
- package/dist/cjs/dtls/record/DtlsRecord.d.ts +10 -10
- package/dist/cjs/dtls/record/DtlsRecord.d.ts.map +1 -1
- package/dist/cjs/dtls/record/DtlsRecord.js +10 -8
- package/dist/cjs/dtls/record/DtlsRecord.js.map +1 -1
- package/dist/cjs/otbr-rest/OtbrRestCapability.d.ts +3 -4
- package/dist/cjs/otbr-rest/OtbrRestCapability.d.ts.map +1 -1
- package/dist/cjs/otbr-rest/OtbrRestClient.d.ts +27 -8
- package/dist/cjs/otbr-rest/OtbrRestClient.d.ts.map +1 -1
- package/dist/cjs/otbr-rest/OtbrRestClient.js +50 -20
- package/dist/cjs/otbr-rest/OtbrRestClient.js.map +1 -1
- package/dist/cjs/otbr-rest/OtbrRestDiagnosticSource.d.ts +2 -1
- package/dist/cjs/otbr-rest/OtbrRestDiagnosticSource.d.ts.map +1 -1
- package/dist/cjs/otbr-rest/OtbrRestDiagnosticSource.js +3 -3
- package/dist/cjs/otbr-rest/OtbrRestDiagnosticSource.js.map +1 -1
- package/dist/cjs/otbr-rest/OtbrRestProbe.d.ts +6 -4
- package/dist/cjs/otbr-rest/OtbrRestProbe.d.ts.map +1 -1
- package/dist/cjs/otbr-rest/OtbrRestProbe.js +11 -43
- package/dist/cjs/otbr-rest/OtbrRestProbe.js.map +1 -1
- package/dist/cjs/otbr-rest/caseNormalizer.d.ts +7 -0
- package/dist/cjs/otbr-rest/caseNormalizer.d.ts.map +1 -1
- package/dist/cjs/otbr-rest/caseNormalizer.js +11 -0
- package/dist/cjs/otbr-rest/caseNormalizer.js.map +1 -1
- package/dist/cjs/otbr-rest/parseHexBytes.d.ts +22 -0
- package/dist/cjs/otbr-rest/parseHexBytes.d.ts.map +1 -0
- package/dist/cjs/otbr-rest/parseHexBytes.js +50 -0
- package/dist/cjs/otbr-rest/parseHexBytes.js.map +6 -0
- package/dist/cjs/otbr-rest/translation.d.ts +2 -1
- package/dist/cjs/otbr-rest/translation.d.ts.map +1 -1
- package/dist/cjs/otbr-rest/translation.js +20 -22
- package/dist/cjs/otbr-rest/translation.js.map +1 -1
- package/dist/cjs/selection/selectBr.d.ts +8 -4
- package/dist/cjs/selection/selectBr.d.ts.map +1 -1
- package/dist/cjs/selection/selectBr.js +6 -5
- package/dist/cjs/selection/selectBr.js.map +1 -1
- package/dist/cjs/selection/withExtPanIdLock.d.ts +2 -1
- package/dist/cjs/selection/withExtPanIdLock.d.ts.map +1 -1
- package/dist/cjs/selection/withExtPanIdLock.js.map +1 -1
- package/dist/cjs/tlv/BasicTlvCodec.d.ts +4 -4
- package/dist/cjs/tlv/BasicTlvCodec.d.ts.map +1 -1
- package/dist/cjs/tlv/BasicTlvCodec.js +13 -11
- package/dist/cjs/tlv/BasicTlvCodec.js.map +1 -1
- package/dist/cjs/tlv/NetworkDiagnosticTlv.d.ts +3 -2
- package/dist/cjs/tlv/NetworkDiagnosticTlv.d.ts.map +1 -1
- package/dist/cjs/tlv/NetworkDiagnosticTlv.js.map +1 -1
- package/dist/cjs/tlv/TypeListTlv.d.ts +3 -2
- package/dist/cjs/tlv/TypeListTlv.d.ts.map +1 -1
- package/dist/cjs/tlv/TypeListTlv.js +1 -1
- package/dist/cjs/tlv/TypeListTlv.js.map +1 -1
- package/dist/cjs/tlv/diag/ChildIpv6AddressList.d.ts +3 -2
- package/dist/cjs/tlv/diag/ChildIpv6AddressList.d.ts.map +1 -1
- package/dist/cjs/tlv/diag/ChildIpv6AddressList.js +5 -3
- package/dist/cjs/tlv/diag/ChildIpv6AddressList.js.map +1 -1
- package/dist/cjs/tlv/diag/ChildTable.d.ts +3 -2
- package/dist/cjs/tlv/diag/ChildTable.d.ts.map +1 -1
- package/dist/cjs/tlv/diag/ChildTable.js +7 -6
- package/dist/cjs/tlv/diag/ChildTable.js.map +1 -1
- package/dist/cjs/tlv/diag/Connectivity.d.ts +3 -2
- package/dist/cjs/tlv/diag/Connectivity.d.ts.map +1 -1
- package/dist/cjs/tlv/diag/Connectivity.js +14 -14
- package/dist/cjs/tlv/diag/Connectivity.js.map +1 -1
- package/dist/cjs/tlv/diag/Ipv6AddressList.d.ts +3 -2
- package/dist/cjs/tlv/diag/Ipv6AddressList.d.ts.map +1 -1
- package/dist/cjs/tlv/diag/Ipv6AddressList.js +6 -5
- package/dist/cjs/tlv/diag/Ipv6AddressList.js.map +1 -1
- package/dist/cjs/tlv/diag/LeaderData.d.ts +3 -2
- package/dist/cjs/tlv/diag/LeaderData.d.ts.map +1 -1
- package/dist/cjs/tlv/diag/LeaderData.js +8 -7
- package/dist/cjs/tlv/diag/LeaderData.js.map +1 -1
- package/dist/cjs/tlv/diag/MacCounters.d.ts +3 -2
- package/dist/cjs/tlv/diag/MacCounters.d.ts.map +1 -1
- package/dist/cjs/tlv/diag/MacCounters.js +12 -11
- package/dist/cjs/tlv/diag/MacCounters.js.map +1 -1
- package/dist/cjs/tlv/diag/MleCounters.d.ts +3 -2
- package/dist/cjs/tlv/diag/MleCounters.d.ts.map +1 -1
- package/dist/cjs/tlv/diag/MleCounters.js +18 -17
- package/dist/cjs/tlv/diag/MleCounters.js.map +1 -1
- package/dist/cjs/tlv/diag/Mode.d.ts +3 -2
- package/dist/cjs/tlv/diag/Mode.d.ts.map +1 -1
- package/dist/cjs/tlv/diag/Mode.js +5 -3
- package/dist/cjs/tlv/diag/Mode.js.map +1 -1
- package/dist/cjs/tlv/diag/NetworkData.d.ts +7 -6
- package/dist/cjs/tlv/diag/NetworkData.d.ts.map +1 -1
- package/dist/cjs/tlv/diag/NetworkData.js +23 -18
- package/dist/cjs/tlv/diag/NetworkData.js.map +1 -1
- package/dist/cjs/tlv/diag/Primitives.d.ts +15 -14
- package/dist/cjs/tlv/diag/Primitives.d.ts.map +1 -1
- package/dist/cjs/tlv/diag/Primitives.js +25 -19
- package/dist/cjs/tlv/diag/Primitives.js.map +1 -1
- package/dist/cjs/tlv/diag/Route64.d.ts +3 -2
- package/dist/cjs/tlv/diag/Route64.d.ts.map +1 -1
- package/dist/cjs/tlv/diag/Route64.js +8 -7
- package/dist/cjs/tlv/diag/Route64.js.map +1 -1
- package/dist/cjs/tlv/diag/RouterNeighbor.d.ts +3 -2
- package/dist/cjs/tlv/diag/RouterNeighbor.d.ts.map +1 -1
- package/dist/cjs/tlv/diag/RouterNeighbor.js +13 -11
- package/dist/cjs/tlv/diag/RouterNeighbor.js.map +1 -1
- package/dist/cjs/tlv/diag/Timeout.d.ts +3 -2
- package/dist/cjs/tlv/diag/Timeout.d.ts.map +1 -1
- package/dist/cjs/tlv/diag/Timeout.js +4 -3
- package/dist/cjs/tlv/diag/Timeout.js.map +1 -1
- package/dist/cjs/tlv/diag/VendorInfo.d.ts +13 -12
- package/dist/cjs/tlv/diag/VendorInfo.d.ts.map +1 -1
- package/dist/cjs/tlv/diag/VendorInfo.js +4 -3
- package/dist/cjs/tlv/diag/VendorInfo.js.map +1 -1
- package/dist/cjs/tlv/meshcop/Ip6AddressTlv.d.ts +3 -2
- package/dist/cjs/tlv/meshcop/Ip6AddressTlv.d.ts.map +1 -1
- package/dist/cjs/tlv/meshcop/Ip6AddressTlv.js +7 -4
- package/dist/cjs/tlv/meshcop/Ip6AddressTlv.js.map +1 -1
- package/dist/cjs/tlv/meshcop/UdpEncapsulationTlv.d.ts +4 -3
- package/dist/cjs/tlv/meshcop/UdpEncapsulationTlv.d.ts.map +1 -1
- package/dist/cjs/tlv/meshcop/UdpEncapsulationTlv.js +9 -7
- package/dist/cjs/tlv/meshcop/UdpEncapsulationTlv.js.map +1 -1
- package/dist/cjs/util/meshLocalAddr.d.ts +5 -4
- package/dist/cjs/util/meshLocalAddr.d.ts.map +1 -1
- package/dist/cjs/util/meshLocalAddr.js +6 -4
- package/dist/cjs/util/meshLocalAddr.js.map +1 -1
- package/dist/esm/coap/CoapClient.d.ts +2 -2
- package/dist/esm/coap/CoapClient.d.ts.map +1 -1
- package/dist/esm/coap/CoapClient.js +11 -17
- package/dist/esm/coap/CoapClient.js.map +1 -1
- package/dist/esm/coap/CoapMessage.d.ts +11 -6
- package/dist/esm/coap/CoapMessage.d.ts.map +1 -1
- package/dist/esm/coap/CoapMessage.js +8 -5
- package/dist/esm/coap/CoapMessage.js.map +1 -1
- package/dist/esm/commissioner/Commissioner.d.ts.map +1 -1
- package/dist/esm/commissioner/Commissioner.js +5 -2
- package/dist/esm/commissioner/Commissioner.js.map +1 -1
- package/dist/esm/commissioner/LeadKa.d.ts +3 -3
- package/dist/esm/commissioner/LeadKa.d.ts.map +1 -1
- package/dist/esm/commissioner/LeadKa.js +2 -2
- package/dist/esm/commissioner/LeadKa.js.map +1 -1
- package/dist/esm/commissioner/LeadPet.d.ts +3 -2
- package/dist/esm/commissioner/LeadPet.d.ts.map +1 -1
- package/dist/esm/commissioner/LeadPet.js +4 -3
- package/dist/esm/commissioner/LeadPet.js.map +1 -1
- package/dist/esm/credentials/ThreadCredentialsRegistry.d.ts +5 -5
- package/dist/esm/credentials/ThreadCredentialsRegistry.d.ts.map +1 -1
- package/dist/esm/credentials/ThreadCredentialsRegistry.js +10 -9
- package/dist/esm/credentials/ThreadCredentialsRegistry.js.map +1 -1
- package/dist/esm/credentials/ThreadNetworkCredentials.d.ts +4 -3
- package/dist/esm/credentials/ThreadNetworkCredentials.d.ts.map +1 -1
- package/dist/esm/crypto/AesCmacPrf128.d.ts +4 -14
- package/dist/esm/crypto/AesCmacPrf128.d.ts.map +1 -1
- package/dist/esm/crypto/AesCmacPrf128.js +8 -72
- package/dist/esm/crypto/AesCmacPrf128.js.map +2 -2
- package/dist/esm/crypto/Pbkdf2AesCmac.d.ts +5 -4
- package/dist/esm/crypto/Pbkdf2AesCmac.d.ts.map +1 -1
- package/dist/esm/crypto/Pbkdf2AesCmac.js +6 -5
- package/dist/esm/crypto/Pbkdf2AesCmac.js.map +1 -1
- package/dist/esm/crypto/Pskc.d.ts +4 -3
- package/dist/esm/crypto/Pskc.d.ts.map +1 -1
- package/dist/esm/crypto/Pskc.js +7 -6
- package/dist/esm/crypto/Pskc.js.map +1 -1
- package/dist/esm/crypto/index.d.ts +1 -1
- package/dist/esm/crypto/index.d.ts.map +1 -1
- package/dist/esm/crypto/index.js +1 -2
- package/dist/esm/crypto/index.js.map +1 -1
- package/dist/esm/dataset/OperationalDataset.d.ts +10 -10
- package/dist/esm/dataset/OperationalDataset.d.ts.map +1 -1
- package/dist/esm/dataset/OperationalDataset.js +32 -31
- package/dist/esm/dataset/OperationalDataset.js.map +1 -1
- package/dist/esm/dataset/SecurityPolicy.d.ts +3 -2
- package/dist/esm/dataset/SecurityPolicy.d.ts.map +1 -1
- package/dist/esm/dataset/SecurityPolicy.js +6 -5
- package/dist/esm/dataset/SecurityPolicy.js.map +1 -1
- package/dist/esm/diagnostic/DiagnosticResponse.d.ts +5 -4
- package/dist/esm/diagnostic/DiagnosticResponse.d.ts.map +1 -1
- package/dist/esm/diagnostic/DiagnosticSource.d.ts +2 -2
- package/dist/esm/diagnostic/DiagnosticSource.d.ts.map +1 -1
- package/dist/esm/diagnostic/MeshCopDiagnosticSource.d.ts +7 -3
- package/dist/esm/diagnostic/MeshCopDiagnosticSource.d.ts.map +1 -1
- package/dist/esm/diagnostic/MeshCopDiagnosticSource.js +49 -43
- package/dist/esm/diagnostic/MeshCopDiagnosticSource.js.map +1 -1
- package/dist/esm/diagnostic/connectMeshcop.d.ts.map +1 -1
- package/dist/esm/diagnostic/connectMeshcop.js +6 -13
- package/dist/esm/diagnostic/connectMeshcop.js.map +1 -1
- package/dist/esm/diagnostic/errors.d.ts +1 -1
- package/dist/esm/diagnostic/errors.d.ts.map +1 -1
- package/dist/esm/discovery/BorderRouterRegistry.d.ts.map +1 -1
- package/dist/esm/discovery/BorderRouterRegistry.js +2 -4
- package/dist/esm/discovery/BorderRouterRegistry.js.map +1 -1
- package/dist/esm/dtls/channel/DtlsConnectOpts.d.ts +3 -3
- package/dist/esm/dtls/channel/DtlsConnectOpts.d.ts.map +1 -1
- package/dist/esm/dtls/channel/NobleDtlsChannel.d.ts.map +1 -1
- package/dist/esm/dtls/channel/NobleDtlsChannel.js +90 -58
- package/dist/esm/dtls/channel/NobleDtlsChannel.js.map +1 -1
- package/dist/esm/dtls/ecjpake/EcJpakePms.d.ts +5 -4
- package/dist/esm/dtls/ecjpake/EcJpakePms.d.ts.map +1 -1
- package/dist/esm/dtls/ecjpake/EcJpakePms.js +5 -6
- package/dist/esm/dtls/ecjpake/EcJpakePms.js.map +1 -1
- package/dist/esm/dtls/ecjpake/EcJpakeRound.d.ts +16 -15
- package/dist/esm/dtls/ecjpake/EcJpakeRound.d.ts.map +1 -1
- package/dist/esm/dtls/ecjpake/EcJpakeRound.js +41 -30
- package/dist/esm/dtls/ecjpake/EcJpakeRound.js.map +1 -1
- package/dist/esm/dtls/ecjpake/SchnorrZkp.d.ts +10 -9
- package/dist/esm/dtls/ecjpake/SchnorrZkp.d.ts.map +1 -1
- package/dist/esm/dtls/ecjpake/SchnorrZkp.js +18 -14
- package/dist/esm/dtls/ecjpake/SchnorrZkp.js.map +1 -1
- package/dist/esm/dtls/handshake/ChangeCipherSpec.d.ts +2 -1
- package/dist/esm/dtls/handshake/ChangeCipherSpec.d.ts.map +1 -1
- package/dist/esm/dtls/handshake/ChangeCipherSpec.js +3 -1
- package/dist/esm/dtls/handshake/ChangeCipherSpec.js.map +1 -1
- package/dist/esm/dtls/handshake/ClientHelloMessage.d.ts +27 -4
- package/dist/esm/dtls/handshake/ClientHelloMessage.d.ts.map +1 -1
- package/dist/esm/dtls/handshake/ClientHelloMessage.js +4 -2
- package/dist/esm/dtls/handshake/ClientHelloMessage.js.map +1 -1
- package/dist/esm/dtls/handshake/ClientKeyExchangeMessage.d.ts +2 -1
- package/dist/esm/dtls/handshake/ClientKeyExchangeMessage.d.ts.map +1 -1
- package/dist/esm/dtls/handshake/ClientKeyExchangeMessage.js.map +1 -1
- package/dist/esm/dtls/handshake/DtlsClient.d.ts +9 -6
- package/dist/esm/dtls/handshake/DtlsClient.d.ts.map +1 -1
- package/dist/esm/dtls/handshake/DtlsClient.js +100 -78
- package/dist/esm/dtls/handshake/DtlsClient.js.map +1 -1
- package/dist/esm/dtls/handshake/FinishedMessage.d.ts +10 -3
- package/dist/esm/dtls/handshake/FinishedMessage.d.ts.map +1 -1
- package/dist/esm/dtls/handshake/FinishedMessage.js +5 -3
- package/dist/esm/dtls/handshake/FinishedMessage.js.map +1 -1
- package/dist/esm/dtls/handshake/HandshakeMessage.d.ts +5 -4
- package/dist/esm/dtls/handshake/HandshakeMessage.d.ts.map +1 -1
- package/dist/esm/dtls/handshake/HandshakeMessage.js +14 -12
- package/dist/esm/dtls/handshake/HandshakeMessage.js.map +1 -1
- package/dist/esm/dtls/handshake/HelloVerifyRequestMessage.d.ts +19 -2
- package/dist/esm/dtls/handshake/HelloVerifyRequestMessage.d.ts.map +1 -1
- package/dist/esm/dtls/handshake/HelloVerifyRequestMessage.js +3 -1
- package/dist/esm/dtls/handshake/HelloVerifyRequestMessage.js.map +1 -1
- package/dist/esm/dtls/handshake/ServerHelloDoneMessage.d.ts +2 -1
- package/dist/esm/dtls/handshake/ServerHelloDoneMessage.d.ts.map +1 -1
- package/dist/esm/dtls/handshake/ServerHelloDoneMessage.js +3 -2
- package/dist/esm/dtls/handshake/ServerHelloDoneMessage.js.map +1 -1
- package/dist/esm/dtls/handshake/ServerHelloMessage.d.ts +4 -3
- package/dist/esm/dtls/handshake/ServerHelloMessage.d.ts.map +1 -1
- package/dist/esm/dtls/handshake/ServerHelloMessage.js +3 -1
- package/dist/esm/dtls/handshake/ServerHelloMessage.js.map +1 -1
- package/dist/esm/dtls/handshake/ServerKeyExchangeMessage.d.ts +2 -1
- package/dist/esm/dtls/handshake/ServerKeyExchangeMessage.d.ts.map +1 -1
- package/dist/esm/dtls/handshake/ServerKeyExchangeMessage.js.map +1 -1
- package/dist/esm/dtls/prf/HandshakeTranscript.d.ts +7 -5
- package/dist/esm/dtls/prf/HandshakeTranscript.d.ts.map +1 -1
- package/dist/esm/dtls/prf/HandshakeTranscript.js +15 -10
- package/dist/esm/dtls/prf/HandshakeTranscript.js.map +1 -1
- package/dist/esm/dtls/prf/TlsPrf.d.ts +23 -22
- package/dist/esm/dtls/prf/TlsPrf.d.ts.map +1 -1
- package/dist/esm/dtls/prf/TlsPrf.js +34 -31
- package/dist/esm/dtls/prf/TlsPrf.js.map +1 -1
- package/dist/esm/dtls/record/AesCcm8.d.ts +13 -12
- package/dist/esm/dtls/record/AesCcm8.d.ts.map +1 -1
- package/dist/esm/dtls/record/AesCcm8.js +13 -35
- package/dist/esm/dtls/record/AesCcm8.js.map +1 -1
- package/dist/esm/dtls/record/DtlsCipherState.d.ts +11 -10
- package/dist/esm/dtls/record/DtlsCipherState.d.ts.map +1 -1
- package/dist/esm/dtls/record/DtlsCipherState.js +11 -7
- package/dist/esm/dtls/record/DtlsCipherState.js.map +1 -1
- package/dist/esm/dtls/record/DtlsRecord.d.ts +10 -10
- package/dist/esm/dtls/record/DtlsRecord.d.ts.map +1 -1
- package/dist/esm/dtls/record/DtlsRecord.js +11 -9
- package/dist/esm/dtls/record/DtlsRecord.js.map +1 -1
- package/dist/esm/otbr-rest/OtbrRestCapability.d.ts +3 -4
- package/dist/esm/otbr-rest/OtbrRestCapability.d.ts.map +1 -1
- package/dist/esm/otbr-rest/OtbrRestClient.d.ts +27 -8
- package/dist/esm/otbr-rest/OtbrRestClient.d.ts.map +1 -1
- package/dist/esm/otbr-rest/OtbrRestClient.js +51 -21
- package/dist/esm/otbr-rest/OtbrRestClient.js.map +1 -1
- package/dist/esm/otbr-rest/OtbrRestDiagnosticSource.d.ts +2 -1
- package/dist/esm/otbr-rest/OtbrRestDiagnosticSource.d.ts.map +1 -1
- package/dist/esm/otbr-rest/OtbrRestDiagnosticSource.js +4 -4
- package/dist/esm/otbr-rest/OtbrRestDiagnosticSource.js.map +1 -1
- package/dist/esm/otbr-rest/OtbrRestProbe.d.ts +6 -4
- package/dist/esm/otbr-rest/OtbrRestProbe.d.ts.map +1 -1
- package/dist/esm/otbr-rest/OtbrRestProbe.js +12 -44
- package/dist/esm/otbr-rest/OtbrRestProbe.js.map +1 -1
- package/dist/esm/otbr-rest/caseNormalizer.d.ts +7 -0
- package/dist/esm/otbr-rest/caseNormalizer.d.ts.map +1 -1
- package/dist/esm/otbr-rest/caseNormalizer.js +11 -0
- package/dist/esm/otbr-rest/caseNormalizer.js.map +1 -1
- package/dist/esm/otbr-rest/parseHexBytes.d.ts +22 -0
- package/dist/esm/otbr-rest/parseHexBytes.d.ts.map +1 -0
- package/dist/esm/otbr-rest/parseHexBytes.js +30 -0
- package/dist/esm/otbr-rest/parseHexBytes.js.map +6 -0
- package/dist/esm/otbr-rest/translation.d.ts +2 -1
- package/dist/esm/otbr-rest/translation.d.ts.map +1 -1
- package/dist/esm/otbr-rest/translation.js +16 -18
- package/dist/esm/otbr-rest/translation.js.map +1 -1
- package/dist/esm/selection/selectBr.d.ts +8 -4
- package/dist/esm/selection/selectBr.d.ts.map +1 -1
- package/dist/esm/selection/selectBr.js +6 -5
- package/dist/esm/selection/selectBr.js.map +1 -1
- package/dist/esm/selection/withExtPanIdLock.d.ts +2 -1
- package/dist/esm/selection/withExtPanIdLock.d.ts.map +1 -1
- package/dist/esm/selection/withExtPanIdLock.js.map +1 -1
- package/dist/esm/tlv/BasicTlvCodec.d.ts +4 -4
- package/dist/esm/tlv/BasicTlvCodec.d.ts.map +1 -1
- package/dist/esm/tlv/BasicTlvCodec.js +14 -12
- package/dist/esm/tlv/BasicTlvCodec.js.map +1 -1
- package/dist/esm/tlv/NetworkDiagnosticTlv.d.ts +3 -2
- package/dist/esm/tlv/NetworkDiagnosticTlv.d.ts.map +1 -1
- package/dist/esm/tlv/NetworkDiagnosticTlv.js.map +1 -1
- package/dist/esm/tlv/TypeListTlv.d.ts +3 -2
- package/dist/esm/tlv/TypeListTlv.d.ts.map +1 -1
- package/dist/esm/tlv/TypeListTlv.js +2 -2
- package/dist/esm/tlv/TypeListTlv.js.map +1 -1
- package/dist/esm/tlv/diag/ChildIpv6AddressList.d.ts +3 -2
- package/dist/esm/tlv/diag/ChildIpv6AddressList.d.ts.map +1 -1
- package/dist/esm/tlv/diag/ChildIpv6AddressList.js +5 -3
- package/dist/esm/tlv/diag/ChildIpv6AddressList.js.map +1 -1
- package/dist/esm/tlv/diag/ChildTable.d.ts +3 -2
- package/dist/esm/tlv/diag/ChildTable.d.ts.map +1 -1
- package/dist/esm/tlv/diag/ChildTable.js +8 -7
- package/dist/esm/tlv/diag/ChildTable.js.map +1 -1
- package/dist/esm/tlv/diag/Connectivity.d.ts +3 -2
- package/dist/esm/tlv/diag/Connectivity.d.ts.map +1 -1
- package/dist/esm/tlv/diag/Connectivity.js +14 -14
- package/dist/esm/tlv/diag/Connectivity.js.map +1 -1
- package/dist/esm/tlv/diag/Ipv6AddressList.d.ts +3 -2
- package/dist/esm/tlv/diag/Ipv6AddressList.d.ts.map +1 -1
- package/dist/esm/tlv/diag/Ipv6AddressList.js +7 -6
- package/dist/esm/tlv/diag/Ipv6AddressList.js.map +1 -1
- package/dist/esm/tlv/diag/LeaderData.d.ts +3 -2
- package/dist/esm/tlv/diag/LeaderData.d.ts.map +1 -1
- package/dist/esm/tlv/diag/LeaderData.js +9 -8
- package/dist/esm/tlv/diag/LeaderData.js.map +1 -1
- package/dist/esm/tlv/diag/MacCounters.d.ts +3 -2
- package/dist/esm/tlv/diag/MacCounters.d.ts.map +1 -1
- package/dist/esm/tlv/diag/MacCounters.js +13 -12
- package/dist/esm/tlv/diag/MacCounters.js.map +1 -1
- package/dist/esm/tlv/diag/MleCounters.d.ts +3 -2
- package/dist/esm/tlv/diag/MleCounters.d.ts.map +1 -1
- package/dist/esm/tlv/diag/MleCounters.js +19 -18
- package/dist/esm/tlv/diag/MleCounters.js.map +1 -1
- package/dist/esm/tlv/diag/Mode.d.ts +3 -2
- package/dist/esm/tlv/diag/Mode.d.ts.map +1 -1
- package/dist/esm/tlv/diag/Mode.js +5 -3
- package/dist/esm/tlv/diag/Mode.js.map +1 -1
- package/dist/esm/tlv/diag/NetworkData.d.ts +7 -6
- package/dist/esm/tlv/diag/NetworkData.d.ts.map +1 -1
- package/dist/esm/tlv/diag/NetworkData.js +23 -18
- package/dist/esm/tlv/diag/NetworkData.js.map +1 -1
- package/dist/esm/tlv/diag/Primitives.d.ts +15 -14
- package/dist/esm/tlv/diag/Primitives.d.ts.map +1 -1
- package/dist/esm/tlv/diag/Primitives.js +26 -20
- package/dist/esm/tlv/diag/Primitives.js.map +1 -1
- package/dist/esm/tlv/diag/Route64.d.ts +3 -2
- package/dist/esm/tlv/diag/Route64.d.ts.map +1 -1
- package/dist/esm/tlv/diag/Route64.js +9 -8
- package/dist/esm/tlv/diag/Route64.js.map +1 -1
- package/dist/esm/tlv/diag/RouterNeighbor.d.ts +3 -2
- package/dist/esm/tlv/diag/RouterNeighbor.d.ts.map +1 -1
- package/dist/esm/tlv/diag/RouterNeighbor.js +13 -11
- package/dist/esm/tlv/diag/RouterNeighbor.js.map +1 -1
- package/dist/esm/tlv/diag/Timeout.d.ts +3 -2
- package/dist/esm/tlv/diag/Timeout.d.ts.map +1 -1
- package/dist/esm/tlv/diag/Timeout.js +5 -4
- package/dist/esm/tlv/diag/Timeout.js.map +1 -1
- package/dist/esm/tlv/diag/VendorInfo.d.ts +13 -12
- package/dist/esm/tlv/diag/VendorInfo.d.ts.map +1 -1
- package/dist/esm/tlv/diag/VendorInfo.js +5 -4
- package/dist/esm/tlv/diag/VendorInfo.js.map +1 -1
- package/dist/esm/tlv/meshcop/Ip6AddressTlv.d.ts +3 -2
- package/dist/esm/tlv/meshcop/Ip6AddressTlv.d.ts.map +1 -1
- package/dist/esm/tlv/meshcop/Ip6AddressTlv.js +7 -4
- package/dist/esm/tlv/meshcop/Ip6AddressTlv.js.map +1 -1
- package/dist/esm/tlv/meshcop/UdpEncapsulationTlv.d.ts +4 -3
- package/dist/esm/tlv/meshcop/UdpEncapsulationTlv.d.ts.map +1 -1
- package/dist/esm/tlv/meshcop/UdpEncapsulationTlv.js +10 -8
- package/dist/esm/tlv/meshcop/UdpEncapsulationTlv.js.map +1 -1
- package/dist/esm/util/meshLocalAddr.d.ts +5 -4
- package/dist/esm/util/meshLocalAddr.d.ts.map +1 -1
- package/dist/esm/util/meshLocalAddr.js +7 -5
- package/dist/esm/util/meshLocalAddr.js.map +1 -1
- package/package.json +5 -5
- package/src/coap/CoapClient.ts +13 -20
- package/src/coap/CoapMessage.ts +17 -9
- package/src/commissioner/Commissioner.ts +5 -2
- package/src/commissioner/LeadKa.ts +4 -4
- package/src/commissioner/LeadPet.ts +6 -5
- package/src/credentials/ThreadCredentialsRegistry.ts +14 -13
- package/src/credentials/ThreadNetworkCredentials.ts +5 -3
- package/src/crypto/AesCmacPrf128.ts +10 -87
- package/src/crypto/Pbkdf2AesCmac.ts +14 -10
- package/src/crypto/Pskc.ts +7 -6
- package/src/crypto/index.ts +1 -1
- package/src/dataset/OperationalDataset.ts +48 -47
- package/src/dataset/SecurityPolicy.ts +8 -7
- package/src/diagnostic/DiagnosticResponse.ts +5 -4
- package/src/diagnostic/DiagnosticSource.ts +2 -2
- package/src/diagnostic/MeshCopDiagnosticSource.ts +80 -64
- package/src/diagnostic/connectMeshcop.ts +6 -14
- package/src/diagnostic/errors.ts +1 -1
- package/src/discovery/BorderRouterRegistry.ts +2 -4
- package/src/dtls/channel/DtlsConnectOpts.ts +3 -3
- package/src/dtls/channel/NobleDtlsChannel.ts +96 -60
- package/src/dtls/ecjpake/EcJpakePms.ts +5 -6
- package/src/dtls/ecjpake/EcJpakeRound.ts +57 -37
- package/src/dtls/ecjpake/SchnorrZkp.ts +43 -30
- package/src/dtls/handshake/ChangeCipherSpec.ts +3 -1
- package/src/dtls/handshake/ClientHelloMessage.ts +8 -6
- package/src/dtls/handshake/ClientKeyExchangeMessage.ts +2 -1
- package/src/dtls/handshake/DtlsClient.ts +119 -95
- package/src/dtls/handshake/FinishedMessage.ts +5 -3
- package/src/dtls/handshake/HandshakeMessage.ts +18 -16
- package/src/dtls/handshake/HelloVerifyRequestMessage.ts +3 -1
- package/src/dtls/handshake/ServerHelloDoneMessage.ts +5 -3
- package/src/dtls/handshake/ServerHelloMessage.ts +5 -3
- package/src/dtls/handshake/ServerKeyExchangeMessage.ts +2 -1
- package/src/dtls/prf/HandshakeTranscript.ts +18 -11
- package/src/dtls/prf/TlsPrf.ts +68 -54
- package/src/dtls/record/AesCcm8.ts +23 -49
- package/src/dtls/record/DtlsCipherState.ts +20 -16
- package/src/dtls/record/DtlsRecord.ts +17 -15
- package/src/otbr-rest/OtbrRestCapability.ts +4 -4
- package/src/otbr-rest/OtbrRestClient.ts +64 -29
- package/src/otbr-rest/OtbrRestDiagnosticSource.ts +5 -5
- package/src/otbr-rest/OtbrRestProbe.ts +12 -47
- package/src/otbr-rest/caseNormalizer.ts +17 -0
- package/src/otbr-rest/parseHexBytes.ts +47 -0
- package/src/otbr-rest/translation.ts +24 -22
- package/src/selection/selectBr.ts +26 -13
- package/src/selection/withExtPanIdLock.ts +1 -1
- package/src/tlv/BasicTlvCodec.ts +17 -15
- package/src/tlv/NetworkDiagnosticTlv.ts +3 -2
- package/src/tlv/TypeListTlv.ts +4 -4
- package/src/tlv/diag/ChildIpv6AddressList.ts +8 -5
- package/src/tlv/diag/ChildTable.ts +10 -9
- package/src/tlv/diag/Connectivity.ts +16 -16
- package/src/tlv/diag/Ipv6AddressList.ts +9 -8
- package/src/tlv/diag/LeaderData.ts +11 -10
- package/src/tlv/diag/MacCounters.ts +15 -14
- package/src/tlv/diag/MleCounters.ts +21 -20
- package/src/tlv/diag/Mode.ts +7 -5
- package/src/tlv/diag/NetworkData.ts +31 -26
- package/src/tlv/diag/Primitives.ts +42 -36
- package/src/tlv/diag/Route64.ts +11 -10
- package/src/tlv/diag/RouterNeighbor.ts +16 -13
- package/src/tlv/diag/Timeout.ts +7 -6
- package/src/tlv/diag/VendorInfo.ts +19 -18
- package/src/tlv/meshcop/Ip6AddressTlv.ts +9 -6
- package/src/tlv/meshcop/UdpEncapsulationTlv.ts +13 -11
- package/src/util/meshLocalAddr.ts +10 -8
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { InternalError } from "@matter/general";
|
|
7
|
+
import { Bytes, InternalError } from "@matter/general";
|
|
8
8
|
import { ThreadDiagError } from "../../diagnostic/errors.js";
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -24,49 +24,52 @@ import { ThreadDiagError } from "../../diagnostic/errors.js";
|
|
|
24
24
|
* `Client::GetNextDiagTlv` parser.
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
|
-
function eui64Decode(value:
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
function eui64Decode(value: Bytes, name: string): Bytes {
|
|
28
|
+
const buf = Bytes.of(value);
|
|
29
|
+
if (buf.length !== 8) {
|
|
30
|
+
throw new ThreadDiagError(`${name} TLV must be 8 bytes, got ${buf.length}`);
|
|
30
31
|
}
|
|
31
|
-
return
|
|
32
|
+
return buf.slice();
|
|
32
33
|
}
|
|
33
34
|
|
|
34
|
-
function eui64Encode(addr:
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
function eui64Encode(addr: Bytes, name: string): Bytes {
|
|
36
|
+
const buf = Bytes.of(addr);
|
|
37
|
+
if (buf.length !== 8) {
|
|
38
|
+
throw new InternalError(`${name} must be 8 bytes, got ${buf.length}`);
|
|
37
39
|
}
|
|
38
|
-
return
|
|
40
|
+
return buf.slice();
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
export namespace ExtMacAddress {
|
|
42
|
-
export function decode(value:
|
|
44
|
+
export function decode(value: Bytes): Bytes {
|
|
43
45
|
return eui64Decode(value, "ExtMacAddress");
|
|
44
46
|
}
|
|
45
47
|
|
|
46
|
-
export function encode(addr:
|
|
48
|
+
export function encode(addr: Bytes): Bytes {
|
|
47
49
|
return eui64Encode(addr, "ExtMacAddress");
|
|
48
50
|
}
|
|
49
51
|
}
|
|
50
52
|
|
|
51
53
|
export namespace Eui64 {
|
|
52
|
-
export function decode(value:
|
|
54
|
+
export function decode(value: Bytes): Bytes {
|
|
53
55
|
return eui64Decode(value, "Eui64");
|
|
54
56
|
}
|
|
55
57
|
|
|
56
|
-
export function encode(addr:
|
|
58
|
+
export function encode(addr: Bytes): Bytes {
|
|
57
59
|
return eui64Encode(addr, "Eui64");
|
|
58
60
|
}
|
|
59
61
|
}
|
|
60
62
|
|
|
61
63
|
export namespace Address16 {
|
|
62
|
-
export function decode(value:
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
export function decode(value: Bytes): number {
|
|
65
|
+
const buf = Bytes.of(value);
|
|
66
|
+
if (buf.length !== 2) {
|
|
67
|
+
throw new ThreadDiagError(`Address16 TLV must be 2 bytes, got ${buf.length}`);
|
|
65
68
|
}
|
|
66
|
-
return (
|
|
69
|
+
return (buf[0] << 8) | buf[1];
|
|
67
70
|
}
|
|
68
71
|
|
|
69
|
-
export function encode(rloc16: number):
|
|
72
|
+
export function encode(rloc16: number): Bytes {
|
|
70
73
|
if (!Number.isInteger(rloc16) || rloc16 < 0 || rloc16 > 0xffff) {
|
|
71
74
|
throw new InternalError(`Address16 out of range: ${rloc16}`);
|
|
72
75
|
}
|
|
@@ -75,14 +78,15 @@ export namespace Address16 {
|
|
|
75
78
|
}
|
|
76
79
|
|
|
77
80
|
export namespace BatteryLevel {
|
|
78
|
-
export function decode(value:
|
|
79
|
-
|
|
80
|
-
|
|
81
|
+
export function decode(value: Bytes): number {
|
|
82
|
+
const buf = Bytes.of(value);
|
|
83
|
+
if (buf.length !== 1) {
|
|
84
|
+
throw new ThreadDiagError(`BatteryLevel TLV must be 1 byte, got ${buf.length}`);
|
|
81
85
|
}
|
|
82
|
-
return
|
|
86
|
+
return buf[0];
|
|
83
87
|
}
|
|
84
88
|
|
|
85
|
-
export function encode(percent: number):
|
|
89
|
+
export function encode(percent: number): Bytes {
|
|
86
90
|
if (!Number.isInteger(percent) || percent < 0 || percent > 0xff) {
|
|
87
91
|
throw new InternalError(`BatteryLevel out of range: ${percent}`);
|
|
88
92
|
}
|
|
@@ -91,14 +95,15 @@ export namespace BatteryLevel {
|
|
|
91
95
|
}
|
|
92
96
|
|
|
93
97
|
export namespace SupplyVoltage {
|
|
94
|
-
export function decode(value:
|
|
95
|
-
|
|
96
|
-
|
|
98
|
+
export function decode(value: Bytes): number {
|
|
99
|
+
const buf = Bytes.of(value);
|
|
100
|
+
if (buf.length !== 2) {
|
|
101
|
+
throw new ThreadDiagError(`SupplyVoltage TLV must be 2 bytes, got ${buf.length}`);
|
|
97
102
|
}
|
|
98
|
-
return (
|
|
103
|
+
return (buf[0] << 8) | buf[1];
|
|
99
104
|
}
|
|
100
105
|
|
|
101
|
-
export function encode(millivolts: number):
|
|
106
|
+
export function encode(millivolts: number): Bytes {
|
|
102
107
|
if (!Number.isInteger(millivolts) || millivolts < 0 || millivolts > 0xffff) {
|
|
103
108
|
throw new InternalError(`SupplyVoltage out of range: ${millivolts}`);
|
|
104
109
|
}
|
|
@@ -107,14 +112,15 @@ export namespace SupplyVoltage {
|
|
|
107
112
|
}
|
|
108
113
|
|
|
109
114
|
export namespace MaxChildTimeout {
|
|
110
|
-
export function decode(value:
|
|
111
|
-
|
|
112
|
-
|
|
115
|
+
export function decode(value: Bytes): number {
|
|
116
|
+
const buf = Bytes.of(value);
|
|
117
|
+
if (buf.length !== 4) {
|
|
118
|
+
throw new ThreadDiagError(`MaxChildTimeout TLV must be 4 bytes, got ${buf.length}`);
|
|
113
119
|
}
|
|
114
|
-
return ((
|
|
120
|
+
return ((buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3]) >>> 0;
|
|
115
121
|
}
|
|
116
122
|
|
|
117
|
-
export function encode(seconds: number):
|
|
123
|
+
export function encode(seconds: number): Bytes {
|
|
118
124
|
if (!Number.isInteger(seconds) || seconds < 0 || seconds > 0xffffffff) {
|
|
119
125
|
throw new InternalError(`MaxChildTimeout out of range: ${seconds}`);
|
|
120
126
|
}
|
|
@@ -128,11 +134,11 @@ export namespace MaxChildTimeout {
|
|
|
128
134
|
}
|
|
129
135
|
|
|
130
136
|
export namespace ChannelPages {
|
|
131
|
-
export function decode(value:
|
|
132
|
-
return Array.from(value);
|
|
137
|
+
export function decode(value: Bytes): number[] {
|
|
138
|
+
return Array.from(Bytes.of(value));
|
|
133
139
|
}
|
|
134
140
|
|
|
135
|
-
export function encode(pages: ReadonlyArray<number>):
|
|
141
|
+
export function encode(pages: ReadonlyArray<number>): Bytes {
|
|
136
142
|
const out = new Uint8Array(pages.length);
|
|
137
143
|
for (let i = 0; i < pages.length; i++) {
|
|
138
144
|
const p = pages[i];
|
package/src/tlv/diag/Route64.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { InternalError } from "@matter/general";
|
|
7
|
+
import { Bytes, InternalError } from "@matter/general";
|
|
8
8
|
import { ThreadDiagError } from "../../diagnostic/errors.js";
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -60,27 +60,28 @@ function setRouterIdBit(mask: Uint8Array, routerId: number): void {
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
export namespace Route64 {
|
|
63
|
-
export function decode(value:
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
export function decode(value: Bytes): Route64 {
|
|
64
|
+
const buf = Bytes.of(value);
|
|
65
|
+
if (buf.length < HEADER_BYTES) {
|
|
66
|
+
throw new ThreadDiagError(`Route64 TLV too short: ${buf.length} bytes (need >=${HEADER_BYTES})`);
|
|
66
67
|
}
|
|
67
|
-
const idSequence =
|
|
68
|
-
const mask =
|
|
68
|
+
const idSequence = buf[0];
|
|
69
|
+
const mask = buf.subarray(1, HEADER_BYTES);
|
|
69
70
|
|
|
70
71
|
const allocatedIds = new Array<number>();
|
|
71
72
|
for (let id = 0; id <= MAX_ROUTER_ID; id++) {
|
|
72
73
|
if (isRouterIdSet(mask, id)) allocatedIds.push(id);
|
|
73
74
|
}
|
|
74
75
|
|
|
75
|
-
if (
|
|
76
|
+
if (buf.length !== HEADER_BYTES + allocatedIds.length) {
|
|
76
77
|
throw new ThreadDiagError(
|
|
77
|
-
`Route64 TLV size mismatch: ${
|
|
78
|
+
`Route64 TLV size mismatch: ${buf.length} bytes for ${allocatedIds.length} allocated routers`,
|
|
78
79
|
);
|
|
79
80
|
}
|
|
80
81
|
|
|
81
82
|
const entries = new Array<Route64Entry>();
|
|
82
83
|
for (let i = 0; i < allocatedIds.length; i++) {
|
|
83
|
-
const data =
|
|
84
|
+
const data = buf[HEADER_BYTES + i];
|
|
84
85
|
entries.push({
|
|
85
86
|
routerId: allocatedIds[i],
|
|
86
87
|
linkQualityOut: (data & LINK_QUALITY_OUT_MASK) >> LINK_QUALITY_OUT_SHIFT,
|
|
@@ -91,7 +92,7 @@ export namespace Route64 {
|
|
|
91
92
|
return { idSequence, entries };
|
|
92
93
|
}
|
|
93
94
|
|
|
94
|
-
export function encode(route: Route64):
|
|
95
|
+
export function encode(route: Route64): Bytes {
|
|
95
96
|
const sortedEntries = [...route.entries].sort((a, b) => a.routerId - b.routerId);
|
|
96
97
|
|
|
97
98
|
const out = new Uint8Array(HEADER_BYTES + sortedEntries.length);
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
import { Bytes } from "@matter/general";
|
|
8
|
+
|
|
7
9
|
/**
|
|
8
10
|
* One decoded Router Neighbor entry from Network Diagnostic TLV type 31.
|
|
9
11
|
*
|
|
@@ -24,7 +26,7 @@
|
|
|
24
26
|
export interface RouterNeighborEntry {
|
|
25
27
|
rloc16: number;
|
|
26
28
|
/** 8-byte IEEE EUI-64 extended address. */
|
|
27
|
-
extAddress:
|
|
29
|
+
extAddress: Bytes;
|
|
28
30
|
version: number;
|
|
29
31
|
/** Seconds elapsed since link establishment. */
|
|
30
32
|
connectionTime: number;
|
|
@@ -47,24 +49,25 @@ const ENTRY_BYTES = 24;
|
|
|
47
49
|
const FLAGS_TRACK_ERR_RATE = 0x80; // kFlagsTrackErrRate = 1 << 7
|
|
48
50
|
|
|
49
51
|
export namespace RouterNeighbor {
|
|
50
|
-
export function decode(value:
|
|
51
|
-
const
|
|
52
|
+
export function decode(value: Bytes): RouterNeighborEntry[] {
|
|
53
|
+
const buf = Bytes.of(value);
|
|
54
|
+
const entryCount = Math.floor(buf.length / ENTRY_BYTES);
|
|
52
55
|
const entries = new Array<RouterNeighborEntry>();
|
|
53
56
|
|
|
54
57
|
for (let i = 0; i < entryCount; i++) {
|
|
55
58
|
const off = i * ENTRY_BYTES;
|
|
56
|
-
const flags =
|
|
57
|
-
const rloc16 = (
|
|
58
|
-
const extAddress =
|
|
59
|
-
const version = (
|
|
59
|
+
const flags = buf[off];
|
|
60
|
+
const rloc16 = (buf[off + 1] << 8) | buf[off + 2];
|
|
61
|
+
const extAddress = buf.slice(off + 3, off + 11);
|
|
62
|
+
const version = (buf[off + 11] << 8) | buf[off + 12];
|
|
60
63
|
const connectionTime =
|
|
61
|
-
((
|
|
62
|
-
const linkMargin =
|
|
64
|
+
((buf[off + 13] << 24) | (buf[off + 14] << 16) | (buf[off + 15] << 8) | buf[off + 16]) >>> 0;
|
|
65
|
+
const linkMargin = buf[off + 17];
|
|
63
66
|
// int8 signed decode: values >= 128 are negative (two's complement).
|
|
64
|
-
const averageRssi =
|
|
65
|
-
const lastRssi =
|
|
66
|
-
const frameErrorRate = (
|
|
67
|
-
const messageErrorRate = (
|
|
67
|
+
const averageRssi = buf[off + 18] > 127 ? buf[off + 18] - 256 : buf[off + 18];
|
|
68
|
+
const lastRssi = buf[off + 19] > 127 ? buf[off + 19] - 256 : buf[off + 19];
|
|
69
|
+
const frameErrorRate = (buf[off + 20] << 8) | buf[off + 21];
|
|
70
|
+
const messageErrorRate = (buf[off + 22] << 8) | buf[off + 23];
|
|
68
71
|
|
|
69
72
|
entries.push({
|
|
70
73
|
rloc16,
|
package/src/tlv/diag/Timeout.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { InternalError } from "@matter/general";
|
|
7
|
+
import { Bytes, InternalError } from "@matter/general";
|
|
8
8
|
import { ThreadDiagError } from "../../diagnostic/errors.js";
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -15,14 +15,15 @@ import { ThreadDiagError } from "../../diagnostic/errors.js";
|
|
|
15
15
|
* `network_diagnostic.cpp` parser.
|
|
16
16
|
*/
|
|
17
17
|
export namespace Timeout {
|
|
18
|
-
export function decode(value:
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
export function decode(value: Bytes): number {
|
|
19
|
+
const buf = Bytes.of(value);
|
|
20
|
+
if (buf.length !== 4) {
|
|
21
|
+
throw new ThreadDiagError(`Timeout TLV must be 4 bytes, got ${buf.length}`);
|
|
21
22
|
}
|
|
22
|
-
return ((
|
|
23
|
+
return ((buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3]) >>> 0;
|
|
23
24
|
}
|
|
24
25
|
|
|
25
|
-
export function encode(seconds: number):
|
|
26
|
+
export function encode(seconds: number): Bytes {
|
|
26
27
|
if (!Number.isInteger(seconds) || seconds < 0 || seconds > 0xffffffff) {
|
|
27
28
|
throw new InternalError(`Timeout TLV out of range: ${seconds}`);
|
|
28
29
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { InternalError } from "@matter/general";
|
|
7
|
+
import { Bytes, InternalError } from "@matter/general";
|
|
8
8
|
import { ThreadDiagError } from "../../diagnostic/errors.js";
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -28,11 +28,11 @@ import { ThreadDiagError } from "../../diagnostic/errors.js";
|
|
|
28
28
|
const TEXT_DECODER = new TextDecoder("utf-8", { fatal: false });
|
|
29
29
|
const TEXT_ENCODER = new TextEncoder();
|
|
30
30
|
|
|
31
|
-
function decodeUtf8(value:
|
|
31
|
+
function decodeUtf8(value: Bytes): string {
|
|
32
32
|
return TEXT_DECODER.decode(value);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
function encodeUtf8(text: string, maxBytes: number, name: string):
|
|
35
|
+
function encodeUtf8(text: string, maxBytes: number, name: string): Bytes {
|
|
36
36
|
const encoded = TEXT_ENCODER.encode(text);
|
|
37
37
|
if (encoded.length > maxBytes) {
|
|
38
38
|
throw new InternalError(`${name} value too long: ${encoded.length} bytes (max ${maxBytes})`);
|
|
@@ -47,14 +47,15 @@ export const THREAD_STACK_VERSION_MAX = 64;
|
|
|
47
47
|
export const VENDOR_APP_URL_MAX = 96;
|
|
48
48
|
|
|
49
49
|
export namespace Version {
|
|
50
|
-
export function decode(value:
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
export function decode(value: Bytes): number {
|
|
51
|
+
const buf = Bytes.of(value);
|
|
52
|
+
if (buf.length !== 2) {
|
|
53
|
+
throw new ThreadDiagError(`Version TLV must be 2 bytes, got ${buf.length}`);
|
|
53
54
|
}
|
|
54
|
-
return (
|
|
55
|
+
return (buf[0] << 8) | buf[1];
|
|
55
56
|
}
|
|
56
57
|
|
|
57
|
-
export function encode(version: number):
|
|
58
|
+
export function encode(version: number): Bytes {
|
|
58
59
|
if (!Number.isInteger(version) || version < 0 || version > 0xffff) {
|
|
59
60
|
throw new InternalError(`Version TLV out of range: ${version}`);
|
|
60
61
|
}
|
|
@@ -63,51 +64,51 @@ export namespace Version {
|
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
export namespace VendorName {
|
|
66
|
-
export function decode(value:
|
|
67
|
+
export function decode(value: Bytes): string {
|
|
67
68
|
return decodeUtf8(value);
|
|
68
69
|
}
|
|
69
70
|
|
|
70
|
-
export function encode(name: string):
|
|
71
|
+
export function encode(name: string): Bytes {
|
|
71
72
|
return encodeUtf8(name, VENDOR_NAME_MAX, "VendorName");
|
|
72
73
|
}
|
|
73
74
|
}
|
|
74
75
|
|
|
75
76
|
export namespace VendorModel {
|
|
76
|
-
export function decode(value:
|
|
77
|
+
export function decode(value: Bytes): string {
|
|
77
78
|
return decodeUtf8(value);
|
|
78
79
|
}
|
|
79
80
|
|
|
80
|
-
export function encode(model: string):
|
|
81
|
+
export function encode(model: string): Bytes {
|
|
81
82
|
return encodeUtf8(model, VENDOR_MODEL_MAX, "VendorModel");
|
|
82
83
|
}
|
|
83
84
|
}
|
|
84
85
|
|
|
85
86
|
export namespace VendorSwVersion {
|
|
86
|
-
export function decode(value:
|
|
87
|
+
export function decode(value: Bytes): string {
|
|
87
88
|
return decodeUtf8(value);
|
|
88
89
|
}
|
|
89
90
|
|
|
90
|
-
export function encode(version: string):
|
|
91
|
+
export function encode(version: string): Bytes {
|
|
91
92
|
return encodeUtf8(version, VENDOR_SW_VERSION_MAX, "VendorSwVersion");
|
|
92
93
|
}
|
|
93
94
|
}
|
|
94
95
|
|
|
95
96
|
export namespace ThreadStackVersion {
|
|
96
|
-
export function decode(value:
|
|
97
|
+
export function decode(value: Bytes): string {
|
|
97
98
|
return decodeUtf8(value);
|
|
98
99
|
}
|
|
99
100
|
|
|
100
|
-
export function encode(version: string):
|
|
101
|
+
export function encode(version: string): Bytes {
|
|
101
102
|
return encodeUtf8(version, THREAD_STACK_VERSION_MAX, "ThreadStackVersion");
|
|
102
103
|
}
|
|
103
104
|
}
|
|
104
105
|
|
|
105
106
|
export namespace VendorAppUrl {
|
|
106
|
-
export function decode(value:
|
|
107
|
+
export function decode(value: Bytes): string {
|
|
107
108
|
return decodeUtf8(value);
|
|
108
109
|
}
|
|
109
110
|
|
|
110
|
-
export function encode(url: string):
|
|
111
|
+
export function encode(url: string): Bytes {
|
|
111
112
|
return encodeUtf8(url, VENDOR_APP_URL_MAX, "VendorAppUrl");
|
|
112
113
|
}
|
|
113
114
|
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
import { Bytes } from "@matter/general";
|
|
7
8
|
import { ThreadTlvError } from "../BasicTlvCodec.js";
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -18,14 +19,16 @@ import { ThreadTlvError } from "../BasicTlvCodec.js";
|
|
|
18
19
|
* `src/core/meshcop/meshcop_tlvs.hpp` `IPv6AddressTlv` (`kIPv6Address = 49`).
|
|
19
20
|
*/
|
|
20
21
|
export namespace Ip6AddressTlv {
|
|
21
|
-
export function encode(addr:
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
export function encode(addr: Bytes): Bytes {
|
|
23
|
+
const buf = Bytes.of(addr);
|
|
24
|
+
assertLength(buf);
|
|
25
|
+
return buf.slice();
|
|
24
26
|
}
|
|
25
27
|
|
|
26
|
-
export function decode(bytes:
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
export function decode(bytes: Bytes): Bytes {
|
|
29
|
+
const buf = Bytes.of(bytes);
|
|
30
|
+
assertLength(buf);
|
|
31
|
+
return buf.slice();
|
|
29
32
|
}
|
|
30
33
|
}
|
|
31
34
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { InternalError } from "@matter/general";
|
|
7
|
+
import { Bytes, InternalError } from "@matter/general";
|
|
8
8
|
import { ThreadTlvError } from "../BasicTlvCodec.js";
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -22,30 +22,32 @@ import { ThreadTlvError } from "../BasicTlvCodec.js";
|
|
|
22
22
|
export interface UdpEncapsulation {
|
|
23
23
|
sourcePort: number;
|
|
24
24
|
destinationPort: number;
|
|
25
|
-
payload:
|
|
25
|
+
payload: Bytes;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
export namespace UdpEncapsulationTlv {
|
|
29
|
-
export function encode({ sourcePort, destinationPort, payload }: UdpEncapsulation):
|
|
29
|
+
export function encode({ sourcePort, destinationPort, payload }: UdpEncapsulation): Bytes {
|
|
30
30
|
assertPort(sourcePort, "sourcePort");
|
|
31
31
|
assertPort(destinationPort, "destinationPort");
|
|
32
|
-
const
|
|
32
|
+
const payloadBytes = Bytes.of(payload);
|
|
33
|
+
const out = new Uint8Array(4 + payloadBytes.length);
|
|
33
34
|
out[0] = (sourcePort >> 8) & 0xff;
|
|
34
35
|
out[1] = sourcePort & 0xff;
|
|
35
36
|
out[2] = (destinationPort >> 8) & 0xff;
|
|
36
37
|
out[3] = destinationPort & 0xff;
|
|
37
|
-
out.set(
|
|
38
|
+
out.set(payloadBytes, 4);
|
|
38
39
|
return out;
|
|
39
40
|
}
|
|
40
41
|
|
|
41
|
-
export function decode(bytes:
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
export function decode(bytes: Bytes): UdpEncapsulation {
|
|
43
|
+
const buf = Bytes.of(bytes);
|
|
44
|
+
if (buf.length < 4) {
|
|
45
|
+
throw new ThreadTlvError(`UdpEncapsulationTlv: value must be at least 4 bytes, got ${buf.length}`);
|
|
44
46
|
}
|
|
45
47
|
return {
|
|
46
|
-
sourcePort: (
|
|
47
|
-
destinationPort: (
|
|
48
|
-
payload:
|
|
48
|
+
sourcePort: (buf[0] << 8) | buf[1],
|
|
49
|
+
destinationPort: (buf[2] << 8) | buf[3],
|
|
50
|
+
payload: buf.slice(4),
|
|
49
51
|
};
|
|
50
52
|
}
|
|
51
53
|
}
|
|
@@ -4,18 +4,18 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { ImplementationError } from "@matter/general";
|
|
7
|
+
import { Bytes, ImplementationError } from "@matter/general";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Realm-local all-Thread-nodes multicast address (`ff03::1`).
|
|
11
11
|
*/
|
|
12
|
-
export const ALL_THREAD_NODES_REALM_LOCAL:
|
|
12
|
+
export const ALL_THREAD_NODES_REALM_LOCAL: Bytes = realmLocal(0x01);
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Realm-local all-Thread-routers multicast address (`ff03::2`). Diagnostic
|
|
16
16
|
* multicast queries (`MGMT_DIAG_GET.qry`) target this group.
|
|
17
17
|
*/
|
|
18
|
-
export const ALL_THREAD_ROUTERS_REALM_LOCAL:
|
|
18
|
+
export const ALL_THREAD_ROUTERS_REALM_LOCAL: Bytes = realmLocal(0x02);
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* Derive the mesh-local IPv6 address of a node from its RLOC16.
|
|
@@ -23,15 +23,16 @@ export const ALL_THREAD_ROUTERS_REALM_LOCAL: Uint8Array = realmLocal(0x02);
|
|
|
23
23
|
* Layout: `mlPrefix(8) || 0x0000 00FF FE00 || rloc16(2 BE)` — the well-known
|
|
24
24
|
* Thread RLOC interface identifier with the locator in the low 16 bits.
|
|
25
25
|
*/
|
|
26
|
-
export function deriveMeshLocalAddress(mlPrefix:
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
export function deriveMeshLocalAddress(mlPrefix: Bytes, rloc16: number): Bytes {
|
|
27
|
+
const prefix = Bytes.of(mlPrefix);
|
|
28
|
+
if (prefix.length !== 8) {
|
|
29
|
+
throw new ImplementationError(`deriveMeshLocalAddress: mlPrefix must be 8 bytes, got ${prefix.length}`);
|
|
29
30
|
}
|
|
30
31
|
if (!Number.isInteger(rloc16) || rloc16 < 0 || rloc16 > 0xffff) {
|
|
31
32
|
throw new ImplementationError(`deriveMeshLocalAddress: rloc16 out of range: ${rloc16}`);
|
|
32
33
|
}
|
|
33
34
|
const addr = new Uint8Array(16);
|
|
34
|
-
addr.set(
|
|
35
|
+
addr.set(prefix, 0);
|
|
35
36
|
addr[11] = 0xff;
|
|
36
37
|
addr[12] = 0xfe;
|
|
37
38
|
addr[14] = (rloc16 >> 8) & 0xff;
|
|
@@ -43,7 +44,8 @@ export function deriveMeshLocalAddress(mlPrefix: Uint8Array, rloc16: number): Ui
|
|
|
43
44
|
* Format a 16-byte IPv6 address as colon-separated hextets with leading zeros
|
|
44
45
|
* trimmed. No `::` compression — for logs, where unambiguity beats brevity.
|
|
45
46
|
*/
|
|
46
|
-
export function formatIp6(
|
|
47
|
+
export function formatIp6(input: Bytes): string {
|
|
48
|
+
const addr = Bytes.of(input);
|
|
47
49
|
if (addr.length !== 16) {
|
|
48
50
|
throw new ImplementationError(`formatIp6: address must be 16 bytes, got ${addr.length}`);
|
|
49
51
|
}
|