Check age natively

CalmLens marks content age-restricted but doesn't know your viewers, so your app decides who is old enough to see it. iOS, Android and browsers can answer that themselves: the viewer agrees to share, and your app learns only whether they're over your age gate, never a birth date. Pick your platform, ask when the viewer opens age-restricted content, and serve it only to viewers who pass.

Regional requirements

Your integration performs and confirms the age check. CalmLens doesn't collect identity documents, receive provider results or verify viewers. Some jurisdictions your project serves require a reliable age check rather than a birth date the viewer typed; Age-check responsibilities lists them.

Pass the viewer's country as viewerClaims.region on CDN requests and to the SDK asset component. When your backend proxies media, forward the country from the viewer's request; see Proxies and request country.

Keep viewerClaims.ageConfirmed false while a check is pending, declined, unavailable, expired or identifies a minor. After your app confirms the required check, set viewerClaims.ageConfirmed: true on the CDN request, including signed asset URLs and server-side delivery. The claim tells the CDN it may deliver the asset; it is not evidence that CalmLens checked the viewer's age. Do not put server API keys in browser code.

What each platform provides

PlatformAPIThe viewer sharesHow sure it is
iOS 26 and laterApple's Declared Age Range Which side of your age gates they're on, from their Apple AccountSelf-declared, set by a guardian, or confirmed with a credit card or government ID
AndroidGoogle's Play Age Signals An age range from their Google accountFrom self-declared (TIER_A) to checked with an ID and selfie or a digital ID (TIER_D)
Web: Chrome 141+, Safari 26+The W3C Digital Credentials API "Over 18" from a government ID in their phone's walletSigned by the ID's issuer

App store accountability laws in some US states, such as Utah and Texas, require app stores to share a user's age range and developers to use it, so add the iOS and Android signals even if you also check age another way.

Some laws require a reliable age check before showing pornographic images or video, such as the UK Online Safety Act, which expects highly effective age assurance. A self-declared age doesn’t meet that standard; When the platform can't answer lists the signals that do.

Ask for the viewer's age

Ask only when the viewer tries to open age-restricted content, and keep the answer rather than asking for every item.

Which platform is your app on?

Expo or React Native

expo-age-range wraps both platforms' age signals. Calmsnap, the Expo example, uses it to hide an age-restricted photo until the viewer shares an age range of 18 or older.

View the source code

npx expo install expo-age-range

Add the Declared Age Range entitlement for iOS to app.json:

{
  "expo": {
    "ios": {
      "entitlements": {
        "com.apple.developer.declared-age-range": true
      }
    }
  }
}

On Android, Play shows its consent screen first; on iOS, the consent sheet is part of the age range request. Below iOS 26 and on the web, expo-age-range answers as if the viewer were an adult, so only ask where the OS can really answer:

import * as AgeRange from "expo-age-range";
import { Platform } from "react-native";

const ADULT_AGE = 18;

export type AgeCheck =
  | { result: "adult"; confirmed: boolean }
  | { result: "minor" | "declined" | "verification-required" | "unavailable" };

const canAskTheOs = () =>
  Platform.OS === "android" ||
  (Platform.OS === "ios" && Number.parseInt(String(Platform.Version), 10) >= 26);

export const requestAgeCheck = async (): Promise<AgeCheck> => {
  if (!canAskTheOs()) return { result: "unavailable" };
  try {
    // Android only: Play's consent screen. Resolves null on iOS.
    const access = await AgeRange.requestAgeSignalsAccessAsync();
    if (access === "NOT_SHARED") return { result: "declined" };
    if (access === "VERIFICATION_REQUIRED") return { result: "verification-required" };

    const range = await AgeRange.requestAgeRangeAsync({ threshold1: ADULT_AGE });
    if (range.lowerBound === null && range.upperBound === null) return { result: "unavailable" };
    if ((range.lowerBound ?? 0) < ADULT_AGE) return { result: "minor" };
    return {
      result: "adult",
      confirmed:
        range.ageRangeDeclaration === "confirmed" ||
        range.ageRangeSource === "TIER_C" ||
        range.ageRangeSource === "TIER_D",
    };
  } catch (error) {
    const code = (error as { code?: string }).code;
    if (code === "ERR_AGE_RANGE_USER_DECLINED" || code === "ERR_AGE_RANGE_TASK_CANCELLED") {
      return { result: "declined" };
    }
    return { result: "unavailable" };
  }
};
ResultWhat to do
adultShow the content. Where the law requires a verified age, also require confirmed
minorKeep the content hidden
declinedKeep it hidden and let the viewer ask again
verification-requiredGoogle Play needs the viewer to verify their age in the Play Store first
unavailableThe device can't answer: an older OS, no signed-in account or a simulator. Use a fallback

