- Fixed token
It also accepts a second and a third augment at acceptCookie
and acceptQueryString
that controls whether
token included in cookie and then appended as query string is accepted as backup.
import authenticator from "koa-utilities/dist/authenticator/fixed";
authenticator(<FIXED_TOKEN>, acceptCookie: boolean, acceptQueryString: boolean);
- Local Paseto token
It also accepts a second and a third augment at acceptCookie
and acceptQueryString
that controls whether
token included in cookie and then appended as query string is accepted as backup.
import authenticator from "koa-utilities/dist/authenticator/local";
authenticator(<PASETO_TOKEN>, acceptCookie: boolean, acceptQueryString: boolean);
- Remote Paseto token
It also accepts a second and a third augment at acceptCookie
and acceptQueryString
that controls whether
token included in cookie and then appended as query string is accepted as backup.
import authenticator from "koa-utilities/dist/authenticator/remote";
authenticator(<REMOTE_PATH>, acceptCookie: boolean, acceptQueryString: boolean);
- Paseto Token
import Issuer from "koa-utilities/dist/tokenIssuer/Paseto";
const pasetoIssuer = new Issuer(
<PASETO_HEX_KEY>,
() => ({})
);
- JSON Web Token (Work-in-Progress)
import Issuer from "koa-utilities/dist/tokenIssuer/Jwt";
const jwtIssuer = new Issuer(
<JWT_KEY>,
() => ({})
);
const transformerBuilder = transformerBuilderFactory(sizes, formats);
const promises = transformerBuilder(stream)
.reduce(
(acc, [ transformers, size ]) => acc.concat(
transformers.map(
async ([transformer, extension]) => {
try {
await pipeline(
transformer,
fs.createWriteStream(`${ __dirname }/somewhere.${ size }.${ extension }`)
);
} catch (e) {
throw e;
}
return (`${ __dirname }/somewhere.${ size }.${ extension }`);
}
)
),
[]
);
// It requires a Winston logger instance declared by yourself
import loggerInstance from "./components/Winston";
import logger from "koa-utilities/dist/logger";
app.use(logger(loggerInstance));
import rateLimiter from "koa-utilities/dist/rateLimiter";
app.use(rateLimiter());
import refreshReminder from "koa-utilities/dist/refreshReminder";
app.use(refreshReminder());
This timer middleware does not have a factory. The default export is the Koa middleware itself.
import timer from "koa-utilities/dist/timer";
app.use(timer);
https://docs.sentry.io/platforms/node/guides/koa/
import sentryTracer from "koa-utilities/dist/sentry/tracer";
app.use(sentryTracer(<Sentry_DSN>));