fix: pubkeyの場所を変更

This commit is contained in:
usbharu 2023-03-31 17:24:46 +09:00
parent 6df3c1a670
commit 70c3e408f4
2 changed files with 4 additions and 4 deletions

View File

@ -146,7 +146,7 @@ val httpSignaturePlugin = createClientPlugin("HttpSign", ::HttpSignaturePluginCo
class KtorKeyMap(private val userAuthRepository: IUserAuthService) : KeyMap {
override fun getPublicKey(keyId: String?): PublicKey = runBlocking {
val username = (keyId ?: throw IllegalArgumentException("keyId is null")).substringBeforeLast("/pubkey")
val username = (keyId ?: throw IllegalArgumentException("keyId is null")).substringBeforeLast("#pubkey")
.substringAfterLast("/")
val publicBytes = Base64.getDecoder().decode(
userAuthRepository.findByUsername(
@ -159,7 +159,7 @@ class KtorKeyMap(private val userAuthRepository: IUserAuthService) : KeyMap {
}
override fun getPrivateKey(keyId: String?): PrivateKey = runBlocking {
val username = (keyId ?: throw IllegalArgumentException("keyId is null")).substringBeforeLast("/pubkey")
val username = (keyId ?: throw IllegalArgumentException("keyId is null")).substringBeforeLast("#pubkey")
.substringAfterLast("/")
val publicBytes = Base64.getDecoder().decode(
userAuthRepository.findByUsername(

View File

@ -33,7 +33,7 @@ class ActivityPubUserService(
publicKey = Key(
type = emptyList(),
name = "Public Key",
id = "$userUrl/pubkey",
id = "$userUrl#pubkey",
owner = userUrl,
publicKeyPem = userAuthEntity.publicKey
)
@ -45,7 +45,7 @@ class ActivityPubUserService(
val person = webFingerService.fetchUserModel(actor) ?: throw IllegalArgumentException("actor is not found")
val inboxUrl = person.inbox ?: throw IllegalArgumentException("inbox is not found")
httpClient.postAp(
inboxUrl, "${follow.`object`!!}/pubkey", Accept(
inboxUrl, "${follow.`object`!!}#pubkey", Accept(
name = "Follow",
`object` = follow,
actor = follow.`object`.orEmpty()