<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Vishwanath N on Medium]]></title>
        <description><![CDATA[Stories by Vishwanath N on Medium]]></description>
        <link>https://medium.com/@vishwanathnarayanan29?source=rss-8eeb9348ede0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*iBdx3THCTrLRNsm9ZsZHEw.jpeg</url>
            <title>Stories by Vishwanath N on Medium</title>
            <link>https://medium.com/@vishwanathnarayanan29?source=rss-8eeb9348ede0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 21:54:21 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@vishwanathnarayanan29/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Building My Own Cloud at Home: My Homelab Journey ️]]></title>
            <link>https://medium.com/@vishwanathnarayanan29/building-my-own-cloud-at-home-my-homelab-journey-%EF%B8%8F-4383e651372b?source=rss-8eeb9348ede0------2</link>
            <guid isPermaLink="false">https://medium.com/p/4383e651372b</guid>
            <category><![CDATA[self-hosted]]></category>
            <category><![CDATA[homelab]]></category>
            <category><![CDATA[self-hosting]]></category>
            <category><![CDATA[proxmox]]></category>
            <dc:creator><![CDATA[Vishwanath N]]></dc:creator>
            <pubDate>Mon, 06 Apr 2026 15:50:50 GMT</pubDate>
            <atom:updated>2026-04-06T15:50:50.743Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is a homelab</h3><p>By definition, a homelab is a self-contained IT infrastructure you build and manage at your home. You own the machine, networking everything end-to-end. In simpler terms, it’s like having your own mini cloud where you can run services, experiment, and learn how real infrastructure works.</p><p>Many people have this notion that home labs need to be enterprise-grade servers like a Dell PowerEdge or an HP server rack. But homelabs are like candies. They can be of any shape and size. It can be a small Raspberry Pi with a small ARM chip connected to Ethernet, or to a full-blown data centre-type machine with a Threadripper CPU in it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lMMguCrZIdjcRFle" /></figure><h3>Why I need one</h3><p>I’ve wanted to build a homelab right from my college days. I have seen and followed multiple content creators like <a href="https://www.youtube.com/@LinusTechTips">Linus Tech Tips (LTT)</a>, <a href="https://www.youtube.com/@NetworkChuck">NetworkChuck</a>, and a few others who have their home data centres. The idea of self-hosting services, wiring up Ethernet cables, and experimenting with networking configs always fascinated me. The idea was never to just self-host, which I can do by getting a cloud subscription, but rather it was to get my hands dirty by working with them. There are some benefits, like I own the data, I can break stuff, and most importantly, it won’t cost me a lot (Would be in a generational debt if I forgot to turn off my EC2 instance)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/314/1*Fuggz2J4-KZDLTo0F_h7OA.png" /></figure><h3>Hardware in hand</h3><p>The initial plan was to convert an old laptop into a homelab. But I ended up using an old PC I already had lying around. It was a pretty basic machine with a 10th-gen Intel Core i5, 4 GB RAM and a couple of 256 GB disks - one was an HDD, and another was a SATA SSD. The PSU was dead, and hence I got a cheap PSU to just make it run. For my use case, this is a pretty decent machine. I&#39;m not yet <em>sailing the seas</em> for 4k media, in which case I have to transcode them. Though I haven’t tested it with 4k media, I&#39;m pretty sure there would be a bottleneck on my CPU. For a few simple services, I think this is a good enough machine to start with. The RAM is a whole pain altogether. The 4GB is definitely going to be a huge bottleneck, and given the current scenario of RAM shortage, I highly doubt I will upgrade it. It was a constraint that I had to worry about, like the services I’m going to run, how I’m going to run them, etc. Now that hardware is sorted, let&#39;s look at the brain that is going to host all my services.</p><h3>The Operating System</h3><p>When it came to the operating system, the easier one was to go with any Linux-based server OS like Ubuntu Server, the reason being the amazing community, great support and tons of resources (not brave enough to run Windows Server). But the thing is, these are just standard operating systems. If I wanted to run services, I’d have to run them either as Docker containers or directly on the OS. This is where another of my fascinations kicked in. Welcome “<strong>Proxmox”</strong> Datacentre grade type 1 hypervisor. There are multiple type 1 hypervisors like VMWare ESXi. I wanted something free to use, and Proxmox was the first one to pop up.</p><p>You might be wondering, the Ubuntu server will be more than enough for a lot of people’s use cases, and I agree with that. The reason I chose Proxmox was simple. I wanted to try to use a data centre-grade OS, a type 1 hypervisor, experiment with virtualisation, and learn more about it. It lets me run multiple services in isolated environments, instead of cramming everything into a single OS. I didn’t just want to run services, I wanted to manage them as they would be in a real production environment. Let&#39;s move on to what I run on my machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9z3bTlD4btGK7xIYe7WkFg.png" /><figcaption>Proxmox Dashboard</figcaption></figure><p>I use the SSD for my primary storage, like container storage, VM storage, etc., to have a fast and snappy performance. The HDD, which I mentioned earlier, is used for storing the container templates, VM operating systems and backups. Learning about the backup strategies and <a href="https://pbs.proxmox.com/docs/prune-simulator/">retention policies</a> in itself was an amazing experience. For now, I have just kept it to retain the last 7 backups, so that I can roll back if anything breaks. This separation keeps performance-critical workloads on the SSD, while the HDD handles storage-heavy tasks like backups.</p><h3>Self-Hosted Services</h3><p>After doing everything, it was now time to run the actual services. The first service that I wanted to self-host was <strong>Home Assistant (HA). </strong>I always wanted to explore home automation and the Internet of Things. I wanted to set up simple automations and control everything from my phone, laptop, or Google Home. Home Assistant is one of the top recommended home automation platforms. It easily integrates with a bunch of off-the-shelf IoT devices like Philips Hue or self-developed ESP Home devices. One key recommendation from the community is to run Home Assistant as a dedicated OS in a VM rather than a container to fully utilise its features.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3EvhO3ECsfHFFfjISduclg.png" /><figcaption>HomeAssistant Dashboard</figcaption></figure><p>All the self-hosting is fun until you leave your home. Once you are out of your home network, you cannot access any of them. To access my server from anywhere, I had to install a VPN. There were a bunch to get started, one was Wireguard, and another was tailscale. Tailscale was much easier to get started with. Also, it didn’t require me to have a static IP. Though you can build some solutions around WireGuard with a dynamic IP, it was too much of a hassle. With respect to tailscale, I run it as a container inside my Proxmox server and relay the traffic to my subnet. Tailscale handles the secure connection between my devices, without me having to manage the networking complexity. This essentially turned my home network into something I could access from anywhere, securely.</p><p>The network monitoring tool provided by my ISP in the router’s admin page is useless. It doesn’t show me the MAC address and IP address mapping of the devices that are connected to the LAN. Initially, I was using arp-scan to get info of the devices in my local network. ARP is a protocol that helps you map an IP address to a MAC address. Then I looked into <strong>NetAlertX</strong>. It is a service with which you can scan your LAN, and you can have a dashboard with information about the devices in your LAN. Finally, I had visibility into what was actually connected to my network.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I9mT4Dm5iEwudFGV_bzIXA.png" /><figcaption>NetAlertX Dashboard</figcaption></figure><p>Network-wide Ad Blocking is something I have wanted for a very long time. There are again a good number of options for them. It was between Pi Hole and Adguard DNS for me. Though I was slightly biased towards Pi Hole since I have seen a lot of content creators self-hosting it in a Raspberry Pi to have ad blocking across the network. I self-hosted AdGuard DNS. Primarily because the UI was well polished, and I was already a consumer of the Adguard Cloud DNS, which has been working like a charm all these days. This cleaned up the internet experience across my entire network without configuring each device individually.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Gsouq8vEcOnQ-Bcx-Gvgug.png" /><figcaption>Adguard Dashboard</figcaption></figure><h3>The never-ending journey</h3><p>I like to think of self-hosting and homelabs as something you don’t just set up once and move on from. You constantly tweak them, adding new services, breaking existing ones, and learning along the way. These are just a few services I’ve started with, but there are plenty of ideas and enhancements I still want to explore.</p><p>For instance, I currently use Bitwarden, and self-hosting Vaultwarden is something I’m interested in trying. That said, there are trade-offs if my network goes down, I lose access to my passwords.</p><p>I also want to explore the ARR stack, which includes tools like Sonarr, Radarr, and Prowlarr to automate media management 🏴‍☠️.</p><p>On the infrastructure side, setting up a separate VLAN for self-hosted services and IoT devices is something I want to do for better isolation and security. I’m not sure if my current ISP router supports it , if not, I’ll have to get a separate router and run the current one in bridge mode.</p><p>I also plan to add proper alerting and uptime monitoring so I get notified whenever something breaks. Beyond that, I want to set up a proper monitoring stack using tools like Prometheus and Grafana to better understand resource usage and system behaviour over time. This setup started as an experiment, but it’s slowly becoming something I rely on every day and that’s what makes it exciting. There’s always something new to learn, break, and rebuild.</p><h3>Resources and Credits</h3><p>There are tons of resources out there to get started, here are a few which I followed throughout the journey</p><ol><li><a href="https://www.youtube.com/watch?v=lFzWDJcRsqo">Proxmox Beginner’s Guide: Everything You Need to Get Started</a></li><li><a href="https://www.youtube.com/watch?v=5j0Zb6x_hOk&amp;list=PLT98CRl2KxKHnlbYhtABg6cF50bYa8Ulo">From Zero to Proxmox: A Easy to Follow Getting Started Guide</a></li><li><a href="https://www.youtube.com/watch?v=qFUieNOFYO4">5 Best Services to Run on Proxmox (What I Always Use)</a></li><li><a href="https://www.youtube.com/watch?v=_sfddZHhOj4">My Proxmox Home Server Walk-Through: Part 1 (TrueNAS, Portainer, Wireguard)</a></li><li><a href="https://www.youtube.com/watch?v=gyMpI8csWis">how to build a Raspberry Pi NAS (it’s AWESOME!!)</a></li><li><a href="https://www.youtube.com/watch?v=gPGf4Y8nQqM">What is a HomeLab and How Do I Get Started?</a></li></ol><p>While we are here, I want to give special shoutout to proxmox community. The <a href="https://community-scripts.org/"><strong>community managed helper scripts</strong></a><strong> </strong>are a life saver, if you are getting started with self hosting services in proxmox. My advice would be to use them with caution always understand what a script does before running it.</p><p>This entire journey was built on top of the work and knowledge shared by the community and that’s what makes self-hosting so powerful.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/735/0*N6AZMLrcOFOd9MmB.jpg" /><figcaption>To the entire community</figcaption></figure><h3>Conclusion</h3><p>This started as a small experiment with an old machine, but it quickly turned into something much more valuable.</p><p>If you’re even slightly curious about infrastructure or self-hosting, I’d highly recommend starting you don’t need much, just the willingness to learn and break things.</p><p>I’ll definitely be sharing more about IoT and self-hosting in future blogs stay tuned.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4383e651372b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Moving away from Oh-My-Zsh ]]></title>
            <link>https://medium.com/@vishwanathnarayanan29/moving-away-from-oh-my-zsh-cc8b6bfc3b57?source=rss-8eeb9348ede0------2</link>
            <guid isPermaLink="false">https://medium.com/p/cc8b6bfc3b57</guid>
            <category><![CDATA[iterm2]]></category>
            <category><![CDATA[terminal]]></category>
            <category><![CDATA[zsh]]></category>
            <category><![CDATA[oh-my-zsh]]></category>
            <dc:creator><![CDATA[Vishwanath N]]></dc:creator>
            <pubDate>Thu, 29 Jan 2026 16:12:54 GMT</pubDate>
            <atom:updated>2026-01-29T16:12:54.342Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>I do software for my living, and for software development, I use tons of tools daily, like IntelliJ IDEA, PyCharm, and VS Code. One tool, however, that sits at the centre of almost everything I do is the terminal/shell(They are different, maybe a topic for another day). Some people might be wondering, why all the fuss, when you can use the terminal inside the IDE. Personal opinion, the <strong>integrated terminal in the IDE is shit</strong>. It is extremely uncomfortable to get things done. It is good for a couple of small commands, but for the most part, it is extremely uncomfortable. If you use it, try to move to a dedicated terminal emulator, you will thank me later.</p><h3>Problem</h3><p>I use iTerm2 emulator in my system. The default shell in macOS is ZSH. Most of the users will install Oh-My-Zsh to maximise the use of the terminal. It is a tool that will unlock the full potential of your shell. It will make you a power user. You will have an extreme level of customisations, including key bindings, tons of themes to choose from, and a huge source of community plugins. For someone getting serious about the terminal, Oh My Zsh (OMZ) feels like an obvious win and for a long time, I thought of it exactly that way.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*F36pbfcIZk8UIFn67enNWA.png" /></figure><p>First thing I did was to install iTerm2 and then OMZ. It was amazing to use for the first few weeks. I could change the theme anytime I want, have all the aliases I ever needed and much more. But after a few weeks, things started to get bad. My terminal startup time increased a lot. When I open a new tab, it takes forever to open. Initially, I thought, let me live with this, because of all the bells and whistles it brought. But slowly it became worse. Every time I opened a tab, it took 5 seconds or 6 seconds. That might not sound like a big deal in isolation. But guess what, when you are working with these shells, these small times count. It will break your rhythm and flow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/1*vPLiq7UtKb0BsGMrCcVJKA.gif" /></figure><h3>Solution</h3><h4>First Step</h4><p>I wanted the features of OMZ, but I also wanted my shell to start fast. I also found that I didn’t use all the features of OMZ. It was hardly 30–50%. I wondered what I could do to make it faster. A couple of years back, I saw a YouTube video on how to move away from OMZ. One of the interesting things he mentioned was how everything is a simple script at the end of the day. Everything from terminal themes to key bindings was just a simple script.</p><p>I started by going through the Oh My Zsh GitHub repository and skimming the code to get a surface-level understanding of how things were structured. It wasn’t a deep analysis, but enough to realise that there was no hidden magic, just a collection of Zsh scripts being sourced during startup.</p><p>At that point, I decided to take matters into my own hands. I removed OMZ entirely from my system and began rebuilding my setup piece by piece. Instead of relying on OMZ as a framework, I manually sourced only the scripts I actually needed.</p><p>I picked the theme I liked, extracted the aliases I regularly used into a single file, and pulled in just the code required for features like autosuggestions. Everything else was left out.</p><p>At the end of it, I had a huge zshrc file. For context, .zshrc is the file that will be sourced when you open a new shell session. I felt the file was overly populated and was extremely large and difficult to maintain. Still, the problem wasn’t solved fully; my terminal sessions were still worse, not like 5–6 seconds, but at least in the ballpark of 4 seconds, because I was still doing the same thing that OMZ did.</p><h4>Second Step</h4><p>Before optimising the startup time, I wanted to clean up my zshrc. So I tried to break it into smaller chunks and keep it separate and reusable. I created a dedicated directory to hold all my Zsh-related scripts. The first and most obvious step was to move all my aliases into a separate file. I consolidated every alias I used into a single script and sourced it near the end of my .zshrc.</p><p>The next thing was to get the theme. I downloaded the official theme I needed from OMZ themes, created a separate script file for it, and sourced it. But it was not straightforward like aliases. It required some colour configs from OMZ and a few functions from it. To understand what was actually required, I went through the theme source line by line, removed the parts I didn’t need, and generated a theme from scratch. Since writing everything from scratch will be obsolete, as I might reuse basic theme configs in the future. I sourced the basic theme configs from OMZ, like colours. I kept each theme in a separate folder, thereby sourcing the theme I want dynamically based on a variable I keep in my zshrc file.</p><p>I still wanted a few plugins from OMZ, such as autosuggestions, autocompletions, and syntax highlighting, so I pulled only those plugins from the OMZ repository and sourced them manually in my .zshrc.</p><p>To make all of this work, I needed a few core helper functions that these plugins depended on at runtime. I tracked down the required helpers, grouped them into a dedicated folder, and sourced them explicitly.</p><p>At this point, I was sourcing multiple files. To keep things clean and scalable, I grouped related files and sourced them using loops.</p><pre>.zsh_configs/<br>├── helper/<br>│   ├── completion.zsh<br>│   ├── history.zsh<br>│   └── theme.zsh<br>├── plugins/<br>│   ├── zsh-autosuggestions/<br>│   ├── zsh-completions/<br>│   └── zsh-syntax-highlighting/<br>├── themes/<br>│   ├── light-zsh/<br>│   │   └── light-zsh.zsh-theme<br>│   └── old/<br>│       └── old.zsh-theme<br>├── aliases.zsh<br></pre><pre><br>#### HELPERS ####<br># Source all helper scripts under $ZSH_CONFIGS/helper<br>for helper in &quot;$ZSH_CONFIGS&quot;/helper/**/*.zsh; do<br>  source &quot;$helper&quot;<br>done<br><br>#### PLUGINS ####<br># Source all plugins under $ZSH_CONFIGS/plugins<br>for plugin in &quot;$ZSH_CONFIGS&quot;/plugins/**/*.plugin.zsh; do<br>  source &quot;$plugin&quot;<br>done<br><br>fpath=(&quot;$ZSH_CONFIGS/plugins/zsh-completions/src&quot; $fpath)<br><br>#### ALIASES ####<br>source &quot;$ZSH_CONFIGS/aliases.zsh&quot;<br><br>#### THEME ####<br>source &quot;$ZSH_CONFIGS/themes/$ZSH_THEME/$ZSH_THEME.zsh-theme&quot;</pre><p>After all of this, my .zshrc looked much better. It was cleaner, easier to maintain, and far more readable. However, despite the refactor, I was still doing almost the same work that OMZ was doing. As a result, the startup time didn’t reduce drastically. It was slightly better, but still far from ideal.</p><h4>Final Step</h4><p>I started looking for places where I could improve the startup time. I used zprof to analyse the time taken by each process. Thereby, I found it was the plugins I used that took forever. The slowdown wasn’t caused by any single plugin or feature. Instead, most of the startup time was spent loading <strong>base infrastructure</strong> that many plugins depend on, things like completion initialisation (compinit), permission checks (compaudit), hook registration, and syntax-highlighting internals. That’s when I realised that I do not want every feature right before I write my first command. Loading everything together might be the bottleneck.</p><p>Instead, if I could load a bare-minimum shell first and defer the heavier plugins until after the prompt is ready, the overall experience would feel much faster.</p><p>This is when I came across <strong>zsh-defer</strong>. It allows you to defer the execution of Zsh code until the shell has finished starting up and is idle, essentially when it’s waiting for user input. It&#39;s just a small change I did, but the performance boost was massive.</p><pre>for plugin in &quot;$ZSH_CONFIGS&quot;/plugins/**/*.plugin.zsh; do<br>  zsh-defer source &quot;$plugin&quot;<br>done</pre><h4>Final Numbers</h4><p>Before the optimisations, a new terminal tab startup was <strong>~4–6 seconds. </strong>After the optimizations the effective startup time was <strong>~110 ms, </strong>and the prompt appears almost instantly</p><h3>Conclusion</h3><p>There are still a few things I can improve. One obvious step is setting up a cron job to push my Zsh configuration directory to GitHub, which would make setting up a new system effortless. There are also a few other ideas and tools that could reduce the startup time even further. 110 ms is already fast, but it’s still possible to push it below 50 ms. I could have stuck with OMZ and tried to optimise it further, or even switched to something else entirely. But going through this process, understanding how everything works, and building my setup from scratch was genuinely fun.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cc8b6bfc3b57" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Under the hood of Passkeys: Magic behind seamless login]]></title>
            <link>https://medium.com/@vishwanathnarayanan29/under-the-hood-of-passkeys-magic-behind-seamless-login-0191bb922113?source=rss-8eeb9348ede0------2</link>
            <guid isPermaLink="false">https://medium.com/p/0191bb922113</guid>
            <category><![CDATA[passkey]]></category>
            <category><![CDATA[authentication]]></category>
            <category><![CDATA[cryptography]]></category>
            <category><![CDATA[public-key-cryptography]]></category>
            <category><![CDATA[ellipticcurvecryptography]]></category>
            <dc:creator><![CDATA[Vishwanath N]]></dc:creator>
            <pubDate>Wed, 07 Jan 2026 15:52:20 GMT</pubDate>
            <atom:updated>2026-01-07T15:52:20.873Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>I use a lot of applications and websites every single day, and for some reason, the Remember me button never seems to work (Always Microsoft🤦🏻‍♂️). I tend to enter the password manually, then pass the MFA and then get into the system.</p><p>A few years ago, I learnt about password managers. Thanks to a lot of English tech YouTubers who started to promote LastPass in their videos. I’ve been using Bitwarden for the last couple of years, and it has saved me a ton of times - Autofilling passwords, storing them securely, storing card details, etc.</p><p>Then, suddenly, a year back, when I started to log in to websites, they started promoting <strong>passkeys. </strong>I started to use them to verify myself a ton of times for my Google account and AWS accounts. Over time, I found them useful. They worked as an MFA or for passwordless logins.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/263/1*gEe9ZwJGHirQy1D5L6lEig.png" /><figcaption>Passkeys</figcaption></figure><p>A couple of months back, I was curious about passkeys. I mean, I click a button, use my fingerprint and Voilà, I’m logged in. I wanted to look under the hood at how they were working. Though I started to look into passkeys, I stumbled upon cryptography algorithms and signing. This blog might be a bit long, considering I’m capturing everything I learnt in this entire process. Feel free to skip the parts that you feel are unnecessary.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/259/1*34SUbZe05TamxdkcspqhJQ.jpeg" /><figcaption>Things worked like magic</figcaption></figure><h3>Problem and the solution</h3><p>The problem that they wanted to solve was to come up with something that could reduce the friction of using passwords and MFA, like OTPs, Authenticators, etc. People wanted to come up with a solution where they would start using something they already have, reduce the inputs and make it as smooth as possible.</p><p>Another huge problem with the traditional logins was Phishing attacks. Attackers would create a similar-looking website to the original one, and the victim would log in with the valid credentials, thereby giving attackers the credentials.</p><p>The FIDO (Fast Identity Online) Alliance has been working on this problem space for over a decade. During this time, it introduced multiple authentication standards and technologies that gradually evolved toward a passwordless future. These efforts eventually converged into what we now call passkeys. It was not until a couple of years back that Apple, Google, and many other such companies started to adopt them it became popular.</p><h3>Cryptography to the rescue</h3><p>This is the detour I mentioned earlier. The next 4–6 sections dive into the cryptography that powers passkeys. Some details are simplified to keep things approachable and, honestly, to help me understand them better, too. These topics are like individual topics but everything will fit together as pieces in a jig-saw puzzle when we talk about what happens under the hood of passkeys.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/301/1*mtn16GporzqU1yd6UfGGYw.jpeg" /></figure><h3>Symmetric &amp; Asymmetric Key Cryptography</h3><p>In the case of symmetric key cryptography, a single key is used to encrypt the data, and the key is shared with the other party to decrypt the same. This causes issues, as if we get hold of the key, we can decrypt the data.</p><p>Asymmetric key cryptography, on the other hand, uses a pair of keys: a public key and a private key. The public key can be freely shared, while the private key is kept secret.</p><p>For encryption, data is encrypted using the public key and can only be decrypted using the corresponding private key. This ensures confidentiality, even if the public key is widely known.</p><h3>Encryption and Signing</h3><p>There are mainly two use cases with the keys. One is encryption and the other is signing. In encryption, we encrypt the data, and only the intended person can read the data. Signing, on the other hand, is used to provide authenticity and integrity. The sender signs the data using their private key, and the receiver verifies the signature using the corresponding public key. This helps in knowing if the data was created by the expected sender, and the data has not been altered in transit.</p><h3>Elliptic Curve Cryptography</h3><p>For every cryptographic algorithm, mathematics forms the foundation. How keys are generated and the mathematical relationship between them is critical to the security of the system. There are multiple ways to construct this relationship, and one such approach is Elliptic Curve Cryptography (ECC).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/224/1*OMdEbyJq1hxnhBAbifJWdw.png" /><figcaption>ECC</figcaption></figure><p>At its core, ECC provides a well-defined mathematical relationship between a private key and a public key. The private key must be generated in a way that makes it computationally infeasible to derive or guess, while the public key can be freely shared across the network. Even with full knowledge of the public key, it should remain practically impossible to recover the corresponding private key. Elliptic curves are used in cryptography because they provide a rare combination of efficient computation, strong mathematical hardness, and compact key sizes, properties that most other curves or mathematical structures do not simultaneously offer.</p><p>If we take any random point in the curve and add it to it, we will get another point. Repeated such additions will give us newer points. The chosen multiplier becomes the private key, and the point that we start with is called the generator point. The result is the public key we need. This operation is very easy to do. Unlike traditional multiplication, we cannot divide and get the result back. We will get to a problem called as Elliptic-Curve Discrete Logarithm Problem</p><pre>Q=dG<br><br>where<br>Q = Public Key<br>d = Private Key<br>G = Generator point</pre><p>The generator point is also chosen precisely. It cannot be random. The reason being, if we select a random point, the repeated multiplication will return the original point very quickly, meaning the number of public keys we generate will be less, hence cracking the private key will be easier. The point is chosen in such a way that we can produce a lot of points.</p><h3>Elliptic Curve Digital Signature (ECDSA)</h3><p>Now that Elliptic Curve Cryptography is clear. Let us look into the implementation of it in the signing and verification.</p><h4><strong>Signing</strong></h4><p>For ECDSA, we take a very well-known Elliptic curve. We generate the public key and private key as mentioned in the above process and share the public key. Once this is done, we then hash the message. The hashing is done in order to have a uniform message length. This is easier to work with than working with different sizes of messages. A per-signature value <em>k</em> is generated, which is called a nonce in the world of cryptography. This value must be unique and unpredictable for each signature. In deterministic ECDSA, <em>k</em> is derived from the message hash and the private key using HMAC. This avoids reliance on external randomness.</p><pre>k = HMAC(hash(Message) + private key)<br>R = k * G<br><br>k - the result of HMAC function<br>G - Generator point</pre><p>If you look at <em>R = k × G</em>, it follows the same structure used to derive a public key in ECC. In that sense, R can be thought of as an ephemeral public value corresponding to the nonce <em>k</em>. After this, we calculate something called as the signature proof using the following formula</p><pre>r = R.x<br>s = k⁻¹ (h + r·d) mod n<br><br>r - x component of the R<br>k - nonce<br>h - hash of message<br>d - private key<br>n - order of generator point <br>s - signature proof </pre><p><strong><em>{r,s}</em></strong>- this is the final signature that will be generated. This signature proves that the signer possesses the private key corresponding to the published public key, without revealing the private key itself.</p><p>Now that we have the message and the signature, let us look at how the receiver can verify whether the message they got was from the intended sender, and whether the message is not been tampered</p><h4>Verification</h4><p>First, the receiver hashes the message they get. Since we do not have access to the private key that the sender used it is difficult to verify. This is where math comes into the picture. If we use the inverse of <strong><em>s</em></strong><em> (the signature proof)</em>, then the <em>k</em> will get cancelled out, making it easier for calculation. Let&#39;s look at what we have in hand</p><ul><li>The generator point</li><li>The ECC curve</li><li>r the ephemeral public key</li><li>s the signature proof</li><li>The public key of the signer</li></ul><p>Using the message hash, the public key, and the signature <strong><em>{r,s} t</em></strong>he verifier reconstructs an elliptic-curve point that should match the point originally computed by the signer during signing. If the x-coordinate of the reconstructed point matches <strong><em>r</em></strong>, the signature is valid. Otherwise, it is rejected. Iff the signer knew the private key corresponding to the public key, this reconstructed point will match. This is what allows ECDSA to verify signatures without ever revealing or transmitting the private key.</p><h3>Passkeys working</h3><p>The detour required to look at the underlying things is done. Now, let us look at how passkeys work like magic, using cryptography under the hood.</p><h4>Registration</h4><p>Firstly, the application you are trying to use will ask if you want to use passkeys for future authentications. If you give approval for it, then the process begins. Firstly, the application talks to the browser using the webAuthn api. The api, in turn, talks with the OS using a special protocol called the <strong><em>Client to Authenticator Protocol (CTAP). </em></strong>During this process, the navigator.credentials.create() method is invoked. It creates a public key-private key pair scoped to the application’s domain. The private key is stored in the password manager, and the public key is sent back to the application. The application stores the public key along with some metadata, like username. If you are using passkeys currently, you can see the public key stored in your system. The below is one such example.</p><pre>    &quot;fido2Credentials&quot;: [<br>      {<br>        &quot;credentialId&quot;: &quot;30ac0036-758e-4746-9c8c-c0bc0ad10e2b&quot;,<br>        &quot;keyType&quot;: &quot;public-key&quot;,<br>        &quot;keyAlgorithm&quot;: &quot;ECDSA&quot;,<br>        &quot;keyCurve&quot;: &quot;P-256&quot;,<br>        &quot;keyValue&quot;: &quot;xxxxx&quot;,<br>        &quot;rpId&quot;: &quot;google.com&quot;,<br>        &quot;userHandle&quot;: &quot;user_handle&quot;,<br>        &quot;userName&quot;: &quot;user_name&quot;,<br>        &quot;counter&quot;: &quot;0&quot;,<br>        &quot;rpName&quot;: &quot;Google&quot;,<br>        &quot;userDisplayName&quot;: &quot;Vishwa&quot;,<br>        &quot;discoverable&quot;: &quot;true&quot;,<br>        &quot;creationDate&quot;: &quot;2025-12-20T14:50:16.407Z&quot;<br>      }<br>    ]</pre><p>The relying party, known as rp is the application. Storing the ID and name of it comes in handy during the verification phase. This is what eliminates phishing attacks, as those attacks are primarily done on sites with different domains from the actual ones.</p><h4>Verirification</h4><p>Now, let&#39;s come to the crucial part, which makes the entire flow seamless and effortless. If you try to log in to the application using a passkey, the application will send a challenge and RPID.</p><p>Once the challenge is received by the password manager, the password manager prompts the user for some kind of interaction, either to use biometrics or press a button. In this user interaction, the private key is taken, and the challenge received is signed using the private key and is sent back to the application.</p><pre>{<br>  &quot;id&quot;: &quot;AK-r2A2ophbN_fw_xsHxP3z-l-5SVcbZi5Ez9oLgWrY&quot;,<br>  &quot;raw_id&quot;: &quot;AK-r2A2ophbN_fw_xsHxP3z-l-5SVcbZi5Ez9oLgWrY&quot;,<br>  &quot;response&quot;: {<br>    &quot;client_data_json&quot;: &quot;eyJ0eXBlIjoid2ViYXV0aG4uZ2V0IiwiY2hhbGxlbmdlIjoiWGE2RGdfRTB5TFVZelBja05URDBER2pEcHZtX2JKRDhmazZnbHZJUDc3YyIsIm9yaWdpbiI6Imh0dHA6Ly9sb2NhbGhvc3Q6NTAwMCIsImNyb3NzT3JpZ2luIjpmYWxzZX0&quot;,<br>    &quot;authenticator_data&quot;: &quot;SZYN5YgOjGh0NBcPZHZgW4_krrmihjLHmVzzuoMdl2MFAAAAAA&quot;,<br>    &quot;signature&quot;: &quot;MEUCID2sx44Y2iuVdeBZV8BXxeuRGPzsOrbmS0mTCQ6j25SzAiEAwYem5DpkU_oHjVJopmWCSYDUhJpxGtwb7fjZPgZmaKA&quot;,<br>    &quot;user_handle&quot;: &quot;1EUqUv7528w&quot;<br>  },<br>  &quot;authenticator_attachment&quot;: &quot;platform&quot;,<br>  &quot;type&quot;: &quot;public-key&quot;<br>}</pre><p>After receiving the signed challenge back, the application uses the public key it has to verify whether it has been signed by the actual user. Once it verifies it, <strong><em>Congratulations, you are logged in 🥳</em></strong></p><h3><strong>Conclusion</strong></h3><p>Passkeys may feel like magic on the surface, but under the hood, they are the result of decades of careful cryptographic design and standardisation. By combining public-key cryptography, digital signatures, and strict domain binding, passkeys eliminate the need to share secrets while still providing strong authentication guarantees.</p><p>I had previously looked into authenticators out of curiosity, mainly because they were interesting as a security primitive. Looking at passkeys through the same lens makes it clear how those ideas come together in a more user-friendly form. Understanding the cryptography behind passkeys makes the authentication flow easier to reason about and easier to trust.</p><h3>References</h3><ul><li><a href="https://www.youtube.com/watch?v=xYfiOnufBSk">https://www.youtube.com/watch?v=xYfiOnufBSk</a></li><li><a href="https://www.youtube.com/watch?v=Qiy_s-WpURc&amp;t=1341s">https://www.youtube.com/watch?v=Qiy_s-WpURc&amp;t=1341s</a></li><li><a href="https://cryptobook.nakov.com/asymmetric-key-ciphers/elliptic-curve-cryptography-ecc">https://cryptobook.nakov.com/asymmetric-key-ciphers/elliptic-curve-cryptography-ecc</a></li><li><a href="https://dev.to/vincenzoiozzo/passkeys-deep-dive-security-and-implementations-considerations-557c">https://dev.to/vincenzoiozzo/passkeys-deep-dive-security-and-implementations-considerations-557c</a></li><li><a href="https://fidoalliance.org/passkeys/">https://fidoalliance.org/passkeys/</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0191bb922113" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Embracing Laziness: Smartening the Dumb]]></title>
            <link>https://medium.com/@vishwanathnarayanan29/embracing-laziness-smartening-the-dumb-2f9a135f014d?source=rss-8eeb9348ede0------2</link>
            <guid isPermaLink="false">https://medium.com/p/2f9a135f014d</guid>
            <category><![CDATA[diy-projects]]></category>
            <category><![CDATA[electronics]]></category>
            <category><![CDATA[home-automation]]></category>
            <category><![CDATA[iot]]></category>
            <category><![CDATA[esphome]]></category>
            <dc:creator><![CDATA[Vishwanath N]]></dc:creator>
            <pubDate>Sun, 27 Jul 2025 15:00:09 GMT</pubDate>
            <atom:updated>2025-07-27T15:00:09.055Z</atom:updated>
            <content:encoded><![CDATA[<p>This blog is a journal of my journey in finding a solution to a problem at home using something that I’m very fond of — the <strong>Internet of Things.</strong></p><h3>The Problem</h3><p>Late in the night, when my air conditioner is blasting cold air, it might get cold beyond a point or being someone from Chennai, the temperature during the nights might get high, and it will get sweaty. That’s usually when I start looking for my AC remote, and as you guessed, it will never be available in the bed (Ironically, it magically appears only after I switch on the light). It was easier to find my mobile phone than to find my AC remote.</p><p>I get it, people, it’s a very silly problem. I could solve it using a timer in AC or by being more cautious when keeping the remote away. But hey, it&#39;s still a valid problem and what better situation to put an engineer in?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HrcCf3qsLlfY5nyb" /><figcaption>The struggle (AI generated)</figcaption></figure><p>As always, there are numerous solutions to a problem. There are easier ones, there are harder ones. Let us look at them.</p><h3>The Easier Solutions</h3><ol><li>Keep the remote in an easily findable place. Maybe get a remote holder, stick it near the bed and use it to keep the remote.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/225/0*uYlAGu_OAemCZuPv" /><figcaption>Remote holder from Amazon</figcaption></figure><p>2. Use the built-in features provided by the AC company for this situation</p><p>3. Get a smart IR hub to control the IR devices using the phone or smart home devices.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*U7WbraDbj2fVnSVH" /><figcaption>An example of IR Control Hub</figcaption></figure><p>Sure, those are some of the easier options, but let’s be honest, there’s no thrill in using them. It felt boring. So, how about we build our solution? It’s the harder route, but guess what? I chose it because it’s <strong>fun</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/266/0*CgKrFhBn5YfNGn98.gif" /></figure><h3>The Hardware in Hand</h3><p>I started with an Arduino UNO paired with an 1838 infrared receiver module. To send signals back, I used a KY-005 38KHz infrared transmitter. Since I eventually wanted to connect everything to the internet for the final prototype, I went with a NodeMCU ESP8266 V3 Lua CH340 WiFi dev board</p><h3><strong>The First Idea</strong></h3><p>The idea behind it was pretty simple. I had a bunch of sensors lying around in my home, which I got a couple of years back. The idea is to record the AC remote signals using an IR receiver and store the HEX codes, and repeat them through an IR emitter. The inspiration for this idea is the <strong>Tata Sky Remote. </strong>There was a time when Tata Sky was a huge player. They had an amazing feature in their remote. This feature allows you to capture your normal TV signal and use the Tata Sky remote to control the set-top box as well as the TV.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/686/0*i5yj0nuyXTjU03RZ" /><figcaption>Tata Sky remote to repeat TV remote signal</figcaption></figure><p>I thought this was easy, and it would work. But my small brain didn’t think about the complexities behind this. Capturing AC remote signals and repeating them is not as easy as repeating a TV remote. The reasons are as follows</p><ul><li>Full State Transmission — Unlike TV, the AC remote sends the full state of the remote, including all the values and not just the values that are changed.</li><li>Proprietary Protocols — TV manufacturers use some open source protocols, like NEC, whereas AC manufacturers use proprietary protocols. Hence, they have a custom checksum and CRC validation</li><li>Large Signal Lengths — Since they send the full state, the signal lengths are large, meaning it is not easy to capture and repeat.</li></ul><p>These are some of the problems in capturing and repeating the signals. But I did try it and captured a few signals.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TBaqOAe4kJQ43bpPZqiJPA.png" /><figcaption>Code values of various commands</figcaption></figure><h3>The Second Idea</h3><p>I get it, I’m not the best Software Developer/Engineer out there because instead of googling or using ChatGPT for the problem, I jumped directly. I was one Google search away from finding some cool repositories by some amazing people. I have given below a few such repositories.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5lHXm7nuLJ1l5z4o" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EJWVeDcV4BoBtnor" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*limvnyveBhEsKCx5" /><figcaption>A server with IR component</figcaption></figure><p>These amazing humans have done what I wanted to do and have open-sourced it as well. They have accomplished the complex task of capturing and repeating the IR signals. This is how the solution works</p><ul><li>A Web server is spun up using the ESP8266 Web Server.</li><li>The server handles the incoming request and calls a method.</li><li>It then parses the incoming request and calls the appropriate method using the library.</li><li>IRremoteESP826 library is used to send the desired IR signal.</li><li>Then this change is reflected in the UI.</li></ul><p>Below is the final UI that will be rendered using the web server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*0f8FuHwEm09rZ6YLlbxExg.png" /><figcaption>Thanks to Claude for getting me the perfect UI</figcaption></figure><h3>Still wasn’t satisfied — More Googling and Redditing</h3><p>The solution above was more than enough for my problem. But I wasn’t satisfied yet. I kept searching, and that’s when I came across <a href="https://esphome.io/">ESPHome</a> — a treasure for DIY enthusiasts who are into IoT and Home Automation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cg68Obdd3Pk4fpha" /><figcaption>Finding a treasure while searching internet (AI generated image)</figcaption></figure><h3>What is ESPHome</h3><p>ESPHome is an open-source firmware framework that simplifies the process of creating custom firmware for popular WiFi-enabled microcontrollers. Sounds pretty simple, right? But no. It makes the entire process very easy and manageable. All I need to do now is manage a bunch of YAML configuration and not any complex C++ code.</p><p>It works by compiling the custom YAML we have written into a custom firmware. This firmware is then flashed onto the ESP board, making it run our custom-made firmware, which fits our requirements.</p><h3>Why ESPHome</h3><ul><li>No coding, just configure with simple YAML</li><li>Built-in support for IR remotes and a wide range of sensors and other components for a smart home</li><li>Seamless Home Assistant integration, which is again an open-source home automation and smart devices management hub.</li><li>We can send OTA (Over-the-Air) updates to update the code</li><li>It has a large community &amp; good documentation</li><li>It provides an in-built web server for accessing the sensor details. It supports a wide array of communication protocols.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*iO130ObCVWgbIIojZdY1uQ.png" /><figcaption>Final YAML for controlling AC</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YqpqHhU-t51udeCC.png" /><figcaption>Web UI given by ESPHome</figcaption></figure><h3>Future Enhancements</h3><p>This project helped me find some amazing resources online, subreddits, and YouTube videos by which I understood the joy in building DIY home automation IOT stuff. Some of the wild ideas I have in my backlog are to enhance the current setup.</p><ul><li>Store the state from remote in a common database to keep my UI in sync with the actual values.</li><li>DIY Home server to host this home automation stuff, along with other self-hosted services. Also, making it accessible from anywhere around the world.</li><li>Smart home integration with Google Home</li><li>Turning on the AC when I’m near home, this idea was inspired by an old ad I used to see on TV during IPL breaks back in my childhood</li></ul><h3>Conclusion</h3><p>What started as a simple inconvenience turned into an exciting opportunity to build something meaningful with the Internet of Things. While it may seem like a small problem, I had an amazing time exploring and building a solution for it. This experience has opened up exciting possibilities in the world of DIY and home automation. Do stay tuned for what I&#39;m going to build in the future</p><h3>Resources</h3><ul><li><a href="https://github.com/danny-source/Arduino_DY_IRDaikin">Arduino_DY_IRDaikin</a></li><li><a href="https://github.com/blafois/Daikin-IR-Reverse">Daikin-IR-Reverse</a></li><li><a href="https://github.com/andreacucci/IR-Daikin-Server-ESP8266">IR-Daikin-Server-ESP8266</a></li><li><a href="https://esphome.io/">ESPHome</a></li><li><a href="https://vishaworld.com/products/ky-005-38khz-infrared-ir-transmitter-sensor-module">KY-005 38KHz</a></li><li><a href="https://robu.in/product/nodemcu-esp8266-v3-lua-ch340-wifi-dev-board/">NodeMcu ESP8266 V3 Lua CH340 Wifi Dev. Board</a></li><li><a href="https://techiesms.com/product/infrared-ir-receiver-module-pcb-mounted-sensors-for-arduino-esp-boards/">1838 Infrared Receiver Module</a></li><li><a href="https://robu.in/product/arduino-uno-r3-ch340g-atmega328p-devlopment-board/">Arduino Uno</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2f9a135f014d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building AI Agents: My Journey, Learnings, and Insights]]></title>
            <link>https://medium.com/@vishwanathnarayanan29/building-ai-agents-my-journey-learnings-and-insights-d7784a098a6e?source=rss-8eeb9348ede0------2</link>
            <guid isPermaLink="false">https://medium.com/p/d7784a098a6e</guid>
            <category><![CDATA[crew-ai]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[ai-agent-development]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Vishwanath N]]></dc:creator>
            <pubDate>Sun, 16 Mar 2025 05:27:36 GMT</pubDate>
            <atom:updated>2025-03-16T05:27:36.262Z</atom:updated>
            <content:encoded><![CDATA[<p>Today, I’m back with another blog, sharing my recent experience working with AI Agents. This blog is my personal experience with building AI agents and working with them. This might be slightly biased towards Crew AI’s agentic framework as I worked with them, but I believe most of the AI agents must be similar.</p><h3><strong>AI Agents</strong></h3><p>AI agents are an enhanced version of the traditional LLMs in the market. We give inputs to the LLMs and get an output from them, but then a manual intervention is required to refine the output. AI agents on the other hand function differently, instead of us intervening in the process, the agent in itself will look at the progress and tune itself accordingly. This makes them <strong>more intelligent and adaptable</strong>, requiring little to no manual oversight.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bI2ETxMXDBCIuFD5.jpg" /></figure><h3><strong>Agents Vs LLM Vs RAG</strong></h3><p>When working with AI, we often hear about LLMs, RAG, and AI Agents, but how do they differ?</p><p><strong><em>LLM</em></strong></p><ul><li>LLMs are good at text generation. You give it a prompt and it can predict what comes next and gives out really good textual content.</li><li>However they have a few limitations like knowledge cut-off and inability to update themselves.</li></ul><p><strong><em>RAG</em></strong></p><ul><li>One main limitation of LLMs is that they are trained on a certain subset of data and are not able to be updated with any of the latest information.</li><li>This is where RAG comes in. In RAG, the input query is processed in such a way that we fetch the necessary information associated with the query and feed this data along with the input query to LLM to give it a better context. This relevant document along with the input query makes LLM churn out better results.</li></ul><p><strong><em>AI Agents</em></strong></p><ul><li>Both RAG and LLM excel in text generation but they require manual intervention to work properly, and they do not self-correct. They also cannot repeat tasks, if we give an input they throw an output.</li><li>AI Agents automate repetitive workflows, making them ideal for tasks that require ongoing decision-making and iteration without human involvement.</li></ul><h3>Key Elements of AI Agents</h3><h4><strong><em>Backstory</em></strong></h4><ul><li>The backstory is the foundation of these agents. This backstory needs to be as clear as possible. It sets up the initial context for the AI agent. It is what gives agents an idea of what they know, and how they should behave and enables it to start with the right mindset.</li></ul><p><strong><em>Role</em></strong></p><ul><li>The role gives an agent what it is supposed to do. Whether it is a customer support person, researcher etc. It gives the agent an idea of from which role it is supposed to think and gives it a better perspective on things.</li></ul><p><strong><em>Goal</em></strong></p><ul><li>A goal helps the agent to think about the end state it needs to get to. It helps the agent to look at the task at hand, and the necessary steps it is required to take to achieve it. It gives a purpose for the agent.</li></ul><p>The agent sets the mood with the <strong><em>backstory</em></strong>, thinks from the perspective of the <strong><em>role </em></strong>and<strong><em> </em></strong>looks at the <strong><em>goal</em></strong> it needs to achieve.</p><h3>Multi-Agent System</h3><p>Now that we have a clear understanding of what is an agent, let us look into what is a multi-agent system. A multi-agent system has two or more agents working together for a larger goal. With this definition in place, a question raises</p><blockquote><strong><em>Why do we need a multi agent system? Why can’t a single agent do everything?</em></strong></blockquote><p>The thing about these agentic systems is that, they can easily hallucinate and they tend to think outside of what is necessary making it difficult for it to reach the goal. To solve this, we can split the goal into smaller subtasks, completing which will give us the result. We can assign separate agents for these tasks.</p><p>One of the things that the Crew AI team suggests is to look at the goal from a CEO perspective. Think from the shoes of a CEO, if you have a problem to solve, who are the people you would hire? These people whom you would hire are nothing but agents. Say you are starting an online blog platform, that hosts content as well as creates content. The following are the steps we would take to create more content.</p><ol><li>We would do is hire a researcher, who would research the market on trending topics in various domains and identify topics to write content on.</li><li>We would hire a content writer, who write the content.</li><li>We would hire an editor who would read through the content review it and change it.</li></ol><p>Now when you look at this scenario from a multi-agent system’s perspective, we have three agents.</p><ol><li>Researcher agent</li><li>Content writer agent</li><li>Editor agent</li></ol><p>Each agent in this system has a <strong>specific role</strong>, making the workflow <strong>structured, efficient, and autonomous.</strong></p><h3>Tools</h3><p>Agentic systems can only be pushed to a certain extent. They are trained with a certain data set, which can only be used to generate data to some limit beyond which they become redundant. However, this will not be sufficient in the long run or if complex tasks are given. This is where the role of tools comes in. Tools are enablers for agentic systems. They enhance the agents and make them more powerful. Agents can a<strong><em>ccess the internet, do complex mathematical operations, and integrate with external systems</em></strong> with the help of these tools.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/217/1*Dasscin14D8DIeiRY9zFxw.jpeg" /></figure><p>Let us take an example scenario through which you would understand the importance of tools. <br>Say you are given two numbers, 2 and 3 and you are asked to add them, it is simple, you easily add them because they are small numbers and we have prior experience in doing them. Then we are given bigger numbers say, 354812354 and 98798632, you would still be able to add them if paper and pen are given. Now you are given these numbers and are asked to multiply, now the pen and paper might not be sufficient hence a calculator would be helpful. Finally, you are given a table with 2 columns with 10 rows of numbers. It would be easier to calculate the sum if we had spreadsheets in hand. If we breakdown the above the tools are as follows</p><ol><li>Fingers</li><li>Pen and paper</li><li>Calculator</li><li>Spreadsheets</li></ol><p>You can do all the calculations using all these tools, you can add 2 and 3 using any of them but then you will choose the relevant one. This is how exactly agents work, they look at the task, look at the tools they have and use the necessary tools for help. By leveraging the tools agents can perform complex tasks efficiently and easily.</p><h3><strong>Traditional Software Development vs. Agent-Driven Software Development</strong></h3><p>In traditional software development we tend to write a lot of code. We tend to repeat similar code all over the application which gets redundant after a point of time. We write code in way we want the application to work.</p><p>For example, if we need to fetch data from a database, we must:</p><ul><li>Set up a database connection</li><li>Write queries</li><li>Handle errors</li><li>Process and return the data</li></ul><p>We focus on the <strong><em>“how”</em></strong>, explicitly defining every aspect of implementation.</p><p>In Agent driven development we write very minimal code. With the current state of agent driven development, the code that we get from agent might have some minor bugs here and there which can be fixed easily and hence making it production ready. The whole idea revolves around saying <strong><em>what needs to be done </em></strong>rather than saying <strong><em>how it needs to be done.</em></strong></p><p>We can also have multiple agents working together to streamline the process:</p><ul><li>A Planner Agent that outlines the overall development process</li><li>A Coder Agent that generates the actual code</li><li>A QA Agent that writes and runs tests</li></ul><h3><strong>My learnings</strong></h3><ol><li>Everything is about the prompt. If you give the agents a nice clear descriptive prompt, they will be able to think properly and achieve the goal.</li><li>Tools make agents extremely powerful as they enable them to <strong>stay up-to-date, perform mathematical operations, and interact with external systems.</strong></li><li>Focus is really important. Giving too much information, and tools might make an agent think other than what it is supposed to do. Having a focused narrowed agent will be better.</li><li>Though making them focused is helpful, don’t try to spoon-feed things as well, because doing this will make them dumb. We need the right amount of focus.</li><li>Multi Agent systems are extremely powerful if we are able to break the task in hand into smaller focused agents.</li><li>Agents tend to hallucinate and think a lot, it is always better to keep the logs of their thought process in hand, as it will help us identify how it is thinking, what can we do to make things better etc. This can help us identify the amount of focus it might need.</li><li>Setting up guardrails is important when working with agents. The guardrails are nothing but boundaries we set to make the agent as focused as possible.</li><li>We need to be mindful of the API limits and the context length in hand. Since all these LLMs are hosted by third-party players, it is important to note that we will have certain API limits and context length in our hands and hence we need to take care of that as well.</li><li>Outputs from these agents tend to be fuzzy, we cannot say we will get the same response every time. One way to streamline the output is to use frameworks like Pydantic to get a deterministic output in terms of the data type we want.</li><li>Memory and caching will improve the overall development process as it tends to reduce the number of API calls and give them better context.</li></ol><p>These are things I wanted to share about working with AI agents. It was a great learning experience. With the current pace of AI and LLMs I think we would be soon in the phase of agent-based software development and developing more AI agents.</p><p><strong><em>Happy building and Happy Reading!!</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d7784a098a6e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How does Authenticator Work ]]></title>
            <link>https://medium.com/@vishwanathnarayanan29/how-does-authenticator-work-004c45536aee?source=rss-8eeb9348ede0------2</link>
            <guid isPermaLink="false">https://medium.com/p/004c45536aee</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[mfa]]></category>
            <category><![CDATA[authentication]]></category>
            <dc:creator><![CDATA[Vishwanath N]]></dc:creator>
            <pubDate>Sun, 01 Dec 2024 15:27:01 GMT</pubDate>
            <atom:updated>2024-12-01T15:27:01.648Z</atom:updated>
            <content:encoded><![CDATA[<h3>Behind the Scenes: How Your Authenticator Knows the Code 🤔🔢</h3><h3>Introduction</h3><p>For most of my online accounts, I use SMS based OTP authentication method for the Multi-Factor Authentication (MFA). But one place where I started to use an Authenticator-based verification system was AWS. I use AWS daily, and every day or two it prompts for this code for logging in. I have always wondered how this authenticator app works, how it communicates with the server and how the authentication works. So I started to dig deep into how it works and this blog contains my learning.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Q8k_ub5-7zTejXt1.jpg" /></figure><h3>Process of using the Authenticator</h3><p>The use of authenticator-based authentication is supported in many websites for the MFA. The process is similar for all of them</p><ol><li>First, when you click the option for using an authenticator app, a QR code will be displayed along with a code.</li><li>You need to scan this code using the authenticator app of your choice. There are many available in the market for example <strong>Google Authenticator and Microsoft Authenticato</strong>r. Once it is scanned, things are pretty much done.</li><li>When you log in again, the authenticator will show a code, you enter the code into the website and if it matches you are in.</li></ol><p>The interesting part is that there is<strong><em> zero communication between your authenticator app and the server</em></strong>.</p><h3>Key Generation</h3><p>Before we dive into how it works, we will take a detour and understand how the algorithms work. The algorithm that is used in the authenticator is <strong>Time Based OTP</strong>. This TOTP is a specialised implementation of <strong>Hash-based Message Authentication Code (HMAC) One-Time Password</strong> or <strong>HMAC-OTP</strong>. Sounds confusing? Let me explain</p><ol><li>The HMAC-OTP is a function that takes a counter and a secret and it spits out a key. Under the hood, it uses the algorithm that was specified earlier, along with the counter and secret, and generates the key.</li><li>Keeping track of the counter is a huge task, it requires additional effort. So to solve it, the TOTP uses <strong>time</strong> as the counter. Thereby eliminating the need for keeping track of the counter. For example<br> ◆ Let us take the Unix time of 1/12/24 1:00:00 which is <strong>1732995000</strong><br> ◆ Now let us divide it by 30 (time interval) which is 5,77,66,500<br> ◆ This is the counter that is passed to the algorithm</li><li>Once they are passed inside, there are various mathematical functions and bit manipulation that are run like padding, XORing etc</li><li>We get a huge output after this, so to make it human readable, we take the last 4 bits and use this to extract 4 bytes from the hash</li><li>We then convert this to the desired length using modulo</li></ol><h3>How does Authenticator work<br>Initial Setup</h3><p>The QR code has nothing but some basic information that is needed for the authenticator to work properly. The following is the URL that is in the QR code</p><pre>otpauth://totp/{issuer}:{account}?secret={secret}&amp;period={seconds}&amp;digits={number_of_digits}&amp;algorithm=SHA1&amp;issuer={issuer}</pre><ul><li>The company that has the account is known as the <strong>issuer</strong></li><li>The <strong>account</strong> is a unique identifier for your account like your username or email</li><li>The <strong>secret</strong> is a unique key which is used in the algorithm</li><li>The <strong>period</strong> is the amount of time the key is valid generally 30 seconds</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hE9JQ_C4GNNugu5lEZmK8A.png" /><figcaption>Initialization Process</figcaption></figure><p>Now the server and the authenticator app both store this information. The server combines this information with the user details and the authenticator combines this information with the issuer and stores it locally.</p><h3>Working</h3><ol><li>When you try to log in and open the authenticator app, it already has a code in it which will expire in 30 seconds. The authenticator app uses the above-mentioned algorithm and generates a key.</li><li>When we enter the key in the server, the server generates the key using the same algorithm and checks with the key we have entered. If it matches we are in, else we are thrown out</li><li>Now you might be having a question, I entered the key in the 20th second and due to network delay it reaches the server in the 25th second. Obviously, the time has changed, so how does the algorithm still hold? This is where the period part comes into the picture. Let us take the example scenario which was discussed earlier<br>◆ Unix time of <strong>1/12/24 1:00:00 </strong>— <strong>1732995000</strong><br>◆ Let us divide it by 30 we get <strong>5,77,66,500</strong><br>◆ This is the counter that is passed to the algorithm in the mobile app<br>◆ Let us consider that the server processes request at <strong>1/12/24 1:00:25</strong><br>◆ Unix time is <strong>1732995025</strong><br>◆ If we divide this by 30, we get <strong>5,77,66,500.83333333333</strong><br>◆ We take the floor of the number, it is still <strong>5,77,66,500</strong><br>◆ Since the counter is unchanged, we get the same key<br>◆ Now let us take <strong>1/12/24 1:00:31</strong> , the Unix time is <strong>1732995031</strong><br>◆ If we divide it by 30 we get <strong>5,77,66,501.03333333333</strong>.<br>◆ The counter has changed, so the key generated is different and it fails.</li><li>Generally, some servers are configured in such a way that they go easy on time, i.e. they check for the previous slot and the next slot as well for better user experience.</li><li>Now to the magical part, Yes you guessed it right, since there is no client-server communication the key will still work if your device is offline.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V5fpevR1qHFcsiVSSMNwDQ.png" /><figcaption>Working</figcaption></figure><h3>Conclusion</h3><p>I hope you learnt something from this blog. By knowing how these algorithms operate allows us to appreciate their design and thought processes behind it. It also provides us with the ability to make wise choices when putting safe authentication systems in place.</p><h3>References</h3><ul><li><a href="https://www.keepersecurity.com/blog/2023/07/20/what-are-authenticator-apps-and-how-do-they-work/">https://www.keepersecurity.com/blog/2023/07/20/what-are-authenticator-apps-and-how-do-they-work/</a></li><li><a href="https://medium.com/@tilaklodha/google-authenticator-and-how-it-works-2933a4ece8c2">https://medium.com/@tilaklodha/google-authenticator-and-how-it-works-2933a4ece8c2</a></li><li><a href="https://medium.com/nerd-for-tech/how-does-google-authenticator-work-2696fd5f0764">https://medium.com/nerd-for-tech/how-does-google-authenticator-work-2696fd5f0764</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=004c45536aee" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Custom ROMs! You beauty! ]]></title>
            <link>https://medium.com/@vishwanathnarayanan29/custom-roms-you-beauty-f34af806098f?source=rss-8eeb9348ede0------2</link>
            <guid isPermaLink="false">https://medium.com/p/f34af806098f</guid>
            <category><![CDATA[custom-rom]]></category>
            <category><![CDATA[open-source-software]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[apple]]></category>
            <dc:creator><![CDATA[Vishwanath N]]></dc:creator>
            <pubDate>Wed, 28 Aug 2024 17:12:16 GMT</pubDate>
            <atom:updated>2024-08-29T05:35:36.588Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Custom ROMs</strong>, sounds like an alien term to me, so what is that? How does that work? Before we get into the actual stuff, I would like to apologise to the guys who built Apple. Sorry Steve Jobs &amp; Steve Wozniak!!</p><blockquote>Definition of Custom ROM</blockquote><blockquote>In Android, installing custom firmware, colloquially known as installing a custom ROM or Android ROM, is replacing the system partition of the Android Operating System usually mounted as read-only, with a modified version of Android, also known as “flashing a ROM”.</blockquote><h3>Android &amp; the Open Source Glory</h3><p>Android is an open-source software, licensed under Apache License 2.0. The core principle of Android is that it can be used by anyone, anywhere. It aims to have wider adoption. This is the core idea of Android and its open-source nature. This implies that there are thousands and thousands of Android implementations. These implementations are developed by people from huge organizations to tiny hobbyists. The Android Open Source Project or AOSP is the core for everything.</p><h3>Custom ROM &amp; Me</h3><p>It was December 2018 when I first got my smartphone. It was a <strong>Redmi Note 3</strong>. It was the best smartphone under 15000 at that time. Redmi was crushing the smartphone market back then.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wHQpzxaDkZDhPF0R.jpg" /><figcaption>Where it all started</figcaption></figure><p>I used it for an year and got bored of the software, <strong>MIUI</strong> was shit back then as well. Everyone was into customizing their smartphone like changing wallpaper, trying custom themes, changing icon packs etc. Youtube videos on customizing smartphones were skyrocketing back then. But still, it was MIUI under the hood, which I hated. So I googled on changing the OS of the smartphone. That’s when I stumbled upon the exciting world of Custom ROMs. You could try the stock Android experience without getting a Nexus or a Pixel smartphone, sounds too good to be true, but it was indeed true.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zer5Oj_hNb6mT3roQdWQEg.png" /><figcaption>The OG Pixel 1</figcaption></figure><p>I searched YouTube, watched various tutorials and made myself confident enough to try it out. I was risking it because if I missed something or made a mistake my phone would eventually <strong>brick</strong> i.e. a state which the phone cannot be used anymore. But what is life without risk, followed every step with utmost sincerity and guess what I successfully installed it. It was a tiny step in the direction of what I would term as<strong> “Freedom in Android”</strong>. I tried different custom ROMs. I got to try the latest in Android and test all the features without paying anything extra. Life was so good.</p><p>After this, I made up my mind that I will buy only Redmi smartphones, the reason is simple, Redmi phones were cheap, and had amazing hardware but shitty software meaning there were a bunch of developers pushing excellent and stable custom ROMs, even more, stable than what MI could pull off. The next phone I got was the <strong>Redmi Note 5 pro</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/377/0*IfPyMeD7U3OWKZ90.png" /><figcaption>Redmi Note 5 Pro — Custom ROM devs loved it</figcaption></figure><p>The custom ROM support was off the charts for this. You wanted a gaming-specific custom ROM? You got it. Need an ultra-smooth stock Android experience? You got it. Looking for the pure taste of Android without Google? You got it. Want a fully personalized experience? The community has you covered.</p><p>This is when Oneplus was also making really good smartphones. Oneplus smartphones were known for their amazing software, <strong>Oxygen OS</strong>. So what a person with Redmi would do, obviously check for Oxygen OS ports for the phone, and guess what the community served me that as well. I tried the latest and greatest Oxygen OSs with the latest features even before some official Oneplus smartphones</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5B9YuxBsvjS463lmKPZlUw.png" /><figcaption>Oxygen OS before the Color OS merger was EPIC</figcaption></figure><p>After a point, it started to get boring, so that’s when I came across <strong>rooting.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/737/0*5VLhAW-WxeDzKHe_" /><figcaption>GOD level access</figcaption></figure><p>I rooted my smartphone and opened up a whole new world of possibilities. I added tons of modules, like stereo speaker support, boosted processing power, and enhanced battery life. Every tweak made the experience more and more exciting. Customizing my device to perfection, experimenting with features, and pushing the limits and making it personalised. It turned my phone into a powerhouse, making life so much more fun and interesting.</p><p>The community was so active in bringing out new things day in and day out. The community was doing much better than phone manufactures.</p><h3>A general overview of steps</h3><p>The steps are similar in many smartphones, though there can be slight variations.</p><ol><li>The initial step is to take a backup of all the data you have</li><li>To install the custom ROM, you need to unlock the bootloader. This bootloader is what enables us to remove the existing ROM and write the one that we like. We use the Android Debug Bridge — [ADB](<a href="https://developer.android.com/tools/adb%29CLI">https://developer.android.com/tools/adb)CLI</a> tool. We go into the fast boot mode by pressing a combination of buttons (like power and volume down or volume up), then we execute commands using ADB to unlock the bootloader</li><li>We then install a custom recovery, this is like a BIOS screen in your computer that gives us mechanisms to delete ROM, flash the new one, format disk etc. The popular ones are TWRP and Orange Fox. We get into the custom recovery screen using a combination of buttons similar to the flow of going into the fast boot mode.</li><li>Download the ZIP of the custom ROM you need, and put it in an external storage like a USB or an SD card.</li><li>Get into your custom recovery, erase the existing ROM and install the new one.</li></ol><p>Though these steps differ from smartphone to smartphone, the core idea remains the same. If you are stuck in something or need to know where to start, the below three sites will help out</p><ul><li><a href="https://xdaforums.com/">XDA Forums</a></li><li>Youtube</li><li>Telegram channel specific to your phone</li></ul><h3>Why Custom Roms &amp; Android matter ?</h3><p>You must be wondering, why does a normal user like me need to be aware of this and how does it matter? The truth is it doesn’t matter to you. At the end of the day these small things make up what Android is and how your life has been made better by open source community. In simple terms it might look like customizing your phone but when you think a little higher than it, its the ideology of open source and community driven developement that makes lives of millions of people better everyday.</p><p>Unlike the competition(🍎), the opensource nature helped android reach every corner of the world. Android has given you <strong>freedom. </strong>You must be wondering, how is that so. Right from giving you the freedom of choosing the right phone for you instead of giving you what you want. The company doesn’t choose what you deserve, instead you search for what you want. You want a phone under 10000, you have it, you want a phone under 50000, you have it. You have any budget, android got you covered.</p><p>There is a significant amount of contribution to the world of android done by these custom roms. Apart from this, here are a few things about the advantages of using one,</p><ul><li>It can increase the lifespan of the smartphone</li><li>We can unlock the full potential of our smartphone</li><li>Can learn a lot about how android works, and the internals of it.</li><li>Holding the open source ideology and which in turn means software by the people for the people.</li><li>And most improtantly it is <strong>extremly FUN!!!</strong></li></ul><p>However, the custom ROM community has become very boring lately, and many people including myself have moved from testing out new things to working smartphones. A lot of famous custom ROMs have shut down due to high maintenance and a lack of enthusiastic community members. Pixel experiences one of the largest and most stable custom ROMs which shut down its functioning 6 months back. But its just a matter of time, when Android and custom ROMS get backs to its full glory.</p><p>And finally, here’s my take (a hot take, though) on Apple!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*Of1S8nggVofDM2Bg.jpg" /><figcaption>Replace NVIDIA with Apple</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f34af806098f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Passing in Local, failing in CI and then failing in Local]]></title>
            <link>https://medium.com/@vishwanathnarayanan29/passing-in-local-failing-in-ci-and-then-failing-in-ocal-6c2bbb2ce45b?source=rss-8eeb9348ede0------2</link>
            <guid isPermaLink="false">https://medium.com/p/6c2bbb2ce45b</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[timezone]]></category>
            <category><![CDATA[datetime]]></category>
            <category><![CDATA[jest]]></category>
            <dc:creator><![CDATA[Vishwanath N]]></dc:creator>
            <pubDate>Sun, 14 Jul 2024 07:13:21 GMT</pubDate>
            <atom:updated>2024-07-15T05:46:51.903Z</atom:updated>
            <content:encoded><![CDATA[<p>It was a random Thursday when I was working on the front-end codebase of our application. I already raised a PR, so the ci was all set in GitHub. So I wrote the tests in jest and ran the “npm run test” and voila everything was green and perfect. I was done with it, pushed it to the remote and went for lunch. When I returned, I received a mail saying “Actions failed” with a huge red light. I was shocked, I logged into the actions logs and saw my tests were failing. It was very weird. Just to check if no one else has pushed, I pulled the code and it said “Everything is up to date “. Still, I wasn’t sure, I ran tests again, and it passed. Then I opened vs code and checked all the code as well, it was just as I expected, and then I ran the tests again. It failed. So it goes like <strong><em>Passed locally -&gt; Failed in CI -&gt; Failed Locally</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*y-R-1wE92fD-BPHe" /></figure><p>So I started to dig deep to solve this issue. I found the test which was failing, it was a test related to date and its formatting. When I went into the code base and saw the code, it was doing the following ( In actual codebase, we get the date and do a bit of manipulation, for purpose of simplicity I have removed the logic)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/714/1*kQKEMz0QgXmenAiBOfkUZA.png" /><figcaption>Sample Codebase</figcaption></figure><p>So our assert was like this,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/924/1*TwFQVulxM1IH24Wq3TPkrg.png" /><figcaption>The actual Test</figcaption></figure><p>When I ran this test using iTerm2 the condition validated but in case of default Mac OS terminal and in CI, the condition failed. When I dig deep into the issue, I found some interesting stuff.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/476/1*V0z9FfigWkZJgtz5-rDknw.png" /><figcaption>macOs Terminal</figcaption></figure><p>Here I explicitly set the language as English US</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/876/1*IPMYL6hbKfw7Ul4MV_QVAg.png" /><figcaption>iTerm2 Terminal</figcaption></figure><p><strong>Language and Local Format</strong><br>The language that I had in my iTerm2 terminal was “English-UK” which was explicitly set by me long ago. So when I run the test in iTerm2 terminal using node, the node environment picks up the language of the terminal and thereby calculate the date format. Since we wanted the date format to be “dd/mm/yyyy”, the English UK worked. But in case of the Mac OS terminal or in CI, the date format might be English US which is why the date format was “mm/dd/yyyy”. The first picture is the default Mac OS terminal and the second one is iTerm.</p><p><strong><em>We fixed this issue in the codebase by explicitly formatting using “en_GB” format</em></strong></p><p><strong>Learnings</strong></p><ul><li>Be a bit more cautious when dealing with date and time formatting</li><li>Write proper test cases, and never live with assumptions</li><li>Read through the documentation properly</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6c2bbb2ce45b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>