<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: vchaindz</title>
    <description>The latest articles on DEV Community by vchaindz (@vchaindz).</description>
    <link>https://dev.to/vchaindz</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F398964%2F0ce53db5-94fe-49ad-b436-b27567830439.png</url>
      <title>DEV Community: vchaindz</title>
      <link>https://dev.to/vchaindz</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vchaindz"/>
    <language>en</language>
    <item>
      <title>REST API to Run PowerShell from a ASP.Net C# Webapp</title>
      <dc:creator>vchaindz</dc:creator>
      <pubDate>Wed, 01 Mar 2023 12:41:08 +0000</pubDate>
      <link>https://dev.to/vchaindz/rest-api-to-run-powershell-from-a-aspnet-c-webapp-4856</link>
      <guid>https://dev.to/vchaindz/rest-api-to-run-powershell-from-a-aspnet-c-webapp-4856</guid>
      <description>&lt;p&gt;Do you need to run PowerShell scripts from a web application?&lt;/p&gt;

&lt;p&gt;I asked myself the same and quickly realized that there are some really nice benefits to doing so.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;PowerShell is very flexible, easy to use, and has plenty of integrations built-in or available&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;REST APIs are the most popular way to integrate applications with web services. Having a REST endpoint to the outside would allow you to consume pre-defined PowerShell scripts from anywhere using a Browser, curl, or any other REST scripting or development language.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You can change the PowerShell script without changing and compiling c# source code&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;it could run as part of an existing Microsoft IIS server or as a Docker container&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;So I decided to develop a boilerplate that can be used to on Windows and Linux, as part of an IIS, standalone using IIS express or a Docker container.&lt;/p&gt;

&lt;p&gt;In case you know already everything about REST APIs, please skip the next 2 sections and jump to the overview.&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction to REST APIs
&lt;/h2&gt;

&lt;p&gt;REST stands for Representational State Transfer. It is an architectural style of web services that defines how web services interact with clients. A REST API is a web service that uses the REST architecture to provide an interface for applications to access web services.&lt;/p&gt;

&lt;p&gt;A REST API is a set of web services that allow applications to access data stored on a server. The data is usually in the form of JSON or XML.&lt;/p&gt;

&lt;p&gt;REST APIs are becoming increasingly popular because they are easy to use and can be used to access data from multiple sources.&lt;/p&gt;

&lt;p&gt;REST APIs allow developers to access data from web services and other sources in a uniform way. This makes it easier to develop applications that require data from multiple sources.&lt;/p&gt;

&lt;p&gt;REST APIs are also popular because they are secure and can be used for authentication. Authentication is the process of verifying the identity of a user or a client. REST APIs can be used to authenticate users and restrict access to data.&lt;/p&gt;

&lt;h2&gt;
  
  
  Benefits of Using a REST API to Run PowerShell
&lt;/h2&gt;

&lt;p&gt;Using a REST API to run PowerShell scripts has several benefits.&lt;/p&gt;

&lt;p&gt;First, it is easy to develop a web application using a REST API. The API provides a uniform way to access data, so it is easier to develop applications that require data from multiple sources.&lt;/p&gt;

&lt;p&gt;But it’s much harder to develop a whole application in .net. Here comes the PowerShell.&lt;/p&gt;

&lt;p&gt;Second, a REST API can be used to authenticate users and restrict access to data. This is important when running PowerShell scripts as they can be used to access sensitive data. It can also nicely be used to hide credentials and make the PowerShell script itself inaccessible from the outside.&lt;/p&gt;

&lt;p&gt;Finally, a REST API provides a convenient way to run PowerShell scripts. The API can be used to access data from multiple sources in a uniform way. This makes it easier to develop applications that require data from multiple sources.&lt;/p&gt;

&lt;h2&gt;
  
  
  Overview of Developing a WebApp with a REST API to Run PowerShell
&lt;/h2&gt;

&lt;p&gt;Developing a web application with a REST API to run PowerShell scripts is a straightforward process. First, the necessary components of the web application must be developed. This includes the C# web application that provides the REST API and the Powershell script.&lt;/p&gt;

&lt;p&gt;The components must be coded and integrated into a single web application. The web application can then be run on an IIS server or a Docker container.&lt;/p&gt;

&lt;h2&gt;
  
  
  C# WebApp component development
&lt;/h2&gt;

&lt;p&gt;The C# web application is the first component of the web application. The C# web application is responsible for providing the interface for the web application. It is also responsible for handling user input, authenticating users, and providing access to data.&lt;/p&gt;

