blob: b3d0cd9e4a473ac810ed8e035a8e327bbf2d1418 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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
|