@openmdm/core 0.6.0 → 0.7.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/dist/index.d.ts +4 -3
- package/dist/index.js +12 -3
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
- package/src/index.ts +16 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openmdm/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Core MDM SDK - device management, policies, and commands",
|
|
5
5
|
"author": "OpenMDM Contributors",
|
|
6
6
|
"type": "module",
|
|
@@ -33,7 +33,8 @@
|
|
|
33
33
|
"tsup": "^8.0.0",
|
|
34
34
|
"typescript": "^5.5.0",
|
|
35
35
|
"vitest": "^2.0.0",
|
|
36
|
-
"@vitest/coverage-v8": "^2.0.0"
|
|
36
|
+
"@vitest/coverage-v8": "^2.0.0",
|
|
37
|
+
"@openmdm/client": "0.2.1"
|
|
37
38
|
},
|
|
38
39
|
"peerDependencies": {},
|
|
39
40
|
"keywords": [
|
package/src/index.ts
CHANGED
|
@@ -1328,7 +1328,7 @@ function createStubPushAdapter(): PushAdapter {
|
|
|
1328
1328
|
// Utility Functions
|
|
1329
1329
|
// ============================================
|
|
1330
1330
|
|
|
1331
|
-
function verifyEnrollmentSignature(
|
|
1331
|
+
export function verifyEnrollmentSignature(
|
|
1332
1332
|
request: EnrollmentRequest,
|
|
1333
1333
|
secret: string
|
|
1334
1334
|
): boolean {
|
|
@@ -1338,11 +1338,21 @@ function verifyEnrollmentSignature(
|
|
|
1338
1338
|
return false;
|
|
1339
1339
|
}
|
|
1340
1340
|
|
|
1341
|
-
// Reconstruct the message that was signed
|
|
1342
|
-
//
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
const message =
|
|
1341
|
+
// Reconstruct the message that was signed. This must stay in lockstep with
|
|
1342
|
+
// @openmdm/client's generateEnrollmentSignature — any change here is a wire
|
|
1343
|
+
// break and must land in both places. A contract test in core/tests guards
|
|
1344
|
+
// the format and will fail on divergence.
|
|
1345
|
+
const message = [
|
|
1346
|
+
data.model,
|
|
1347
|
+
data.manufacturer,
|
|
1348
|
+
data.osVersion,
|
|
1349
|
+
data.serialNumber || '',
|
|
1350
|
+
data.imei || '',
|
|
1351
|
+
data.macAddress || '',
|
|
1352
|
+
data.androidId || '',
|
|
1353
|
+
data.method,
|
|
1354
|
+
data.timestamp,
|
|
1355
|
+
].join('|');
|
|
1346
1356
|
|
|
1347
1357
|
const expectedSignature = createHmac('sha256', secret)
|
|
1348
1358
|
.update(message)
|