aboutsummaryrefslogtreecommitdiffstats
path: root/teal-src/prosody/util/jwt.d.tl
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2023-03-23 13:36:52 +0100
committerKim Alvefur <zash@zash.se>2023-03-23 13:36:52 +0100
commitf68336b96e0d843511bb1bd3fdac8bba2fe4573a (patch)
treea54111914e081293e50b846e7f0d9654e885c2ed /teal-src/prosody/util/jwt.d.tl
parent738df041ac3965496e9247acc95d80f84d30b2b5 (diff)
downloadprosody-f68336b96e0d843511bb1bd3fdac8bba2fe4573a.tar.gz
prosody-f68336b96e0d843511bb1bd3fdac8bba2fe4573a.zip
teal: Move into prosody namespace
Diffstat (limited to 'teal-src/prosody/util/jwt.d.tl')
-rw-r--r--teal-src/prosody/util/jwt.d.tl38
1 files changed, 38 insertions, 0 deletions
diff --git a/teal-src/prosody/util/jwt.d.tl b/teal-src/prosody/util/jwt.d.tl
new file mode 100644
index 00000000..b3d0cd9e
--- /dev/null
+++ b/teal-src/prosody/util/jwt.d.tl
@@ -0,0 +1,38 @@
+local crypto = require "prosody.util.crypto"
+local record jwtlib
+ enum algorithm
+ "HS256"
+ "HS384"
+ "HS512"
+ "ES256"
+ "ES512"
+ "RS256"
+ "RS384"
+ "RS512"
+ "PS256"
+ "PS384"
+ "PS512"
+ end
+ type payload = { string : any }
+ type signer_t = function (payload : payload) : string
+ type verifier_t = function (token : string) : payload
+ enum key_type
+ "rsaEncryption"
+ "id-ecPublicKey"
+ end
+ record algorithm_t
+ sign : signer_t
+ verify : verifier_t
+ load_key : function (key : string) : crypto.key
+ end
+ init : function (algorithm, private_key : string, public_key : string, table) : signer_t, verifier_t
+ new_signer : function (algorithm, string, table) : signer_t
+ new_verifier : function (algorithm, string, table) : verifier_t
+ _algorithms : {
+ algorithm : algorithm_t
+ }
+ -- Deprecated
+ sign : function (private_key : string, payload) : string
+ verify : function (string) : payload
+end
+return jwtlib