Logo
Explore Help
Sign In
logos-messaging/logos-messaging-js
1
0
Fork 0
You've already forked logos-messaging-js
mirror of https://github.com/logos-messaging/logos-messaging-js.git synced 2026-03-22 23:03:36 +00:00
Code Issues Packages Projects Releases Wiki Activity
logos-messaging-js/packages/utils/src/common/is_size_valid.ts

11 lines
198 B
TypeScript
Raw Normal View History

feat: add 1MB restriction to LightPush and Relay (#1351) * add 1MB restriction to LightPush and Relay * fix condition * improve lightPush test * update test * add isomorphic-webcrypto * import module * add errors to SendResult and tests * fix lint
2023-05-17 23:40:52 +02:00
const MB = 1024 ** 2;
const SIZE_CAP = 1; // 1 MB
feat: fail early when trying to send empty payload (#1642) * refactor: rename as this method does not check empty payloads * feat: fail early when trying to send empty payload --------- Co-authored-by: Sasha <oleksandr@status.im>
2023-10-17 09:14:45 +11:00
export const isSizeUnderCap = (payload: Uint8Array): boolean => {
feat: add 1MB restriction to LightPush and Relay (#1351) * add 1MB restriction to LightPush and Relay * fix condition * improve lightPush test * update test * add isomorphic-webcrypto * import module * add errors to SendResult and tests * fix lint
2023-05-17 23:40:52 +02:00
if (payload.length / MB > SIZE_CAP) {
return false;
}
return true;
};
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.23.0 Page: 54ms Template: 2ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API