MCPcopy Create free account
hub / github.com/deepnote/vscode-deepnote / initCryptoProvider

Function initCryptoProvider

src/platform/common/crypto.ts:21–38  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

19
20// Async initialization for Node.js crypto
21async function initCryptoProvider(): Promise<Crypto> {
22 // Web
23 if (typeof window === 'object') {
24 // eslint-disable-next-line @typescript-eslint/no-explicit-any
25 return (window as any).crypto;
26 }
27 // Web worker
28 else if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) {
29 // eslint-disable-next-line @typescript-eslint/no-explicit-any
30 return self.crypto;
31 }
32 // Node
33 else {
34 // eslint-disable-next-line local-rules/node-imports
35 const nodeCrypto = await import('node:crypto');
36 return nodeCrypto.webcrypto as Crypto;
37 }
38}
39
40// Initialize crypto provider (will be set on first use)
41let cryptoProviderPromise: Promise<Crypto> | undefined;

Callers 1

computeHashInternalFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected