diff options
author | Mark Haines <mark.haines@matrix.org> | 2015-07-10 11:57:53 +0100 |
---|---|---|
committer | Mark Haines <mark.haines@matrix.org> | 2015-07-10 11:57:53 +0100 |
commit | b6e248c9a58cccbcd5dea7bdc8e3cdee4af03722 (patch) | |
tree | 0924e69d210b7d6878c7fb11f68b942b15f3ca6c /include/olm/account.hh | |
parent | 373acefde7be92f86b8294b325519ad916b1e054 (diff) |
Output simpler JSON for the account keys, don't sign the JSON but instead provide a olm_account_sign method so that the user of the library can sign the JSON themselves
Diffstat (limited to 'include/olm/account.hh')
-rw-r--r-- | include/olm/account.hh | 52 |
1 files changed, 20 insertions, 32 deletions
diff --git a/include/olm/account.hh b/include/olm/account.hh index da3ca35..209139a 100644 --- a/include/olm/account.hh +++ b/include/olm/account.hh @@ -56,57 +56,45 @@ struct Account { ); /** Number of bytes needed to output the identity keys for this account */ - std::size_t get_identity_json_length( - std::size_t user_id_length, - std::size_t device_id_length, - std::uint64_t valid_after_ts, - std::uint64_t valid_until_ts - ); + std::size_t get_identity_json_length(); /** Output the identity keys for this account as JSON in the following * format: * - * {"algorithms": - * ["m.olm.curve25519-aes-sha256" - * ] - * ,"device_id":"<device identifier>" - * ,"keys": - * {"curve25519:<key id>":"<base64 characters>" - * ,"ed25519:<key id>":"<base64 characters>" - * } - * ,"user_id":"<user identifier>" - * ,"valid_after_ts":<digits> - * ,"valid_until_ts":<digits> - * ,"signatures": - * {"<user identifier>/<device identifier>": - * {"ed25519:<key id>":"<base64 characters>" - * } - * } + * {"curve25519":"<43 base64 characters>" + * ,"ed25519":"<43 base64 characters>" * } * - * The user_id and device_id must not contain 0x00-0x1F, '\"' or '\\'. - * The JSON up to but not including the "signatures" key will be signed - * using the account's ed25519 key. That signature is then included under - * the "signatures" key. * * Returns the size of the JSON written or std::size_t(-1) on error. * If the buffer is too small last_error will be OUTPUT_BUFFER_TOO_SMALL. */ std::size_t get_identity_json( - std::uint8_t const * user_id, std::size_t user_id_length, - std::uint8_t const * device_id, std::size_t device_id_length, - std::uint64_t valid_after_ts, - std::uint64_t valid_until_ts, std::uint8_t * identity_json, std::size_t identity_json_length ); + /** + * The length of an ed25519 signature in bytes. + */ + std::size_t signature_length(); + + /** + * Signs a message with the ed25519 key for this account. + */ + std::size_t sign( + std::uint8_t const * message, std::size_t message_length, + std::uint8_t * signature, std::size_t signature_length + ); + /** Number of bytes needed to output the one time keys for this account */ std::size_t get_one_time_keys_json_length(); /** Output the one time keys that haven't been published yet as JSON: * - * {"curve25519:<key id>":"<base64 characters>" - * ,"curve25519:<key_id>":"<base64 characters>" + * {"curve25519": + * ["<6 byte key id>":"<43 base64 characters>" + * ,"<6 byte key id>":"<43 base64 characters>" * ... + * ] * } * * Returns the size of the JSON written or std::size_t(-1) on error. |