musakui / fedi

tools for the fediverse
MIT License
5 stars 1 forks source link

Provide Class for HTTP Signature utilities that require an Actor Key #3

Closed jojobii-arks closed 1 year ago

jojobii-arks commented 1 year ago

Issue

Notes

randName commented 1 year ago

ah, it's a code style that helps with treeshaking (especially for singletons). But I think it doesn't help much with the current code and wrapping them up in a class makes sense.

(evidently my use case was too focused on single user instances and completely forgot that normal servers need to sign for different users 😅)

randName commented 1 year ago

The signer info is now encapsulated in the Signer class. in the future if there are other runtimes with different signing utilities the CoreSigner class can be extended.

import { sendRequest, Signer } from '...'
const res = await sendRequest(req, new Signer(keyId, key))