Upload app.py
Browse files
app.py
CHANGED
|
@@ -647,7 +647,7 @@ with tab4:
|
|
| 647 |
</div><div class="sc-body">
|
| 648 |
<div class="flabel">Endpoint</div>
|
| 649 |
<div style="font-family:'JetBrains Mono',monospace;font-size:12px;background:var(--surface);border:1px solid var(--border);border-radius:var(--rs);padding:10px 14px;margin-bottom:14px;word-break:break-all;">
|
| 650 |
-
POST https://
|
| 651 |
</div>
|
| 652 |
<div class="flabel">Request — multipart/form-data</div>
|
| 653 |
<div style="font-family:'JetBrains Mono',monospace;font-size:12px;background:var(--surface);border:1px solid var(--border);border-radius:var(--rs);padding:10px 14px;margin-bottom:14px;line-height:1.9">
|
|
@@ -655,19 +655,18 @@ with tab4:
|
|
| 655 |
<span style="color:var(--accent)">key</span> your secret passphrase<br>
|
| 656 |
<span style="color:var(--accent)">Authorization</span> Bearer <your-api-token>
|
| 657 |
</div>
|
| 658 |
-
<div class="flabel">Response — application/
|
| 659 |
<div style="font-family:'JetBrains Mono',monospace;font-size:12px;background:var(--surface);border:1px solid var(--border);border-radius:var(--rs);padding:10px 14px;margin-bottom:14px;line-height:1.9">
|
| 660 |
-
<span style="color:var(--ok)">
|
| 661 |
-
<span style="color:var(--ok)">
|
| 662 |
-
<span style="color:var(--ok)">
|
| 663 |
-
<span style="color:var(--ok)">status</span> "ok"
|
| 664 |
</div>
|
| 665 |
<div class="flabel">curl example</div>
|
| 666 |
-
<div style="font-family:'JetBrains Mono',monospace;font-size:11.5px;background:var(--ink);color:#e2eaff;border-radius:var(--rs);padding:14px 16px;line-height:1.85;white-space:pre;overflow-x:auto">curl -X POST https://
|
| 667 |
-H "Authorization: Bearer <your-api-token>" \\
|
| 668 |
-F "file=@document.pdf" \\
|
| 669 |
-F "key=my-secret-passphrase" \\
|
| 670 |
-
-
|
| 671 |
</div></div>
|
| 672 |
""", unsafe_allow_html=True)
|
| 673 |
|
|
@@ -679,7 +678,7 @@ with tab4:
|
|
| 679 |
</div><div class="sc-body">
|
| 680 |
<div class="flabel">Endpoint</div>
|
| 681 |
<div style="font-family:'JetBrains Mono',monospace;font-size:12px;background:var(--surface);border:1px solid var(--border);border-radius:var(--rs);padding:10px 14px;margin-bottom:14px;word-break:break-all;">
|
| 682 |
-
POST https://
|
| 683 |
</div>
|
| 684 |
<div class="flabel">Request — multipart/form-data</div>
|
| 685 |
<div style="font-family:'JetBrains Mono',monospace;font-size:12px;background:var(--surface);border:1px solid var(--border);border-radius:var(--rs);padding:10px 14px;margin-bottom:14px;line-height:1.9">
|
|
@@ -690,12 +689,13 @@ with tab4:
|
|
| 690 |
</div>
|
| 691 |
<div class="flabel">Response — application/json</div>
|
| 692 |
<div style="font-family:'JetBrains Mono',monospace;font-size:12px;background:var(--surface);border:1px solid var(--border);border-radius:var(--rs);padding:10px 14px;margin-bottom:14px;line-height:1.9">
|
| 693 |
-
<span style="color:var(--ok)">is_valid</span> true / false<br>
|
| 694 |
-
<span style="color:var(--ok)">
|
| 695 |
-
<span style="color:var(--ok)">
|
|
|
|
| 696 |
</div>
|
| 697 |
<div class="flabel">curl example</div>
|
| 698 |
-
<div style="font-family:'JetBrains Mono',monospace;font-size:11.5px;background:var(--ink);color:#e2eaff;border-radius:var(--rs);padding:14px 16px;line-height:1.85;white-space:pre;overflow-x:auto">curl -X POST https://
|
| 699 |
-H "Authorization: Bearer <your-api-token>" \\
|
| 700 |
-F "file=@document_signed.pdf" \\
|
| 701 |
-F "sig_file=@document_signed.json" \\
|
|
@@ -707,40 +707,35 @@ with tab4:
|
|
| 707 |
# Python example card
|
| 708 |
st.markdown("""
|
| 709 |
<div class="scard"><div class="scard-hd">Python Example</div><div class="scard-bd">
|
| 710 |
-
<div style="font-family:'JetBrains Mono',monospace;font-size:11px;background:var(--ink);color:#e2eaff;border-radius:var(--rs);padding:14px 16px;line-height:1.85;white-space:pre;overflow-x:auto">import requests,
|
| 711 |
|
| 712 |
API_TOKEN = "<your-api-token>"
|
| 713 |
-
BASE_URL = "https://
|
| 714 |
HEADERS = {"Authorization": f"Bearer {API_TOKEN}"}
|
| 715 |
|
| 716 |
# ── sign ─────────────────────────────
|
| 717 |
with open("document.pdf", "rb") as f:
|
| 718 |
-
r = requests.post(
|
| 719 |
-
|
| 720 |
-
|
| 721 |
-
|
| 722 |
-
|
| 723 |
-
|
| 724 |
-
|
| 725 |
-
|
| 726 |
-
|
| 727 |
-
|
| 728 |
-
with open("document_signed.
|
| 729 |
-
f.write(signed)
|
| 730 |
-
with open("document_signed.json", "wb") as f:
|
| 731 |
-
f.write(sig)
|
| 732 |
|
| 733 |
# ── verify ───────────────────────────
|
| 734 |
-
with (open("document_signed.pdf","rb") as pf,
|
| 735 |
-
open("document_signed.json","rb") as sf):
|
| 736 |
-
r = requests.post(
|
| 737 |
-
|
| 738 |
-
|
| 739 |
-
|
| 740 |
-
data={"key": "my-secret"},
|
| 741 |
-
)
|
| 742 |
print(r.json())
|
| 743 |
-
# {"is_valid": true, "
|
| 744 |
</div></div>
|
| 745 |
""", unsafe_allow_html=True)
|
| 746 |
|
|
@@ -754,7 +749,7 @@ print(r.json())
|
|
| 754 |
</div>
|
| 755 |
<div class="flabel">Contact</div>
|
| 756 |
<div style="font-family:'JetBrains Mono',monospace;font-size:12px;background:var(--accent-lt);border:1px solid #b3caff;border-radius:var(--rs);padding:10px 14px;color:var(--accent);font-weight:600;word-break:break-all;">
|
| 757 |
-
|
| 758 |
</div>
|
| 759 |
<div style="font-size:12px;color:var(--muted);margin-top:10px;line-height:1.5">
|
| 760 |
Please include your intended request volume and a short description of your
|
|
@@ -768,9 +763,11 @@ print(r.json())
|
|
| 768 |
for lbl, val, cls in [
|
| 769 |
("Auth method", "Bearer token", "mv-neu"),
|
| 770 |
("File transfer", "multipart/form-data", "mv-neu"),
|
| 771 |
-
("
|
|
|
|
| 772 |
("Max file size", "20 MB", "mv-neu"),
|
| 773 |
("Formats", "PNG · JPG · PDF", "mv-neu"),
|
|
|
|
| 774 |
]:
|
| 775 |
st.markdown(f'<div class="mrow"><span class="mlbl">{lbl}</span><span class="mval {cls}">{val}</span></div>', unsafe_allow_html=True)
|
| 776 |
st.markdown('</div></div>', unsafe_allow_html=True)
|
|
@@ -780,9 +777,9 @@ print(r.json())
|
|
| 780 |
st.markdown("""
|
| 781 |
<div class="ws-ftr">
|
| 782 |
<div class="ftr-links">
|
| 783 |
-
<a href="https://github.com/
|
| 784 |
</div>
|
| 785 |
-
<div>WaveSign · Invisible File Authentication · © 2026
|
| 786 |
</div>
|
| 787 |
</div>
|
| 788 |
""", unsafe_allow_html=True)
|
|
|
|
| 647 |
</div><div class="sc-body">
|
| 648 |
<div class="flabel">Endpoint</div>
|
| 649 |
<div style="font-family:'JetBrains Mono',monospace;font-size:12px;background:var(--surface);border:1px solid var(--border);border-radius:var(--rs);padding:10px 14px;margin-bottom:14px;word-break:break-all;">
|
| 650 |
+
POST https://roseluo-wavesign-api.hf.space/sign
|
| 651 |
</div>
|
| 652 |
<div class="flabel">Request — multipart/form-data</div>
|
| 653 |
<div style="font-family:'JetBrains Mono',monospace;font-size:12px;background:var(--surface);border:1px solid var(--border);border-radius:var(--rs);padding:10px 14px;margin-bottom:14px;line-height:1.9">
|
|
|
|
| 655 |
<span style="color:var(--accent)">key</span> your secret passphrase<br>
|
| 656 |
<span style="color:var(--accent)">Authorization</span> Bearer <your-api-token>
|
| 657 |
</div>
|
| 658 |
+
<div class="flabel">Response — application/zip</div>
|
| 659 |
<div style="font-family:'JetBrains Mono',monospace;font-size:12px;background:var(--surface);border:1px solid var(--border);border-radius:var(--rs);padding:10px 14px;margin-bottom:14px;line-height:1.9">
|
| 660 |
+
<span style="color:var(--ok)">signed_package.zip</span><br>
|
| 661 |
+
<span style="color:var(--muted)">└──</span> <span style="color:var(--ok)">signed.png / signed.pdf</span> watermarked file<br>
|
| 662 |
+
<span style="color:var(--muted)">└──</span> <span style="color:var(--ok)">sig.json</span> signature file for verification
|
|
|
|
| 663 |
</div>
|
| 664 |
<div class="flabel">curl example</div>
|
| 665 |
+
<div style="font-family:'JetBrains Mono',monospace;font-size:11.5px;background:var(--ink);color:#e2eaff;border-radius:var(--rs);padding:14px 16px;line-height:1.85;white-space:pre;overflow-x:auto">curl -X POST https://roseluo-wavesign-api.hf.space/sign \\
|
| 666 |
-H "Authorization: Bearer <your-api-token>" \\
|
| 667 |
-F "file=@document.pdf" \\
|
| 668 |
-F "key=my-secret-passphrase" \\
|
| 669 |
+
--output signed_package.zip</div>
|
| 670 |
</div></div>
|
| 671 |
""", unsafe_allow_html=True)
|
| 672 |
|
|
|
|
| 678 |
</div><div class="sc-body">
|
| 679 |
<div class="flabel">Endpoint</div>
|
| 680 |
<div style="font-family:'JetBrains Mono',monospace;font-size:12px;background:var(--surface);border:1px solid var(--border);border-radius:var(--rs);padding:10px 14px;margin-bottom:14px;word-break:break-all;">
|
| 681 |
+
POST https://roseluo-wavesign-api.hf.space/verify
|
| 682 |
</div>
|
| 683 |
<div class="flabel">Request — multipart/form-data</div>
|
| 684 |
<div style="font-family:'JetBrains Mono',monospace;font-size:12px;background:var(--surface);border:1px solid var(--border);border-radius:var(--rs);padding:10px 14px;margin-bottom:14px;line-height:1.9">
|
|
|
|
| 689 |
</div>
|
| 690 |
<div class="flabel">Response — application/json</div>
|
| 691 |
<div style="font-family:'JetBrains Mono',monospace;font-size:12px;background:var(--surface);border:1px solid var(--border);border-radius:var(--rs);padding:10px 14px;margin-bottom:14px;line-height:1.9">
|
| 692 |
+
<span style="color:var(--ok)">is_valid</span> true / false<br>
|
| 693 |
+
<span style="color:var(--ok)">verdict</span> "AUTHENTIC" or "TAMPERED or INVALID KEY"<br>
|
| 694 |
+
<span style="color:var(--ok)">similarity_score</span> 0.0 – 1.0 confidence<br>
|
| 695 |
+
<span style="color:var(--ok)">mode</span> detected image mode (RGB · L · …)
|
| 696 |
</div>
|
| 697 |
<div class="flabel">curl example</div>
|
| 698 |
+
<div style="font-family:'JetBrains Mono',monospace;font-size:11.5px;background:var(--ink);color:#e2eaff;border-radius:var(--rs);padding:14px 16px;line-height:1.85;white-space:pre;overflow-x:auto">curl -X POST https://roseluo-wavesign-api.hf.space/verify \\
|
| 699 |
-H "Authorization: Bearer <your-api-token>" \\
|
| 700 |
-F "file=@document_signed.pdf" \\
|
| 701 |
-F "sig_file=@document_signed.json" \\
|
|
|
|
| 707 |
# Python example card
|
| 708 |
st.markdown("""
|
| 709 |
<div class="scard"><div class="scard-hd">Python Example</div><div class="scard-bd">
|
| 710 |
+
<div style="font-family:'JetBrains Mono',monospace;font-size:11px;background:var(--ink);color:#e2eaff;border-radius:var(--rs);padding:14px 16px;line-height:1.85;white-space:pre;overflow-x:auto">import requests, zipfile, io
|
| 711 |
|
| 712 |
API_TOKEN = "<your-api-token>"
|
| 713 |
+
BASE_URL = "https://roseluo-wavesign-api.hf.space"
|
| 714 |
HEADERS = {"Authorization": f"Bearer {API_TOKEN}"}
|
| 715 |
|
| 716 |
# ── sign ─────────────────────────────
|
| 717 |
with open("document.pdf", "rb") as f:
|
| 718 |
+
r = requests.post(f"{BASE_URL}/sign",
|
| 719 |
+
headers=HEADERS,
|
| 720 |
+
files={"file": f},
|
| 721 |
+
data={"key": "my-secret"})
|
| 722 |
+
|
| 723 |
+
with zipfile.ZipFile(io.BytesIO(r.content)) as z:
|
| 724 |
+
signed = z.read("signed.pdf")
|
| 725 |
+
sig = z.read("sig.json")
|
| 726 |
+
|
| 727 |
+
with open("document_signed.pdf", "wb") as f: f.write(signed)
|
| 728 |
+
with open("document_signed.json", "wb") as f: f.write(sig)
|
|
|
|
|
|
|
|
|
|
| 729 |
|
| 730 |
# ── verify ───────────────────────────
|
| 731 |
+
with (open("document_signed.pdf", "rb") as pf,
|
| 732 |
+
open("document_signed.json", "rb") as sf):
|
| 733 |
+
r = requests.post(f"{BASE_URL}/verify",
|
| 734 |
+
headers=HEADERS,
|
| 735 |
+
files={"file": pf, "sig_file": sf},
|
| 736 |
+
data={"key": "my-secret"})
|
|
|
|
|
|
|
| 737 |
print(r.json())
|
| 738 |
+
# {"is_valid": true, "verdict": "AUTHENTIC", "similarity_score": 0.97}</div>
|
| 739 |
</div></div>
|
| 740 |
""", unsafe_allow_html=True)
|
| 741 |
|
|
|
|
| 749 |
</div>
|
| 750 |
<div class="flabel">Contact</div>
|
| 751 |
<div style="font-family:'JetBrains Mono',monospace;font-size:12px;background:var(--accent-lt);border:1px solid #b3caff;border-radius:var(--rs);padding:10px 14px;color:var(--accent);font-weight:600;word-break:break-all;">
|
| 752 |
+
rose.huiluo@gmail.com
|
| 753 |
</div>
|
| 754 |
<div style="font-size:12px;color:var(--muted);margin-top:10px;line-height:1.5">
|
| 755 |
Please include your intended request volume and a short description of your
|
|
|
|
| 763 |
for lbl, val, cls in [
|
| 764 |
("Auth method", "Bearer token", "mv-neu"),
|
| 765 |
("File transfer", "multipart/form-data", "mv-neu"),
|
| 766 |
+
("Sign response", "ZIP archive", "mv-neu"),
|
| 767 |
+
("Verify response", "JSON", "mv-neu"),
|
| 768 |
("Max file size", "20 MB", "mv-neu"),
|
| 769 |
("Formats", "PNG · JPG · PDF", "mv-neu"),
|
| 770 |
+
("GET /", "API directory", "mv-neu"),
|
| 771 |
]:
|
| 772 |
st.markdown(f'<div class="mrow"><span class="mlbl">{lbl}</span><span class="mval {cls}">{val}</span></div>', unsafe_allow_html=True)
|
| 773 |
st.markdown('</div></div>', unsafe_allow_html=True)
|
|
|
|
| 777 |
st.markdown("""
|
| 778 |
<div class="ws-ftr">
|
| 779 |
<div class="ftr-links">
|
| 780 |
+
<a href="https://github.com/roseluo/WaveSign" target="_blank">GitHub</a>
|
| 781 |
</div>
|
| 782 |
+
<div>WaveSign · Invisible File Authentication · © 2026 roseluo</div>
|
| 783 |
</div>
|
| 784 |
</div>
|
| 785 |
""", unsafe_allow_html=True)
|