3.0.3 • Published 1 year ago

@neogeek/create-app-utils v3.0.3

Weekly downloads
-
License
-
Repository
github
Last release
1 year ago

@neogeek/create-app-utils

Tests NPM version

Install

$ npm install @neogeek/create-app-utils

Usage

URL

getQueryParamsFromUrl(url)

import { getQueryParamsFromUrl } from '@neogeek/create-app-utils';

const { key } = getQueryParamsFromUrl('https://domain.com/?key=value');

Cookies

serializeCookie(key, value, maxAge, secure)

import { serializeCookie } from '@neogeek/create-app-utils';

const cookie = serializeCookie('key', 'value', 0, true);

Dates

generateExpireAtDate(daysFromNow)

import { generateExpireAtDate } from '@neogeek/create-app-utils';

const date = generateExpireAtDate(5);

JWT

extractDataFromToken(token)

import { extractDataFromToken } from '@neogeek/create-app-utils';

const { key } = extractDataFromToken(token);

generateAccessToken(privateKey, data, options)

import { generateAccessToken } from '@neogeek/create-app-utils';

const accessToken = generateAccessToken(
  privateKey,
  { key: 'value' },
  {
    algorithm: 'RS512',
    expiresIn: '15 minutes',
  }
);

generateRefreshToken(privateKey, data, options)

import { generateRefreshToken } from '@neogeek/create-app-utils';

const refreshToken = generateRefreshToken(
  privateKey,
  { key: 'value' },
  {
    algorithm: 'RS512',
    expiresIn: '15 minutes',
  }
);

verifyAccessToken(publicKey, token)

import { verifyAccessToken } from '@neogeek/create-app-utils';

const isValid = verifyAccessToken(publicKey, token);

verifyRefreshToken(publicKey, token)

import { verifyRefreshToken } from '@neogeek/create-app-utils';

const isValid = verifyRefreshToken(publicKey, token);
3.0.3

1 year ago

3.0.2

2 years ago

3.0.1

2 years ago

3.0.0

2 years ago

2.0.0

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago