trustbloc / agent-sdk

Apache License 2.0
8 stars 21 forks source link

Add JS binding to return bootstrap data from agent-js-worker #392

Open Moopli opened 2 years ago

Moopli commented 2 years ago

When the wasm agent initializes, it is either given a number of parameters containing bootstrap data, or it must onboard a new user. In either case, it will have a set of bootstrap parameters at the end, that it uses for initializing its vaults, keystores, etc. Since trustbloc/wallet needs the bootstrap data after wasm agent initialization, and since the wasm agent can change bootstrap data when onboarding, wallet currently needs to make a bootstrap GET call after agent initialization, despite the wasm agent having had all the up-to-date bootstrap data moments before.

The wasm agent should save its bootstrap data (once onboarding is complete, if onboarding is necessary), and should have a JS API function that returns the bootstrap data, so wallet can just fetch the bootstrap data from its own wasm agent instance instead of fetching the bootstrap data from the auth server.