UNPKG

@simulacrum/auth0-simulator

Version:

Run local instance of Auth0 API for local development and integration testing

23 lines (21 loc) 622 B
import { epochTime } from "./date.mjs"; import { assert } from "assert-ts"; import { encode } from "base64-url"; //#region src/auth/refresh-token.ts function issueRefreshToken(scope, grantType) { return grantType === "refresh_token" || scope.includes("offline_access"); } function createRefreshToken({ exp, rotations = 0, scope, user, nonce }) { assert(!!user.id, `no identifier for user`); return encode(JSON.stringify({ exp, iat: epochTime(), rotations, scope, user: { id: user.id }, nonce })); } //#endregion export { createRefreshToken, issueRefreshToken }; //# sourceMappingURL=refresh-token.mjs.map