fix: PEM bundle parsing
This commit is contained in:
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "azure-acme-provisioner",
|
"name": "azure-acme-provisioner",
|
||||||
"version": "0.6.0",
|
"version": "0.6.1",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "azure-acme-provisioner",
|
"name": "azure-acme-provisioner",
|
||||||
"version": "0.6.0",
|
"version": "0.6.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@azure/arm-authorization": "^9.0.0",
|
"@azure/arm-authorization": "^9.0.0",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "azure-acme-provisioner",
|
"name": "azure-acme-provisioner",
|
||||||
"version": "0.6.0",
|
"version": "0.6.1",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Sławomir Koszewski",
|
"name": "Sławomir Koszewski",
|
||||||
"url": "https://github.com/skoszewski"
|
"url": "https://github.com/skoszewski"
|
||||||
|
|||||||
+1
-1
@@ -41,7 +41,7 @@ export function pfxToPem(pfxBuffer: Buffer, password = ''): PemBundle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function parsePemBundle(bundle: string): PemBundle {
|
export function parsePemBundle(bundle: string): PemBundle {
|
||||||
const blocks = bundle.match(/-----BEGIN [^-]+-----[\s\S]+?-----END [^-]+-----/g) ?? [];
|
const blocks = bundle.replace(/\\n/g, '\n').match(/-----BEGIN [^-]+-----[\s\S]+?-----END [^-]+-----/g) ?? [];
|
||||||
const privateKeyPem = blocks.find(b => b.includes('PRIVATE KEY')) ?? '';
|
const privateKeyPem = blocks.find(b => b.includes('PRIVATE KEY')) ?? '';
|
||||||
const certs = blocks.filter(b => b.includes('CERTIFICATE'));
|
const certs = blocks.filter(b => b.includes('CERTIFICATE'));
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user