Skip to main content
Module

x/peko/mod.ts>Crypto

Featherweight server/router framework for Deno + middleware library 🐣
Go to Latest
class Crypto
Re-export
import { Crypto } from "https://deno.land/x/peko@1.4.0/mod.ts";

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

Constructors

new
Crypto(key: CryptoKey | string)

Properties

algorithm: { name: string; hash: DigestAlgorithm; }
key: CryptoKey | undefined
rawKey: string | undefined

Methods

createCryptoKey(): Promise<void>

Create CryptoKey from rawKey string to be used in crypto methods

hash(contents: string): Promise<string>

Generate hash from string

sign(payload: Payload): Promise<string>

Sign (create) JWT from payload

verify(jwt: string): Promise<Payload | undefined>

Verify JWT and extract payload