@swarp/cli 0.0.1 → 0.0.2-rc.19
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/package.json +1 -1
- package/src/certs/generate.mjs +6 -1
package/package.json
CHANGED
package/src/certs/generate.mjs
CHANGED
|
@@ -54,7 +54,12 @@ function set_(...items) {
|
|
|
54
54
|
|
|
55
55
|
function integerFromBuffer(buf) {
|
|
56
56
|
const b = Buffer.isBuffer(buf) ? buf : Buffer.from(buf);
|
|
57
|
-
|
|
57
|
+
// Strip leading zeros — DER requires minimal integer encoding
|
|
58
|
+
let start = 0;
|
|
59
|
+
while (start < b.length - 1 && b[start] === 0x00) start++;
|
|
60
|
+
const trimmed = start > 0 ? b.subarray(start) : b;
|
|
61
|
+
// Add padding zero if high bit set (positive integer must not look negative)
|
|
62
|
+
const prefixed = trimmed[0] & 0x80 ? Buffer.concat([Buffer.from([0x00]), trimmed]) : trimmed;
|
|
58
63
|
return tlv(TAG.INTEGER, prefixed);
|
|
59
64
|
}
|
|
60
65
|
|