Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# @digitalbazaar/http-digest-header Changelog

## 2.2.1 - 2025-10-dd

### Fixed
- Prevent making an unnecessary copy when encoding bytes.

## 2.2.0 - 2025-10-08

### Changed
Expand Down
6 changes: 4 additions & 2 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
* Copyright (c) 2021-2025 Digital Bazaar, Inc. All rights reserved.
*/
export function base64Encode(bytes) {
return Buffer.from(bytes).toString('base64');
return Buffer.from(bytes.buffer, bytes.offset, bytes.length)
.toString('base64');
}

export function base64urlEncode(bytes) {
return Buffer.from(bytes).toString('base64url');
return Buffer.from(bytes.buffer, bytes.offset, bytes.length)
.toString('base64url');
}