11--- @meta
2- resty_aes = {}
3- function resty_aes .cipher () end
4- resty_aes .hash = {}
5- resty_aes .hash .sha1 = {}
6- resty_aes .hash .md5 = {}
7- resty_aes .hash .sha224 = {}
8- resty_aes .hash .sha512 = {}
9- resty_aes .hash .sha256 = {}
10- resty_aes .hash .sha384 = {}
11- function resty_aes .new (self , key , salt , _cipher , _hash , hash_rounds ) end
12- function resty_aes .decrypt (self , s ) end
13- resty_aes ._VERSION = " 0.11"
14- function resty_aes .encrypt (self , s ) end
15- return resty_aes
2+
3+ local aes = {}
4+
5+ --- @alias resty.aes.cipher.name
6+ --- | ' "ecb"'
7+ --- | ' "cbc"'
8+ --- | ' "cfb1"'
9+ --- | ' "cfb128"'
10+ --- | ' "cfb8"'
11+ --- | ' "ctr"
12+ --- | ' "gcm"'
13+ --- | ' "ofb"'
14+
15+ --- @alias resty.aes.cipher.size ' 128' | ' 192' | ' 256'
16+
17+ --- @class resty.aes.cipher : table
18+ --- @field size resty.aes.cipher.size
19+ --- @field cipher resty.aes.cipher.name
20+ --- @field method userdata
21+
22+ --- @param size resty.aes.cipher.size # cipher size (default `128`)
23+ --- @param cipher ? resty.aes.cipher.name # cipher name (default `"cbc"`)
24+ --- @return resty.aes.cipher ?
25+ function aes .cipher (size , cipher ) end
26+
27+ --- @class resty.aes.hash_table : table
28+ --- @field iv string
29+ --- @field method ? fun ( key : string ): string
30+
31+ --- @class resty.aes.hash_cdata : userdata
32+
33+ --- @type table<string , resty.aes.hash_cdata>
34+ aes .hash = {}
35+ aes .hash .sha1 = {}
36+ aes .hash .md5 = {}
37+ aes .hash .sha224 = {}
38+ aes .hash .sha512 = {}
39+ aes .hash .sha256 = {}
40+ aes .hash .sha384 = {}
41+
42+ --- @alias resty.aes.hash resty.aes.hash_cdata | resty.aes.hash_table
43+
44+ --- @param key string encryption key
45+ --- @param salt ? string if provided , must be exactly 8 characters in length
46+ --- @param cipher ? resty.aes.cipher (default is 128 CBC )
47+ --- @param hash ? resty.aes.hash (default is md5 )
48+ --- @param hash_rounds ? number (default : ` 1` )
49+ --- @param iv_len ? number
50+ --- @param enable_padding ? boolean (default : ` true ` )
51+ ---
52+ --- @return resty.aes ?
53+ --- @return string ? error
54+ function aes :new (key , salt , cipher , hash , hash_rounds , iv_len , enable_padding ) end
55+
56+ --- @class resty.aes : table
57+ local aes_ctx = {}
58+
59+ --- Decrypt a string
60+ ---
61+ --- @param s string
62+ --- @param tag ? string
63+ --- @return string ? decrypted
64+ --- @return string ? error
65+ function aes_ctx :decrypt (s , tag ) end
66+
67+
68+ --- Encrypt a string.
69+ ---
70+ --- @param s string
71+ --- @return string ? encrypted
72+ --- @return string ? error
73+ function aes_ctx :encrypt (s ) end
74+
75+ return aes
0 commit comments