1
0
forked from mirror/misskey

signatureAlgorithm

This commit is contained in:
tamaina 2024-02-27 01:41:34 +00:00
parent 172546f3ef
commit 1d780ac010
3 changed files with 9 additions and 8 deletions

View File

@ -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#',
},

View File

@ -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,

View File

@ -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
};
}