1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-25 12:43:36 +00:00

[EC-598] fix: properly convert credentials to guid raw format

This commit is contained in:
Andreas Coroiu
2023-03-28 15:50:01 +02:00
parent c882c37f82
commit 80fbfc9d13
3 changed files with 25 additions and 10 deletions

View File

@@ -618,7 +618,11 @@ export class Utils {
}
/** Convert raw 16 byte array to standard format (XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX) UUID. */
static guidToStandardFormat(arr: Uint8Array) {
static guidToStandardFormat(bufferSource: BufferSource) {
const arr =
bufferSource instanceof ArrayBuffer
? new Uint8Array(bufferSource)
: new Uint8Array(bufferSource.buffer);
// Note: Be careful editing this code! It's been tuned for performance
// and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
const guid = (