@@ -251,8 +251,7 @@ LIBSESSION_EXPORT size_t contacts_size(const config_object* conf);
251251/// Outputs:
252252/// - `contacts_blinded_contact_list*` -- pointer to the list of blinded contact structs; the
253253/// pointer belongs to the caller and must be freed when done with it.
254- LIBSESSION_EXPORT contacts_blinded_contact_list * contacts_blinded_contacts (
255- const config_object * conf );
254+ LIBSESSION_EXPORT contacts_blinded_contact_list * contacts_blinded (const config_object * conf );
256255
257256/// API: contacts/contacts_get_blinded_contact
258257///
@@ -264,27 +263,68 @@ LIBSESSION_EXPORT contacts_blinded_contact_list* contacts_blinded_contacts(
264263/// ```cpp
265264/// BOOL contacts_get_blinded_contact(
266265/// [in] config_object* conf,
267- /// [in] const char* blinded_session_id ,
266+ /// [in] const char* blinded_id ,
268267/// [in] bool legacy_blinding,
269268/// [out] contacts_blinded_contact* blinded_contact
270269/// );
271270/// ```
272271///
273272/// Inputs:
274273/// - `conf` -- [in] Pointer to the config object
275- /// - `blinded_session_id ` -- [in] null terminated hex string
274+ /// - `blinded_id ` -- [in] null terminated hex string
276275/// - `legacy_blinding` -- [in] null terminated hex string
277276/// - `blinded_contact` -- [out] the blinded contact info data
278277///
279278/// Output:
280279/// - `bool` -- Returns true if blinded contact exists
281- LIBSESSION_EXPORT bool contacts_get_blinded_contact (
280+ LIBSESSION_EXPORT bool contacts_get_blinded (
282281 config_object * conf ,
283- const char * blinded_session_id ,
282+ const char * blinded_id ,
284283 bool legacy_blinding ,
285284 contacts_blinded_contact * blinded_contact ) LIBSESSION_WARN_UNUSED ;
286285
287- /// API: contacts/contacts_set_blinded_contact
286+ /// API: contacts/contacts_get_or_construct_blinded
287+ ///
288+ /// Same as the above `contacts_get_blinded()` except that when the blinded contact does not exist,
289+ /// this sets all the contact fields to defaults and loads it with the given blinded_id.
290+ ///
291+ /// Returns true as long as it is given a valid blinded_id. A false return is considered an error,
292+ /// and means the blinded_id was not a valid blinded_id.
293+ ///
294+ /// This is the method that should usually be used to create or update a blinded contact, followed
295+ /// by setting fields in the blinded contact, and then giving it to contacts_set_blinded().
296+ ///
297+ /// Declaration:
298+ /// ```cpp
299+ /// BOOL contacts_get_or_construct_blinded(
300+ /// [in] config_object* conf,
301+ /// [in] const char* community_base_url,
302+ /// [in] const char* community_pubkey_hex,
303+ /// [in] const char* blinded_id,
304+ /// [in] bool legacy_blinding,
305+ /// [out] contacts_blinded_contact* blinded_contact
306+ /// );
307+ /// ```
308+ ///
309+ /// Inputs:
310+ /// - `conf` -- [in] Pointer to the config object
311+ /// - `community_base_url` -- [in] null terminated string
312+ /// - `community_pubkey_hex` -- [in] null terminated hex string
313+ /// - `blinded_id` -- [in] null terminated hex string
314+ /// - `legacy_blinding` -- [in] null terminated hex string
315+ /// - `blinded_contact` -- [out] the blinded contact info data
316+ ///
317+ /// Output:
318+ /// - `bool` -- Returns true if contact exsts
319+ LIBSESSION_EXPORT bool contacts_get_or_construct_blinded (
320+ config_object * conf ,
321+ const char * community_base_url ,
322+ const char * community_pubkey_hex ,
323+ const char * blinded_id ,
324+ bool legacy_blinding ,
325+ contacts_blinded_contact * blinded_contact ) LIBSESSION_WARN_UNUSED ;
326+
327+ /// API: contacts/contacts_set_blinded
288328///
289329/// Adds or updates a blinded contact from the given contact info struct.
290330///
@@ -302,19 +342,19 @@ LIBSESSION_EXPORT bool contacts_get_blinded_contact(
302342///
303343/// Output:
304344/// - `bool` -- Returns true if the call succeeds, false if an error occurs.
305- LIBSESSION_EXPORT bool contacts_set_blinded_contact (
345+ LIBSESSION_EXPORT bool contacts_set_blinded (
306346 config_object * conf , const contacts_blinded_contact * bc );
307347
308- /// API: contacts/contacts_erase_blinded_contact
348+ /// API: contacts/contacts_erase_blinded
309349///
310350/// Erases a blinded contact from the blinded contact list. blinded_id is in hex. Returns true if
311351/// the blinded contact was found and removed, false if the blinded contact was not present.
312352///
313353/// Declaration:
314354/// ```cpp
315- /// BOOL contacts_erase_blinded_contact (
355+ /// BOOL contacts_erase_blinded (
316356/// [in, out] config_object* conf,
317- /// [in] const char* base_url ,
357+ /// [in] const char* community_base_url ,
318358/// [in] const char* blinded_id,
319359/// [in] bool legacy_blinding
320360/// );
@@ -330,7 +370,10 @@ LIBSESSION_EXPORT bool contacts_set_blinded_contact(
330370/// Outputs:
331371/// - `bool` -- True if erasing was successful
332372LIBSESSION_EXPORT bool contacts_erase_blinded_contact (
333- config_object * conf , const char * base_url , const char * blinded_id , bool legacy_blinding );
373+ config_object * conf ,
374+ const char * community_base_url ,
375+ const char * blinded_id ,
376+ bool legacy_blinding );
334377
335378typedef struct contacts_iterator {
336379 void * _internals ;
0 commit comments