Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/expo-crypto/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

### 🐛 Bug fixes

- Access `crypto` on `globalThis` rather than just `window.crypto` ([#43405](https://github.com/expo/expo/pull/43405) by [@bradleyayers](https://github.com/bradleyayers))

### 💡 Others

## 55.0.8 — 2026-02-25
Expand Down
2 changes: 1 addition & 1 deletion packages/expo-crypto/build/ExpoCrypto.web.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 12 additions & 1 deletion packages/expo-crypto/build/ExpoCrypto.web.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/expo-crypto/build/ExpoCrypto.web.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion packages/expo-crypto/src/ExpoCrypto.web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,23 @@ import { CodedError, TypedArray } from 'expo-modules-core';

import { CryptoDigestAlgorithm, CryptoEncoding, CryptoDigestOptions } from './Crypto.types';

const getCrypto = (): Crypto => window.crypto ?? (window as any).msCrypto;
const getCrypto = (): Crypto => {
if (typeof globalThis.crypto !== 'undefined') {
return globalThis.crypto;
} else if (typeof window !== 'undefined') {
return window.crypto ?? (window as any).msCrypto;
} else {
return crypto;
}
};

export default {
async digestStringAsync(
algorithm: CryptoDigestAlgorithm,
data: string,
options: CryptoDigestOptions
): Promise<string> {
const crypto = getCrypto();
if (!crypto.subtle) {
throw new CodedError(
'ERR_CRYPTO_UNAVAILABLE',
Expand Down
Loading