summaryrefslogtreecommitdiffstats
path: root/openpgp-ffi
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@pep.foundation>2019-05-07 11:12:21 +0200
committerNeal H. Walfield <neal@pep.foundation>2019-05-07 12:18:42 +0200
commit381ecfedce31d38d6bd447d85a05f7d9a458c38b (patch)
treefc9b245eb8a46bee88e9bdaac00c7efd91d70cfc /openpgp-ffi
parent4ecdcafbb1a46a39e7fe54c2802c421c2160884d (diff)
openpgp: Rename TPKBuilder::default to TPKBuilder::new
- One would think that TPKBuilder::default would return something filled with useful defaults, but it just returns a nearly empty builder. Rename it to TPKBuilder::new, which is less misleading.
Diffstat (limited to 'openpgp-ffi')
-rw-r--r--openpgp-ffi/examples/generate-key.c2
-rw-r--r--openpgp-ffi/include/sequoia/openpgp.h8
-rw-r--r--openpgp-ffi/src/tpk.rs10
3 files changed, 12 insertions, 8 deletions
diff --git a/openpgp-ffi/examples/generate-key.c b/openpgp-ffi/examples/generate-key.c
index 268e5593..96a7f2fc 100644
--- a/openpgp-ffi/examples/generate-key.c
+++ b/openpgp-ffi/examples/generate-key.c
@@ -8,7 +8,7 @@ main () {
pgp_status_t rc;
/* First, generate the key. */
- pgp_tpk_builder_t builder = pgp_tpk_builder_default ();
+ pgp_tpk_builder_t builder = pgp_tpk_builder_new ();
pgp_tpk_builder_set_cipher_suite (&builder, PGP_TPK_CIPHER_SUITE_CV25519);
pgp_tpk_t tpk;
diff --git a/openpgp-ffi/include/sequoia/openpgp.h b/openpgp-ffi/include/sequoia/openpgp.h
index d985984e..1f612855 100644
--- a/openpgp-ffi/include/sequoia/openpgp.h
+++ b/openpgp-ffi/include/sequoia/openpgp.h
@@ -802,9 +802,13 @@ char *pgp_tpk_primary_user_id(pgp_tpk_t tpk);
/* TPKBuilder */
/*/
-/// Creates a default `pgp_tpk_builder_t`.
+/// Creates a new `pgp_tpk_builder_t`.
+///
+/// The returned TPKBuilder is setup to only create a
+/// certification-capable primary key using the default cipher suite.
+/// You'll almost certainly want to add subkeys, and user ids.
/*/
-pgp_tpk_builder_t pgp_tpk_builder_default(void);
+pgp_tpk_builder_t pgp_tpk_builder_new(void);
/*/
/// Generates a key compliant to [Autocrypt Level 1].
diff --git a/openpgp-ffi/src/tpk.rs b/openpgp-ffi/src/tpk.rs
index 9fbc871c..060715bc 100644
--- a/openpgp-ffi/src/tpk.rs
+++ b/openpgp-ffi/src/tpk.rs
@@ -188,7 +188,7 @@ fn int_to_reason_for_revocation(code: c_int) -> ReasonForRevocation {
/// pgp_key_pair_t primary_keypair;
/// pgp_signer_t primary_signer;
///
-/// builder = pgp_tpk_builder_default ();
+/// builder = pgp_tpk_builder_new ();
/// pgp_tpk_builder_set_cipher_suite (&builder, PGP_TPK_CIPHER_SUITE_CV25519);
/// pgp_tpk_builder_generate (NULL, builder, &tpk, &revocation);
/// assert (tpk);
@@ -255,7 +255,7 @@ fn pgp_tpk_revoke(errp: Option<&mut *mut ::error::Error>,
/// pgp_key_pair_t primary_keypair;
/// pgp_signer_t primary_signer;
///
-/// builder = pgp_tpk_builder_default ();
+/// builder = pgp_tpk_builder_new ();
/// pgp_tpk_builder_set_cipher_suite (&builder, PGP_TPK_CIPHER_SUITE_CV25519);
/// pgp_tpk_builder_generate (NULL, builder, &tpk, &revocation);
/// assert (tpk);
@@ -690,7 +690,7 @@ pub extern "system" fn pgp_tpk_key_iter_next<'a>(
/// pgp_tpk_t tpk;
/// pgp_signature_t revocation;
///
-/// builder = pgp_tpk_builder_default ();
+/// builder = pgp_tpk_builder_new ();
/// pgp_tpk_builder_set_cipher_suite (&builder, PGP_TPK_CIPHER_SUITE_CV25519);
/// pgp_tpk_builder_add_userid (&builder, "some@example.org");
/// pgp_tpk_builder_add_signing_subkey (&builder);
@@ -705,8 +705,8 @@ pub extern "system" fn pgp_tpk_key_iter_next<'a>(
/// pgp_tpk_free (tpk);
/// ```
#[::sequoia_ffi_macros::extern_fn] #[no_mangle]
-pub extern "system" fn pgp_tpk_builder_default() -> *mut TPKBuilder {
- box_raw!(TPKBuilder::default())
+pub extern "system" fn pgp_tpk_builder_new() -> *mut TPKBuilder {
+ box_raw!(TPKBuilder::new())
}
/// Generates a key compliant to [Autocrypt Level 1].