[doc] update show doc
This commit is contained in:
parent
44e0bc4046
commit
a49cec70b2
1 changed files with 10 additions and 11 deletions
|
@ -105,7 +105,7 @@ ME = {
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
#+begin_src python
|
#+begin_src python
|
||||||
@app.route(f"/user/{config.USERNAME}")
|
@app.route(f"/user/{config.USERNAME}") # /user/show
|
||||||
def locate_user() -> Response:
|
def locate_user() -> Response:
|
||||||
"""Return user ActivityPub response."""
|
"""Return user ActivityPub response."""
|
||||||
resp = jsonify(ME)
|
resp = jsonify(ME)
|
||||||
|
@ -168,7 +168,6 @@ GET http://coscup.localhost/.well-known/webfinger?resource=acct:show@coscup.loca
|
||||||
|
|
||||||
other.localhost --Follow-> coscup.localhost
|
other.localhost --Follow-> coscup.localhost
|
||||||
|
|
||||||
#+NAME: payload_block
|
|
||||||
#+begin_src json
|
#+begin_src json
|
||||||
# request.data
|
# request.data
|
||||||
{
|
{
|
||||||
|
@ -179,7 +178,7 @@ other.localhost --Follow-> coscup.localhost
|
||||||
"object": "http://coscup.localhost/meow/show"
|
"object": "http://coscup.localhost/meow/show"
|
||||||
}
|
}
|
||||||
|
|
||||||
# request.data
|
# request.header
|
||||||
{
|
{
|
||||||
"host":"other.localhost",
|
"host":"other.localhost",
|
||||||
"accept":"*/*",
|
"accept":"*/*",
|
||||||
|
@ -213,6 +212,7 @@ def parse_signature(
|
||||||
return signature_details
|
return signature_details
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
|
||||||
parse_signature(headers["signature"])
|
parse_signature(headers["signature"])
|
||||||
#+begin_src json
|
#+begin_src json
|
||||||
{"algorithm": "rsa-sha256",
|
{"algorithm": "rsa-sha256",
|
||||||
|
@ -230,7 +230,6 @@ def calculate_digest(
|
||||||
payload: bytes,
|
payload: bytes,
|
||||||
) -> str:
|
) -> str:
|
||||||
"""Calculate digest for given HTTP payload."""
|
"""Calculate digest for given HTTP payload."""
|
||||||
if "sha-256" == algorithm:
|
|
||||||
payload_digest = SHA256.new()
|
payload_digest = SHA256.new()
|
||||||
payload_digest.update(body)
|
payload_digest.update(body)
|
||||||
return "SHA-256=" + \
|
return "SHA-256=" + \
|
||||||
|
@ -258,7 +257,7 @@ def build_signature_string(
|
||||||
build_signature_string(
|
build_signature_string(
|
||||||
request.method # "post"
|
request.method # "post"
|
||||||
request.path # "/inbox"
|
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),
|
calculate_digest(request.data),
|
||||||
headers,
|
headers,
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue