@oxy.so/app-preset 2.2.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -14,7 +14,7 @@ and JSON.
14
14
 
15
15
  | Piece | Import | Replaces |
16
16
  | --- | --- | --- |
17
- | Config plugin | `['@oxy.so/app-preset', {}]` | `withSharedUserId` + iOS keychain entitlement + `expo-build-properties` + `@oxy.so/services/plugins/withSharedIdentityReader` |
17
+ | Config plugin | `['@oxy.so/app-preset', {}]` | iOS keychain entitlement + `expo-build-properties` + `@oxy.so/services/plugins/withOxySharedPermissions` |
18
18
  | Android release build | `@oxy.so/app-preset/plugin/withOxyAndroidRelease` | R8 `-optimize` ProGuard file + shared-keystore release signing (opt-in, see below) |
19
19
  | Android WebP resources | `@oxy.so/app-preset/plugin/withOxyAndroidWebp` | re-encoding generated mipmaps/splash bitmaps to real lossless WebP (opt-in, needs `sharp`) |
20
20
  | Oxy Updates (OTA) | `@oxy.so/app-preset/plugin/withOxyUpdates` | the `expo-updates` manifest URL, release channel, `runtimeVersion` policy and the shared code-signing certificate (opt-in, see below) |
@@ -35,25 +35,29 @@ plugins: [
35
35
  ]
36
36
  ```
37
37
 
38
- This adds `android:sharedUserId="so.oxy.shared"`, the iOS
39
- `keychain-access-groups` entitlement (`$(AppIdentifierPrefix)group.so.oxy.shared`),
40
- the Oxy `expo-build-properties` defaults (iOS `deploymentTarget 16.4`; Android
41
- `compileSdk 36` / `targetSdk 35` / ProGuard + resource shrinking), and the
42
- `@oxy.so/services` shared-identity reader plugin (Android signature permission +
43
- `<queries>` for silent "Sign in with Oxy").
38
+ This adds the iOS `keychain-access-groups` entitlement
39
+ (`$(AppIdentifierPrefix)group.so.oxy.shared`), the Oxy `expo-build-properties`
40
+ defaults (iOS `deploymentTarget 16.4`; Android `compileSdk 36` / `targetSdk 35` /
41
+ ProGuard + resource shrinking), and `@oxy.so/services/plugins/withOxySharedPermissions`:
42
+ the app declares and requests the signature-level `so.oxy.permission.IDENTITY` and
43
+ `so.oxy.permission.DEVICE_SESSION`, with `<queries>` for the Commons and Accounts
44
+ providers. That is how silent "Sign in with Oxy" works on Android: each Oxy app
45
+ has its own UID, and Commons — the only holder of the identity key — answers over
46
+ signature-protected IPC. **Never add `android:sharedUserId`.**
44
47
 
45
- Each piece is individually disableable and overridable:
48
+ The iOS and build-property pieces are overridable:
46
49
 
47
50
  ```js
48
51
  ['@oxy.so/app-preset', {
49
- sharedUserId: 'so.oxy.shared', // false → skip android:sharedUserId
50
52
  keychainGroup: 'group.so.oxy.shared', // false → skip iOS keychain entitlement
51
53
  ios: { deploymentTarget: '17.0' }, // deep-merges over defaults; false → skip iOS build props
52
54
  android: { targetSdkVersion: 34 }, // deep-merges over defaults; false → skip Android build props
53
- sharedIdentityReader: true, // false → skip @oxy.so/services reader plugin
54
55
  }]
