Comparison

teal-src/util/jwt.d.tl @ 12926:f9e474cb86ac

util.jwt: Document interface as Teal definition file
author Kim Alvefur <zash@zash.se>
date Fri, 10 Mar 2023 10:55:50 +0100
child 12928:916af6fcef1e
comparison
equal deleted inserted replaced
12925:6cb339423928 12926:f9e474cb86ac
1 local record jwtlib
2 enum algorithm
3 "HS256"
4 "HS384"
5 "HS512"
6 "ES256"
7 "ES512"
8 "RS256"
9 "RS384"
10 "RS512"
11 "PS256"
12 "PS384"
13 "PS512"
14 end
15 type payload = { string : any }
16 type signer_t = function (payload : payload) : string
17 type verifier_t = function (token : string) : payload
18 enum key_type
19 "rsaEncryption"
20 "id-ecPublicKey"
21 end
22 record key_t
23 get_type : function (key_t) : key_type
24 end
25 record algorithm_t
26 sign : signer_t
27 verify : verifier_t
28 load_key : function (key : string) : key_t
29 end
30 init : function (algorithm, private_key : string, public_key : string, table) : signer_t, verifier_t
31 new_signer : function (algorithm, string, table) : signer_t
32 new_verifier : function (algorithm, string, table) : verifier_t
33 _algorithms : {
34 algorithm : algorithm_t
35 }
36 -- Deprecated
37 sign : function (string : key, payload) : string
38 verify : function (string) : payload
39 end
40 return jwtlib