openwsn-berkeley / py-edhoc

Python implementation of EDHOC
BSD 3-Clause "New" or "Revised" License
5 stars 6 forks source link

None values where warnings should be raised #20

Open chrysn opened 3 years ago

chrysn commented 3 years ago

There were (and are) some places in the code where a TODO is indicated, but then the code just passes through without any visible action. Working with the library would be easier if in these places an exception would be raised, and (if things can contine, like when before #19 the signatures got checked, raise a clearly visible warning).

For example, when this returns in the error case

    def remote_pubkey(self) -> RPK:
        if self.cipher_suite.dh_curve in [X448, X25519]:
            return OKPKey(x=self.g_x, crv=self.cipher_suite.dh_curve)
        else:
            # TODO: implement NIST curves
            pass

then the error is not visible where it happens, but only much later when the implicitly returned None is actually used.

Feel free to close this if you consider it just a matter of different styles; I'd file fixes whenever I stumble upon such a case and refer back to this.