whodis-react
Version:
React hooks and components for secure, best practices authentication in seconds
30 lines • 1.57 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getAuthableTokenClaims = void 0;
const simple_jwt_auth_1 = require("simple-jwt-auth");
const getAuthableToken_1 = require("../token/getAuthableToken");
/**
* internal use only
*
* use case: you need to know the claims of the token
*/
const getAuthableTokenClaims = ({ storage, }) => __awaiter(void 0, void 0, void 0, function* () {
// grab the token
const token = yield (0, getAuthableToken_1.getAuthableToken)({ storage });
if (!token)
return null;
// if we reached here, then we're optimistic that the token is either not expired or will be refreshed; return the data
const claims = (0, simple_jwt_auth_1.getUnauthedClaims)({ token });
return claims;
});
exports.getAuthableTokenClaims = getAuthableTokenClaims;
//# sourceMappingURL=getAuthableTokenClaims.js.map