You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For context, when initializing an s5 node in dart you have to run two main functions:
await s5.recoverIdentityFromSeedPhrase(seed);
await s5.registerOnNewStorageService(nodeURL);
The first uses the seed to "log in" by fetching the reg entry associated with the account info, the second signs up on the node of choice, without the second one there's no way to make sure you're using the node you want to.
So my proposal, there should be a function like ensureRegisteredOnStorageService that does the same thing as registerOnNewStorageService but checks to see if it has already registered first. This is not a difficult thing to work around, but it is a waste of developers time to have to write logic around this for every app they want to build quickly. Below is an example of how I did my checks in s5_deploy and vup_chat.
List<String>? urls;
// then check if already registeredif ((s5!.api asS5NodeAPIWithIdentity).accounts.isNotEmpty) {
Map<dynamic, dynamic> data =
(s5!.api asS5NodeAPIWithIdentity).accounts;
finalMap<String, dynamic> accounts = (data['accounts'] asMap).map(
(key, value) =>MapEntry(key asString, value),
);
urls =
accounts.values.map((account) => account['url'] asString).toList();
// And if the nodeURL isn't on the seed already, authenticate on that server
}
if (urls ==null||!urls.contains(nodeURL)) {
logger.d("Registering @ $nodeURL");
await s5!.registerOnNewStorageService(
nodeURL,
);
}
The text was updated successfully, but these errors were encountered:
For context, when initializing an s5 node in dart you have to run two main functions:
await s5.recoverIdentityFromSeedPhrase(seed);
await s5.registerOnNewStorageService(nodeURL);
The first uses the seed to "log in" by fetching the reg entry associated with the account info, the second signs up on the node of choice, without the second one there's no way to make sure you're using the node you want to.
So my proposal, there should be a function like
ensureRegisteredOnStorageService
that does the same thing asregisterOnNewStorageService
but checks to see if it has already registered first. This is not a difficult thing to work around, but it is a waste of developers time to have to write logic around this for every app they want to build quickly. Below is an example of how I did my checks ins5_deploy
andvup_chat
.The text was updated successfully, but these errors were encountered: