expo-crypto 15.0.0-canary-20250404-3c3b5fd → 15.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.
Files changed (33) hide show
  1. package/CHANGELOG.md +32 -2
  2. package/android/build.gradle +2 -2
  3. package/build/Crypto.js.map +1 -1
  4. package/build/ExpoCrypto.web.d.ts.map +1 -1
  5. package/build/ExpoCrypto.web.js.map +1 -1
  6. package/expo-module.config.json +7 -1
  7. package/ios/ExpoCrypto.podspec +1 -1
  8. package/local-maven-repo/host/exp/exponent/expo.modules.crypto/15.0.0/expo.modules.crypto-15.0.0-sources.jar +0 -0
  9. package/local-maven-repo/host/exp/exponent/expo.modules.crypto/15.0.0/expo.modules.crypto-15.0.0-sources.jar.md5 +1 -0
  10. package/local-maven-repo/host/exp/exponent/expo.modules.crypto/15.0.0/expo.modules.crypto-15.0.0-sources.jar.sha1 +1 -0
  11. package/local-maven-repo/host/exp/exponent/expo.modules.crypto/15.0.0/expo.modules.crypto-15.0.0-sources.jar.sha256 +1 -0
  12. package/local-maven-repo/host/exp/exponent/expo.modules.crypto/15.0.0/expo.modules.crypto-15.0.0-sources.jar.sha512 +1 -0
  13. package/local-maven-repo/host/exp/exponent/expo.modules.crypto/15.0.0/expo.modules.crypto-15.0.0.aar +0 -0
  14. package/local-maven-repo/host/exp/exponent/expo.modules.crypto/15.0.0/expo.modules.crypto-15.0.0.aar.md5 +1 -0
  15. package/local-maven-repo/host/exp/exponent/expo.modules.crypto/15.0.0/expo.modules.crypto-15.0.0.aar.sha1 +1 -0
  16. package/local-maven-repo/host/exp/exponent/expo.modules.crypto/15.0.0/expo.modules.crypto-15.0.0.aar.sha256 +1 -0
  17. package/local-maven-repo/host/exp/exponent/expo.modules.crypto/15.0.0/expo.modules.crypto-15.0.0.aar.sha512 +1 -0
  18. package/local-maven-repo/host/exp/exponent/expo.modules.crypto/15.0.0/expo.modules.crypto-15.0.0.module +87 -0
  19. package/local-maven-repo/host/exp/exponent/expo.modules.crypto/15.0.0/expo.modules.crypto-15.0.0.module.md5 +1 -0
  20. package/local-maven-repo/host/exp/exponent/expo.modules.crypto/15.0.0/expo.modules.crypto-15.0.0.module.sha1 +1 -0
  21. package/local-maven-repo/host/exp/exponent/expo.modules.crypto/15.0.0/expo.modules.crypto-15.0.0.module.sha256 +1 -0
  22. package/local-maven-repo/host/exp/exponent/expo.modules.crypto/15.0.0/expo.modules.crypto-15.0.0.module.sha512 +1 -0
  23. package/local-maven-repo/host/exp/exponent/expo.modules.crypto/15.0.0/expo.modules.crypto-15.0.0.pom +35 -0
  24. package/local-maven-repo/host/exp/exponent/expo.modules.crypto/15.0.0/expo.modules.crypto-15.0.0.pom.md5 +1 -0
  25. package/local-maven-repo/host/exp/exponent/expo.modules.crypto/15.0.0/expo.modules.crypto-15.0.0.pom.sha1 +1 -0
  26. package/local-maven-repo/host/exp/exponent/expo.modules.crypto/15.0.0/expo.modules.crypto-15.0.0.pom.sha256 +1 -0
  27. package/local-maven-repo/host/exp/exponent/expo.modules.crypto/15.0.0/expo.modules.crypto-15.0.0.pom.sha512 +1 -0
  28. package/local-maven-repo/host/exp/exponent/expo.modules.crypto/maven-metadata.xml +13 -0
  29. package/local-maven-repo/host/exp/exponent/expo.modules.crypto/maven-metadata.xml.md5 +1 -0
  30. package/local-maven-repo/host/exp/exponent/expo.modules.crypto/maven-metadata.xml.sha1 +1 -0
  31. package/local-maven-repo/host/exp/exponent/expo.modules.crypto/maven-metadata.xml.sha256 +1 -0
  32. package/local-maven-repo/host/exp/exponent/expo.modules.crypto/maven-metadata.xml.sha512 +1 -0
  33. package/package.json +5 -4
package/CHANGELOG.md CHANGED
@@ -4,14 +4,44 @@
4
4
 
5
5
  ### 🛠 Breaking changes
6
6
 
