package activitypub

import (
	"encoding/pem"
	"fmt"

	"git.mstar.dev/mstar/linstrom/config"
)

func userIdToApUrl(id string) string {
	return fmt.Sprintf(
		"%s/api/ap/users/%s",
		config.GlobalConfig.General.GetFullPublicUrl(),
		id,
	)
}

func keyBytesToPem(bytes []byte) string {
	block := pem.Block{
		Type:    "PUBLIC KEY",
		Headers: nil,
		Bytes:   bytes,
	}
	return string(pem.EncodeToMemory(&block))
}
