@ship-it-app/validate
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

Ship It Validate

This package can be used to easily validate headers signed by Ship It.

Install

npm i @ship-it-app/validate

Usage

import { validate } from '@ship-it-app/validate';

async function fetch(request, env) {
    const isValid = await validate(
		env.REQUEST_PUBLIC_KEY,
		request.headers.get('X-Proxy-Signature'),
		request.headers.get('X-Proxy-Timestamp'),
		request.headers.get('X-User-Sub'),
	);
    if (!isValid) {
        return new Response(
            "unauthorized",
            {
                status: 401
            }
        );
    }
}

Readme

Keywords

none

Package Sidebar

Install

npm i @ship-it-app/validate

Homepage

ship-it.app

Weekly Downloads

0

Version

1.0.2

License

ISC

Unpacked Size

3.45 kB

Total Files

4

Last publish

Collaborators

  • ship-it-actions