55
56
  ```
56
57
 
58
+ The `sharedUserId` and `sharedIdentityReader` options were removed in 3.0.0 and
59
+ throw if passed. `@oxy.so/services` 11+ is a required peer.
60
+
57
61
  #### Android release-build plugins (opt-in)
58
62
 
59
63
  These two are deliberately NOT part of `['@oxy.so/app-preset', {}]`: one writes a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxy.so/app-preset",
3
- "version": "2.2.0",
3
+ "version": "3.0.0",
4
4
  "description": "The Oxy distro of Expo — centralized Expo config plugin, Metro/Babel/ESLint factories, Tailwind base CSS and TypeScript bases shared by every Oxy app (Mention, Homiio, Allo, accounts, …). A zero-build package: apps replace copy-pasted config with a single dependency bump.",
5
5
  "main": "./app.plugin.js",
6
6
  "publishConfig": {
@@ -10,7 +10,6 @@
10
10
  ".": "./app.plugin.js",
11
11
  "./app.plugin.js": "./app.plugin.js",
12
12
  "./plugin/withOxyAppPreset": "./plugin/withOxyAppPreset.js",
13
- "./plugin/withSharedUserId": "./plugin/withSharedUserId.js",
14
13
  "./plugin/withOxyKeychain": "./plugin/withOxyKeychain.js",
15
14
  "./plugin/withOxyBuildProperties": "./plugin/withOxyBuildProperties.js",
16
15
  "./plugin/withOxyAndroidRelease": "./plugin/withOxyAndroidRelease.js",
@@ -64,10 +63,10 @@
64
63
  "prepublishOnly": "node ../../scripts/assert-bun-publish.mjs",
65
64
  "test": "node --test __tests__/*.test.js"
66
65
  },
67
- "//peerDependencies": "THE TWO @oxy.so PEERS ARE DELIBERATE. This package couples to them by FILE PATH, not by API: `css/base.css` imports `@oxy.so/bloom/design-tokens/theme.css`, and `plugin/withOxyAppPreset.js` optionally requires `@oxy.so/services/plugins/withSharedIdentityReader`. Both peers retain a measured floor and a breaking-major cap so compatible patches deduplicate in consumers. Never replace either constraint with `*` or an uncapped range.",
66
+ "//peerDependencies": "THE TWO @oxy.so PEERS ARE DELIBERATE. This package couples to them by FILE PATH, not by API: `css/base.css` imports `@oxy.so/bloom/design-tokens/theme.css`, and `plugin/withOxyAppPreset.js` requires `@oxy.so/services/plugins/withOxySharedPermissions` (services 11+, where it first exists, so the services floor is the major that ships it). Both peers retain a measured floor and a breaking-major cap so compatible patches deduplicate in consumers. Never replace either constraint with `*` or an uncapped range.",
68
67
  "peerDependencies": {
69
- "@oxy.so/bloom": "^2.0.0 || ^3.0.0 || ^4.2.0 || ^5.1.0",
70
- "@oxy.so/services": "^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0",
68
+ "@oxy.so/bloom": "^2.0.0 || ^3.0.0 || ^4.2.0 || ^5.1.0 || ^6.0.0",
69
+ "@oxy.so/services": "^11.0.0",
71
70
  "babel-plugin-module-resolver": "*",
72
71
  "babel-preset-expo": "*",
73
72
  "eslint": ">=9.0.0",
@@ -88,9 +87,6 @@
88
87
  "@oxy.so/bloom": {
89
88
  "optional": true
90
89
  },
91
- "@oxy.so/services": {
92
- "optional": true
93
- },
94
90
  "babel-plugin-module-resolver": {
95
91
  "optional": true
96
92
  },
@@ -27,11 +27,12 @@
27
27
  * -jarfile <aab>` / `apksigner verify --print-certs <apk>`) rather than
28
28
  * assumed.
29
29
  *
30
- * The certificate MUST be the shared Oxy ecosystem one: every Oxy app sets
31
- * `android:sharedUserId="so.oxy.shared"` (see withSharedUserId) and Android
32
- * requires every app sharing that UID to be signed with the SAME
33
- * certificate. An app-specific key breaks "sign in once, use everywhere" and
34
- * makes the app refuse to install next to its siblings.
30
+ * The certificate MUST be the shared Oxy ecosystem one: Oxy apps share the
31
+ * identity and the device session through `signature`-level permissions
32
+ * (`withOxySharedPermissions`) and providers that check the caller's
33
+ * certificate. An app-specific key is refused by Commons, and its duplicate
34
+ * permission declaration makes Android refuse to install it next to its
35
+ * siblings (INSTALL_FAILED_DUPLICATE_PERMISSION).
35
36
  *
36
37
  * @param {import('expo/config').ExpoConfig} config
37
38
  */
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * Expo Config Plugin: withOxyAppPreset
3
3
  *
4
- * The single config-plugin entry every Oxy app adds in place of the four
5
- * copy-pasted plugin entries (`withSharedUserId`, keychain entitlement,
6
- * `expo-build-properties`, `@oxy.so/services/plugins/withSharedIdentityReader`).
4
+ * The single config-plugin entry every Oxy app adds in place of the copy-pasted
5
+ * plugin entries (iOS keychain entitlement, `expo-build-properties`,
6
+ * `@oxy.so/services/plugins/withOxySharedPermissions`).
7
7
  *
8
8
  * In app.config.js / app.json:
9
9
  *
@@ -12,44 +12,56 @@
12
12
  * ['@oxy.so/app-preset', {}],
13
13
  * ]
14
14
  *
15
- * Each piece is individually disableable by passing its option as `false`:
15
+ * Options:
16
16
  *
17
17
  * ['@oxy.so/app-preset', {
18
- * sharedUserId: 'so.oxy.shared', // false → skip android:sharedUserId
19
18
  * keychainGroup: 'group.so.oxy.shared', // false → skip iOS keychain entitlement
20
19
  * ios: { deploymentTarget: '17.0' }, // false → skip iOS build properties
21
20
  * android: { targetSdkVersion: 34 }, // false → skip Android build properties
22
- * sharedIdentityReader: true, // false → skip @oxy.so/services reader plugin
23
21
  * }]
24
22
  *
23
+ * Android never gets `android:sharedUserId`: each Oxy app has its own UID and
24
+ * shares the identity and the device session with Commons over
25
+ * signature-protected IPC. `withOxySharedPermissions` (always applied) declares
26
+ * and requests the two Oxy signature permissions and the `<queries>` for the
27
+ * host authorities. The removed `sharedUserId` and `sharedIdentityReader`
28
+ * options throw, so an app config that still passes them fails loudly instead
29
+ * of silently doing something else.
30
+ *
25
31
  * @param {import('expo/config').ExpoConfig} config
26
32
  * @param {object} [options]
27
- * @param {string|false} [options.sharedUserId='so.oxy.shared']
28
33
  * @param {string|false} [options.keychainGroup='group.so.oxy.shared']
29
34
  * @param {object|false} [options.ios]
30
35
  * @param {object|false} [options.android]
31
- * @param {boolean} [options.sharedIdentityReader=true]
32
36
  */
33
- const withSharedUserId = require('./withSharedUserId');
34
37
  const withOxyKeychain = require('./withOxyKeychain');
35
38
  const withOxyBuildProperties = require('./withOxyBuildProperties');
36
39
  const { projectRootOf, requireFromProject } = require('./requireFromProject');
37
40
 
