-
-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plugins API #23
Comments
Thank you for opening this! There's definitely space to add an extensibility interface to typage. At first look, a Plugin interface feels like one abstraction too many: the plugin protocol is a way to extend the CLI (or other applications) with code that lives in other binaries. When the code is available as a Go library, it can just be exposed as a Recipient and/or Identity implementation. (Note how even a plugin client is then exposed as Recipient/Identity in the Go library, the core age Go library has no concept of plugins.) Couldn't we just define equivalent Recipient and Identity TypeScript interfaces, and then accept them from addIdentity and addRecipient? |
@FiloSottile Yeah that sounds like it would be simpler and more in line with the Go lib. Iirc I went for the rather complex interface because I wanted to pass the recipient/identity as a string or didn't want to change the function signature of |
Yeah it would make sense to expose the equivalents of the https://pkg.go.dev/filippo.io/age/plugin Parse and Encode functions. |
In olastor/age-plugin-fido2-hmac#20 I created the PoC mentioned in #16 and while doing that I added a simple plugin API to a fork of typage (see olastor@156a9b1). I am wondering if there could be an official plugin API in this project. I tried to create a simple implementation that is close to FiloSottile/age#580 .
Every plugin would need to implement the following data structure:
For the
Encrypter
/Decrypter
classes, you'd then need to call.registerPlugin(plugin)
. There'd also be a newaddIdentity()
method in the encrypter that useshandleIdentityAsRecipient
.There are probably many ways this API could be implemented and the code I created in the fork is still a bit "sketched", lacking validations, tests etc. If a modified version of this would be useful for having in the main package, I could look into polishing it and creating a PR, though. But maybe also a totally different way of doing it could be considered.
The text was updated successfully, but these errors were encountered: