expo-crypto 14.1.1-canary-20250408-7f0ab53 → 14.1.1

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 (40) hide show
  1. package/CHANGELOG.md +4 -0
  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 +1 -1
  7. package/local-maven-repo/host/exp/exponent/expo.modules.crypto/{14.1.1-canary-20250408-7f0ab53/expo.modules.crypto-14.1.1-canary-20250408-7f0ab53.module → 14.1.1/expo.modules.crypto-14.1.1.module} +7 -7
  8. package/local-maven-repo/host/exp/exponent/expo.modules.crypto/14.1.1/expo.modules.crypto-14.1.1.module.md5 +1 -0
  9. package/local-maven-repo/host/exp/exponent/expo.modules.crypto/14.1.1/expo.modules.crypto-14.1.1.module.sha1 +1 -0
  10. package/local-maven-repo/host/exp/exponent/expo.modules.crypto/14.1.1/expo.modules.crypto-14.1.1.module.sha256 +1 -0
  11. package/local-maven-repo/host/exp/exponent/expo.modules.crypto/14.1.1/expo.modules.crypto-14.1.1.module.sha512 +1 -0
  12. package/local-maven-repo/host/exp/exponent/expo.modules.crypto/{14.1.1-canary-20250408-7f0ab53/expo.modules.crypto-14.1.1-canary-20250408-7f0ab53.pom → 14.1.1/expo.modules.crypto-14.1.1.pom} +1 -1
  13. package/local-maven-repo/host/exp/exponent/expo.modules.crypto/14.1.1/expo.modules.crypto-14.1.1.pom.md5 +1 -0
  14. package/local-maven-repo/host/exp/exponent/expo.modules.crypto/14.1.1/expo.modules.crypto-14.1.1.pom.sha1 +1 -0
  15. package/local-maven-repo/host/exp/exponent/expo.modules.crypto/14.1.1/expo.modules.crypto-14.1.1.pom.sha256 +1 -0
  16. package/local-maven-repo/host/exp/exponent/expo.modules.crypto/14.1.1/expo.modules.crypto-14.1.1.pom.sha512 +1 -0
  17. package/local-maven-repo/host/exp/exponent/expo.modules.crypto/maven-metadata.xml +4 -4
  18. package/local-maven-repo/host/exp/exponent/expo.modules.crypto/maven-metadata.xml.md5 +1 -1
  19. package/local-maven-repo/host/exp/exponent/expo.modules.crypto/maven-metadata.xml.sha1 +1 -1
  20. package/local-maven-repo/host/exp/exponent/expo.modules.crypto/maven-metadata.xml.sha256 +1 -1
  21. package/local-maven-repo/host/exp/exponent/expo.modules.crypto/maven-metadata.xml.sha512 +1 -1
  22. package/package.json +5 -4
  23. package/local-maven-repo/host/exp/exponent/expo.modules.crypto/14.1.1-canary-20250408-7f0ab53/expo.modules.crypto-14.1.1-canary-20250408-7f0ab53.module.md5 +0 -1
  24. package/local-maven-repo/host/exp/exponent/expo.modules.crypto/14.1.1-canary-20250408-7f0ab53/expo.modules.crypto-14.1.1-canary-20250408-7f0ab53.module.sha1 +0 -1
  25. package/local-maven-repo/host/exp/exponent/expo.modules.crypto/14.1.1-canary-20250408-7f0ab53/expo.modules.crypto-14.1.1-canary-20250408-7f0ab53.module.sha256 +0 -1
  26. package/local-maven-repo/host/exp/exponent/expo.modules.crypto/14.1.1-canary-20250408-7f0ab53/expo.modules.crypto-14.1.1-canary-20250408-7f0ab53.module.sha512 +0 -1
  27. package/local-maven-repo/host/exp/exponent/expo.modules.crypto/14.1.1-canary-20250408-7f0ab53/expo.modules.crypto-14.1.1-canary-20250408-7f0ab53.pom.md5 +0 -1
  28. package/local-maven-repo/host/exp/exponent/expo.modules.crypto/14.1.1-canary-20250408-7f0ab53/expo.modules.crypto-14.1.1-canary-20250408-7f0ab53.pom.sha1 +0 -1
  29. package/local-maven-repo/host/exp/exponent/expo.modules.crypto/14.1.1-canary-20250408-7f0ab53/expo.modules.crypto-14.1.1-canary-20250408-7f0ab53.pom.sha256 +0 -1
  30. package/local-maven-repo/host/exp/exponent/expo.modules.crypto/14.1.1-canary-20250408-7f0ab53/expo.modules.crypto-14.1.1-canary-20250408-7f0ab53.pom.sha512 +0 -1
  31. /package/local-maven-repo/host/exp/exponent/expo.modules.crypto/{14.1.1-canary-20250408-7f0ab53/expo.modules.crypto-14.1.1-canary-20250408-7f0ab53-sources.jar → 14.1.1/expo.modules.crypto-14.1.1-sources.jar} +0 -0
  32. /package/local-maven-repo/host/exp/exponent/expo.modules.crypto/{14.1.1-canary-20250408-7f0ab53/expo.modules.crypto-14.1.1-canary-20250408-7f0ab53-sources.jar.md5 → 14.1.1/expo.modules.crypto-14.1.1-sources.jar.md5} +0 -0
  33. /package/local-maven-repo/host/exp/exponent/expo.modules.crypto/{14.1.1-canary-20250408-7f0ab53/expo.modules.crypto-14.1.1-canary-20250408-7f0ab53-sources.jar.sha1 → 14.1.1/expo.modules.crypto-14.1.1-sources.jar.sha1} +0 -0
  34. /package/local-maven-repo/host/exp/exponent/expo.modules.crypto/{14.1.1-canary-20250408-7f0ab53/expo.modules.crypto-14.1.1-canary-20250408-7f0ab53-sources.jar.sha256 → 14.1.1/expo.modules.crypto-14.1.1-sources.jar.sha256} +0 -0
  35. /package/local-maven-repo/host/exp/exponent/expo.modules.crypto/{14.1.1-canary-20250408-7f0ab53/expo.modules.crypto-14.1.1-canary-20250408-7f0ab53-sources.jar.sha512 → 14.1.1/expo.modules.crypto-14.1.1-sources.jar.sha512} +0 -0
  36. /package/local-maven-repo/host/exp/exponent/expo.modules.crypto/{14.1.1-canary-20250408-7f0ab53/expo.modules.crypto-14.1.1-canary-20250408-7f0ab53.aar → 14.1.1/expo.modules.crypto-14.1.1.aar} +0 -0
  37. /package/local-maven-repo/host/exp/exponent/expo.modules.crypto/{14.1.1-canary-20250408-7f0ab53/expo.modules.crypto-14.1.1-canary-20250408-7f0ab53.aar.md5 → 14.1.1/expo.modules.crypto-14.1.1.aar.md5} +0 -0
  38. /package/local-maven-repo/host/exp/exponent/expo.modules.crypto/{14.1.1-canary-20250408-7f0ab53/expo.modules.crypto-14.1.1-canary-20250408-7f0ab53.aar.sha1 → 14.1.1/expo.modules.crypto-14.1.1.aar.sha1} +0 -0
  39. /package/local-maven-repo/host/exp/exponent/expo.modules.crypto/{14.1.1-canary-20250408-7f0ab53/expo.modules.crypto-14.1.1-canary-20250408-7f0ab53.aar.sha256 → 14.1.1/expo.modules.crypto-14.1.1.aar.sha256} +0 -0
  40. /package/local-maven-repo/host/exp/exponent/expo.modules.crypto/{14.1.1-canary-20250408-7f0ab53/expo.modules.crypto-14.1.1-canary-20250408-7f0ab53.aar.sha512 → 14.1.1/expo.modules.crypto-14.1.1.aar.sha512} +0 -0
