Comments (4)
See the plugin package as exposed in https://pkg.go.dev/filippo.io/age/[email protected].
from age.
@FiloSottile the link appears to be broken
I am trying to use age programmatically and I have AGE-PLUGIN-...
identity
from age.
@ngortheone the plugin package is available on main by now, since last autumn I believe. But not tagged yet. I'm using it in https://github.com/quite/age-plugin-tkey
from age.
@FiloSottile I have actually started working on plage
which would be a "plugin for age" Go library, solving this issue. But I'm not too happy with my current design, especially for the API around the bidirectional Phase 2 parts.
I'd love to discuss designs options further, tho.
Phase 1 being unidirectional, it's easy to provide a library with an API for it.
My current design:
-
Users (plugin creators) can instantiate a
plugin
, by providing itsname
and 2 functions as input: anewRec func() RecipientV1
and anewId func() IdentityV1
, notice how I currently didn't decide to use theplugin.Recipient
type here since it would require the user of the plugin library to specify their ownClientUI
and all, but these seemed more of a concern for theage
implementation calling the plugin rather than a concern that all plugin creators should be caring about. SoRecipientV1
andIdentityV1
are currently interfaces of the form:type RecipientV1 interface { age.Recipient SetRecipient([]byte) error }
(which is arguably not the best kind of Go API, but feels like the easiest way of letting plugin creators define their own types and then passing them to the
plage
plugin library to handle.)The idea of having a
plugin
object is that it can hold the state, and the details about the plugin.This has the advantage of meaning plugin creators mostly just need to create a
Wrap
and aUnwrap
function on their very own recipient and identity types, and aSet([]byte)
function without having to care about formatting, stanzas, bech32, etc. -
Users can also play with the
stdin
,stdout
andstderr
pipes (mostly in order to enable easy testing of plugins) used by aplugin
after having instantiated one. -
Users can then
p.RunPhase1()
on their newly instantiatedp plugin
, which will parse and use the required (state machine) flag for an age-plugin, using the phase 1 state machine to populate its internal state. This is easy because it's being driven byage
and is unidirectional. So in theory no need for callbacks or user interactions in this step. -
Now comes the tricky bits: Phase 2 is driven by the plugin and is bi-directional. One one side, I could just provide all the required bits like "CommandReader", "CommandWriter" structs, "NewCommand" functions for the various functions supported by the
age-plugin
spec, and expect the plugin creator to handle the entire thing themselves and basically let the implementation of most of the state machine for Phase 2 to users... But this sounds painful to use.On the other hand, if I provide a
RunPhase2
function, suddenly all the possible user interactions in that phase become painful and the current "best solution" I could think of would be to provide callbacks to the plugin creators that could be run in certain message types, but this feels brittle at best.
But this might be because I'm not tying the callbacks properly to the rights things. Maybe just having a way of tying callbacks to identity and recipients and filekeys would be enough, but it does feel not too comfy to use neither.So I'd love to hear your opinion on how best to support plugin creators in Phase 2 without delegating all of the work to them.
I guess another open question would be key-generation, should I let plugin creators handle that or should the NewPlugin
also expect a GenerateIdentity() IdentityV1
function and parse the --generate-key
flag or something like that. Notice the current plugin specs just says:
It is expected that the same plugin binary will be used (potentially with other argument flags) for administrative tasks like generating keys.
so I'm hesitant to provide a "canonical" way of doing key gen, but it does feel like a desirable feature of a plugin library. WDYT?
Finally, re. the current age/plugin
package, I think it'd be great if you could also expose the StanzaReader
that is in internal/format/format.go
since it is required to parse commands and messages that age
expects.
Do you have a strong reason not to expose it currently?
from age.
Related Issues (20)
- Age terminates too soon on MacOS HOT 5
- Can this method be used to encrypt movie files? HOT 1
- report unexpected HOT 1
- age: error: failed to wrap key for recipient #0: test plugin: write |1: broken pipe HOT 16
- Plugin receives only one identity or recipient when there are multiple HOT 1
- failed to decrypt and authenticate payload chunk HOT 1
- Documentation bug in /README.md #encrypting-to-a-github-user HOT 2
- Support `sk-ssh` keys HOT 2
- brew install: not a tagged release HOT 1
- Specified SSH key is not eligible for claiming. Only RSA and Ed25519 keys are supported for proof generation. HOT 9
- Couldn't decrypt with that SSH key, please choose another one. HOT 1
- Couldn't decrypt with that SSH key, please choose another one. HOT 1
- Unable to claim the reward of 5000 token FLT HOT 1
- Unsupported SSH key type: ecdsa-sha2-nistp256 HOT 2
- Decryption does not create a file when data is empty HOT 1
- ssh connection to Github HOT 1
- I am the winner of the airdrop HOT 2
- unable to decrypt a proof with ssh key HOT 1
- Choco and scoop were unable to install age in windows
- Management of `Harvest Now, Decrypt Later` strategy and Post Quantum Safe Cryptography HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from age.