Core modules for SaaS crypto-currency virtual wallet
Перейти к файлу
Elad Iwanir ed76e71153 First version 2018-06-12 23:52:31 +03:00
Blockchain First version 2018-06-12 23:52:31 +03:00
Communication First version 2018-06-12 23:52:31 +03:00
Cryptography First version 2018-06-12 23:52:31 +03:00
Tests First version 2018-06-12 23:52:31 +03:00
WalletSample First version 2018-06-12 23:52:31 +03:00
.dockerignore First version 2018-06-12 23:52:31 +03:00
.gitignore First version 2018-06-12 23:52:31 +03:00
.travis.yml First version 2018-06-12 23:52:31 +03:00
CONTRIBUTING.md First version 2018-06-12 23:52:31 +03:00
CryptoWallet.sln First version 2018-06-12 23:52:31 +03:00
LICENSE Initial commit 2017-11-12 15:17:40 +02:00
README.md First version 2018-06-12 23:52:31 +03:00

README.md

Core modules for crypto-currency virtual wallet Build Status

The project consists of the infrastructure Core modules needed for implementing a SaaS cryptocurrency virtual wallet. This project has the following modules:

Secrets manager for the communication pipeline

For abstracting the needed secrets for the encryption/signing operations over the sent messages

A secure communication library over a queue

For inter micro-services communication

An Ethereum node client

For querying, signing and sending transactions and data over the public (and test) Ethereum network

This project also contains a Sample directory, to get you started.

Installation

The project contains three components:

  1. Blockchain - Blockchain (Currently only Ethereum implementation) related functionality
  2. Communication - Communication pipeline between micro-services.
  3. Cryptography - Provides functionality for saving the users secrets (private keys) and for securing the micro-services communication pipeline

To consume, clone the repository and add the projects as dependencies.

Usage examples:

Secrets Manager


// Create
var kv = new KeyVault(...);

var secretsMgmnt =
                new KeyVaultCryptoActions(
                    new CertificateInfo(encryptionKeyName, encryptionCertPassword),
                    new CertificateInfo(decryptionKeyName, decryptionCertPassword),
                    new CertificateInfo(signKeyName, signCertPassword),
                    new CertificateInfo(verifyKeyName, verifyCertPassword),
                    kv,
                    kv);

// Initialize
await secretsMgmnt.InitializeAsync();

// Call methods
var rawData = "Some text";
var encryptedData = secretsMgmnt.Encrypt(Communication.Utils.ToByteArray(rawData));
var originalData = secretsMgmnt.Decrypt(encryptedData);

Communication pipeline

// The following code enqueues a message to a queue named 'MyQueue'
var secretsMgmnt = new KeyVaultCryptoActions(...);
secretsMgmnt.InitializeAsync().Wait();

var queueClient = new CloudQueueClientWrapper(ConfigurationManager.AppSettings["AzureStorageConnectionString"]);
// Create
var securedComm = new AzureQueue("MyQueue", queueClient, secretsMgmnt, true);
// Init
await securedComm.InitializeAsync();

// Enqueue messages
await securedComm.EnqueueAsync(Communication.Utils.ToByteArray("A message"));

 securedComm.DequeueAsync(
   msg =>
   {
      Console.WriteLine("Decrypted and Verified message is" : + msg);
   });
  

Ethereum node client

// Create the instance of the Sql connector (which holds the users' private keys)
var sqlDb = new SqlConnector(...);
// Create the instance
var ethereumNodeClient = new EthereumAccount(sqlDb, ConfigurationManager.AppSettings["EthereumNodeUrl"]);

// Call methods
var result = await ethereumNodeClient.GetPublicAddressAsync("0x012345...");

Sample

Sample wallet app that uses the provided libraries can be found here

Known Issues

  • Getting 'access denied' when the script trys to set a new secret into KeyVault: wrong object id was entered. refer to the pre-requisites step and make sure you are using the correct object id.

Contributing

See instructions here.
By participating in this project, you agree to abide by the Microsoft Open Source Code of Conduct