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

Pass a Genesis string to agent config instead of a file path #219

Closed
icc-romeu opened this issue Mar 31, 2021 · 5 comments · Fixed by #273
Closed

Pass a Genesis string to agent config instead of a file path #219

icc-romeu opened this issue Mar 31, 2021 · 5 comments · Fixed by #273

Comments

@icc-romeu
Copy link

Currently the agent receives a genesisPath to a file. This is not convenient for dynamic configurations. It should be able to receive a string.

If a genesis file is included it is trivial to read it and pass the resulting string.

@jakubkoci
Copy link
Contributor

jakubkoci commented Mar 31, 2021

I'm afraid that indy-sdk requires path to file, according to createPoolLedgerConfig.

I don't know why or if it's really necessary 🤷‍♂️

@icc-romeu
Copy link
Author

I have done a trick for that, use the native part of the library -I work on react native- to create a "temporary" file to init the Indy library. I know this is a "hack" but it makes sense for me not to "force" the user to have a file when the library only needs the content.

I think this is an implementation detail of Libindy that should be hidden. But I admit it is a convenience issue, not a "must".

@TimoGlastra
Copy link
Contributor

I agree! I already allowed to pass a url in the mobile wallet. Problem is that storage depends on the environment. This means we need to add RN specific + nodejs specific code and libraries to the framework which is not that ideal...

@karimStekelenburg
Copy link
Contributor

Does anyone know if there are plans to change this in Indy? If not a possible solutions is to abstract it away from the framework. For example define something like a GenesisProvider interface where its implementations are responsible for handling the platform specific storage stuff.

That being said, it's not a sexy solution either, so it might be worth opening an issue on the Indy side of things, since we all don't seem to understand the reasoning behind it...

@icc-romeu
Copy link
Author

@karimStekelenburg it's easy to solve in javascript/typescript. I used a couple of convenience methods -copied from @TimoGlastra who wrote them here- and then you can pass a path to a file, a url to download the file or the string itself.

Maybe we could include this in this framework? 🤷🏻‍♂️ Hence we will hide this implementation detail to final users

          let genesisPath = props.agentConfig.genesisPath;
          if (props.agentConfig.genesisUrl) {
            const genesis = await downloadGenesis(props.agentConfig.genesisUrl);
            genesisPath = await storeGenesis(genesis, 'genesis.txn');
          } else if (props.agentConfig.genesisString) {
            genesisPath = await storeGenesis(
              props.agentConfig.genesisString,
              'genesis.txn',
            );
          }

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

Successfully merging a pull request may close this issue.

4 participants