diff --git a/services/gateway/apis/http-version3/methods/anchors.js b/services/gateway/apis/http-version3/methods/anchors.js index 45b2f2d91..aa9555cfb 100644 --- a/services/gateway/apis/http-version3/methods/anchors.js +++ b/services/gateway/apis/http-version3/methods/anchors.js @@ -10,7 +10,7 @@ module.exports = { tags: ['Anchors'], params: { submitter: { optional: true, type: 'string', min: 3, max: 41, pattern: regex.ADDRESS_LISK32 }, - anchorID: { optional: true, type: 'string', min: 1, max: 64, pattern: regex.HASH_SHA256 }, + anchorID: { optional: true, type: 'string', min: 1, max: 64, pattern: regex.MD5 }, search: { optional: true, type: 'string' }, limit: { optional: true, type: 'number', min: 1, max: 100, default: 10 }, offset: { optional: true, type: 'number', min: 0, default: 0 }, diff --git a/services/gateway/apis/http-version3/methods/badges.js b/services/gateway/apis/http-version3/methods/badges.js index ca384ce3f..ca9064ad6 100644 --- a/services/gateway/apis/http-version3/methods/badges.js +++ b/services/gateway/apis/http-version3/methods/badges.js @@ -26,9 +26,11 @@ module.exports = { tags: ['Badges'], params: { awardedTo: { optional: true, type: 'string', min: 3, max: 41, pattern: regex.ADDRESS_LISK32 }, - badgeID: { optional: true, type: 'string', min: 1, max: 64, pattern: regex.HASH_SHA256 }, - anchorID: { optional: true, type: 'string', min: 1, max: 64, pattern: regex.HASH_SHA256 }, + badgeID: { optional: true, type: 'string', min: 1, max: 64, pattern: regex.MD5 }, + anchorID: { optional: true, type: 'string', min: 1, max: 64, pattern: regex.MD5 }, type: { optional: true, type: 'string' }, + limit: { optional: true, type: 'number', min: 1, max: 100, default: 10 }, + offset: { optional: true, type: 'number', min: 0, default: 0 }, }, get schema() { const badgeSchema = {}; diff --git a/services/gateway/shared/regex.js b/services/gateway/shared/regex.js index 3249368d7..822c793a0 100644 --- a/services/gateway/shared/regex.js +++ b/services/gateway/shared/regex.js @@ -53,6 +53,7 @@ const TOPIC_CSV = /^\b(?:[0-9a-fA-F]{2,64}|lsk[a-hjkm-z2-9]{38})(?:,(?:[0-9a-fA- const HEX_STRING = /^\b[a-fA-F0-9]+\b$/; const EXCEL_EXPORT_FILENAME = /^\btransactions_([a-fA-F0-9]{8})_(lsk[a-hjkm-z2-9]{38})_((\d{4})-((1[012])|(0?[1-9]))-(([012][1-9])|([123]0)|31))_((\d{4})-((1[012])|(0?[1-9]))-(([012][1-9])|([123]0)|31))\.xlsx\b$/; const EVENT_NAME = /^[\w!@$&. ]{1,32}$/; +const MD5 = /^\b[a-fA-F0-9]{32}\b$/; // MD5 pattern module.exports = { PUBLIC_KEY, @@ -95,4 +96,5 @@ module.exports = { FEE, EXCEL_EXPORT_FILENAME, EVENT_NAME, + MD5, };