signal-desktop/ts/util/pemToDer.ts
andrew-signal 9c99796937
Update libsignal to v0.59.0, add support for mock server test with libsignal
Co-authored-by: trevor-signal <trevor@signal.org>
Co-authored-by: Fedor Indutny <indutny@signal.org>
2024-10-21 12:27:58 -07:00

11 lines
341 B
TypeScript

// Copyright 2024 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
export function pemToDer(pem: string): Buffer {
const pemContent = pem
.replace(/-----BEGIN [^-]+-----/, '')
.replace(/-----END [^-]+-----/, '')
.replace(/\s+/g, '');
const derBuffer = Buffer.from(pemContent, 'base64');
return derBuffer;
}