New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@genie-solutions/lambda-toolbelt

Package Overview
Dependencies
Maintainers
8
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@genie-solutions/lambda-toolbelt

Toolbelt for creating Lambda functions

  • 0.1.1
  • npm
  • Socket score

Version published
Weekly downloads
40
increased by700%
Maintainers
8
Weekly downloads
 
Created
Source

Genie Lambda Toolbelt

Set of reusable tools to make writing new Lambda functions a breeze.

Sample Usage

import { compose, httpHandler, withJSONBody, HTTPEvent, HTTPContext } from 'genie-lambda-toolbelt';

const myHelloWorldFunction = async (event: HTTPEvent, context: HTTPContext): Promise<object> => {
  const { genie: { body } } = context;
  return {
    message: `Hello, ${body.name}`,
  };
};

export default compose(httpHandler, withJSONBody)(myHelloWorldFunction);

withJWTPayload

Automatically verifies and parses the payload of a JWT token being provided via a HTTP header.

Example:

import { createParameterStore, compose, httpHandler, withJWTPayload } from 'genie-lambda-toolbelt';

const mySuperSecretFunction = async (event: HTTPEvent, context: HTTPContext): Promise<object> => {
  const { userId, tenantId, roleId } = context.genie.jwt.role;
  return Promise.resolve('Oll Korrect (yep, that is what OK stands for)');
};

const parameterStore = createParameterStore();
const getPublicKey = () => parameterStore('JWT_PUBLIC_KEY');

export default compose(
  httpHandler,
  withJWTPayload({
    getPublicKey,
    algorithm: 'RS256',
    headerName: 'X-GENIE-ROLES',
    payloadKey: 'role',
  }),
);

FAQs

Package last updated on 10 Jun 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc