public static async Task <Near> ConnectAsync(dynamic config) { // Try to find extra key in `KeyPath` if provided. if (config.KeyPath == null) { return(new Near(config)); } try { var accountKeyFile = await UnencryptedFileSystemKeyStore.ReadKeyFile(config.keyPath); if (accountKeyFile[0] != null) { // TODO: Only load key if network ID matches var keyPair = accountKeyFile[1]; var keyPathStore = new InMemoryKeyStore(); await keyPathStore.SetKeyAsync(config.NetworkId, accountKeyFile[0], keyPair); if (config.MasterAccount == null) { config.MasterAccount = accountKeyFile[0]; } config.KeyStore = new MergeKeyStore(new KeyStore[] { config.KeyStore, keyPathStore }); } } catch (Exception error) { Console.WriteLine($"Failed to load master account key from {config.KeyPath}: {error}"); } return(new Near(config)); }
public void ClassInit() { _keyStore = new UnencryptedFileSystemKeyStore(_keystorePath); }