@paladen/auth
Advanced tools
Comparing version 0.0.83 to 0.0.84
@@ -5,23 +5,2 @@ export * from "./AuthContext"; | ||
isAuthenticated?: boolean; | ||
claims?: TokenClaims; | ||
}; | ||
export declare type Tokens = { | ||
access: string; | ||
refresh: string; | ||
}; | ||
export declare type TokenClaimsUser = { | ||
id: string; | ||
fullName: string; | ||
imageUrl: string; | ||
}; | ||
export declare type TokenClaims = { | ||
user: TokenClaimsUser; | ||
iat?: string; | ||
exp?: string; | ||
}; | ||
export declare const buildSessionCookieString: (name: string, value: string, expiryDate: string) => string; | ||
export declare const createSessionCookie: (tokens: Tokens, userId: string) => string; | ||
export declare const deleteSessionCookie: () => string; | ||
export declare const encodeCookieString: (str: string) => string; | ||
export declare const decodeCookieString: (str: string) => string; | ||
export declare const combineCookieStrings: (accessToken: string, refreshToken: string, userId: string) => string; |
@@ -7,3 +7,2 @@ 'use strict'; | ||
var config = require('@paladen/config'); | ||
var React = require('react'); | ||
@@ -242,38 +241,2 @@ var React__default = _interopDefault(React); | ||
var buildSessionCookieString = function buildSessionCookieString(name, value, expiryDate) { | ||
return ["".concat(name, "=").concat(value), "path=/", "SameSite=Lax", "expires=".concat(expiryDate), "HttpOnly", process.env.NODE_ENV === "production" ? "Secure;" : null].join(";"); | ||
}; | ||
var createSessionCookie = function createSessionCookie(tokens, userId) { | ||
var _getGlobals = config.getGlobals(), | ||
SESSION_COOKIE_EXPIRY_MINS = _getGlobals.SESSION_COOKIE_EXPIRY_MINS, | ||
SESSION_COOKIE_NAME = _getGlobals.SESSION_COOKIE_NAME; | ||
var dateFuture = Date.now() + 60000 * SESSION_COOKIE_EXPIRY_MINS; | ||
var expiryDate = new Date(dateFuture).toUTCString(); | ||
var combinedCookieString = combineCookieStrings(tokens.access, tokens.refresh, userId); | ||
var encodedCookieString = encodeCookieString(combinedCookieString); | ||
return buildSessionCookieString(SESSION_COOKIE_NAME, encodedCookieString, expiryDate); | ||
}; | ||
var deleteSessionCookie = function deleteSessionCookie() { | ||
var _getGlobals2 = config.getGlobals(), | ||
SESSION_COOKIE_NAME = _getGlobals2.SESSION_COOKIE_NAME; | ||
var expiryDate = new Date(0).toUTCString(); | ||
return buildSessionCookieString(SESSION_COOKIE_NAME, "", expiryDate); | ||
}; | ||
var encodeCookieString = function encodeCookieString(str) { | ||
return Buffer.from(str, "binary").toString("base64"); | ||
}; | ||
var decodeCookieString = function decodeCookieString(str) { | ||
return Buffer.from(str, "base64").toString("binary"); | ||
}; | ||
var combineCookieStrings = function combineCookieStrings(accessToken, refreshToken, userId) { | ||
var _getGlobals3 = config.getGlobals(), | ||
SESSION_COOKIE_ACCESS_TOKEN_KEY = _getGlobals3.SESSION_COOKIE_ACCESS_TOKEN_KEY, | ||
SESSION_COOKIE_REFRESH_TOKEN_KEY = _getGlobals3.SESSION_COOKIE_REFRESH_TOKEN_KEY, | ||
SESSION_COOKIE_USER_ID_KEY = _getGlobals3.SESSION_COOKIE_USER_ID_KEY; | ||
return "".concat(SESSION_COOKIE_ACCESS_TOKEN_KEY, "=").concat(accessToken, ";") + "".concat(SESSION_COOKIE_REFRESH_TOKEN_KEY, "=").concat(refreshToken, ";") + "".concat(SESSION_COOKIE_USER_ID_KEY, "=").concat(userId, ";"); | ||
}; | ||
exports.AlreadyAuthenticatedError = AlreadyAuthenticatedError; | ||
@@ -286,7 +249,1 @@ exports.AuthContext = AuthContext; | ||
exports.UserAlreadyExistsError = UserAlreadyExistsError; | ||
exports.buildSessionCookieString = buildSessionCookieString; | ||
exports.combineCookieStrings = combineCookieStrings; | ||
exports.createSessionCookie = createSessionCookie; | ||
exports.decodeCookieString = decodeCookieString; | ||
exports.deleteSessionCookie = deleteSessionCookie; | ||
exports.encodeCookieString = encodeCookieString; |
{ | ||
"name": "@paladen/auth", | ||
"version": "0.0.83", | ||
"version": "0.0.84", | ||
"repository": "https://github.com/samstr/paladen", | ||
@@ -18,4 +18,4 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@paladen/config": "^0.0.83", | ||
"@paladen/errors": "^0.0.83", | ||
"@paladen/config": "^0.0.84", | ||
"@paladen/errors": "^0.0.84", | ||
"react": "^16.13.0", | ||
@@ -34,3 +34,3 @@ "react-dom": "^16.13.0" | ||
}, | ||
"gitHead": "3eeaa68d6fc20af7b31f8735326aad66e831404f" | ||
"gitHead": "95279e6576de89757b6d1b3001d81ed528fd13d7" | ||
} |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
1
9563
228
+ Added@paladen/config@0.0.84(transitive)
+ Added@paladen/errors@0.0.84(transitive)
- Removed@paladen/config@0.0.83(transitive)
- Removed@paladen/errors@0.0.83(transitive)
Updated@paladen/config@^0.0.84
Updated@paladen/errors@^0.0.84