Skip to main content
Module

x/peko/mod.ts>Crypto

Featherweight HTTP routing + utils for stateless apps 🐣
Latest
class Crypto
Re-export
import { Crypto } from "https://deno.land/x/peko@2.1.0/mod.ts";

Crypto class, generates hashes and signs/verifies JWTs using provided key.

Constructors

new
Crypto(key: CryptoKey | string, algData?: AlgData)

Properties

algData: AlgData
key: CryptoKey | string

Methods

hash(contents: BodyInit): Promise<string>

Generate hash from string

sign(payload: Record<string, unknown>): Promise<string>

Sign (create) JWT from payload

verify(jwt: string): Promise<Record<string, unknown> | false>

Verify JWT and extract payload

Static Methods

createCryptoKey(
key: string,
algData: AlgData,
usage: KeyUsage[],
extractable?,
): Promise<CryptoKey>

Create CryptoKey from rawKey string to be used in crypto methods