Esempio n. 1
0
        /// <summary>
        /// Initializes the <see cref="ProtectedType"/> with the <see cref="byte"/>[] and additional <see cref="SecureObject"/> instances to use to encrypt the data.
        /// </summary>
        /// <param name="value"> The <see cref="byte"/>[] value to protect. </param>
        /// <param name="encryptionObjects"> The additional <see cref="SecureObject"/> instances to apply to the encryption. </param>
        protected ProtectedType(byte[] value, params SecureObject[] encryptionObjects)
        {
            SecureObject[] currentEncryptionObj = new SecureObject[] { this };

            memoryEncryptor = new MemoryEncryptor(encryptionObjects == null ? currentEncryptionObj : encryptionObjects.Concat(currentEncryptionObj).ToArray());
            SetValue(value);
        }
    /// <summary>
    /// Initializes the <see cref="WalletTransactionSigner"/> by assigning all references.
    /// </summary>
    /// <param name="playerPrefPassword"> The <see cref="PlayerPrefPasswordDerivation"/> instance to assign to the <see cref="WalletDecryptor"/>. </param>
    /// <param name="dynamicDataCache"> The active <see cref="DynamicDataCache"/> to assign to the <see cref="WalletDecryptor"/>. </param>
    /// <param name="ethereumNetworkManager"> The active <see cref="EthereumNetworkManager"/>. </param>
    /// <param name="passwordEncryptor"> The <see cref="MemoryEncryptor"/> instance used to encrypt the password. </param>
    /// <param name="hopeWalletInfoManager"> The active <see cref="HopeWalletInfoManager"/>. </param>
    public WalletTransactionSigner(
        PlayerPrefPasswordDerivation playerPrefPassword,
        DynamicDataCache dynamicDataCache,
        EthereumNetworkManager ethereumNetworkManager,
        MemoryEncryptor passwordEncryptor,
        HopeWalletInfoManager hopeWalletInfoManager)
    {
        this.ethereumNetworkManager = ethereumNetworkManager;
        this.passwordEncryptor      = passwordEncryptor;
        this.hopeWalletInfoManager  = hopeWalletInfoManager;

        walletDecryptor = new WalletDecryptor(playerPrefPassword, dynamicDataCache);
    }
Esempio n. 3
0
    /// <summary>
    /// Initializes the UserWallet with the PlayerPrefPassword object.
    /// </summary>
    /// <param name="prefPassword"> The PlayerPrefPassword object used for managing the wallet's encryption password. </param>
    /// <param name="popupManager"> The active PopupManager. </param>
    /// <param name="ethereumNetworkManager"> The active EthereumNetworkManager. </param>
    /// <param name="dynamicDataCache"> The active ProtectedStringDataCache. </param>
    /// <param name="hopeWalletInfoManager"> The active HopeWalletInfoManager. </param>
    public HopeWallet(PlayerPrefPasswordDerivation prefPassword,
                      PopupManager popupManager,
                      EthereumNetworkManager ethereumNetworkManager,
                      DynamicDataCache dynamicDataCache,
                      HopeWalletInfoManager hopeWalletInfoManager)
    {
        this.popupManager     = popupManager;
        this.dynamicDataCache = dynamicDataCache;

        passwordEncryptor       = new MemoryEncryptor(this);
        walletCreator           = new WalletCreator(popupManager, prefPassword, dynamicDataCache, hopeWalletInfoManager);
        walletUnlocker          = new WalletUnlocker(popupManager, prefPassword, dynamicDataCache, hopeWalletInfoManager);
        walletTransactionSigner = new WalletTransactionSigner(prefPassword, dynamicDataCache, ethereumNetworkManager, passwordEncryptor, hopeWalletInfoManager);
    }