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
Auto-close duplicate issues / auto-close-duplicates (push) Failing after 1s
Code scanning - action / CodeQL-Build (push) Failing after 1s
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
Auto-close duplicate issues / auto-close-duplicates (push) Failing after 1s
Code scanning - action / CodeQL-Build (push) Failing after 1s
This commit is contained in:
93
packages/jwt/__tests__/jwt.spec.ts
Normal file
93
packages/jwt/__tests__/jwt.spec.ts
Normal file
@@ -0,0 +1,93 @@
|
||||
import { generateKeyPair, exportPKCS8, exportSPKI } from 'jose';
|
||||
|
||||
import { sign, verify } from '../src/index';
|
||||
|
||||
it('should sign and verify a jwt with RS256', async () => {
|
||||
const { publicKey, privateKey } = await generateKeyPair('RS256');
|
||||
const spki = await exportSPKI(publicKey);
|
||||
const pkcs8 = await exportPKCS8(privateKey);
|
||||
|
||||
const licenseV3 = {
|
||||
information: {
|
||||
id: '64d28d096400df50b6ace670',
|
||||
autoRenew: true,
|
||||
createdAt: '2023-08-08T18:44:25.719+0000',
|
||||
visualExpiration: '2024-09-08T18:44:25.719+0000',
|
||||
notifyAdminsAt: '2024-09-01T18:44:25.719+0000',
|
||||
notifyUsersAt: '2024-09-05T18:44:25.719+0000',
|
||||
trial: false,
|
||||
offline: false,
|
||||
grantedBy: { method: 'manual', seller: 'john.rocketseed@rocket.chat' },
|
||||
grantedTo: { name: 'Alice Clientseed', company: 'Client', email: 'alice.clientseed@client.com' },
|
||||
legalText: "This license can't be used for reselling",
|
||||
notes: 'Plan Premium',
|
||||
tags: [{ name: 'Enterprise', color: '#CCCCCC' }],
|
||||
},
|
||||
validation: {
|
||||
serverUrls: [{ value: 'https://localhost:3000', type: 'url' }],
|
||||
serverVersions: [{ value: '6.4' }],
|
||||
cloudWorkspaceId: 'alks-a9sj0diba09shdiasodjha9s0diha9s9duabsiuhdai0sdh0a9hs09da09s8d09a80s9d8',
|
||||
serverUniqueId: '64d28d096400df50b6ace670',
|
||||
validUntil: '2024-09-18T18:44:25.719+0000',
|
||||
validFrom: '2024-07-08T18:44:25.719+0000',
|
||||
installationAllowedUntil: '2024-07-09T18:44:25.719+0000',
|
||||
legalTextAgreement: { type: 'accepted', acceptedVia: 'cloud' },
|
||||
statisticsReport: { required: true, allowedStaleInDays: 5 },
|
||||
},
|
||||
grantedModules: [
|
||||
{ module: 'auditing' },
|
||||
{ module: 'canned-responses' },
|
||||
{ module: 'ldap-enterprise' },
|
||||
{ module: 'livechat-enterprise' },
|
||||
{ module: 'voip-enterprise' },
|
||||
{ module: 'omnichannel-mobile-enterprise' },
|
||||
{ module: 'engagement-dashboard' },
|
||||
{ module: 'push-privacy' },
|
||||
{ module: 'scalability' },
|
||||
{ module: 'teams-mention' },
|
||||
{ module: 'saml-enterprise' },
|
||||
{ module: 'oauth-enterprise' },
|
||||
{ module: 'device-management' },
|
||||
{ module: 'federation' },
|
||||
{ module: 'videoconference-enterprise' },
|
||||
{ module: 'message-read-receipt' },
|
||||
{ module: 'outlook-calendar' },
|
||||
{ module: 'unlimited-presence' },
|
||||
{ module: 'outbound-messaging' },
|
||||
{ module: 'abac' },
|
||||
],
|
||||
limits: {
|
||||
activeUsers: [
|
||||
{ max: 500, behavior: 'start_fair_policy' },
|
||||
{ max: 1000, behavior: 'prevent_action' },
|
||||
{ max: 1100, behavior: 'invalidate_license' },
|
||||
],
|
||||
guestUsers: [
|
||||
{ max: 200, behavior: 'start_fair_policy' },
|
||||
{ max: 400, behavior: 'prevent_action' },
|
||||
{ max: 500, behavior: 'invalidate_license' },
|
||||
],
|
||||
roomsPerGuest: [
|
||||
{ max: 5, behavior: 'start_fair_policy' },
|
||||
{ max: 10, behavior: 'prevent_action' },
|
||||
],
|
||||
privateApps: [
|
||||
{ max: 5, behavior: 'start_fair_policy' },
|
||||
{ max: 10, behavior: 'prevent_action' },
|
||||
{ max: 11, behavior: 'invalidate_license' },
|
||||
],
|
||||
marketplaceApps: [
|
||||
{ max: 5, behavior: 'start_fair_policy' },
|
||||
{ max: 10, behavior: 'prevent_action' },
|
||||
{ max: 11, behavior: 'invalidate_license' },
|
||||
],
|
||||
},
|
||||
cloudMeta: { lastStatisticId: '64d28d096400df50b6ace671' },
|
||||
};
|
||||
|
||||
const token = await sign(licenseV3, pkcs8);
|
||||
const [payload, protectedHeader] = await verify(token, spki);
|
||||
|
||||
expect(protectedHeader).toEqual({ alg: 'RS256', typ: 'JWT' });
|
||||
expect(payload).toEqual(licenseV3);
|
||||
});
|
||||
Reference in New Issue
Block a user