How to modify Matter device’s discriminator and setup PIN code without configuring factorydata?

Hi Team,

Is it possible to modify Matter device’s discriminator and setup PIN code in Matter's sample app for test purpose without configuring factorydata ?

Default discriminator: 3840

Default Setup PIN Code: 20202021

Thank you

Bhavya

  • Hi Bhavya,

    You can change the descriminator with CONFIG_CHIP_DEVICE_DISCRIMINATOR in prj.conf. As for the PIN code, you can change it using CONFIG_CHIP_DEVICE_SPAKE2_PASSCODE, but you will also have to generate a new SPAKE2+ verifier for the new passcode and set CONFIG_CHIP_FACTORY_DATA_GENERATE_SPAKE2_VERIFIER=n.

    The SPAKE2+ verifier can be generated with the SPAKE2+ Python Tool using the passcode, SPAKE2+ salt, and iteration count. The simplest is to use the default SPAKE2+ salt (U1BBS0UyUCBLZXkgU2FsdA==) and iteration count (1000). Here is an example where I use the default salt and iteration count but a different passcode:

    ./spake2p.py gen-verifier -p 20372039 -s U1BBS0UyUCBLZXkgU2FsdA== -i 1000

    This results in the verifier kLXow6J5EYWRa3aO71DkTG5qMtkn5PfwwXhOixGa2zEEDEDGlKfe7mEBAg6b3CTx++XPKapVRxnuWs6r6O90+7aDXjlDytFVwlS+PVpSY3dQTmm1/0aZKr9Mw+4mWPBefQ==

    Here is an example showing how to set this in prj.conf:

    CONFIG_CHIP_DEVICE_DISCRIMINATOR=0x231
    CONFIG_CHIP_DEVICE_SPAKE2_PASSCODE=20372039
    CONFIG_CHIP_FACTORY_DATA_GENERATE_SPAKE2_VERIFIER=n
    CONFIG_CHIP_DEVICE_SPAKE2_TEST_VERIFIER="kLXow6J5EYWRa3aO71DkTG5qMtkn5PfwwXhOixGa2zEEDEDGlKfe7mEBAg6b3CTx++XPKapVRxnuWs6r6O90+7aDXjlDytFVwlS+PVpSY3dQTmm1/0aZKr9Mw+4mWPBefQ=="

    Please note that these Kconfigs should only be used for testing purposes.

    Best regards,
    Marte

Related