Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Registration of Wallet and Storage classes other than Indy in Agent constructor #1235

Closed
genaris opened this issue Jan 23, 2023 · 4 comments
Closed

Comments

@genaris
Copy link
Contributor

genaris commented Jan 23, 2023

Currently, Agent class provides a way of registering Wallet and StorageService instances not based on Indy: this can be achieved by creating a DependencyManager before Agent constructor and register there the one we want. Something like:

    const dependencyManager = new DependencyManager()
    dependencyManager.registerContextScoped(InjectionSymbols.Wallet, IndySdkWallet)
    dependencyManager.registerSingleton(InjectionSymbols.StorageService, IndySdkStorageService)
    senderAgent = new Agent(
      {
        ...
        modules: { indySdk: new IndySdkModule({ indySdk: agentDependencies.indy }) },
      },
      dependencyManager
    )

As it can be seen, this is not very evident, so now we are working on extracting IndyWallet class from the core and make use of extension modules like @aries-framework/indy-sdk and @aries-framework/askar, we can simplify this procedure. For instance, we can leave the extension module to register the instances it needs and throw an error if another module has already done so.

@karimStekelenburg
Copy link
Contributor

I'm not too familiar with Askar, so forgive me for asking mildly uninformed questions...

How pluggable is the database backend from the perspective of AFJ? Looking at #1211 I can see that this works with both SQLite and Postgres, nice! But let's say I'd like to use MySQL or maybe even a NoSQL backend. Would that be possible without touching the Rust layer (e.g. providing some FFI callbacks)?

@genaris
Copy link
Contributor Author

genaris commented Jan 24, 2023

I'm not too familiar with Askar, so forgive me for asking mildly uninformed questions...

How pluggable is the database backend from the perspective of AFJ? Looking at #1211 I can see that this works with both SQLite and Postgres, nice! But let's say I'd like to use MySQL or maybe even a NoSQL backend. Would that be possible without touching the Rust layer (e.g. providing some FFI callbacks)?

My understanding is that currently Askar supports those two 'fixed' backends. I'm not completely sure but AFAIK there is not yet a plug-in interface to register external backends. But I do think that it would be very interesting to be able to plug a custom backend by using FFI callbacks (something like the one for the custom logger). Not sure how good it might be in terms of performance but it will be interesting to see it working.

Surely @andrewwhitehead and @blu3beri can give us good ideas about this possibility (and how feasible) it is.

@berendsliedrecht
Copy link
Contributor

Yes I believe Ariel is correct that they are fixed. However I doubt it would ever be possible with some FFI callbacks for the storing and such. I think if we really need that, Askar Storage and Askar Crypto have to become separate modules. Afterwards we can use Askar Crypto for the secure part of the secure storage and implement askar storage in pure js for the storage part of secure storage. Does that make sense?

@TimoGlastra
Copy link
Contributor

I think this is done, If I misunderstood please reopen @genaris

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

No branches or pull requests

4 participants