@@ -29,13 +29,7 @@ fs.writeFile("myFile.yaml", serde.encode("yaml", someYaml))
29
29
30
30
Encodes the given value using the given format.
31
31
32
- Currently supported formats:
33
-
34
- | Name | Learn More |
35
- | :----- | :------------------- |
36
- | ` json ` | https://www.json.org |
37
- | ` yaml ` | https://yaml.org |
38
- | ` toml ` | https://toml.io |
32
+ See [ ` EncodeDecodeFormat ` ] for a list of supported formats.
39
33
40
34
#### Parameters
41
35
@@ -56,13 +50,7 @@ Currently supported formats:
56
50
57
51
Decodes the given string using the given format into a lua value.
58
52
59
- Currently supported formats:
60
-
61
- | Name | Learn More |
62
- | :----- | :------------------- |
63
- | ` json ` | https://www.json.org |
64
- | ` yaml ` | https://yaml.org |
65
- | ` toml ` | https://toml.io |
53
+ See [ ` EncodeDecodeFormat ` ] for a list of supported formats.
66
54
67
55
#### Parameters
68
56
@@ -80,14 +68,7 @@ Currently supported formats:
80
68
81
69
Compresses the given string using the given format.
82
70
83
- Currently supported formats:
84
-
85
- | Name | Learn More |
86
- | :------- | :-------------------------------- |
87
- | ` brotli ` | https://github.com/google/brotli |
88
- | ` gzip ` | https://www.gnu.org/software/gzip |
89
- | ` lz4 ` | https://github.com/lz4/lz4 |
90
- | ` zlib ` | https://www.zlib.net |
71
+ See [ ` CompressDecompressFormat ` ] for a list of supported formats.
91
72
92
73
#### Parameters
93
74
@@ -105,14 +86,7 @@ Currently supported formats:
105
86
106
87
Decompresses the given string using the given format.
107
88
108
- Currently supported formats:
109
-
110
- | Name | Learn More |
111
- | :------- | :-------------------------------- |
112
- | ` brotli ` | https://github.com/google/brotli |
113
- | ` gzip ` | https://www.gnu.org/software/gzip |
114
- | ` lz4 ` | https://github.com/lz4/lz4 |
115
- | ` zlib ` | https://www.zlib.net |
89
+ See [ ` CompressDecompressFormat ` ] for a list of supported formats.
116
90
117
91
#### Parameters
118
92
@@ -125,3 +99,95 @@ Currently supported formats:
125
99
- The decompressed string
126
100
127
101
---
102
+
103
+ ### hash
104
+
105
+ Hashes the given message using the given algorithm and returns the hash as a hex string.
106
+
107
+ See [ ` HashAlgorithm ` ] for a list of supported algorithms.
108
+
109
+ #### Parameters
110
+
111
+ - ` algorithm ` The algorithm to use
112
+
113
+ - ` message ` The message to hash
114
+
115
+ #### Returns
116
+
117
+ - The hash as a hex string
118
+
119
+ ---
120
+
121
+ ### hmac
122
+
123
+ Hashes the given message using HMAC with the given secret and algorithm, returning the hash as a
124
+ base64 string.
125
+
126
+ See [ ` HashAlgorithm ` ] for a list of supported algorithms.
127
+
128
+ #### Parameters
129
+
130
+ - ` algorithm ` The algorithm to use
131
+
132
+ - ` message ` The message to hash
133
+
134
+ - ` secret ` string | buffer
135
+
136
+ #### Returns
137
+
138
+ - The hash as a base64 string
139
+
140
+ ---
141
+
142
+ ## Types
143
+
144
+ ### EncodeDecodeFormat
145
+
146
+ A serialization/deserialization format supported by the Serde library.
147
+
148
+ Currently supported formats:
149
+
150
+ | Name | Learn More |
151
+ | :----- | :------------------- |
152
+ | ` json ` | https://www.json.org |
153
+ | ` yaml ` | https://yaml.org |
154
+ | ` toml ` | https://toml.io |
155
+
156
+ ---
157
+
158
+ ### CompressDecompressFormat
159
+
160
+ A compression/decompression format supported by the Serde library.
161
+
162
+ Currently supported formats:
163
+
164
+ | Name | Learn More |
165
+ | :------- | :-------------------------------- |
166
+ | ` brotli ` | https://github.com/google/brotli |
167
+ | ` gzip ` | https://www.gnu.org/software/gzip |
168
+ | ` lz4 ` | https://github.com/lz4/lz4 |
169
+ | ` zlib ` | https://www.zlib.net |
170
+
171
+ ---
172
+
173
+ ### HashAlgorithm
174
+
175
+ A hash algorithm supported by the Serde library.
176
+
177
+ Currently supported algorithms:
178
+
179
+ | Name | Learn More |
180
+ | :--------- | :----------------------------------- |
181
+ | ` md5 ` | https://en.wikipedia.org/wiki/MD5 |
182
+ | ` sha1 ` | https://en.wikipedia.org/wiki/SHA-1 |
183
+ | ` sha224 ` | https://en.wikipedia.org/wiki/SHA-2 |
184
+ | ` sha256 ` | https://en.wikipedia.org/wiki/SHA-2 |
185
+ | ` sha384 ` | https://en.wikipedia.org/wiki/SHA-2 |
186
+ | ` sha512 ` | https://en.wikipedia.org/wiki/SHA-2 |
187
+ | ` sha3-224 ` | https://en.wikipedia.org/wiki/SHA-3 |
188
+ | ` sha3-256 ` | https://en.wikipedia.org/wiki/SHA-3 |
189
+ | ` sha3-384 ` | https://en.wikipedia.org/wiki/SHA-3 |
190
+ | ` sha3-512 ` | https://en.wikipedia.org/wiki/SHA-3 |
191
+ | ` blake3 ` | https://en.wikipedia.org/wiki/BLAKE3 |
192
+
193
+ ---
0 commit comments