Current state
All checks were successful
/ docker (push) Successful in 4m7s

This commit is contained in:
Melody Becker 2025-04-13 20:10:19 +02:00
parent e3a97170a9
commit f4e876a4b1
Signed by: mstar
SSH key fingerprint: SHA256:vkXfS9FG2pVNVfvDrzd1VW9n8VJzqqdKQGljxxX8uK8
10 changed files with 191 additions and 20 deletions

View file

@ -14,6 +14,7 @@ import (
"git.mstar.dev/mstar/linstrom/activitypub"
"git.mstar.dev/mstar/linstrom/config"
"git.mstar.dev/mstar/linstrom/shared"
"git.mstar.dev/mstar/linstrom/storage-new"
"git.mstar.dev/mstar/linstrom/storage-new/dbgen"
"git.mstar.dev/mstar/linstrom/storage-new/models"
@ -71,9 +72,9 @@ func users(w http.ResponseWriter, r *http.Request) {
apUrl := userIdToApUrl(user.ID)
var keyBytes string
if config.GlobalConfig.Experimental.UseEd25519Keys {
keyBytes = keyBytesToPem(user.PublicKeyEd)
keyBytes = shared.KeyBytesToPem(user.PublicKeyEd)
} else {
keyBytes = keyBytesToPem(user.PublicKeyRsa)
keyBytes = shared.KeyBytesToPem(user.PublicKeyRsa)
}
data := Outbound{
Context: activitypub.BaseLdContext,

View file

@ -1,7 +1,6 @@
package activitypub
import (
"encoding/pem"
"fmt"
"git.mstar.dev/mstar/linstrom/config"
@ -14,12 +13,3 @@ func userIdToApUrl(id string) string {
id,
)
}
func keyBytesToPem(bytes []byte) string {
block := pem.Block{
Type: "PUBLIC KEY",
Headers: nil,
Bytes: bytes,
}
return string(pem.EncodeToMemory(&block))
}