open-index/open-npm huggingface dataset:
npm package: @gcoredev/as-jwt
Description: AssemblyScript package that provides simple jws handling for jwt tokens/
Author: Gordon Farquharson
Latest version: 1.0.3

# as-jwt

[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/G-Core/as-jwt/deploy.yaml)](https://github.com/G-Core/as-jwt)
[![GitHub commit activity](https://img.shields.io/github/commit-activity/t/G-Core/as-jwt)](https://github.com/G-Core/as-jwt)
[![GitHub top language](https://img.shields.io/github/languages/top/G-Core/as-jwt)](https://github.com/G-Core/as-jwt)
[![GitHub License](https://img.shields.io/github/license/G-Core/as-jwt)](https://github.com/G-Core/as-jwt/blob/main/LICENSE)
[![NPM Version](https://img.shields.io/npm/v/@gcoredev/as-jwt)](https://www.npmjs.com/package/@gcoredev/as-jwt)

AssemblyScript package that provides simple jws handling for jwt tokens.

## Installation:

```sh
npm install @gcoredev/as-jwt
```

## Usage:

```ts
import { jwtVerify, JwtValidation } from "@gcoredev/as-jwt/assembly";

const token = "<base64-header>.<base64-payload>.<signed-secret>";
const secret = "my-long-private-key-that-is-hard-to-guess";

const result: JwtValidation = jwtVerify(token, secret);

if (result === JwtValidation.Ok) {
  // Jwt is valid.
} else {
  // Jwt validation failed
}
```

## API

### jwtVerify()

`jwtVerify(token, secret): JwtValidation`

Validates `token` signature has been signed with a valid `secret`.

Also validates that claims contain an `exp` date and that the token is not expired.

### compactVerify()

`compactVerify(token, secret): JwtValidation`

Validates `token` signature has been signed with a valid `secret`.

Does NOT validate any claims in the payload.

### Internal Libraries:

Under the hood this package is powered by:

- [as-hmac-sha2](https://github.com/jedisct1/as-hmac-sha2)
- [as-base64](https://github.com/near/as-base64)
- [as-sha256](https://github.com/ChainSafe/as-sha256)
npm package: @gcoredev/fastedge-sdk-js
Description: [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/G-Core/FastEdge-sdk-js/deploy.yaml)](https://github.com/G-Core/FastEdge-sdk-js) [![GitHub commit activity](https://img.shields.io/github/commit-activity/t/G-Core/Fast
Latest version: 2.2.1

# FastEdge JS SDK

[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/G-Core/FastEdge-sdk-js/deploy.yaml)](https://github.com/G-Core/FastEdge-sdk-js)
[![GitHub commit activity](https://img.shields.io/github/commit-activity/t/G-Core/FastEdge-sdk-js)](https://github.com/G-Core/FastEdge-sdk-js)
[![GitHub top language](https://img.shields.io/github/languages/top/G-Core/FastEdge-sdk-js)](https://github.com/G-Core/FastEdge-sdk-js)
[![GitHub License](https://img.shields.io/github/license/G-Core/FastEdge-sdk-js)](https://github.com/G-Core/FastEdge-sdk-js/blob/main/LICENSE)
[![NPM Version](https://img.shields.io/npm/v/@gcoredev/fastedge-sdk-js)](https://www.npmjs.com/package/@gcoredev/fastedge-sdk-js)

This is the Javascript SDK for building Javascript applications ready for deploying on FastEdge.

## Getting Started

Please read through the documentation provided by Gcore.

- FastEdge: [Overview](https://gcore.com/fastedge)
- User Guide: [SDK Homepage](https://G-Core.github.io/FastEdge-sdk-js/)
- Deploying an App:
  [Documentation](https://gcore.com/docs/fastedge/getting-started/create-fastedge-apps#stage-2-deploy-an-app)

## Installation

Required:

- Node v20 or higher

Setup:

- `npm install --save-dev @gcoredev/fastedge-sdk-js`

### Basic Javascript Example

```js
async function app(event) {
  const request = event.request;
  return new Response(`You made a request to ${request.url}`);
}

addEventListener('fetch', (event) => {
  event.respondWith(app(event));
});
```

## Home Page

For more information on how this works please visit our user guide and
[homepage](https://G-Core.github.io/FastEdge-sdk-js/)