snapshot of https://github.com/RocketChat/Rocket.Chat.git (develop, 2026-09-16; blobs > 131072B omitted)
Some checks failed
Create issues from TODOs / todos (push) Failing after 3s
Close inactive issues / close-issues (push) Has been cancelled
Deploy GitHub Pages / deploy-preview (push) Has been cancelled
CI / ⚙️ Variables Setup (push) Has been cancelled
CI / ⚙️ Test Guard (push) Has been cancelled
CI / 🚀 Notify external services - draft (push) Has been cancelled
CI / 📦 Build Packages (push) Has been cancelled
CI / 📦 Meteor Build (coverage) (push) Has been cancelled
CI / 📦 Meteor Build (production) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], fips) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Publish Docker Images (ghcr.io) (push) Has been cancelled
CI / 📦 Track Image Sizes (push) Has been cancelled
CI / 🔎 Code Check - Action Lint (push) Has been cancelled
CI / 🔎 Code Check (push) Has been cancelled
CI / 🔨 Test Storybook (push) Has been cancelled
CI / 🔨 Test Unit (push) Has been cancelled
CI / 🔨 Test API (CE) (push) Has been cancelled
CI / 🔨 Test API Livechat (CE) (push) Has been cancelled
CI / 🔨 Test UI (CE) (push) Has been cancelled
CI / 🔨 Test API (EE) (push) Has been cancelled
CI / 🔨 Test API Livechat (EE) (push) Has been cancelled
CI / 🔨 Test API Apps (deno-runtime - EE) (push) Has been cancelled
CI / 🔨 Test UI (EE) (push) Has been cancelled
CI / 🔨 Test API (FIPS) (push) Has been cancelled
CI / 🔨 Test API Livechat (FIPS) (push) Has been cancelled
CI / 🔨 Test UI (FIPS) (push) Has been cancelled
CI / 🔨 Test Federation Matrix (push) Has been cancelled
CI / 📊 Report Coverage (push) Has been cancelled
CI / ✅ Tests Done (push) Has been cancelled
CI / 🚀 Publish build assets (push) Has been cancelled
CI / 🚀 Publish Docker Images (DockerHub) (push) Has been cancelled
CI / 🚀 Notify external services (push) Has been cancelled
CI / Update Version Durability (push) Has been cancelled
Release / Release (push) Has been cancelled
Code scanning - action / CodeQL-Build (push) Failing after 2s
Auto-close duplicate issues / auto-close-duplicates (push) Failing after 1s

This commit is contained in:
upstream-mirror
2026-09-16 01:21:02 +05:00
commit 30810eecd7
10161 changed files with 987110 additions and 0 deletions

1
packages/base64/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.build*

View File

