feat(principal)!: webcrypto ed25519 signer support for non-extractable agent keys#408
feat(principal)!: webcrypto ed25519 signer support for non-extractable agent keys#408NiKrause wants to merge 20 commits intostoracha:mainfrom
Conversation
hannahhoward
left a comment
There was a problem hiding this comment.
Wow. So this is pretty great. Also great ed25519 FINALLY landed in webcrypto.... I followed but it was taking so long I lost track several times :P I think I'm good to approve it as is.
Just to confirm, re: extractable / non-extractable -- this isn't ultimately a breaking change cause the API.Signer returned by generate didn't provider access to the secret() method so you'd need a type cast for that anyway.
Also, does it make sense to rebuild the old ED25519Signer on an actual webcrypto key instead of importing on sign? Is there a perf cost to importing every time we need to sign? (I assuming not a significant one cause the compute cost comes from actually signing as opposed to importing)
Anyway, would love some color on the answers to these questions, but I am otherwise good to merge, and thank you so much for this contribution.
…o-ed25519-agent-keys
|
Thank you @hannahhoward for looking into this! First of all, I enabled type checks on all branches Otherwise I answer inline:
There's a good example here in the upload-service, which accessed and again accesses .secret directly from signer (ed25519.secret) see: https://github.com/storacha/upload-service/pull/667/changes#diff-e0788dca19d1076e1e2a937c09bf86711f6d4763400b47a743d88849b16abbbf Libs and tests which required extractable keys now have to enforce it with
We have now the "old" ED25519Signer and a new UnextractableEd25519Signer mainly for compatibility reasons. We could remove the ED25519Signer completely but e.g. the toArchive() function is needed elsewhere in other imlementing projects signing UCANs. If we would use only one ED25519Signer, it would pretend it has access to .secret() and .encode(). Would be possible but seems worse design as of my research. edited 2026-02-18 13:58 CET |
Summary
@ucanto/principalEd25519 signer implementation to WebCryptogenerate()to non-extractable keys while preserving extractable mode when explicitly requested@noble/ed25519signing path from Ed25519 signerContext
This aligns with storacha/upload-service#658, which requires browser agent key generation to move to non-extractable WebCrypto Ed25519 keys.
Breaking Changes
generate({ extractable: true })Previously, keys were extractable by default. Now:
generate()produces non-extractable keysgenerate({ extractable: true }).secret()or.encode()access will need updatesRemark
Many changes are just prettier formatting changes
Co-Authored-By: NiKrause