We have so far been unable to expose UncheckedProposal::extract_err_req and process_err_res across the FFI boundary because ReplyableError encapsulates internal variants that don't make it across the boundary. Because the internals of the type does not completely convert across the boundary, it cannot be returned back into rust for use in extract_err_req, even though extract_err_req only relies on impl JsonError to extract the error request.
see the issue LtbLightning/payjoin-ffi#59 for details. In summary, we may not want to expose JsonError as a public trait because it would allow users to return arbitrary JSON, and leaked data through JSON can be a security vulnerability, e.g. if a receiver returned some internal error message about their wallet state.
The JsonError implementation only maps the error to an error code with a template message. With the exception of the UnknownVersion error, which returns the supported versions, the encapsulated variant tuple contents are not serialized to JSON.
We must figure out some way to cross the foreign language barrier both ways to return these errors to senders for correct operation of the protocol.
We have so far been unable to expose
UncheckedProposal::extract_err_reqandprocess_err_resacross the FFI boundary becauseReplyableErrorencapsulates internal variants that don't make it across the boundary. Because the internals of the type does not completely convert across the boundary, it cannot be returned back into rust for use inextract_err_req, even thoughextract_err_reqonly relies onimpl JsonErrorto extract the error request.see the issue LtbLightning/payjoin-ffi#59 for details. In summary, we may not want to expose
JsonErroras a public trait because it would allow users to return arbitrary JSON, and leaked data through JSON can be a security vulnerability, e.g. if a receiver returned some internal error message about their wallet state.The JsonError implementation only maps the error to an error code with a template message. With the exception of the UnknownVersion error, which returns the supported versions, the encapsulated variant tuple contents are not serialized to JSON.
We must figure out some way to cross the foreign language barrier both ways to return these errors to senders for correct operation of the protocol.