Skip to main content
Latest
class Keygrip
import { Keygrip } from "https://deno.land/x/cookies@1.0.0/deps.ts";

Creates a class for storing private keys in a keychain to easily hash and verify data with different keys

Constructors

new
Keygrip(keys: string[], algo?: Algorithm)

Methods

private
compare(a: string, b: string): boolean

Timing safe compare using Brad Hill's Double HMAC pattern

index(data: string, digest: string): number

Resolve the index of which key was used to digest specified data.

sign(data: string, key?: string | number): string

Cryptographically sign data by a secret key

verify(data: string, digest: string): boolean

Verifies if the data matches the digest with any of the keys in the keychain.