Skip to main content
Module

x/peko/mod.ts>Crypto

Featherweight server framework and utility library for full-stack stateless apps on Deno Deploy 🐓🦕
Go to Latest
class Crypto
Re-export
import { Crypto } from "https://deno.land/x/peko@v0.5/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