From ff54cc5bcfd5fc9ec23f8d974f0c46363f9bb35a Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Mon, 11 Jul 2022 13:43:01 +0100 Subject: util.jwt: Add new init() convenience method to obtain both signer and verifier --- util/jwt.lua | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'util') diff --git a/util/jwt.lua b/util/jwt.lua index 53825236..5c74850a 100644 --- a/util/jwt.lua +++ b/util/jwt.lua @@ -197,9 +197,15 @@ local function new_verifier(algorithm, key_input, options) end end +local function init(algorithm, private_key, public_key, options) + return new_signer(algorithm, private_key, options), new_verifier(algorithm, public_key or private_key, options); +end + return { + init = init; new_signer = new_signer; new_verifier = new_verifier; + -- Exported mainly for tests _algorithms = algorithms; -- Deprecated sign = algorithms.HS256.sign; -- cgit v1.2.3