How to use jwa - 4 common examples

To help you get started, we’ve selected a few jwa examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DivanteLtd / storefront-api / src / modules / default-vsf / api / product.ts View on Github external
import { apiStatus, sgnSrc, apiError } from '@storefront-api/lib/util';
import { Router } from 'express';
import PlatformFactory from '../../../platform/factory';
import AbstractProductProxy from '../../../platform/abstract/product';

import jwa from 'jwa';
const hmac = jwa('HS256');

export default ({ config, db }) => {
  let productApi = Router();

  const _getProxy = (req): AbstractProductProxy => {
    const platform = config.platform
    const factory = new PlatformFactory(config, req)
    return factory.getAdapter(platform, 'product')
  };

  /**
   * GET get products info
   */
  /*
    #RESPONSE BODY:
    For list:
github jimpick / lambda-comments / packages / lambda / src / queueComment / index.js View on Github external
import { parse as urlParse } from 'url'
import { normalize as pathNormalize, join as pathJoin } from 'path'
import slugid from 'slugid'
import moment from 'moment'
import { isEmail, isURL } from 'validator'
import jwa from 'jwa'
import dotenv from 'dotenv'
import { generateReference } from 'lambda-comments-utils/src/references'
import { uploadPrivate } from 'lambda-comments-utils/src/s3'
import Akismet from 'lambda-comments-utils/src/akismet'
import { updateRecord } from 'lambda-comments-utils/src/dynamoDb'
import { apiKey } from '../../../../deploy/state/apiKey.json'

dotenv.config({ silent: true })

const hmac = jwa('HS256')

let akismet = null

class ValidationError extends Error {
  constructor (data) {
    super()
    this.name = 'ValidationError'
    this.data = data
    this.stack = (new Error()).stack
  }
}

function uploadJson ({ dirName, actionRef, action }) {
  return uploadPrivate({
    key: `${dirName}/.actions/${actionRef}/action.json`,
    data: JSON.stringify(action),
github portier / portier-node / src / client.ts View on Github external
import url from "url";
import jwa from "jwa";
import jwkToPem from "jwk-to-pem";
import querystring from "querystring";
import AbstractStore from "./store";
import MemoryStore from "./stores/memory";

const rs256 = jwa("RS256");

/**
 * Get the origin for a URL.
 */
const getOrigin = (input: string): string => {
  const parsed = url.parse(input);
  const { protocol, hostname } = parsed;
  let { port } = parsed;

  if (protocol === "http:") {
    if (port === "80") {
      port = undefined;
    }
  } else if (protocol === "https:") {
    if (port === "443") {
      port = undefined;
github jimpick / lambda-comments / packages / frontend / src / actions / comments.js View on Github external
import fetch from 'isomorphic-fetch'
import { initialize as initializeReduxForm } from 'redux-form'
import jwa from 'jwa'
import store from 'store'
import { Buffer } from 'buffer'

const hmac = jwa('HS256')

export const GET_COMMENTS = 'GET_COMMENTS'
export const GET_COMMENTS_COMPLETE = 'GET_COMMENTS_COMPLETE'
export const GET_COMMENTS_ERROR = 'GET_COMMENTS_ERROR'

export const POST_COMMENT = 'POST_COMMENT'
export const POST_COMMENT_COMPLETE = 'POST_COMMENT_COMPLETE'
export const POST_COMMENT_ERROR = 'POST_COMMENT_ERROR'

export const FORM_NAME = 'postCommment'
export const FORM_FIELDS = [
  'commentContent',
  'authorName',
  'authorEmail',
  'authorUrl',
]

jwa

JWA implementation (supports all JWS algorithms)

MIT
Latest version published 5 years ago

Package Health Score

74 / 100
Full package analysis

Popular jwa functions