export async function cryptoModule()

in src/node-crypto.ts [18:32]


export async function cryptoModule(): Promise<Crypto> {
  // check for availability of crypto module and throws an error otherwise
  // ref: https://nodejs.org/dist/latest-v18.x/docs/api/crypto.html#determining-if-crypto-support-is-unavailable
  let crypto;
  try {
    crypto = await import('node:crypto');
    /* c8 ignore next 6 */
  } catch (err) {
    throw new CloudSQLConnectorError({
      message: 'Support to node crypto module is required',
      code: 'ENOCRYPTOMODULE',
    });
  }
  return crypto;
}