How to use the math-random.toString function in math-random

To help you get started, we’ve selected a few math-random examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / BotFramework-WebChat / samples / 19.a.single-sign-on-for-enterprise-apps / rest-api / src / index.js View on Github external
require('dotenv').config();

const random = require('math-random');

// Setting default environment variables.
process.env = {
  AAD_OAUTH_AUTHORIZE_URL: 'https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize',
  AAD_OAUTH_ACCESS_TOKEN_URL: 'https://login.microsoftonline.com/organizations/oauth2/v2.0/token',
  AAD_OAUTH_PKCE_SALT: random.toString(36).substr(2),
  AAD_OAUTH_SCOPE: 'User.Read',
  GITHUB_OAUTH_ACCESS_TOKEN_URL: 'https://github.com/login/oauth/access_token',
  GITHUB_OAUTH_AUTHORIZE_URL: 'https://github.com/login/oauth/authorize',
  GITHUB_OAUTH_SCOPE: 'user:email',
  GITHUB_OAUTH_STATE_SALT: random.toString(36).substr(2),
  PORT: '5000',
  STATIC_FILES: 'public',
  ...process.env
};

// Checks for required environment variables.
[
  'AAD_OAUTH_CLIENT_ID',
  'AAD_OAUTH_REDIRECT_URI',
  'DIRECT_LINE_SECRET',
  'GITHUB_OAUTH_CLIENT_ID',
  'GITHUB_OAUTH_CLIENT_SECRET',
  'GITHUB_OAUTH_REDIRECT_URI'
].forEach(name => {
  if (!process.env[name]) {
    throw new Error(`Environment variable ${name} must be set.`);
github microsoft / BotFramework-WebChat / samples / 19.c.single-sign-on-for-teams-apps / web / src / index.js View on Github external
require('dotenv').config();

const random = require('math-random');

// Setting default environment variables.
process.env = {
  OAUTH_AUTHORIZE_URL: 'https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize',
  OAUTH_ACCESS_TOKEN_URL: 'https://login.microsoftonline.com/organizations/oauth2/v2.0/token',
  OAUTH_PKCE_SALT: random.toString(36).substr(2),
  OAUTH_SCOPE: 'User.Read',
  PORT: '5000',
  STATIC_FILES: 'public',
  ...process.env
};

// Checks for required environment variables.
['OAUTH_CLIENT_ID', 'OAUTH_REDIRECT_URI', 'DIRECT_LINE_SECRET'].forEach(name => {
  if (!process.env[name]) {
    throw new Error(`Environment variable ${name} must be set.`);
  }
});

const { join } = require('path');
const restify = require('restify');

math-random

math-random is an isomorphic, drop-in replacement for `Math.random` that uses cryptographically secure random number generation, where available

CC0-1.0
Latest version published 4 years ago

Package Health Score

65 / 100
Full package analysis