14 lines
333 B
TypeScript
14 lines
333 B
TypeScript
// Copyright 2023 Signal Messenger, LLC
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
export function bufferToUuid(buffer: Buffer): string {
|
|
const hex = buffer.toString('hex');
|
|
|
|
return [
|
|
hex.substring(0, 8),
|
|
hex.substring(8, 12),
|
|
hex.substring(12, 16),
|
|
hex.substring(16, 20),
|
|
hex.substring(20),
|
|
].join('-');
|
|
}
|