This is a set of tools that can be used to simplify the development of smart contract applications. Currently the tools included can be used for data encryption and string generation.
Encryption providers can be created through a factory, allowing you to adhere to SOLID guidelines and test your implementation more easily. Begin by adding the factory to your container.
services.AddSingleton<ICipherFactory,AesCipherFactory>();varcustomerName="Benjamin Swift";CbcResultcustomerNameEncryptionResult;try{usingvarcbc=_cipherFactory.CreateCbcProvider();customerNameEncryptionResult=cbc.Encrypt(customerName);}catch(CryptographicExceptione){}catch(ArgumentExceptione){}// persist cipher to contract// give user control of key and IVstringcustomerName;try{usingvarcbc=_cipherFactory.CreateCbcProvider();customerName=cbc.Decrypt(customerNameCipher,key,iv);}catch(CryptographicExceptione){}catch(ArgumentExceptione){}vargenerator=newUrlFriendlyStringGenerator();varvalue=generator.CreateUniqueString(24);