mirror of
https://github.com/wiseguru/ReWrite-Voice-Notes.git
synced 2026-07-22 07:49:19 +00:00
10 lines
509 B
TypeScript
10 lines
509 B
TypeScript
|
|
// Obsidian's real runtime (Electron/browser) always has a global `crypto` (Web Crypto), which
|
||
|
|
// secrets.ts relies on without importing it. Node exposes it as a global automatically only on
|
||
|
|
// newer runtimes; polyfill it from node:crypto so the test environment matches regardless of
|
||
|
|
// which Node version is running the suite.
|
||
|
|
import { webcrypto } from 'node:crypto';
|
||
|
|
|
||
|
|
if (typeof globalThis.crypto === 'undefined') {
|
||
|
|
Object.defineProperty(globalThis, 'crypto', { value: webcrypto, configurable: true });
|
||
|
|
}
|