File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# @digitalbazaar/http-digest-header Changelog
22
3+ ## 2.3.0 - 2025-10-dd
4+
5+ ### Added
6+ - Support parsing a digest from structured field value, i.e., expressed as
7+ a base64-encoded byte array that is wrapped in colons;
8+ see: https://datatracker.ietf.org/doc/html/rfc9651#name-byte-sequences .
9+
310## 2.2.1 - 2025-10-08
411
512### Fixed
Original file line number Diff line number Diff line change @@ -76,12 +76,13 @@ function _createMultihash({digest}) {
7676}
7777
7878function _parseHeaderValue ( headerValue ) {
79- const [ key , digest ] = headerValue . split ( / = ( .+ ) / ) ;
79+ const [ key , digestValue ] = headerValue . split ( / = ( .+ ) / ) ;
8080
8181 let encodedDigest ;
8282 let algorithm ;
8383 if ( key === 'mh' ) {
84- encodedDigest = digest ;
84+ encodedDigest = digestValue ;
85+
8586 // if `encodedDigest` starts with `uEi`, then it is a base64url-encoded
8687 // sha-256 multihash
8788 if ( encodedDigest . startsWith ( 'uEi' ) ) {
@@ -91,8 +92,9 @@ function _parseHeaderValue(headerValue) {
9192 `Only base64url-encoded, sha-256 multihash is supported.` ) ;
9293 }
9394 } else {
94- // Unwrap in case the base64-encoded digest bytes are wrapped in colons
95- encodedDigest = digest ?. replace ( / ^ : ( .* ) : $ / , '$1' ) ;
95+ // per RFC 9651, the digest value could be a structured field value,
96+ // expressed as a base64-encoded byte array wrapped in colons
97+ encodedDigest = digestValue ?. replace ( / ^ : ( .* ) : $ / , '$1' ) ;
9698
9799 algorithm = key . replace ( '-' , '' ) . toLowerCase ( ) ;
98100 if ( algorithm !== 'sha256' ) {
You can’t perform that action at this time.
0 commit comments