fix: pubkeyの場所を変更

This commit is contained in:
usbharu 2023-03-31 17:24:46 +09:00
parent 33324e724c
commit 6d7bc25946
Signed by: usbharu
GPG Key ID: 6556747BF94EEBC8
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 { class KtorKeyMap(private val userAuthRepository: IUserAuthService) : KeyMap {
override fun getPublicKey(keyId: String?): PublicKey = runBlocking { 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("/") .substringAfterLast("/")
val publicBytes = Base64.getDecoder().decode( val publicBytes = Base64.getDecoder().decode(
userAuthRepository.findByUsername( userAuthRepository.findByUsername(
@ -159,7 +159,7 @@ class KtorKeyMap(private val userAuthRepository: IUserAuthService) : KeyMap {
} }
override fun getPrivateKey(keyId: String?): PrivateKey = runBlocking { 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("/") .substringAfterLast("/")
val publicBytes = Base64.getDecoder().decode( val publicBytes = Base64.getDecoder().decode(
userAuthRepository.findByUsername( userAuthRepository.findByUsername(

View File

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