Skip to content

categorizePemBlocks

Groups PEM blocks by label into well-known PKI categories (certificates, CSRs, private keys, public keys, and everything else). Accepts either raw PEM text or pre-split PemBlock entries.

Returns a typed failure (code: 'malformed') when raw text contains stray or truncated PEM markers. For the throwing form use categorizePemBlocksOrThrow.

ts
function categorizePemBlocks(
	input: string | readonly PemBlock[],
): CategorizePemBlocksResult

Parameters

Released under the MIT License.