@ai-ecoverse/slicc-kernel 1.133.2 → 1.133.3

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.
@@ -6520,7 +6520,7 @@ var KERNEL_VERSION, OS_RELEASE;
6520
6520
  var init_version = __esm({
6521
6521
  "src/version.ts"() {
6522
6522
  "use strict";
6523
- KERNEL_VERSION = true ? "1.133.2" : "0.0.0-dev";
6523
+ KERNEL_VERSION = true ? "1.133.3" : "0.0.0-dev";
6524
6524
  OS_RELEASE = "6.0.0-slicc";
6525
6525
  }
6526
6526
  });
package/dist/node.js CHANGED
@@ -7403,7 +7403,7 @@ function satisfies(version, range2) {
7403
7403
  }
7404
7404
 
7405
7405
  // src/version.ts
7406
- var KERNEL_VERSION = true ? "1.133.2" : "0.0.0-dev";
7406
+ var KERNEL_VERSION = true ? "1.133.3" : "0.0.0-dev";
7407
7407
  var OS_RELEASE = "6.0.0-slicc";
7408
7408
  function procVersion() {
7409
7409
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -19342,10 +19342,32 @@ var KEY_ERRORS = [
19342
19342
  [-15232, "ERR_OSSL_BAD_DECRYPT"],
19343
19343
  [-15360, "ERR_OSSL_CRYPTO_INTERRUPTED_OR_CANCELLED"]
19344
19344
  ];
19345
- function keyRefused(err) {
19346
- const code = err instanceof TlsError ? err.code : 0;
19345
+ var PBE_OIDS = [
19346
+ [42, 134, 72, 134, 247, 13, 1, 5],
19347
+ [42, 134, 72, 134, 247, 13, 1, 12, 1]
19348
+ ];
19349
+ function hasBytes(hay, needle) {
19350
+ for (let i = 0; i + needle.length <= hay.length; i++) {
19351
+ if (needle.every((b, j) => hay[i + j] === b)) return true;
19352
+ }
19353
+ return false;
19354
+ }
19355
+ function encryptedKey(key) {
19356
+ if (key[0] === 48) return PBE_OIDS.some((oid2) => hasBytes(key, oid2));
19357
+ return new TextDecoder().decode(key).includes("ENCRYPTED");
19358
+ }
19359
+ var KEY_PARSE_RANGES = [
19360
+ [-16383, -14336],
19361
+ [-5375, -4096],
19362
+ [-28671, -24576],
19363
+ [-127, -96]
19364
+ ];
19365
+ var keyParse = (code) => code !== -15360 && KEY_PARSE_RANGES.some(([lo, hi]) => code >= lo && code <= hi);
19366
+ function keyRefused(err, locked) {
19367
+ const raw2 = err instanceof TlsError ? err.code : 0;
19368
+ const code = locked && keyParse(raw2) ? -15232 : raw2;
19347
19369
  const name2 = KEY_ERRORS.find(([n]) => n === code)?.[1] ?? "ERR_OSSL_UNSUPPORTED";
19348
- const text = code === -3 ? "the key does not match the certificate" : err.message;
19370
+ const text = code === -3 ? "the key does not match the certificate" : code === raw2 ? err.message : "bad decrypt";
19349
19371
  return new KernelError("EPROTO", `${name2}: ${text}`);
19350
19372
  }
19351
19373
  function takeCert(req) {
@@ -19376,7 +19398,7 @@ function withCert(session, cert) {
19376
19398
  try {
19377
19399
  session.ownCert(cert.chain, cert.key, cert.pass);
19378
19400
  } catch (err) {
19379
- throw keyRefused(err);
19401
+ throw keyRefused(err, cert.pass.length > 0 && encryptedKey(cert.key));
19380
19402
  }
19381
19403
  }
19382
19404
  function wipe(cert) {