node-opcua-crypto-web 6.1.3 → 6.2.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_web.d.ts +1 -0
- package/dist/index_web.js +24 -14
- package/package.json +4 -4
package/dist/index_web.d.ts
CHANGED
|
@@ -292,6 +292,7 @@ interface SubjectPublicKeyInfo {
|
|
|
292
292
|
interface BasicConstraints {
|
|
293
293
|
critical: boolean;
|
|
294
294
|
cA: boolean;
|
|
295
|
+
/** Maximum number of CA certificates below this one; undefined when the certificate sets no limit. */
|
|
295
296
|
pathLengthConstraint?: number;
|
|
296
297
|
}
|
|
297
298
|
interface AuthorityKeyIdentifier {
|
package/dist/index_web.js
CHANGED
|
@@ -42141,6 +42141,7 @@ __export(node_crypto_shim_exports, {
|
|
|
42141
42141
|
createHmac: () => createHmac,
|
|
42142
42142
|
createPrivateKey: () => createPrivateKey,
|
|
42143
42143
|
createPublicKey: () => createPublicKey,
|
|
42144
|
+
createSecretKey: () => createSecretKey,
|
|
42144
42145
|
createSign: () => createSign,
|
|
42145
42146
|
createVerify: () => createVerify,
|
|
42146
42147
|
default: () => node_crypto_shim_default,
|
|
@@ -42295,7 +42296,7 @@ function createPrivateKey(input) {
|
|
|
42295
42296
|
}
|
|
42296
42297
|
};
|
|
42297
42298
|
}
|
|
42298
|
-
var import_crypto_browserify, createHash, createHmac, createSign, createVerify, createCipheriv, createDecipheriv, publicEncrypt, privateDecrypt, randomBytes, pseudoRandomBytes, getCiphers, getHashes, pbkdf2, pbkdf2Sync, getDiffieHellman, createDiffieHellman, createECDH, randomFillSync, randomFill, node_crypto_shim_default;
|
|
42299
|
+
var import_crypto_browserify, createHash, createHmac, createSign, createVerify, createCipheriv, createDecipheriv, publicEncrypt, privateDecrypt, randomBytes, pseudoRandomBytes, getCiphers, getHashes, pbkdf2, pbkdf2Sync, getDiffieHellman, createDiffieHellman, createECDH, randomFillSync, randomFill, createSecretKey, node_crypto_shim_default;
|
|
42299
42300
|
var init_node_crypto_shim = __esm({
|
|
42300
42301
|
"shims/node-crypto-shim.js"() {
|
|
42301
42302
|
"use strict";
|
|
@@ -42320,6 +42321,7 @@ var init_node_crypto_shim = __esm({
|
|
|
42320
42321
|
createECDH = import_crypto_browserify.default.createECDH;
|
|
42321
42322
|
randomFillSync = import_crypto_browserify.default.randomFillSync;
|
|
42322
42323
|
randomFill = import_crypto_browserify.default.randomFill;
|
|
42324
|
+
createSecretKey = void 0;
|
|
42323
42325
|
node_crypto_shim_default = {
|
|
42324
42326
|
...import_crypto_browserify.default,
|
|
42325
42327
|
createPublicKey,
|
|
@@ -47198,7 +47200,7 @@ function readBasicConstraint2_5_29_19(buffer, _block) {
|
|
|
47198
47200
|
const block_info = readTag(buffer, 0);
|
|
47199
47201
|
const inner_blocks = readStruct(buffer, block_info).slice(0, 2);
|
|
47200
47202
|
let cA = false;
|
|
47201
|
-
let pathLengthConstraint
|
|
47203
|
+
let pathLengthConstraint;
|
|
47202
47204
|
let breakControl = 0;
|
|
47203
47205
|
for (const inner_block of inner_blocks) {
|
|
47204
47206
|
switch (inner_block.tag) {
|
|
@@ -62905,6 +62907,16 @@ function computePaddingFooter(buffer, derivedKeys) {
|
|
|
62905
62907
|
padding.fill(paddingSize);
|
|
62906
62908
|
return padding;
|
|
62907
62909
|
}
|
|
62910
|
+
var keyObjects = /* @__PURE__ */ new WeakMap();
|
|
62911
|
+
function keyObjectOf(key) {
|
|
62912
|
+
if (typeof createSecretKey !== "function") return key;
|
|
62913
|
+
let keyObject = keyObjects.get(key);
|
|
62914
|
+
if (!keyObject) {
|
|
62915
|
+
keyObject = createSecretKey(key);
|
|
62916
|
+
keyObjects.set(key, keyObject);
|
|
62917
|
+
}
|
|
62918
|
+
return keyObject;
|
|
62919
|
+
}
|
|
62908
62920
|
function derivedKeys_algorithm(derivedKeys) {
|
|
62909
62921
|
(0, import_node_assert7.default)(Object.hasOwn(derivedKeys, "algorithm"));
|
|
62910
62922
|
const algorithm = derivedKeys.algorithm || "aes-128-cbc";
|
|
@@ -62915,30 +62927,28 @@ function encryptBufferWithDerivedKeys(buffer, derivedKeys) {
|
|
|
62915
62927
|
const algorithm = derivedKeys_algorithm(derivedKeys);
|
|
62916
62928
|
const key = derivedKeys.encryptingKey;
|
|
62917
62929
|
const initVector = derivedKeys.initializationVector;
|
|
62918
|
-
const cipher = createCipheriv(algorithm, key, initVector);
|
|
62930
|
+
const cipher = createCipheriv(algorithm, keyObjectOf(key), initVector);
|
|
62919
62931
|
cipher.setAutoPadding(false);
|
|
62920
|
-
const
|
|
62921
|
-
|
|
62922
|
-
|
|
62923
|
-
return import_buffer.Buffer.concat(encrypted_chunks);
|
|
62932
|
+
const encrypted = cipher.update(buffer);
|
|
62933
|
+
const tail2 = cipher.final();
|
|
62934
|
+
return tail2.length === 0 ? encrypted : import_buffer.Buffer.concat([encrypted, tail2]);
|
|
62924
62935
|
}
|
|
62925
62936
|
function decryptBufferWithDerivedKeys(buffer, derivedKeys) {
|
|
62926
62937
|
const algorithm = derivedKeys_algorithm(derivedKeys);
|
|
62927
62938
|
const key = derivedKeys.encryptingKey;
|
|
62928
62939
|
const initVector = derivedKeys.initializationVector;
|
|
62929
|
-
const cipher = createDecipheriv(algorithm, key, initVector);
|
|
62940
|
+
const cipher = createDecipheriv(algorithm, keyObjectOf(key), initVector);
|
|
62930
62941
|
cipher.setAutoPadding(false);
|
|
62931
|
-
const
|
|
62932
|
-
|
|
62933
|
-
|
|
62934
|
-
return import_buffer.Buffer.concat(decrypted_chunks);
|
|
62942
|
+
const decrypted = cipher.update(buffer);
|
|
62943
|
+
const tail2 = cipher.final();
|
|
62944
|
+
return tail2.length === 0 ? decrypted : import_buffer.Buffer.concat([decrypted, tail2]);
|
|
62935
62945
|
}
|
|
62936
62946
|
function makeMessageChunkSignatureWithDerivedKeys(message, derivedKeys) {
|
|
62937
62947
|
(0, import_node_assert7.default)(import_buffer.Buffer.isBuffer(message));
|
|
62938
62948
|
(0, import_node_assert7.default)(import_buffer.Buffer.isBuffer(derivedKeys.signingKey));
|
|
62939
62949
|
(0, import_node_assert7.default)(typeof derivedKeys.sha1or256 === "string");
|
|
62940
62950
|
(0, import_node_assert7.default)(derivedKeys.sha1or256 === "SHA1" || derivedKeys.sha1or256 === "SHA256");
|
|
62941
|
-
const signature = createHmac(derivedKeys.sha1or256, derivedKeys.signingKey).update(message).digest();
|
|
62951
|
+
const signature = createHmac(derivedKeys.sha1or256, keyObjectOf(derivedKeys.signingKey)).update(message).digest();
|
|
62942
62952
|
(0, import_node_assert7.default)(signature.length === derivedKeys.signatureLength);
|
|
62943
62953
|
return signature;
|
|
62944
62954
|
}
|
|
@@ -62946,7 +62956,7 @@ function verifyChunkSignatureWithDerivedKeys(chunk, derivedKeys) {
|
|
|
62946
62956
|
const message = chunk.subarray(0, chunk.length - derivedKeys.signatureLength);
|
|
62947
62957
|
const expectedSignature = chunk.subarray(chunk.length - derivedKeys.signatureLength);
|
|
62948
62958
|
const computedSignature = makeMessageChunkSignatureWithDerivedKeys(message, derivedKeys);
|
|
62949
|
-
return computedSignature.
|
|
62959
|
+
return computedSignature.equals(expectedSignature);
|
|
62950
62960
|
}
|
|
62951
62961
|
|
|
62952
62962
|
// ../node-opcua-crypto/source/key_operations/local_key_operations.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-opcua-crypto-web",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Pre-bundled, zero-config browser build of node-opcua-crypto",
|
|
6
6
|
"//why": "This package exists so node-opcua-crypto can stay lean for Node. The pre-bundled browser build inlines its polyfills (crypto-browserify, stream-browserify, ...) and weighs ~344 KB gzip - more than the entire node-opcua-crypto tarball. Shipping it there would make every Node consumer download a browser bundle they never import. Browser consumers install this package explicitly, or let node-opcua-crypto's \"browser\" export condition redirect to it (see node-opcua-crypto/browser/index.js).",
|
|
@@ -37,14 +37,14 @@
|
|
|
37
37
|
"license": "MIT",
|
|
38
38
|
"//devDependencies": "every one of these is inlined into dist/ at build time (tsup noExternal), so this package has no runtime dependencies at all.",
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@types/node": "^24.19.
|
|
40
|
+
"@types/node": "^24.19.1",
|
|
41
41
|
"assert": "^2.1.0",
|
|
42
42
|
"buffer": "^6.0.3",
|
|
43
43
|
"constants-browserify": "^1.0.0",
|
|
44
44
|
"crypto-browserify": "^3.12.1",
|
|
45
45
|
"esbuild": "^0.28.2",
|
|
46
46
|
"events": "^3.3.0",
|
|
47
|
-
"node-opcua-crypto": "^6.
|
|
47
|
+
"node-opcua-crypto": "^6.2.0",
|
|
48
48
|
"path-browserify": "^1.0.1",
|
|
49
49
|
"process": "^0.11.10",
|
|
50
50
|
"stream-browserify": "^3.0.0",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"LICENSE",
|
|
68
68
|
"README.md"
|
|
69
69
|
],
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "ba3f9e5151ed01aab242b2807556a49692bc59db"
|
|
71
71
|
}
|