diff --git a/packages/backend/src/core/activitypub/ApRendererService.ts b/packages/backend/src/core/activitypub/ApRendererService.ts index 66322f6870..66a15b2d18 100644 --- a/packages/backend/src/core/activitypub/ApRendererService.ts +++ b/packages/backend/src/core/activitypub/ApRendererService.ts @@ -501,7 +501,7 @@ export class ApRendererService { discoverable: user.isExplorable, publicKey: this.renderKey(user, keypair.publicKey, '#main-key'), additionalPublicKeys: [ - ...(keypair.ed25519PublicKey ? [this.renderKey(user, keypair.ed25519PublicKey, '#ed25519-key', { type: keypair.ed25519SignatureAlgorithm!, signatureValue: keypair.ed25519PublicKeySignature! })] : []), + ...(keypair.ed25519PublicKey ? [this.renderKey(user, keypair.ed25519PublicKey, '#ed25519-key', { signatureAlgorithm: keypair.ed25519SignatureAlgorithm!, signatureValue: keypair.ed25519PublicKeySignature! })] : []), ], isCat: user.isCat, attachment: attachment.length ? attachment : undefined, @@ -649,6 +649,7 @@ export class ApRendererService { '_misskey_votes': 'misskey:_misskey_votes', '_misskey_summary': 'misskey:_misskey_summary', 'isCat': 'misskey:isCat', + additionalPublicKeys: 'misskey:additionalPublicKeys', // vcard vcard: 'http://www.w3.org/2006/vcard/ns#', }, diff --git a/packages/backend/src/core/activitypub/models/ApPersonService.ts b/packages/backend/src/core/activitypub/models/ApPersonService.ts index 4c1f79e1b1..36fad4c759 100644 --- a/packages/backend/src/core/activitypub/models/ApPersonService.ts +++ b/packages/backend/src/core/activitypub/models/ApPersonService.ts @@ -216,8 +216,8 @@ export class ApPersonService implements OnModuleInit { if (!key.signature) { throw new Error('invalid Actor: additionalPublicKeys.signature is not set'); } - if (typeof key.signature.type !== 'string') { - throw new Error('invalid Actor: additionalPublicKeys.signature.type is not a string'); + if (typeof key.signature.signatureAlgorithm !== 'string') { + throw new Error('invalid Actor: additionalPublicKeys.signature.signatureAlgorithm is not a string'); } if (typeof key.signature.signatureValue !== 'string') { throw new Error('invalid Actor: additionalPublicKeys.signature.signatureValue is not a string'); @@ -397,8 +397,8 @@ export class ApPersonService implements OnModuleInit { if (person.additionalPublicKeys) { for (const key of person.additionalPublicKeys) { if ( - key.signature && key.signature.type && key.signature.signatureValue && - verify(key.signature.type, Buffer.from(key.publicKeyPem), person.publicKey.publicKeyPem, Buffer.from(key.signature.signatureValue, 'base64')) + key.signature && key.signature.signatureAlgorithm && key.signature.signatureValue && + verify(key.signature.signatureAlgorithm, Buffer.from(key.publicKeyPem), person.publicKey.publicKeyPem, Buffer.from(key.signature.signatureValue, 'base64')) ) { await transactionalEntityManager.save(new MiUserPublickey({ keyId: key.id, @@ -564,8 +564,8 @@ export class ApPersonService implements OnModuleInit { if (person.additionalPublicKeys) { for (const key of person.additionalPublicKeys) { if ( - key.signature && key.signature.type && key.signature.signatureValue && - verify(key.signature.type, Buffer.from(key.publicKeyPem), person.publicKey.publicKeyPem, Buffer.from(key.signature.signatureValue, 'base64')) + key.signature && key.signature.signatureAlgorithm && key.signature.signatureValue && + verify(key.signature.signatureAlgorithm, Buffer.from(key.publicKeyPem), person.publicKey.publicKeyPem, Buffer.from(key.signature.signatureValue, 'base64')) ) { await this.userPublickeysRepository.update({ keyId: key.id }, { userId: exist.id, diff --git a/packages/backend/src/core/activitypub/type.ts b/packages/backend/src/core/activitypub/type.ts index 72d383442e..ff0d340b6b 100644 --- a/packages/backend/src/core/activitypub/type.ts +++ b/packages/backend/src/core/activitypub/type.ts @@ -241,7 +241,7 @@ export interface IKey extends IObject { * Signature of publicKeyPem, signed by root privateKey (for additionalPublicKey) */ signature?: { - type: string; + signatureAlgorithm: string; signatureValue: string }; }