public SimpleRpcClient(IUserOutput userOutput, IPasswordRegistry passwordRegistry, X509Certificate2 certificate, ILogger logger, SigningContext signingContextProvider) { _logger = logger; _certificate = certificate; var fileSystem = new FileSystem(); var consolePasswordReader = new ConsolePasswordReader(userOutput, new ConsoleUserInput()); var passwordManager = new PasswordManager(consolePasswordReader, passwordRegistry); var cryptoContext = new FfiWrapper(); var hashProvider = new HashProvider(HashingAlgorithm.GetAlgorithmMetadata("keccak-256")); var peerSettings = Substitute.For <IPeerSettings>(); peerSettings.NetworkType.Returns(signingContextProvider.NetworkType); var localKeyStore = new LocalKeyStore(passwordManager, cryptoContext, fileSystem, hashProvider, _logger); var keyRegistry = new KeyRegistry(); var keySigner = new KeySigner(localKeyStore, cryptoContext, keyRegistry); var memoryCacheOptions = new MemoryCacheOptions(); var memoryCache = new MemoryCache(memoryCacheOptions); var changeTokenProvider = new TtlChangeTokenProvider(10000); var messageCorrelationManager = new RpcMessageCorrelationManager(memoryCache, _logger, changeTokenProvider); var peerIdValidator = new PeerIdValidator(cryptoContext); var nodeRpcClientChannelFactory = new RpcClientChannelFactory(keySigner, messageCorrelationManager, peerIdValidator, peerSettings); var eventLoopGroupFactoryConfiguration = new EventLoopGroupFactoryConfiguration { TcpClientHandlerWorkerThreads = 4 }; var tcpClientEventLoopGroupFactory = new TcpClientEventLoopGroupFactory(eventLoopGroupFactoryConfiguration); var handlers = new List <IRpcResponseObserver> { new BroadcastRawTransactionResponseObserver(_logger), new GetVersionResponseObserver(_logger) }; _rpcClientFactory = new RpcClientFactory(nodeRpcClientChannelFactory, tcpClientEventLoopGroupFactory, handlers); //PeerId for RPC/TCP is currently redundant. var publicKey = keyRegistry.GetItemFromRegistry(KeyRegistryTypes.DefaultKey).GetPublicKey().Bytes; _senderPeerId = publicKey.BuildPeerIdFromPublicKey(IPAddress.Any, 1026); }
/// <summary> /// Create a SubKeyRegistry. /// </summary> /// <param name="master">The master KeyRegistry to stay in sync with.</param> public SubKeyRegistry(KeyRegistry master) { masterRegistry = master; //GetMethodFunction = getMethodFunc; //GetMenuFunction = getMenuFunc; master.ShortcutRegistered += Master_ShortcutRegistered; master.ShortcutUnregistered += Master_ShortcutUnregistered; RegisterExistingShortcuts(); }
public KeySignerIntegrationTests(ITestOutputHelper output) : base(output) { var logger = Substitute.For <ILogger>(); var passwordManager = Substitute.For <IPasswordManager>(); var cryptoContext = new FfiWrapper(); var peerSettings = Substitute.For <IPeerSettings>(); peerSettings.NetworkType.Returns(NetworkType.Devnet); var hashProvider = new HashProvider(HashingAlgorithm.GetAlgorithmMetadata("blake2b-256")); var keystore = new LocalKeyStore(passwordManager, cryptoContext, FileSystem, hashProvider, peerSettings, logger); var keyRegistry = new KeyRegistry(); _keySigner = new KeySigner(keystore, cryptoContext, keyRegistry); }
private void Registry_Click(object sender, RoutedEventArgs e) { if (!Configurations.Get.Association) { var reg = new AssociationWindow(); if (reg.ShowDialog() == true) { var result = new KeyRegistry("r"); Configurations.Get.Association = result.IsRegistry; } } else { var reg = new UnAssociationWindow(); if (reg.ShowDialog() == true) { var result = new KeyRegistry("u"); Configurations.Get.Association = result.IsRegistry; } } ButtonsPanel.GetHomePopup.IsOpen = false; }
public void Init() { this.Setup(TestContext.CurrentContext); var logger = Substitute.For <ILogger>(); var passwordManager = Substitute.For <IPasswordManager>(); var cryptoContext = new FfiWrapper(); var peerSettings = Substitute.For <IPeerSettings>(); peerSettings.NetworkType.Returns(NetworkType.Devnet); var hashProvider = new HashProvider(HashingAlgorithm.GetAlgorithmMetadata("keccak-256")); var keystore = new LocalKeyStore(passwordManager, cryptoContext, FileSystem, hashProvider, logger); var keyRegistry = new KeyRegistry(); _keySigner = new KeySigner(keystore, cryptoContext, keyRegistry); }
public KeyRegistryTests() { _keyRegistry = new KeyRegistry(); }
void Aplication_StartUp(object sender, StartupEventArgs e) { var prc = Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName); if (prc.Length > 1) { try { if (e.Args.Length >= 1) { var client = new CleverClient(e.Args[0]); client.StartClient(); } this.Shutdown(); } catch (Exception ex) { var message = new MessageWindow(ex.Message); message.ShowDialog(); this.Shutdown(); } } else { try { var server = new CleverServer(); server.Start(); SplashScreen = new SplashScreen("Resources/splashscreen_nover.png"); SplashScreen.Show(false); Configurations.Install(); GUILanguage.Install(); BpColors.Install(); Errors = localizator.ReadErrors(); IntellisenseObjects = new ReadXml().Read(); MainWindow main = new MainWindow(); main.Show(); main.UpdateGridSize(); //new ValidData().GetData(); if (e.Args.Length > 0) { MainWindowVM.FileNew(e.Args[0], false); } if (!Configurations.Get.Association && !Configurations.Get.Association_NotShow) { var reg = new FirstAssociationWindow(); if (reg.ShowDialog() == true) { var result = new KeyRegistry("r"); Configurations.Get.Association = result.IsRegistry; } } } catch (Exception ex) { var message = new MessageWindow(ex.Message); message.ShowDialog(); this.Shutdown(); } } }
public void Init() { _keyRegistry = new KeyRegistry(); }