diff options
author | Neal H. Walfield <neal@pep.foundation> | 2018-11-22 10:38:47 +0100 |
---|---|---|
committer | Neal H. Walfield <neal@pep.foundation> | 2018-11-22 10:55:43 +0100 |
commit | 73d61ae48eb932613821cf524d122164c9512540 (patch) | |
tree | 3e15d71174a979ce406d61cd896c4b6e111a9754 /ffi/include | |
parent | fce58a063f8c2aeeaef783f45ec089cfcc753102 (diff) |
ffi: Wrap tpk::UserIDBinding.
- Add sq_user_id_binding_user_id to return the value of the UserID
from a UserIDBinding.
- Export an interface to iterate over UserIDBindings,
sq_tpk_user_id_binding_iter, fn sq_user_id_binding_iter_free,
sq_user_id_binding_iter_next.
Diffstat (limited to 'ffi/include')
-rw-r--r-- | ffi/include/sequoia/openpgp.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/ffi/include/sequoia/openpgp.h b/ffi/include/sequoia/openpgp.h index f898c2a3..c39581c7 100644 --- a/ffi/include/sequoia/openpgp.h +++ b/ffi/include/sequoia/openpgp.h @@ -545,6 +545,38 @@ typedef enum sq_reason_for_revocation { SQ_REASON_FOR_REVOCATION_FORCE_WIDTH = INT_MAX, } sq_reason_for_revocation_t; +/* openpgp::tpk::UserIDBinding. */ + +/*/ +/// A `UserIDBinding`. +/*/ +typedef struct sq_user_id_binding *sq_user_id_binding_t; + +/*/ +/// Returns the user id. +/// +/// This function may fail and return NULL if the user id contains an +/// interior NUL byte. We do this rather than complicate the API, as +/// there is no valid use for such user ids; they must be malicious. +/// +/// The caller must free the returned value. +/*/ +char *sq_user_id_binding_user_id (sq_user_id_binding_t binding); + +/* openpgp::tpk::UserIDBindingIter. */ + +/*/ +/// An iterator over `UserIDBinding`s. +/*/ +typedef struct sq_user_id_binding_iter *sq_user_id_binding_iter_t; + +/*/ +/// Returns the next element in the iterator. +/*/ +sq_user_id_binding_t sq_user_id_binding_iter_next (sq_user_id_binding_iter_t iter); + +/// Frees an sq_user_id_binding_iter_t. +void sq_user_id_binding_iter_free (sq_user_id_binding_iter_t iter); /* openpgp::tpk. */ @@ -708,6 +740,11 @@ sq_tpk_t sq_tpk_set_expiry(sq_context_t ctx, /*/ int sq_tpk_is_tsk(sq_tpk_t tpk); +/*/ +/// Returns an iterator over the `UserIDBinding`s. +/*/ +sq_user_id_binding_iter_t sq_tpk_user_id_binding_iter (sq_tpk_t tpk); + /* TPKBuilder */ typedef struct sq_tpk_builder *sq_tpk_builder_t; |