aboutsummaryrefslogtreecommitdiffstats
path: root/teal-src/util
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2023-03-10 10:55:50 +0100
committerKim Alvefur <zash@zash.se>2023-03-10 10:55:50 +0100
commit4fa75289f6ab1cb49544da9ebd7103c76674fe97 (patch)
tree1bffa55806e77b54d9c546fbb8f2f74340b80ec6 /teal-src/util
parentcb65c589501f66709867c632773904a8eb5134db (diff)
downloadprosody-4fa75289f6ab1cb49544da9ebd7103c76674fe97.tar.gz
prosody-4fa75289f6ab1cb49544da9ebd7103c76674fe97.zip
util.jwt: Document interface as Teal definition file
Diffstat (limited to 'teal-src/util')
-rw-r--r--teal-src/util/jwt.d.tl40
1 files changed, 40 insertions, 0 deletions
diff --git a/teal-src/util/jwt.d.tl b/teal-src/util/jwt.d.tl
new file mode 100644
index 00000000..e21a4b8a
--- /dev/null
+++ b/teal-src/util/jwt.d.tl
@@ -0,0 +1,40 @@
+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 key_t
+ get_type : function (key_t) : key_type
+ end
+ record algorithm_t
+ sign : signer_t
+ verify : verifier_t
+ load_key : function (key : string) : key_t
+ 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 (string : key, payload) : string
+ verify : function (string) : payload
+end
+return jwtlib