From 8573c673b6d53bbd532132546d4ee78948815b2d Mon Sep 17 00:00:00 2001 From: enisn Date: Tue, 11 May 2021 10:34:22 +0300 Subject: [PATCH 1/2] Docs - Improve Readability of String-Encryption.md --- docs/en/String-Encryption.md | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/docs/en/String-Encryption.md b/docs/en/String-Encryption.md index 81bb4f119a..ed7f5d1a3d 100644 --- a/docs/en/String-Encryption.md +++ b/docs/en/String-Encryption.md @@ -43,9 +43,9 @@ All encryption operations are included in `IStringEncryptionService`. You can in ```csharp public class MyService : DomainService { - public IStringEncryptionService StringEncryptionService { get; } + protected IStringEncryptionService StringEncryptionService { get; } - public MyAppService(IStringEncryptionService stringEncryptionService) + public MyService(IStringEncryptionService stringEncryptionService) { StringEncryptionService = stringEncryptionService; } @@ -69,8 +69,11 @@ All encryption operations are included in `IStringEncryptionService`. You can in `IStringEncryptionService` methods has **passPharase** parameter with default value and it uses default PassPhrase when you don't pass passPhrase parameter. ```csharp -StringEncryptionService.Encrypt(value); // Default Pass Phrase -StringEncryptionService.Encrypt(value, "MyCustomPassPhrase"); // Custom Pass Phrase +// Default Pass Phrase +StringEncryptionService.Encrypt(value); + +// Custom Pass Phrase +StringEncryptionService.Encrypt(value, "MyCustomPassPhrase"); // Encrypt & Decrypt have same parameters. StringEncryptionService.Decrypt(value, "MyCustomPassPhrase"); @@ -81,8 +84,11 @@ StringEncryptionService.Decrypt(value, "MyCustomPassPhrase"); `IStringEncryptionService` methods has **salt** parameter with default value and it uses default Salt when you don't pass the parameter. ```csharp -StringEncryptionService.Encrypt(value); // Default Salt -StringEncryptionService.Encrypt(value, salt: Encoding.UTF8.GetBytes("MyCustomSalt")); // Custom Salt +// Default Salt +StringEncryptionService.Encrypt(value); + +// Custom Salt +StringEncryptionService.Encrypt(value, salt: Encoding.UTF8.GetBytes("MyCustomSalt")); // Encrypt & Decrypt have same parameters. StringEncryptionService.Decrypt(value, salt: Encoding.UTF8.GetBytes("MyCustomSalt")); From 531d93b3d9324654fad78be12d0a98e112b2d41e Mon Sep 17 00:00:00 2001 From: enisn Date: Tue, 11 May 2021 18:07:38 +0300 Subject: [PATCH 2/2] Docs - Add variables to String-Encrytion code samples --- docs/en/String-Encryption.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/en/String-Encryption.md b/docs/en/String-Encryption.md index ed7f5d1a3d..867190365d 100644 --- a/docs/en/String-Encryption.md +++ b/docs/en/String-Encryption.md @@ -70,13 +70,13 @@ All encryption operations are included in `IStringEncryptionService`. You can in ```csharp // Default Pass Phrase -StringEncryptionService.Encrypt(value); +var encryptedValue = StringEncryptionService.Encrypt(value); // Custom Pass Phrase -StringEncryptionService.Encrypt(value, "MyCustomPassPhrase"); +var encryptedValue = StringEncryptionService.Encrypt(value, "MyCustomPassPhrase"); // Encrypt & Decrypt have same parameters. -StringEncryptionService.Decrypt(value, "MyCustomPassPhrase"); +var decryptedValue = StringEncryptionService.Decrypt(value, "MyCustomPassPhrase"); ``` ### Using Custom Salt @@ -85,13 +85,13 @@ StringEncryptionService.Decrypt(value, "MyCustomPassPhrase"); ```csharp // Default Salt -StringEncryptionService.Encrypt(value); +var encryptedValue = StringEncryptionService.Encrypt(value); // Custom Salt -StringEncryptionService.Encrypt(value, salt: Encoding.UTF8.GetBytes("MyCustomSalt")); +var encryptedValue = StringEncryptionService.Encrypt(value, salt: Encoding.UTF8.GetBytes("MyCustomSalt")); // Encrypt & Decrypt have same parameters. -StringEncryptionService.Decrypt(value, salt: Encoding.UTF8.GetBytes("MyCustomSalt")); +var decryptedValue = StringEncryptionService.Decrypt(value, salt: Encoding.UTF8.GetBytes("MyCustomSalt")); ``` *** @@ -122,4 +122,4 @@ Configure(opts => - **Keysize:** This constant is used to determine the keysize of the encryption algorithm. - Default value: `256` + Default value: `256` \ No newline at end of file