Skip to content

Commit

Permalink
fix(bimi): Added 'type' for BIMI information schema
Browse files Browse the repository at this point in the history
  • Loading branch information
andris9 committed Nov 5, 2024
1 parent 8f7b8f2 commit 61f03dc
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/api/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ module.exports = (db, server, messageHandler, userHandler, storageHandler, setti
messageData.bimi = {
certified: bimiData.type === 'authority',
url: bimiData.url,
image: `data:image/svg+xml;base64,${bimiData.content.toString('base64')}`
image: `data:image/svg+xml;base64,${bimiData.content.toString('base64')}`,
type: bimiData.type === 'authority' ? bimiData.vmc?.type || 'VMC' : undefined
};
}
delete messageData.verificationResults.bimi;
Expand Down Expand Up @@ -1112,7 +1113,8 @@ module.exports = (db, server, messageHandler, userHandler, storageHandler, setti
bimi: Joi.object({
certified: booleanSchema.description('If true, then this logo is from a VMC file'),
url: Joi.string().description('URL of the resource the logo was retrieved from'),
image: Joi.string().description('Data URL for the SVG image')
image: Joi.string().description('Data URL for the SVG image'),
type: Joi.string().valid('VMC', 'CMC').description('Certificate type (only for VMC files)')
}).description('BIMI logo info. If logo validation failed in any way, then this property is not set'),
contentType: Joi.object({
value: Joi.string().required().description('MIME type of the message, eg. "multipart/mixed'),
Expand Down Expand Up @@ -1372,7 +1374,8 @@ module.exports = (db, server, messageHandler, userHandler, storageHandler, setti
response.bimi = {
certified: bimiData.type === 'authority',
url: bimiData.url,
image: `data:image/svg+xml;base64,${bimiData.content.toString('base64')}`
image: `data:image/svg+xml;base64,${bimiData.content.toString('base64')}`,
type: bimiData.type === 'authority' ? bimiData.vmc?.type || 'VMC' : undefined
};
}
} catch (err) {
Expand Down

0 comments on commit 61f03dc

Please sign in to comment.