Skip to content

pemDecode

Extracts and base64-decodes the DER content from a PEM string.

Returns a typed failure (code: 'malformed') when the BEGIN/END markers don't match label or the body is not valid base64. For the throwing form use pemDecodeOrThrow.

ts
function pemDecode(
	label: string,
	pem: string,
): PemDecodeResult

Parameters

  • label: string
  • pem: string

Released under the MIT License.