&lt;p&gt;Let’s start with a new project — I use Visual Studio Community — ASP.NET Core Web API, so it can run also in a Docker container.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foxpr1xlf87mdyeox3u1j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foxpr1xlf87mdyeox3u1j.png" alt="Create New ASP.NET Core Web API" width="669" height="453"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the next step let’s check “Enable Docker” using the Linux OS and uncheck “Use controllers” to have the most simple Web App.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft3j1w9xk3d9rn78x71vs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft3j1w9xk3d9rn78x71vs.png" alt="Enable Docker support and uncheck Use controllers" width="698" height="427"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That produces already a good project structure and we can directly jump into the C# code:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8wcd6fxjwgf5pi6948i3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8wcd6fxjwgf5pi6948i3.png" alt="initial project structure" width="241" height="230"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As we want to use PowerShell commands out of the Web application, you need to install 2 packages to fit all needs (IIS and Docker). Therefore jump to the Package Manager Console and install the packages.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F98ncmxkv5sg1oqsdx1b6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F98ncmxkv5sg1oqsdx1b6.png" width="611" height="320"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;install-package System.Management.Automation
run install-package Microsoft.PowerShell.SDK
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  Program.cs — the Web application itself
&lt;/h3&gt;

&lt;p&gt;The Progam.cs file that comes with the new project contains a sample weather forecast that you can simply overwrite completely.&lt;/p&gt;

&lt;p&gt;Here comes the code that:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;listens to REST API calls on &lt;strong&gt;/pwsh&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;allows you to send 2 arguments (string) to the PowerShell script&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;reads the PowerShell script &lt;strong&gt;script.ps1&lt;/strong&gt; that resides inside of the project&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Runs the script.ps1 PowerShell script with the 2 arguments&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Returns an error or the PowerShell result&lt;/p&gt;

&lt;p&gt;using System.IO;&lt;br&gt;
using System.Management.Automation;&lt;/p&gt;

&lt;p&gt;var builder = WebApplication.CreateBuilder(args);&lt;/p&gt;

&lt;p&gt;// Add services to the container.&lt;/p&gt;

&lt;p&gt;var app = builder.Build();&lt;/p&gt;

