diff --git a/src/main/kotlin/dev/usbharu/hideout/plugins/ActivityPub.kt b/src/main/kotlin/dev/usbharu/hideout/plugins/ActivityPub.kt index ed0eb615..8cd9cfdc 100644 --- a/src/main/kotlin/dev/usbharu/hideout/plugins/ActivityPub.kt +++ b/src/main/kotlin/dev/usbharu/hideout/plugins/ActivityPub.kt @@ -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( diff --git a/src/main/kotlin/dev/usbharu/hideout/service/ActivityPubUserService.kt b/src/main/kotlin/dev/usbharu/hideout/service/ActivityPubUserService.kt index e4ff466d..4c2b0f82 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/ActivityPubUserService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/ActivityPubUserService.kt @@ -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()