[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
|
||||
|
||||
#+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,11 +230,10 @@ 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=" + \
|
||||
base64.b64encode(body_digest.digest()).decode("utf-8")
|
||||
payload_digest = SHA256.new()
|
||||
payload_digest.update(body)
|
||||
return "SHA-256=" + \
|
||||
base64.b64encode(body_digest.digest()).decode("utf-8")
|
||||
|
||||
|
||||
def build_signature_string(
|
||||
|
@ -256,9 +255,9 @@ def build_signature_string(
|
|||
|
||||
|
||||
build_signature_string(
|
||||
request.method #"post"
|
||||
request.path #"/inbox"
|
||||
parse_signature(headers["signature"])["headers"],
|
||||
request.method # "post"
|
||||
request.path # "/inbox"
|
||||
parse_signature(headers["signature"])["headers"], # ["(request-target)", "user-agent", "host", "date", "digest", "content-type"]
|
||||
calculate_digest(request.data),
|
||||
headers,
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue