<?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 Abhishek Gaddi on Medium]]></title>
        <description><![CDATA[Stories by Abhishek Gaddi on Medium]]></description>
        <link>https://medium.com/@abhishekg_79562?source=rss-8c89e155fee0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*BiW9y8_j5nz_C9Fo</url>
            <title>Stories by Abhishek Gaddi on Medium</title>
            <link>https://medium.com/@abhishekg_79562?source=rss-8c89e155fee0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 20:21:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@abhishekg_79562/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[Generate JWT Access Tokens in Keycloak Without Client Secrets (Using Private Key JWT)]]></title>
            <link>https://medium.com/@abhishekg_79562/generating-access-tokens-in-keycloak-without-client-secrets-using-private-key-jwt-1837b0db3453?source=rss-8c89e155fee0------2</link>
            <guid isPermaLink="false">https://medium.com/p/1837b0db3453</guid>
            <dc:creator><![CDATA[Abhishek Gaddi]]></dc:creator>
            <pubDate>Wed, 04 Feb 2026 10:57:23 GMT</pubDate>
            <atom:updated>2026-02-05T05:04:07.951Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y0iSVf_6eR4p23jcrOXcTA.png" /><figcaption><strong>Keycloak access token flow using Private Key JWT (no shared secrets).</strong></figcaption></figure><p>Modern systems increasingly avoid long-lived client secrets in favor of stronger, more manageable authentication mechanisms. If you’re using <strong>Keycloak</strong> with <strong>client credentials</strong> and <strong>client secrets</strong>, this guide shows how to switch to <strong>private key JWT (JWS-based client authentication)</strong> — and why this is a better fit <strong>specifically for Keycloak</strong>.</p><blockquote><em>This article focuses on </em><strong><em>Keycloak’s client authentication model</em></strong><em>. It does not attempt to generalize behavior across all OAuth or OpenID Connect providers.</em></blockquote><h3>Why move away from client secrets (Keycloak-specific)</h3><p>Before getting into the implementation, it’s important to understand how <strong>client secrets work in Keycloak</strong>.</p><p>In Keycloak database, a <strong>client secret is neither a hash</strong> <strong>nor encrypted</strong> . It must be retrievable in plaintext form at runtime, because Keycloak needs the original value to validate client authentication requests.This leads to a few practical issues.</p><h3>Secrets are hard to keep secret</h3><p>In real deployments, client secrets often end up in:</p><ul><li>Application configuration files</li><li>CI/CD pipelines</li><li>Logs or debug output</li><li>Shared documents or chat messages</li></ul><p>A single leak allows an attacker to <strong>impersonate the client</strong> until the secret is rotated.</p><h3>Audit and visibility limitations</h3><p>Because the secret is stored by Keycloak:</p><ul><li>Privileged administrators may be able to view or reset it</li><li>Secrets may appear in backups or exports</li><li>It is difficult to prove who accessed the secret and when</li></ul><h3>How private key JWT changes this in Keycloak</h3><p>When using <strong>private key JWT</strong> with Keycloak:</p><ul><li>The <strong>client holds a private key</strong></li><li>Keycloak stores <strong>only the public key</strong></li><li>Authentication uses <strong>signed JWT assertions</strong>, not shared secrets</li></ul><p>As a result:</p><ul><li>There is <strong>no client secret</strong> to view, reset, or export</li><li>Nothing sensitive is stored in Keycloak’s database</li><li>Even if Keycloak data is leaked, <strong>no client credential is exposed</strong></li></ul><p>This is a Keycloak-supported alternative that removes the need for client secrets entirely.</p><h3>What changes in your Keycloak setup?</h3><p>At a high level, you will:</p><ol><li>Configure the client in Keycloak to use <strong>private key JWT</strong> instead of a client secret under the client settings.</li><li>Register the client’s <strong>public key</strong> in Keycloak</li><li>Update token retrieval logic to:</li></ol><ul><li>Sign a JWT with the private key</li><li>Send it as a <strong>client assertion</strong> to the token endpoint</li></ul><blockquote><strong><em>Important:</em></strong><em> Keycloak supports only </em><strong><em>one client authentication method per client</em></strong><em>.<br>You cannot use </em><strong><em>client secrets</em></strong><em> </em><strong><em>authentication </em></strong><em>and private key JWT at the same time.</em></blockquote><h3>Step-by-step implementation to generate an access token using Private Key JWT</h3><p>This section walks through the complete end-to-end flow of how a client authenticates with Keycloak and obtains an access token using private key JWT.</p><h3>STEP 1: Generate a key pair (client-side)</h3><pre># private key<br>openssl genpkey -algorithm RSA -out client.key -pkeyopt rsa_keygen_bits:2048</pre><pre># public key<br>openssl rsa -pubout -in client.key -out entity_public_key.pub</pre><p>Keep the private key secure:</p><ul><li>Store in a vault or KMS</li><li>Restrict filesystem access</li><li>Never commit to source control</li></ul><h3>STEP 2: Convert public key to JWK (recommended)</h3><pre>npm install -g pem-jwk<br>pem-jwk entity_public_key.pub &gt; client.jwk.json</pre><p>Example:</p><pre>{<br>  &quot;kty&quot;: &quot;RSA&quot;,<br>  &quot;alg&quot;: &quot;RS256&quot;,<br>  &quot;use&quot;: &quot;sig&quot;,<br>  &quot;n&quot;: &quot;...&quot;,<br>  &quot;e&quot;: &quot;AQAB&quot;,<br>  &quot;kid&quot;: &quot;client-key-1&quot;<br>}</pre><p>Ensure kid is set for rotation.</p><h3>STEP 3: Configure the client in Keycloak</h3><ul><li>Client type: <strong>Confidential</strong></li><li>Protocol: <strong>OpenID Connect</strong></li><li>Authentication method: <strong>Private Key JWT</strong></li><li>Token endpoint auth signing alg: <strong>RS256</strong></li></ul><h3>STEP 4: Upload the public key to Keycloak</h3><ul><li>Client → Keys → Client keys</li><li>Import the JWK</li><li>Use: <strong>Signature</strong></li><li>Algorithm: <strong>RS256</strong></li></ul><h3>STEP 5: Verify Keycloak configuration</h3><p>Confirm:</p><ul><li>No client secret exists</li><li>Only public keys are visible</li><li>No secret view/reset options appear</li></ul><h3>STEP 6: Create JWT assertion (client)</h3><p>JWT claims:</p><pre>{<br>  &quot;iss&quot;: &quot;my-secure-service&quot;,<br>  &quot;sub&quot;: &quot;my-secure-service&quot;,<br>  &quot;aud&quot;: &quot;https://keycloak.example.com/realms/myrealm/protocol/openid-connect/token&quot;,<br>  &quot;exp&quot;: 1710000000,<br>  &quot;jti&quot;: &quot;uuid&quot;<br>}</pre><h3>STEP 7: Sign the JWT (example: Node.js)</h3><pre>const jwt = require(&quot;jsonwebtoken&quot;);<br>const fs = require(&quot;fs&quot;);<br>const crypto = require(&quot;crypto&quot;);</pre><pre>const privateKey = fs.readFileSync(&quot;client.key&quot;);</pre><pre>const assertion = jwt.sign(<br>  {<br>    iss: &quot;my-secure-service&quot;,<br>    sub: &quot;my-secure-service&quot;,<br>    aud: &quot;https://keycloak.example.com/realms/myrealm/protocol/openid-connect/token&quot;,<br>    exp: Math.floor(Date.now() / 1000) + 300,<br>    jti: crypto.randomUUID()<br>  },<br>  privateKey,<br>  {<br>    algorithm: &quot;RS256&quot;,<br>    keyid: &quot;client-key-1&quot;<br>  }<br>);</pre><h3>STEP 8: Request token from Keycloak</h3><pre>curl -X POST \<br>  https://keycloak.example.com/realms/myrealm/protocol/openid-connect/token \<br>  -H &quot;Content-Type: application/x-www-form-urlencoded&quot; \<br>  -d &quot;grant_type=client_credentials&quot; \<br>  -d &quot;client_id=my-secure-service&quot; \<br>  -d &quot;client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer&quot; \<br>  -d &quot;client_assertion=${ASSERTION}&quot;</pre><h3>Cons and trade-offs</h3><p>While private key JWT removes the need for client secrets in Keycloak, it introduces a few operational trade-offs.</p><ul><li><strong>Per-request JWT generation</strong><br> A new JWS must be created and signed for every access token request.</li><li><strong>Key pair management and rotation</strong><br> Clients must securely store private keys and manage key rotation.</li><li><strong>Higher client-side complexity</strong><br> Clients must correctly handle JWT claims and signing; misconfiguration (aud, exp, kid) can lead to authentication failures that are harder to debug.</li></ul><h3>Summary</h3><p>Using <strong>private key JWT in Keycloak</strong>:</p><ul><li>Removes client secrets entirely</li><li>Uses asymmetric cryptography for client authentication</li><li>Improves security, auditability, and operational simplicity</li></ul><p>This is a <strong>practical, supported improvement in Keycloak</strong>, not a theoretical OAuth change.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1837b0db3453" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Redis Is Fast Despite Being Single-Threaded]]></title>
            <link>https://medium.com/@abhishekg_79562/why-redis-is-fast-despite-being-single-threaded-0eae37570633?source=rss-8c89e155fee0------2</link>
            <guid isPermaLink="false">https://medium.com/p/0eae37570633</guid>
            <dc:creator><![CDATA[Abhishek Gaddi]]></dc:creator>
            <pubDate>Sun, 21 Dec 2025 15:46:20 GMT</pubDate>
            <atom:updated>2025-12-22T05:15:56.060Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*yQrxnlkoEdxeyJ8EoIQ1cA.jpeg" /><figcaption>Image credit: <a href="https://dev.to/dev_tips/the-hidden-power-of-redis-fast-flexible-and-freakishly-simple-5g38">dev.to</a></figcaption></figure><p>At first glance, Redis being <strong>single-threaded</strong> sounds like a limitation.</p><p>We usually assume that applications must be multithreaded to be fast. After all, single-threaded systems execute requests one after another, so shouldn’t they be slow?</p><p>Surprisingly, Redis proves the opposite.</p><p>Let’s understand <strong>why Redis is extremely fast despite processing commands sequentially</strong>, and why in many real-world systems, this design is actually an advantage.</p><h3>A Simple Analogy: The Single Cashier</h3><p>Think of Redis like a <strong>cashier at a store with a single counter</strong>.</p><p>Each customer is served one at a time:</p><ul><li>The cashier listens to the order</li><li>Completes the billing</li><li>Hands over the receipt</li><li>Moves to the next customer</li></ul><p>There is <strong>no overlap</strong>, no confusion, and no mistakes.</p><p>Redis works the same way. It processes commands <strong>sequentially in a single main thread</strong>, ensuring correctness and simplicity.</p><h3>Why Single-Threaded Sounds Slow (But Isn’t Always)</h3><p>We often associate single-threaded execution with poor performance because it is <strong>sequential</strong>. A request must finish before the next one starts.</p><p>On the other hand, <strong>multithreading</strong> allows multiple requests to be handled concurrently, typically across multiple CPU cores.</p><p>But concurrency does not always mean better performance.</p><h3>Multithreading vs Single Threading (Reality Check)</h3><h3>What Multithreading Really Means</h3><p>Multithreading allows an application to handle multiple requests concurrently. However:</p><ul><li>On a <strong>single-core CPU</strong>, threads do <strong>not</strong> run in parallel</li><li>The CPU can execute only <strong>one instruction at a time</strong></li></ul><p>Instead, the system rapidly switches between threads, creating the illusion of parallelism.</p><p>This is an example of <strong>concurrency</strong>, not true <strong>parallel execution</strong>. I used a <strong>single-core CPU</strong> for simplicity; however, most modern systems have <strong>multiple cores</strong>, and the fundamental execution concept remains the same.</p><h3>How Execution Works on a CPU</h3><p>Every CPU instruction follows this cycle:</p><ol><li><strong>Fetch</strong> — Get the instruction from memory</li><li><strong>Decode</strong> — Understand what needs to be done</li><li><strong>Execute</strong> — Perform the operation</li></ol><p>Only one instruction can execute at any moment on a single core.</p><h3>Context Switching</h3><p>When multiple threads exist on a single-core system, the CPU constantly:</p><ul><li>Executes Thread A for a short time slice</li><li>Saves Thread A’s state (registers, stack, program counter)</li><li>Switches to Thread B</li><li>Repeats this process rapidly</li></ul><h4>Why This Is Expensive</h4><p>Context switching:</p><ul><li>Wastes CPU cycles</li><li>Pollutes CPU cache</li><li>Adds scheduling overhead</li></ul><p>…the overhead can outweigh the benefits of multithreading.</p><h3>The Race Condition Nightmare</h3><p>Consider this real-world example.</p><p>Two users, Priya and Rohan, try to book the same movie seat:</p><ul><li>Both load the seat map → Seat 12G is available</li><li>Priya clicks “Book”</li><li>Rohan clicks “Book” milliseconds later</li><li>Both requests check availability → <strong>Yes</strong></li><li>Both proceed to payment</li></ul><p><strong>Result:</strong> One seat, two bookings. Chaos.</p><p>This is a classic <strong>race condition</strong>, caused by concurrent execution.</p><p>Avoiding this in multithreaded systems requires:</p><ul><li>Locks</li><li>Synchronization</li><li>Careful ordering</li></ul><p>All of which add complexity and overhead.</p><h3>Why Redis Avoids These Problems</h3><p>Redis processes <strong>one command at a time</strong>.</p><ul><li>No two commands modify data simultaneously</li><li>No locks</li><li>No race conditions</li><li>No synchronization overhead</li></ul><h3>Key Features That Make Redis Fast</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d_667W8XhNdRVYEM0-3BgA.jpeg" /><figcaption>Redis Single-Threaded Architecture with Event Loop and epoll</figcaption></figure><h3>#1: I/O Multiplexing (epoll / kqueue)</h3><p>Redis uses <strong>I/O multiplexing</strong> with an <strong>event loop</strong> and OS-level notification systems like epoll (Linux) or kqueue (macOS/BSD).</p><h4>How It Works</h4><ol><li>Each client connection gets its own socket</li><li>All sockets are registered with epoll.</li><li>Redis sleeps instead of checking sockets repeatedly</li><li>epoll notifies Redis only when sockets are ready</li><li>The event loop processes ready sockets <strong>one by one</strong></li></ol><p>Redis never wastes CPU time on idle connections.</p><h4>Why This Is Fast</h4><p>Redis spends <strong>nearly 100% of its CPU time doing real work</strong>, not managing threads or checking inactive clients.</p><h3>#2: In-Memory Operations (No Disk Bottleneck)</h3><p>Redis stores data entirely in <strong>RAM</strong>, which is directly accessible by the CPU.</p><ul><li>RAM access: ~100 nanoseconds</li><li>SSD access: ~100 microseconds</li><li>HDD access: ~10 milliseconds</li></ul><p>That’s <strong>thousands to millions of times faster</strong>.</p><p>Disk I/O typically blocks CPUs while waiting. Redis avoids this entirely in the request path.</p><h3>#3: Highly Optimized Data Structures</h3><p>Redis uses <strong>purpose-built data structures</strong> optimized for speed:</p><ul><li>Hash Tables → O(1) lookups, Lists, Sets, Sorted Sets, Intsets, Zip Lists</li></ul><h4>What Is O(1)?</h4><p>O(1) means <strong>constant time</strong>.</p><p>Whether Redis has: 10 keys or 10 million keys. …the lookup time is nearly the same.</p><p>These structures are: Compact, Cache-friendly, Minimal in overhead</p><p>This allows Redis to execute <strong>millions of operations per second</strong>, even with a single thread.</p><h3>#4: Persistence Without Blocking</h3><p>Redis balances speed and durability:</p><h4>Redis supports:</h4><ul><li><strong>RDB snapshots</strong></li><li><strong>AOF (Append-Only File)</strong></li></ul><p>Both run <strong>asynchronously in the background</strong>, so normal requests are never blocked by disk writes.</p><h3>Disadvantages of Single-Threaded Redis</h3><p>To be fair, this design has trade-offs:</p><ol><li><strong>CPU-intensive commands can block all clients</strong></li><li><strong>Multi-core CPUs are underutilized</strong></li><li><strong>Long-running commands affect latency</strong></li><li><strong>Not suitable for heavy analytics or computation</strong></li></ol><h3>Conclusion</h3><p>Redis is fast <strong>not despite being single-threaded, but because of it</strong>.</p><p>By avoiding:</p><ul><li>Locks, Context switching, Synchronization overhead, Disk I/O in the hot path</li></ul><p>…and combining this with:</p><ul><li>I/O multiplexing, In-memory storage, Optimized data structures</li></ul><p>Redis achieves exceptional performance with a simple and predictable execution model.</p><p>Sometimes, <strong>doing one thing at a time — very efficiently — beats doing many things at once</strong>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0eae37570633" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Apache Kafka Handles Real-Time Data at Scale]]></title>
            <link>https://medium.com/@abhishekg_79562/how-apache-kafka-handles-real-time-data-at-scale-a987fdd34e3d?source=rss-8c89e155fee0------2</link>
            <guid isPermaLink="false">https://medium.com/p/a987fdd34e3d</guid>
            <dc:creator><![CDATA[Abhishek Gaddi]]></dc:creator>
            <pubDate>Sun, 14 Dec 2025 19:27:04 GMT</pubDate>
            <atom:updated>2025-12-15T19:02:55.381Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f8wtzsI37fOl0YzHP5LAkQ.png" /></figure><p>Modern applications generate huge amounts of data every second — user clicks, orders, payments, logs, sensor data, and more. Handling this data <strong>reliably</strong>, <strong>quickly</strong>, and <strong>at scale</strong> is extremely difficult.</p><p>Apache Kafka was created to solve exactly this problem.</p><p>This article explains Kafka in a simple but deep way — starting from <em>why it was created</em>, moving through <em>how it works internally</em>, and finally <em>why its architecture makes it highly scalable</em>, fault-tolerant, and different from traditional message queues.</p><h3>1. A Brief History: Why Kafka Was Created</h3><p>Kafka was created to handle <strong>real-time data streams at very large scale</strong>.</p><p>Companies had many systems that all needed the same data:</p><ul><li>Analytics systems</li><li>Monitoring tools</li><li>Search and reporting systems</li></ul><p>The old way of moving data between systems simply did not scale. Pipelines were fragile, tightly coupled, and slow to change.</p><p>Kafka introduced a <strong>new way of thinking</strong>:</p><blockquote><em>Store events first, then let any number of systems read them independently.</em></blockquote><p>This idea became the foundation of Kafka’s architecture.</p><h3>2. What Kafka Solves: The Problem with Traditional Queues</h3><h3>The Point-to-Point Integration Problem</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q4lO9_-3Md1D5sdFTzq6KQ.png" /></figure><p>Before Kafka, systems often talked to each other directly.</p><p>In traditional point-to-point integration:</p><ul><li>Every service connects directly to every other service</li><li>Connections grow exponentially</li><li>Adding a new system requires many new integrations</li><li>Changes in one system impact many others</li></ul><p>This quickly becomes <strong>hard to manage and impossible to scale</strong>.</p><h3>Kafka’s Solution: Central Event Streaming Platform</h3><p>With Kafka:</p><ul><li>Producers write data <strong>once</strong></li><li>Kafka stores it durably</li><li>Consumers read data <strong>independently</strong></li><li>Systems are fully decoupled</li></ul><p>This decoupling is the <strong>first major reason Kafka scales so well</strong>.</p><h3>3. Core Kafka Basics (Simple Explanation)</h3><h3>Producer</h3><p>A <strong>producer</strong> is an application that sends events to Kafka.<br>Example: an order service sending “order placed” events.</p><h3>Topic</h3><p>A <strong>topic</strong> is a named stream of events.<br>Examples:</p><ul><li>orders</li><li>payments</li></ul><p>Topics organize data logically.</p><h3>Partition</h3><p>Each topic is split into <strong>partitions</strong>.</p><ul><li>Each partition is an ordered log</li><li>Order is guaranteed <strong>within a partition only</strong></li><li>Partitions allow parallel reading and writing</li></ul><p>Think of partitions like lanes on a highway — more lanes allow more traffic to move at the same time.</p><h3>Broker</h3><p>A <strong>broker</strong> is a Kafka server.</p><ul><li>Stores partition data on disk</li><li>Appends new messages</li><li>Serves data to consumers</li></ul><p>Kafka runs as a <strong>cluster of brokers</strong>, not a single server.</p><h3>Consumer</h3><p>A <strong>consumer</strong> reads data from Kafka.</p><ul><li>Consumers pull data</li><li>Consumers track their own progress using offsets</li><li>Multiple consumers can read the same data</li></ul><h3>4. How Kafka Works (Step-by-Step Flow)</h3><p>Let’s follow a real example:<br><em>A user places an order on an e-commerce website.</em></p><h3>Step-by-Step What Happens</h3><ol><li><strong>Producer sends an event</strong> to the orders topic</li><li>Kafka chooses a partition (based on key or round-robin)</li><li>The partition leader broker <strong>appends</strong> the event to the log</li><li>The event is replicated to other brokers</li><li>Kafka sends acknowledgements based on producer settings</li><li>Consumers pull the event and process it.</li><li>Offsets are committed after processing.</li></ol><h3>Message Delivery (Acknowledgements)</h3><p>Kafka does <strong>not guarantee delivery by default</strong>.</p><p>Producers choose reliability using acknowledgements:</p><ul><li>acks=0 → No confirmation (fastest, least safe)</li><li>acks=1 → Leader confirms write</li><li>acks=all → All replicas confirm write (safest)</li></ul><p>This lets Kafka balance <strong>speed vs durability</strong>.</p><h3>Retention Period</h3><p>Kafka <strong>does not delete messages after they are read</strong>.</p><ul><li>Data stays for a configured retention period</li><li>Consumers can replay old data</li><li>New consumers can read historical events</li></ul><p>This is a key difference from traditional queues.</p><h3>5. Why Kafka Is Scalable</h3><p>Kafka is scalable because <strong>every architectural decision supports scale</strong>.</p><h3>5.1 How Kafka Stores Data (Append-Only Logs)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BOsnMFGo8sahxJLLvZ0Mfg.png" /></figure><p>Kafka stores messages as <strong>append-only logs</strong>:</p><ul><li>Messages are written sequentially</li><li>No updates or deletes during normal operation</li><li>Each message gets a unique offset</li></ul><p>Sequential disk writes are extremely fast, enabling <strong>high throughput</strong>.</p><h3>5.2 Horizontal Scaling with Partitions and Brokers</h3><p>Kafka scales horizontally:</p><ul><li>Add more partitions → more parallelism</li><li>Add more brokers → more capacity</li></ul><p>This allows Kafka to handle increasing load simply by adding machines.</p><h3>5.3 Fault Tolerance with Replication</h3><p>Kafka ensures fault tolerance through replication:</p><ul><li>Each partition has one leader and multiple replicas</li><li>Replicas are stored on different brokers</li><li>If a broker fails, a replica becomes leader</li></ul><p>With proper acknowledgements, <strong>no data is lost</strong>.</p><h3>5.4 Heartbeats and Cluster Coordination</h3><p>Kafka continuously monitors cluster health:</p><ul><li>Brokers send heartbeats</li><li>Failures are detected automatically</li><li>Leaders are re-elected when needed</li></ul><p>ZooKeeper (older setups) or KRaft (newer setups) manages:</p><ul><li>Metadata</li><li>Leader elections</li><li>Cluster consistency</li></ul><p>This keeps Kafka highly available.</p><h3>6. Why Kafka Is Better Than Traditional Message Queues</h3><h3>Traditional Message Queues</h3><ol><li>Use a <strong>push-based model</strong>, where the broker sends messages to consumers.</li><li><strong>Remove messages after consumption</strong>, so data is short-lived.</li><li>Are best suited for <strong>task and job processing</strong>.</li><li>Brokers <strong>track delivery state</strong>, increasing load as traffic grows.</li><li>Have <strong>limited scalability</strong>, often becoming bottlenecks under high throughput.</li></ol><h3>Apache Kafka</h3><ol><li>Uses a <strong>pull-based model</strong>, allowing consumers to read at their own pace.</li><li><strong>Retains data for a configurable period</strong>, even after consumption.</li><li>Is designed for <strong>real-time event streaming and data pipelines</strong>.</li><li>Keeps brokers <strong>lightweight and mostly stateless</strong>, improving performance.</li><li><strong>Scales horizontally</strong> using partitions and multiple brokers.</li></ol><h3>Key Takeaway</h3><p>Traditional message queues focus on <strong>task delivery</strong>.<br>Apache Kafka focuses on <strong>streaming data at scale</strong> with durability, replayability, and high throughput.</p><h3>7. Drawbacks of Apache Kafka</h3><p>Kafka is powerful, but not always the right choice.</p><ul><li>Overkill for simple use cases</li><li>Ordering only guaranteed per partition</li><li>Requires careful configuration for guarantees</li></ul><p>Kafka shines most in <strong>large-scale, real-time systems</strong>.</p><h3>Final Thoughts</h3><p>Kafka is scalable because:</p><ul><li>Data is stored as append-only logs</li><li>Work is distributed using partitions</li><li>Brokers scale horizontally</li><li>Consumers pull data independently</li><li>Replication handles failures automatically</li><li>Producers and consumers are fully decoupled</li></ul><p>Kafka does not scale by accident — it scales <strong>by design</strong>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a987fdd34e3d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ How Your Financial Data Moves Securely in the AA Ecosystem]]></title>
            <link>https://medium.com/@abhishekg_79562/how-your-financial-data-moves-securely-in-the-aa-ecosystem-a6e0a66bc200?source=rss-8c89e155fee0------2</link>
            <guid isPermaLink="false">https://medium.com/p/a6e0a66bc200</guid>
            <dc:creator><![CDATA[Abhishek Gaddi]]></dc:creator>
            <pubDate>Sun, 08 Jun 2025 15:48:49 GMT</pubDate>
            <atom:updated>2025-06-19T18:17:34.024Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hENC82TUZIaCj1kYIewBBQ.png" /><figcaption>Photo from <a href="https://sahamati.org.in/">Sahamati website</a></figcaption></figure><p><strong>Have you ever wondered how your bank data reaches another app securely — without anyone snooping in?</strong> That magic happens inside India’s <strong>Account Aggregator (AA) ecosystem</strong>, where encryption, decryption, and digital signing work together to protect your data.</p><p>Let’s break this down in the simplest way possible. Imagine it like <strong>sending a locked box</strong> with a message inside — you give the key only to the person it’s meant for. Now let’s understand who’s involved and how it all works.</p><h3>Participants in the AA Ecosystem?</h3><p>Let’s first meet the key players:</p><ul><li><strong>FIU (Financial Information User):</strong> This is the party requesting your data. For example, a <strong>loan app</strong> asking for your bank statements.</li><li><strong>AA (Account Aggregator):</strong> Think of this as a <strong>data courier</strong>. It doesn’t open your data; it just delivers it securely between banks and apps.</li><li><strong>FIP (Financial Information Provider):</strong> This is your <strong>bank or financial institution</strong> — the one that holds your data.</li></ul><p>These three entities interact using <strong>encryption protocols</strong> that keep your data safe, even if it’s moving through the internet.</p><h3>🔒 Why Is Encryption So Important?</h3><p>Imagine your financial data is like a <strong>diary of your life</strong> — it shows how much you earn, save, and spend. Would you want this in unsafe hands?</p><p><strong>Encryption</strong> ensures:</p><ul><li>Only the right person can read your data.</li><li>Nobody in between can tamper with it.</li><li>You control who accesses it, when, and for how long.</li></ul><h3>Two Tools: Encryption &amp; Signing — What’s the Difference?</h3><p>Most people confuse <strong>encryption</strong> with <strong>signing</strong>. Let’s clear that up.</p><h3>1. Encryption</h3><p>This is like <strong>locking your message</strong> so that only the receiver with the right key can open it.</p><p>There are two types:</p><h4>a. Symmetric Encryption.</h4><p>The same key is used to <strong>lock and unlock</strong>.<br> Think of a diary with one key — both you and your friend need a copy of it.</p><blockquote><em>🔹 Fast but risky: If someone steals the key, they can open it.</em></blockquote><h4>b. Asymmetric Encryption.</h4><p>Two keys are used:</p><ul><li><strong>Public Key</strong> (for locking)</li><li><strong>Private Key</strong> (for unlocking)</li></ul><p>Only the <strong>receiver</strong> knows the private key, so even if others see the locked box (public key), they <strong>can’t open it</strong>.</p><blockquote><em>🔹 More secure .</em></blockquote><h3>2. Digital Signing</h3><p>Signing is <strong>not about locking</strong>, it’s about <strong>proving the message is really from you</strong>.</p><p>Imagine you <strong>seal the box with your signature</strong>. Even if others read it, they’ll know the message wasn’t tampered with.</p><ul><li>It ensures <strong>authenticity and integrity</strong>.</li><li>The sender uses their <strong>private key</strong> to sign.</li><li>The receiver uses the <strong>sender’s public key</strong> to verify.</li></ul><h3>Let’s See the AA Process in Action</h3><p>Here’s how the full <strong>data-sharing process</strong> unfolds in the AA ecosystem. Don’t worry if this seems technical at first — read through the flow, and it’ll start to click.</p><h3>Step-by-Step: Encryption &amp; Decryption Flow</h3><p><strong>1. Consent Is Taken by the User (You)</strong></p><p>Everything starts with <strong>your consent</strong>.</p><ul><li>A Financial Information User (<strong>FIU</strong>) — like a loan provider or a personal finance app — needs your financial data.</li><li>It sends you to the <strong>Account Aggregator (AA)</strong> app or client.</li><li>There, you review the <strong>consent request</strong> (what data, for how long, and for what purpose), and if you’re okay with it, you <strong>approve it</strong>.</li></ul><p>Once approved, the AA generates a <strong>Consent ID</strong> and moves to the next step.</p><p><strong>2. The FIU Sends a Data Request Using Consent</strong></p><ul><li>The FIU sends a <strong>Financial Information (FI) Request</strong> to the AA.</li><li>This request includes the <strong>Consent ID</strong> that you approved earlier.</li></ul><p><strong>3. AA Forwards the Request to the FIP</strong></p><p>The AA then:</p><ul><li>Looks at your approved consent.</li><li>Maps it correctly to the Financial Information Provider (<strong>FIP</strong>) — like your bank or mutual fund platform.</li><li>Forwards the data request securely to the correct FIP.</li></ul><p><strong>4. Key Pairs Are Generated for Encryption</strong></p><p>Now comes the encryption part.</p><p>To keep data secure during transmission, we use <strong>asymmetric encryption</strong> based on the <strong>Curve25519 elliptic curve and the Diffie-Hellman key exchange algorithm</strong>.</p><p>Here’s how it works:</p><ul><li>The FIU (data consumer) creates a <strong>public key and private key pair</strong>.</li><li>It sends the <strong>public key</strong> to the FIP <strong>via the AA</strong>, as part of the FI request.</li></ul><p><strong>5. The FIP Encrypts the Data</strong></p><ul><li>The FIP (e.g., bank) prepares financial data.</li><li>It <strong>encrypts the data</strong> using <strong>(FIU’s) public key </strong>And its own <strong>private key.</strong></li></ul><p><strong>6</strong>. This creates a <strong>double-encrypted payload</strong> that only:</p><ul><li>The FIP (with its own private key)</li><li>And the FIU (with its own private key) can fully unlock.</li></ul><p><strong>7. Data Travels Securely to the FIU</strong></p><ul><li>The encrypted data is sent back through the AA to the FIU.</li><li>Because only the FIU has the correct <strong>private key</strong>, it can <strong>decrypt</strong> the data and use it.</li></ul><h3>🧠 Why You Should Care</h3><p>Encryption and signing aren’t just for financial systems — they’re the backbone of <strong>modern digital trust</strong>.</p><h3>Here’s where you use them (without realizing it):</h3><ul><li><strong>Messaging apps (like WhatsApp/Signal)</strong> use <strong>end-to-end encryption</strong> so that only you and the other person can read messages.</li><li><strong>Websites with HTTPS</strong> use encryption so that your card details or passwords aren’t visible to hackers.</li><li><strong>Documents signed digitally (PDFs or Aadhaar eSign)</strong> use <strong>digital signatures</strong> to confirm identity and prevent tampering.</li></ul><h3>Why this matters:</h3><ul><li><strong><em>Privacy is not optional</em></strong><em> any more — it’s essential.</em></li><li><strong>Encryption protects your rights</strong>, identity, finances, and communication.</li><li>Even if you “have nothing to hide,” your data has value. Protecting it is like locking your house — not because you’re hiding something, but because it’s yours.</li></ul><blockquote>🔑 <strong>Encryption = Control.</strong> Signing = <strong>Trust.</strong> You need both in every digital interaction.</blockquote><p>📌 Want to remember this?</p><ul><li><strong>Encryption = Locking data</strong></li><li><strong>Decryption = Unlocking data</strong></li><li><strong>Digital Signing = Proving who sent it</strong></li><li><strong>Public Key = Share with others</strong></li><li><strong>Private Key = Keep to yourself</strong></li></ul><h3>Conclusion &amp; Scope for Improvement</h3><p>The Account Aggregator (AA) system makes data sharing safe using strong encryption. Financial data stays protected while moving between banks and apps.</p><p>But safety shouldn’t stop there.</p><p>Once the data is unlocked by an app(FIU), it’s important to control how it’s stored and used. Future improvements could include <strong>time-limited access</strong>, <strong>use-specific permissions</strong>, and <strong>automatic data expiry</strong> methods.</p><p>The AA framework has secured the way data moves — now it’s time to ensure it’s handled responsibly after it arrives.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a6e0a66bc200" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>