7
- - Bump minimum macOS version to 11.0. ([#34980](https://github.com/expo/expo/pull/34980) by [@gabrieldonadel](https://github.com/gabrieldonadel))
8
-
9
7
  ### 🎉 New features
10
8
 
11
9
  ### 🐛 Bug fixes
12
10
 
13
11
  ### 💡 Others
14
12
 
13
+ ## 15.0.0 — 2025-08-13
14
+
15
+ _This version does not introduce any user-facing changes._
16
+
17
+ ## 14.1.5 - 2025-06-06
18
+
19
+ _This version does not introduce any user-facing changes._
20
+
21
+ ## 14.1.4 — 2025-04-30
22
+
23
+ _This version does not introduce any user-facing changes._
24
+
25
+ ## 14.1.3 — 2025-04-25
26
+
27
+ _This version does not introduce any user-facing changes._
28
+
29
+ ## 14.1.2 — 2025-04-14
30
+
31
+ _This version does not introduce any user-facing changes._
32
+
33
+ ## 14.1.1 — 2025-04-09
34
+
35
+ _This version does not introduce any user-facing changes._
36
+
37
+ ## 14.1.0 — 2025-04-04
38
+
39
+ ### 🛠 Breaking changes
40
+
41
+ - Bump minimum macOS version to 11.0. ([#34980](https://github.com/expo/expo/pull/34980) by [@gabrieldonadel](https://github.com/gabrieldonadel))
42
+
43
+ ### 💡 Others
44
+
15
45
  - [Android] Started using expo modules gradle plugin. ([#34176](https://github.com/expo/expo/pull/34176) by [@lukmccall](https://github.com/lukmccall))
16
46
  - [iOS] Fix warnings which will become errors in Swift 6. ([#35288](https://github.com/expo/expo/pull/35288) by [@behenate](https://github.com/behenate))
17
47
 
@@ -4,13 +4,13 @@ plugins {
4
4
  }
5
5
 
6
6
  group = 'host.exp.exponent'
7
- version = '14.0.1'
7
+ version = '15.0.0'
8
8
 
9
9
  android {
10
10
  namespace "expo.modules.crypto"
11
11
  defaultConfig {
12
12
  versionCode 25
13
- versionName "14.0.1"
13
+ versionName "15.0.0"
14
14
  }
15
15
  }
16
16
 
@@ -1 +1 @@
1
- {"version":3,"file":"Crypto.js","sourceRoot":"","sources":["../src/Crypto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAA2C,MAAM,mBAAmB,CAAC;AAEjG,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAA+B,MAAM,gBAAgB,CAAC;AACpG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,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAAE,EAAE;IAClC,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAAE,EAAE;IAClC,CAAC,qBAAqB,CAAC,GAAG,CAAC,EAAE,EAAE;IAC/B,CAAC,qBAAqB,CAAC,GAAG,CAAC,EAAE,EAAE;IAC/B,CAAC,qBAAqB,CAAC,GAAG,CAAC,EAAE,EAAE;CAChC,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,MAAM,CAAC,SAAgC,EAAE,IAAkB;IACzE,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,IAAI;YACF,IAAI,OAAO,UAAU,CAAC,WAAW,KAAK,UAAU,EAAE;gBAChD,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC;aAClD;iBAAM;gBACL,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC;gBACxD,UAAU,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;gBAC3C,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;aACxB;SACF;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,CAAC,KAAK,CAAC,CAAC;SACf;IACH,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { toByteArray } from 'base64-js';\nimport { UnavailabilityError, UintBasedTypedArray, IntBasedTypedArray } from 'expo-modules-core';\n\nimport { CryptoDigestAlgorithm, CryptoEncoding, CryptoDigestOptions, Digest } from './Crypto.types';\nimport ExpoCrypto from './ExpoCrypto';\n\ndeclare const global: any;\n\nexport * from './Crypto.types';\n\nclass CryptoError extends TypeError {\n code = 'ERR_CRYPTO';\n\n constructor(message: string) {\n super(`expo-crypto: ${message}`);\n }\n}\n\n// @needsAudit\n/**\n * Generates completely random bytes using native implementations. The `byteCount` property\n * is a `number` indicating the number of bytes to generate in the form of a `Uint8Array`.\n * Falls back to `Math.random` during development to prevent issues with React Native Debugger.\n * @param byteCount - A number within the range from `0` to `1024`. Anything else will throw a `TypeError`.\n * @return An array of random bytes with the same length as the `byteCount`.\n */\nexport function getRandomBytes(byteCount: number): Uint8Array {\n assertByteCount(byteCount, 'getRandomBytes');\n const validByteCount = Math.floor(byteCount);\n if (__DEV__) {\n if (!global.nativeCallSyncHook || global.__REMOTEDEV__) {\n // remote javascript debugging is enabled\n const array = new Uint8Array(validByteCount);\n for (let i = 0; i < validByteCount; i++) {\n array[i] = Math.floor(Math.random() * 256);\n }\n return array;\n }\n }\n if (ExpoCrypto.getRandomValues) {\n const byteArray = new Uint8Array(validByteCount);\n ExpoCrypto.getRandomValues(byteArray);\n return byteArray;\n } else if (ExpoCrypto.getRandomBase64String) {\n const base64 = ExpoCrypto.getRandomBase64String(validByteCount);\n return toByteArray(base64);\n } else {\n throw new UnavailabilityError('expo-crypto', 'getRandomBytes');\n }\n}\n\n// @needsAudit\n/**\n * Generates completely random bytes using native implementations. The `byteCount` property\n * is a `number` indicating the number of bytes to generate in the form of a `Uint8Array`.\n * @param byteCount - A number within the range from `0` to `1024`. Anything else will throw a `TypeError`.\n * @return A promise that fulfills with an array of random bytes with the same length as the `byteCount`.\n */\nexport async function getRandomBytesAsync(byteCount: number): Promise<Uint8Array> {\n assertByteCount(byteCount, 'getRandomBytesAsync');\n const validByteCount = Math.floor(byteCount);\n if (ExpoCrypto.getRandomValues) {\n const byteArray = new Uint8Array(validByteCount);\n ExpoCrypto.getRandomValues(byteArray);\n return byteArray;\n } else if (ExpoCrypto.getRandomBase64StringAsync) {\n const base64 = await ExpoCrypto.getRandomBase64StringAsync(validByteCount);\n return toByteArray(base64);\n } else {\n throw new UnavailabilityError('expo-crypto', 'getRandomBytesAsync');\n }\n}\n\nfunction assertByteCount(value: any, methodName: string): void {\n if (\n typeof value !== 'number' ||\n isNaN(value) ||\n Math.floor(value) < 0 ||\n Math.floor(value) > 1024\n ) {\n throw new TypeError(\n `expo-crypto: ${methodName}(${value}) expected a valid number from range 0...1024`\n );\n }\n}\n\nfunction assertAlgorithm(algorithm: CryptoDigestAlgorithm): void {\n if (!Object.values(CryptoDigestAlgorithm).includes(algorithm)) {\n throw new CryptoError(\n `Invalid algorithm provided. Expected one of: CryptoDigestAlgorithm.${Object.keys(\n CryptoDigestAlgorithm\n ).join(', AlgCryptoDigestAlgorithmorithm.')}`\n );\n }\n}\n\nfunction assertData(data: string): void {\n if (typeof data !== 'string') {\n throw new CryptoError(`Invalid data provided. Expected a string.`);\n }\n}\n\nfunction assertEncoding(encoding: CryptoEncoding): void {\n if (!Object.values(CryptoEncoding).includes(encoding)) {\n throw new CryptoError(\n `Invalid encoding provided. Expected one of: CryptoEncoding.${Object.keys(\n CryptoEncoding\n ).join(', CryptoEncoding.')}`\n );\n }\n}\n\n// @needsAudit\n/**\n * The `digestStringAsync()` method of `Crypto` generates a digest of the supplied `data` string with the provided digest `algorithm`.\n * A digest is a short fixed-length value derived from some variable-length input. **Cryptographic digests** should exhibit _collision-resistance_,\n * meaning that it's very difficult to generate multiple inputs that have equal digest values.\n * You can specify the returned string format as one of `CryptoEncoding`. By default, the resolved value will be formatted as a `HEX` string.\n * On web, this method can only be called from a secure origin (HTTPS) otherwise, an error will be thrown.\n *\n * @param algorithm The cryptographic hash function to use to transform a block of data into a fixed-size output.\n * @param data The value that will be used to generate a digest.\n * @param options Format of the digest string. Defaults to: `CryptoDigestOptions.HEX`.\n * @return Return a Promise which fulfills with a value representing the hashed input.\n *\n * @example\n * ```ts\n * const digest = await Crypto.digestStringAsync(\n * Crypto.CryptoDigestAlgorithm.SHA512,\n * '🥓 Easy to Digest! 💙'\n * );\n * ```\n */\nexport async function digestStringAsync(\n algorithm: CryptoDigestAlgorithm,\n data: string,\n options: CryptoDigestOptions = { encoding: CryptoEncoding.HEX }\n): Promise<Digest> {\n if (!ExpoCrypto.digestStringAsync) {\n throw new UnavailabilityError('expo-crypto', 'digestStringAsync');\n }\n\n assertAlgorithm(algorithm);\n assertData(data);\n assertEncoding(options.encoding);\n\n return await ExpoCrypto.digestStringAsync(algorithm, data, options);\n}\n\n/**\n * The `getRandomValues()` method of `Crypto` fills a provided `TypedArray` with cryptographically secure random values.\n *\n * @param typedArray An integer based [`TypedArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) to fill with cryptographically secure random values. It modifies the input array in place.\n * @return The input array filled with cryptographically secure random values.\n *\n * @example\n * ```ts\n * const byteArray = new Uint8Array(16);\n * Crypto.getRandomValues(byteArray);\n * console.log('Your lucky bytes: ' + byteArray);\n * ```\n */\nexport function getRandomValues<T extends IntBasedTypedArray | UintBasedTypedArray>(\n typedArray: T\n): T {\n ExpoCrypto.getRandomValues(typedArray);\n return typedArray;\n}\n\n/**\n * The `randomUUID()` method returns a unique identifier based on the V4 UUID spec (RFC4122).\n * It uses cryptographically secure random values to generate the UUID.\n *\n * @return A string containing a newly generated UUIDv4 identifier\n * @example\n * ```ts\n * const UUID = Crypto.randomUUID();\n * console.log('Your UUID: ' + UUID);\n * ```\n */\nexport function randomUUID(): string {\n return ExpoCrypto.randomUUID();\n}\n\nconst digestLengths = {\n [CryptoDigestAlgorithm.SHA1]: 20,\n [CryptoDigestAlgorithm.SHA256]: 32,\n [CryptoDigestAlgorithm.SHA384]: 48,\n [CryptoDigestAlgorithm.SHA512]: 64,\n [CryptoDigestAlgorithm.MD2]: 16,\n [CryptoDigestAlgorithm.MD4]: 16,\n [CryptoDigestAlgorithm.MD5]: 16,\n};\n\n/**\n * The `digest()` method of `Crypto` generates a digest of the supplied `TypedArray` of bytes `data` with the provided digest `algorithm`.\n * A digest is a short fixed-length value derived from some variable-length input. **Cryptographic digests** should exhibit _collision-resistance_,\n * meaning that it's very difficult to generate multiple inputs that have equal digest values.\n * On web, this method can only be called from a secure origin (HTTPS) otherwise, an error will be thrown.\n *\n * @param algorithm The cryptographic hash function to use to transform a block of data into a fixed-size output.\n * @param data The value that will be used to generate a digest.\n * @return A Promise which fulfills with an ArrayBuffer representing the hashed input.\n * @example\n * ```ts\n * const array = new Uint8Array([1, 2, 3, 4, 5]);\n * const digest = await Crypto.digest(Crypto.CryptoDigestAlgorithm.SHA512, array);\n * console.log('Your digest: ' + digest);\n * ```\n */\nexport function digest(algorithm: CryptoDigestAlgorithm, data: BufferSource): Promise<ArrayBuffer> {\n return new Promise((resolve, reject) => {\n try {\n if (typeof ExpoCrypto.digestAsync === 'function') {\n resolve(ExpoCrypto.digestAsync(algorithm, data));\n } else {\n const output = new Uint8Array(digestLengths[algorithm]);\n ExpoCrypto.digest(algorithm, output, data);\n resolve(output.buffer);\n }\n } catch (error) {\n reject(error);\n }\n });\n}\n"]}
1
+ {"version":3,"file":"Crypto.js","sourceRoot":"","sources":["../src/Crypto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAA2C,MAAM,mBAAmB,CAAC;AAEjG,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAA+B,MAAM,gBAAgB,CAAC;AACpG,OAAO,UAAU,MAAM,cAAc,CAAC;AAItC,cAAc,gBAAgB,CAAC;AAE/B,MAAM,WAAY,SAAQ,SAAS;IACjC,IAAI,GAAG,YAAY,CAAC;IAEpB,YAAY,OAAe;QACzB,KAAK,CAAC,gBAAgB,OAAO,EAAE,CAAC,CAAC;IACnC,CAAC;CACF;AAED,cAAc;AACd;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,SAAiB;IAC9C,eAAe,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;IAC7C,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAC7C,IAAI,OAAO,EAAE,CAAC;QACZ,IAAI,CAAC,MAAM,CAAC,kBAAkB,IAAI,MAAM,CAAC,aAAa,EAAE,CAAC;YACvD,yCAAyC;YACzC,MAAM,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AO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,IAAI,CAAC;YACH,IAAI,OAAO,UAAU,CAAC,WAAW,KAAK,UAAU,EAAE,CAAC;gBACjD,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC;YACnD,CAAC;iBAAM,CAAC;gBACN,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC;gBACxD,UAAU,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;gBAC3C,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YACzB,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,KAAK,CAAC,CAAC;QAChB,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { toByteArray } from 'base64-js';\nimport { UnavailabilityError, UintBasedTypedArray, IntBasedTypedArray } from 'expo-modules-core';\n\nimport { CryptoDigestAlgorithm, CryptoEncoding, CryptoDigestOptions, Digest } from './Crypto.types';\nimport ExpoCrypto from './ExpoCrypto';\n\ndeclare const global: any;\n\nexport * from './Crypto.types';\n\nclass CryptoError extends TypeError {\n code = 'ERR_CRYPTO';\n\n constructor(message: string) {\n super(`expo-crypto: ${message}`);\n }\n}\n\n// @needsAudit\n/**\n * Generates completely random bytes using native implementations. The `byteCount` property\n * is a `number` indicating the number of bytes to generate in the form of a `Uint8Array`.\n * Falls back to `Math.random` during development to prevent issues with React Native Debugger.\n * @param byteCount - A number within the range from `0` to `1024`. Anything else will throw a `TypeError`.\n * @return An array of random bytes with the same length as the `byteCount`.\n */\nexport function getRandomBytes(byteCount: number): Uint8Array {\n assertByteCount(byteCount, 'getRandomBytes');\n const validByteCount = Math.floor(byteCount);\n if (__DEV__) {\n if (!global.nativeCallSyncHook || global.__REMOTEDEV__) {\n // remote javascript debugging is enabled\n const array = new Uint8Array(validByteCount);\n for (let i = 0; i < validByteCount; i++) {\n array[i] = Math.floor(Math.random() * 256);\n }\n return array;\n }\n }\n if (ExpoCrypto.getRandomValues) {\n const byteArray = new Uint8Array(validByteCount);\n ExpoCrypto.getRandomValues(byteArray);\n return byteArray;\n } else if (ExpoCrypto.getRandomBase64String) {\n const base64 = ExpoCrypto.getRandomBase64String(validByteCount);\n return toByteArray(base64);\n } else {\n throw new UnavailabilityError('expo-crypto', 'getRandomBytes');\n }\n}\n\n// @needsAudit\n/**\n * Generates completely random bytes using native implementations. The `byteCount` property\n * is a `number` indicating the number of bytes to generate in the form of a `Uint8Array`.\n * @param byteCount - A number within the range from `0` to `1024`. Anything else will throw a `TypeError`.\n * @return A promise that fulfills with an array of random bytes with the same length as the `byteCount`.\n */\nexport async function getRandomBytesAsync(byteCount: number): Promise<Uint8Array> {\n assertByteCount(byteCount, 'getRandomBytesAsync');\n const validByteCount = Math.floor(byteCount);\n if (ExpoCrypto.getRandomValues) {\n const byteArray = new Uint8Array(validByteCount);\n ExpoCrypto.getRandomValues(byteArray);\n return byteArray;\n } else if (ExpoCrypto.getRandomBase64StringAsync) {\n const base64 = await ExpoCrypto.getRandomBase64StringAsync(validByteCount);\n return toByteArray(base64);\n } else {\n throw new UnavailabilityError('expo-crypto', 'getRandomBytesAsync');\n }\n}\n\nfunction assertByteCount(value: any, methodName: string): void {\n if (\n typeof value !== 'number' ||\n isNaN(value) ||\n Math.floor(value) < 0 ||\n Math.floor(value) > 1024\n ) {\n throw new TypeError(\n `expo-crypto: ${methodName}(${value}) expected a valid number from range 0...1024`\n );\n }\n}\n\nfunction assertAlgorithm(algorithm: CryptoDigestAlgorithm): void {\n if (!Object.values(CryptoDigestAlgorithm).includes(algorithm)) {\n throw new CryptoError(\n `Invalid algorithm provided. Expected one of: CryptoDigestAlgorithm.${Object.keys(\n CryptoDigestAlgorithm\n ).join(', AlgCryptoDigestAlgorithmorithm.')}`\n );\n }\n}\n\nfunction assertData(data: string): void {\n if (typeof data !== 'string') {\n throw new CryptoError(`Invalid data provided. Expected a string.`);\n }\n}\n\nfunction assertEncoding(encoding: CryptoEncoding): void {\n if (!Object.values(CryptoEncoding).includes(encoding)) {\n throw new CryptoError(\n `Invalid encoding provided. Expected one of: CryptoEncoding.${Object.keys(\n CryptoEncoding\n ).join(', CryptoEncoding.')}`\n );\n }\n}\n\n// @needsAudit\n/**\n * The `digestStringAsync()` method of `Crypto` generates a digest of the supplied `data` string with the provided digest `algorithm`.\n * A digest is a short fixed-length value derived from some variable-length input. **Cryptographic digests** should exhibit _collision-resistance_,\n * meaning that it's very difficult to generate multiple inputs that have equal digest values.\n * You can specify the returned string format as one of `CryptoEncoding`. By default, the resolved value will be formatted as a `HEX` string.\n * On web, this method can only be called from a secure origin (HTTPS) otherwise, an error will be thrown.\n *\n * @param algorithm The cryptographic hash function to use to transform a block of data into a fixed-size output.\n * @param data The value that will be used to generate a digest.\n * @param options Format of the digest string. Defaults to: `CryptoDigestOptions.HEX`.\n * @return Return a Promise which fulfills with a value representing the hashed input.\n *\n * @example\n * ```ts\n * const digest = await Crypto.digestStringAsync(\n * Crypto.CryptoDigestAlgorithm.SHA512,\n * '🥓 Easy to Digest! 💙'\n * );\n * ```\n */\nexport async function digestStringAsync(\n algorithm: CryptoDigestAlgorithm,\n data: string,\n options: CryptoDigestOptions = { encoding: CryptoEncoding.HEX }\n): Promise<Digest> {\n if (!ExpoCrypto.digestStringAsync) {\n throw new UnavailabilityError('expo-crypto', 'digestStringAsync');\n }\n\n assertAlgorithm(algorithm);\n assertData(data);\n assertEncoding(options.encoding);\n\n return await ExpoCrypto.digestStringAsync(algorithm, data, options);\n}\n\n/**\n * The `getRandomValues()` method of `Crypto` fills a provided `TypedArray` with cryptographically secure random values.\n *\n * @param typedArray An integer based [`TypedArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) to fill with cryptographically secure random values. It modifies the input array in place.\n * @return The input array filled with cryptographically secure random values.\n *\n * @example\n * ```ts\n * const byteArray = new Uint8Array(16);\n * Crypto.getRandomValues(byteArray);\n * console.log('Your lucky bytes: ' + byteArray);\n * ```\n */\nexport function getRandomValues<T extends IntBasedTypedArray | UintBasedTypedArray>(\n typedArray: T\n): T {\n ExpoCrypto.getRandomValues(typedArray);\n return typedArray;\n}\n\n/**\n * The `randomUUID()` method returns a unique identifier based on the V4 UUID spec (RFC4122).\n * It uses cryptographically secure random values to generate the UUID.\n *\n * @return A string containing a newly generated UUIDv4 identifier\n * @example\n * ```ts\n * const UUID = Crypto.randomUUID();\n * console.log('Your UUID: ' + UUID);\n * ```\n */\nexport function randomUUID(): string {\n return ExpoCrypto.randomUUID();\n}\n\nconst digestLengths = {\n [CryptoDigestAlgorithm.SHA1]: 20,\n [CryptoDigestAlgorithm.SHA256]: 32,\n [CryptoDigestAlgorithm.SHA384]: 48,\n [CryptoDigestAlgorithm.SHA512]: 64,\n [CryptoDigestAlgorithm.MD2]: 16,\n [CryptoDigestAlgorithm.MD4]: 16,\n [CryptoDigestAlgorithm.MD5]: 16,\n};\n\n/**\n * The `digest()` method of `Crypto` generates a digest of the supplied `TypedArray` of bytes `data` with the provided digest `algorithm`.\n * A digest is a short fixed-length value derived from some variable-length input. **Cryptographic digests** should exhibit _collision-resistance_,\n * meaning that it's very difficult to generate multiple inputs that have equal digest values.\n * On web, this method can only be called from a secure origin (HTTPS) otherwise, an error will be thrown.\n *\n * @param algorithm The cryptographic hash function to use to transform a block of data into a fixed-size output.\n * @param data The value that will be used to generate a digest.\n * @return A Promise which fulfills with an ArrayBuffer representing the hashed input.\n * @example\n * ```ts\n * const array = new Uint8Array([1, 2, 3, 4, 5]);\n * const digest = await Crypto.digest(Crypto.CryptoDigestAlgorithm.SHA512, array);\n * console.log('Your digest: ' + digest);\n * ```\n */\nexport function digest(algorithm: CryptoDigestAlgorithm, data: BufferSource): Promise<ArrayBuffer> {\n return new Promise((resolve, reject) => {\n try {\n if (typeof ExpoCrypto.digestAsync === 'function') {\n resolve(ExpoCrypto.digestAsync(algorithm, data));\n } else {\n const output = new Uint8Array(digestLengths[algorithm]);\n ExpoCrypto.digest(algorithm, output, data);\n resolve(output.buffer);\n }\n } catch (error) {\n reject(error);\n }\n });\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoCrypto.web.d.ts","sourceRoot":"","sources":["../src/ExpoCrypto.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE3D,OAAO,EAAE,qBAAqB,EAAkB,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;;iCAM7E,qBAAqB,QAC1B,MAAM,WACH,mBAAmB,GAC3B,QAAQ,MAAM,CAAC;2BAiBK,MAAM,GAAG,UAAU;gCAIR,MAAM,GAAG,QAAQ,UAAU,CAAC;gCAIlC,UAAU;;2BAMf,mBAAmB,QAAQ,WAAW,GAAG,QAAQ,WAAW,CAAC;;AApCtF,wBAuCE"}
1
+ {"version":3,"file":"ExpoCrypto.web.d.ts","sourceRoot":"","sources":["../src/ExpoCrypto.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE3D,OAAO,EAAE,qBAAqB,EAAkB,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;;iCAM7E,qBAAqB,QAC1B,MAAM,WACH,mBAAmB,GAC3B,OAAO,CAAC,MAAM,CAAC;2BAiBK,MAAM,GAAG,UAAU;gCAIR,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;gCAIlC,UAAU;;2BAMf,mBAAmB,QAAQ,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;;AApCtF,wBAuCE"}
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoCrypto.web.js","sourceRoot":"","sources":["../src/ExpoCrypto.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAc,MAAM,mBAAmB,CAAC;AAE3D,OAAO,EAAyB,cAAc,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ACpC,OAAO,SAAS,EAAE,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;IACjD,CAAC;IACD,UAAU;QACR,OAAO,SAAS,EAAE,CAAC,UAAU,EAAE,CAAC;IAClC,CAAC;IACD,WAAW,CAAC,SAA8B,EAAE,IAAiB;QAC3D,OAAO,SAAS,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IACpD,CAAC;CACF,CAAC;AAEF,SAAS,SAAS,CAAC,MAAmB;IACpC,MAAM,SAAS,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;IAEzC,MAAM,QAAQ,GAAG,CAAC,GAAG,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QAC5C,MAAM,OAAO,GAAG,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QACnC,MAAM,aAAa,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QAC/C,OAAO,aAAa,CAAC;IACvB,CAAC,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC3B,CAAC","sourcesContent":["import { CodedError, TypedArray } from 'expo-modules-core';\n\nimport { CryptoDigestAlgorithm, CryptoEncoding, CryptoDigestOptions } from './Crypto.types';\n\nconst getCrypto = (): Crypto => window.crypto ?? (window as any).msCrypto;\n\nexport default {\n async digestStringAsync(\n algorithm: CryptoDigestAlgorithm,\n data: string,\n options: CryptoDigestOptions\n ): Promise<string> {\n if (!crypto.subtle) {\n throw new CodedError(\n 'ERR_CRYPTO_UNAVAILABLE',\n 'Access to the WebCrypto API is restricted to secure origins (localhost/https).'\n );\n }\n const encoder = new TextEncoder();\n const buffer = encoder.encode(data);\n const hashedData = await crypto.subtle.digest(algorithm, buffer);\n if (options.encoding === CryptoEncoding.HEX) {\n return hexString(hashedData);\n } else if (options.encoding === CryptoEncoding.BASE64) {\n return btoa(String.fromCharCode(...new Uint8Array(hashedData)));\n }\n throw new CodedError('ERR_CRYPTO_DIGEST', 'Invalid encoding type provided.');\n },\n getRandomBytes(length: number): Uint8Array {\n const array = new Uint8Array(length);\n return getCrypto().getRandomValues(array);\n },\n async getRandomBytesAsync(length: number): Promise<Uint8Array> {\n const array = new Uint8Array(length);\n return getCrypto().getRandomValues(array);\n },\n getRandomValues(typedArray: TypedArray) {\n return getCrypto().getRandomValues(typedArray);\n },\n randomUUID() {\n return getCrypto().randomUUID();\n },\n digestAsync(algorithm: AlgorithmIdentifier, data: ArrayBuffer): Promise<ArrayBuffer> {\n return getCrypto().subtle.digest(algorithm, data);\n },\n};\n\nfunction hexString(buffer: ArrayBuffer): string {\n const byteArray = new Uint8Array(buffer);\n\n const hexCodes = [...byteArray].map((value) => {\n const hexCode = value.toString(16);\n const paddedHexCode = hexCode.padStart(2, '0');\n return paddedHexCode;\n });\n\n return hexCodes.join('');\n}\n"]}
1
+ {"version":3,"file":"ExpoCrypto.web.js","sourceRoot":"","sources":["../src/ExpoCrypto.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAc,MAAM,mBAAmB,CAAC;AAE3D,OAAO,EAAyB,cAAc,EAAuB,MAAM,gBAAgB,CAAC;AAE5F,MAAM,SAAS,GAAG,GAAW,EAAE,CAAC,MAAM,CAAC,MAAM,IAAK,MAAc,CAAC,QAAQ,CAAC;AAE1E,eAAe;IACb,KAAK,CAAC,iBAAiB,CACrB,SAAgC,EAChC,IAAY,EACZ,OAA4B;QAE5B,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;YACnB,MAAM,IAAI,UAAU,CAClB,wBAAwB,EACxB,gFAAgF,CACjF,CAAC;QACJ,CAAC;QACD,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;QAClC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACpC,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,MAAM,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AAC,KAAK,EAAE,EAAE;QAC5C,MAAM,OAAO,GAAG,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QACnC,MAAM,aAAa,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QAC/C,OAAO,aAAa,CAAC;IACvB,CAAC,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC3B,CAAC","sourcesContent":["import { CodedError, TypedArray } from 'expo-modules-core';\n\nimport { CryptoDigestAlgorithm, CryptoEncoding, CryptoDigestOptions } from './Crypto.types';\n\nconst getCrypto = (): Crypto => window.crypto ?? (window as any).msCrypto;\n\nexport default {\n async digestStringAsync(\n algorithm: CryptoDigestAlgorithm,\n data: string,\n options: CryptoDigestOptions\n ): Promise<string> {\n if (!crypto.subtle) {\n throw new CodedError(\n 'ERR_CRYPTO_UNAVAILABLE',\n 'Access to the WebCrypto API is restricted to secure origins (localhost/https).'\n );\n }\n const encoder = new TextEncoder();\n const buffer = encoder.encode(data);\n const hashedData = await crypto.subtle.digest(algorithm, buffer);\n if (options.encoding === CryptoEncoding.HEX) {\n return hexString(hashedData);\n } else if (options.encoding === CryptoEncoding.BASE64) {\n return btoa(String.fromCharCode(...new Uint8Array(hashedData)));\n }\n throw new CodedError('ERR_CRYPTO_DIGEST', 'Invalid encoding type provided.');\n },\n getRandomBytes(length: number): Uint8Array {\n const array = new Uint8Array(length);\n return getCrypto().getRandomValues(array);\n },\n async getRandomBytesAsync(length: number): Promise<Uint8Array> {\n const array = new Uint8Array(length);\n return getCrypto().getRandomValues(array);\n },\n getRandomValues(typedArray: TypedArray) {\n return getCrypto().getRandomValues(typedArray);\n },\n randomUUID() {\n return getCrypto().randomUUID();\n },\n digestAsync(algorithm: AlgorithmIdentifier, data: ArrayBuffer): Promise<ArrayBuffer> {\n return getCrypto().subtle.digest(algorithm, data);\n },\n};\n\nfunction hexString(buffer: ArrayBuffer): string {\n const byteArray = new Uint8Array(buffer);\n\n const hexCodes = [...byteArray].map((value) => {\n const hexCode = value.toString(16);\n const paddedHexCode = hexCode.padStart(2, '0');\n return paddedHexCode;\n });\n\n return hexCodes.join('');\n}\n"]}
@@ -4,6 +4,12 @@
4
4
  "modules": ["CryptoModule"]
5
5
  },
6
6
  "android": {
7
- "modules": ["expo.modules.crypto.CryptoModule"]
7
+ "modules": ["expo.modules.crypto.CryptoModule"],
8
+ "publication": {
9
+ "groupId": "host.exp.exponent",
10
+ "artifactId": "expo.modules.crypto",
11
+ "version": "15.0.0",
12
+ "repository": "local-maven-repo"
13
+ }
8
14
  }
9
15
  }
@@ -15,7 +15,7 @@ Pod::Spec.new do |s|
15
15
  :tvos => '15.1',
16
16
  :osx => '11.0'
17
17
  }
18
- s.swift_version = '5.4'
18
+ s.swift_version = '5.9'
19
19
  s.source = { git: 'https://github.com/expo/expo.git' }
20
20
  s.static_framework = true
21
21
 
@@ -0,0 +1 @@
1
+ fbb9dee297c3061dc4d03768b2c257d77e8a8b125bc53523c3b9d63496404bd8
@@ -0,0 +1 @@
1
+ 9ee66fd92f77abd9cfefad61c67aba460278f8294792432e98d13500e525acc0622ac8c7ac3d107a0c6e3a9f9c206b4b805fdd739ebdaad0af5507af7374f337
@@ -0,0 +1 @@
1
+ ee19c3697e42acdc64354a9ff89824a5f2d3651ad449a8e8c6145f3257f26cfe
@@ -0,0 +1 @@
1
+ 28efae67bc2493dcc57ea73deca3cc1fb23bb817a820d36d01a40dfe14a6db40034316f0bcfcfe1d55b3b5e7d510cb12c1f3036d27d9cb2902476cfb9b99fa76
@@ -0,0 +1,87 @@
1
+ {
2
+ "formatVersion": "1.1",
3
+ "component": {
4
+ "group": "host.exp.exponent",
5
+ "module": "expo.modules.crypto",
6
+ "version": "15.0.0",
7
+ "attributes": {
8
+ "org.gradle.status": "release"
9
+ }
10
+ },
11
+ "createdBy": {
12
+ "gradle": {
13
+ "version": "8.14.3"
14
+ }
15
+ },
16
+ "variants": [
17
+ {
18
+ "name": "releaseVariantReleaseApiPublication",
19
+ "attributes": {
20
+ "org.gradle.category": "library",
21
+ "org.gradle.dependency.bundling": "external",
22
+ "org.gradle.libraryelements": "aar",
23
+ "org.gradle.usage": "java-api"
24
+ },
25
+ "files": [
26
+ {
27
+ "name": "expo.modules.crypto-15.0.0.aar",
28
+ "url": "expo.modules.crypto-15.0.0.aar",
29
+ "size": 32027,
30
+ "sha512": "28efae67bc2493dcc57ea73deca3cc1fb23bb817a820d36d01a40dfe14a6db40034316f0bcfcfe1d55b3b5e7d510cb12c1f3036d27d9cb2902476cfb9b99fa76",
31
+ "sha256": "ee19c3697e42acdc64354a9ff89824a5f2d3651ad449a8e8c6145f3257f26cfe",
32
+ "sha1": "34d497c55e6e1937107fe43aeda4f2ee96acf464",
33
+ "md5": "45682e5aa7c4c0ad31263216a4b3b58c"
34
+ }
35
+ ]
36
+ },
37
+ {
38
+ "name": "releaseVariantReleaseRuntimePublication",
39
+ "attributes": {
40
+ "org.gradle.category": "library",
41
+ "org.gradle.dependency.bundling": "external",
42
+ "org.gradle.libraryelements": "aar",
43
+ "org.gradle.usage": "java-runtime"
44
+ },
45
+ "dependencies": [
46
+ {
47
+ "group": "org.jetbrains.kotlin",
48
+ "module": "kotlin-stdlib-jdk7",
49
+ "version": {
50
+ "requires": "2.1.20"
51
+ }
52
+ }
53
+ ],
54
+ "files": [
55
+ {
56
+ "name": "expo.modules.crypto-15.0.0.aar",
57
+ "url": "expo.modules.crypto-15.0.0.aar",
58
+ "size": 32027,
59
+ "sha512": "28efae67bc2493dcc57ea73deca3cc1fb23bb817a820d36d01a40dfe14a6db40034316f0bcfcfe1d55b3b5e7d510cb12c1f3036d27d9cb2902476cfb9b99fa76",
60
+ "sha256": "ee19c3697e42acdc64354a9ff89824a5f2d3651ad449a8e8c6145f3257f26cfe",
61
+ "sha1": "34d497c55e6e1937107fe43aeda4f2ee96acf464",
62
+ "md5": "45682e5aa7c4c0ad31263216a4b3b58c"
63
+ }
64
+ ]
65
+ },
66
+ {
67
+ "name": "releaseVariantReleaseSourcePublication",
68
+ "attributes": {
69
+ "org.gradle.category": "documentation",
70
+ "org.gradle.dependency.bundling": "external",
71
+ "org.gradle.docstype": "sources",
72
+ "org.gradle.usage": "java-runtime"
73
+ },
74
+ "files": [
75
+ {
76
+ "name": "expo.modules.crypto-15.0.0-sources.jar",
77
+ "url": "expo.modules.crypto-15.0.0-sources.jar",
78
+ "size": 2443,
79
+ "sha512": "9ee66fd92f77abd9cfefad61c67aba460278f8294792432e98d13500e525acc0622ac8c7ac3d107a0c6e3a9f9c206b4b805fdd739ebdaad0af5507af7374f337",
80
+ "sha256": "fbb9dee297c3061dc4d03768b2c257d77e8a8b125bc53523c3b9d63496404bd8",
81
+ "sha1": "f7fc7f161cfe92554e5bd6cac8e609b3f5919d6c",
82
+ "md5": "d828acd0ab9b2a1ce162926327c4f825"
83
+ }
84
+ ]
85
+ }
86
+ ]
87
+ }
@@ -0,0 +1 @@
1
+ 29c101f04a9a2c75a0c23aa4435fbddeb40006eccb694e11fac47010a906f0f3
@@ -0,0 +1 @@
1
+ 38190d75945a79ee10e0fdd5b4e8d95c9efb0bdc43bd8eef773b513557ace93282f18a0a50fe092a57b0bea512dfb6e008adf8e249c9b0479097ae73eca59ba4
@@ -0,0 +1,35 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
3
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
4
+ <!-- This module was also published with a richer model, Gradle metadata, -->
5
+ <!-- which should be used instead. Do not delete the following line which -->
6
+ <!-- is to indicate to Gradle or any Gradle module metadata file consumer -->
7
+ <!-- that they should prefer consuming it instead. -->
8
+ <!-- do_not_remove: published-with-gradle-metadata -->
9
+ <modelVersion>4.0.0</modelVersion>
10
+ <groupId>host.exp.exponent</groupId>
11
+ <artifactId>expo.modules.crypto</artifactId>
12
+ <version>15.0.0</version>
13
+ <packaging>aar</packaging>
14
+ <name>expo.modules.crypto</name>
15
+ <url>https://github.com/expo/expo</url>
16
+ <licenses>
17
+ <license>
18
+ <name>MIT License</name>
19
+ <url>https://github.com/expo/expo/blob/main/LICENSE</url>
20
+ </license>
21
+ </licenses>
22
+ <scm>
23
+ <connection>https://github.com/expo/expo.git</connection>
24
+ <developerConnection>https://github.com/expo/expo.git</developerConnection>
25
+ <url>https://github.com/expo/expo</url>
26
+ </scm>
27
+ <dependencies>
28
+ <dependency>
29
+ <groupId>org.jetbrains.kotlin</groupId>
30
+ <artifactId>kotlin-stdlib-jdk7</artifactId>
31
+ <version>2.1.20</version>
32
+ <scope>runtime</scope>
33
+ </dependency>
34
+ </dependencies>
35
+ </project>
@@ -0,0 +1 @@
1
+ 7524b75e6bb6dc6cd9bc2955b3811ba38baf90a541ef3670f35f0b49f9678494
@@ -0,0 +1 @@
1
+ a4ea98dd01059115d307d7b2d81377c5fe3818a1bac5edd45189b09de52b7188eb9a7fc9c9e60735ab50872ce9f36b31cfb25c370befa1c705fa77bf0cb866e2
@@ -0,0 +1,13 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <metadata>
3
+ <groupId>host.exp.exponent</groupId>
4
+ <artifactId>expo.modules.crypto</artifactId>
5
+ <versioning>
6
+ <latest>15.0.0</latest>
7
+ <release>15.0.0</release>
8
+ <versions>
9
+ <version>15.0.0</version>
10
+ </versions>
11
+ <lastUpdated>20250813165925</lastUpdated>
12
+ </versioning>
13
+ </metadata>
@@ -0,0 +1 @@
1
+ 6da28a0018630be4d597755517d95a20
@@ -0,0 +1 @@
1
+ f23a3207fab34d3439f0727048b48dd5740d0261
@@ -0,0 +1 @@
1
+ e36decadb1a9a2e9df9f022cb432dd790ee4539cbdccfdf9cbe9c7d0d8d5837d
@@ -0,0 +1 @@
1
+ fa961e3a7393bc0f9d3fc5b57275e67ae9883511d08f6a0ace8311efd4c4626684581e655b2910dbdca4b839efb84c400f9daf159211795ffcc22dcc12cdbee8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-crypto",
3
- "version": "15.0.0-canary-20250404-3c3b5fd",
3
+ "version": "15.0.0",
4
4
  "description": "Provides cryptography primitives for Android, iOS and web.",
5
5
  "main": "build/Crypto.js",
6
6
  "types": "build/Crypto.d.ts",
@@ -42,9 +42,10 @@
42
42
  "base64-js": "^1.3.0"
43
43
  },
44
44
  "devDependencies": {
45
- "expo-module-scripts": "4.0.6-canary-20250404-3c3b5fd"
45
+ "expo-module-scripts": "^5.0.0"
46
46
  },
47
47
  "peerDependencies": {
48
- "expo": "53.0.0-canary-20250404-3c3b5fd"
49
- }
48
+ "expo": "*"
49
+ },
50
+ "gitHead": "cb7062e2c17d1fb09522834aaaac0e19b766df62"
50
51
  }