Test on a real device signed in to an Apple or Google account. In a debug build on Android, AgeRange.setFakeAgeSignals reports the signals you choose instead of asking Play.

When the platform can't answer

The viewer may be on an older OS, have no digital ID, or decline. Give them another way to prove their age:

  • Age assurance providers run the check and send your server the result. The UK regulator Ofcom lists photo ID matching, facial age estimation, credit card checks, open banking, mobile network operator checks, email-based age estimation and digital identity services as capable of being highly effective age assurance  under the Online Safety Act.
  • Self-declaration, a birth date field or an "I'm 18 or older" button, is enough for a content warning that adults dismiss. Ofcom doesn't accept it, or a debit card payment, where a highly effective check is required.

The platform signals can be self-declared too. Where the law asks for a verified age, accept only a confirmed iOS range, a TIER_C or TIER_D Android range, a wallet ID, or a provider's check.

Record the result on your server

iOS and Android report to the app, so your server only learns what the app tells it. Save the outcome on the viewer's account, with the method and whether it was confirmed, so every device and your backend use the same answer. Where your server must be able to verify the check itself, use a wallet ID or a provider that sends the result to your backend.

Re-check when the answer can change: a minor's age range moves on with their birthday, and a viewer can stop sharing their range in their account settings.

Serve age-restricted content to viewers who passed

Age-restricted assets aren't served on plain public URLs. For viewers who passed, pass the check's result as viewerClaims.ageConfirmed, as described in Regional requirements, and show everyone else the placeholder:

import { CalmLensAppClient } from "calmlens/app";

// Builds public CDN URLs without a request or an API key.
const calmlens = new CalmLensAppClient({ uploadPresetId: "preset_4Lk8Qw2Xm9Rt5Vb3Nc7P" });

type SensitiveImageProps = {
  projectId: string;
  assetId: string;
  status: "allowed" | "limited" | "age-restricted";
  ageConfirmed: boolean;
  alt: string;
  /** Width divided by height, which you store when the image is uploaded. */
  aspectRatio: number;
  onReveal: () => void;
};

const fill = { width: "100%", height: "100%", objectFit: "cover" } as const;

export function SensitiveImage({
  projectId,
  assetId,
  status,
  ageConfirmed,
  alt,
  aspectRatio,
  onReveal,
}: SensitiveImageProps) {
  const restricted = status === "age-restricted";
  const asset = { projectId, assetId };
  return (
    <figure style={{ aspectRatio, margin: 0, position: "relative" }}>
      {!restricted || ageConfirmed ? (
        <img
          // Claims make the response private and uncacheable: send them only when needed.
          src={calmlens.cdn.getAssetUrl({
            ...asset,
            resource: "rendered",
            ...(restricted ? { viewerClaims: { ageConfirmed } } : {}),
          })}
          alt={alt}
          style={fill}
        />
      ) : (
        <>
          <img
            src={calmlens.cdn.getAssetUrl({ ...asset, resource: "placeholder" })}
            alt=""
            style={fill}
          />
          <figcaption
            style={{ position: "absolute", inset: 0, display: "grid", placeContent: "center" }}
          >
            Sensitive content{" "}
            <button type="button" onClick={onReveal}>
              View
            </button>
          </figcaption>
        </>
      )}
    </figure>
  );
}

Show sensitive media explains what the opt-in protects, the signed-URL alternative and a reveal control for viewers who choose to see it.

Sources for age-check standards

Ofcom’s age-assurance guidance  explains highly effective age checks for services in scope of the UK requirements. For the EU, Australia and Brazil, see the jurisdiction-specific official sources in Jurisdiction rules.

Last updated

Signing in

Signing out

Cookies on CalmLens

We use essential cookies for sign-in and security. With your permission, functional cookies remember your preferences and Google Analytics measures website use and signups. Optional ad measurement cookies link Google ad clicks to signups. Personalised advertising stays off. Manage cookies