show the bot public key pem on the bot view page

This commit is contained in:
Yvan 2025-02-04 02:43:03 +00:00
parent 44efa084cc
commit 1682cbe81f
2 changed files with 2 additions and 1 deletions

View file

@ -43,7 +43,7 @@ public class Bot {
* ActivityPub key JSON. * ActivityPub key JSON.
* "-----BEGIN PUBLIC KEY-----\\nMI [...] AB\\n-----END PUBLIC KEY-----" * "-----BEGIN PUBLIC KEY-----\\nMI [...] AB\\n-----END PUBLIC KEY-----"
*/ */
String getPublicKeyPEMString() { public String getPublicKeyPEMString() {
// Note: for performance it could be worth storing this in the db, or caching it in some way // Note: for performance it could be worth storing this in the db, or caching it in some way
PublicKey pk = keyPair.getPublic(); PublicKey pk = keyPair.getPublic();
StringWriter w = new StringWriter(); StringWriter w = new StringWriter();

View file

@ -21,6 +21,7 @@
<span>Description:</span><span th:text="${bot.summary}"></span><br/> <span>Description:</span><span th:text="${bot.summary}"></span><br/>
<span>Published:</span><span th:text="${bot.published}"></span><br/> <span>Published:</span><span th:text="${bot.published}"></span><br/>
<span>Type:</span><span th:text="${bot.type}"></span><br/> <span>Type:</span><span th:text="${bot.type}"></span><br/>
<span>Public Key:</span><pre th:text="${bot.getPublicKeyPEMString()}"></pre><br/>
<br> <br>
<a href="/">HOME</a> | <a href="/">HOME</a> |
<a href="/viewbot">Bot List</a> <a href="/viewbot">Bot List</a>