diff options
author | Neal H. Walfield <neal@pep.foundation> | 2018-11-22 10:47:39 +0100 |
---|---|---|
committer | Neal H. Walfield <neal@pep.foundation> | 2018-11-22 10:56:17 +0100 |
commit | 89c7f7d72f041cc739cde563558acd381164a965 (patch) | |
tree | 0a5d0af19257f7a0321e9979371fd973dd46e8ff /ffi/include | |
parent | 73d61ae48eb932613821cf524d122164c9512540 (diff) |
ffi: Provide an interface to iterate over Keys in a TPK.
- Add sq_tpk_key_iter, sq_tpk_key_iter_free, and sq_tpk_key_iter_next.
Diffstat (limited to 'ffi/include')
-rw-r--r-- | ffi/include/sequoia/openpgp.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/ffi/include/sequoia/openpgp.h b/ffi/include/sequoia/openpgp.h index c39581c7..a46aa275 100644 --- a/ffi/include/sequoia/openpgp.h +++ b/ffi/include/sequoia/openpgp.h @@ -578,6 +578,28 @@ sq_user_id_binding_t sq_user_id_binding_iter_next (sq_user_id_binding_iter_t ite /// Frees an sq_user_id_binding_iter_t. void sq_user_id_binding_iter_free (sq_user_id_binding_iter_t iter); +/* openpgp::tpk::KeyIter. */ + +/*/ +/// An iterator over keys in a TPK. +/*/ +typedef struct sq_tpk_key_iter *sq_tpk_key_iter_t; + +/*/ +/// Returns a reference to the next element in the iterator. Returns +/// NULL if there are no more elements. +/// +/// If signature is not NULL, stores a reference to the key's most +/// recent self-signature, if any. (Note: subkeys always have +/// signatures, but a primary key may not have a direct signature, and +/// there might not be any user ids.) +/*/ +sq_p_key_t sq_tpk_key_iter_next (sq_tpk_key_iter_t iter, + sq_packet_t *signature); + +/// Frees an sq_tpk_key_iter_t. +void sq_tpk_key_iter_free (sq_tpk_key_iter_t iter); + /* openpgp::tpk. */ /*/ @@ -745,6 +767,12 @@ int sq_tpk_is_tsk(sq_tpk_t tpk); /*/ sq_user_id_binding_iter_t sq_tpk_user_id_binding_iter (sq_tpk_t tpk); +/*/ +/// Returns an iterator over all `Key`s (both the primary key and any +/// subkeys) in a TPK. +/*/ +sq_tpk_key_iter_t sq_tpk_key_iter (sq_tpk_t tpk); + /* TPKBuilder */ typedef struct sq_tpk_builder *sq_tpk_builder_t; |