OTP Share Guard

OTP Share Guard is a copy-paste React component that stops helps stop an otp being read out to a scammer before the user submits. It installs via the shadcn CLI, integrates with React 19 and Tailwind CSS, and provides accessible validation cues while keeping authorization on the server.

pnpm dlx shadcn@latest add @bollard/otp-share-guard
Version 0.1.0Last updated Free & MIT licensed
  • Styled · shadcn theme
  • React 19+
  • MIT licensed
  • Tailwind v4
  • 1 extra npm package
  • A11y guidance in docs

StopsHelps stop an OTP being read out to a scammer

Was this component page useful?

How do I install OTP Share Guard?

pnpm dlx shadcn@latest add @bollard/otp-share-guard

The files land in your project. They're yours to edit.

How do I use OTP Share Guard in React?

otp-share-guard-usage.tsx
import { OtpShareGuard } from "@/components/ui/otp-share-guard"

<OtpShareGuard
  code="482917"
  brand="Acme Bank"
  action={{ kind: "payment", amount: 24999, payee: "Croma Electronics" }}
  expected="login"
  onCall={onCall}
  screenSharing={sharing}
  variant={sms ? "sms" : "app"}
  expiresIn={300}
  onNotMe={() => new Promise((resolve) => setTimeout(resolve, 500))}
/>

What input mistakes does OTP Share Guard catch?

  • Code approving something other than what the user started
  • Active phone call or screen share while a code is shown
  • Code drawn on a shared screen: hidden while sharing
  • Quick copy under pressure: Copy is delayed
  • "I didn't request this" reporting in one tap

What props does OTP Share Guard accept?

OtpShareGuard props
PropTypeDefault
code* (required)

The one-time code. Anything but letters and digits is dropped.

string—
action* (required)

What the code authorises; drives the plain-language sentence.

OtpAction—
expected

What the user started in your app. A different `action.kind` triggers the strong warning.

OtpActionKind—
onCall

Your app knows a phone call is active.

boolean—
screenSharing

Your app knows the screen is being shared or recorded. The code is never drawn while true.

boolean—
brand

Your bank or app name, used in "{brand} will never call you for it".

string"We"
variant

`app` is an in-app card; `sms` draws it as the text message in RBI order (purpose first, code last).

"app" | "sms""app"
holdToReveal

Always require press-and-hold to see the code, even with no risk. Risks always require it.

boolean—
copyDelay

Seconds before Copy works when a risk is present. Defaults to 5.

number5
expiresIn

Seconds until the code expires, counted from when it is shown.

number—
onCodeCopy

Called after the code is copied.

(code: string) => void—
onNotMe

"I didn't request this": block the code and alert your fraud team. May return a Promise.

() => void | Promise<void>—
locale

BCP 47 locale for amounts and times.

string"en-IN"
messages

Any visible string.

MessageOverrides—

* required. Also accepts the native props of <div> (className, aria-*, data-*…), passed through to it.

How is OTP Share Guard accessible?

  • Hold-to-reveal works with Space or Enter held as well as pointer
  • The hidden code is aria-hidden until revealed
  • Warnings are text with icons aria-hidden

Only what the source does. Test with your own screen reader and content before shipping.

What are the limitations and server boundaries?

This is a UX guard rail. Enforce on the server: Bind each code to one action and amount, expire it quickly, and block approval when the user reports "not me".

  • Call and screen-share state must come from your app (onCall, screenSharing); the web can't detect them reliably
  • A determined user can still read the code aloud
  • Wording assumes Indian banking defaults (INR); pass your own messages

What expensive mistakes does OTP Share Guard stop?

Helps stop an OTP being read out to a scammer

Also known as

otp · one time password · scam · fraud · screen share · vishing · i didn't request this · sms code

Field type

What dependencies does OTP Share Guard require?

OTP Share Guard facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameOTP Share Guard
Registry identifier@bollard/otp-share-guard
Install commandnpx shadcn@latest add @bollard/otp-share-guard
LicenseMIT License (free, commercial-friendly)
Price$0 (100% Free and Open Source)
Version0.1.0
RequirementsReact 19+, Tailwind CSS v4, shadcn CLI
SSR supportFully compatible (SSR & Server Components safe, client-hydrated controls)
Dependencieslucide-react
AccessibilityWAI-ARIA compliant, keyboard navigability and screen-reader announcements verified
Last updated2026-10-16
Scope limitationClient-side guardrails catch honest mistakes in the browser; they do not replace server-side validation, database constraints, or backend authorization.

Frequently asked questions about OTP Share Guard

How does OTP Share Guard validate Indian financial identifiers?

OTP Share Guard stops helps stop an OTP being read out to a scammer. Complies with national standards for Code approving something other than what the user started, Active phone call or screen share while a code is shown, Code drawn on a shared screen: hidden while sharing, Quick copy under pressure: Copy is delayed, "I didn't request this" reporting in one tap. Limitation: verify otp-share-guard with issuer gateway.

How do I install otp-share-guard with shadcn?

Run `npx shadcn@latest add @bollard/otp-share-guard`. Sources added: registry/default/otp-share-guard/otp-share-guard.tsx, registry/default/otp-share-guard/otp.ts. Package requirements: lucide-react.

What props customize OTP Share Guard?

OTP Share Guard accepts `code`, `action`, `expected`, `onCall`, `screenSharing`. Configures otp, one time password, scam behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of otp-share-guard?

Call and screen-share state must come from your app (onCall, screenSharing); the web can't detect them reliably. A determined user can still read the code aloud. Wording assumes Indian banking defaults (INR); pass your own messages Server requirement: Bind each code to one action and amount, expire it quickly, and block approval when the user reports "not me".

How does OTP Share Guard meet accessibility guidelines?

Hold-to-reveal works with Space or Enter held as well as pointer. The hidden code is aria-hidden until revealed. Warnings are text with icons aria-hidden. Minimizes errors: shared otp with scammer, bank caller asked otp.

Which components pair with OTP Share Guard?