NodePlatformFunctions

stripe-node · payments, node-platform, uuid-generation, crypto-primitives, http-primitives, dev-tools

Node.js-specific implementation of platform utilities for the Stripe SDK, providing OS-aware methods for UUIDs, telemetry, secure comparison, and HTTP/crypto providers.

export class NodePlatformFunctions extends PlatformFunctions {
  /** @override */
  uuid4(): string {
    // available in: v14.17.x+
    if (crypto.randomUUID) {
      return crypto.randomUUID();
    }
    return super.uuid4();
  }

  /** @override */
  getPlatformInfo(): string {
    return `${process.platform} ${os.release()} ${os.arch()}`;
  }

  /** @override */
  writeStderr(msg: string): void {
    process.stderr.write(msg);
  }

  /** @override */
  emitWarning(warning: string): void {
    if (typeof process.emitWarning === 'function') {
      process.emitWarning(warning, 'Stripe');
    } else {
      super.emitWarning(warning);
    }
  }

  /** @override */
  getEnv(): Record<string, string | undefined> {
    return process.env;
  }

  /** @override */
  getRuntimeVersion(): string

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search 40K more like it.

Get a free API key