expo-eas-client 57.0.1 → 57.0.2

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/CHANGELOG.md CHANGED
@@ -10,6 +10,12 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 57.0.2 — 2026-08-26
14
+
15
+ ### 🐛 Bug fixes
16
+
17
+ - Fix `deterministicUniformValue` to return a uniformly distributed value over `[0, 1)`. ([#49182](https://github.com/expo/expo/pull/49182) by [@bjjeong](https://github.com/bjjeong))
18
+
13
19
  ## 57.0.1 — 2026-07-15
14
20
 
15
21
  _This version does not introduce any user-facing changes._
@@ -4,7 +4,7 @@ plugins {
4
4
  }
5
5
 
6
6
  group = 'host.exp.exponent'
7
- version = '57.0.1'
7
+ version = '57.0.2'
8
8
 
9
9
  expoModule {
10
10
  canBePublished false
@@ -14,7 +14,7 @@ android {
14
14
  namespace "expo.modules.easclient"
15
15
  defaultConfig {
16
16
  versionCode 1
17
- versionName "57.0.1"
17
+ versionName "57.0.2"
18
18
  testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
19
19
  }
20
20
  testOptions {
@@ -9,11 +9,17 @@ private const val EAS_CLIENT_ID_SHARED_PREFERENCES_KEY = "eas-client-id"
9
9
  class EASClientID(private val context: Context) {
10
10
  companion object {
11
11
  /**
12
- * Converts a UUID to a deterministic value in [0, 1] using the least significant
13
- * 64 bits interpreted as an unsigned integer fraction of ULong.MAX_VALUE.
12
+ * Converts a UUID to a deterministic value in [0, 1).
14
13
  */
15
14
  fun deterministicUniformValue(uuid: UUID): Double {
16
- return uuid.leastSignificantBits.toULong().toDouble() / ULong.MAX_VALUE.toDouble()
15
+ // Byte 8 is the RFC 4122 variant octet, pinned to `10`, and it is the high byte of
16
+ // leastSignificantBits, so that half alone only spans [0.5, 0.75]. splitmix64 over both
17
+ // halves moves the fixed bits off the high end; 2^53 is the widest exact Double range.
18
+ var z = (uuid.mostSignificantBits xor uuid.leastSignificantBits).toULong()
19
+ z = (z xor (z shr 30)) * 0xbf58476d1ce4e5b9UL
20
+ z = (z xor (z shr 27)) * 0x94d049bb133111ebUL
21
+ z = z xor (z shr 31)
22
+ return (z shr 11).toDouble() / (1L shl 53).toDouble()
17
23
  }
18
24
  }
19
25
 
package/build/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export declare const clientID: any;
2
2
  /**
3
- * A deterministic uniform value in [0, 1] derived from clientId.
3
+ * A deterministic uniform value in [0, 1) derived from clientId.
4
4
  * Stable across app launches for the same installation,
5
5
  * but unique per app instance.
6
6
  */
package/build/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import EASClient from './EASClient';
2
2
  export const clientID = EASClient.clientID;
3
3
  /**
4
- * A deterministic uniform value in [0, 1] derived from clientId.
4
+ * A deterministic uniform value in [0, 1) derived from clientId.
5
5
  * Stable across app launches for the same installation,
6
6
  * but unique per app instance.
7
7
  */
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,aAAa,CAAC;AAEpC,MAAM,CAAC,MAAM,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAC;AAC3C;;;;GAIG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAW,SAAS,CAAC,yBAAyB,CAAC","sourcesContent":["import EASClient from './EASClient';\n\nexport const clientID = EASClient.clientID;\n/**\n * A deterministic uniform value in [0, 1] derived from clientId.\n * Stable across app launches for the same installation,\n * but unique per app instance.\n */\nexport const deterministicUniformValue: number = EASClient.deterministicUniformValue;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,aAAa,CAAC;AAEpC,MAAM,CAAC,MAAM,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAC;AAC3C;;;;GAIG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAW,SAAS,CAAC,yBAAyB,CAAC","sourcesContent":["import EASClient from './EASClient';\n\nexport const clientID = EASClient.clientID;\n/**\n * A deterministic uniform value in [0, 1) derived from clientId.\n * Stable across app launches for the same installation,\n * but unique per app instance.\n */\nexport const deterministicUniformValue: number = EASClient.deterministicUniformValue;\n"]}
@@ -12,13 +12,22 @@ public class EASClientID : NSObject {
12
12
  })!
13
13
  }
14
14
 
15
- /// Converts a UUID to a deterministic value in [0, 1] using the least significant
16
- /// 64 bits (bytes 8–15) interpreted as an unsigned integer fraction of UInt64.max.
15
+ /// Converts a UUID to a deterministic value in [0, 1).
17
16
  public static func deterministicUniformValue(_ uuid: UUID) -> Double {
18
- let value = withUnsafeBytes(of: uuid.uuid) {
19
- $0.load(fromByteOffset: 8, as: UInt64.self).bigEndian
17
+ // Byte 8 is the RFC 4122 variant octet, pinned to `10`, and it is the high byte of the low
18
+ // half, so that half alone only spans [0.5, 0.75]. splitmix64 over both halves moves the
19
+ // fixed bits off the high end; 2^53 is the widest exact Double range.
20
+ let (high, low) = withUnsafeBytes(of: uuid.uuid) {
21
+ (
22
+ $0.load(fromByteOffset: 0, as: UInt64.self).bigEndian,
23
+ $0.load(fromByteOffset: 8, as: UInt64.self).bigEndian
24
+ )
20
25
  }
21
- return Double(value) / Double(UInt64.max)
26
+ var z = high ^ low
27
+ z = (z ^ (z >> 30)) &* 0xbf58_476d_1ce4_e5b9
28
+ z = (z ^ (z >> 27)) &* 0x94d0_49bb_1331_11eb
29
+ z = z ^ (z >> 31)
30
+ return Double(z >> 11) / Double(1 << 53)
22
31
  }
23
32
  }
24
33
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-eas-client",
3
- "version": "57.0.1",
3
+ "version": "57.0.2",
4
4
  "description": "Stable client identifier for EAS services",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -28,7 +28,7 @@
28
28
  "devDependencies": {
29
29
  "expo-module-scripts": "56.0.3"
30
30
  },
31
- "gitHead": "b9503d06b8e130abfca1bc16f671dbefb41ad709",
31
+ "gitHead": "c300d2cc60c9e684e64f48d9bc90ea18a571d01d",
32
32
  "scripts": {
33
33
  "build": "expo-module build",
34
34
  "clean": "expo-module clean",
package/src/index.ts CHANGED
@@ -2,7 +2,7 @@ import EASClient from './EASClient';
2
2
 
3
3
  export const clientID = EASClient.clientID;
4
4
  /**
5
- * A deterministic uniform value in [0, 1] derived from clientId.
5
+ * A deterministic uniform value in [0, 1) derived from clientId.
6
6
  * Stable across app launches for the same installation,
7
7
  * but unique per app instance.
8
8
  */