This commit is contained in:
parent
e3a97170a9
commit
f4e876a4b1
10 changed files with 191 additions and 20 deletions
|
@ -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,
|
||||
|
|
|
@ -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))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue