Skip to content
This repository was archived by the owner on Feb 4, 2026. It is now read-only.

Fix request logging middleware#84

Closed
kentbull wants to merge 99 commits intohyperledger-labs:mainfrom
kentbull:fix-request-logging-middleware
Closed

Fix request logging middleware#84
kentbull wants to merge 99 commits intohyperledger-labs:mainfrom
kentbull:fix-request-logging-middleware

Conversation

@kentbull
Copy link
Copy Markdown
Contributor

The prior version of the RequestLoggerMiddleware would consume the request body stream with req.stream.read() which broke things because the stream is a one-shot IO read meaning that the stream must be reset in order to be later consumed by the Falcon HTTP request handler. The logging was also updated to use placeholders rather than f-strings for performance.

m00sey and others added 30 commits March 18, 2025 12:46
Signed-off-by: Kevin Griffin <griffin.kev@gmail.com>
Signed-off-by: Kevin Griffin <griffin.kev@gmail.com>
Signed-off-by: Kevin Griffin <griffin.kev@gmail.com>
Signed-off-by: Kevin Griffin <griffin.kev@gmail.com>
Signed-off-by: Kevin Griffin <griffin.kev@gmail.com>
Signed-off-by: Kevin Griffin <griffin.kev@gmail.com>
Signed-off-by: Kevin Griffin <griffin.kev@gmail.com>
Signed-off-by: Kevin Griffin <griffin.kev@gmail.com>
Signed-off-by: Kevin Griffin <griffin.kev@gmail.com>
wip - updating to 1.2+ fixing tests and build
Signed-off-by: Kevin Griffin <griffin.kev@gmail.com>
Signed-off-by: Kevin Griffin <griffin.kev@gmail.com>
Signed-off-by: Kevin Griffin <griffin.kev@gmail.com>
Signed-off-by: Kevin Griffin <griffin.kev@gmail.com>
Signed-off-by: Kevin Griffin <griffin.kev@gmail.com>
Signed-off-by: Kevin Griffin <griffin.kev@gmail.com>
Signed-off-by: Kevin Griffin <griffin.kev@gmail.com>
Signed-off-by: Kevin Griffin <griffin.kev@gmail.com>
Signed-off-by: Kevin Griffin <griffin.kev@gmail.com>
Signed-off-by: Kevin Griffin <griffin.kev@gmail.com>
Signed-off-by: Kevin Griffin <griffin.kev@gmail.com>
Signed-off-by: Kevin Griffin <griffin.kev@gmail.com>
Signed-off-by: Kevin Griffin <griffin.kev@gmail.com>
Signed-off-by: Kevin Griffin <griffin.kev@gmail.com>
Fix KERIpy iterators, logging, docker build, constants imports
kentbull and others added 28 commits July 23, 2025 11:59
PEP 3333 compatibility requires the URL path be URL encoded which breaks resolution. So we will have to detect URL encoded paths, decode them, and construct a DID string with the port properly URL encoded while the rest of the colons in the DID remain unencoded.
Using the inner self.resolve_oobi requires use of yield from in order to direct the HIO Doist to run the sub-generator.
We should not be using the OOBI parameter to resolve keystate to then allow for DID artifact resolution. Instead we should only be generating did.json and keri.cesr artifacts for KELs, TELs, and ACDCs from only the local keystore.

Building a did:webs DID artifact generator for any resolved KERI AID is a separate project and is out of scope for this resolver.

Many tests were added in this commit which caused many small refactorings to make things more testable and to make consistent APIs.
Refactored to make testing easier and to ensure consistent Regery and Reger database usage. Moved requote to didding where it belongs. Made a few more small functions for testability.
it was determined that OOBI resolution is critical for did:keri resolution because there is not enough information in a did:keri to know where to resolve it from, thus an OOBI is required for anything that is non-local.
… gen ends

This adds integration tests for the endpoints that dynamically generate did.json and keri.cesr files. It also adds a feature for auto-wrapping a did.json document in did resolution metadata when the metadata is requested, which is useful and avoids unnecessary error responses when static did.json files do not have resolution metadata.

This also adds request logging for did.json and keri.cesr file resolution for log monitoring usability.
The delegation chain is necessary when using delegated identifiers. This fixes that.

The missing ACDC anchor was a long-standing bug that prevented generation of both equivalentIds and alsoKnownAs based on the keri.cesr since the anchor tieing the designated aliases ACDC to the KEL for the AID being resolved was missing from the keri.cesr CESR stream.
…ead of 'null' for None

And this commit has many related testing and slight refactoring additions.
The Docker Compose setup uses the test-resolutions.sh script to show sample usage of this repo. This is added to make it clear how to use the did:webs resolver.
The spec says to use https, not http, for the did.json and keri.cesr files. This corrects that mistake and also adds a fallback from https to http for local testing and for a nice feature for those who do not want to set up https.
Refactor to non-hardcoded controller use small functions
Getting the port from X-Forwarded-Port allows the DIDWebsResourceEnd to generate the correct did:webs did for proxied deployments of this resource. This does depend on the proxy sending the X-Forwarded-Port through.
…esolution-content-type

feat: application/did-resolution for DID HTTP Binding and X-Forwarded-Port for proxy config
The Revery was not added to the Kevery prior to parsing and as such was dropping reply messages. This reordering of instantiation and passing of rvy to Kevery fixes that.
Use of the requests library is temporarily employed since the exception handling is there and tested. Moving to HIO for simple URL requests will occur in the future.
It was decided that the name "dws" is more in line with what people would expect from this repository so the package name was changed from "dkr", which was a holdover from the did:keri work, to "dws" to illustrate the primary nature of the repository of serving as a did:webs DID resolver.
The prior version of the RequestLoggerMiddleware would consume the request body stream with req.stream.read() which broke things because the stream is a one-shot IO read meaning that the stream must be reset in order to be later consumed by the Falcon HTTP request handler. The logging was also updated to use placeholders rather than f-strings for performance.
@kentbull kentbull closed this Aug 20, 2025
@codecov-commenter
Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants