Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Auth should be an EventTarget and emit events #341

Open
sgwilym opened this issue May 30, 2024 · 2 comments
Open

Auth should be an EventTarget and emit events #341

sgwilym opened this issue May 30, 2024 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers willow Issues with the willow branch.
Milestone

Comments

@sgwilym
Copy link
Contributor

sgwilym commented May 30, 2024

What's the problem you want solved?

There is no way to observe whether an Auth has added new keypairs or capabilities without being directly responsible for adding those keypairs or capabilities.

Is there a solution you'd like to recommend?

Auth should extend EventTarget and emit events for:

  • Identity keypairs being added
  • Share keypairs being added
  • Capabilities being added
@sgwilym sgwilym added enhancement New feature or request willow Issues with the willow branch. labels May 30, 2024
@sgwilym sgwilym added this to the Willow milestone May 30, 2024
@sgwilym sgwilym added the good first issue Good for newcomers label May 30, 2024
@Vicente015
Copy link

Vicente015 commented Mar 1, 2025

Hello, I would like to implement this, what do you think about the following structure?

Auth Events Reference

Name Description Payload
CAP_ADDED Cap added ReadCapPack | WriteCapPack
KEYPAIR_ADDED Keypair added { type: 'IDENTITY' | 'SHARE', keypair: ShareKeypairRaw | IdentityKeypairRaw }

More events to consider?:
Reading the code I came up with more events ideas, not sure if they are useful

Name Description Payload
CAP_CREATED Cap created ReadCapPack | WriteCapPack
CAP_DELEGATED Cap delegated ReadCapPack | WriteCapPack
KEYPAIR_CREATED Keypair created { type: 'IDENTITY' | 'SHARE', keypair: ShareKeypairRaw | IdentityKeypairRaw }
READY Auth is ready (encryptionKey resolved) Auth

@sgwilym
Copy link
Contributor Author

sgwilym commented Mar 2, 2025

Great! I like the DELEGATED, and READY events, they seem useful.

I feel like the CREATED vs ADDED events may be too fine-grained? What do you think? Did you find some use for these?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request good first issue Good for newcomers willow Issues with the willow branch.
Projects
Development

No branches or pull requests

2 participants