mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-05-08 08:58:38 +01:00
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>
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
// Copyright 2024 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
export function getMockServerPort(
|
||||
serverUrl = window.SignalContext.config.serverUrl
|
||||
): string {
|
||||
const url = new URL(serverUrl);
|
||||
return url.port;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// Copyright 2024 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
export function isMockServer(
|
||||
serverUrl = window.SignalContext.config.serverUrl
|
||||
): boolean {
|
||||
try {
|
||||
const url = new URL(serverUrl);
|
||||
|
||||
return (
|
||||
url.hostname === 'localhost' ||
|
||||
url.hostname === '127.0.0.1' ||
|
||||
url.hostname === '[::1]' // IPv6 loopback address
|
||||
);
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// 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;
|
||||
}
|
||||
Reference in New Issue
Block a user