New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@iad-os/react-ghost-auth

Package Overview
Dependencies
Maintainers
3
Versions
110
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@iad-os/react-ghost-auth - npm Package Compare versions

Comparing version 0.5.7 to 0.6.0

57

build/index.es.js
import { jsx, jsxs } from 'react/jsx-runtime';
import React, { useState, useMemo, useRef, useEffect, useCallback, useContext } from 'react';
import { randomFillSync } from 'crypto';

@@ -803,2 +804,27 @@ /******************************************************************************

const urlAlphabet =
'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict';
const POOL_SIZE_MULTIPLIER = 128;
let pool, poolOffset;
let fillPool = bytes => {
if (!pool || pool.length < bytes) {
pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER);
randomFillSync(pool);
poolOffset = 0;
} else if (poolOffset + bytes > pool.length) {
randomFillSync(pool);
poolOffset = 0;
}
poolOffset += bytes;
};
let nanoid = (size = 21) => {
fillPool((size -= 0));
let id = '';
for (let i = poolOffset - size; i < poolOffset; i++) {
id += urlAlphabet[pool[i] & 63];
}
return id
};
const AutenticationContext = React.createContext({});

@@ -914,7 +940,24 @@ function AuthenticationProvider(props) {

const { authorization_endpoint, client_id, redirect_uri, requested_scopes, access_type, } = _provider;
const new_code_verifier = generateRandomString();
const new_state = generateRandomString();
setState(new_state);
setCodeVerifier(new_code_verifier);
pkceChallengeFromVerifier(new_code_verifier).then(code_challenge => {
if (_provider.pkce) {
const new_code_verifier = generateRandomString();
const new_state = generateRandomString();
setState(new_state);
setCodeVerifier(new_code_verifier);
pkceChallengeFromVerifier(new_code_verifier).then(code_challenge => {
window.location.replace(openIdInitialFlowUrl({
authorization_endpoint,
client_id,
redirect_uri: redirect_uri !== null && redirect_uri !== void 0 ? redirect_uri : window.location.href,
requested_scopes,
code_challenge,
state: new_state,
code_challenge_method: 'S256',
access_type,
}));
});
}
else {
const new_state = nanoid(64);
setState(new_state);
setCodeVerifier('NO_PKCE');
window.location.replace(openIdInitialFlowUrl({

@@ -925,8 +968,6 @@ authorization_endpoint,

requested_scopes,
code_challenge,
state: new_state,
code_challenge_method: 'S256',
access_type,
}));
});
}
}

@@ -933,0 +974,0 @@ else {

@@ -7,2 +7,3 @@ 'use strict';

var React = require('react');
var crypto = require('crypto');

@@ -812,2 +813,27 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

const urlAlphabet =
'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict';
const POOL_SIZE_MULTIPLIER = 128;
let pool, poolOffset;
let fillPool = bytes => {
if (!pool || pool.length < bytes) {
pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER);
crypto.randomFillSync(pool);
poolOffset = 0;
} else if (poolOffset + bytes > pool.length) {
crypto.randomFillSync(pool);
poolOffset = 0;
}
poolOffset += bytes;
};
let nanoid = (size = 21) => {
fillPool((size -= 0));
let id = '';
for (let i = poolOffset - size; i < poolOffset; i++) {
id += urlAlphabet[pool[i] & 63];
}
return id
};
const AutenticationContext = React__default["default"].createContext({});

@@ -923,7 +949,24 @@ function AuthenticationProvider(props) {

const { authorization_endpoint, client_id, redirect_uri, requested_scopes, access_type, } = _provider;
const new_code_verifier = generateRandomString();
const new_state = generateRandomString();
setState(new_state);
setCodeVerifier(new_code_verifier);
pkceChallengeFromVerifier(new_code_verifier).then(code_challenge => {
if (_provider.pkce) {
const new_code_verifier = generateRandomString();
const new_state = generateRandomString();
setState(new_state);
setCodeVerifier(new_code_verifier);
pkceChallengeFromVerifier(new_code_verifier).then(code_challenge => {
window.location.replace(openIdInitialFlowUrl({
authorization_endpoint,
client_id,
redirect_uri: redirect_uri !== null && redirect_uri !== void 0 ? redirect_uri : window.location.href,
requested_scopes,
code_challenge,
state: new_state,
code_challenge_method: 'S256',
access_type,
}));
});
}
else {
const new_state = nanoid(64);
setState(new_state);
setCodeVerifier('NO_PKCE');
window.location.replace(openIdInitialFlowUrl({

@@ -934,8 +977,6 @@ authorization_endpoint,

requested_scopes,
code_challenge,
state: new_state,
code_challenge_method: 'S256',
access_type,
}));
});
}
}

@@ -942,0 +983,0 @@ else {

5

build/models.d.ts

@@ -6,5 +6,5 @@ export declare type InitFlowUrlType = {

requested_scopes: string;
code_challenge: string;
code_challenge?: string;
state: string;
code_challenge_method: 'S256';
code_challenge_method?: 'S256';
access_type?: string;

@@ -41,3 +41,4 @@ };

client_secret?: string;
pkce?: boolean;
};
export declare type EStatus = 'INIT' | 'LOGIN' | 'LOGGING' | 'LOGGED';
{
"name": "@iad-os/react-ghost-auth",
"version": "0.5.7",
"version": "0.6.0",
"maintainers": [

@@ -28,2 +28,3 @@ {

"axios": "^0.27.2",
"nanoid": "^4.0.0",
"query-string": "^7.1.1"

@@ -30,0 +31,0 @@ },

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc