[doc] update show doc

This commit is contained in:
SouthFox 2023-07-14 00:42:26 +08:00
parent 44e0bc4046
commit a49cec70b2

View file

@ -105,7 +105,7 @@ ME = {
#+end_src
#+begin_src python
@app.route(f"/user/{config.USERNAME}")
@app.route(f"/user/{config.USERNAME}") # /user/show
def locate_user() -> Response:
"""Return user ActivityPub response."""
resp = jsonify(ME)
@ -168,7 +168,6 @@ GET http://coscup.localhost/.well-known/webfinger?resource=acct:show@coscup.loca
other.localhost --Follow-> coscup.localhost
#+NAME: payload_block
#+begin_src json
# request.data
{
@ -179,7 +178,7 @@ other.localhost --Follow-> coscup.localhost
"object": "http://coscup.localhost/meow/show"
}
# request.data
# request.header
{
"host":"other.localhost",
"accept":"*/*",
@ -213,6 +212,7 @@ def parse_signature(
return signature_details
#+end_src
parse_signature(headers["signature"])
#+begin_src json
{"algorithm": "rsa-sha256",
@ -230,7 +230,6 @@ def calculate_digest(
payload: bytes,
) -> str:
"""Calculate digest for given HTTP payload."""
if "sha-256" == algorithm:
payload_digest = SHA256.new()
payload_digest.update(body)
return "SHA-256=" + \
@ -258,7 +257,7 @@ def build_signature_string(
build_signature_string(
request.method # "post"
request.path # "/inbox"
parse_signature(headers["signature"])["headers"],
parse_signature(headers["signature"])["headers"], # ["(request-target)", "user-agent", "host", "date", "digest", "content-type"]
calculate_digest(request.data),
headers,
)