There is nothing in this model that indicates that this is the BullWallet Seed.
For those users who only have one seed, this wont be a problem. We just use that seed.
Looking at _pkg/wallet/repository/secure_storage.dart newSeed
Future<Err?> newSeed({
required Seed seed,
}) async {
try {
final fingerprintIndex = seed.getSeedStorageString();
final (fingerprintIndexes, err) = await _secureStorage.getValue(StorageKeys.seeds);
if (err != null) {
// no seeds exist make this the first
final jsn = jsonEncode({
'seeds': [fingerprintIndex],
});
final _ = await _secureStorage.saveValue(
key: StorageKeys.seeds,
value: jsn,
);
} else {
final fingerprintIdsJson = jsonDecode(fingerprintIndexes!)['seeds'] as List<dynamic>;
final List<String> fingerprints = [];
for (final fingerprint in fingerprintIdsJson) {
if (fingerprint == fingerprintIndex)
return Err('Seed Exists');
else
fingerprints.add(fingerprint as String);
}
fingerprints.add(fingerprintIndex);
final jsn = jsonEncode({
'seeds': [...fingerprints],
});
final _ = await _secureStorage.saveValue(
key: StorageKeys.seeds,
value: jsn,
);
}
// why are we also storing the seed with the index directly? easier to read? backup?
await _secureStorage.saveValue(
key: fingerprintIndex,
value: jsonEncode(seed),
);
return null;
}
I'm guessing seeds end up being stored in chronological order i.e. the first element is the Bull Wallet seed.
Main concerns:
Seeds in secure storage must not be deleted or overwritten!
Bull Wallet seed should be used for new default Secure/Instant Wallets. This could be challenging because the Seed model is as follows:
There is nothing in this model that indicates that this is the BullWallet Seed.
For those users who only have one seed, this wont be a problem. We just use that seed.
Looking at _pkg/wallet/repository/secure_storage.dart
newSeed
I'm guessing seeds end up being stored in chronological order i.e. the first element is the Bull Wallet seed.