package/CHANGELOG.md CHANGED
@@ -10,6 +10,10 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 14.1.1 — 2025-04-09
14
+
15
+ _This version does not introduce any user-facing changes._
16
+
13
17
  ## 14.1.0 — 2025-04-04
14
18
 
15
19
  ### 🛠 Breaking changes
@@ -4,13 +4,13 @@ plugins {
4
4
  }
5
5
 
6
6
  group = 'host.exp.exponent'
7
- version = '14.1.1-canary-20250408-7f0ab53'
7
+ version = '14.1.1'
8
8
 
9
9
  android {
10
10
  namespace "expo.modules.crypto"
11
11
  defaultConfig {
12
12
  versionCode 25
13
- versionName "14.1.1-canary-20250408-7f0ab53"
13
+ versionName "14.1.1"
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,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;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AC,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,KAAK,GAAG,IAAI,UAAU,CAAC,cAAc,CAAC,CAAC;YAC7C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,cAAc,EAAE,CAAC,EAAE,EAAE,CAAC;gBACxC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAA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AC;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,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,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AAM,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,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QACjE,IAAI,OAAO,CAAC,QAAQ,KAAK,cAAc,CAAC,GAAG,EAAE,CAAC;YAC5C,OAAO,SAAS,CAAC,UAAU,CAAC,CAAC;QAC/B,CAAC;aAAM,IAAI,OAAO,CAAC,QAAQ,KAAK,cAAc,CAAC,M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EH,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"]}
@@ -8,7 +8,7 @@
8
8
  "publication": {
9
9
  "groupId": "host.exp.exponent",
10
10
  "artifactId": "expo.modules.crypto",
11
- "version": "14.1.1-canary-20250408-7f0ab53",
11
+ "version": "14.1.1",
12
12
  "repository": "local-maven-repo"
13
13
  }
14
14
  }
@@ -3,7 +3,7 @@
3
3
  "component": {
4
4
  "group": "host.exp.exponent",
5
5
  "module": "expo.modules.crypto",
6
- "version": "14.1.1-canary-20250408-7f0ab53",
6
+ "version": "14.1.1",
7
7
  "attributes": {
8
8
  "org.gradle.status": "release"
9
9
  }
@@ -24,8 +24,8 @@
24
24
  },
25
25
  "files": [
26
26
  {
27
- "name": "expo.modules.crypto-14.1.1-canary-20250408-7f0ab53.aar",
28
- "url": "expo.modules.crypto-14.1.1-canary-20250408-7f0ab53.aar",
27
+ "name": "expo.modules.crypto-14.1.1.aar",
28
+ "url": "expo.modules.crypto-14.1.1.aar",
29
29
  "size": 31995,
30
30
  "sha512": "b27dcdb26b1ee5a219442736faacde147da38b03ea1fcb1e40fc0276426a7d77923f47e685fea2d1d30ce86b38f2f3512d61aea59895459556192ca4e559181d",
31
31
  "sha256": "f9efd4ddeb4aa85e9b5f286568e0eaf67a6c860a2f358ed16b1139a6dee212f8",
@@ -53,8 +53,8 @@
53
53
  ],
54
54
  "files": [
55
55
  {
56
- "name": "expo.modules.crypto-14.1.1-canary-20250408-7f0ab53.aar",
57
- "url": "expo.modules.crypto-14.1.1-canary-20250408-7f0ab53.aar",
56
+ "name": "expo.modules.crypto-14.1.1.aar",
57
+ "url": "expo.modules.crypto-14.1.1.aar",
58
58
  "size": 31995,
59
59
  "sha512": "b27dcdb26b1ee5a219442736faacde147da38b03ea1fcb1e40fc0276426a7d77923f47e685fea2d1d30ce86b38f2f3512d61aea59895459556192ca4e559181d",
60
60
  "sha256": "f9efd4ddeb4aa85e9b5f286568e0eaf67a6c860a2f358ed16b1139a6dee212f8",
@@ -73,8 +73,8 @@
73
73
  },
74
74
  "files": [
75
75
  {
76
- "name": "expo.modules.crypto-14.1.1-canary-20250408-7f0ab53-sources.jar",
77
- "url": "expo.modules.crypto-14.1.1-canary-20250408-7f0ab53-sources.jar",
76
+ "name": "expo.modules.crypto-14.1.1-sources.jar",
77
+ "url": "expo.modules.crypto-14.1.1-sources.jar",
78
78
  "size": 2443,
79
79
  "sha512": "9ee66fd92f77abd9cfefad61c67aba460278f8294792432e98d13500e525acc0622ac8c7ac3d107a0c6e3a9f9c206b4b805fdd739ebdaad0af5507af7374f337",
80
80
  "sha256": "fbb9dee297c3061dc4d03768b2c257d77e8a8b125bc53523c3b9d63496404bd8",
@@ -0,0 +1 @@
1
+ 91c5f9dd0f1db4d495b00071e8ded91ca606ad90deea41a9d801c5ed5ed205c3
@@ -0,0 +1 @@
1
+ bc4a677382422dd0a551a04acc2efa13193777697f4ab6e34f376fafd47c5786aa718752cf2691800787d69a8cf960ed4a85fafa849a643791db276f2033073d
@@ -9,7 +9,7 @@
9
9
  <modelVersion>4.0.0</modelVersion>
10
10
  <groupId>host.exp.exponent</groupId>
11
11
  <artifactId>expo.modules.crypto</artifactId>
12
- <version>14.1.1-canary-20250408-7f0ab53</version>
12
+ <version>14.1.1</version>
13
13
  <packaging>aar</packaging>
14
14
  <name>expo.modules.crypto</name>
15
15
  <url>https://github.com/expo/expo</url>
@@ -0,0 +1 @@
1
+ 9db690a57c4d7078e6736505cf2841653b9656148a052b82785571a49ae9c24a
@@ -0,0 +1 @@
1
+ 7e4204ff36d9bada546f04d777e923f3e5827cf1d01b768cefa047e4adc657ea9764c661a3ab42c09145a7c02453fedda2c7e3ae36b77187f80dc6abac09851b
@@ -3,11 +3,11 @@
3
3
  <groupId>host.exp.exponent</groupId>
4
4
  <artifactId>expo.modules.crypto</artifactId>
5
5
  <versioning>
6
- <latest>14.1.1-canary-20250408-7f0ab53</latest>
7
- <release>14.1.1-canary-20250408-7f0ab53</release>
6
+ <latest>14.1.1</latest>
7
+ <release>14.1.1</release>
8
8
  <versions>
9
- <version>14.1.1-canary-20250408-7f0ab53</version>
9
+ <version>14.1.1</version>
10
10
  </versions>
11
- <lastUpdated>20250408205738</lastUpdated>
11
+ <lastUpdated>20250409202814</lastUpdated>
12
12
  </versioning>
13
13
  </metadata>
@@ -1 +1 @@
1
- 50984aba0e0e63f281b2233936c0a83f
1
+ bd303bf83489f857c7395a92d1b804eb
@@ -1 +1 @@
1
- 95a3f731cdd7941c4dcc979199670a4bc45d1ec1
1
+ 899e78894a4722f397d8ac85d5c88abced8cbebf
@@ -1 +1 @@
1
- 5680e20447fe07bd259fe41202cfae1e3b2950146534781946df211675eb912c
1
+ 55956466a7015077faa2173e5c9a4fbaef0ff6c4e1b14f1df1500f103e968c33
@@ -1 +1 @@
1
- b8de9687a98b3fd35a656e28f247af9812524c1f19695d168c634141d79f49baa2c5b977b6088ecb6ef8744b08fcf0058f8c0ec53209acad65a865a382cd49ff
1
+ 3d3ad6ba8bc7727d9f12239b6a449fae32f1220228d2bd96e7c1d4f867f4f83ba20d9c03a490f8c690f7f9400958177e3678742322a8dbfd64aeed21930132c7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-crypto",
3
- "version": "14.1.1-canary-20250408-7f0ab53",
3
+ "version": "14.1.1",
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.1.1-canary-20250408-7f0ab53"
45
+ "expo-module-scripts": "^4.1.1"
46
46
  },
47
47
  "peerDependencies": {
48
- "expo": "53.0.0-canary-20250408-7f0ab53"
49
- }
48
+ "expo": "*"
49
+ },
50
+ "gitHead": "1914bb35d23af23078da37e70988261844436505"
50
51
  }
@@ -1 +0,0 @@
1
- 410cd91389a9ec89d38b64b5428d99c086fea1e71ffd88b56ad81af9615edebbb133073d94d6cd1c1d6af1bfbb9a4e5dc7144911ec7bd9702e1726d0332291af
@@ -1 +0,0 @@
1
- 036b6a4d57ab9309d3c853a23fcf4dff2c98759a552f5b9359c6b30773fae83f69bce6eda600b6fcfa37a1414fbef057f24fb10945be98f47f3b7bda47362978