From 2ef1f6f4fc5bdc069483a527ab3a1b060c71fcad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Wed, 23 Sep 2020 10:13:46 +0200 Subject: SAS: add olm_sas_is_their_key_set Also make olm_sas_generate_bytes fail if their key wasn't set. --- include/olm/sas.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'include/olm/sas.h') diff --git a/include/olm/sas.h b/include/olm/sas.h index ee44eff..4a5e751 100644 --- a/include/olm/sas.h +++ b/include/olm/sas.h @@ -105,6 +105,15 @@ size_t olm_sas_set_their_key( void * their_key, size_t their_key_length ); +/** Checks if their key was set. + * + * @param[in] sas the SAS object. + * + */ +int olm_sas_is_their_key_set( + OlmSAS *sas +); + /** Generate bytes to use for the short authentication string. * * @param[in] sas the SAS object. @@ -114,6 +123,9 @@ size_t olm_sas_set_their_key( * @param[out] output the output buffer. * @param[in] output_length the size of the output buffer. For hex-based SAS * as in the Matrix spec, this will be 5. + * + * @return `olm_error()` on failure. If their key wasn't set then + * `olm_sas_last_error()` will be `SAS_THEIR_KEY_NOT_SET`. */ size_t olm_sas_generate_bytes( OlmSAS * sas, -- cgit v1.2.3