Software /
code /
prosody
Changeset
12707:f75235110045
util.jwt: Add new init() convenience method to obtain both signer and verifier
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 11 Jul 2022 13:43:01 +0100 |
parents | 12706:108b1758bd8d |
children | 12708:9953ac7b0c15 |
files | util/jwt.lua |
diffstat | 1 files changed, 6 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/util/jwt.lua Mon Jul 11 13:42:08 2022 +0100 +++ b/util/jwt.lua Mon Jul 11 13:43:01 2022 +0100 @@ -197,9 +197,15 @@ 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;