Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

Improve signer secret import #17

Open
vasco-santos opened this issue Sep 7, 2023 · 0 comments
Open

Improve signer secret import #17

vasco-santos opened this issue Sep 7, 2023 · 0 comments

Comments

@vasco-santos
Copy link
Contributor

Context: #15 (comment)

I think we should embrace the composed principals exposed by ucanto instead of assuming which key types are at play. Specifically we have SignerImporter interface that import Signer from '@ucanto/principal' implements.

That is to say I think it would make a lot more sense if we wrote JSON.serialize(signer.toArchive()) into secrets and then read loaded it with Signer.from(JSON.parse(secret)).

Also note that this would remove need for signer.withDID(did) dance as long as what we stored in secrets is ed25519.parse('...').withDID(did)

P.S. Only reason toArchive does not return bytes or a string today is because in browsers we won't be able to serialize non-extractible keys, yet we could store object containing them into indexedDB.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant