npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@limrun/apple-auth

v0.6.3

Published

Apple authentication, signing credentials, and App Store Connect for browsers, CLIs, and desktop apps.

Readme

@limrun/apple-auth

Primitives for signing in with an Apple Account and managing Apple Developer and App Store Connect resources through Limrun's Apple relay. Use the same package import in secure browser contexts, Node.js 18 or later, and the Node process of a desktop app. Crypto and WebSocket implementations are selected automatically; you do not need to install browser globals.

The package exports Apple login, teams, bundle IDs, certificates, provisioning profiles, App Store Connect API keys and app records, signing crypto, and pluggable signing-secret stores:

import { createAppleProfile, ensureAppleCertificateSecret, listAppleTeams } from '@limrun/apple-auth';

React applications can use the thin Apple ID login state helper:

import { useAppleIDLogin } from '@limrun/apple-auth/react';

Signing secrets remain under the caller's control through SigningSecretStore. Limrun's org secret store (createLimrunSecretStore) is the included implementation; applications that keep secrets themselves implement the interface over their own storage — a database, a KMS, anything — like the publish-to-stores example does with its backend.

Sign in from a CLI or desktop app

Use startAppleIDLogin for the same SRP and two-factor flow used in browsers. startBrowserOwnedAppleIDLogin remains an alias for existing integrations. Your application supplies the password and verification-code prompts. The password stays in the calling process; the relay handles SRP proofs, verification codes, and Apple session credentials.

import { startAppleIDLogin, listAppleTeams, ensureAppStoreConnectApiKeySecret } from '@limrun/apple-auth';

const session = await startAppleIDLogin({ registryApiUrl, token, accountName, password });
try {
  if (session.requiresTwoFactor) {
    await session.finishTwoFactor(await promptForVerificationCode());
  }
  await session.finalize();
  const teams = await listAppleTeams({ relay: session.relay });
  // Let the user select a team when the account belongs to more than one.
  const team = await selectTeam(teams);
  await ensureAppStoreConnectApiKeySecret({
    relay: session.relay,
    teamId: team.teamId,
    providerId: team.providerId,
    nickname: 'My desktop app',
    roles: ['ADMIN'],
    secretStore,
  });
} finally {
  await session.close();
}

The secretStore implements SigningSecretStore. A CLI can store the key in user-owned files; a desktop app can use its operating system's credential store. The package does not persist credentials on its own. lim ios apple auth uses this flow and saves its key under ~/.lim/secrets.

Get a support reference for Apple login failures

Read relay.relaySessionId or response.relaySessionId to identify one relay connection. The ID is a random support reference, contains no account information, and grants no access to the connection. A new connection gets a new ID.

Login and relay transport failures throw AppleRelayError. Save its relaySessionId before starting another login attempt:

import { AppleRelayError, startBrowserOwnedAppleIDLogin } from '@limrun/apple-auth';

try {
  const login = await startBrowserOwnedAppleIDLogin({ registryApiUrl, token, accountName, password });
  console.info({ relaySessionId: login.relay.relaySessionId });
} catch (error) {
  if (error instanceof AppleRelayError && error.relaySessionId) {
    console.info({ relaySessionId: error.relaySessionId });
  }
  throw error;
}

For React, useAppleIDLogin() returns relaySessionId alongside error, including when login fails before a session is returned. Display that ID as the support reference. Starting another login or calling close() clears the hook's reference.

Share the reference and approximate failure time with Limrun support. Record only the reference for correlation; Apple response bodies, headers, and error messages can contain account information or authentication state.

The ID is optional for compatibility with older relay servers and is unavailable if the connection fails before its first response. The low-level client's getter is populated by the first response and remains available after close(), until the next connect() call.

Developer Portal resources

All helpers use the existing Apple ID relay session and accept { relay, teamId }. Operations supported in both portal namespaces also accept platform: 'ios' | 'mac', with ios as the default. New resource types retain Apple's wire field names. For example, applicationGroup is the opaque ID for assignments, while identifier is the group.com.example.shared value used in entitlements.

| Resource | Helpers | Platforms | | ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------- | | App Groups | listAppleAppGroups, createAppleAppGroup, ensureAppleAppGroup, deleteAppleAppGroup, assignAppleAppGroups | iOS | | App ID details and name | getAppleBundleIDDetails, renameAppleBundleID | iOS, Mac | | Capabilities and push | updateAppleAppService | iOS | | iCloud containers | listAppleCloudContainers, createAppleCloudContainer, assignAppleCloudContainers | Team resources; iOS assignments | | Apple Pay merchant IDs | listAppleMerchantIDs, createAppleMerchantID, deleteAppleMerchantID, assignAppleMerchantIDs | iOS, Mac | | Merchant domains | listAppleMerchantDomains, registerAppleMerchantDomain, downloadAppleMerchantDomainVerification, verifyAppleMerchantDomain, deleteAppleMerchantDomain | iOS, Mac | | Wallet pass type IDs | listApplePassTypeIDs, createApplePassTypeID, deleteApplePassTypeID | iOS | | Website push IDs | listAppleWebsitePushIDs, createAppleWebsitePushID, deleteAppleWebsitePushID | iOS, Mac | | Profiles | getAppleProfileDetails, regenerateAppleProfile | iOS, Mac | | Devices | enableAppleDevice; listAppleDevices also accepts includeDisabled and deviceClass | iOS, Mac | | Developer Portal keys | listAppleDeveloperKeys, getAppleDeveloperKey, downloadAppleDeveloperKey, revokeAppleDeveloperKey | Team resources |

The existing bundle ID, certificate, device, and profile helpers also accept platform. Developer Portal keys are separate from App Store Connect API keys. Downloads return the original bytes as rawBodyBase64; decode that once to get the key or verification file. JSON and HTTP errors reject the promise.

updateAppleAppService takes Apple's featureType and featureValue. App Groups uses APG3427HIY with true; push uses push and selects Apple's separate push endpoint. Assignment helpers send the entire supplied array of opaque record IDs. Read existing assignments and merge them before adding a new one. They do not implicitly enable capabilities or refresh provisioning profiles.

New resource lists fetch all pages. Mutating helpers refresh the relevant CSRF headers through a list request before the write. Await setup calls sequentially on a shared relay session, since Apple session headers change between resources.

Sharing an App Group with a widget

import {
  ensureAppleAppGroup,
  getAppleBundleIDDetails,
  updateAppleAppService,
  assignAppleAppGroups,
} from '@limrun/apple-auth';

// Use the authenticated relay and the selected Developer Portal team.
const group = await ensureAppleAppGroup({
  relay,
  teamId,
  identifier: 'group.com.example.shared',
  name: 'Shared widget data',
});

// These are Apple's opaque App ID record IDs, not bundle identifier strings.
for (const appIdId of [mainAppIdId, widgetAppIdId]) {
  const details = await getAppleBundleIDDetails({ relay, teamId, appIdId });
  const applicationGroups = [
    ...new Set([
      ...(details.associatedApplicationGroups ?? []).map((g) => g.applicationGroup),
      group.applicationGroup,
    ]),
  ];
  await updateAppleAppService({
    relay,
    teamId,
    appIdId,
    featureType: 'APG3427HIY',
    featureValue: true,
  });
  await assignAppleAppGroups({ relay, teamId, appIdId, applicationGroups });
}

After changing capabilities or assignments, create or regenerate each affected bundle's provisioning profile and download it again. For cloud signing, pass com.apple.security.application-groups in the entitlements for both the main app and widget using --entitlements or the SDK's per-bundle entitlements map.

When regenerating development (limited) or ad hoc (adhoc) profiles, pass a nonempty deviceIds list containing every device that should remain in the profile. regenerateAppleProfile rejects missing or empty lists before making any requests. Store, enterprise (inhouse), and Developer ID (direct) profiles can omit devices.

Developer service keys and agreements

The following helpers use the same { relay, teamId } session:

| Operation | Helper | | -------------------------------------------- | ---------------------------- | | Read outstanding agreements | listApplePendingAgreements | | Create an APNs, DeviceCheck, or MusicKit key | createAppleDeveloperKey |

The relay selects JSON encoding for these endpoints. Callers use the same provisioning request type as the other portal helpers. Key creation refreshes key CSRF headers before the write.

import { createAppleDeveloperKey, downloadAppleDeveloperKey } from '@limrun/apple-auth';

const key = await createAppleDeveloperKey({
  relay,
  teamId,
  name: 'App notifications',
  apns: true,
});
const privateKey = await downloadAppleDeveloperKey({ relay, teamId, keyId: key.keyId });
// Decode privateKey.rawBodyBase64 once to obtain the .p8 private key bytes.

apns: true requests a team-scoped key for development and production. Add deviceCheck: true or musicId: '<opaque Music ID>' to configure those services. These are Developer Portal service keys, separate from App Store Connect API keys and code-signing certificates. Creation returns a key record; private bytes are downloaded separately and remain under the caller's control.

listApplePendingAgreements returns Apple's full response envelope; its optional language defaults to en. It does not accept agreements.