Allow working with a non-finalizing Pkcs11
#290
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi folks,
There is much interest in a Pkcs11 that does not finalize the underlying implementation and I thought I'll try out one idea I had: splitting the
Pkcs11
into an owning and ref structs (similarly to how Rust does withString
andstr
). I've made thePkcs11
finalize itself and thePkcs11Impl
just work on what's passed in. This way, folks that manage the lifecycle themselves can construct a new instance viaPkcs11Impl::new_unchecked
which should resolve #208.I've also dropped inner Arc from
Pkcs11
(so that the concurrency is now managed by the client outside of Pkcs11) and madeSession
own a reference to the client. I'd further renamePkcs11Impl
into something likePkcs11Ref
but I want to keep the diff as small as possible, and in case you don't like it it's not worth the refactor.See what you think about it @hug-dev and @Jakuje.
The alternative posted on Slack by @testingapisname is adding additional finalization flag: testingapisname@6a4e58d