Language: TypeScript
Label: vulnerable
CWE: CWE-331 \u2014 Insufficient Entropy
The product uses an algorithm or scheme that produces insufficient entropy, leaving patterns or clusters of values that are more likely to occur than others.

Code:
  constructor(setup) {
    // extract config.
    const { listenToBrowserNetworkEvents = true } = setup;

    setup.sdkFamily = 'Web';
    setup.networking = new Networking({
      del,
      get,
      post,
      patch,
      sendBeacon,
      getfile,
      postfile,
    });
    setup.cbor = new Cbor((arrayBuffer) => stringifyBufferKeys(CborReader.decode(arrayBuffer)), decode);

    setup.PubNubFile = PubNubFile;
    setup.cryptography = new WebCryptography();

    super(setup);

    if (listenToBrowserNetworkEvents) {
      // mount network events.
      window.addEventListener('offline', () => {
        this.networkDownDetected();
      });

      window.addEventListener('online', () => {
        this.networkUpDetected();
      });
    }
  }