&lt;p&gt;app.MapGet("/pwsh", (string arg1, string arg2) =&amp;gt;&lt;br&gt;
{&lt;br&gt;
string _filePath = Path.GetDirectoryName(System.AppDomain.CurrentDomain.BaseDirectory);&lt;br&gt;
// read file content&lt;br&gt;
string myScript = File.ReadAllText(_filePath + "/script.ps1");&lt;/p&gt;

&lt;p&gt;var result = PowerShell.Create().AddScript(myScript)&lt;br&gt;
                                 .AddParameter("arg1", arg1)&lt;br&gt;
                                 .AddParameter("arg2", arg2)&lt;br&gt;
                                 .Invoke();&lt;br&gt;
 if (result.Count &amp;gt; 0)&lt;br&gt;
 {&lt;br&gt;
  foreach (var PSObject in result)&lt;br&gt;
  {&lt;br&gt;
   return PSObject.ToString();&lt;/p&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;}&lt;br&gt;
 return "error occured";&lt;/p&gt;

&lt;p&gt;});&lt;/p&gt;

&lt;p&gt;app.Run();&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now you can create the PowerShell script as a new file in the project.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Hint: Of course, you can either use a script path outside of the project folder or overwrite the file later on using docker -v mapping.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;
  
  
  Powershell script development
&lt;/h2&gt;

&lt;p&gt;The second component of the web application is the Powershell script. The Powershell script is responsible for executing the PowerShell commands and returning data to the web application.&lt;/p&gt;

&lt;p&gt;The script should be developed in such a way that it is able to execute the necessary commands and return the data in a JSON format that can be processed by the web application.&lt;/p&gt;

&lt;p&gt;Simply create the script file named script.ps1 in the project folder.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1zw6s62fxxeun2myt9vg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1zw6s62fxxeun2myt9vg.png" width="269" height="265"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  script.ps1 — the PowerShell script
&lt;/h3&gt;

&lt;p&gt;In this example, we use a very simple PowerShell script that only consumes the 2 arguments and returns these as JSON.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;param(
       $arg1,
       $arg2
)

$message = "$arg1, $arg2" | convertto-json

return $message
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;That is already it and you can start testing the web application and the Powershell script that has been developed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5l0agzcwkd78cn2w9af5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5l0agzcwkd78cn2w9af5.png" width="485" height="147"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If all goes well it should look like that.&lt;/p&gt;

&lt;h2&gt;
  
  
  Run the Web application on an IIS server or a Docker container
&lt;/h2&gt;

&lt;p&gt;Once the web application has been coded and integrated with the REST API, the next step is to run the web application on an IIS server or a Docker container. This will allow the web application to be accessed by users from anywhere in the world.&lt;/p&gt;

&lt;p&gt;To build the Docker container you can use the Dockerfile created as part of the project.&lt;/p&gt;

&lt;p&gt;Simply clone your repository to a system where Docker is installed, copy the Dockerfile from the project folder to one level above and run:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker build -f Dockerfile -t rest2pwsh .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Now you can run the Docker container&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker run -it --rm -p 8080:80 rest2pwsh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;and test it as well with a browser.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In conclusion, using a REST API to run PowerShell scripts is an efficient and secure way to run PowerShell scripts from a web application. The REST API provides a uniform way to access data from multiple sources, which makes it easier to develop applications that require data from multiple sources. It also provides a secure way to run PowerShell scripts as it can be used to authenticate users and restrict access to data.&lt;/p&gt;

&lt;p&gt;The process of developing a web application with a REST API to run PowerShell scripts is straightforward. The necessary components of the web application need to be developed, coded, and integrated into a single web application. The web application can then be run on a IIS server or a Docker container.&lt;/p&gt;

&lt;p&gt;If you need to run PowerShell scripts from a web application, then using a REST API to run PowerShell is a great solution. With the right approach, you can unlock the benefits of a REST API to run PowerShell with a C# Webapp.&lt;/p&gt;

</description>
      <category>learning</category>
      <category>tools</category>
      <category>webdev</category>
      <category>gamedev</category>
    </item>
    <item>
      <title>CodeNotary free trusted timestamping service for Developer</title>
      <dc:creator>vchaindz</dc:creator>
      <pubDate>Sat, 30 Jan 2021 09:52:00 +0000</pubDate>
      <link>https://dev.to/vchaindz/codenotary-free-trusted-timestamping-service-for-developer-158f</link>
      <guid>https://dev.to/vchaindz/codenotary-free-trusted-timestamping-service-for-developer-158f</guid>
      <description>&lt;h1&gt;
  
  
  CodeNotary Trusted Timestamping Service
&lt;/h1&gt;

&lt;p&gt;Every build has a story to tell - Tamperproof provenance for your code and CI/CD pipeline&lt;/p&gt;

&lt;p&gt;Quickstart here: &lt;a href="https://timestamp.codenotary.com"&gt;Code Timestamp&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The combination of our free, lightning-fast and always-on timestamp service and the easy to use cli tool, gets you started in a minute.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WHSaGDPx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/2jcktzsi0tiv7t7oj556.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WHSaGDPx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/2jcktzsi0tiv7t7oj556.jpg" alt="immutable and lightning-fast"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  What means trusted timestamping
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/Trusted_timestamping"&gt;Trusted timestamping&lt;/a&gt; is the process of securely keeping track of the creation and modification time of a document. Security here means that no one—not even the owner of the document—should be able to change it once it has been recorded provided that the timestamper's integrity is never compromised.&lt;br&gt;
CodeNotary uses its immutable open source database &lt;a href="https://github.com/codenotary/immudb"&gt;immudb&lt;/a&gt; to provide this service that includes cryptographic verification and immutable data history.&lt;/p&gt;
&lt;h2&gt;
  
  
  Use cases
&lt;/h2&gt;

&lt;p&gt;This timestamping service provides full immutability for all data ever written and unique data checksum ever stored including its history. As a trust level comes with the timestamp, you can change your mind over time (unsupport, untrust) without touching the code or binary. As the complete trust and timestamping history is stored for any digital identity (SHA-256 checksum), you can easily create workflows and decision trees in your CI/CD recipes.&lt;/p&gt;

&lt;p&gt;There are plenty of different use cases:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add a trusted timestamp to code&lt;/li&gt;
&lt;li&gt;Add an immutable timestamp to electronic signatures&lt;/li&gt;
&lt;li&gt;Seal the data integrity and your trust level at a given point in time&lt;/li&gt;
&lt;li&gt;Prove the existence of elecronic data at a specific point in time&lt;/li&gt;
&lt;li&gt;CI/CD integration - notarize all outgoing assets, authenticate all incoming&lt;/li&gt;
&lt;li&gt;Store provenance for you own sources&lt;/li&gt;
&lt;li&gt;Unsupport deprecated versions of your software and run update checks bases on the latest timestamp&lt;/li&gt;
&lt;li&gt;Revoke trust (untrust) at any time without the need to touch your code or binaries&lt;/li&gt;
&lt;li&gt;Trust or remove trust for digital assets and act on the status (within your script or pipeline)&lt;/li&gt;
&lt;li&gt;Simply timestamp files and sources to doublecheck at any time in the future if these are still the same (backup/restore)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Simply request your API key and get started within a minute! This service is free forever and was built using Open Source!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Notarized assets information is stored in a tamperproof ledger with cryptographic verification backed by &lt;a href="https://codenotary.com/technologies/immudb/"&gt;immudb&lt;/a&gt;, the immutable database.&lt;/p&gt;
&lt;h3&gt;
  
  
  Obtain an API Key
&lt;/h3&gt;

&lt;p&gt;To provide access to our timestamping service a valid API Key is required. If you don't have one yet, simply signup here &lt;a href="https://timestamp.codenotary.com/"&gt;CodeNotary Timestamp&lt;/a&gt;&lt;br&gt;
This API Key is bound to your email address and it's required during vcn login.&lt;/p&gt;
&lt;h2&gt;
  
  
  Quick start
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Installer&lt;/strong&gt; In case you use Linux or macOS, the quickest start is our install script:
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;bash &amp;lt;&lt;span class="o"&gt;(&lt;/span&gt;curl https://getvcn.codenotary.com &lt;span class="nt"&gt;-L&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;You can also &lt;a href="https://github.com/vchain-us/vcn/releases/latest"&gt;download the latest release&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Login&lt;/strong&gt; to &lt;a href="https://timestamp.codenotary.com/"&gt;timestamp.codenotary.com&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;vcn login &lt;span class="nt"&gt;--lc-host&lt;/span&gt; timestamp.codenotary.com &lt;span class="c"&gt;# type in your API key when requested&lt;/span&gt;
&lt;span class="c"&gt;# or setting the API key&lt;/span&gt;
&lt;span class="nv"&gt;VCN_LC_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;lt;Your-API-Key vcn login &lt;span class="nt"&gt;--lc-host&lt;/span&gt; timestamp.codenotary.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Notarize existing digital objects&lt;/strong&gt; Once you have an account you can start notarizing digital assets to give them an identity.
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;vcn n &amp;lt;file|dir://directory|docker://dockerimage|git://gitdirectory&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Authenticate digital objects&lt;/strong&gt; You can use the command as a starting point.
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;vcn a &amp;lt;file|dir://directory|docker://dockerimage|git://gitdirectory&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;Tip&lt;/strong&gt;: the timestamping and verification calculates a SHA256, so larger files might take a bit longer depending on your system.&lt;/p&gt;

&lt;p&gt;For detailed &lt;strong&gt;command line usage&lt;/strong&gt;, just run &lt;code&gt;vcn help&lt;/code&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  Usage
&lt;/h2&gt;
&lt;h4&gt;
  
  
  Wildcard support and recursive notarization
&lt;/h4&gt;

&lt;p&gt;It's also possible to notarize assets using a wildcard pattern.&lt;/p&gt;

&lt;p&gt;With &lt;code&gt;--recursive&lt;/code&gt; flag the utility can recursively notarize inner directories.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;vcn n &lt;span class="s2"&gt;"*.md"&lt;/span&gt; &lt;span class="nt"&gt;--recursive&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Notarization
&lt;/h4&gt;

&lt;p&gt;Start with the &lt;code&gt;login&lt;/code&gt; command. &lt;code&gt;vcn&lt;/code&gt; will walk you through login and importing up your secret upon initial use.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;vcn login &lt;span class="nt"&gt;--lc-host&lt;/span&gt; timestamp.codenotary.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once your secret is set, you can notarize assets like in the following examples:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;vcn notarize &amp;lt;file&amp;gt;
vcn notarize &lt;span class="nb"&gt;dir&lt;/span&gt;://&amp;lt;directory&amp;gt;
vcn notarize docker://&amp;lt;imageId&amp;gt;
vcn notarize podman://&amp;lt;imageId&amp;gt;
vcn notarize git://&amp;lt;path_to_git_repo&amp;gt;
vcn notarize &lt;span class="nt"&gt;--hash&lt;/span&gt; &amp;lt;&lt;span class="nb"&gt;hash&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Change the asset's status:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;vcn unsupport &amp;lt;asset&amp;gt;
vcn untrust &amp;lt;asset&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Authentication
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;vcn authenticate &amp;lt;file&amp;gt;
vcn authenticate &lt;span class="nb"&gt;dir&lt;/span&gt;://&amp;lt;directory&amp;gt;
vcn authenticate docker://&amp;lt;imageId&amp;gt;
vcn authenticate podman://&amp;lt;imageId&amp;gt;
vcn authenticate git://&amp;lt;path_to_git_repo&amp;gt;
vcn authenticate &lt;span class="nt"&gt;--hash&lt;/span&gt; &amp;lt;&lt;span class="nb"&gt;hash&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To output results in &lt;code&gt;json&lt;/code&gt; or &lt;code&gt;yaml&lt;/code&gt; formats:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;vcn authenticate &lt;span class="nt"&gt;--output&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;json &amp;lt;asset&amp;gt;
vcn authenticate &lt;span class="nt"&gt;--output&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;yaml &amp;lt;asset&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Automated environments
&lt;/h4&gt;

&lt;p&gt;Simply set up your environment accordingly using the following commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;VCN_LC_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;Your-API-Key
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once done, you can use &lt;code&gt;vcn&lt;/code&gt; in your non-interactive environment using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;vcn login &lt;span class="nt"&gt;--lc-host&lt;/span&gt; timestamp.codenotary.com
vcn notarize &amp;lt;asset&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Other commands like &lt;code&gt;untrust&lt;/code&gt; and &lt;code&gt;unsupport&lt;/code&gt; will also work.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Examples
&lt;/h2&gt;

&lt;h4&gt;
  
  
  Authenticate a Docker image automatically prior to running it
&lt;/h4&gt;

&lt;p&gt;First, you’ll need to pull the image by using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker pull hello-world
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then use the below command to put in place an automatic safety check. It allows only verified images to run.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;vcn authenticate docker://hello-world &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; docker run hello-world
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If an image was not verified, it will not run and nothing will execute.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;This new and free forever service enables hundreds of use cases for developers and DevOps engineers. &lt;br&gt;
We're keen to learn about your use case! Just reach out to us in the chat or by email - &lt;a href="https://www.codenotary.com"&gt;CodeNotary&lt;/a&gt;&lt;/p&gt;

</description>
      <category>devops</category>
      <category>timestamp</category>
      <category>programming</category>
      <category>provenance</category>
    </item>
    <item>
      <title>Store data tamperproof using the Python  SDK for immudb — the blazing fast, OSS immutable db</title>
      <dc:creator>vchaindz</dc:creator>
      <pubDate>Tue, 22 Sep 2020 18:08:17 +0000</pubDate>
      <link>https://dev.to/vchaindz/store-data-tamperproof-using-the-python-sdk-for-immudb-the-blazing-fast-oss-immutable-db-3eg7</link>
      <guid>https://dev.to/vchaindz/store-data-tamperproof-using-the-python-sdk-for-immudb-the-blazing-fast-oss-immutable-db-3eg7</guid>
      <description>&lt;h1&gt;
  
  
  The Python  SDK for immudb
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;immu-py&lt;/strong&gt; assumes there is an existing instance of the immudb server up and running. &lt;/p&gt;

&lt;p&gt;You can skip the Setup immudb part, if you have immudb already running.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setup immudb
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;immudb&lt;/strong&gt; is &lt;strong&gt;lightweight, high-speed immutable database&lt;/strong&gt; for systems and applications. immudb is open source under the &lt;a href="https://github.com/codenotary/immudb/blob/master/LICENSE"&gt;Apache v2.0 License&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;With &lt;a href="https://github.com/codenotary/immudb"&gt;immudb&lt;/a&gt; you can track changes in sensitive data in your transactional databases and then record those changes indelibly in a tamperproof database. immudb makes sure that not just the latest data, but the complete history of, say, your debit/credit transactions is stored unchangeable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setup immudb
&lt;/h2&gt;

&lt;p&gt;If you haven't setup immudb yet, this is the time to do so. You only need to start immudb either as a process, a service or a docker container.&lt;/p&gt;

&lt;p&gt;It's up to you if you want to build the Docker /images/blog yourself based on the Dockerfiles in the GitHub repository or use the prebuild ones on Dockerhub.&lt;/p&gt;

&lt;p&gt;immudb is using the following defaults:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Auth user: immudb&lt;/li&gt;
&lt;li&gt;Auth password: immudb&lt;/li&gt;
&lt;li&gt;Service Port: 3322 (immudb)&lt;/li&gt;
&lt;li&gt;Metrics Port: 9497 (Prometheus exporter)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  immudb &lt;strong&gt;Dockerhub&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;-it&lt;/span&gt; &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; 3322:3322 &lt;span class="nt"&gt;-p&lt;/span&gt; 9497:9497 — name immudb codenotary/immudb:latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  standalone Binaries
&lt;/h3&gt;

&lt;p&gt;Each release provides all binaries for different operating systems. you can find these here: &lt;a href="https://github.com/codenotary/immudb/releases"&gt;immudb releases&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you want to build the &lt;strong&gt;binaries&lt;/strong&gt;yourself, simply &lt;a href="https://github.com/codenotary/immudb"&gt;clone this repo&lt;/a&gt; and run one of the following commands based on your operating system.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Linux&lt;/span&gt;
&lt;span class="nv"&gt;GOOS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;linux &lt;span class="nv"&gt;GOARCH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;amd64 make immudb-static
&lt;span class="c"&gt;# macOS&lt;/span&gt;
&lt;span class="nv"&gt;GOOS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;darwin &lt;span class="nv"&gt;GOARCH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;amd64 make immudb-static
&lt;span class="c"&gt;# Microsoft Windows&lt;/span&gt;
&lt;span class="nv"&gt;GOOS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;windows &lt;span class="nv"&gt;GOARCH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;amd64 make immudb-static
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then you can run immudb&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# run immudb in the foreground &lt;/span&gt;
./immudb
&lt;span class="c"&gt;# run immudb in the background &lt;/span&gt;
./immudb &lt;span class="nt"&gt;-d&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  install immudb as a service
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# install immudb service &lt;/span&gt;
./immudb service &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;span class="c"&gt;# check current immudb service status &lt;/span&gt;
./immudb service status
&lt;span class="c"&gt;# stop immudb service &lt;/span&gt;
./immudb service stop
&lt;span class="c"&gt;# start immudb service &lt;/span&gt;
./immudb service start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Introduction Python SDK for immudb
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;immu-py&lt;/strong&gt; implements a &lt;a href="https://grpc.io/"&gt;grpc&lt;/a&gt; immudb client. A minimalist API is exposed for applications while cryptographic&lt;br&gt;
verifications and state update protocol implementation are fully implemented by this client.&lt;br&gt;
Latest validated immudb state may be kept in the local filesystem when using default &lt;code&gt;rootService&lt;/code&gt;,&lt;br&gt;
please read &lt;a href="https://immudb.io/"&gt;immudb research paper&lt;/a&gt; for details of how immutability is ensured by &lt;a href="https://immudb.io/"&gt;immudb&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  Installation
&lt;/h2&gt;

&lt;p&gt;Install the package using pip:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;    pip &lt;span class="nb"&gt;install &lt;/span&gt;git+https://github.com/codenotary/immu-py.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then import the client as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;    &lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;immudb.client&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;ImmudbClient&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note: immu-py is currently hosted in [Github Packages].&lt;/p&gt;

&lt;h2&gt;
  
  
  Supported Versions
&lt;/h2&gt;

&lt;p&gt;immu-py supports the &lt;a href="https://github.com/codenotary/immudb/releases/tag/v0.7.1"&gt;latest immudb release&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quickstart
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/codenotary/immudb-client-examples/tree/master/python"&gt;Hello Immutable World!&lt;/a&gt; example can be found in &lt;code&gt;immudb-client-examples&lt;/code&gt; repo.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step by step guide
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Creating a Client
&lt;/h3&gt;

&lt;p&gt;The following code snippets shows how to create a client.&lt;/p&gt;

&lt;p&gt;Using default configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;    &lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ImmudbClient&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Setting &lt;code&gt;immudb&lt;/code&gt; url and port:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;
    &lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ImmudbClient&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"mycustomurl:someport"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ImmudbClient&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"10.105.20.32:8899"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  User sessions
&lt;/h3&gt;

&lt;p&gt;Use &lt;code&gt;login&lt;/code&gt; and &lt;code&gt;logout&lt;/code&gt; methods to initiate and terminate user sessions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;    &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;login&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"usr1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"pwd1"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="o"&gt;//&lt;/span&gt; &lt;span class="n"&gt;Interact&lt;/span&gt; &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;immudb&lt;/span&gt; &lt;span class="n"&gt;using&lt;/span&gt; &lt;span class="n"&gt;logged&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;

    &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;logout&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Encoding
&lt;/h3&gt;

&lt;p&gt;Please note that, in order to provide maximum flexibility, all functions accept byte arrays as parameters. Therefore, unicode strings must be properly encoded.&lt;br&gt;
It is possible to store structured objects, but they must be serialized (e.g., with pickle or json).&lt;/p&gt;
&lt;h3&gt;
  
  
  Creating a database
&lt;/h3&gt;

&lt;p&gt;Creating a new database is quite simple:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;    &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;createDatabase&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;b&lt;/span&gt;&lt;span class="s"&gt;"db1"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Setting the active database
&lt;/h3&gt;

&lt;p&gt;Specify the active database with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;    &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;useDatabase&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;b&lt;/span&gt;&lt;span class="s"&gt;"db1"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If not specified, the default databased used is "defaultdb".&lt;/p&gt;

&lt;h3&gt;
  
  
  Traditional read and write
&lt;/h3&gt;

&lt;p&gt;immudb provides read and write operations that behave as a traditional&lt;br&gt;
key-value store i.e. no cryptographic verification is done. This operations&lt;br&gt;
may be used when validations can be post-poned:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;    &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;b&lt;/span&gt;&lt;span class="s"&gt;"k123"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sa"&gt;b&lt;/span&gt;&lt;span class="s"&gt;"value123"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;b&lt;/span&gt;&lt;span class="s"&gt;"k123"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Verified or Safe read and write
&lt;/h3&gt;

&lt;p&gt;immudb provides built-in cryptographic verification for any entry. The client&lt;br&gt;
implements the mathematical validations while the application uses as a traditional&lt;br&gt;
read or write operation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;    &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;safeSet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;b&lt;/span&gt;&lt;span class="s"&gt;"k123"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;new&lt;/span&gt; &lt;span class="n"&gt;byte&lt;/span&gt;&lt;span class="p"&gt;[]{&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;});&lt;/span&gt;
        &lt;span class="n"&gt;results&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;safeGet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;b&lt;/span&gt;&lt;span class="s"&gt;"k123"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;Except&lt;/span&gt; &lt;span class="n"&gt;VerificationException&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="c1"&gt;# Do something
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Multi-key read and write
&lt;/h3&gt;

&lt;p&gt;Transactional multi-key read and write operations are supported by immudb and immupy.&lt;br&gt;
Atomic multi-key write (all entries are persisted or none):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;    &lt;span class="n"&gt;normal_dictionary&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sa"&gt;b&lt;/span&gt;&lt;span class="s"&gt;"key1"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sa"&gt;b&lt;/span&gt;&lt;span class="s"&gt;"value1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sa"&gt;b&lt;/span&gt;&lt;span class="s"&gt;"key2"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sa"&gt;b&lt;/span&gt;&lt;span class="s"&gt;"value2"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;setAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;normal_dictionary&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Atomic multi-key read (all entries are retrieved or none):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;    &lt;span class="n"&gt;normal_dictionary&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sa"&gt;b&lt;/span&gt;&lt;span class="s"&gt;"key1"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sa"&gt;b&lt;/span&gt;&lt;span class="s"&gt;"value1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sa"&gt;b&lt;/span&gt;&lt;span class="s"&gt;"key2"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sa"&gt;b&lt;/span&gt;&lt;span class="s"&gt;"value2"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;results_dictionary&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;getAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;normal_dictionary&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;keys&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
    &lt;span class="c1"&gt;# Or manually
&lt;/span&gt;    &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="sa"&gt;b&lt;/span&gt;&lt;span class="s"&gt;"key1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sa"&gt;b&lt;/span&gt;&lt;span class="s"&gt;"key2"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  User management
&lt;/h2&gt;

&lt;p&gt;Users can be added and granted access to databases.&lt;/p&gt;

&lt;h3&gt;
  
  
  Adding a user
&lt;/h3&gt;

&lt;p&gt;The&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
 functions create a new users and grants the specified permission to a database.


```python
user='newuser'
password='Pw1:pasdfoiu'
permission=immudb.constants.PERMISSION_RW
database='defaultdb'

client.createUser(user, password, permission, database)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The database must exists at the time the user is created. The password must be between 8 and 32 characters in length, and must have at least one upper case letter, a symbol and a digit.&lt;/p&gt;

&lt;p&gt;Permission are defined in immudb.constants and are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;PERMISSION_SYS_ADMIN&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;PERMISSION_ADMIN&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;PERMISSION_NONE&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;PERMISSION_R&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;PERMISSION_RW&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Changing password
&lt;/h3&gt;

&lt;p&gt;The user must must provide both old and new password:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;newPassword&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"pW1:a0s98d7gfy"&lt;/span&gt;
&lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;changePassword&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;newPassword&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;oldPassword&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It is applied the same password policy of user creation.&lt;/p&gt;

&lt;h3&gt;
  
  
  User list
&lt;/h3&gt;

&lt;p&gt;To get the list of user created on immudb, simply call&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
:


```python
resp=client.listUsers()
print(users.userlist.users)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Closing the client
&lt;/h3&gt;

&lt;p&gt;To programatically close the connection with immudb server use the &lt;code&gt;shutdown&lt;/code&gt; operation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;    &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;shutdown&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note: after shutdown, a new client needs to be created to establish a new connection.&lt;/p&gt;

&lt;h2&gt;
  
  
  Contributing
&lt;/h2&gt;

&lt;p&gt;We welcome contributions. Feel free to join the team!&lt;/p&gt;

&lt;p&gt;To report bugs or get help, use &lt;a href="https://github.com/codenotary/immudpy/issues"&gt;GitHub's issues&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>python</category>
      <category>opensource</category>
      <category>immutability</category>
      <category>database</category>
    </item>
    <item>
      <title>immudb is an open source, high-speed immutable database for systems and applications</title>
      <dc:creator>vchaindz</dc:creator>
      <pubDate>Sun, 31 May 2020 10:36:14 +0000</pubDate>
      <link>https://dev.to/vchaindz/immudb-is-an-open-source-high-speed-immutable-database-for-systems-and-applications-27j4</link>
      <guid>https://dev.to/vchaindz/immudb-is-an-open-source-high-speed-immutable-database-for-systems-and-applications-27j4</guid>
      <description>&lt;p&gt;immudb is a &lt;strong&gt;lightweight, high-speed immutable database&lt;/strong&gt; for systems and applications, written in Go.&lt;br&gt;
With immudb you can track changes in sensitive data in your transactional databases and then record those changes permanently in a&lt;br&gt;
tamperproof immudb database. This allows you to keep an indelible history of sensitive data, for example debit/credit card transactions.&lt;/p&gt;

&lt;p&gt;Traditional transaction logs are hard to scale and are mutable. So there is no way to know for sure if your data has been compromised.&lt;/p&gt;

&lt;p&gt;As such, immudb provides &lt;strong&gt;unparalleled insights&lt;/strong&gt; &lt;strong&gt;retroactively&lt;/strong&gt; of changes to your sensitive data, even&lt;br&gt;
if your perimeter has been compromised. immudb guarantees immutability by using a &lt;strong&gt;Merkle tree structure&lt;/strong&gt; internally.&lt;/p&gt;

&lt;p&gt;immudb gives you the same &lt;strong&gt;cryptographic verification&lt;/strong&gt; of the integrity of data written with &lt;strong&gt;SHA-256&lt;/strong&gt; as a classic blockchain without the cost and complexity associated with blockchains today.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why immudb?
&lt;/h2&gt;

&lt;p&gt;immudb has 4 main benefits:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;immudb is immutable&lt;/strong&gt;. You can add records, but &lt;strong&gt;never change or delete records&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Data stored in immudb is &lt;strong&gt;cryptographically coherent and verifiable&lt;/strong&gt;, like blockchains, just without all the complexity and at high speed.&lt;/li&gt;
&lt;li&gt;Anyone can get &lt;strong&gt;started with immudb in minutes&lt;/strong&gt;. Whether you're using node.js, Java, Python, Golang, .Net, or any other language. It's very easy to use and you can have your immutable database running in just a few minutes.&lt;/li&gt;
&lt;li&gt;Finally, immudb is  &lt;strong&gt;Open Source&lt;/strong&gt;. You can run it &lt;strong&gt;on premise&lt;/strong&gt;, or in the &lt;strong&gt;cloud&lt;/strong&gt;. It's completely free. immudb is governed by the Apache 2.0 License.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;immudb can be ran on &lt;strong&gt;Linux&lt;/strong&gt;, &lt;strong&gt;FreeBSD&lt;/strong&gt;, &lt;strong&gt;Windows&lt;/strong&gt;, and &lt;strong&gt;MacOS&lt;/strong&gt;, along with&lt;br&gt;
other systems derived from them, such as &lt;strong&gt;Kubernetes&lt;/strong&gt; and &lt;strong&gt;Docker&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Components
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;immudb&lt;/strong&gt; is the server binary that listens on port 3322 and provides a gRPC interface&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;immugw&lt;/strong&gt; is the intelligent REST proxy that connects to immudb and provides a RESTful interface for applications. We recommend to run immudb and immugw on separate machines to enhance security&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;immuadmin&lt;/strong&gt; is the admin CLI for immudb and immugw. You can install and manage the service installation for both components and get statistics as well as runtime information.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;immuclient&lt;/strong&gt; is the CLI client for immudb. You can read, write data into immudb from the commandline using direct or interactive mode.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fcodenotary%2Fimmudb-docs%2Fraw%2Fmaster%2Fsrc%2Fdocs%2Fimmudb%2Fcomponent-diagram.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fcodenotary%2Fimmudb-docs%2Fraw%2Fmaster%2Fsrc%2Fdocs%2Fimmudb%2Fcomponent-diagram.png" alt="immudb component overview"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The latest release binaries can be found &lt;a href="https://github.com/codenotary/immudb/releases" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We always welcome feedback and contribution!&lt;/p&gt;

&lt;h2&gt;
  
  
  Further information
&lt;/h2&gt;

&lt;p&gt;You can find a complete documentation &lt;a href="https://immudb.io/docs/introduction.html" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  License
&lt;/h2&gt;

&lt;p&gt;immudb is &lt;a href="https://github.com/codenotary/immudb/blob/master/LICENSE" rel="noopener noreferrer"&gt;Apache v2.0 License&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>go</category>
      <category>opensource</category>
      <category>database</category>
      <category>security</category>
    </item>
  </channel>
</rss>