41
+ const REMOVED_OPTIONS = {
42
+ sharedUserId:
43
+ 'Oxy Android apps no longer share a UID: they share the identity and the session with Commons '
44
+ + 'over signature-protected IPC. Remove the option (and any android:sharedUserId).',
45
+ sharedIdentityReader:
46
+ 'the reader plugin is gone; every Oxy app now applies @oxy.so/services/plugins/withOxySharedPermissions, '
47
+ + 'which the preset always does. Remove the option.',
48
+ };
49
+
38
50
  module.exports = function withOxyAppPreset(config, options = {}) {
51
+ for (const [name, reason] of Object.entries(REMOVED_OPTIONS)) {
52
+ if (Object.hasOwn(options, name)) {
53
+ throw new Error(`[@oxy.so/app-preset] The \`${name}\` option was removed: ${reason}`);
54
+ }
55
+ }
56
+
39
57
  const {
40
- sharedUserId = 'so.oxy.shared',
41
58
  keychainGroup = 'group.so.oxy.shared',
42
59
  ios = {},
43
60
  android = {},
44
- sharedIdentityReader = true,
45
61
  } = options;
46
62
 
47
63
  let next = config;
48
64
 
49
- if (sharedUserId !== false) {
50
- next = withSharedUserId(next, sharedUserId);
51
- }
52
-
53
65
  if (keychainGroup !== false) {
54
66
  next = withOxyKeychain(next, keychainGroup);
55
67
  }
@@ -58,18 +70,19 @@ module.exports = function withOxyAppPreset(config, options = {}) {
58
70
  next = withOxyBuildProperties(next, { ios, android });
59
71
  }
60
72
 
61
- if (sharedIdentityReader !== false) {
62
- let withSharedIdentityReader;
63
- try {
64
- withSharedIdentityReader = requireFromProject('@oxy.so/services/plugins/withSharedIdentityReader', projectRootOf(config));
65
- } catch (error) {
66
- throw new Error(
67
- "[@oxy.so/app-preset] sharedIdentityReader is enabled but the peer dependency '@oxy.so/services' "
68
- + 'is not installed. Install it, or pass `{ sharedIdentityReader: false }` to the preset.',
69
- );
70
- }
71
- next = withSharedIdentityReader(next);
73
+ let withOxySharedPermissions;
74
+ try {
75
+ withOxySharedPermissions = requireFromProject(
76
+ '@oxy.so/services/plugins/withOxySharedPermissions',
77
+ projectRootOf(config),
78
+ );
79
+ } catch (error) {
80
+ throw new Error(
81
+ "[@oxy.so/app-preset] needs '@oxy.so/services' 11 or later (for plugins/withOxySharedPermissions). "
82
+ + `Install it in the app. (${error instanceof Error ? error.message : String(error)})`,
83
+ );
72
84
  }
85
+ next = withOxySharedPermissions(next);
73
86
 
74
87
  return next;
75
88
  };
@@ -3,8 +3,8 @@
3
3
  *
4
4
  * Adds an iOS `keychain-access-groups` entitlement so Oxy apps signed with the
5
5
  * same Team ID can share Keychain items — the iOS half of "sign in once, use
6
- * everywhere" (the Android half is withSharedUserId + the shared-identity
7
- * native module). The group is prefixed with `$(AppIdentifierPrefix)` so Xcode
6
+ * everywhere" (the Android half is Commons' identity host, reached over
7
+ * signature-protected IPC; see `withOxySharedPermissions` in @oxy.so/services). The group is prefixed with `$(AppIdentifierPrefix)` so Xcode
8
8
  * expands it to the Team ID at build time.
9
9
  *
10
10
  * Merge-not-overwrite: if the app (or another plugin, e.g. expo-build-properties)
@@ -1,36 +0,0 @@
1
- /**
2
- * Expo Config Plugin: withSharedUserId
3
- *
4
- * Adds android:sharedUserId to AndroidManifest.xml to enable cross-app data
5
- * sharing between Oxy apps (Mention, Homiio, accounts, Commons, …).
6
- *
7
- * This allows:
8
- * - Shared cryptographic identity storage
9
- * - Cross-app authentication (sign in once, use everywhere)
10
- * - Shared session tokens
11
- *
12
- * IMPORTANT:
13
- * - All Oxy apps MUST use the same sharedUserId: "so.oxy.shared"
14
- * - Apps MUST be signed with the same certificate
15
- * - Cannot change sharedUserId after publishing (requires reinstall)
16
- *
17
- * @see https://developer.android.com/guide/topics/manifest/manifest-element#uid
18
- *
19
- * @param {import('expo/config').ExpoConfig} config
20
- * @param {string} [sharedUserId='so.oxy.shared'] The android:sharedUserId value.
21
- */
22
- const { withAndroidManifest } = require('expo/config-plugins');
23
-
24
- module.exports = function withSharedUserId(config, sharedUserId = 'so.oxy.shared') {
25
- return withAndroidManifest(config, async (config) => {
26
- const androidManifest = config.modResults.manifest;
27
-
28
- // Add sharedUserId to the manifest root element
29
- androidManifest.$ = {
30
- ...androidManifest.$,
31
- 'android:sharedUserId': sharedUserId,
32
- };
33
-
34
- return config;
35
- });
36
- };