diff --git a/src/gen_cpp_Engine.ysl2 b/src/gen_cpp_Engine.ysl2 index eef8111..9f50823 100644 --- a/src/gen_cpp_Engine.ysl2 +++ b/src/gen_cpp_Engine.ysl2 @@ -17,6 +17,7 @@ tstylesheet { #include "foundation_pEp_jniadapter_«@name».h" #include "throw_pEp_exception.hh" #include "jniutils.hh" + #include using pEp::Adapter::session; using namespace pEp::JNIAdapter; @@ -62,7 +63,20 @@ tstylesheet { apply "parm[creates|returns]", mode=out; || - PEP_STATUS status = ::«@name»(session()`apply "parm", mode=call`); + || + choose { + when "@cached = 'true'" { + || + pEpLog("cached passphrase"); + PEP_STATUS status = cache.api(::«@name»,session()`apply "parm", mode=call`); + || + } otherwise { + || + PEP_STATUS status = ::«@name»(session()`apply "parm", mode=call`); + || + } + } + || if ((status > PEP_STATUS_OK && status < PEP_UNENCRYPTED) |`> |` status < PEP_STATUS_OK |`> |` status >= PEP_TRUSTWORD_NOT_FOUND) { @@ -237,6 +251,8 @@ tstylesheet { | bool _«$name» = (bool) «$name»; when "$type='int'" | int _«$name» = (int) «$name»; + when "$type='string'" + | const char *_«$name» = to_string(env, «$name»); otherwise | √$type *_«$name» = to_«$type»(env, «$name»); } diff --git a/src/pEp.yml2 b/src/pEp.yml2 index e9d0309..603f4fe 100644 --- a/src/pEp.yml2 +++ b/src/pEp.yml2 @@ -85,32 +85,32 @@ namespace pEp { }; interface Engine { - method encrypt_message( + method cached=true encrypt_message( in message src, in stringlist extra, creates message dst, in EncFormat format, - Cconst PEP_encrypt_flags flags "0" + Cconst PEP_encrypt_flags flags "(PEP_encrypt_flags_t)0" ); - method encrypt_message_and_add_priv_key( + method cached=true encrypt_message_and_add_priv_key( in message src, creates message dst, in string fpr, Cconst PEP_enc_format encformat "PEP_enc_PEP", - Cconst PEP_encrypt_flags flags "0" + Cconst PEP_encrypt_flags flags "(PEP_encrypt_flags_t)0" ); - method encrypt_message_for_self( + method cached=true encrypt_message_for_self( in identity target, in message src, in stringlist extra, creates message dst, Cconst PEP_enc_format encformat "PEP_enc_PEP", - Cconst PEP_encrypt_flags flags "0" + Cconst PEP_encrypt_flags flags "(PEP_encrypt_flags_t)0" ); - method decrypt_message( + method cached=true decrypt_message( inout message src, creates message dst, inout stringlist keylist, @@ -150,7 +150,8 @@ namespace pEp { returns stringlist blacklist ); - method own_message_private_key_details( + // TODO: WTF is... + method cached=true own_message_private_key_details( in message msg, returns identity ident );