Skip to content

⚡️⚡️⚡️ Self-hosted collaborative bookmark manager to collect, read, annotate, and fully preserve what matters, all in one place.

replace revenuecat with apple and google webhooks

daniel31x137889e8d0bdd5
diff --git a/apps/mobile/.env.sample b/apps/mobile/.env.sample
index 1dedc38a..dc03d829 100644
--- a/apps/mobile/.env.sample
+++ b/apps/mobile/.env.sample
@@ -1,8 +1,12 @@
EXPO_PUBLIC_GOOGLE_WEB_CLIENT_ID=
EXPO_PUBLIC_GOOGLE_IOS_URL_SCHEME=
EXPO_PUBLIC_GOOGLE_IOS_CLIENT_ID=
-EXPO_PUBLIC_REVENUECAT_IOS_API_KEY=
-EXPO_PUBLIC_REVENUECAT_ANDROID_API_KEY=
+# In-app purchase product ids (must match App Store Connect / Play Console).
+EXPO_PUBLIC_IAP_MONTHLY_SKU_IOS=
+EXPO_PUBLIC_IAP_YEARLY_SKU_IOS=
+EXPO_PUBLIC_IAP_MONTHLY_SKU_ANDROID=
+EXPO_PUBLIC_IAP_YEARLY_SKU_ANDROID=
+
SENTRY_AUTH_TOKEN=
EXPO_PUBLIC_SHOW_LOGS=
# Expo: https://docs.expo.dev/more/expo-cli/#environment-variables
diff --git a/apps/mobile/app.config.ts b/apps/mobile/app.config.ts
index 4d02ac59..5663799c 100644
--- a/apps/mobile/app.config.ts
+++ b/apps/mobile/app.config.ts
@@ -35,6 +35,7 @@ const config: ExpoConfig = {
},
plugins: [
"expo-router",
+ "expo-iap",
[
"expo-splash-screen",
{
diff --git a/apps/mobile/app/_layout.tsx b/apps/mobile/app/_layout.tsx
index 6ae825d0..4fd15a85 100644
--- a/apps/mobile/app/_layout.tsx
+++ b/apps/mobile/app/_layout.tsx
@@ -12,7 +12,7 @@ import { SheetProvider } from "react-native-actions-sheet";
import "@/components/ActionSheets/Sheets";
import { useColorScheme } from "nativewind";
import { lightTheme, darkTheme } from "../lib/theme";
-import { Platform, View } from "react-native";
+import { View } from "react-native";
import { rawTheme, ThemeName } from "@/lib/colors";
import { useShareIntent } from "expo-share-intent";
import useDataStore from "@/store/data";
@@ -23,7 +23,6 @@ import { queryClient } from "@/lib/queryClient";
import { StatusBar } from "expo-status-bar";
import * as Sentry from "@sentry/react-native";
import OfflineSyncProvider from "@/components/OfflineSyncProvider";
-import Purchases, { LOG_LEVEL } from "react-native-purchases";
Sentry.init({
dsn: "https://00d7eed9e810cbbf91a7ed3547e37100@o4510998442475520.ingest.us.sentry.io/4511033679609856",
@@ -47,26 +46,6 @@ export default Sentry.wrap(function RootLayout() {
setAuth();
setData();
setReader();
-
- Purchases.setLogLevel(
- process.env.EXPO_PUBLIC_SHOW_LOGS === "true"
- ? LOG_LEVEL.VERBOSE
- : LOG_LEVEL.ERROR
- );
-
- // Platform-specific API keys
- const iosApiKey =
- process.env.EXPO_PUBLIC_REVENUECAT_IOS_API_KEY ??
- "appl_KYAGLnQJZpcgxmmVIoMTMZtSnYI";
- const androidApiKey =
- process.env.EXPO_PUBLIC_REVENUECAT_ANDROID_API_KEY ??
- "goog_MNATzOjDJIQJIQlkBuJMkmTjxJF";
-
- if (Platform.OS === "ios") {
- Purchases.configure({ apiKey: iosApiKey });
- } else if (Platform.OS === "android") {
- Purchases.configure({ apiKey: androidApiKey });
- }
}, []);
useEffect(() => {
diff --git a/apps/mobile/app/subscribe.tsx b/apps/mobile/app/subscribe.tsx
index eca4bf2c..a34e47cc 100644
--- a/apps/mobile/app/subscribe.tsx
+++ b/apps/mobile/app/subscribe.tsx
@@ -5,10 +5,16 @@ import {
shouldRouteToSubscribe,
} from "@/lib/subscription";
import { ensureCloudIsReachable } from "@/lib/ensureCloudIsReachable";
+import {
+ formatPrice,
+ getPlanOption,
+ SUBSCRIPTION_SKUS,
+ verifyPurchaseWithServer,
+} from "@/lib/iap";
import useAuthStore from "@/store/auth";
import { useConfig } from "@linkwarden/router/config";
import { useUser } from "@linkwarden/router/user";
-import { MobileAuth, Plan } from "@linkwarden/types/global";
+import { Plan } from "@linkwarden/types/global";
import { router } from "expo-router";
import { useColorScheme } from "nativewind";
import {
@@ -22,8 +28,15 @@ import {
Sparkles,
} from "lucide-react-native";
import FontAwesome5 from "@expo/vector-icons/FontAwesome5";
+import { useFonts } from "expo-font";
import * as DropdownMenu from "zeego/dropdown-menu";
-import Purchases, { type PurchasesPackage } from "react-native-purchases";
+import {
+ ErrorCode,
+ getAvailablePurchases,
+ isEligibleForIntroOfferIOS,
+ useIAP,
+ type Purchase,
+} from "expo-iap";
import { useEffect, useMemo, useState } from "react";
import {
ActivityIndicator,
@@ -44,37 +57,6 @@ import {
const wait = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
-const saveGooglePurchaseToken = async (
- auth: MobileAuth,
- purchaseToken: string,
- attempts = 5
-) => {
- for (let attempt = 0; attempt < attempts; attempt++) {
- try {
- const res = await fetch(
- `${auth.instance}/api/v1/billing/google-purchase-token`,
- {
- method: "POST",
- headers: {
- "Content-Type": "application/json",
- Authorization: `Bearer ${auth.session}`,
- },
- body: JSON.stringify({ purchaseToken }),
- }
- );
-
- if (res.ok) {
- const data = await res.json().catch(() => null);
- if (data?.updated > 0) return;
- } else if (res.status === 409) {
- return;
- }
- } catch {}
-
- await wait(1500);
- }
-};
-
const features = [
{ title: "Save & organize", icon: Bookmark },
{ title: "Permanent archives", icon: Archive },
@@ -88,11 +70,13 @@ const paymentButton = Platform.select({
accessibilityLabel: "Subscribe with Apple Pay",
icon: "apple-pay",
iconSize: 40,
+ label: "Subscribe",
},
android: {
accessibilityLabel: "Subscribe with Google Pay",
icon: "google-pay",
iconSize: 40,
+ label: "Subscribe",
},
default: {
accessibilityLabel: "Complete Subscription",
@@ -101,45 +85,6 @@ const paymentButton = Platform.select({
},
});
-type RevenueCatPackages = {
- monthly: PurchasesPackage | null;
- yearly: PurchasesPackage | null;
-};
-
-const formatTrialPeriod = (
- unit?: string,
- units = 1,
- cycles: number | null = 1
-) => {
- const total = Math.max(1, units * (cycles || 1));
- const normalizedUnit = (unit || "day").toLowerCase();
- const label = total === 1 ? normalizedUnit : `${normalizedUnit}s`;
-
- return `${total} ${label}`;
-};
-
-const getFreeTrialPeriod = (product?: PurchasesPackage["product"]) => {
- const freePhase = product?.defaultOption?.freePhase;
-
- if (freePhase) {
- return formatTrialPeriod(
- freePhase.billingPeriod.unit,
- freePhase.billingPeriod.value,
- freePhase.billingCycleCount
- );
- }
-
- if (product?.introPrice?.price === 0) {
- return formatTrialPeriod(
- product.introPrice.periodUnit,
- product.introPrice.periodNumberOfUnits,
- product.introPrice.cycles
- );
- }
-
- return null;
-};
-
export default function SubscribeScreen() {
const { auth, signOut } = useAuthStore();
const { colorScheme } = useColorScheme();
@@ -157,11 +102,87 @@ export default function SubscribeScreen() {
const config = useConfig(auth);
const [purchaseLoading, setPurchaseLoading] = useState(false);
const [restoreLoading, setRestoreLoading] = useState(false);
- const [revenueCatPackages, setRevenueCatPackages] =
- useState<RevenueCatPackages>({
- monthly: null,
- yearly: null,
- });
+ const [productsError, setProductsError] = useState(false);
+ const [fetchAttempt, setFetchAttempt] = useState(0);
+ const [payIconReady] = useFonts(FontAwesome5.font);
+
+ const [introOfferEligible, setIntroOfferEligible] = useState(
+ Platform.OS !== "ios"
+ );
+
+ const activateSubscription = async () => {
+ for (let attempt = 0; attempt < 8; attempt++) {
+ const { data } = await refetchUser();
+
+ if (data?.subscription?.active || data?.parentSubscription?.active) {
+ router.replace("/(tabs)/dashboard");
+ return;
+ }
+
+ await wait(1000);
+ }
+
+ Alert.alert(
+ "Subscription syncing",
+ "Your purchase was completed and is still syncing. Please try again in a moment."
+ );
+ };
+
+ const handlePurchaseSuccess = async (purchase: Purchase) => {
+ try {
+ // Ask-to-Buy / slow payment methods complete later; the purchase comes back
+ // through this listener again once it's actually purchased.
+ if (purchase.purchaseState === "pending") {
+ Alert.alert(
+ "Purchase pending",
+ "Your purchase is awaiting approval and will activate once it completes."
+ );
+ return;
+ }
+
+ const verified = await verifyPurchaseWithServer(
+ useAuthStore.getState().auth,
+ purchase
+ );
+
+ if (verified) {
+ // Only finish after the server has validated it — unfinished purchases are
+ // redelivered on the next launch, which is the retry mechanism.
+ await finishTransaction({ purchase, isConsumable: false }).catch(
+ () => {}
+ );
+ await activateSubscription();
+ } else {
+ Alert.alert(
+ "Subscription syncing",
+ "Your purchase was completed and is still syncing. Please try again in a moment."
+ );
+ }
+ } finally {
+ setPurchaseLoading(false);
+ }
+ };
+
+ const {
+ connected,
+ subscriptions,
+ fetchProducts,
+ requestPurchase,
+ finishTransaction,
+ reconnect,
+ } = useIAP({
+ onPurchaseSuccess: handlePurchaseSuccess,
+ onPurchaseError: (error) => {
+ setPurchaseLoading(false);
+
+ if (
+ error.code !== ErrorCode.UserCancelled &&
+ error.code !== ErrorCode.DeferredPayment
+ ) {
+ Alert.alert("Purchase failed", "Could not complete purchase.");
+ }
+ },
+ });
const isForcedSubscribe = shouldRouteToSubscribe(user, config.data);
const showSubscribe = hasInactiveSubscription(user, config.data);
@@ -176,87 +197,122 @@ export default function SubscribeScreen() {
}, [auth.status, isChecking, showSubscribe]);
useEffect(() => {
+ if (!connected) return;
+
let active = true;
- const fetchOfferings = async () => {
- try {
- if (!active) return;
+ fetchProducts({ skus: SUBSCRIPTION_SKUS, type: "subs" })
+ .then(() => active && setProductsError(false))
+ .catch(() => active && setProductsError(true));
- if (!(await Purchases.isConfigured())) {
- setTimeout(fetchOfferings, 250);
- return;
- }
+ return () => {
+ active = false;
+ };
+ }, [connected, fetchAttempt]);
+
+ const monthlyPlan = useMemo(
+ () => getPlanOption(subscriptions, "monthly"),
+ [subscriptions]
+ );
+ const yearlyPlan = useMemo(
+ () => getPlanOption(subscriptions, "yearly"),
+ [subscriptions]
+ );
- const offerings = await Purchases.getOfferings();
- if (!active) return;
+ const plansLoaded = Boolean(monthlyPlan && yearlyPlan);
- setRevenueCatPackages({
- monthly: offerings.current?.monthly ?? null,
- yearly: offerings.current?.annual ?? null,
- });
- } catch {}
- };
+ // A trial-expired user is forced onto this screen, so a failed store
+ // connection or product fetch must keep retrying instead of dead-ending.
+ useEffect(() => {
+ if (plansLoaded) return;
+
+ const timer = setInterval(() => {
+ if (!connected) {
+ reconnect().catch(() => {});
+ } else {
+ setFetchAttempt((attempt) => attempt + 1);
+ }
+ }, 8000);
+
+ return () => clearInterval(timer);
+ }, [plansLoaded, connected]);
+
+ // iOS product metadata always advertises the intro offer; whether this Apple ID
+ // is still eligible for it has to be checked separately.
+ useEffect(() => {
+ if (Platform.OS !== "ios") return;
+
+ const groupId = subscriptions
+ .map((subscription) =>
+ subscription.platform === "ios"
+ ? subscription.subscriptionGroupIdIOS
+ : null
+ )
+ .find(Boolean);
+
+ if (!groupId) return;
+
+ let active = true;
- fetchOfferings();
+ isEligibleForIntroOfferIOS(groupId)
+ .then((eligible) => active && setIntroOfferEligible(eligible))
+ .catch(() => active && setIntroOfferEligible(false));
return () => {
active = false;
};
- }, []);
+ }, [subscriptions]);
const planCards = useMemo(
() => [
{
key: Plan.yearly,
label: "Yearly",
- package: revenueCatPackages.yearly,
- price: revenueCatPackages.yearly?.product?.priceString ?? null,
+ price: yearlyPlan?.displayPrice ?? null,
suffix: "/yr",
- caption: revenueCatPackages.yearly?.product?.pricePerMonthString
- ? `Only ${revenueCatPackages.yearly.product.pricePerMonthString}/mo`
+ caption: yearlyPlan?.priceAmount
+ ? `Only ${formatPrice(
+ yearlyPlan.priceAmount / 12,
+ yearlyPlan.currency
+ )}/mo`
: null,
},
{
key: Plan.monthly,
label: "Monthly",
- package: revenueCatPackages.monthly,
- price: revenueCatPackages.monthly?.product?.priceString ?? null,
+ price: monthlyPlan?.displayPrice ?? null,
suffix: "/mo",
- caption: revenueCatPackages.monthly?.product?.priceString
- ? `Billed at ${revenueCatPackages.monthly.product.priceString}/mo.`
+ caption: monthlyPlan?.displayPrice
+ ? `Billed at ${monthlyPlan.displayPrice}/mo.`
: null,
},
],
- [revenueCatPackages.monthly, revenueCatPackages.yearly]
+ [monthlyPlan, yearlyPlan]
);
const savingsPercent = useMemo(() => {
- const monthlyPrice = revenueCatPackages.monthly?.product?.price;
- const yearlyPrice = revenueCatPackages.yearly?.product?.price;
+ const monthlyPrice = monthlyPlan?.priceAmount;
+ const yearlyPrice = yearlyPlan?.priceAmount;
if (!monthlyPrice || !yearlyPrice) return null;
const percent = Math.round((1 - yearlyPrice / (monthlyPrice * 12)) * 100);
return percent > 0 ? percent : null;
- }, [revenueCatPackages.monthly, revenueCatPackages.yearly]);
+ }, [monthlyPlan, yearlyPlan]);
const selectedPlan = useMemo(() => {
- const selectedPackage =
- plan === Plan.monthly
- ? revenueCatPackages.monthly
- : revenueCatPackages.yearly;
- const product = selectedPackage?.product;
- const total = product?.priceString;
+ const option = plan === Plan.monthly ? monthlyPlan : yearlyPlan;
+ const total = option?.displayPrice;
const period = plan === Plan.monthly ? "month" : "year";
- const freeTrialPeriod = getFreeTrialPeriod(product);
+ const freeTrialPeriod = introOfferEligible ? option?.freeTrialPeriod : null;
return {
- package: selectedPackage ?? null,
+ option: option ?? null,
footnote: total
? freeTrialPeriod
? `Get ${freeTrialPeriod} free, then ${total} per ${period}. Cancel anytime from your device settings.`
: `${total} per ${period}. Cancel anytime from your device settings.`
: null,
};
- }, [plan, revenueCatPackages.monthly, revenueCatPackages.yearly]);
+ }, [plan, monthlyPlan, yearlyPlan, introOfferEligible]);
if (isChecking || auth.status !== "authenticated" || !showSubscribe) {
return (
@@ -266,40 +322,32 @@ export default function SubscribeScreen() {
);
}
- const activateSubscription = async (customerInfo: any) => {
- if (Object.keys(customerInfo.entitlements.active).length === 0)
- return false;
-
- for (let attempt = 0; attempt < 8; attempt++) {
- const { data } = await refetchUser();
-
- if (data?.subscription?.active || data?.parentSubscription?.active) {
- router.replace("/(tabs)/dashboard");
- return true;
- }
-
- await wait(1000);
- }
-
- Alert.alert(
- "Subscription syncing",
- "Your purchase was completed and is still syncing. Please try again in a moment."
- );
- return true;
- };
-
const restorePurchases = async () => {
if (restoreLoading) return;
setRestoreLoading(true);
try {
- if (user?.uuid) await Purchases.logIn(user.uuid);
+ const purchases = await getAvailablePurchases();
+ const owned = purchases.filter((purchase) =>
+ SUBSCRIPTION_SKUS.includes(purchase.productId)
+ );
- const customerInfo = await Purchases.restorePurchases();
- const restored = await activateSubscription(customerInfo);
+ let restored = false;
- if (!restored) {
+ for (const purchase of owned) {
+ if (await verifyPurchaseWithServer(auth, purchase)) {
+ await finishTransaction({ purchase, isConsumable: false }).catch(
+ () => {}
+ );
+ restored = true;
+ break;
+ }
+ }
+
+ if (restored) {
+ await activateSubscription();
+ } else {
Alert.alert("No purchases found", "No active purchases were found.");
}
} catch {
@@ -310,39 +358,55 @@ export default function SubscribeScreen() {
};
const purchase = async () => {
- if (!selectedPlan.package || purchaseLoading || !user?.uuid) return;
+ if (!selectedPlan.option || purchaseLoading || !user?.uuid) return;
setPurchaseLoading(true);
try {
const serverReachable = await ensureCloudIsReachable(auth.instance);
- if (!serverReachable) return;
-
- await Purchases.logIn(user.uuid);
- if (user.email) await Purchases.setEmail(user.email);
- await Purchases.invalidateCustomerInfoCache();
-
- const existingCustomerInfo = await Purchases.getCustomerInfo();
- const alreadySubscribed =
- await activateSubscription(existingCustomerInfo);
-
- if (alreadySubscribed) return;
+ if (!serverReachable) {
+ setPurchaseLoading(false);
+ return;
+ }
- const { customerInfo, transaction } = await Purchases.purchasePackage(
- selectedPlan.package
+ // The store account may already hold a subscription (reinstall, new device,
+ // signed-out repurchase attempt) — re-link it instead of buying again.
+ const existing = await getAvailablePurchases().catch(
+ () => [] as Purchase[]
+ );
+ const owned = existing.find((purchase) =>
+ SUBSCRIPTION_SKUS.includes(purchase.productId)
);
- await activateSubscription(customerInfo);
- // Android only: persist the Google Play purchase token (null on iOS). Fire-and-forget
- // after activation, by which point the subscription row exists server-side.
- if (transaction?.purchaseToken) {
- saveGooglePurchaseToken(auth, transaction.purchaseToken);
- }
- } catch (error: any) {
- if (!error?.userCancelled) {
- Alert.alert("Purchase failed", "Could not complete purchase.");
+ if (owned && (await verifyPurchaseWithServer(auth, owned))) {
+ await finishTransaction({ purchase: owned, isConsumable: false }).catch(
+ () => {}
+ );
+ await activateSubscription();
+ setPurchaseLoading(false);
+ return;
}
- } finally {
+
+ const { sku, offerToken } = selectedPlan.option;
+
+ // The result is delivered to onPurchaseSuccess/onPurchaseError, which also
+ // clear the loading state.
+ await requestPurchase({
+ request: {
+ apple: {
+ sku,
+ appAccountToken: user.uuid,
+ },
+ google: {
+ skus: [sku],
+ subscriptionOffers: offerToken ? [{ sku, offerToken }] : undefined,
+ obfuscatedAccountId: user.uuid,
+ },
+ },
+ type: "subs",
+ });
+ } catch {
+ // Failures (including cancellation) are surfaced through onPurchaseError
setPurchaseLoading(false);
}
};
@@ -457,6 +521,22 @@ export default function SubscribeScreen() {
})}
</View>
+ {/* Also shown when fetches "succeed" with no matching products (e.g. SKU
+ env vars not matching the store's product ids — unknown ids are
+ silently omitted rather than erroring) */}
+ {(productsError || fetchAttempt >= 2) && !plansLoaded ? (
+ <TouchableOpacity
+ activeOpacity={0.7}
+ className="mt-3"
+ onPress={() => setFetchAttempt((attempt) => attempt + 1)}
+ >
+ <Text className="text-neutral text-center text-sm">
+ Couldn't load subscription plans.{" "}
+ <Text className="text-primary font-semibold">Retry</Text>
+ </Text>
+ </TouchableOpacity>
+ ) : null}
+
<Button
variant="ghost"
size="lg"
@@ -464,11 +544,11 @@ export default function SubscribeScreen() {
accessibilityRole="button"
accessibilityLabel={paymentButton.accessibilityLabel}
className={`w-full flex-row mt-4 px-4 ${payButtonClass}`}
- disabled={!selectedPlan.package || purchaseLoading || !user?.uuid}
+ disabled={!selectedPlan.option || purchaseLoading || !user?.uuid}
onPress={purchase}
isLoading={purchaseLoading}
>
- {paymentButton.icon ? (
+ {paymentButton.icon && payIconReady ? (
<FontAwesome5
brand
name={paymentButton.icon}
diff --git a/apps/mobile/lib/iap.ts b/apps/mobile/lib/iap.ts
new file mode 100644
index 00000000..f1024e74
--- /dev/null
+++ b/apps/mobile/lib/iap.ts
@@ -0,0 +1,202 @@
+import { Platform } from "react-native";
+import type { MobileAuth } from "@linkwarden/types/global";
+import type { Product, ProductSubscription, Purchase } from "expo-iap";
+
+// Product ids as configured in App Store Connect / Play Console. The _IOS/_ANDROID
+// variants override the shared value when the two stores use different ids. On
+// Android this also works with a single subscription product that has monthly +
+// yearly base plans (both env vars set to the same id) — the offer is picked by
+// billing period.
+export const MONTHLY_SKU =
+ Platform.select({
+ ios: process.env.EXPO_PUBLIC_IAP_MONTHLY_SKU_IOS || "cloud_monthly",
+ android: process.env.EXPO_PUBLIC_IAP_MONTHLY_SKU_ANDROID || "monthly",
+ }) ?? "monthly";
+export const YEARLY_SKU =
+ Platform.select({
+ ios: process.env.EXPO_PUBLIC_IAP_YEARLY_SKU_IOS || "cloud_yearly",
+ android: process.env.EXPO_PUBLIC_IAP_YEARLY_SKU_ANDROID || "yearly",
+ }) ?? "yearly";
+
+export const SUBSCRIPTION_SKUS = [...new Set([MONTHLY_SKU, YEARLY_SKU])];
+
+export type PlanPeriod = "monthly" | "yearly";
+
+export type PlanOption = {
+ sku: string;
+ offerToken?: string; // Android base-plan/offer to purchase
+ displayPrice: string;
+ priceAmount: number | null;
+ currency: string | null;
+ freeTrialPeriod: string | null; // e.g. "7 days"
+};
+
+const PERIOD_UNITS: Record<string, string> = {
+ D: "day",
+ W: "week",
+ M: "month",
+ Y: "year",
+};
+
+const pluralize = (value: number, unit: string) =>
+ `${value} ${value === 1 ? unit : `${unit}s`}`;
+
+// "P1W" × cycles → "1 week", "P3D" → "3 days"
+const formatIsoPeriod = (isoPeriod: string, cycles = 1) => {
+ const match = /^P(\d+)([DWMY])$/.exec(isoPeriod);
+ if (!match) return null;
+
+ const value = Number(match[1]) * Math.max(1, cycles);
+ return pluralize(value, PERIOD_UNITS[match[2]]);
+};
+
+export const formatPrice = (amount: number, currency: string | null) => {
+ try {
+ return new Intl.NumberFormat(undefined, {
+ style: "currency",
+ currency: currency ?? "USD",
+ }).format(amount);
+ } catch {
+ return `${amount.toFixed(2)}${currency ? ` ${currency}` : ""}`;
+ }
+};
+
+const getIosPlan = (product: ProductSubscription): PlanOption => {
+ const ios = product as Extract<ProductSubscription, { platform: "ios" }>;
+
+ const hasFreeTrial =
+ ios.introductoryPricePaymentModeIOS === "free-trial" &&
+ ios.introductoryPriceNumberOfPeriodsIOS &&
+ ios.introductoryPriceSubscriptionPeriodIOS &&
+ ios.introductoryPriceSubscriptionPeriodIOS !== "empty";
+
+ return {
+ sku: product.id,
+ displayPrice: product.displayPrice,
+ priceAmount: product.price ?? null,
+ currency: product.currency ?? null,
+ freeTrialPeriod: hasFreeTrial
+ ? pluralize(
+ Number(ios.introductoryPriceNumberOfPeriodsIOS),
+ ios.introductoryPriceSubscriptionPeriodIOS as string
+ )
+ : null,
+ };
+};
+
+const getAndroidPlan = (
+ product: ProductSubscription,
+ period: PlanPeriod
+): PlanOption | null => {
+ const android = product as Extract<
+ ProductSubscription,
+ { platform: "android" }
+ >;
+ const expectedPeriod = period === "monthly" ? "P1M" : "P1Y";
+
+ // The recurring price is the offer's last pricing phase; earlier phases are
+ // trials/intro prices. Offers not matching the expected billing period belong
+ // to another base plan of the same product.
+ const candidates = (android.subscriptionOfferDetailsAndroid ?? [])
+ .map((offer) => {
+ const phases = offer.pricingPhases?.pricingPhaseList ?? [];
+ const recurringPhase = phases[phases.length - 1];
+ const trialPhase = phases.find(
+ (phase) => phase.priceAmountMicros === "0"
+ );
+
+ return { offer, recurringPhase, trialPhase };
+ })
+ .filter(
+ (candidate) => candidate.recurringPhase?.billingPeriod === expectedPeriod
+ );
+
+ if (!candidates.length) return null;
+
+ // Prefer the offer that includes a free trial (mirrors the store's best offer)
+ const best =
+ candidates.find((candidate) => candidate.trialPhase) ?? candidates[0];
+
+ const recurringPhase = best.recurringPhase!;
+
+ return {
+ sku: product.id,
+ offerToken: best.offer.offerToken,
+ displayPrice: recurringPhase.formattedPrice,
+ priceAmount: Number(recurringPhase.priceAmountMicros) / 1_000_000,
+ currency: recurringPhase.priceCurrencyCode ?? null,
+ freeTrialPeriod: best.trialPhase
+ ? formatIsoPeriod(
+ best.trialPhase.billingPeriod,
+ best.trialPhase.billingCycleCount
+ )
+ : null,
+ };
+};
+
+// Normalizes the store products into the monthly/yearly options the UI renders
+export const getPlanOption = (
+ subscriptions: (Product | ProductSubscription)[],
+ period: PlanPeriod
+): PlanOption | null => {
+ const sku = period === "monthly" ? MONTHLY_SKU : YEARLY_SKU;
+ const product = subscriptions.find(
+ (subscription): subscription is ProductSubscription =>
+ subscription.id === sku && subscription.type === "subs"
+ );
+
+ if (!product) return null;
+
+ return product.platform === "ios"
+ ? getIosPlan(product)
+ : getAndroidPlan(product, period);
+};
+
+const wait = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
+
+// Asks the server to validate the purchase with Apple/Google and activate the
+// subscription. The identifiers are only lookup keys — the server re-fetches the
+// authoritative state from the store, so retrying is always safe.
+export const verifyPurchaseWithServer = async (
+ auth: MobileAuth,
+ purchase: Purchase,
+ attempts = 5
+): Promise<boolean> => {
+ const body =
+ Platform.OS === "ios"
+ ? {
+ platform: "ios",
+ transactionId:
+ (purchase as { transactionId?: string }).transactionId ??
+ purchase.id,
+ }
+ : { platform: "android", purchaseToken: purchase.purchaseToken };
+
+ for (let attempt = 0; attempt < attempts; attempt++) {
+ try {
+ const res = await fetch(
+ `${auth.instance}/api/v1/billing/verify-store-purchase`,
+ {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ Authorization: `Bearer ${auth.session}`,
+ },
+ body: JSON.stringify(body),
+ }
+ );
+
+ if (res.ok) {
+ const data = await res.json().catch(() => null);
+ return Boolean(data?.active);
+ }
+
+ // Client errors won't succeed on retry (bad token, foreign purchase, ...)
+ if (res.status >= 400 && res.status < 500) return false;
+ } catch {}
+
+ await wait(1500);
+ }
+
+ return false;
+};
diff --git a/apps/mobile/package.json b/apps/mobile/package.json
index 5fbe86cb..cd1b1f46 100644
--- a/apps/mobile/package.json
+++ b/apps/mobile/package.json
@@ -41,6 +41,7 @@
"expo-file-system": "~19.0.21",
"expo-font": "~14.0.11",
"expo-haptics": "~15.0.8",
+ "expo-iap": "~4.3.6",
"expo-linking": "~8.0.11",
"expo-navigation-bar": "~5.0.10",
"expo-router": "~6.0.23",
@@ -68,7 +69,6 @@
"react-native-mmkv": "4.1.2",
"react-native-nitro-modules": "0.34.1",
"react-native-pdf": "^7.0.3",
- "react-native-purchases": "^10.2.0",
"react-native-reanimated": "4.1.1",
"react-native-safe-area-context": "^5.7.0",
"react-native-screens": "~4.19.0",
diff --git a/apps/web/lib/api/billing/appStore.ts b/apps/web/lib/api/billing/appStore.ts
new file mode 100644
index 00000000..3514500e
--- /dev/null
+++ b/apps/web/lib/api/billing/appStore.ts
@@ -0,0 +1,188 @@
+import {
+ AppStoreServerAPIClient,
+ APIError,
+ APIException,
+ Environment,
+ type JWSRenewalInfoDecodedPayload,
+ type JWSTransactionDecodedPayload,
+ type LastTransactionsItem,
+ type StatusResponse,
+} from "@apple/app-store-server-library";
+
+const BUNDLE_ID = process.env.APP_STORE_BUNDLE_ID || "app.linkwarden";
+
+export const isAppStoreConfigured = () =>
+ Boolean(
+ process.env.APP_STORE_ISSUER_ID &&
+ process.env.APP_STORE_KEY_ID &&
+ process.env.APP_STORE_PRIVATE_KEY
+ );
+
+const clients: Partial<Record<Environment, AppStoreServerAPIClient>> = {};
+
+const getClient = (environment: Environment) => {
+ if (!isAppStoreConfigured())
+ throw new Error(
+ "Missing APP_STORE_ISSUER_ID/APP_STORE_KEY_ID/APP_STORE_PRIVATE_KEY environment variables!"
+ );
+
+ if (!clients[environment]) {
+ clients[environment] = new AppStoreServerAPIClient(
+ // Deployment tooling often stores the .p8 with literal \n sequences
+ (process.env.APP_STORE_PRIVATE_KEY as string).replace(/\\n/g, "\n"),
+ process.env.APP_STORE_KEY_ID as string,
+ process.env.APP_STORE_ISSUER_ID as string,
+ BUNDLE_ID,
+ environment
+ );
+ }
+
+ return clients[environment] as AppStoreServerAPIClient;
+};
+
+// The JWS payloads we consume are either fetched from Apple's API over TLS or
+// re-validated against it, so decoding without cert-chain verification is safe here.
+export const decodeJws = <T>(jws?: string | null): T | null => {
+ try {
+ if (!jws) return null;
+ return JSON.parse(
+ Buffer.from(jws.split(".")[1], "base64url").toString("utf8")
+ ) as T;
+ } catch {
+ return null;
+ }
+};
+
+const NOT_FOUND_ERRORS = new Set<number>([
+ APIError.TRANSACTION_ID_NOT_FOUND,
+ APIError.ORIGINAL_TRANSACTION_ID_NOT_FOUND,
+]);
+
+const getStatuses = async (transactionId: string) => {
+ try {
+ const response = await getClient(
+ Environment.PRODUCTION
+ ).getAllSubscriptionStatuses(transactionId);
+ return { response, environment: Environment.PRODUCTION };
+ } catch (error) {
+ // Sandbox/TestFlight transactions 404 on the production host; retry against sandbox
+ if (
+ error instanceof APIException &&
+ error.apiError !== null &&
+ NOT_FOUND_ERRORS.has(error.apiError)
+ ) {
+ const response = await getClient(
+ Environment.SANDBOX
+ ).getAllSubscriptionStatuses(transactionId);
+ return { response, environment: Environment.SANDBOX };
+ }
+
+ throw error;
+ }
+};
+
+// Statuses that keep the entitlement: 1 = active, 4 = billing grace period
+const ENTITLED_STATUSES = new Set<number>([1, 4]);
+
+export type AppleSubscriptionState = {
+ active: boolean;
+ sandbox: boolean;
+ originalTransactionId: string | null;
+ productId: string | null;
+ appAccountToken: string | null;
+ currentPeriodStart: Date | null;
+ currentPeriodEnd: Date | null;
+ raw: {
+ transaction: JWSTransactionDecodedPayload;
+ renewalInfo: JWSRenewalInfoDecodedPayload | null;
+ status: number | undefined;
+ };
+} | null;
+
+// Resolves the authoritative subscription state for any transaction id
+// (transactionId or originalTransactionId) belonging to the customer.
+export default async function getAppleSubscriptionState(
+ transactionId: string
+): Promise<AppleSubscriptionState> {
+ let statuses: { response: StatusResponse; environment: Environment };
+
+ try {
+ statuses = await getStatuses(transactionId);
+ } catch (error) {
+ if (
+ error instanceof APIException &&
+ error.apiError !== null &&
+ NOT_FOUND_ERRORS.has(error.apiError)
+ ) {
+ return null;
+ }
+ throw error;
+ }
+
+ const lastTransactions = (statuses.response.data ?? []).flatMap(
+ (group) => group.lastTransactions ?? []
+ );
+
+ if (!lastTransactions.length) return null;
+
+ const decorated = lastTransactions
+ .map((item: LastTransactionsItem) => {
+ const transaction = decodeJws<JWSTransactionDecodedPayload>(
+ item.signedTransactionInfo
+ );
+ const renewalInfo = decodeJws<JWSRenewalInfoDecodedPayload>(
+ item.signedRenewalInfo
+ );
+ return { item, transaction, renewalInfo };
+ })
+ .filter(
+ (
+ entry
+ ): entry is typeof entry & {
+ transaction: JWSTransactionDecodedPayload;
+ } => Boolean(entry.transaction)
+ );
+
+ if (!decorated.length) return null;
+
+ // A customer that switched plans within the group has one entry per product;
+ // prefer the entitled one, otherwise the one that expires last.
+ const best =
+ decorated.find(
+ (entry) =>
+ ENTITLED_STATUSES.has(Number(entry.item.status)) &&
+ !entry.transaction.revocationDate
+ ) ??
+ decorated.sort(
+ (a, b) => (b.transaction.expiresDate ?? 0) - (a.transaction.expiresDate ?? 0)
+ )[0];
+
+ const { item, transaction, renewalInfo } = best;
+
+ const expiresDate = transaction.expiresDate ?? null;
+ const gracePeriodExpiresDate = renewalInfo?.gracePeriodExpiresDate ?? null;
+ const currentPeriodEndMs =
+ gracePeriodExpiresDate && gracePeriodExpiresDate > (expiresDate ?? 0)
+ ? gracePeriodExpiresDate
+ : expiresDate;
+
+ const active =
+ ENTITLED_STATUSES.has(Number(item.status)) &&
+ !transaction.revocationDate &&
+ (currentPeriodEndMs ?? 0) > Date.now();
+
+ return {
+ active,
+ sandbox: statuses.environment === Environment.SANDBOX,
+ originalTransactionId:
+ transaction.originalTransactionId ?? item.originalTransactionId ?? null,
+ productId: transaction.productId ?? null,
+ // Apple lowercases the UUID in JWS payloads; user.uuid is stored lowercase too
+ appAccountToken: transaction.appAccountToken?.toLowerCase() ?? null,
+ currentPeriodStart: transaction.purchaseDate
+ ? new Date(transaction.purchaseDate)
+ : null,
+ currentPeriodEnd: currentPeriodEndMs ? new Date(currentPeriodEndMs) : null,
+ raw: { transaction, renewalInfo, status: item.status },
+ };
+}
diff --git a/apps/web/lib/api/billing/checkRevenuecatSubscription.ts b/apps/web/lib/api/billing/checkRevenuecatSubscription.ts
deleted file mode 100644
index 61448bcd..00000000
--- a/apps/web/lib/api/billing/checkRevenuecatSubscription.ts
+++ /dev/null
@@ -1,76 +0,0 @@
-import mapStore from "./mapStore";
-
-type RevenueCatSubscription = {
- id: string;
- product_id: string;
- store?: string | null;
- current_period_starts_at: number | null;
- current_period_ends_at: number | null;
- store_subscription_identifier: string | number | null;
- gives_access: boolean;
- status: string;
- entitlements?: {
- items?: {
- lookup_key?: string;
- state?: string;
- }[];
- };
-};
-
-export default async function checkRevenuecatSubscription(appUserId: string) {
- const projectId = process.env.REVENUECAT_PROJECT_ID;
- const apiKey = process.env.REVENUECAT_API_KEY;
-
- if (!projectId || !apiKey)
- throw new Error(
- `Missing REVENUECAT_PROJECT_ID/REVENUECAT_API_KEY envirnonment variables!`
- );
-
- const entitlementId = "Linkwarden Cloud";
-
- const res = await fetch(
- `https://api.revenuecat.com/v2/projects/${projectId}/customers/${encodeURIComponent(
- appUserId
- )}/subscriptions?limit=20`,
- {
- headers: {
- Authorization: `Bearer ${apiKey}`,
- },
- cache: "no-store",
- }
- );
-
- if (res.status === 404) return null;
- if (!res.ok) throw new Error(`RevenueCat API error: ${res.status}`);
-
- const data = (await res.json()) as { items?: RevenueCatSubscription[] };
-
- const sub = data.items
- ?.filter((s) => {
- const hasEntitlement = s.entitlements?.items?.some(
- (e) => e.lookup_key === entitlementId && e.state === "active"
- );
-
- return s.gives_access && hasEntitlement;
- })
- .sort(
- (a, b) =>
- (b.current_period_ends_at ?? 0) - (a.current_period_ends_at ?? 0)
- )[0];
-
- if (!sub?.current_period_starts_at || !sub?.current_period_ends_at) {
- return null;
- }
-
- return {
- active: sub.gives_access,
- store: mapStore(sub.store),
- storeOriginalTransactionId: sub.store_subscription_identifier
- ? String(sub.store_subscription_identifier)
- : null,
- storeProductId: sub.product_id ?? null,
- currentPeriodStart: new Date(sub.current_period_starts_at),
- currentPeriodEnd: new Date(sub.current_period_ends_at),
- raw: sub,
- };
-}
diff --git a/apps/web/lib/api/billing/googlePlay.ts b/apps/web/lib/api/billing/googlePlay.ts
new file mode 100644
index 00000000..96cb92cf
--- /dev/null
+++ b/apps/web/lib/api/billing/googlePlay.ts
@@ -0,0 +1,158 @@
+import { JWT } from "google-auth-library";
+
+const PACKAGE_NAME = process.env.GOOGLE_PLAY_PACKAGE_NAME || "app.linkwarden";
+const API_BASE = `https://androidpublisher.googleapis.com/androidpublisher/v3/applications/${PACKAGE_NAME}`;
+
+export const isGooglePlayConfigured = () =>
+ Boolean(process.env.GOOGLE_PLAY_SERVICE_ACCOUNT_JSON);
+
+let client: JWT | null = null;
+
+const getClient = () => {
+ const raw = process.env.GOOGLE_PLAY_SERVICE_ACCOUNT_JSON;
+
+ if (!raw)
+ throw new Error(
+ "Missing GOOGLE_PLAY_SERVICE_ACCOUNT_JSON environment variable!"
+ );
+
+ if (!client) {
+ // Accept both raw and base64-encoded service-account JSON
+ const json = raw.trim().startsWith("{")
+ ? raw
+ : Buffer.from(raw, "base64").toString("utf8");
+ const credentials = JSON.parse(json) as {
+ client_email: string;
+ private_key: string;
+ };
+
+ client = new JWT({
+ email: credentials.client_email,
+ key: credentials.private_key.replace(/\\n/g, "\n"),
+ scopes: ["https://www.googleapis.com/auth/androidpublisher"],
+ });
+ }
+
+ return client;
+};
+
+type SubscriptionPurchaseV2 = {
+ kind?: string;
+ startTime?: string;
+ subscriptionState?: string;
+ latestOrderId?: string;
+ linkedPurchaseToken?: string;
+ acknowledgementState?: string;
+ externalAccountIdentifiers?: {
+ obfuscatedExternalAccountId?: string;
+ obfuscatedExternalProfileId?: string;
+ };
+ outOfAppPurchaseContext?: {
+ expiredExternalAccountIdentifiers?: {
+ obfuscatedExternalAccountId?: string;
+ };
+ expiredPurchaseToken?: string;
+ };
+ testPurchase?: object;
+ lineItems?: {
+ productId?: string;
+ expiryTime?: string;
+ offerDetails?: { basePlanId?: string; offerId?: string };
+ autoRenewingPlan?: { autoRenewEnabled?: boolean };
+ }[];
+};
+
+// States that keep the entitlement: canceled stays entitled until expiryTime
+const ENTITLED_STATES = new Set([
+ "SUBSCRIPTION_STATE_ACTIVE",
+ "SUBSCRIPTION_STATE_CANCELED",
+ "SUBSCRIPTION_STATE_IN_GRACE_PERIOD",
+]);
+
+export type GoogleSubscriptionState = {
+ active: boolean;
+ sandbox: boolean;
+ productId: string | null;
+ obfuscatedExternalAccountId: string | null;
+ expiredObfuscatedExternalAccountId: string | null;
+ linkedPurchaseToken: string | null;
+ expiredPurchaseToken: string | null;
+ needsAcknowledgement: boolean;
+ currentPeriodStart: Date | null;
+ currentPeriodEnd: Date | null;
+ raw: SubscriptionPurchaseV2;
+} | null;
+
+export default async function getGoogleSubscriptionState(
+ purchaseToken: string
+): Promise<GoogleSubscriptionState> {
+ let purchase: SubscriptionPurchaseV2;
+
+ try {
+ const response = await getClient().request<SubscriptionPurchaseV2>({
+ url: `${API_BASE}/purchases/subscriptionsv2/tokens/${encodeURIComponent(
+ purchaseToken
+ )}`,
+ });
+ purchase = response.data;
+ } catch (error: any) {
+ const status = error?.response?.status;
+ // Unknown, malformed, or purged (~60 days after expiry) tokens
+ if (status === 400 || status === 404 || status === 410) return null;
+ throw error;
+ }
+
+ const lineItems = purchase.lineItems ?? [];
+ const latest = [...lineItems].sort(
+ (a, b) =>
+ new Date(b.expiryTime ?? 0).getTime() -
+ new Date(a.expiryTime ?? 0).getTime()
+ )[0];
+
+ const expiryTime = latest?.expiryTime ? new Date(latest.expiryTime) : null;
+
+ const active =
+ ENTITLED_STATES.has(purchase.subscriptionState ?? "") &&
+ (expiryTime?.getTime() ?? 0) > Date.now();
+
+ return {
+ active,
+ sandbox: purchase.testPurchase !== undefined,
+ productId: latest?.productId ?? null,
+ obfuscatedExternalAccountId:
+ purchase.externalAccountIdentifiers?.obfuscatedExternalAccountId ?? null,
+ expiredObfuscatedExternalAccountId:
+ purchase.outOfAppPurchaseContext?.expiredExternalAccountIdentifiers
+ ?.obfuscatedExternalAccountId ?? null,
+ linkedPurchaseToken: purchase.linkedPurchaseToken ?? null,
+ expiredPurchaseToken:
+ purchase.outOfAppPurchaseContext?.expiredPurchaseToken ?? null,
+ needsAcknowledgement:
+ purchase.acknowledgementState === "ACKNOWLEDGEMENT_STATE_PENDING",
+ currentPeriodStart: purchase.startTime ? new Date(purchase.startTime) : null,
+ currentPeriodEnd: expiryTime,
+ raw: purchase,
+ };
+}
+
+// Unacknowledged purchases are auto-refunded by Google after 3 days, so this must
+// run server-side even though the app also finishes the transaction client-side.
+export async function acknowledgeGoogleSubscription(
+ purchaseToken: string,
+ productId: string
+) {
+ try {
+ await getClient().request({
+ url: `${API_BASE}/purchases/subscriptions/${encodeURIComponent(
+ productId
+ )}/tokens/${encodeURIComponent(purchaseToken)}:acknowledge`,
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ data: {},
+ });
+ } catch (error: any) {
+ // 400 = already acknowledged (client finished the transaction first)
+ if (error?.response?.status === 400) return;
+ throw error;
+ }
+}
diff --git a/apps/web/lib/api/billing/mapStore.ts b/apps/web/lib/api/billing/mapStore.ts
deleted file mode 100644
index 61892c3a..00000000
--- a/apps/web/lib/api/billing/mapStore.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import type { SubscriptionStore } from "@linkwarden/prisma/client";
-
-export default function mapStore(
- store?: string | null
-): SubscriptionStore | undefined {
- switch (store?.toUpperCase()) {
- case "APP_STORE":
- case "MAC_APP_STORE":
- return "APP_STORE";
- case "PLAY_STORE":
- return "PLAY_STORE";
- default:
- return undefined;
- }
-}
diff --git a/apps/web/lib/api/billing/stripeStoreReset.ts b/apps/web/lib/api/billing/stripeStoreReset.ts
index 136ba151..11ca8128 100644
--- a/apps/web/lib/api/billing/stripeStoreReset.ts
+++ b/apps/web/lib/api/billing/stripeStoreReset.ts
@@ -1,14 +1,12 @@
import { Prisma } from "@linkwarden/prisma/client";
// A Stripe subscription is web-only, so every write that sets `provider: "STRIPE"`
-// clears the RevenueCat/IAP-store fields. This keeps a row that switched over from
-// RevenueCat from carrying stale store identifiers, and is shared across every Stripe
-// write path so they can't drift apart.
+// clears the IAP-store fields. This keeps a row that switched over from the App
+// Store/Play Store from carrying stale store identifiers, and is shared across every
+// Stripe write path so they can't drift apart.
export const stripeStoreReset = {
- store: null,
- revenueCatAppUserId: null,
storeOriginalTransactionId: null,
storeProductId: null,
googlePurchaseToken: null,
- revenuecatMetadata: Prisma.DbNull,
+ storeMetadata: Prisma.DbNull,
};
diff --git a/apps/web/lib/api/billing/syncRevenuecatSubscription.ts b/apps/web/lib/api/billing/syncRevenuecatSubscription.ts
deleted file mode 100644
index eb3e9036..00000000
--- a/apps/web/lib/api/billing/syncRevenuecatSubscription.ts
+++ /dev/null
@@ -1,83 +0,0 @@
-import { prisma } from "@linkwarden/prisma";
-import type { Prisma, User } from "@linkwarden/prisma/client";
-import checkRevenuecatSubscription from "./checkRevenuecatSubscription";
-
-const hasRevenuecatCredentials = () =>
- Boolean(process.env.REVENUECAT_PROJECT_ID && process.env.REVENUECAT_API_KEY);
-
-export default async function syncRevenuecatSubscription(
- user: Pick<User, "id" | "uuid">
-) {
- if (!hasRevenuecatCredentials()) return null;
-
- const subscription = await checkRevenuecatSubscription(user.uuid);
-
- if (
- !subscription ||
- !subscription.active ||
- !subscription.currentPeriodEnd ||
- !subscription.storeOriginalTransactionId ||
- !subscription.currentPeriodStart
- ) {
- await prisma.subscription.updateMany({
- where: {
- provider: "REVENUECAT",
- OR: [{ userId: user.id }, { revenueCatAppUserId: user.uuid }],
- },
- data: {
- active: false,
- },
- });
-
- return null;
- }
-
- const isGooglePlay = subscription.store === "PLAY_STORE";
-
- const data = {
- active: subscription.active,
- provider: "REVENUECAT" as const,
- // Clear any leftover Stripe identifier when switching Stripe -> RevenueCat.
- stripeSubscriptionId: null,
- revenueCatAppUserId: user.uuid,
- store: subscription.store,
- storeOriginalTransactionId: subscription.storeOriginalTransactionId,
- storeProductId: subscription.storeProductId,
- revenuecatMetadata: subscription.raw as Prisma.InputJsonValue,
- currentPeriodStart: subscription.currentPeriodStart,
- currentPeriodEnd: subscription.currentPeriodEnd,
- quantity: 1,
- // Leave the client-captured token alone for Google Play; clear a stale one
- // when switching to a non-Google store (e.g. Google -> Apple).
- ...(isGooglePlay ? {} : { googlePurchaseToken: null }),
- };
-
- const existingSubscription = await prisma.subscription.findUnique({
- where: {
- revenueCatAppUserId: user.uuid,
- },
- });
-
- if (existingSubscription) {
- return prisma.subscription.update({
- where: {
- id: existingSubscription.id,
- },
- data: {
- ...data,
- userId: user.id,
- },
- });
- }
-
- return prisma.subscription.upsert({
- where: {
- userId: user.id,
- },
- create: {
- ...data,
- userId: user.id,
- },
- update: data,
- });
-}
diff --git a/apps/web/lib/api/billing/syncStoreSubscription.ts b/apps/web/lib/api/billing/syncStoreSubscription.ts
new file mode 100644
index 00000000..a673e5cf
--- /dev/null
+++ b/apps/web/lib/api/billing/syncStoreSubscription.ts
@@ -0,0 +1,306 @@
+import { prisma } from "@linkwarden/prisma";
+import type { Prisma, Subscription, User } from "@linkwarden/prisma/client";
+import getAppleSubscriptionState, {
+ isAppStoreConfigured,
+ type AppleSubscriptionState,
+} from "./appStore";
+import getGoogleSubscriptionState, {
+ acknowledgeGoogleSubscription,
+ isGooglePlayConfigured,
+ type GoogleSubscriptionState,
+} from "./googlePlay";
+
+export const UUID_REGEX =
+ /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
+
+export const isStoreBillingConfigured = () =>
+ isAppStoreConfigured() || isGooglePlayConfigured();
+
+// Sandbox/TestFlight and Play license-tester purchases only grant entitlements in
+// production when explicitly allowed (e.g. during App Review).
+const acceptsSandbox = () =>
+ process.env.STORE_ACCEPT_SANDBOX === "true" ||
+ process.env.NODE_ENV !== "production";
+
+const shouldGrant = (state: { sandbox: boolean } | null) =>
+ Boolean(state && (!state.sandbox || acceptsSandbox()));
+
+export async function writeAppleSubscription(
+ userId: number,
+ state: NonNullable<AppleSubscriptionState>
+): Promise<Subscription | null> {
+ if (state.sandbox && !acceptsSandbox()) return null;
+ if (!state.currentPeriodStart || !state.currentPeriodEnd) return null;
+ if (!state.originalTransactionId) return null;
+
+ // An inactive state may be stale (delayed/replayed notification) or refer to a
+ // subscription the user replaced (e.g. they now pay via Stripe) — it may only
+ // deactivate the row that actually tracks this exact store subscription, never
+ // take over the user's row.
+ if (!state.active) {
+ await prisma.subscription.updateMany({
+ where: {
+ userId,
+ provider: "APPLE",
+ storeOriginalTransactionId: state.originalTransactionId,
+ },
+ data: {
+ active: false,
+ storeMetadata: state.raw as unknown as Prisma.InputJsonValue,
+ currentPeriodStart: state.currentPeriodStart,
+ currentPeriodEnd: state.currentPeriodEnd,
+ },
+ });
+ return null;
+ }
+
+ // The same App Store subscription can only back one account at a time; release
+ // it from any other account (e.g. re-restored after switching Linkwarden accounts).
+ await prisma.subscription.updateMany({
+ where: {
+ storeOriginalTransactionId: state.originalTransactionId,
+ NOT: { userId },
+ },
+ data: { active: false, storeOriginalTransactionId: null },
+ });
+
+ const data = {
+ active: true,
+ provider: "APPLE" as const,
+ stripeSubscriptionId: null,
+ storeOriginalTransactionId: state.originalTransactionId,
+ storeProductId: state.productId,
+ googlePurchaseToken: null,
+ storeMetadata: state.raw as unknown as Prisma.InputJsonValue,
+ currentPeriodStart: state.currentPeriodStart,
+ currentPeriodEnd: state.currentPeriodEnd,
+ quantity: 1,
+ };
+
+ return prisma.subscription.upsert({
+ where: { userId },
+ create: { ...data, userId },
+ update: data,
+ });
+}
+
+export async function writeGoogleSubscription(
+ userId: number,
+ state: NonNullable<GoogleSubscriptionState>,
+ purchaseToken: string
+): Promise<Subscription | null> {
+ if (state.sandbox && !acceptsSandbox()) return null;
+ if (!state.currentPeriodStart || !state.currentPeriodEnd) return null;
+
+ // Same rule as Apple: an inactive state (expired, or a superseded token whose
+ // replacement the row already tracks) may only touch the row holding this token.
+ if (!state.active) {
+ await prisma.subscription.updateMany({
+ where: {
+ userId,
+ provider: "GOOGLE",
+ googlePurchaseToken: purchaseToken,
+ },
+ data: {
+ active: false,
+ storeMetadata: state.raw as unknown as Prisma.InputJsonValue,
+ currentPeriodStart: state.currentPeriodStart,
+ currentPeriodEnd: state.currentPeriodEnd,
+ },
+ });
+ return null;
+ }
+
+ await prisma.subscription.updateMany({
+ where: { googlePurchaseToken: purchaseToken, NOT: { userId } },
+ data: { active: false, googlePurchaseToken: null },
+ });
+
+ const data = {
+ active: true,
+ provider: "GOOGLE" as const,
+ stripeSubscriptionId: null,
+ storeOriginalTransactionId: null,
+ storeProductId: state.productId,
+ googlePurchaseToken: purchaseToken,
+ storeMetadata: state.raw as unknown as Prisma.InputJsonValue,
+ currentPeriodStart: state.currentPeriodStart,
+ currentPeriodEnd: state.currentPeriodEnd,
+ quantity: 1,
+ };
+
+ const subscription = await prisma.subscription.upsert({
+ where: { userId },
+ create: { ...data, userId },
+ update: data,
+ });
+
+ // Google auto-refunds unacknowledged purchases after 3 days, so acknowledge as
+ // soon as the entitlement is granted (renewals never need acknowledgement).
+ if (state.needsAcknowledgement && state.productId) {
+ await acknowledgeGoogleSubscription(purchaseToken, state.productId).catch(
+ (error) => console.error("Error acknowledging Google purchase:", error)
+ );
+ }
+
+ return subscription;
+}
+
+// Ownership of a client-reported Apple transaction. The appAccountToken is stamped
+// with the buyer's user.uuid at purchase time; out-of-app purchases (e.g. offer-code
+// redemptions in the App Store) have none.
+const ownsAppleTransaction = async (
+ user: Pick<User, "id" | "uuid">,
+ state: NonNullable<AppleSubscriptionState>
+) => {
+ if (state.appAccountToken) {
+ if (state.appAccountToken === user.uuid) return true;
+
+ if (UUID_REGEX.test(state.appAccountToken)) {
+ const stampedUser = await prisma.user.findUnique({
+ where: { uuid: state.appAccountToken },
+ select: { id: true },
+ });
+ // Stamped for a live account that isn't the caller — refuse. If the stamped
+ // account was deleted (user deleted and recreated their Linkwarden account),
+ // the store subscription can't be re-stamped, so fall through to the
+ // claimed-row check below.
+ if (stampedUser) return false;
+ } else {
+ return false;
+ }
+ }
+
+ // No usable token (out-of-app purchase, or deleted stamped account): allow
+ // unless the transaction is already bound to another account's row.
+ if (!state.originalTransactionId) return false;
+
+ const claimedBy = await prisma.subscription.findUnique({
+ where: { storeOriginalTransactionId: state.originalTransactionId },
+ select: { userId: true },
+ });
+
+ return !claimedBy || claimedBy.userId === user.id;
+};
+
+// Ownership of a client-reported Play purchase. The buyer's user.uuid is stamped
+// as obfuscatedAccountId at purchase time.
+const ownsGooglePurchase = async (
+ user: Pick<User, "id" | "uuid">,
+ state: NonNullable<GoogleSubscriptionState>,
+ purchaseToken: string
+) => {
+ const accountId =
+ state.obfuscatedExternalAccountId ??
+ state.expiredObfuscatedExternalAccountId;
+
+ if (accountId === user.uuid) return true;
+
+ if (accountId && UUID_REGEX.test(accountId)) {
+ const stampedUser = await prisma.user.findUnique({
+ where: { uuid: accountId },
+ select: { id: true },
+ });
+ // Deleted-and-recreated account — possession of the token decides
+ if (stampedUser) return false;
+ }
+
+ // Unrecognized/absent id: allow unless another account already holds the token
+ const claimedBy = await prisma.subscription.findFirst({
+ where: {
+ googlePurchaseToken: {
+ in: [purchaseToken, state.linkedPurchaseToken ?? purchaseToken],
+ },
+ },
+ select: { userId: true },
+ });
+
+ return !claimedBy || claimedBy.userId === user.id;
+};
+
+export type StorePurchaseHint =
+ | { provider: "APPLE"; transactionId: string }
+ | { provider: "GOOGLE"; purchaseToken: string };
+
+// Re-syncs a user's App Store/Play Store subscription straight from Apple/Google.
+// `hint` carries a client-reported purchase (purchase/restore flows) and is subject
+// to ownership checks; without it the identifiers already stored on the user's own
+// subscription row are used (ownership was established when they were stored).
+// Returns null when there was nothing to sync from; returns the (possibly
+// deactivated) row when the store answered authoritatively.
+export default async function syncStoreSubscription(
+ user: Pick<User, "id" | "uuid">,
+ hint?: StorePurchaseHint
+): Promise<Subscription | null> {
+ const existing = hint
+ ? null
+ : await prisma.subscription.findUnique({ where: { userId: user.id } });
+
+ const deactivate = async () => {
+ await prisma.subscription.updateMany({
+ where: { userId: user.id, provider: { in: ["APPLE", "GOOGLE"] } },
+ data: { active: false },
+ });
+ return prisma.subscription.findUnique({ where: { userId: user.id } });
+ };
+
+ if (
+ (hint?.provider === "APPLE" ||
+ (!hint && existing?.provider === "APPLE" &&
+ existing.storeOriginalTransactionId)) &&
+ isAppStoreConfigured()
+ ) {
+ const transactionId =
+ hint?.provider === "APPLE"
+ ? hint.transactionId
+ : (existing?.storeOriginalTransactionId as string);
+
+ const state = await getAppleSubscriptionState(transactionId);
+
+ if (!state) return hint ? null : deactivate();
+
+ if (hint && !(await ownsAppleTransaction(user, state))) {
+ console.warn(
+ `App Store transaction ${state.originalTransactionId} belongs to another account.`
+ );
+ return null;
+ }
+
+ if (!shouldGrant(state) || !state.active)
+ return hint ? null : deactivate();
+
+ return writeAppleSubscription(user.id, state);
+ }
+
+ if (
+ (hint?.provider === "GOOGLE" ||
+ (!hint && existing?.provider === "GOOGLE" &&
+ existing.googlePurchaseToken)) &&
+ isGooglePlayConfigured()
+ ) {
+ const purchaseToken =
+ hint?.provider === "GOOGLE"
+ ? hint.purchaseToken
+ : (existing?.googlePurchaseToken as string);
+
+ const state = await getGoogleSubscriptionState(purchaseToken);
+
+ if (!state) return hint ? null : deactivate();
+
+ if (hint && !(await ownsGooglePurchase(user, state, purchaseToken))) {
+ console.warn(
+ "Play Store purchase token belongs to another account (obfuscated id mismatch)."
+ );
+ return null;
+ }
+
+ if (!shouldGrant(state) || !state.active)
+ return hint ? null : deactivate();
+
+ return writeGoogleSubscription(user.id, state, purchaseToken);
+ }
+
+ // Nothing to sync from: no store identifiers on file, or the store isn't
+ // configured.
+ return null;
+}
diff --git a/apps/web/lib/api/billing/updateRevenuecatCustomerEmail.ts b/apps/web/lib/api/billing/updateRevenuecatCustomerEmail.ts
deleted file mode 100644
index 7b47e2ae..00000000
--- a/apps/web/lib/api/billing/updateRevenuecatCustomerEmail.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-export default async function updateRevenuecatCustomerEmail(
- appUserId: string,
- newEmail: string
-) {
- const projectId = process.env.REVENUECAT_PROJECT_ID;
- const apiKey = process.env.REVENUECAT_API_KEY;
-
- if (!projectId || !apiKey)
- throw new Error(
- "Missing REVENUECAT_PROJECT_ID/REVENUECAT_API_KEY environment variables!"
- );
-
- const response = await fetch(
- `https://api.revenuecat.com/v2/projects/${projectId}/customers/${encodeURIComponent(
- appUserId
- )}/attributes`,
- {
- method: "POST",
- headers: {
- Authorization: `Bearer ${apiKey}`,
- "Content-Type": "application/json",
- },
- body: JSON.stringify({
- attributes: [
- {
- name: "$email",
- value: newEmail.toLowerCase().trim(),
- },
- ],
- }),
- }
- );
-
- if (response.status === 404) return false;
-
- if (!response.ok) {
- throw new Error(
- `RevenueCat API error: ${response.status} ${await response.text()}`
- );
- }
-
- return true;
-}
diff --git a/apps/web/lib/api/billing/verifySubscription.ts b/apps/web/lib/api/billing/verifySubscription.ts
index a8540b58..d243d747 100644
--- a/apps/web/lib/api/billing/verifySubscription.ts
+++ b/apps/web/lib/api/billing/verifySubscription.ts
@@ -1,7 +1,7 @@
import { prisma } from "@linkwarden/prisma";
import { Subscription, User } from "@linkwarden/prisma/client";
import checkStripeSubscriptionByEmail from "./checkStripeSubscriptionByEmail";
-import syncRevenuecatSubscription from "./syncRevenuecatSubscription";
+import syncStoreSubscription from "./syncStoreSubscription";
import { stripeStoreReset } from "./stripeStoreReset";
interface UserIncludingSubscription extends User {
@@ -11,6 +11,7 @@ interface UserIncludingSubscription extends User {
const TRIAL_PERIOD_DAYS = process.env.NEXT_PUBLIC_TRIAL_PERIOD_DAYS || 14;
const REQUIRE_CC = process.env.NEXT_PUBLIC_REQUIRE_CC === "true";
+const STORE_SYNC_GRACE_PERIOD_MS = 3 * 86400000;
export default async function verifySubscription(
user?: UserIncludingSubscription | null
@@ -82,14 +83,30 @@ export default async function verifySubscription(
})
.catch((err) => console.log(err));
} else {
- const subscription = await syncRevenuecatSubscription(user).catch(
- (err) => {
- console.log(err);
- return null;
- }
- );
+ const subscription = await syncStoreSubscription(user).catch((err) => {
+ console.log(err);
+ return null;
+ });
if (!subscription?.active) {
+ // A null result means the sync couldn't consult the store (missing store
+ // credentials or identifiers) rather than an authoritative "expired".
+ // Honor the row itself within a short grace window past its period end
+ // instead of locking out a payer.
+ const graceCutoff =
+ user.subscriptions &&
+ new Date(user.subscriptions.currentPeriodEnd).getTime() +
+ STORE_SYNC_GRACE_PERIOD_MS;
+
+ if (
+ subscription === null &&
+ user.subscriptions?.active &&
+ graceCutoff &&
+ Date.now() < graceCutoff
+ ) {
+ return user;
+ }
+
return null;
}
}
diff --git a/apps/web/lib/api/controllers/users/userId/deleteUserById.ts b/apps/web/lib/api/controllers/users/userId/deleteUserById.ts
index 95c6ee0d..fb487688 100644
--- a/apps/web/lib/api/controllers/users/userId/deleteUserById.ts
+++ b/apps/web/lib/api/controllers/users/userId/deleteUserById.ts
@@ -5,6 +5,7 @@ import { DeleteUserBody } from "@linkwarden/types/global";
import updateSeats from "@/lib/api/billing/updateSeats";
import { meiliClient } from "@linkwarden/lib/meilisearchClient";
import stripeSDK from "@/lib/api/billing/stripeSDK";
+import { isStoreBillingConfigured } from "@/lib/api/billing/syncStoreSubscription";
import transporter from "@linkwarden/lib/transporter";
export default async function deleteUserById(
@@ -142,10 +143,7 @@ export default async function deleteUserById(
await removeFile({ filePath: `uploads/avatar/${queryId}.jpg` });
const billingEnabled =
- Boolean(process.env.STRIPE_SECRET_KEY) ||
- Boolean(
- process.env.REVENUECAT_PROJECT_ID && process.env.REVENUECAT_API_KEY
- );
+ Boolean(process.env.STRIPE_SECRET_KEY) || isStoreBillingConfigured();
// Send an email about cancellation reason if provided
if (
diff --git a/apps/web/package.json b/apps/web/package.json
index 37eeef28..0a5278fc 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -16,6 +16,7 @@
"postinstall": "playwright install --with-deps chromium"
},
"dependencies": {
+ "@apple/app-store-server-library": "^3.1.0",
"@atlaskit/tree": "^8.8.7",
"@auth/prisma-adapter": "^1.0.1",
"@dnd-kit/core": "^6.3.1",
@@ -50,6 +51,7 @@
"eslint-config-next": "13.4.9",
"formidable": "^3.5.1",
"fuse.js": "^7.0.0",
+ "google-auth-library": "^10.9.0",
"handlebars": "^4.7.8",
"himalaya": "^1.1.0",
"https-proxy-agent": "^7.0.6",
diff --git a/apps/web/pages/api/v1/auth/verify-email.ts b/apps/web/pages/api/v1/auth/verify-email.ts
index 8570be25..1ca4a608 100644
--- a/apps/web/pages/api/v1/auth/verify-email.ts
+++ b/apps/web/pages/api/v1/auth/verify-email.ts
@@ -1,6 +1,5 @@
import { prisma } from "@linkwarden/prisma";
import updateCustomerEmail from "@/lib/api/billing/updateStripeCustomerEmail";
-import updateRevenuecatCustomerEmail from "@/lib/api/billing/updateRevenuecatCustomerEmail";
import { VerifyEmailSchema } from "@linkwarden/lib/schemaValidation";
import type { NextApiRequest, NextApiResponse } from "next";
@@ -105,13 +104,6 @@ export default async function verifyEmail(
await updateCustomerEmail(oldEmail, newEmail);
}
- if (process.env.REVENUECAT_PROJECT_ID && process.env.REVENUECAT_API_KEY) {
- await updateRevenuecatCustomerEmail(
- user.subscriptions?.revenueCatAppUserId ?? user.uuid,
- newEmail
- );
- }
-
// Clean up existing tokens
await prisma.verificationToken.delete({
where: {
diff --git a/apps/web/pages/api/v1/billing/google-purchase-token.ts b/apps/web/pages/api/v1/billing/google-purchase-token.ts
deleted file mode 100644
index bba43f79..00000000
--- a/apps/web/pages/api/v1/billing/google-purchase-token.ts
+++ /dev/null
@@ -1,56 +0,0 @@
-import type { NextApiRequest, NextApiResponse } from "next";
-import { prisma } from "@linkwarden/prisma";
-import verifyToken from "@/lib/api/verifyToken";
-
-export default async function googlePurchaseToken(
- req: NextApiRequest,
- res: NextApiResponse
-) {
- if (req.method !== "POST") {
- return res.status(405).json({ response: "Method not allowed." });
- }
-
- if (process.env.NEXT_PUBLIC_DEMO === "true")
- return res.status(400).json({
- response:
- "This action is disabled because this is a read-only demo of Linkwarden.",
- });
-
- if (!process.env.REVENUECAT_WEBHOOK_AUTHORIZATION) {
- return res.status(400).json({
- response:
- "This action is disabled because RevenueCat is not initialized.",
- });
- }
-
- const token = await verifyToken({ req });
-
- if (typeof token === "string") {
- return res.status(401).json({ response: token });
- }
-
- const purchaseToken = req.body?.purchaseToken;
-
- if (typeof purchaseToken !== "string" || !purchaseToken.trim()) {
- return res.status(400).json({ response: "Missing purchase token." });
- }
-
- try {
- const { count } = await prisma.subscription.updateMany({
- where: {
- userId: token.id,
- provider: "REVENUECAT",
- store: "PLAY_STORE",
- },
- data: {
- googlePurchaseToken: purchaseToken,
- },
- });
-
- return res.status(200).json({ response: "Done!", updated: count });
- } catch (error) {
- return res
- .status(409)
- .json({ response: "Purchase token already in use.", updated: 0 });
- }
-}
diff --git a/apps/web/pages/api/v1/billing/verify-store-purchase.ts b/apps/web/pages/api/v1/billing/verify-store-purchase.ts
new file mode 100644
index 00000000..4a0f6155
--- /dev/null
+++ b/apps/web/pages/api/v1/billing/verify-store-purchase.ts
@@ -0,0 +1,81 @@
+import type { NextApiRequest, NextApiResponse } from "next";
+import verifyToken from "@/lib/api/verifyToken";
+import { prisma } from "@linkwarden/prisma";
+import syncStoreSubscription, {
+ type StorePurchaseHint,
+} from "@/lib/api/billing/syncStoreSubscription";
+import { isAppStoreConfigured } from "@/lib/api/billing/appStore";
+import { isGooglePlayConfigured } from "@/lib/api/billing/googlePlay";
+
+// Called by the mobile app right after a purchase or restore. The reported
+// identifiers are only used as lookup keys — the subscription state itself is
+// fetched from Apple/Google, so a forged request can't grant an entitlement.
+export default async function verifyStorePurchase(
+ req: NextApiRequest,
+ res: NextApiResponse
+) {
+ if (req.method !== "POST") {
+ return res.status(405).json({ response: "Method not allowed." });
+ }
+
+ if (process.env.NEXT_PUBLIC_DEMO === "true")
+ return res.status(400).json({
+ response:
+ "This action is disabled because this is a read-only demo of Linkwarden.",
+ });
+
+ const token = await verifyToken({ req });
+
+ if (typeof token === "string") {
+ return res.status(401).json({ response: token });
+ }
+
+ const platform = req.body?.platform;
+ const transactionId = req.body?.transactionId;
+ const purchaseToken = req.body?.purchaseToken;
+
+ let hint: StorePurchaseHint;
+
+ if (platform === "ios" && typeof transactionId === "string" && transactionId) {
+ if (!isAppStoreConfigured())
+ return res
+ .status(400)
+ .json({ response: "App Store billing is not configured." });
+
+ hint = { provider: "APPLE", transactionId };
+ } else if (
+ platform === "android" &&
+ typeof purchaseToken === "string" &&
+ purchaseToken
+ ) {
+ if (!isGooglePlayConfigured())
+ return res
+ .status(400)
+ .json({ response: "Play Store billing is not configured." });
+
+ hint = { provider: "GOOGLE", purchaseToken };
+ } else {
+ return res.status(400).json({ response: "Invalid request." });
+ }
+
+ const user = await prisma.user.findUnique({
+ where: { id: token.id },
+ select: { id: true, uuid: true },
+ });
+
+ if (!user) return res.status(404).json({ response: "User not found." });
+
+ try {
+ const subscription = await syncStoreSubscription(user, hint);
+
+ return res.status(200).json({
+ response: subscription?.active
+ ? "Done!"
+ : "No active subscription found for this purchase.",
+ active: Boolean(subscription?.active),
+ });
+ } catch (error) {
+ console.error("Error verifying store purchase:", error);
+ return res.status(500).json({ response: "Server Error" });
+ }
+}
diff --git a/apps/web/pages/api/v1/users/[id]/index.ts b/apps/web/pages/api/v1/users/[id]/index.ts
index a827d381..6094b682 100644
--- a/apps/web/pages/api/v1/users/[id]/index.ts
+++ b/apps/web/pages/api/v1/users/[id]/index.ts
@@ -4,11 +4,11 @@ import updateUserById from "@/lib/api/controllers/users/userId/updateUserById";
import deleteUserById from "@/lib/api/controllers/users/userId/deleteUserById";
import { prisma } from "@linkwarden/prisma";
import verifySubscription from "@/lib/api/billing/verifySubscription";
+import { isStoreBillingConfigured } from "@/lib/api/billing/syncStoreSubscription";
import verifyToken from "@/lib/api/verifyToken";
const BILLING_ENABLED =
- Boolean(process.env.STRIPE_SECRET_KEY) ||
- Boolean(process.env.REVENUECAT_PROJECT_ID && process.env.REVENUECAT_API_KEY);
+ Boolean(process.env.STRIPE_SECRET_KEY) || isStoreBillingConfigured();
export default async function users(req: NextApiRequest, res: NextApiResponse) {
const token = await verifyToken({ req });
diff --git a/apps/web/pages/api/v1/users/me.ts b/apps/web/pages/api/v1/users/me.ts
index 86dd0ae2..78a463fa 100644
--- a/apps/web/pages/api/v1/users/me.ts
+++ b/apps/web/pages/api/v1/users/me.ts
@@ -1,10 +1,10 @@
import type { NextApiRequest, NextApiResponse } from "next";
import getUserById from "@/lib/api/controllers/users/userId/getUserById";
-import syncRevenuecatSubscription from "@/lib/api/billing/syncRevenuecatSubscription";
+import syncStoreSubscription from "@/lib/api/billing/syncStoreSubscription";
import verifyToken from "@/lib/api/verifyToken";
import { prisma } from "@linkwarden/prisma";
-const syncRevenuecatSubscriptionIfNeeded = async (userId: number) => {
+const syncStoreSubscriptionIfNeeded = async (userId: number) => {
const user = await prisma.user.findUnique({
where: {
id: userId,
@@ -29,16 +29,16 @@ const syncRevenuecatSubscriptionIfNeeded = async (userId: number) => {
if (!user || user.parentSubscription?.active) return;
- const shouldSyncRevenuecatSubscription =
+ const shouldSyncStoreSubscription =
!user.subscriptions ||
!user.subscriptions.active ||
- (user.subscriptions.provider === "REVENUECAT" &&
+ (user.subscriptions.provider !== "STRIPE" &&
new Date() > user.subscriptions.currentPeriodEnd);
- if (!shouldSyncRevenuecatSubscription) return;
+ if (!shouldSyncStoreSubscription) return;
- await syncRevenuecatSubscription(user).catch((error) => {
- console.error("Error syncing RevenueCat subscription:", error);
+ await syncStoreSubscription(user).catch((error) => {
+ console.error("Error syncing store subscription:", error);
});
};
@@ -53,7 +53,7 @@ export default async function me(req: NextApiRequest, res: NextApiResponse) {
const userId = token.id;
if (req.method === "GET") {
- await syncRevenuecatSubscriptionIfNeeded(userId);
+ await syncStoreSubscriptionIfNeeded(userId);
const users = await getUserById(userId);
return res.status(users.status).json({ response: users.response });
diff --git a/apps/web/pages/api/v1/webhooks/app-store.ts b/apps/web/pages/api/v1/webhooks/app-store.ts
new file mode 100644
index 00000000..d70d15f6
--- /dev/null
+++ b/apps/web/pages/api/v1/webhooks/app-store.ts
@@ -0,0 +1,104 @@
+import type { NextApiRequest, NextApiResponse } from "next";
+import { prisma } from "@linkwarden/prisma";
+import getAppleSubscriptionState, {
+ decodeJws,
+ isAppStoreConfigured,
+} from "@/lib/api/billing/appStore";
+import { writeAppleSubscription } from "@/lib/api/billing/syncStoreSubscription";
+
+const UUID_REGEX =
+ /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
+
+type NotificationPayload = {
+ notificationType?: string;
+ data?: {
+ signedTransactionInfo?: string;
+ };
+};
+
+// App Store Server Notifications V2. The signed payload is only decoded (not
+// signature-verified) to extract a transaction id — every field that grants an
+// entitlement is re-fetched from the App Store Server API, so a forged request
+// can at most trigger a lookup.
+export default async function appStoreWebhook(
+ req: NextApiRequest,
+ res: NextApiResponse
+) {
+ if (req.method !== "POST") {
+ return res.status(405).json({ response: "Method not allowed." });
+ }
+
+ if (process.env.NEXT_PUBLIC_DEMO === "true")
+ return res.status(400).json({
+ response:
+ "This action is disabled because this is a read-only demo of Linkwarden.",
+ });
+
+ if (!isAppStoreConfigured()) {
+ return res.status(400).json({
+ response:
+ "This action is disabled because App Store billing is not configured.",
+ });
+ }
+
+ const payload = decodeJws<NotificationPayload>(req.body?.signedPayload);
+
+ if (!payload?.notificationType) {
+ return res.status(400).json({ response: "Invalid payload." });
+ }
+
+ const transactionInfo = decodeJws<{ originalTransactionId?: string }>(
+ payload.data?.signedTransactionInfo
+ );
+
+ if (payload.notificationType === "TEST" || !transactionInfo?.originalTransactionId) {
+ return res.status(200).json({ response: "Event ignored." });
+ }
+
+ try {
+ const state = await getAppleSubscriptionState(
+ transactionInfo.originalTransactionId
+ );
+
+ if (!state) {
+ return res.status(200).json({ response: "Transaction not found." });
+ }
+
+ // Prefer the subscription row that already tracks this transaction (possession
+ // established at purchase/restore time — also the only way deactivations reach
+ // the right row); fall back to the appAccountToken stamped on the Apple-fetched
+ // transaction for rows that haven't captured the transaction id yet.
+ let userId: number | null = null;
+
+ if (state.originalTransactionId) {
+ const subscription = await prisma.subscription.findUnique({
+ where: { storeOriginalTransactionId: state.originalTransactionId },
+ select: { userId: true },
+ });
+ if (subscription) userId = subscription.userId;
+ }
+
+ if (!userId && state.appAccountToken && UUID_REGEX.test(state.appAccountToken)) {
+ const user = await prisma.user.findUnique({
+ where: { uuid: state.appAccountToken },
+ select: { id: true },
+ });
+ if (user) userId = user.id;
+ }
+
+ if (!userId) {
+ console.warn(
+ `App Store notification for unmapped transaction ${state.originalTransactionId}.`
+ );
+ return res.status(200).json({ response: "User not found." });
+ }
+
+ await writeAppleSubscription(userId, state);
+ } catch (error) {
+ console.error("Error handling App Store notification:", error);
+ // Non-2xx makes Apple retry (1/12/24/48/72h) — desired for transient failures
+ return res.status(500).send("Server Error");
+ }
+
+ return res.status(200).json({ response: "Done!" });
+}
diff --git a/apps/web/pages/api/v1/webhooks/google-play.ts b/apps/web/pages/api/v1/webhooks/google-play.ts
new file mode 100644
index 00000000..07866d45
--- /dev/null
+++ b/apps/web/pages/api/v1/webhooks/google-play.ts
@@ -0,0 +1,136 @@
+import type { NextApiRequest, NextApiResponse } from "next";
+import { timingSafeEqual } from "crypto";
+import { prisma } from "@linkwarden/prisma";
+import getGoogleSubscriptionState, {
+ isGooglePlayConfigured,
+} from "@/lib/api/billing/googlePlay";
+import { writeGoogleSubscription } from "@/lib/api/billing/syncStoreSubscription";
+
+const UUID_REGEX =
+ /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
+
+const PACKAGE_NAME = process.env.GOOGLE_PLAY_PACKAGE_NAME || "app.linkwarden";
+
+const isAuthorized = (req: NextApiRequest) => {
+ const secret = process.env.GOOGLE_PLAY_PUBSUB_TOKEN;
+ const token = req.query.token;
+
+ if (!secret || typeof token !== "string") return false;
+
+ const a = new TextEncoder().encode(token);
+ const b = new TextEncoder().encode(secret);
+ return a.length === b.length && timingSafeEqual(a, b);
+};
+
+type DeveloperNotification = {
+ version?: string;
+ packageName?: string;
+ subscriptionNotification?: {
+ notificationType?: number;
+ purchaseToken?: string;
+ };
+ testNotification?: { version?: string };
+};
+
+// Google Play Real-Time Developer Notifications, delivered as a Cloud Pub/Sub
+// push subscription. The notification only signals that something changed — the
+// authoritative state always comes from purchases.subscriptionsv2.get.
+export default async function googlePlayWebhook(
+ req: NextApiRequest,
+ res: NextApiResponse
+) {
+ if (req.method !== "POST") {
+ return res.status(405).json({ response: "Method not allowed." });
+ }
+
+ if (process.env.NEXT_PUBLIC_DEMO === "true")
+ return res.status(400).json({
+ response:
+ "This action is disabled because this is a read-only demo of Linkwarden.",
+ });
+
+ if (!isGooglePlayConfigured() || !process.env.GOOGLE_PLAY_PUBSUB_TOKEN) {
+ return res.status(400).json({
+ response:
+ "This action is disabled because Play Store billing is not configured.",
+ });
+ }
+
+ if (!isAuthorized(req)) {
+ return res.status(401).json({ response: "Invalid token." });
+ }
+
+ let notification: DeveloperNotification | null = null;
+
+ try {
+ notification = JSON.parse(
+ Buffer.from(req.body?.message?.data ?? "", "base64").toString("utf8")
+ );
+ } catch {
+ // Malformed payloads are acknowledged so Pub/Sub doesn't redeliver them
+ }
+
+ const purchaseToken = notification?.subscriptionNotification?.purchaseToken;
+
+ if (
+ !notification ||
+ notification.testNotification ||
+ notification.packageName !== PACKAGE_NAME ||
+ !purchaseToken
+ ) {
+ return res.status(200).json({ response: "Event ignored." });
+ }
+
+ try {
+ const state = await getGoogleSubscriptionState(purchaseToken);
+
+ if (!state) {
+ return res.status(200).json({ response: "Purchase not found." });
+ }
+
+ // Map the token to a user: the row that holds it, the row holding the token it
+ // replaced (upgrades/resubscribes issue a new token with linkedPurchaseToken),
+ // the obfuscated account id set at purchase time, or — for out-of-app
+ // resubscriptions — the identifiers of the expired subscription it follows.
+ const knownTokens = [
+ purchaseToken,
+ state.linkedPurchaseToken,
+ state.expiredPurchaseToken,
+ ].filter((token): token is string => Boolean(token));
+
+ let userId: number | null = null;
+
+ const subscription = await prisma.subscription.findFirst({
+ where: { googlePurchaseToken: { in: knownTokens } },
+ select: { userId: true },
+ });
+ if (subscription) userId = subscription.userId;
+
+ if (!userId) {
+ const accountId =
+ state.obfuscatedExternalAccountId ??
+ state.expiredObfuscatedExternalAccountId;
+
+ if (accountId && UUID_REGEX.test(accountId)) {
+ const user = await prisma.user.findUnique({
+ where: { uuid: accountId },
+ select: { id: true },
+ });
+ if (user) userId = user.id;
+ }
+ }
+
+ if (!userId) {
+ console.warn("Play Store notification for unmapped purchase token.");
+ return res.status(200).json({ response: "User not found." });
+ }
+
+ await writeGoogleSubscription(userId, state, purchaseToken);
+ } catch (error) {
+ console.error("Error handling Play Store notification:", error);
+ // Non-2xx makes Pub/Sub redeliver with backoff — desired for transient failures
+ return res.status(500).send("Server Error");
+ }
+
+ return res.status(200).json({ response: "Done!" });
+}
diff --git a/apps/web/pages/api/v1/webhooks/revenuecat.ts b/apps/web/pages/api/v1/webhooks/revenuecat.ts
deleted file mode 100644
index 18ed82e0..00000000
--- a/apps/web/pages/api/v1/webhooks/revenuecat.ts
+++ /dev/null
@@ -1,163 +0,0 @@
-import type { NextApiRequest, NextApiResponse } from "next";
-import { prisma } from "@linkwarden/prisma";
-import mapStore from "@/lib/api/billing/mapStore";
-
-type RevenueCatEvent = {
- type?: string;
- app_user_id?: string;
- original_app_user_id?: string;
- aliases?: string[];
- environment?: "PRODUCTION" | "SANDBOX";
- store?: string;
- product_id?: string;
- original_transaction_id?: string;
- transaction_id?: string;
- purchased_at_ms?: number | null;
- expiration_at_ms?: number | null;
-};
-
-const subscriptionEvents = new Set([
- "INITIAL_PURCHASE",
- "RENEWAL",
- "UNCANCELLATION",
- "CANCELLATION",
- "BILLING_ISSUE",
- "EXPIRATION",
- "SUBSCRIPTION_EXTENDED",
- "TEMPORARY_ENTITLEMENT_GRANT",
-]);
-
-export default async function revenueCatWebhook(
- req: NextApiRequest,
- res: NextApiResponse
-) {
- if (req.method !== "POST") {
- return res.status(405).json({ response: "Method not allowed." });
- }
-
- if (process.env.NEXT_PUBLIC_DEMO === "true")
- return res.status(400).json({
- response:
- "This action is disabled because this is a read-only demo of Linkwarden.",
- });
-
- if (!process.env.REVENUECAT_WEBHOOK_AUTHORIZATION) {
- return res.status(400).json({
- response:
- "This action is disabled because RevenueCat is not initialized.",
- });
- }
-
- if (
- req.headers.authorization !== process.env.REVENUECAT_WEBHOOK_AUTHORIZATION
- ) {
- return res.status(401).json({ response: "Invalid authorization header." });
- }
-
- const event = req.body?.event as RevenueCatEvent | undefined;
-
- if (!event?.type || !subscriptionEvents.has(event.type)) {
- return res.status(200).json({ response: "Event ignored." });
- }
-
- if (
- event.environment === "SANDBOX" &&
- process.env.REVENUECAT_ACCEPT_SANDBOX_WEBHOOKS !== "true" &&
- process.env.NODE_ENV === "production"
- ) {
- return res.status(200).json({ response: "Sandbox event ignored." });
- }
-
- if (
- !event.original_app_user_id ||
- !event.purchased_at_ms ||
- !event.expiration_at_ms
- ) {
- return res.status(200).json({ response: "Event ignored." });
- }
-
- const currentPeriodStart = new Date(event.purchased_at_ms);
- const currentPeriodEnd = new Date(event.expiration_at_ms);
- const active = event.type !== "EXPIRATION" && currentPeriodEnd > new Date();
-
- const mappedStore = mapStore(event.store);
-
- const storeData = {
- // Clear any leftover Stripe identifier when switching Stripe -> RevenueCat.
- stripeSubscriptionId: null,
- store: mappedStore,
- storeOriginalTransactionId: event.original_transaction_id ?? undefined,
- storeProductId: event.product_id ?? undefined,
- revenuecatMetadata: req.body.event,
- // Leave the client-captured token alone for Google Play; clear a stale one
- // when this isn't a Google Play subscription (e.g. Google -> Apple).
- ...(mappedStore === "PLAY_STORE" ? {} : { googlePurchaseToken: null }),
- };
-
- try {
- const user = await prisma.user.findUnique({
- where: {
- uuid: event.original_app_user_id,
- },
- });
-
- if (!user) {
- return res.status(200).json({ response: "User not found." });
- }
-
- const subscription = await prisma.subscription.findUnique({
- where: {
- revenueCatAppUserId: event.original_app_user_id,
- },
- });
-
- if (subscription) {
- await prisma.subscription.update({
- where: {
- id: subscription.id,
- },
- data: {
- active,
- provider: "REVENUECAT",
- ...storeData,
- currentPeriodStart,
- currentPeriodEnd,
- quantity: 1,
- userId: user.id,
- },
- });
- } else {
- await prisma.subscription.upsert({
- where: {
- userId: user.id,
- },
- create: {
- active,
- provider: "REVENUECAT",
- revenueCatAppUserId: event.original_app_user_id,
- ...storeData,
- currentPeriodStart,
- currentPeriodEnd,
- quantity: 1,
- userId: user.id,
- },
- update: {
- active,
- provider: "REVENUECAT",
- revenueCatAppUserId: event.original_app_user_id,
- ...storeData,
- currentPeriodStart,
- currentPeriodEnd,
- quantity: 1,
- },
- });
- }
- } catch (error) {
- console.error("Error handling RevenueCat webhook event:", error);
- return res.status(500).send("Server Error");
- }
-
- return res.status(200).json({
- response: "Done!",
- });
-}
diff --git a/apps/web/pages/settings/billing.tsx b/apps/web/pages/settings/billing.tsx
index 02f49c4b..b505c777 100644
--- a/apps/web/pages/settings/billing.tsx
+++ b/apps/web/pages/settings/billing.tsx
@@ -73,8 +73,9 @@ const Page: NextPageWithLayout = () => {
});
const [inviteModal, setInviteModal] = useState(false);
- const isRevenueCatSubscription =
- account?.subscription?.provider === "REVENUECAT";
+ const isMobileStoreSubscription =
+ account?.subscription?.provider === "APPLE" ||
+ account?.subscription?.provider === "GOOGLE";
return (
<>
@@ -87,7 +88,7 @@ const Page: NextPageWithLayout = () => {
<Separator className="my-3" />
- {isRevenueCatSubscription ? (
+ {isMobileStoreSubscription ? (
<div className="w-full mx-auto flex flex-col gap-3 justify-between">
<p className="text-md">{t("mobile_billing_managed_externally")}</p>
diff --git a/packages/prisma/migrations/20260703143543_replace_revenuecat_with_store_billing/migration.sql b/packages/prisma/migrations/20260703143543_replace_revenuecat_with_store_billing/migration.sql
new file mode 100644
index 00000000..ce896d33
--- /dev/null
+++ b/packages/prisma/migrations/20260703143543_replace_revenuecat_with_store_billing/migration.sql
@@ -0,0 +1,29 @@
+/*
+ Warnings:
+
+ - The values [REVENUECAT] on the enum `SubscriptionProvider` will be removed. If these variants are still used in the database, this will fail.
+ - You are about to drop the column `revenueCatAppUserId` on the `Subscription` table. All the data in the column will be lost.
+ - You are about to drop the column `revenuecatMetadata` on the `Subscription` table. All the data in the column will be lost.
+ - You are about to drop the column `store` on the `Subscription` table. All the data in the column will be lost.
+
+*/
+-- AlterEnum
+BEGIN;
+CREATE TYPE "SubscriptionProvider_new" AS ENUM ('STRIPE', 'APPLE', 'GOOGLE');
+ALTER TABLE "Subscription" ALTER COLUMN "provider" TYPE "SubscriptionProvider_new" USING ("provider"::text::"SubscriptionProvider_new");
+ALTER TYPE "SubscriptionProvider" RENAME TO "SubscriptionProvider_old";
+ALTER TYPE "SubscriptionProvider_new" RENAME TO "SubscriptionProvider";
+DROP TYPE "SubscriptionProvider_old";
+COMMIT;
+
+-- DropIndex
+DROP INDEX "Subscription_revenueCatAppUserId_key";
+
+-- AlterTable
+ALTER TABLE "Subscription" DROP COLUMN "revenueCatAppUserId",
+DROP COLUMN "revenuecatMetadata",
+DROP COLUMN "store",
+ADD COLUMN "storeMetadata" JSONB;
+
+-- DropEnum
+DROP TYPE "SubscriptionStore";
diff --git a/packages/prisma/schema.prisma b/packages/prisma/schema.prisma
index 14850c4c..d8652c21 100644
--- a/packages/prisma/schema.prisma
+++ b/packages/prisma/schema.prisma
@@ -221,19 +221,18 @@ model Tag {
model Subscription {
id Int @id @default(autoincrement())
active Boolean
- stripeSubscriptionId String? @unique
- revenueCatAppUserId String? @unique @db.Uuid
+ provider SubscriptionProvider
currentPeriodStart DateTime
currentPeriodEnd DateTime
quantity Int @default(1)
- provider SubscriptionProvider
- store SubscriptionStore?
storeOriginalTransactionId String? @unique
storeProductId String?
- googlePurchaseToken String? @unique // Google Play purchase token — captured client-side; RevenueCat never exposes it, and Google's API needs it
- revenuecatMetadata Json?
+ googlePurchaseToken String? @unique // Google Play purchase token — the key for querying/acknowledging the subscription
+ storeMetadata Json?
+ stripeSubscriptionId String? @unique
+
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
userId Int @unique
childUsers User[] @relation("ChildUsers")
@@ -243,12 +242,8 @@ model Subscription {
enum SubscriptionProvider {
STRIPE
- REVENUECAT
-}
-
-enum SubscriptionStore {
- APP_STORE
- PLAY_STORE
+ APPLE
+ GOOGLE
}
model AccessToken {
diff --git a/packages/prisma/seed.js b/packages/prisma/seed.js
index 0ccd4291..f6b42feb 100644
--- a/packages/prisma/seed.js
+++ b/packages/prisma/seed.js
@@ -28,6 +28,7 @@ async function main() {
create: {
stripeSubscriptionId: "sub_4323",
active: true,
+ provider: "STRIPE",
currentPeriodStart,
currentPeriodEnd,
},
@@ -64,6 +65,7 @@ async function main() {
create: {
stripeSubscriptionId: "sub_5435",
active: true,
+ provider: "STRIPE",
currentPeriodStart,
currentPeriodEnd,
},
@@ -100,6 +102,7 @@ async function main() {
create: {
stripeSubscriptionId: "sub_6435",
active: true,
+ provider: "STRIPE",
currentPeriodStart,
currentPeriodEnd,
},
@@ -136,6 +139,7 @@ async function main() {
create: {
stripeSubscriptionId: "sub_7868",
active: true,
+ provider: "STRIPE",
currentPeriodStart,
currentPeriodEnd,
},
@@ -172,6 +176,7 @@ async function main() {
create: {
stripeSubscriptionId: "sub_5653",
active: true,
+ provider: "STRIPE",
currentPeriodStart,
currentPeriodEnd,
},
diff --git a/yarn.lock b/yarn.lock
index 346d77f5..be57423e 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -137,6 +137,22 @@ __metadata:
languageName: node
linkType: hard
+"@apple/app-store-server-library@npm:^3.1.0":
+ version: 3.1.0
+ resolution: "@apple/app-store-server-library@npm:3.1.0"
+ dependencies:
+ "@types/jsonwebtoken": "npm:^9.0.5"
+ "@types/jsrsasign": "npm:^10.5.12"
+ "@types/node": "npm:^25.4.0"
+ "@types/node-fetch": "npm:^2.6.13"
+ base64url: "npm:^3.0.1"
+ jsonwebtoken: "npm:^9.0.2"
+ jsrsasign: "npm:^11.0.0"
+ node-fetch: "npm:^2.7.0"
+ checksum: 10c0/6ea624d9639fc537e53e714818297969ec078624f3db058b5cb441de71a3d3abbccac718d7227a85b23de0bcd6535a2c00f9707c3f4928d0d3726bd97c6a7eff
+ languageName: node
+ linkType: hard
+
"@atlaskit/tree@npm:^8.8.7":
version: 8.8.7
resolution: "@atlaskit/tree@npm:8.8.7"
@@ -5266,6 +5282,7 @@ __metadata:
expo-file-system: "npm:~19.0.21"
expo-font: "npm:~14.0.11"
expo-haptics: "npm:~15.0.8"
+ expo-iap: "npm:~4.3.6"
expo-linking: "npm:~8.0.11"
expo-navigation-bar: "npm:~5.0.10"
expo-router: "npm:~6.0.23"
@@ -5295,7 +5312,6 @@ __metadata:
react-native-mmkv: "npm:4.1.2"
react-native-nitro-modules: "npm:0.34.1"
react-native-pdf: "npm:^7.0.3"
- react-native-purchases: "npm:^10.2.0"
react-native-reanimated: "npm:4.1.1"
react-native-safe-area-context: "npm:^5.7.0"
react-native-screens: "npm:~4.19.0"
@@ -5374,6 +5390,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@linkwarden/web@workspace:apps/web"
dependencies:
+ "@apple/app-store-server-library": "npm:^3.1.0"
"@atlaskit/tree": "npm:^8.8.7"
"@auth/prisma-adapter": "npm:^1.0.1"
"@dnd-kit/core": "npm:^6.3.1"
@@ -5425,6 +5442,7 @@ __metadata:
eslint-config-next: "npm:13.4.9"
formidable: "npm:^3.5.1"
fuse.js: "npm:^7.0.0"
+ google-auth-library: "npm:^10.9.0"
handlebars: "npm:^4.7.8"
himalaya: "npm:^1.1.0"
https-proxy-agent: "npm:^7.0.6"
@@ -7463,29 +7481,6 @@ __metadata:
languageName: node
linkType: hard
-"@revenuecat/purchases-js-hybrid-mappings@npm:18.8.0":
- version: 18.8.0
- resolution: "@revenuecat/purchases-js-hybrid-mappings@npm:18.8.0"
- dependencies:
- "@revenuecat/purchases-js": "npm:1.41.1"
- checksum: 10c0/12915a0191efba55caa3da2298821b83af3c976df106e3388a169fbf0cd3b870baf5428567e7a4fe01f5f7849dd7c4b90f67926367c15d04b54caa3e6f5fa71a
- languageName: node
- linkType: hard
-
-"@revenuecat/purchases-js@npm:1.41.1":
- version: 1.41.1
- resolution: "@revenuecat/purchases-js@npm:1.41.1"
- checksum: 10c0/ca3a412e597b08890e5f18a4c0063e6b39e5807e742bb9788970d08fae05d42d4f80e4f0722c27cbe1b22bf882b7f65fdc9871ea02416a24003b4c286b11b38d
- languageName: node
- linkType: hard
-
-"@revenuecat/purchases-typescript-internal@npm:18.8.0":
- version: 18.8.0
- resolution: "@revenuecat/purchases-typescript-internal@npm:18.8.0"
- checksum: 10c0/7cf3aa9d356aa40e2cc33410fed8a71fe71b331f3fcc5ccd22d895206daff76e2ff0eca87f1c1a06e968d3c5c02cb9c78bd244996f1f64b0370424e4e60e826b
- languageName: node
- linkType: hard
-
"@rollup/rollup-android-arm-eabi@npm:4.55.1":
version: 4.55.1
resolution: "@rollup/rollup-android-arm-eabi@npm:4.55.1"
@@ -9182,6 +9177,23 @@ __metadata:
languageName: node
linkType: hard
+"@types/jsonwebtoken@npm:^9.0.5":
+ version: 9.0.10
+ resolution: "@types/jsonwebtoken@npm:9.0.10"
+ dependencies:
+ "@types/ms": "npm:*"
+ "@types/node": "npm:*"
+ checksum: 10c0/0688ac8fb75f809201cb7e18a12b9d80ce539cb9dd27e1b01e11807cb1a337059e899b8ee3abc3f2c9417f02e363a3069d9eab9ef9724b1da1f0e10713514f94
+ languageName: node
+ linkType: hard
+
+"@types/jsrsasign@npm:^10.5.12":
+ version: 10.5.15
+ resolution: "@types/jsrsasign@npm:10.5.15"
+ checksum: 10c0/1487c55b19913b7573d14b6250fc0ec5edf6e13e04b4c1feff22e095c9a3a0e3c8a3746eff5009b813bd586a7749439b9a2cc330ffbd9d839fd0ffa5db393ee7
+ languageName: node
+ linkType: hard
+
"@types/minimatch@npm:*":
version: 5.1.2
resolution: "@types/minimatch@npm:5.1.2"
@@ -9189,6 +9201,13 @@ __metadata:
languageName: node
linkType: hard
+"@types/ms@npm:*":
+ version: 2.1.0
+ resolution: "@types/ms@npm:2.1.0"
+ checksum: 10c0/5ce692ffe1549e1b827d99ef8ff71187457e0eb44adbae38fdf7b9a74bae8d20642ee963c14516db1d35fa2652e65f47680fdf679dcbde52bbfadd021f497225
+ languageName: node
+ linkType: hard
+
"@types/node-fetch@npm:^2.6.10":
version: 2.6.10
resolution: "@types/node-fetch@npm:2.6.10"
@@ -9199,6 +9218,16 @@ __metadata:
languageName: node
linkType: hard
+"@types/node-fetch@npm:^2.6.13":
+ version: 2.6.13
+ resolution: "@types/node-fetch@npm:2.6.13"
+ dependencies:
+ "@types/node": "npm:*"
+ form-data: "npm:^4.0.4"
+ checksum: 10c0/6313c89f62c50bd0513a6839cdff0a06727ac5495ccbb2eeda51bb2bbbc4f3c0a76c0393a491b7610af703d3d2deb6cf60e37e59c81ceeca803ffde745dbf309
+ languageName: node
+ linkType: hard
+
"@types/node@npm:*":
version: 20.4.4
resolution: "@types/node@npm:20.4.4"
@@ -9231,6 +9260,15 @@ __metadata:
languageName: node
linkType: hard
+"@types/node@npm:^25.4.0":
+ version: 25.9.4
+ resolution: "@types/node@npm:25.9.4"
+ dependencies:
+ undici-types: "npm:>=7.24.0 <7.24.7"
+ checksum: 10c0/4b19670ef5dbefa836a2d4a9ed0b5ac6befbc0844bfdd12833234ff8fa68da1f65e6362d2ef87acf7e7da9d6ff649bf81c454d12e802b7e7fa9246a15c0edcf6
+ languageName: node
+ linkType: hard
+
"@types/nodemailer@npm:^7.0.4":
version: 7.0.4
resolution: "@types/nodemailer@npm:7.0.4"
@@ -10287,13 +10325,20 @@ __metadata:
languageName: node
linkType: hard
-"base64-js@npm:^1.2.3, base64-js@npm:^1.3.1, base64-js@npm:^1.5.1":
+"base64-js@npm:^1.2.3, base64-js@npm:^1.3.0, base64-js@npm:^1.3.1, base64-js@npm:^1.5.1":
version: 1.5.1
resolution: "base64-js@npm:1.5.1"
checksum: 10c0/f23823513b63173a001030fae4f2dabe283b99a9d324ade3ad3d148e218134676f1ee8568c877cd79ec1c53158dcf2d2ba527a97c606618928ba99dd930102bf
languageName: node
linkType: hard
+"base64url@npm:^3.0.1":
+ version: 3.0.1
+ resolution: "base64url@npm:3.0.1"
+ checksum: 10c0/5ca9d6064e9440a2a45749558dddd2549ca439a305793d4f14a900b7256b5f4438ef1b7a494e1addc66ced5d20f5c010716d353ed267e4b769e6c78074991241
+ languageName: node
+ linkType: hard
+
"baseline-browser-mapping@npm:^2.9.0":
version: 2.10.0
resolution: "baseline-browser-mapping@npm:2.10.0"
@@ -10329,6 +10374,13 @@ __metadata:
languageName: node
linkType: hard
+"bignumber.js@npm:^9.0.0":
+ version: 9.3.1
+ resolution: "bignumber.js@npm:9.3.1"
+ checksum: 10c0/61342ba5fe1c10887f0ecf5be02ff6709271481aff48631f86b4d37d55a99b87ce441cfd54df3d16d10ee07ceab7e272fc0be430c657ffafbbbf7b7d631efb75
+ languageName: node
+ linkType: hard
+
"binary-extensions@npm:^2.0.0":
version: 2.2.0
resolution: "binary-extensions@npm:2.2.0"
@@ -10471,6 +10523,13 @@ __metadata:
languageName: node
linkType: hard
+"buffer-equal-constant-time@npm:^1.0.1":
+ version: 1.0.1
+ resolution: "buffer-equal-constant-time@npm:1.0.1"
+ checksum: 10c0/fb2294e64d23c573d0dd1f1e7a466c3e978fe94a4e0f8183937912ca374619773bef8e2aceb854129d2efecbbc515bbd0cc78d2734a3e3031edb0888531bbc8e
+ languageName: node
+ linkType: hard
+
"buffer-equal@npm:0.0.1":
version: 0.0.1
resolution: "buffer-equal@npm:0.0.1"
@@ -11356,6 +11415,13 @@ __metadata:
languageName: node
linkType: hard
+"data-uri-to-buffer@npm:^4.0.0":
+ version: 4.0.1
+ resolution: "data-uri-to-buffer@npm:4.0.1"
+ checksum: 10c0/20a6b93107597530d71d4cb285acee17f66bcdfc03fd81040921a81252f19db27588d87fc8fc69e1950c55cfb0bf8ae40d0e5e21d907230813eb5d5a7f9eb45b
+ languageName: node
+ linkType: hard
+
"data-urls@npm:^3.0.2":
version: 3.0.2
resolution: "data-urls@npm:3.0.2"
@@ -11877,6 +11943,15 @@ __metadata:
languageName: node
linkType: hard
+"ecdsa-sig-formatter@npm:1.0.11, ecdsa-sig-formatter@npm:^1.0.11":
+ version: 1.0.11
+ resolution: "ecdsa-sig-formatter@npm:1.0.11"
+ dependencies:
+ safe-buffer: "npm:^5.0.1"
+ checksum: 10c0/ebfbf19d4b8be938f4dd4a83b8788385da353d63307ede301a9252f9f7f88672e76f2191618fd8edfc2f24679236064176fab0b78131b161ee73daa37125408c
+ languageName: node
+ linkType: hard
+
"ee-first@npm:1.1.1":
version: 1.1.1
resolution: "ee-first@npm:1.1.1"
@@ -12899,6 +12974,17 @@ __metadata:
languageName: node
linkType: hard
+"expo-iap@npm:~4.3.6":
+ version: 4.3.6
+ resolution: "expo-iap@npm:4.3.6"
+ peerDependencies:
+ expo: "*"
+ react: "*"
+ react-native: "*"
+ checksum: 10c0/b967e963ac33ce35439dbe1a4c90f2a21670c62084edce1634e40d1f1384f07f4ca35c4bf290ab09f689b53e096be685aecc29510b883946641e90ab75a095d7
+ languageName: node
+ linkType: hard
+
"expo-json-utils@npm:~0.15.0":
version: 0.15.0
resolution: "expo-json-utils@npm:0.15.0"
@@ -13237,6 +13323,13 @@ __metadata:
languageName: node
linkType: hard
+"extend@npm:^3.0.2":
+ version: 3.0.2
+ resolution: "extend@npm:3.0.2"
+ checksum: 10c0/73bf6e27406e80aa3e85b0d1c4fd987261e628064e170ca781125c0b635a3dabad5e05adbf07595ea0cf1e6c5396cacb214af933da7cbaf24fe75ff14818e8f9
+ languageName: node
+ linkType: hard
+
"fast-deep-equal@npm:^3.1.1, fast-deep-equal@npm:^3.1.3":
version: 3.1.3
resolution: "fast-deep-equal@npm:3.1.3"
@@ -13372,6 +13465,16 @@ __metadata:
languageName: node
linkType: hard
+"fetch-blob@npm:^3.1.2, fetch-blob@npm:^3.1.4":
+ version: 3.2.0
+ resolution: "fetch-blob@npm:3.2.0"
+ dependencies:
+ node-domexception: "npm:^1.0.0"
+ web-streams-polyfill: "npm:^3.0.3"
+ checksum: 10c0/60054bf47bfa10fb0ba6cb7742acec2f37c1f56344f79a70bb8b1c48d77675927c720ff3191fa546410a0442c998d27ab05e9144c32d530d8a52fbe68f843b69
+ languageName: node
+ linkType: hard
+
"file-entry-cache@npm:^6.0.1":
version: 6.0.1
resolution: "file-entry-cache@npm:6.0.1"
@@ -13532,6 +13635,15 @@ __metadata:
languageName: node
linkType: hard
+"formdata-polyfill@npm:^4.0.10":
+ version: 4.0.10
+ resolution: "formdata-polyfill@npm:4.0.10"
+ dependencies:
+ fetch-blob: "npm:^3.1.2"
+ checksum: 10c0/5392ec484f9ce0d5e0d52fb5a78e7486637d516179b0eb84d81389d7eccf9ca2f663079da56f761355c0a65792810e3b345dc24db9a8bbbcf24ef3c8c88570c6
+ languageName: node
+ linkType: hard
+
"formidable@npm:^3.5.1":
version: 3.5.4
resolution: "formidable@npm:3.5.4"
@@ -13696,6 +13808,28 @@ __metadata:
languageName: node
linkType: hard
+"gaxios@npm:^7.0.0, gaxios@npm:^7.1.4":
+ version: 7.1.5
+ resolution: "gaxios@npm:7.1.5"
+ dependencies:
+ extend: "npm:^3.0.2"
+ https-proxy-agent: "npm:^7.0.1"
+ node-fetch: "npm:^3.3.2"
+ checksum: 10c0/a3d12a9d2b781c548b40b4f2d7792281d091b63ffdd92713301a6e55bc9072fe7c1c54fa014416ca1fcdba40c171389bd409d0e3e326f4ae5ae60b25ae8ea540
+ languageName: node
+ linkType: hard
+
+"gcp-metadata@npm:8.1.2":
+ version: 8.1.2
+ resolution: "gcp-metadata@npm:8.1.2"
+ dependencies:
+ gaxios: "npm:^7.0.0"
+ google-logging-utils: "npm:^1.0.0"
+ json-bigint: "npm:^1.0.0"
+ checksum: 10c0/15a61231a9410dc11c2828d2c9fdc8b0a939f1af746195c44edc6f2ffea0acab52cef3a7b9828069a36fd5d68bda730f7328a415fe42a01258f6e249dfba6908
+ languageName: node
+ linkType: hard
+
"gensync@npm:^1.0.0-beta.2":
version: 1.0.0-beta.2
resolution: "gensync@npm:1.0.0-beta.2"
@@ -13971,6 +14105,34 @@ __metadata:
languageName: node
linkType: hard
+"google-auth-library@npm:^10.9.0":
+ version: 10.9.0
+ resolution: "google-auth-library@npm:10.9.0"
+ dependencies:
+ base64-js: "npm:^1.3.0"
+ ecdsa-sig-formatter: "npm:^1.0.11"
+ gaxios: "npm:^7.1.4"
+ gcp-metadata: "npm:8.1.2"
+ google-logging-utils: "npm:1.1.3"
+ jws: "npm:^4.0.0"
+ checksum: 10c0/d731d0bff429c63e995a954f4a08ccbcdb159bff322c529c467e89a98de215fff6630ddf94c9a29a1737ab8d820ff5943b7131c51faabae04497f146d62636dc
+ languageName: node
+ linkType: hard
+
+"google-logging-utils@npm:1.1.3":
+ version: 1.1.3
+ resolution: "google-logging-utils@npm:1.1.3"
+ checksum: 10c0/e65201c7e96543bd1423b9324013736646b9eed60941e0bfa47b9bfd146d2f09cf3df1c99ca60b7d80a726075263ead049ee72de53372cb8458c3bc55c2c1e59
+ languageName: node
+ linkType: hard
+
+"google-logging-utils@npm:^1.0.0":
+ version: 1.1.4
+ resolution: "google-logging-utils@npm:1.1.4"
+ checksum: 10c0/860873974dd31678553f1074eb8fcf49c6417807086f4645ee8d4eaa81e8dce39f8f7a4b6856be4fda6e5d812b2df10e7abeb6dfe28353d28724cf81357c5a53
+ languageName: node
+ linkType: hard
+
"gopd@npm:^1.0.1":
version: 1.0.1
resolution: "gopd@npm:1.0.1"
@@ -15651,6 +15813,15 @@ __metadata:
languageName: node
linkType: hard
+"json-bigint@npm:^1.0.0":
+ version: 1.0.0
+ resolution: "json-bigint@npm:1.0.0"
+ dependencies:
+ bignumber.js: "npm:^9.0.0"
+ checksum: 10c0/e3f34e43be3284b573ea150a3890c92f06d54d8ded72894556357946aeed9877fd795f62f37fe16509af189fd314ab1104d0fd0f163746ad231b9f378f5b33f4
+ languageName: node
+ linkType: hard
+
"json-parse-even-better-errors@npm:^2.3.0":
version: 2.3.1
resolution: "json-parse-even-better-errors@npm:2.3.1"
@@ -15739,6 +15910,31 @@ __metadata:
languageName: node
linkType: hard
+"jsonwebtoken@npm:^9.0.2":
+ version: 9.0.3
+ resolution: "jsonwebtoken@npm:9.0.3"
+ dependencies:
+ jws: "npm:^4.0.1"
+ lodash.includes: "npm:^4.3.0"
+ lodash.isboolean: "npm:^3.0.3"
+ lodash.isinteger: "npm:^4.0.4"
+ lodash.isnumber: "npm:^3.0.3"
+ lodash.isplainobject: "npm:^4.0.6"
+ lodash.isstring: "npm:^4.0.1"
+ lodash.once: "npm:^4.0.0"
+ ms: "npm:^2.1.1"
+ semver: "npm:^7.5.4"
+ checksum: 10c0/6ca7f1e54886ea3bde7146a5a22b53847c46e25453c7f7307a69818b9a6ad48c390b2e59d5690fcfd03c529b01960060cc4bb0c686991d6edae2285dfd30f4ba
+ languageName: node
+ linkType: hard
+
+"jsrsasign@npm:^11.0.0":
+ version: 11.1.3
+ resolution: "jsrsasign@npm:11.1.3"
+ checksum: 10c0/808fc88339e9060cb38bbaaeff04783db6f7bf628fb5c0a0773b22461f16a0942643a22f59468e7ed05408a4f7b874113a20c31f7d93dbcb029a9231566d99ae
+ languageName: node
+ linkType: hard
+
"jsx-ast-utils@npm:^2.4.1 || ^3.0.0, jsx-ast-utils@npm:^3.3.3":
version: 3.3.3
resolution: "jsx-ast-utils@npm:3.3.3"
@@ -15761,6 +15957,27 @@ __metadata:
languageName: node
linkType: hard
+"jwa@npm:^2.0.1":
+ version: 2.0.1
+ resolution: "jwa@npm:2.0.1"
+ dependencies:
+ buffer-equal-constant-time: "npm:^1.0.1"
+ ecdsa-sig-formatter: "npm:1.0.11"
+ safe-buffer: "npm:^5.0.1"
+ checksum: 10c0/ab3ebc6598e10dc11419d4ed675c9ca714a387481466b10e8a6f3f65d8d9c9237e2826f2505280a739cf4cbcf511cb288eeec22b5c9c63286fc5a2e4f97e78cf
+ languageName: node
+ linkType: hard
+
+"jws@npm:^4.0.0, jws@npm:^4.0.1":
+ version: 4.0.1
+ resolution: "jws@npm:4.0.1"
+ dependencies:
+ jwa: "npm:^2.0.1"
+ safe-buffer: "npm:^5.0.1"
+ checksum: 10c0/6be1ed93023aef570ccc5ea8d162b065840f3ef12f0d1bb3114cade844de7a357d5dc558201d9a65101e70885a6fa56b17462f520e6b0d426195510618a154d0
+ languageName: node
+ linkType: hard
+
"klaw-sync@npm:^6.0.0":
version: 6.0.0
resolution: "klaw-sync@npm:6.0.0"
@@ -16134,6 +16351,48 @@ __metadata:
languageName: node
linkType: hard
+"lodash.includes@npm:^4.3.0":
+ version: 4.3.0
+ resolution: "lodash.includes@npm:4.3.0"
+ checksum: 10c0/7ca498b9b75bf602d04e48c0adb842dfc7d90f77bcb2a91a2b2be34a723ad24bc1c8b3683ec6b2552a90f216c723cdea530ddb11a3320e08fa38265703978f4b
+ languageName: node
+ linkType: hard
+
+"lodash.isboolean@npm:^3.0.3":
+ version: 3.0.3
+ resolution: "lodash.isboolean@npm:3.0.3"
+ checksum: 10c0/0aac604c1ef7e72f9a6b798e5b676606042401dd58e49f051df3cc1e3adb497b3d7695635a5cbec4ae5f66456b951fdabe7d6b387055f13267cde521f10ec7f7
+ languageName: node
+ linkType: hard
+
+"lodash.isinteger@npm:^4.0.4":
+ version: 4.0.4
+ resolution: "lodash.isinteger@npm:4.0.4"
+ checksum: 10c0/4c3e023a2373bf65bf366d3b8605b97ec830bca702a926939bcaa53f8e02789b6a176e7f166b082f9365bfec4121bfeb52e86e9040cb8d450e64c858583f61b7
+ languageName: node
+ linkType: hard
+
+"lodash.isnumber@npm:^3.0.3":
+ version: 3.0.3
+ resolution: "lodash.isnumber@npm:3.0.3"
+ checksum: 10c0/2d01530513a1ee4f72dd79528444db4e6360588adcb0e2ff663db2b3f642d4bb3d687051ae1115751ca9082db4fdef675160071226ca6bbf5f0c123dbf0aa12d
+ languageName: node
+ linkType: hard
+
+"lodash.isplainobject@npm:^4.0.6":
+ version: 4.0.6
+ resolution: "lodash.isplainobject@npm:4.0.6"
+ checksum: 10c0/afd70b5c450d1e09f32a737bed06ff85b873ecd3d3d3400458725283e3f2e0bb6bf48e67dbe7a309eb371a822b16a26cca4a63c8c52db3fc7dc9d5f9dd324cbb
+ languageName: node
+ linkType: hard
+
+"lodash.isstring@npm:^4.0.1":
+ version: 4.0.1
+ resolution: "lodash.isstring@npm:4.0.1"
+ checksum: 10c0/09eaf980a283f9eef58ef95b30ec7fee61df4d6bf4aba3b5f096869cc58f24c9da17900febc8ffd67819b4e29de29793190e88dc96983db92d84c95fa85d1c92
+ languageName: node
+ linkType: hard
+
"lodash.merge@npm:^4.6.2":
version: 4.6.2
resolution: "lodash.merge@npm:4.6.2"
@@ -16141,6 +16400,13 @@ __metadata:
languageName: node
linkType: hard
+"lodash.once@npm:^4.0.0":
+ version: 4.1.1
+ resolution: "lodash.once@npm:4.1.1"
+ checksum: 10c0/46a9a0a66c45dd812fcc016e46605d85ad599fe87d71a02f6736220554b52ffbe82e79a483ad40f52a8a95755b0d1077fba259da8bfb6694a7abbf4a48f1fc04
+ languageName: node
+ linkType: hard
+
"lodash.throttle@npm:^4.1.1":
version: 4.1.1
resolution: "lodash.throttle@npm:4.1.1"
@@ -17272,6 +17538,13 @@ __metadata:
languageName: node
linkType: hard
+"node-domexception@npm:^1.0.0":
+ version: 1.0.0
+ resolution: "node-domexception@npm:1.0.0"
+ checksum: 10c0/5e5d63cda29856402df9472335af4bb13875e1927ad3be861dc5ebde38917aecbf9ae337923777af52a48c426b70148815e890a5d72760f1b4d758cc671b1a2b
+ languageName: node
+ linkType: hard
+
"node-fetch@npm:^2.6.1, node-fetch@npm:^2.7.0":
version: 2.7.0
resolution: "node-fetch@npm:2.7.0"
@@ -17300,6 +17573,17 @@ __metadata:
languageName: node
linkType: hard
+"node-fetch@npm:^3.3.2":
+ version: 3.3.2
+ resolution: "node-fetch@npm:3.3.2"
+ dependencies:
+ data-uri-to-buffer: "npm:^4.0.0"
+ fetch-blob: "npm:^3.1.4"
+ formdata-polyfill: "npm:^4.0.10"
+ checksum: 10c0/f3d5e56190562221398c9f5750198b34cf6113aa304e34ee97c94fd300ec578b25b2c2906edba922050fce983338fde0d5d34fcb0fc3336ade5bd0e429ad7538
+ languageName: node
+ linkType: hard
+
"node-forge@npm:^1.3.3":
version: 1.3.3
resolution: "node-forge@npm:1.3.3"
@@ -18937,23 +19221,6 @@ __metadata:
languageName: node
linkType: hard
-"react-native-purchases@npm:^10.2.0":
- version: 10.2.0
- resolution: "react-native-purchases@npm:10.2.0"
- dependencies:
- "@revenuecat/purchases-js-hybrid-mappings": "npm:18.8.0"
- "@revenuecat/purchases-typescript-internal": "npm:18.8.0"
- peerDependencies:
- react: ">= 16.6.3"
- react-native: ">= 0.73.0"
- react-native-web: "*"
- peerDependenciesMeta:
- react-native-web:
- optional: true
- checksum: 10c0/1f1d68b1133ff7156d9e206831ff308ff04b7878a4fb621cdac489d78ba062d796a21d925bf6147cdd4222a4ba7fa2fccc1a52183dff0204a0c82dd8fc5d497e
- languageName: node
- linkType: hard
-
"react-native-reanimated@npm:4.1.1":
version: 4.1.1
resolution: "react-native-reanimated@npm:4.1.1"
@@ -19869,7 +20136,7 @@ __metadata:
languageName: node
linkType: hard
-"safe-buffer@npm:5.2.1, safe-buffer@npm:~5.2.0":
+"safe-buffer@npm:5.2.1, safe-buffer@npm:^5.0.1, safe-buffer@npm:~5.2.0":
version: 5.2.1
resolution: "safe-buffer@npm:5.2.1"
checksum: 10c0/6501914237c0a86e9675d4e51d89ca3c21ffd6a31642efeba25ad65720bce6921c9e7e974e5be91a786b25aa058b5303285d3c15dbabf983a919f5f630d349f3
@@ -21511,6 +21778,13 @@ __metadata:
languageName: node
linkType: hard
+"undici-types@npm:>=7.24.0 <7.24.7":
+ version: 7.24.6
+ resolution: "undici-types@npm:7.24.6"
+ checksum: 10c0/d9cd8befb643ac904615c280a095ba4240531f6bb4a5e75a22a7483630ca8d3f1016d2ab6ace6ceda1f63b3a2db2fe037fafe121d6917a0187573aa548ff78ca
+ languageName: node
+ linkType: hard
+
"undici-types@npm:~5.26.4":
version: 5.26.5
resolution: "undici-types@npm:5.26.5"
@@ -22064,6 +22338,13 @@ __metadata:
languageName: node
linkType: hard
+"web-streams-polyfill@npm:^3.0.3":
+ version: 3.3.3
+ resolution: "web-streams-polyfill@npm:3.3.3"
+ checksum: 10c0/64e855c47f6c8330b5436147db1c75cb7e7474d924166800e8e2aab5eb6c76aac4981a84261dd2982b3e754490900b99791c80ae1407a9fa0dcff74f82ea3a7f
+ languageName: node
+ linkType: hard
+
"webidl-conversions@npm:^3.0.0":
version: 3.0.1
resolution: "webidl-conversions@npm:3.0.1"