text: // Generated by BUCKLESCRIPT VERSION 2.2.0, PLEASE EDIT WITH CARE
  'use strict';
  
  var Js_exn = require("bs-platform/lib/js/js_exn.js");
  var Js_boolean = require("bs-platform/lib/js/js_boolean.js");
  var SecureRandomString = require("secure-random-string");
  
  function gen($staropt$star, $staropt$star$1, _) {
    var length = $staropt$star ? $staropt$star[0] : 32;
    var alphaNumeric = $staropt$star$1 ? $staropt$star$1[0] : /* false */0;
    return new Promise((function (resolve, reject) {
                  try {
                    SecureRandomString({
                          length: length,
                          alphanumeric: Js_boolean.to_js_boolean(alphaNumeric)
                        }, (function (err, result) {
                            if (err == null) {
                              return resolve(result);
                            } else {
                              return reject(err);
                            }
                          }));
                    return /* () */0;
                  }
                  catch (raw_err){
                    var err = Js_exn.internalToOCamlException(raw_err);
                    return reject(err);
                  }
                }));
  }
  
  function genSync($staropt$star, $staropt$star$1, _) {
    var length = $staropt$star ? $staropt$star[0] : 32;
    var alphaNumeric = $staropt$star$1 ? $staropt$star$1[0] : /* false */0;
    return SecureRandomString({
                length: length,
                alphanumeric: Js_boolean.to_js_boolean(alphaNumeric)
              });
  }
  
  exports.gen = gen;
  exports.genSync = genSync;
  /* secure-random-string Not a pure module */
  