edhoc 1.2.3 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/binding.gyp +2 -2
- package/dist/edhoc.d.ts +4 -0
- package/dist/edhoc.d.ts.map +1 -1
- package/include/{LibEDHOC.h → Binding.h} +60 -40
- package/include/EdhocComposeAsyncWorker.h +8 -22
- package/include/EdhocCredentialManager.h +9 -25
- package/include/EdhocCryptoManager.h +27 -43
- package/include/EdhocEadManager.h +3 -4
- package/include/EdhocExportOscoreAsyncWorker.h +10 -27
- package/include/EdhocKeyExporterAsyncWorker.h +8 -28
- package/include/EdhocKeyUpdateAsyncWorker.h +7 -24
- package/include/EdhocProcessAsyncWorker.h +11 -36
- package/include/RunningContext.h +102 -0
- package/include/Utils.h +2 -46
- package/package.json +1 -2
- package/prebuilds/android-arm/edhoc.armv7.node +0 -0
- package/prebuilds/android-arm64/edhoc.armv8.node +0 -0
- package/prebuilds/darwin-arm64/edhoc.node +0 -0
- package/prebuilds/darwin-x64/edhoc.node +0 -0
- package/prebuilds/linux-arm/edhoc.armv6.node +0 -0
- package/prebuilds/linux-arm/edhoc.armv7.node +0 -0
- package/prebuilds/linux-arm64/edhoc.armv8.node +0 -0
- package/prebuilds/linux-x64/edhoc.glibc.node +0 -0
- package/prebuilds/linux-x64/edhoc.musl.node +0 -0
- package/prebuilds/win32-ia32/edhoc.node +0 -0
- package/prebuilds/win32-x64/edhoc.node +0 -0
- package/src/Binding.cpp +434 -0
- package/src/EdhocComposeAsyncWorker.cpp +39 -57
- package/src/EdhocCredentialManager.cpp +58 -93
- package/src/EdhocCryptoManager.cpp +181 -400
- package/src/EdhocEadManager.cpp +13 -13
- package/src/EdhocExportOscoreAsyncWorker.cpp +29 -45
- package/src/EdhocKeyExporterAsyncWorker.cpp +19 -37
- package/src/EdhocKeyUpdateAsyncWorker.cpp +15 -33
- package/src/EdhocProcessAsyncWorker.cpp +82 -96
- package/src/RunningContext.cpp +95 -0
- package/src/Utils.cpp +2 -34
- package/test/basic.test.ts +57 -3
- package/include/UserContext.h +0 -78
- package/src/LibEDHOC.cpp +0 -418
- package/test/errors.test.ts +0 -129
package/binding.gyp
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
{
|
|
7
7
|
"target_name": "bindings",
|
|
8
8
|
'defines': [
|
|
9
|
-
'
|
|
9
|
+
'NAPI_CPP_EXCEPTIONS=1',
|
|
10
10
|
'CONFIG_LIBEDHOC_ENABLE=1',
|
|
11
11
|
'CONFIG_LIBEDHOC_MAX_NR_OF_CIPHER_SUITES=9',
|
|
12
12
|
'CONFIG_LIBEDHOC_MAX_LEN_OF_CONN_ID=7',
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
'cflags!': [ '-fno-exceptions', '-std=c99' ],
|
|
39
39
|
'cflags_cc!': [ '-fno-exceptions', '-std=c++20' ],
|
|
40
40
|
'xcode_settings': {
|
|
41
|
-
'GCC_ENABLE_CPP_EXCEPTIONS': '
|
|
41
|
+
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
|
|
42
42
|
'CLANG_CXX_LIBRARY': 'libc++',
|
|
43
43
|
'CLANG_CXX_LANGUAGE_STANDARD': 'c++20',
|
|
44
44
|
'MACOSX_DEPLOYMENT_TARGET': '12'
|
package/dist/edhoc.d.ts
CHANGED
|
@@ -292,6 +292,10 @@ export declare class EDHOC {
|
|
|
292
292
|
* @param crypto A crypto manager to handle cryptographic functions.
|
|
293
293
|
*/
|
|
294
294
|
constructor(connectionID: EdhocConnectionID, methods: EdhocMethod[], suites: EdhocSuite[], credentials: EdhocCredentialManager, crypto: EdhocCryptoManager);
|
|
295
|
+
/**
|
|
296
|
+
* Resets the EDHOC context.
|
|
297
|
+
*/
|
|
298
|
+
reset(): void;
|
|
295
299
|
/**
|
|
296
300
|
* Composes the first EDHOC message.
|
|
297
301
|
* @param ead Optional array of EAD objects to include in the message.
|
package/dist/edhoc.d.ts.map
CHANGED
|
@@ -1 +1 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OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,GAAG,KAAK;IAEpE;;;;OAIG;IACI,eAAe,CAAC,GAAG,CAAC,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,KAAK;IAEjE;;;;;OAKG;IACI,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,GAAG,KAAK;IAEpE;;;OAGG;IACI,YAAY,IAAI,OAAO,CAAC,kBAAkB,CAAC,GAAG,KAAK;IAE1D;;;;;OAKG;IACI,SAAS,CAAC,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,KAAK;IAEhF;;;;;OAKG;IACI,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,KAAK;CAC3D;AAED,cAAc,YAAY,CAAC"}
|
|
@@ -3,47 +3,50 @@
|
|
|
3
3
|
|
|
4
4
|
#include <napi.h>
|
|
5
5
|
|
|
6
|
-
#include "
|
|
6
|
+
#include "EdhocCredentialManager.h"
|
|
7
|
+
#include "EdhocCryptoManager.h"
|
|
8
|
+
#include "EdhocEadManager.h"
|
|
9
|
+
#include "RunningContext.h"
|
|
7
10
|
|
|
8
11
|
extern "C" {
|
|
9
12
|
#include "edhoc.h"
|
|
10
13
|
}
|
|
11
14
|
|
|
12
15
|
/**
|
|
13
|
-
* @class
|
|
14
|
-
* @brief A class that represents the
|
|
16
|
+
* @class Edhoc
|
|
17
|
+
* @brief A class that represents the Edhoc object.
|
|
15
18
|
*
|
|
16
|
-
* The
|
|
19
|
+
* The Edhoc class is a wrapper around the EDHOC library and provides
|
|
17
20
|
* an interface for performing EDHOC operations. It allows users to
|
|
18
21
|
* initialize the EDHOC context, set connection identifiers, set the
|
|
19
22
|
* method used in EDHOC, set cipher suites, set a logger function, and
|
|
20
23
|
* compose/process EDHOC messages.
|
|
21
24
|
*/
|
|
22
|
-
class
|
|
25
|
+
class Edhoc : public Napi::ObjectWrap<Edhoc> {
|
|
23
26
|
public:
|
|
24
27
|
/**
|
|
25
|
-
* @brief Initializes the
|
|
28
|
+
* @brief Initializes the Edhoc object.
|
|
26
29
|
*
|
|
27
|
-
* This static method is used to initialize the
|
|
30
|
+
* This static method is used to initialize the Edhoc object and
|
|
28
31
|
* bind it to the provided JavaScript environment.
|
|
29
32
|
*
|
|
30
33
|
* @param env The Napi::Env representing the JavaScript environment.
|
|
31
34
|
* @param exports The Napi::Object representing the exports object.
|
|
32
|
-
* @return Napi::Object The initialized
|
|
35
|
+
* @return Napi::Object The initialized Edhoc object.
|
|
33
36
|
*/
|
|
34
37
|
static Napi::Object Init(Napi::Env env, Napi::Object exports);
|
|
35
38
|
|
|
36
39
|
/**
|
|
37
|
-
* @brief Constructs a
|
|
40
|
+
* @brief Constructs a Edhoc object.
|
|
38
41
|
*
|
|
39
42
|
* @param info The Napi::CallbackInfo representing the callback information.
|
|
40
43
|
*/
|
|
41
|
-
|
|
44
|
+
Edhoc(const Napi::CallbackInfo& info);
|
|
42
45
|
|
|
43
46
|
/**
|
|
44
|
-
* @brief Destroys the
|
|
47
|
+
* @brief Destroys the Edhoc object.
|
|
45
48
|
*/
|
|
46
|
-
~
|
|
49
|
+
~Edhoc();
|
|
47
50
|
|
|
48
51
|
/**
|
|
49
52
|
* @brief Gets the connection identifier (C_I or C_R depending on the role).
|
|
@@ -86,7 +89,7 @@ class LibEDHOC : public Napi::ObjectWrap<LibEDHOC> {
|
|
|
86
89
|
* @brief Gets the Method (RFC 9528: 3.2.) used in EDHOC.
|
|
87
90
|
*
|
|
88
91
|
* This method returns the Method (RFC 9528: 3.2.) used in EDHOC
|
|
89
|
-
* associated with the
|
|
92
|
+
* associated with the Edhoc object.
|
|
90
93
|
*
|
|
91
94
|
* @param info The Napi::CallbackInfo representing the callback information.
|
|
92
95
|
* @return Napi::Value The supported methods used in EDHOC.
|
|
@@ -97,7 +100,7 @@ class LibEDHOC : public Napi::ObjectWrap<LibEDHOC> {
|
|
|
97
100
|
* @brief Sets the Method (RFC 9528: 3.2.) used in EDHOC.
|
|
98
101
|
*
|
|
99
102
|
* This method sets the supported methods (RFC 9528: 3.2.) used in EDHOC for
|
|
100
|
-
* the
|
|
103
|
+
* the Edhoc object.
|
|
101
104
|
*
|
|
102
105
|
* @param info The Napi::CallbackInfo representing the callback information.
|
|
103
106
|
* @param value The Napi::Value representing the supported methods used in EDHOC.
|
|
@@ -107,7 +110,7 @@ class LibEDHOC : public Napi::ObjectWrap<LibEDHOC> {
|
|
|
107
110
|
/**
|
|
108
111
|
* @brief Gets the selected method.
|
|
109
112
|
*
|
|
110
|
-
* This method returns the selected method associated with the
|
|
113
|
+
* This method returns the selected method associated with the Edhoc object.
|
|
111
114
|
*
|
|
112
115
|
* @param info The Napi::CallbackInfo representing the callback information.
|
|
113
116
|
* @return Napi::Value The selected method.
|
|
@@ -117,7 +120,7 @@ class LibEDHOC : public Napi::ObjectWrap<LibEDHOC> {
|
|
|
117
120
|
/**
|
|
118
121
|
* @brief Sets the cipher suites.
|
|
119
122
|
*
|
|
120
|
-
* This method sets the cipher suites for the
|
|
123
|
+
* This method sets the cipher suites for the Edhoc object.
|
|
121
124
|
*
|
|
122
125
|
* @param info The Napi::CallbackInfo representing the callback information.
|
|
123
126
|
* @param value The Napi::Value representing the cipher suites.
|
|
@@ -127,7 +130,7 @@ class LibEDHOC : public Napi::ObjectWrap<LibEDHOC> {
|
|
|
127
130
|
/**
|
|
128
131
|
* @brief Gets the cipher suites.
|
|
129
132
|
*
|
|
130
|
-
* This method returns the cipher suites associated with the
|
|
133
|
+
* This method returns the cipher suites associated with the Edhoc object.
|
|
131
134
|
*
|
|
132
135
|
* @param info The Napi::CallbackInfo representing the callback information.
|
|
133
136
|
* @return Napi::Value The cipher suites.
|
|
@@ -137,7 +140,7 @@ class LibEDHOC : public Napi::ObjectWrap<LibEDHOC> {
|
|
|
137
140
|
/**
|
|
138
141
|
* @brief Gets the selected cipher suite.
|
|
139
142
|
*
|
|
140
|
-
* This method returns the selected cipher suite associated with the
|
|
143
|
+
* This method returns the selected cipher suite associated with the Edhoc
|
|
141
144
|
* object.
|
|
142
145
|
*
|
|
143
146
|
* @param info The Napi::CallbackInfo representing the callback information.
|
|
@@ -148,7 +151,7 @@ class LibEDHOC : public Napi::ObjectWrap<LibEDHOC> {
|
|
|
148
151
|
/**
|
|
149
152
|
* @brief Gets the logger function.
|
|
150
153
|
*
|
|
151
|
-
* This method returns the logger function associated with the
|
|
154
|
+
* This method returns the logger function associated with the Edhoc
|
|
152
155
|
* object.
|
|
153
156
|
*
|
|
154
157
|
* @param info The Napi::CallbackInfo representing the callback information.
|
|
@@ -159,17 +162,27 @@ class LibEDHOC : public Napi::ObjectWrap<LibEDHOC> {
|
|
|
159
162
|
/**
|
|
160
163
|
* @brief Sets the logger function.
|
|
161
164
|
*
|
|
162
|
-
* This method sets the logger function for the
|
|
165
|
+
* This method sets the logger function for the Edhoc object.
|
|
163
166
|
*
|
|
164
167
|
* @param info The Napi::CallbackInfo representing the callback information.
|
|
165
168
|
* @param value The Napi::Value representing the logger function.
|
|
166
169
|
*/
|
|
167
170
|
void SetLogger(const Napi::CallbackInfo& info, const Napi::Value& value);
|
|
168
|
-
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* @brief Resets the EDHOC context.
|
|
174
|
+
*
|
|
175
|
+
* This method resets the EDHOC context for the Edhoc object.
|
|
176
|
+
*
|
|
177
|
+
* @param info The Napi::CallbackInfo representing the callback information.
|
|
178
|
+
* @return Napi::Value void.
|
|
179
|
+
*/
|
|
180
|
+
void Reset(const Napi::CallbackInfo& info);
|
|
181
|
+
|
|
169
182
|
/**
|
|
170
183
|
* @brief Composes EDHOC message 1.
|
|
171
184
|
*
|
|
172
|
-
* This method composes EDHOC message 1 for the
|
|
185
|
+
* This method composes EDHOC message 1 for the Edhoc object.
|
|
173
186
|
*
|
|
174
187
|
* @param info The Napi::CallbackInfo representing the callback information.
|
|
175
188
|
* @return Napi::Value The composed EDHOC message 1.
|
|
@@ -179,7 +192,7 @@ class LibEDHOC : public Napi::ObjectWrap<LibEDHOC> {
|
|
|
179
192
|
/**
|
|
180
193
|
* @brief Processes EDHOC message 1.
|
|
181
194
|
*
|
|
182
|
-
* This method processes EDHOC message 1 for the
|
|
195
|
+
* This method processes EDHOC message 1 for the Edhoc object.
|
|
183
196
|
*
|
|
184
197
|
* @param info The Napi::CallbackInfo representing the callback information.
|
|
185
198
|
* @return Napi::Value The EAD data from message 1 or Null.
|
|
@@ -189,7 +202,7 @@ class LibEDHOC : public Napi::ObjectWrap<LibEDHOC> {
|
|
|
189
202
|
/**
|
|
190
203
|
* @brief Composes EDHOC message 2.
|
|
191
204
|
*
|
|
192
|
-
* This method composes EDHOC message 2 for the
|
|
205
|
+
* This method composes EDHOC message 2 for the Edhoc object.
|
|
193
206
|
*
|
|
194
207
|
* @param info The Napi::CallbackInfo representing the callback information.
|
|
195
208
|
* @return Napi::Value The composed EDHOC message 2.
|
|
@@ -199,7 +212,7 @@ class LibEDHOC : public Napi::ObjectWrap<LibEDHOC> {
|
|
|
199
212
|
/**
|
|
200
213
|
* @brief Processes EDHOC message 2.
|
|
201
214
|
*
|
|
202
|
-
* This method processes EDHOC message 2 for the
|
|
215
|
+
* This method processes EDHOC message 2 for the Edhoc object.
|
|
203
216
|
*
|
|
204
217
|
* @param info The Napi::CallbackInfo representing the callback information.
|
|
205
218
|
* @return Napi::Value The EAD data from message 2 or Null.
|
|
@@ -209,7 +222,7 @@ class LibEDHOC : public Napi::ObjectWrap<LibEDHOC> {
|
|
|
209
222
|
/**
|
|
210
223
|
* @brief Composes EDHOC message 3.
|
|
211
224
|
*
|
|
212
|
-
* This method composes EDHOC message 3 for the
|
|
225
|
+
* This method composes EDHOC message 3 for the Edhoc object.
|
|
213
226
|
*
|
|
214
227
|
* @param info The Napi::CallbackInfo representing the callback information.
|
|
215
228
|
* @return Napi::Value The composed EDHOC message 3.
|
|
@@ -219,7 +232,7 @@ class LibEDHOC : public Napi::ObjectWrap<LibEDHOC> {
|
|
|
219
232
|
/**
|
|
220
233
|
* @brief Processes EDHOC message 3.
|
|
221
234
|
*
|
|
222
|
-
* This method processes EDHOC message 3 for the
|
|
235
|
+
* This method processes EDHOC message 3 for the Edhoc object.
|
|
223
236
|
*
|
|
224
237
|
* @param info The Napi::CallbackInfo representing the callback information.
|
|
225
238
|
* @return Napi::Value The EAD data from message 3 or Null.
|
|
@@ -229,7 +242,7 @@ class LibEDHOC : public Napi::ObjectWrap<LibEDHOC> {
|
|
|
229
242
|
/**
|
|
230
243
|
* @brief Composes EDHOC message 4.
|
|
231
244
|
*
|
|
232
|
-
* This method composes EDHOC message 4 for the
|
|
245
|
+
* This method composes EDHOC message 4 for the Edhoc object.
|
|
233
246
|
*
|
|
234
247
|
* @param info The Napi::CallbackInfo representing the callback information.
|
|
235
248
|
* @return Napi::Value The composed EDHOC message 4.
|
|
@@ -239,7 +252,7 @@ class LibEDHOC : public Napi::ObjectWrap<LibEDHOC> {
|
|
|
239
252
|
/**
|
|
240
253
|
* @brief Processes EDHOC message 4.
|
|
241
254
|
*
|
|
242
|
-
* This method processes EDHOC message 4 for the
|
|
255
|
+
* This method processes EDHOC message 4 for the Edhoc object.
|
|
243
256
|
*
|
|
244
257
|
* @param info The Napi::CallbackInfo representing the callback information.
|
|
245
258
|
* @return Napi::Value The EAD data from message 4 or Null.
|
|
@@ -250,7 +263,7 @@ class LibEDHOC : public Napi::ObjectWrap<LibEDHOC> {
|
|
|
250
263
|
* @brief Exports OSCORE.
|
|
251
264
|
*
|
|
252
265
|
* This method exports an OSCORE context object containing the master key,
|
|
253
|
-
* salt, recipient ID, and sender ID for the
|
|
266
|
+
* salt, recipient ID, and sender ID for the Edhoc object.
|
|
254
267
|
*
|
|
255
268
|
* @param info The Napi::CallbackInfo representing the callback information.
|
|
256
269
|
* @return Napi::Value The exported OSCORE context object.
|
|
@@ -272,7 +285,7 @@ class LibEDHOC : public Napi::ObjectWrap<LibEDHOC> {
|
|
|
272
285
|
/**
|
|
273
286
|
* @brief Performs a key update.
|
|
274
287
|
*
|
|
275
|
-
* This method performs a key update for the
|
|
288
|
+
* This method performs a key update for the Edhoc object.
|
|
276
289
|
*
|
|
277
290
|
* @param info The Napi::CallbackInfo representing the callback information.
|
|
278
291
|
* @return Napi::Value void.
|
|
@@ -280,18 +293,25 @@ class LibEDHOC : public Napi::ObjectWrap<LibEDHOC> {
|
|
|
280
293
|
Napi::Value KeyUpdate(const Napi::CallbackInfo& info);
|
|
281
294
|
|
|
282
295
|
private:
|
|
283
|
-
|
|
296
|
+
|
|
297
|
+
std::unique_ptr<edhoc_context> edhocContext_; ///< The EDHOC context.
|
|
284
298
|
|
|
285
|
-
|
|
299
|
+
std::unique_ptr<RunningContext> runningContext_; ///< The running context.
|
|
286
300
|
|
|
287
|
-
|
|
301
|
+
struct edhoc_connection_id cid_; ///< RFC 9528: 3.3.2. Representation of Byte String Identifiers.
|
|
302
|
+
|
|
303
|
+
Napi::FunctionReference logger_; ///< N-API reference to the logger function
|
|
304
|
+
|
|
305
|
+
std::unique_ptr<EdhocCryptoManager> cryptoManager_; ///< The crypto manager
|
|
306
|
+
|
|
307
|
+
std::unique_ptr<EdhocEadManager> eadManager_; ///< The EAD manager
|
|
308
|
+
|
|
309
|
+
std::unique_ptr<EdhocCredentialManager> credentialManager_; ///< The credential manager
|
|
288
310
|
|
|
289
|
-
|
|
290
|
-
// cryptographic operations, EAD, and credentials
|
|
291
|
-
std::shared_ptr<UserContext> userContext;
|
|
311
|
+
void StartRunningContext(Napi::Env env);
|
|
292
312
|
|
|
293
313
|
/**
|
|
294
|
-
* @brief Logger function for the
|
|
314
|
+
* @brief Logger function for the Edhoc object.
|
|
295
315
|
*
|
|
296
316
|
* This static method is used to log messages from the EDHOC library.
|
|
297
317
|
*
|
|
@@ -305,7 +325,7 @@ class LibEDHOC : public Napi::ObjectWrap<LibEDHOC> {
|
|
|
305
325
|
/**
|
|
306
326
|
* @brief Composes an EDHOC message.
|
|
307
327
|
*
|
|
308
|
-
* This method is used to compose an EDHOC message for the
|
|
328
|
+
* This method is used to compose an EDHOC message for the Edhoc object.
|
|
309
329
|
*
|
|
310
330
|
* @param info The Napi::CallbackInfo representing the callback information.
|
|
311
331
|
* @param message The EDHOC message to compose.
|
|
@@ -316,7 +336,7 @@ class LibEDHOC : public Napi::ObjectWrap<LibEDHOC> {
|
|
|
316
336
|
/**
|
|
317
337
|
* @brief Processes an EDHOC message.
|
|
318
338
|
*
|
|
319
|
-
* This method is used to process an EDHOC message for the
|
|
339
|
+
* This method is used to process an EDHOC message for the Edhoc object.
|
|
320
340
|
*
|
|
321
341
|
* @param info The Napi::CallbackInfo representing the callback information.
|
|
322
342
|
* @param message The EDHOC message to process.
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
#define EDHOC_COMPOSE_ASYNC_WORKER_H
|
|
3
3
|
|
|
4
4
|
#include <napi.h>
|
|
5
|
-
|
|
6
5
|
#include <vector>
|
|
7
6
|
|
|
7
|
+
#include "RunningContext.h"
|
|
8
|
+
|
|
8
9
|
extern "C" {
|
|
9
10
|
#include "edhoc.h"
|
|
10
11
|
}
|
|
@@ -15,20 +16,13 @@ extern "C" {
|
|
|
15
16
|
*/
|
|
16
17
|
class EdhocComposeAsyncWorker : public Napi::AsyncWorker {
|
|
17
18
|
public:
|
|
18
|
-
/**
|
|
19
|
-
* @brief The type definition for the callback function.
|
|
20
|
-
*/
|
|
21
|
-
using CallbackType = std::function<void(Napi::Env&)>;
|
|
22
|
-
|
|
23
19
|
/**
|
|
24
20
|
* @brief Constructor for EdhocComposeAsyncWorker.
|
|
25
|
-
* @param
|
|
26
|
-
* @param context The EDHOC context.
|
|
21
|
+
* @param runningContext The pointer to the running context.
|
|
27
22
|
* @param messageNumber The message number.
|
|
28
|
-
* @param callback The callback function.
|
|
29
23
|
*/
|
|
30
|
-
EdhocComposeAsyncWorker(
|
|
31
|
-
|
|
24
|
+
EdhocComposeAsyncWorker(RunningContext* runningContext, int messageNumber);
|
|
25
|
+
|
|
32
26
|
/**
|
|
33
27
|
* @brief Executes the asynchronous worker task.
|
|
34
28
|
*/
|
|
@@ -46,18 +40,10 @@ class EdhocComposeAsyncWorker : public Napi::AsyncWorker {
|
|
|
46
40
|
*/
|
|
47
41
|
void OnError(const Napi::Error& error) override;
|
|
48
42
|
|
|
49
|
-
/**
|
|
50
|
-
* @brief Returns the promise object.
|
|
51
|
-
* @return The promise object.
|
|
52
|
-
*/
|
|
53
|
-
Napi::Promise GetPromise();
|
|
54
|
-
|
|
55
43
|
private:
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
CallbackType callback; ///< The callback function.
|
|
60
|
-
std::vector<uint8_t> composedMessage; ///< The composed message.
|
|
44
|
+
RunningContext* runningContext_; ///< The pointer to the running context.
|
|
45
|
+
int messageNumber_; ///< The message number.
|
|
46
|
+
std::vector<uint8_t> composedMessage_; ///< The composed message.
|
|
61
47
|
};
|
|
62
48
|
|
|
63
49
|
#endif // EDHOC_COMPOSE_ASYNC_WORKER_H
|
|
@@ -7,6 +7,8 @@ extern "C" {
|
|
|
7
7
|
#include "edhoc.h"
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
class RunningContext;
|
|
11
|
+
|
|
10
12
|
/**
|
|
11
13
|
* @class EdhocCredentialManager
|
|
12
14
|
* @brief The EdhocCredentialManager class manages the credentials required for
|
|
@@ -18,14 +20,14 @@ class EdhocCredentialManager {
|
|
|
18
20
|
|
|
19
21
|
/**
|
|
20
22
|
* @struct edhoc_credentials
|
|
21
|
-
* @brief
|
|
23
|
+
* @brief Edhoc's bind structure for authentication credentials.
|
|
22
24
|
*/
|
|
23
25
|
struct edhoc_credentials credentials;
|
|
24
26
|
|
|
25
27
|
/**
|
|
26
28
|
* @brief Constructs an EdhocCredentialManager object.
|
|
27
29
|
*/
|
|
28
|
-
EdhocCredentialManager(Napi::Object& jsCredentialManager);
|
|
30
|
+
EdhocCredentialManager(Napi::Object& jsCredentialManager, Napi::Object& jsEdhoc);
|
|
29
31
|
|
|
30
32
|
/**
|
|
31
33
|
* @brief Destroys the EdhocCredentialManager object.
|
|
@@ -62,7 +64,7 @@ class EdhocCredentialManager {
|
|
|
62
64
|
* fetched credentials.
|
|
63
65
|
* @return EDHOC_SUCCESS if successful, otherwise an error code.
|
|
64
66
|
*/
|
|
65
|
-
int callFetchCredentials(
|
|
67
|
+
int callFetchCredentials(RunningContext* runningContext, struct edhoc_auth_creds* credentials);
|
|
66
68
|
|
|
67
69
|
/**
|
|
68
70
|
* @brief Calls the VerifyCredentials function.
|
|
@@ -73,33 +75,15 @@ class EdhocCredentialManager {
|
|
|
73
75
|
* @param public_key_length Pointer to the length of the public key.
|
|
74
76
|
* @return EDHOC_SUCCESS if successful, otherwise an error code.
|
|
75
77
|
*/
|
|
76
|
-
int callVerifyCredentials(
|
|
78
|
+
int callVerifyCredentials(RunningContext* runningContext,
|
|
77
79
|
struct edhoc_auth_creds* credentials,
|
|
78
80
|
const uint8_t** public_key_reference,
|
|
79
81
|
size_t* public_key_length);
|
|
80
82
|
|
|
81
|
-
/**
|
|
82
|
-
* @brief Sets up the async functions.
|
|
83
|
-
*/
|
|
84
|
-
void SetupAsyncFunctions();
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* @brief Releases the async functions.
|
|
88
|
-
*/
|
|
89
|
-
void CleanupAsyncFunctions();
|
|
90
|
-
|
|
91
83
|
private:
|
|
92
|
-
std::vector<Napi::Reference<Napi::Object>>
|
|
93
|
-
Napi::ObjectReference
|
|
94
|
-
Napi::
|
|
95
|
-
Napi::ThreadSafeFunction verifyTsfn; ///< Thread-safe function for VerifyCredentials
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* @brief Assosciates the thread-safe function with the JS object function.
|
|
99
|
-
* @param name The name of the function in the JS credential manager object.
|
|
100
|
-
* @param tsfn The thread-safe function.
|
|
101
|
-
*/
|
|
102
|
-
void SetFunction(const char* name, Napi::ThreadSafeFunction& tsfn);
|
|
84
|
+
std::vector<Napi::Reference<Napi::Object>> credentialReferences_; ///< References to the JS objects
|
|
85
|
+
Napi::ObjectReference credentialManagerRef_; ///< Reference to the JS object
|
|
86
|
+
Napi::ObjectReference edhocRef_;
|
|
103
87
|
};
|
|
104
88
|
|
|
105
89
|
#endif // EDHOC_CREDENTIAL_MANAGER_H
|