fix: standardize punctuation

This commit is contained in:
Linus Rath
2026-04-16 19:07:42 +02:00
parent 6b57118add
commit 8bdadc7ba3
107 changed files with 452 additions and 448 deletions
+1 -1
View File
@@ -187,7 +187,7 @@ function extractEmailAddresses(cert: pkijs.Certificate): string[] {
names = gn.names;
}
} catch {
// Malformed SAN skip gracefully
// Malformed SAN - skip gracefully
}
}
+2 -2
View File
@@ -21,7 +21,7 @@ import * as pkijs from 'pkijs';
// webcrypto-liner exports a Crypto constructor at runtime that extends native
// Web Crypto with legacy algorithms (3DES, etc.). Its type declarations only
// expose the type alias, so we import the module dynamically and cast.
// Import the ES module build directly the package's "browser" field points
// Import the ES module build directly - the package's "browser" field points
// to a shim-only build that has no named exports (no setCrypto, Crypto, etc.).
// eslint-disable-next-line @typescript-eslint/no-require-imports
const liner = require('webcrypto-liner/build/index.es.js') as {
@@ -55,7 +55,7 @@ function pbeConfig(oid: string): { keyLen: number; ivLen: number; algName: strin
}
/**
* PKCS#12 key derivation RFC 7292, Appendix B.
* PKCS#12 key derivation - RFC 7292, Appendix B.
*
* @param password BMP-encoded password (with trailing 0x00 0x00)
* @param salt raw salt bytes
+1 -1
View File
@@ -275,7 +275,7 @@ function cmsToBase64Blob(data: Blob | ArrayBuffer | Uint8Array): Blob {
} else if (data instanceof ArrayBuffer) {
bytes = new Uint8Array(data);
} else {
// Blob we need sync; caller should have converted. Fallback to empty.
// Blob - we need sync; caller should have converted. Fallback to empty.
bytes = new Uint8Array(0);
}
const b64 = base64Encode(bytes.buffer as ArrayBuffer);
+1 -1
View File
@@ -106,7 +106,7 @@ export async function exportPkcs12(
parsedValue: {
safeContents: [
{
privacyMode: 0, // no extra encryption key bag is already shrouded
privacyMode: 0, // no extra encryption - key bag is already shrouded
value: new pkijs.SafeContents({
safeBags: [keyBagSafe],
}),
+1 -1
View File
@@ -89,7 +89,7 @@ export async function importPkcs12(
cert = certBag.parsedValue;
der = cert.toSchema(true).toBER(false);
} else if (certBag.certId === '1.2.840.113549.1.9.22.1' && certBag.certValue) {
// x509Certificate extract DER from the OCTET STRING
// x509Certificate - extract DER from the OCTET STRING
const certDerBytes = (certBag.certValue as asn1js.OctetString).valueBlock.valueHexView;
const certAsn1 = asn1js.fromBER(certDerBytes);
if (certAsn1.offset !== -1) {
+5 -5
View File
@@ -78,7 +78,7 @@ export async function smimeDecrypt(input: DecryptionInput): Promise<DecryptionRe
continue;
}
}
continue; // Key exists but isn't unlocked skip, caller should unlock first
continue; // Key exists but isn't unlocked - skip, caller should unlock first
}
try {
@@ -170,7 +170,7 @@ export function normalizeCmsBytes(raw: ArrayBuffer): ArrayBuffer {
const bytes = new Uint8Array(raw);
// Already valid DER starts with ASN.1 SEQUENCE tag
// Already valid DER - starts with ASN.1 SEQUENCE tag
if (bytes[0] === 0x30) {
return raw;
}
@@ -272,19 +272,19 @@ export function normalizeCmsBytes(raw: ArrayBuffer): ArrayBuffer {
}
}
// Not decodable return original bytes
// Not decodable - return original bytes
return raw;
}
function parseContentInfo(der: ArrayBuffer): pkijs.ContentInfo {
const asn1 = asn1js.fromBER(der);
if (asn1.offset === -1) {
throw new Error('Invalid ASN.1 data cannot parse CMS envelope');
throw new Error('Invalid ASN.1 data - cannot parse CMS envelope');
}
try {
return new pkijs.ContentInfo({ schema: asn1.result });
} catch {
throw new Error('Invalid ASN.1 data cannot parse CMS envelope');
throw new Error('Invalid ASN.1 data - cannot parse CMS envelope');
}
}
+1 -1
View File
@@ -69,7 +69,7 @@ export function detectSmime(
supported: true,
};
}
// Generic pkcs7-mime without explicit smime-type try bodyStructure
// Generic pkcs7-mime without explicit smime-type - try bodyStructure
const part = findCmsPart(bodyStructure, null);
if (part) {
const partType = inferSmimeType(part);
+1 -1
View File
@@ -6,7 +6,7 @@ import { parseCertificateDer } from './certificate-utils';
* Produce an opaque CMS SignedData wrapping the given MIME content.
*
* Content type: application/pkcs7-mime; smime-type=signed-data
* This is the "opaque" form the content is embedded inside the CMS structure.
* This is the "opaque" form - the content is embedded inside the CMS structure.
*/
export async function smimeSign(
mimeBytes: Uint8Array,
+1 -1
View File
@@ -132,7 +132,7 @@ export async function smimeVerify(
function parseContentInfo(der: ArrayBuffer): pkijs.ContentInfo {
const asn1 = asn1js.fromBER(der);
if (asn1.offset === -1) {
throw new Error('Invalid ASN.1 data cannot parse CMS structure');
throw new Error('Invalid ASN.1 data - cannot parse CMS structure');
}
return new pkijs.ContentInfo({ schema: asn1.result });
}