@@ -0,0 +1,25 @@
# @rocket.chat/base64
## 1.0.14
### Patch Changes
- ([#38989](https://github.com/RocketChat/Rocket.Chat/pull/38989)) chore(eslint): Upgrades ESLint and its configuration
## 1.0.14-rc.0
### Patch Changes
- ([#38989](https://github.com/RocketChat/Rocket.Chat/pull/38989)) chore(eslint): Upgrades ESLint and its configuration
## 1.0.13
### Patch Changes
- ([#31138](https://github.com/RocketChat/Rocket.Chat/pull/31138)) feat(uikit): Move `@rocket.chat/ui-kit` package to the main monorepo
## 1.0.13-rc.0
### Patch Changes
- b223cbde14: feat(uikit): Move `@rocket.chat/ui-kit` package to the main monorepo

View File

@@ -0,0 +1,4 @@
# base64
***
This is an internal Meteor package.

View File

@@ -0,0 +1,6 @@
import server from '@rocket.chat/jest-presets/server';
import type { Config } from 'jest';
export default {
preset: server.preset,
} satisfies Config;

View File

@@ -0,0 +1,26 @@
{
"name": "@rocket.chat/base64",
"version": "1.0.14",
"private": true,
"description": "Base64 encoding and decoding; Fork of Meteor's Base64 package",
"main": "./dist/base64.js",
"types": "./dist/base64.d.ts",
"scripts": {
"build": "rm -rf dist && tsc -p tsconfig.build.json",
"dev": "tsc -p tsconfig.build.json --watch --preserveWatchOutput",
"lint": "eslint .",
"lint:fix": "eslint --fix .",
"test": "jest",
"testunit": "jest"
},
"devDependencies": {
"@rocket.chat/jest-presets": "workspace:~",
"@rocket.chat/tsconfig": "workspace:*",
"eslint": "~9.39.5",
"jest": "~30.2.0",
"typescript": "~5.9.3"
},
"volta": {
"extends": "../../package.json"
}
}

View File

@@ -0,0 +1,41 @@
import { Base64 } from './base64';
describe('empty input', () => {
it('should encode empty string', () => {
expect(Base64.encode(new Uint8Array(0))).toStrictEqual('');
});
it('should decode empty string', () => {
expect(Base64.decode('')).toStrictEqual(new Uint8Array(new ArrayBuffer(0)));
});
});
describe('text examples', () => {
it.each([
['pleasure.', 'cGxlYXN1cmUu'],
['leasure.', 'bGVhc3VyZS4='],
['easure.', 'ZWFzdXJlLg=='],
['asure.', 'YXN1cmUu'],
['sure.', 'c3VyZS4='],
])('encodes and decodes %p', (txt, res) => {
const encoded = Base64.encode(Buffer.from(txt, 'ascii'));
expect(encoded).toBe(res);
const decoded = Buffer.from(Base64.decode(res)).toString('ascii');
expect(decoded).toBe(txt);
});
});
describe('non-text examples', () => {
it.each([
[[0, 0, 0], 'AAAA'],
[[0, 0, 1], 'AAAB'],
])('encodes and decodes %p', (array, b64) => {
const encoded = Base64.encode(array);
expect(encoded).toBe(b64);
const decoded = Base64.decode(b64);
const expectedAsBinary = Uint8Array.from({ length: array.length }, (_, i) => array[i]);
expect(decoded).toStrictEqual(expectedAsBinary);
});
});

View File

@@ -0,0 +1,136 @@
// Base 64 encoding
const BASE_64_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
const BASE_64_VALS = Object.create(null);
const getChar = (val: number) => BASE_64_CHARS.charAt(val);
const getVal = (ch: string) => (ch === '=' ? -1 : BASE_64_VALS[ch]);
for (let i = 0; i < BASE_64_CHARS.length; i++) {
BASE_64_VALS[getChar(i)] = i;
}
const newBinary = (len: number) => new Uint8Array(new ArrayBuffer(len));
const encode = (array: ArrayLike<number> | string) => {
if (typeof array === 'string') {
const str = array;
const binary = newBinary(str.length);
for (let i = 0; i < str.length; i++) {
const ch = str.charCodeAt(i);
if (ch > 0xff) {
throw new Error('Not ascii. Base64.encode can only take ascii strings.');
}
binary[i] = ch;
}
array = binary;
}
const answer: string[] = [];
let a: number | null = null;
let b: number | null = null;
let c: number | null = null;
let d: number | null = null;
for (let i = 0; i < array.length; i++) {
switch (i % 3) {
case 0:
a = (array[i] >> 2) & 0x3f;
b = (array[i] & 0x03) << 4;
break;
case 1:
b = (b ?? 0) | ((array[i] >> 4) & 0xf);
c = (array[i] & 0xf) << 2;
break;
case 2:
c = (c ?? 0) | ((array[i] >> 6) & 0x03);
d = array[i] & 0x3f;
answer.push(getChar(a ?? 0));
answer.push(getChar(b ?? 0));
answer.push(getChar(c));
answer.push(getChar(d));
a = null;
b = null;
c = null;
d = null;
break;
}
}
if (a !== null) {
answer.push(getChar(a));
answer.push(getChar(b ?? 0));
if (c === null) {
answer.push('=');
} else {
answer.push(getChar(c));
}
if (d === null) {
answer.push('=');
}
}
return answer.join('');
};
const decode = (str: string) => {
let len = Math.floor((str.length * 3) / 4);
if (str.charAt(str.length - 1) === '=') {
len--;
if (str.charAt(str.length - 2) === '=') {
len--;
}
}
const arr = newBinary(len);
let one: number | null = null;
let two: number | null = null;
let three: number | null = null;
let j = 0;
for (let i = 0; i < str.length; i++) {
const c = str.charAt(i);
const v = getVal(c);
switch (i % 4) {
case 0:
if (v < 0) {
throw new Error('invalid base64 string');
}
one = v << 2;
break;
case 1:
if (v < 0) {
throw new Error('invalid base64 string');
}
one = (one ?? 0) | (v >> 4);
arr[j++] = one;
two = (v & 0x0f) << 4;
break;
case 2:
if (v >= 0) {
two = (two ?? 0) | (v >> 2);
arr[j++] = two;
three = (v & 0x03) << 6;
}
break;
case 3:
if (v >= 0) {
arr[j++] = (three ?? 0) | v;
}
break;
}
}
return arr;
};
export const Base64 = { encode, decode, newBinary };

View File

@@ -0,0 +1,12 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "dist",
"target": "ES2015",
"module": "ESNext",
"declaration": true,
"declarationMap": true,
"sourceMap": true,
},
"exclude": ["**/*.spec.ts"]
}

View File

@@ -0,0 +1,7 @@
{
"extends": "@rocket.chat/tsconfig/base.json",
"compilerOptions": {
"rootDir": "src",
},
"include": ["src"]
}