holomekc / bosch-smart-home-bridge

Allows communication to Bosch Smart Home Controller
MIT License
19 stars 5 forks source link

@types/selfsigned not exported? #14

Closed arnecls closed 9 months ago

arnecls commented 9 months ago

I'm running into a compiler issue when using this dependency.

I'm generating my own certificate to change the lifetime. This requires me to use the selfsigned dependency. However, when I import your module and the selfsigned module, it creates a compiler error, as the selfsigned module does not include the CertificateDefinition interface.

I fixed this by adding this to my tsconfig:

    "typeRoots": [
      "./node_modules/@types",
      "./node_modules/bosch-smart-home-bridge/@types"
    ]

This feels wrong though. The code in question can be found here:

holomekc commented 9 months ago

Hmm when I implemented the lib I started with selfsigned 1.10.7 (2019). In this version there was no type definition. This is why I wrote my own. I can remove this in a newer version. When I do not forget this... I will do this this weekend.

I do the same here btw: https://github.com/holomekc/ioBroker.bshb/blob/85c42eeb1bf235e9e12b7515a68c13b7a4d899a0/tsconfig.json#L27C1-L30

But when I remove the import in my ts config it is still fine. As long as I am not explicitly use CertificateDefinition. At least this is what my compiler and integration tests say.

holomekc commented 9 months ago

Btw. I never tested it, but I think it does not matter how long the client cert is valid. This is not checked by the controller as far as I know. The controller just stores the certificate and is happy to see it in HTTP requests :). But I am not 100% sure. Well. Mine is way older than 365 days. So...

holomekc commented 9 months ago

Ok. I changed my mind. I did it now. You can test version 1.3.1. If you face any issue, please let me know.