我为JOSE写了一个小PoC,它在世博网站上工作,但在iOS上失败了,因为它正在寻找crypto,并且显示无法找到变量:crypto
发布于 2022-10-12 19:15:10
还需要安装一些其他软件包。
npx expo install expo-random text-encoding buffer expo-standard-web-crypto然后添加将初始化所需的多填充的文件。
// initializePolyfills.ts
global.Buffer = require("buffer").Buffer;
import { polyfillWebCrypto } from "expo-standard-web-crypto";
polyfillWebCrypto();
const TextEncodingPolyfill = require("text-encoding");
Object.assign(global, {
TextEncoder: TextEncodingPolyfill.TextEncoder,
TextDecoder: TextEncodingPolyfill.TextDecoder,
});在app.tsx中,导入文件作为第一行
import './importPolyfills'
...https://stackoverflow.com/questions/74046745
复制相似问题