typage icon indicating copy to clipboard operation
typage copied to clipboard

Usage of Recipient and Identity interfaces

Open Sanket2211 opened this issue 11 months ago • 2 comments

Hi. Apologies if this is not the right place to ask but I have some questions on how to really make use of the provided interfaces since I am a bit new to typescript. So, I have been using age along with a plugin for the wrap and unwrap methods for custom encryption written in Go and it works fine. Now I want to make it usable on a browser and for that I looked into typage. From what it I have seen, in order to use the plugin with typage, I would have to modify the Go code to expose the wrap/unwrap APIs to JS using syscall/js, compile it to wasm, then create a typescript project to implement the Recipient/Identifier interfaces and there call the wrap/unwrap APIs through the wasm file, compile the typescript project to JS and then use it along with the typage.js file to run it on a browser. Is my understanding correct or am I wrong on how these interfaces are to be used?

Sanket2211 avatar Jan 29 '25 14:01 Sanket2211

That sounds directionally right, yeah.

Note that the interfaces were added in fc58f5b1f2300a7c33fdfb0ead29e9d27de539f5, which is not yet part of a npm release, so you'll need to use a git dependency if you use npm. If you use npm, then you'll probably want to bundle everything using esbuild (which will also take care of turning TS into JS for you).

Alternatively you can just use a <script> tag with the typage.js file built by GitHub Actions at main, and separately load the wasm file and your glue Javascript.

Let me know if it works out! It's useful to get feedback. (Also, if you feel like sharing more about what you're building, I'd be curious, but no pressure.)

FiloSottile avatar Jan 29 '25 15:01 FiloSottile

Thanks for very much for your help. Will be working on implementing this.

Sanket2211 avatar Jan 30 '25 14:01 Sanket2211

(Closing as it sounds like there are no unresolved issues, but still open to feedback!)

FiloSottile avatar Jun 15 '25 20:06 FiloSottile