Browse Source

improve import_key: this change set had been apparently lost

positron-nkls-mixnet
Luca Saiu 2 years ago
parent
commit
539d931f66
  1. 28
      src/pEp/_pEp/basic_api.cc
  2. 4
      src/pEp/_pEp/basic_api.hh
  3. 8
      src/pEp/_pEp/pEpmodule.cc

28
src/pEp/_pEp/basic_api.cc

@ -110,33 +110,7 @@ namespace pEp {
_throw_status(status);
}
boost::python::list import_key(string key_data)
{
::identity_list *private_keys = NULL;
PEP_STATUS status = ::import_key(
Adapter::session(),
key_data.c_str(),
key_data.size(),
&private_keys);
if (status && status != PEP_KEY_IMPORTED)
_throw_status(status);
auto result = boost::python::list();
for (::identity_list *il = private_keys; il && il->ident; il = il->next) {
::pEp_identity *ident = ::identity_dup(il->ident);
if (!ident) {
free_identity_list(private_keys);
throw std::bad_alloc();
}
result.append(Identity(ident));
}
free_identity_list(private_keys);
return result;
}
boost::python::tuple import_key_with_fpr_return(string key_data)
boost::python::tuple import_key(string key_data)
{
::identity_list *private_keys = NULL;
::stringlist_t *imported_keys = NULL;

4
src/pEp/_pEp/basic_api.hh

@ -23,9 +23,7 @@ namespace pEp {
void key_reset_trust(Identity ident);
boost::python::list import_key(string key_data);
boost::python::tuple import_key_with_fpr_return(string key_data);
boost::python::tuple import_key(string key_data);
string export_key(Identity ident);

8
src/pEp/_pEp/pEpmodule.cc

@ -650,13 +650,7 @@ namespace pEp {
def("import_key",
&import_key,
"private_key_list = import_key(key_data)\n"
"\n"
"import key(s) from key_data\n");
def("import_key_with_fpr_return",
&import_key_with_fpr_return,
"imported_keys, affected_own_identities = import_key_with_fpr_return(key_data)\n"
"imported_keys, affected_own_identities = import_key(key_data)\n"
"\n"
"import key(s) from key_data\n");

Loading…
Cancel
Save