diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..76690fddb45485bef5b16dd2929f300e364bb074 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.env +node_modules +server.log +keys.json diff --git a/README.md b/README.md index 7be5fc7f47d5db027d120b8024982df93db95b74..44fee2947ee5a980350e243fa59b80963843fbf8 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,116 @@ ---- -license: mit ---- +# microipfs: The Permanent Record as a Service + +> A scalable microservice for creating permanent, verifiable academic records on IPFS. + +This project provides a suite of tools for educational institutions to transition to a model of student-owned, verifiable digital records. It acts as a "Permanent Record as a Service," leveraging the power of IPFS for immutable storage and Verifiable Credentials for cryptographic proof. + +# Core Features + +1. **Batch Archiving (`/batch-archive`):** A scalable endpoint for institutions to archive large volumes of student work (e.g., end-of-semester projects) to IPFS. It returns a single, easily-managed root CID for the entire batch. +2. **Verifiable Credentials with IPFS Proof (`/issue-credential`):** A system for issuing tamper-proof academic credentials (e.g., for a diploma or a specific skill) that are cryptographically linked to the underlying student work stored on IPFS. +3. **Student-Owned Identity & Data:** The platform includes reference implementations for a student-run digital wallet (`/portfolio.html`) with client-side encryption, and a public verifier (`/verify.html`) that can perform "deep verification" of a credential and its linked proof of work. +4. **Learning Object Repository (`/add-learning-object`):** A tool for creating permanent, resilient archives of open educational resources. +5. **AI Model Playground (`/playground.html`):** An interactive tool for running small AI/ML models directly in the browser from IPFS. + +--- + +# Installation and Setup + +## 1. Install Dependencies +```bash +npm install +``` + +## 2. Configure Environment +Create a `.env` file in the root of the project and add your `NFT_STORAGE_KEY`. +``` +NFT_STORAGE_KEY= +``` + +## 3. Run the Server +```bash +node index.js +``` +The server will start, and if `keys.json` is not found, it will generate a new key pair for signing Verifiable Credentials. + +--- + +# API Reference + +## 1. Batch Archive + +A scalable endpoint for creating a permanent archive of multiple files in a single transaction. + +**Endpoint:** `POST /batch-archive` + +**Body (JSON):** An object with an `items` property, which is an array of objects. Each object must have a `url` (the URL of the content to pin) and can have an optional `metadata` object. +```json +{ + "items": [ + { + "url": "https://example.com/student-a/thesis.pdf", + "metadata": { "studentId": "123", "title": "My Final Thesis" } + }, + { + "url": "https://example.com/student-b/project.zip", + "metadata": { "studentId": "456", "title": "Capstone Project" } + } + ] +} +``` +The endpoint returns a single `manifestCid` for the entire batch. + +## 2. Issue Verifiable Credential + +Issues a W3C-compliant Verifiable Credential (VC) as a JWT. + +**Endpoint:** `POST /issue-credential` + +**Body (JSON):** +* `studentDid` (string): The Decentralized Identifier of the student. +* `claims` (object): A JSON object containing the claims to be included in the credential (e.g., `{ "degree": "Bachelor of Science" }`). +* `proofOfWorkCID` (string, optional): The IPFS CID of a manifest file (e.g., from a batch archive) that contains the evidence supporting this credential. This enables "deep verification." + +The server signs the credential with its private key. The public key is available at `/.well-known/jwks.json` for verifiers. + +## 3. Pin Learning Object + +Pins a single educational resource with rich metadata. + +**Endpoint:** `POST /add-learning-object` (multipart/form-data) + +**Fields:** `files`, `title`, `author`, `subject`, `gradeLevel`, `license`, `description`. + +## 4. Pin Encrypted Object (Student Portfolio) + +Stores a pre-encrypted blob of data. The server has no knowledge of the contents. + +**Endpoint:** `POST /add-encrypted-object` (multipart/form-data) + +**Fields:** `file` + +## 5. Check CID Status + +Checks the pinning status of a CID on NFT.storage. + +**Endpoint:** `GET /status/:cid` + +--- + +# Future Vision: DIDs in K-12 Education + +The question of how a K-12 school in the U.S. could issue DIDs requires a thoughtful approach that balances state-level educational requirements with federal privacy laws. A successful implementation would not be a single, monolithic system, but a federated trust network. + +## A Potential Roadmap + +1. **Adopt the `did:web` Method:** This is the most practical starting point. Each school district could host their DID documents on their own web servers, making their DIDs resolvable via standard HTTPS. This avoids the need for a custom blockchain and leverages existing, trusted infrastructure. A school's DID might look like `did:web:bostonschools.org:students:12345`. + +2. **State-Level Trust Registries:** Each state's Department of Public Instruction (DPI) could maintain a cryptographically-verifiable list of all accredited school districts in their state. This registry would essentially be a "DID of DIDs," allowing anyone to confirm that a particular school district is a legitimate issuer of student credentials. + +3. **Cross-State Interoperability:** A national body, perhaps facilitated by the U.S. Department of Education, could maintain a registry of all state DPIs. This would create a chain of trust from the federal level down to the individual school district, allowing a university in California to verify a credential from a high school in Massachusetts. + +## Key Considerations + +* **Privacy (FERPA & COPPA):** Verifiable Credentials allow for "selective disclosure." A student could prove they are over 13 without revealing their exact birthdate, or prove they are a student at a particular school without revealing their student ID number. This is a significant privacy enhancement over traditional, all-or-nothing ID cards. +* **Key Management for Minors:** For younger students, the school or district could act as a "custodial wallet," managing the student's private keys. As students get older, they could be taught to manage their own keys, perhaps in a dedicated digital literacy course. +* **Verifiable Credentials for Everything:** This system could be used for more than just identity. It could be used to issue verifiable credentials for transcripts, attendance records, and even individual skills or competencies, creating a rich, student-owned "learning ledger." diff --git a/index.js b/index.js new file mode 100644 index 0000000000000000000000000000000000000000..d4964470ed0e3d1ae85eabd602079ea864d9c821 --- /dev/null +++ b/index.js @@ -0,0 +1,249 @@ +require('dotenv').config() +var cors = require('cors') +var { I } = require('ipfsio') +var express = require('express') +var multer = require('multer') +const fs = require('fs') +const fsp = require('fs').promises +const { randomUUID } = require('crypto'); +const axios = require('axios') +const jose = require('jose') +var app = express() +var i = new I(process.env.NFT_STORAGE_KEY) + +let institutionKeyPair; +const KEY_FILE = 'keys.json'; + +async function initializeKeys() { + try { + if (fs.existsSync(KEY_FILE)) { + const keyFileContent = await fsp.readFile(KEY_FILE, 'utf-8'); + const jwk = JSON.parse(keyFileContent); + institutionKeyPair = { + publicKey: await jose.importJWK(jwk.publicKey, 'ES256'), + privateKey: await jose.importJWK(jwk.privateKey, 'ES256'), + }; + console.log('Loaded institutional key pair from file.'); + } else { + const { publicKey, privateKey } = await jose.generateKeyPair('ES256'); + institutionKeyPair = { publicKey, privateKey }; + const jwk = { + publicKey: await jose.exportJWK(publicKey), + privateKey: await jose.exportJWK(privateKey), + }; + await fsp.writeFile(KEY_FILE, JSON.stringify(jwk, null, 2)); + console.log('Generated new institutional key pair and saved to file.'); + } + } catch (error) { + console.error('Failed to initialize keys:', error); + } +} + +initializeKeys(); + +const recentUploads = [] +const MAX_RECENT_UPLOADS = 10 + +const UPLOAD_DIR = 'uploads/' +if (!fs.existsSync(UPLOAD_DIR)) { + fs.mkdirSync(UPLOAD_DIR) +} + +const allowed = (process.env.ALLOWED ? process.env.ALLOWED.split(",") : []) +const port = (process.env.PORT ? process.env.PORT : 3000) +const issuerDid = process.env.ISSUER_DID || 'did:web:example.com'; +const storage = multer.diskStorage({ + destination: function (req, file, cb) { + cb(null, UPLOAD_DIR) + }, + filename: function (req, file, cb) { + const uniqueSuffix = Date.now() + '-' + Math.round(Math.random() * 1E9) + cb(null, file.fieldname + '-' + uniqueSuffix) + } +}) +const upload = multer({ + storage: storage, + limits: { + fileSize: 1024 * 1024 * 5, // 5MB + files: 10 + } +}) +app.use(express.json()) +app.use(express.static('public')) +if (allowed && allowed.length > 0) { + app.use(cors({ origin: allowed })) +} else { + app.use(cors()) +} +app.use(express.urlencoded({ extended: true })); +app.post('/add', async (req, res) => { + let cid; + if (req.body.url) { + cid = await i.url(req.body.url) + } else if (req.body.object) { + cid = await i.object(req.body.object) + } + console.log("cid", cid) + res.json({ success: cid }) +}) +app.get('/.well-known/jwks.json', async (req, res) => { + if (!institutionKeyPair || !institutionKeyPair.publicKey) { + return res.status(500).json({ error: 'Key pair not generated yet.' }); + } + const jwk = await jose.exportJWK(institutionKeyPair.publicKey); + res.json({ keys: [jwk] }); +}); + +app.post('/issue-credential', async (req, res) => { + if (!institutionKeyPair || !institutionKeyPair.privateKey) { + return res.status(500).json({ error: 'Key pair not generated yet.' }); + } + + const { studentDid, proofOfWorkCID, claims } = req.body; + if (!studentDid || !claims) { + return res.status(400).json({ error: 'Missing studentDid or claims.' }); + } + + try { + const vcPayload = { + '@context': [ + 'https://www.w3.org/2018/credentials/v1', + 'https://www.w3.org/2018/credentials/examples/v1' + ], + id: `urn:uuid:${randomUUID()}`, + type: ['VerifiableCredential', 'AcademicCredential'], + issuer: issuerDid, + issuanceDate: new Date().toISOString(), + credentialSubject: { + id: studentDid, + proofOfWorkCID: proofOfWorkCID, + ...claims + } + }; + + const jwt = await new jose.SignJWT(vcPayload) + .setProtectedHeader({ alg: 'ES256' }) + .setIssuedAt() + .setIssuer(issuerDid) + .setSubject(studentDid) + .sign(institutionKeyPair.privateKey); + + res.json({ vcJwt: jwt }); + } catch (error) { + console.error('Failed to issue credential:', error); + res.status(500).json({ error: 'Failed to issue credential.' }); + } +}); +app.post('/batch-archive', async (req, res) => { + const { items } = req.body; // Expects an array of objects with { url, metadata } + + if (!items || !Array.isArray(items) || items.length === 0) { + return res.status(400).json({ error: 'Invalid or empty "items" array in request body.' }); + } + + try { + const processingPromises = items.map(async (item) => { + const cid = await i.url(item.url); + return { cid, metadata: item.metadata }; + }); + + const processedItems = await Promise.all(processingPromises); + + const manifest = { + archiveDate: new Date().toISOString(), + items: processedItems, + }; + + const manifestCid = await i.object(manifest); + res.json({ success: true, manifestCid }); + + } catch (error) { + console.error('Batch archive failed:', error); + res.status(500).json({ error: 'Failed to process batch archive.' }); + } +}); +app.get('/recent', (req, res) => { + res.json(recentUploads) +}) + +app.get('/status/:cid', async (req, res) => { + const { cid } = req.params + try { + const response = await axios.get(`https://api.nft.storage/check/${cid}`, { + headers: { + 'Authorization': `Bearer ${process.env.NFT_STORAGE_KEY}` + } + }) + res.json(response.data) + } catch (error) { + if (error.response) { + res.status(error.response.status).json({ error: error.response.data }) + } else { + res.status(500).json({ error: 'Failed to check CID status' }) + } + } +}) + +app.post('/add-encrypted-object', upload.single('file'), async (req, res) => { + const file = req.file + if (!file) { + return res.status(400).json({ error: 'No file uploaded' }) + } + + try { + const cid = await i.path(file.path) + res.json({ success: cid }) + } catch (error) { + console.error('Failed to pin encrypted object:', error) + res.status(500).json({ error: 'Failed to pin encrypted object' }) + } finally { + // Clean up the temporary file + await fsp.unlink(file.path) + } +}) + +app.post('/add-learning-object', upload.array('files'), async (req, res) => { + const files = req.files + if (!files || files.length === 0) { + return res.status(400).json({ error: 'No files uploaded' }) + } + + const { title, author, subject, gradeLevel, license, description } = req.body + + try { + const cids = [] + for (const file of files) { + const cid = await i.path(file.path) + cids.push({ + filename: file.originalname, + cid: cid + }) + } + + const manifest = { + title: title || 'Untitled Learning Object', + author: author || 'Unknown', + subject: subject || 'Uncategorized', + gradeLevel: gradeLevel || 'N/A', + license: license || 'CC-BY-4.0', + description: description || '', + files: cids + } + + const manifestCid = await i.object(manifest) + + recentUploads.unshift(manifestCid) + if (recentUploads.length > MAX_RECENT_UPLOADS) { + recentUploads.pop() + } + + res.json({ success: manifestCid }) + } catch (error) { + console.error('Failed to process dataset:', error) + res.status(500).json({ error: 'Failed to process dataset' }) + } finally { + const unlinkPromises = files.map(file => fsp.unlink(file.path)) + await Promise.all(unlinkPromises) + } +}) +app.listen(port) diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000000000000000000000000000000000000..7eebd38acc3dbeb9aeae42d304237a06621c1ffe --- /dev/null +++ b/package-lock.json @@ -0,0 +1,3380 @@ +{ + "name": "microipfs", + "version": "0.0.1", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "microipfs", + "version": "0.0.1", + "license": "MIT", + "dependencies": { + "axios": "^1.13.2", + "cors": "^2.8.5", + "dotenv": "^10.0.0", + "express": "^4.17.2", + "ipfsio": "^0.0.8", + "jose": "^6.1.3", + "multer": "^2.0.1" + }, + "devDependencies": {} + }, + "node_modules/@assemblyscript/loader": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/@assemblyscript/loader/-/loader-0.9.4.tgz", + "integrity": "sha512-HazVq9zwTVwGmqdwYzu7WyQ6FQVZ7SwET0KKQuKm55jD0IfUpZgN0OPIiZG3zV1iSrVYcN0bdwLRXI/VNCYsUA==", + "license": "Apache-2.0" + }, + "node_modules/@babel/code-frame": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.27.1.tgz", + "integrity": "sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg==", + "license": "MIT", + "dependencies": { + "@babel/helper-validator-identifier": "^7.27.1", + "js-tokens": "^4.0.0", + "picocolors": "^1.1.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz", + "integrity": "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==", + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@ipld/car": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/@ipld/car/-/car-3.2.4.tgz", + "integrity": "sha512-rezKd+jk8AsTGOoJKqzfjLJ3WVft7NZNH95f0pfPbicROvzTyvHCNy567HzSUd6gRXZ9im29z5ZEv9Hw49jSYw==", + "license": "(Apache-2.0 AND MIT)", + "dependencies": { + "@ipld/dag-cbor": "^7.0.0", + "multiformats": "^9.5.4", + "varint": "^6.0.0" + } + }, + "node_modules/@ipld/car/node_modules/@ipld/dag-cbor": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/@ipld/dag-cbor/-/dag-cbor-7.0.3.tgz", + "integrity": "sha512-1VVh2huHsuohdXC1bGJNE8WR72slZ9XE2T3wbBBq31dm7ZBatmKLLxrB+XAqafxfRFjv08RZmj/W/ZqaM13AuA==", + "license": "(Apache-2.0 AND MIT)", + "dependencies": { + "cborg": "^1.6.0", + "multiformats": "^9.5.4" + } + }, + "node_modules/@ipld/dag-cbor": { + "version": "6.0.15", + "resolved": "https://registry.npmjs.org/@ipld/dag-cbor/-/dag-cbor-6.0.15.tgz", + "integrity": "sha512-Vm3VTSTwlmGV92a3C5aeY+r2A18zbH2amehNhsX8PBa3muXICaWrN8Uri85A5hLH7D7ElhE8PdjxD6kNqUmTZA==", + "license": "(Apache-2.0 AND MIT)", + "dependencies": { + "cborg": "^1.5.4", + "multiformats": "^9.5.4" + } + }, + "node_modules/@ipld/dag-pb": { + "version": "2.1.18", + "resolved": "https://registry.npmjs.org/@ipld/dag-pb/-/dag-pb-2.1.18.tgz", + "integrity": "sha512-ZBnf2fuX9y3KccADURG5vb9FaOeMjFkCrNysB0PtftME/4iCTjxfaLoNq/IAh5fTqUOMXvryN6Jyka4ZGuMLIg==", + "license": "(Apache-2.0 AND MIT)", + "dependencies": { + "multiformats": "^9.5.4" + } + }, + "node_modules/@multiformats/murmur3": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@multiformats/murmur3/-/murmur3-1.1.3.tgz", + "integrity": "sha512-wAPLUErGR8g6Lt+bAZn6218k9YQPym+sjszsXL6o4zfxbA22P+gxWZuuD9wDbwL55xrKO5idpcuQUX7/E3oHcw==", + "license": "(Apache-2.0 AND MIT)", + "dependencies": { + "multiformats": "^9.5.4", + "murmurhash3js-revisited": "^3.0.0" + } + }, + "node_modules/@protobufjs/aspromise": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", + "integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/base64": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", + "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/codegen": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", + "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/eventemitter": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz", + "integrity": "sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/fetch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", + "integrity": "sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==", + "license": "BSD-3-Clause", + "dependencies": { + "@protobufjs/aspromise": "^1.1.1", + "@protobufjs/inquire": "^1.1.0" + } + }, + "node_modules/@protobufjs/float": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", + "integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/inquire": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", + "integrity": "sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/path": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", + "integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/pool": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", + "integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/utf8": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", + "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==", + "license": "BSD-3-Clause" + }, + "node_modules/@types/long": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.2.tgz", + "integrity": "sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA==", + "license": "MIT" + }, + "node_modules/@types/minimatch": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.5.tgz", + "integrity": "sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ==", + "license": "MIT" + }, + "node_modules/@types/minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-hov8bUuiLiyFPGyFPE1lwWhmzYbirOXQNNo40+y3zow8aFVTeyn3VWL0VFFfdNddA8S4Vf0Tc062rzyNr7Paag==", + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "25.0.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-25.0.1.tgz", + "integrity": "sha512-czWPzKIAXucn9PtsttxmumiQ9N0ok9FrBwgRWrwmVLlp86BrMExzvXRLFYRJ+Ex3g6yqj+KuaxfX1JTgV2lpfg==", + "license": "MIT", + "dependencies": { + "undici-types": "~7.16.0" + } + }, + "node_modules/@types/normalize-package-data": { + "version": "2.4.4", + "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.4.tgz", + "integrity": "sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==", + "license": "MIT" + }, + "node_modules/@types/retry": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.0.tgz", + "integrity": "sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA==", + "license": "MIT" + }, + "node_modules/@web-std/blob": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@web-std/blob/-/blob-3.0.5.tgz", + "integrity": "sha512-Lm03qr0eT3PoLBuhkvFBLf0EFkAsNz/G/AYCzpOdi483aFaVX86b4iQs0OHhzHJfN5C15q17UtDbyABjlzM96A==", + "license": "MIT", + "dependencies": { + "@web-std/stream": "1.0.0", + "web-encoding": "1.1.5" + } + }, + "node_modules/@web-std/fetch": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@web-std/fetch/-/fetch-3.0.0.tgz", + "integrity": "sha512-U1b9gjmBZllDL/B+F4eef0Yq2eJDsmPzZOGGOpoMry/bPIUVT0WCIj3PO6jZaGtcQY8JpyiFJa1S8Z4KJJGl0Q==", + "license": "MIT", + "dependencies": { + "@web-std/blob": "^3.0.0", + "@web-std/form-data": "^3.0.0", + "@web3-storage/multipart-parser": "^1.0.0", + "data-uri-to-buffer": "^3.0.1" + }, + "engines": { + "node": "^10.17 || >=12.3" + } + }, + "node_modules/@web-std/file": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@web-std/file/-/file-3.0.3.tgz", + "integrity": "sha512-X7YYyvEERBbaDfJeC9lBKC5Q5lIEWYCP1SNftJNwNH/VbFhdHm+3neKOQP+kWEYJmosbDFq+NEUG7+XIvet/Jw==", + "license": "MIT", + "dependencies": { + "@web-std/blob": "^3.0.3" + } + }, + "node_modules/@web-std/form-data": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@web-std/form-data/-/form-data-3.1.0.tgz", + "integrity": "sha512-WkOrB8rnc2hEK2iVhDl9TFiPMptmxJA1HaIzSdc2/qk3XS4Ny4cCt6/V36U3XmoYKz0Md2YyK2uOZecoZWPAcA==", + "license": "MIT", + "dependencies": { + "web-encoding": "1.1.5" + } + }, + "node_modules/@web-std/stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@web-std/stream/-/stream-1.0.0.tgz", + "integrity": "sha512-jyIbdVl+0ZJyKGTV0Ohb9E6UnxP+t7ZzX4Do3AHjZKxUXKMs9EmqnBDQgHF7bEw0EzbQygOjtt/7gvtmi//iCQ==", + "license": "MIT", + "dependencies": { + "web-streams-polyfill": "^3.1.1" + } + }, + "node_modules/@web3-storage/multipart-parser": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@web3-storage/multipart-parser/-/multipart-parser-1.0.0.tgz", + "integrity": "sha512-BEO6al7BYqcnfX15W2cnGR+Q566ACXAT9UQykORCWW80lmkpWsnEob6zJS1ZVBKsSJC8+7vJkHwlp+lXG1UCdw==", + "license": "(Apache-2.0 AND MIT)" + }, + "node_modules/@zxing/text-encoding": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/@zxing/text-encoding/-/text-encoding-0.9.0.tgz", + "integrity": "sha512-U/4aVJ2mxI0aDNI8Uq0wEhMgY+u4CNtEb0om3+y3+niDAsoTCOB33UF0sxpzqzdqXLqmvc+vZyAt4O8pPdfkwA==", + "license": "(Unlicense OR Apache-2.0)", + "optional": true + }, + "node_modules/abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "license": "MIT", + "peer": true, + "dependencies": { + "event-target-shim": "^5.0.0" + }, + "engines": { + "node": ">=6.5" + } + }, + "node_modules/accepts": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "license": "MIT", + "dependencies": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/any-signal": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/any-signal/-/any-signal-2.1.2.tgz", + "integrity": "sha512-B+rDnWasMi/eWcajPcCWSlYc7muXOrcYrqgyzcdKisl2H/WTlQ0gip1KyQfr0ZlxJdsuWCj/LWwQm7fhyhRfIQ==", + "license": "MIT", + "dependencies": { + "abort-controller": "^3.0.0", + "native-abort-controller": "^1.0.3" + } + }, + "node_modules/append-field": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/append-field/-/append-field-1.0.0.tgz", + "integrity": "sha512-klpgFSWLW1ZEs8svjfb7g4qWY0YS5imI82dTg+QahUvJ8YqAY0P10Uk8tTyh9ZGuYEZEMaeJYCF5BFuX552hsw==", + "license": "MIT" + }, + "node_modules/array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==", + "license": "MIT" + }, + "node_modules/arrify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", + "integrity": "sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "license": "MIT" + }, + "node_modules/available-typed-arrays": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", + "integrity": "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==", + "license": "MIT", + "dependencies": { + "possible-typed-array-names": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/axios": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.13.2.tgz", + "integrity": "sha512-VPk9ebNqPcy5lRGuSlKx752IlDatOjT9paPlm8A7yOuW2Fbvp4X3JznJtT4f0GzGLLiWE9W8onz51SqLYwzGaA==", + "license": "MIT", + "dependencies": { + "follow-redirects": "^1.15.6", + "form-data": "^4.0.4", + "proxy-from-env": "^1.1.0" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "license": "MIT" + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/bl": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-5.1.0.tgz", + "integrity": "sha512-tv1ZJHLfTDnXE6tMHv73YgSJaWR2AFuPwMntBe7XL/GBFHnT0CLnsHMogfk5+GzCDC5ZWarSCYaIGATZt9dNsQ==", + "license": "MIT", + "dependencies": { + "buffer": "^6.0.3", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "node_modules/blob-to-it": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/blob-to-it/-/blob-to-it-1.0.4.tgz", + "integrity": "sha512-iCmk0W4NdbrWgRRuxOriU8aM5ijeVLI61Zulsmg/lUHNr7pYjoj+U77opLefNagevtrrbMt3JQ5Qip7ar178kA==", + "license": "ISC", + "dependencies": { + "browser-readablestream-to-it": "^1.0.3" + } + }, + "node_modules/blockstore-core": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/blockstore-core/-/blockstore-core-1.0.5.tgz", + "integrity": "sha512-i/9CUMMvBALVbtSqUIuiWB3tk//a4Q2I2CEWiBuYNnhJvk/DWplXjLt8Sqc5VGkRVXVPSsEuH8fUtqJt5UFYcA==", + "license": "(Apache-2.0 OR MIT)", + "dependencies": { + "err-code": "^3.0.1", + "interface-blockstore": "^2.0.2", + "interface-store": "^2.0.1", + "it-all": "^1.0.4", + "it-drain": "^1.0.4", + "it-filter": "^1.0.2", + "it-take": "^1.0.1", + "multiformats": "^9.4.7" + } + }, + "node_modules/body-parser": { + "version": "1.20.4", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.4.tgz", + "integrity": "sha512-ZTgYYLMOXY9qKU/57FAo8F+HA2dGX7bqGc71txDRC1rS4frdFI5R7NhluHxH6M0YItAP0sHB4uqAOcYKxO6uGA==", + "license": "MIT", + "dependencies": { + "bytes": "~3.1.2", + "content-type": "~1.0.5", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "~1.2.0", + "http-errors": "~2.0.1", + "iconv-lite": "~0.4.24", + "on-finished": "~2.4.1", + "qs": "~6.14.0", + "raw-body": "~2.5.3", + "type-is": "~1.6.18", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/brace-expansion": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/browser-readablestream-to-it": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/browser-readablestream-to-it/-/browser-readablestream-to-it-1.0.3.tgz", + "integrity": "sha512-+12sHB+Br8HIh6VAMVEG5r3UXCyESIgDW7kzk3BjIXa43DVqVwL7GC5TW3jeh+72dtcH99pPVpw0X8i0jt+/kw==", + "license": "ISC" + }, + "node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "license": "MIT" + }, + "node_modules/busboy": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", + "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==", + "dependencies": { + "streamsearch": "^1.1.0" + }, + "engines": { + "node": ">=10.16.0" + } + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.8.tgz", + "integrity": "sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.0", + "es-define-property": "^1.0.0", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/camelcase-keys": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-6.2.2.tgz", + "integrity": "sha512-YrwaA0vEKazPBkn0ipTiMpSajYDSe+KjQfrjhcBMxJt/znbvlHd8Pw/Vamaz5EB4Wfhs3SUR3Z9mwRu/P3s3Yg==", + "license": "MIT", + "dependencies": { + "camelcase": "^5.3.1", + "map-obj": "^4.0.0", + "quick-lru": "^4.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/carbites": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/carbites/-/carbites-1.0.6.tgz", + "integrity": "sha512-dS9IQvnrb5VIRvSTNz5Ff+mB9d2MFfi5mojtJi7Rlss79VeF190jr0sZdA7eW0CGHotvHkZaWuM6wgfD9PEFRg==", + "license": "(Apache-2.0 AND MIT)", + "dependencies": { + "@ipld/car": "^3.0.1", + "@ipld/dag-cbor": "^6.0.3", + "@ipld/dag-pb": "^2.0.2", + "multiformats": "^9.0.4" + } + }, + "node_modules/cborg": { + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/cborg/-/cborg-1.10.2.tgz", + "integrity": "sha512-b3tFPA9pUr2zCUiCfRd2+wok2/LBSNUMKOuRRok+WlvvAgEt/PlbgPTsZUcwCOs53IJvLgTp0eotwtosE6njug==", + "license": "Apache-2.0", + "bin": { + "cborg": "cli.js" + } + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "license": "MIT", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "license": "MIT" + }, + "node_modules/concat-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-2.0.0.tgz", + "integrity": "sha512-MWufYdFw53ccGjCA+Ol7XJYpAlW6/prSMzuPOTRnJGcGzuhLn4Scrz7qf6o8bROZ514ltazcIFJZevcfbo0x7A==", + "engines": [ + "node >= 6.0" + ], + "license": "MIT", + "dependencies": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.0.2", + "typedarray": "^0.0.6" + } + }, + "node_modules/content-disposition": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", + "license": "MIT", + "dependencies": { + "safe-buffer": "5.2.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.7.tgz", + "integrity": "sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA==", + "license": "MIT" + }, + "node_modules/cors": { + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", + "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", + "license": "MIT", + "dependencies": { + "object-assign": "^4", + "vary": "^1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/data-uri-to-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-3.0.1.tgz", + "integrity": "sha512-WboRycPNsVw3B3TL559F7kuBUM4d8CgMEvk6xEJlOp7OBPjt6G7z8WMWlD2rOFZLk6OYfFIUGsCOWzcQH9K2og==", + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/decamelize-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/decamelize-keys/-/decamelize-keys-1.1.1.tgz", + "integrity": "sha512-WiPxgEirIV0/eIOMcnFBA3/IJZAZqKnwAwWyvvdi4lsr1WCN22nhdf/3db3DoZcUjTV2SqfzIwNyp6y2xs3nmg==", + "license": "MIT", + "dependencies": { + "decamelize": "^1.1.0", + "map-obj": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/decamelize-keys/node_modules/map-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", + "integrity": "sha512-7N/q3lyZ+LVCp7PzuxrJr4KMbBE2hW7BT7YNia330OFxIf4d3r5zVpicP2650l7CPN6RM9zOJRl3NGpqSiw3Eg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/define-data-property": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "license": "MIT", + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/destroy": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", + "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", + "license": "MIT", + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/dns-over-http-resolver": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/dns-over-http-resolver/-/dns-over-http-resolver-1.2.3.tgz", + "integrity": "sha512-miDiVSI6KSNbi4SVifzO/reD8rMnxgrlnkrlkugOLQpWQTe2qMdHsZp5DmfKjxNE+/T3VAAYLQUZMv9SMr6+AA==", + "license": "MIT", + "dependencies": { + "debug": "^4.3.1", + "native-fetch": "^3.0.0", + "receptacle": "^1.3.2" + } + }, + "node_modules/dns-over-http-resolver/node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/dns-over-http-resolver/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/dotenv": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz", + "integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=10" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", + "license": "MIT" + }, + "node_modules/electron-fetch": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/electron-fetch/-/electron-fetch-1.9.1.tgz", + "integrity": "sha512-M9qw6oUILGVrcENMSRRefE1MbHPIz0h79EKIeJWK9v563aT9Qkh8aEHPO1H5vi970wPirNY+jO9OpFoLiMsMGA==", + "license": "MIT", + "dependencies": { + "encoding": "^0.1.13" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/encodeurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/encoding": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz", + "integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==", + "license": "MIT", + "dependencies": { + "iconv-lite": "^0.6.2" + } + }, + "node_modules/encoding/node_modules/iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/err-code": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/err-code/-/err-code-3.0.1.tgz", + "integrity": "sha512-GiaH0KJUewYok+eeY05IIgjtAe4Yltygk9Wqp1V5yVWLdhf0hYZchRjNIT9bb0mSwRcIusT3cx7PJUf3zEIfUA==", + "license": "MIT" + }, + "node_modules/error-ex": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.4.tgz", + "integrity": "sha512-sqQamAnR14VgCr1A618A3sGrygcpK+HEbenA/HiEAkkUwcZIIB/tgWqHFxWgOyDh4nB4JCRimh79dR5Ywc9MDQ==", + "license": "MIT", + "dependencies": { + "is-arrayish": "^0.2.1" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-set-tostringtag": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", + "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", + "license": "MIT" + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/express": { + "version": "4.22.1", + "resolved": "https://registry.npmjs.org/express/-/express-4.22.1.tgz", + "integrity": "sha512-F2X8g9P1X7uCPZMA3MVf9wcTqlyNp7IhH5qPCI0izhaOIYXaW9L535tGA3qmjRzpH+bZczqq7hVKxTR4NWnu+g==", + "license": "MIT", + "dependencies": { + "accepts": "~1.3.8", + "array-flatten": "1.1.1", + "body-parser": "~1.20.3", + "content-disposition": "~0.5.4", + "content-type": "~1.0.4", + "cookie": "~0.7.1", + "cookie-signature": "~1.0.6", + "debug": "2.6.9", + "depd": "2.0.0", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "~1.3.1", + "fresh": "~0.5.2", + "http-errors": "~2.0.0", + "merge-descriptors": "1.0.3", + "methods": "~1.1.2", + "on-finished": "~2.4.1", + "parseurl": "~1.3.3", + "path-to-regexp": "~0.1.12", + "proxy-addr": "~2.0.7", + "qs": "~6.14.0", + "range-parser": "~1.2.1", + "safe-buffer": "5.2.1", + "send": "~0.19.0", + "serve-static": "~1.16.2", + "setprototypeof": "1.2.0", + "statuses": "~2.0.1", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "engines": { + "node": ">= 0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/fast-fifo": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.2.tgz", + "integrity": "sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==", + "license": "MIT" + }, + "node_modules/finalhandler": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.2.tgz", + "integrity": "sha512-aA4RyPcd3badbdABGDuTXCMTtOneUCAYH/gxoYRTZlIJdF0YPWuGqiAsIrhNnnqdXGswYk6dGujem4w80UJFhg==", + "license": "MIT", + "dependencies": { + "debug": "2.6.9", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "on-finished": "~2.4.1", + "parseurl": "~1.3.3", + "statuses": "~2.0.2", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "license": "MIT", + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/follow-redirects": { + "version": "1.15.11", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.11.tgz", + "integrity": "sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "license": "MIT", + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/for-each": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.5.tgz", + "integrity": "sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg==", + "license": "MIT", + "dependencies": { + "is-callable": "^1.2.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/form-data": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.5.tgz", + "integrity": "sha512-8RipRLol37bNs2bhoV67fiTEvdTrbMUYcFTiy3+wuuOnUog2QBHCZWXDRijWQfAkhBj2Uf5UnVaiWwA5vdd82w==", + "license": "MIT", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "es-set-tostringtag": "^2.1.0", + "hasown": "^2.0.2", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/generator-function": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/generator-function/-/generator-function-2.0.1.tgz", + "integrity": "sha512-SFdFmIJi+ybC0vjlHN0ZGVGHc3lgE0DxPAT0djjVg+kjOnSqclqmj0KQ7ykTOLP6YxoqOvuAODGdcHJn+43q3g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-iterator": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/get-iterator/-/get-iterator-1.0.2.tgz", + "integrity": "sha512-v+dm9bNVfOYsY1OrhaCrmyOcYoSeVvbt+hHZ0Au+T+p1y+0Uyj9aMaGIeUTT6xdpRbWzDeYKvfOslPhggQMcsg==", + "license": "MIT" + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hamt-sharding": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/hamt-sharding/-/hamt-sharding-2.0.1.tgz", + "integrity": "sha512-vnjrmdXG9dDs1m/H4iJ6z0JFI2NtgsW5keRkTcM85NGak69Mkf5PHUqBz+Xs0T4sg0ppvj9O5EGAJo40FTxmmA==", + "license": "MIT", + "dependencies": { + "sparse-array": "^1.3.1", + "uint8arrays": "^3.0.0" + }, + "engines": { + "node": ">=10.0.0", + "npm": ">=6.0.0" + } + }, + "node_modules/hard-rejection": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/hard-rejection/-/hard-rejection-2.1.0.tgz", + "integrity": "sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/has-property-descriptors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "license": "MIT", + "dependencies": { + "es-define-property": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "license": "MIT", + "dependencies": { + "has-symbols": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/hosted-git-info": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.1.0.tgz", + "integrity": "sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA==", + "license": "ISC", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/http-errors": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz", + "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==", + "license": "MIT", + "dependencies": { + "depd": "~2.0.0", + "inherits": "~2.0.4", + "setprototypeof": "~1.2.0", + "statuses": "~2.0.2", + "toidentifier": "~1.0.1" + }, + "engines": { + "node": ">= 0.8" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/idb-keyval": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/idb-keyval/-/idb-keyval-6.2.2.tgz", + "integrity": "sha512-yjD9nARJ/jb1g+CvD0tlhUHOrJ9Sy0P8T9MF3YaLlHnSRpwPfpTX0XIvpmw3gAJUmEu3FiICLBDPXVwyEvrleg==", + "license": "Apache-2.0" + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/indent-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", + "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" + }, + "node_modules/interface-blockstore": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/interface-blockstore/-/interface-blockstore-2.0.3.tgz", + "integrity": "sha512-OwVUnlNcx7H5HloK0Myv6c/C1q9cNG11HX6afdeU6q6kbuNj8jKCwVnmJHhC94LZaJ+9hvVOk4IUstb3Esg81w==", + "license": "(Apache-2.0 OR MIT)", + "dependencies": { + "interface-store": "^2.0.2", + "multiformats": "^9.0.4" + } + }, + "node_modules/interface-datastore": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/interface-datastore/-/interface-datastore-6.1.1.tgz", + "integrity": "sha512-AmCS+9CT34pp2u0QQVXjKztkuq3y5T+BIciuiHDDtDZucZD8VudosnSdUyXJV6IsRkN5jc4RFDhCk1O6Q3Gxjg==", + "license": "MIT", + "dependencies": { + "interface-store": "^2.0.2", + "nanoid": "^3.0.2", + "uint8arrays": "^3.0.0" + } + }, + "node_modules/interface-store": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/interface-store/-/interface-store-2.0.2.tgz", + "integrity": "sha512-rScRlhDcz6k199EkHqT8NpM87ebN89ICOzILoBHgaG36/WX50N32BnU/kpZgCGPLhARRAWUUX5/cyaIjt7Kipg==", + "license": "(Apache-2.0 OR MIT)" + }, + "node_modules/ip-regex": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.3.0.tgz", + "integrity": "sha512-B9ZWJxHHOHUhUjCPrMpLD4xEq35bUTClHM1S6CBU5ixQnkZmwipwgc96vAd7AAGM9TGHvJR+Uss+/Ak6UphK+Q==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/ipfs-car": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/ipfs-car/-/ipfs-car-0.6.2.tgz", + "integrity": "sha512-tliuakkKKtCa4TTnFT3zJKjq/aD8EGKX8Y0ybCyrAW0fo/n2koZpxiLjBvtTs47Rqyji6ggXo+atPbJJ60hJmg==", + "license": "(Apache-2.0 AND MIT)", + "dependencies": { + "@ipld/car": "^3.2.3", + "@web-std/blob": "^3.0.1", + "bl": "^5.0.0", + "blockstore-core": "^1.0.2", + "browser-readablestream-to-it": "^1.0.2", + "idb-keyval": "^6.0.3", + "interface-blockstore": "^2.0.2", + "ipfs-core-types": "^0.8.3", + "ipfs-core-utils": "^0.12.1", + "ipfs-unixfs-exporter": "^7.0.4", + "ipfs-unixfs-importer": "^9.0.4", + "ipfs-utils": "^9.0.2", + "it-all": "^1.0.5", + "it-last": "^1.0.5", + "it-pipe": "^1.1.0", + "meow": "^9.0.0", + "move-file": "^2.1.0", + "multiformats": "^9.6.3", + "stream-to-it": "^0.2.3", + "streaming-iterables": "^6.0.0", + "uint8arrays": "^3.0.0" + }, + "bin": { + "🚘": "dist/cjs/cli/cli.js", + "ipfs-car": "dist/cjs/cli/cli.js" + } + }, + "node_modules/ipfs-core-types": { + "version": "0.8.4", + "resolved": "https://registry.npmjs.org/ipfs-core-types/-/ipfs-core-types-0.8.4.tgz", + "integrity": "sha512-sbRZA1QX3xJ6ywTiVQZMOxhlhp4osAZX2SXx3azOLxAtxmGWDMkHYt722VV4nZ2GyJy8qyk5GHQIZ0uvQnpaTg==", + "deprecated": "js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details", + "license": "(Apache-2.0 OR MIT)", + "dependencies": { + "interface-datastore": "^6.0.2", + "multiaddr": "^10.0.0", + "multiformats": "^9.4.13" + } + }, + "node_modules/ipfs-core-utils": { + "version": "0.12.2", + "resolved": "https://registry.npmjs.org/ipfs-core-utils/-/ipfs-core-utils-0.12.2.tgz", + "integrity": "sha512-RfxP3rPhXuqKIUmTAUhmee6fmaV3A7LMnjOUikRKpSyqESz/DR7aGK7tbttMxkZdkSEr0rFXlqbyb0vVwmn0wQ==", + "deprecated": "js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details", + "license": "MIT", + "dependencies": { + "any-signal": "^2.1.2", + "blob-to-it": "^1.0.1", + "browser-readablestream-to-it": "^1.0.1", + "debug": "^4.1.1", + "err-code": "^3.0.1", + "ipfs-core-types": "^0.8.4", + "ipfs-unixfs": "^6.0.3", + "ipfs-utils": "^9.0.2", + "it-all": "^1.0.4", + "it-map": "^1.0.4", + "it-peekable": "^1.0.2", + "it-to-stream": "^1.0.0", + "merge-options": "^3.0.4", + "multiaddr": "^10.0.0", + "multiaddr-to-uri": "^8.0.0", + "multiformats": "^9.4.13", + "nanoid": "^3.1.23", + "parse-duration": "^1.0.0", + "timeout-abort-controller": "^1.1.1", + "uint8arrays": "^3.0.0" + } + }, + "node_modules/ipfs-core-utils/node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/ipfs-core-utils/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/ipfs-unixfs": { + "version": "6.0.9", + "resolved": "https://registry.npmjs.org/ipfs-unixfs/-/ipfs-unixfs-6.0.9.tgz", + "integrity": "sha512-0DQ7p0/9dRB6XCb0mVCTli33GzIzSVx5udpJuVM47tGcD+W+Bl4LsnoLswd3ggNnNEakMv1FdoFITiEnchXDqQ==", + "license": "Apache-2.0 OR MIT", + "dependencies": { + "err-code": "^3.0.1", + "protobufjs": "^6.10.2" + }, + "engines": { + "node": ">=16.0.0", + "npm": ">=7.0.0" + } + }, + "node_modules/ipfs-unixfs-exporter": { + "version": "7.0.11", + "resolved": "https://registry.npmjs.org/ipfs-unixfs-exporter/-/ipfs-unixfs-exporter-7.0.11.tgz", + "integrity": "sha512-qTYa69J7HbI2EIYNUddKPg9Y3rHkYZV0bNdmzZKA5+ZbwRVoUEuBW/cguEqTp22zHygh3sMnzYZFm0naVIdMgQ==", + "license": "Apache-2.0 OR MIT", + "dependencies": { + "@ipld/dag-cbor": "^7.0.2", + "@ipld/dag-pb": "^2.0.2", + "@multiformats/murmur3": "^1.0.3", + "err-code": "^3.0.1", + "hamt-sharding": "^2.0.0", + "interface-blockstore": "^2.0.3", + "ipfs-unixfs": "^6.0.0", + "it-last": "^1.0.5", + "multiformats": "^9.4.2", + "uint8arrays": "^3.0.0" + }, + "engines": { + "node": ">=16.0.0", + "npm": ">=7.0.0" + } + }, + "node_modules/ipfs-unixfs-exporter/node_modules/@ipld/dag-cbor": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/@ipld/dag-cbor/-/dag-cbor-7.0.3.tgz", + "integrity": "sha512-1VVh2huHsuohdXC1bGJNE8WR72slZ9XE2T3wbBBq31dm7ZBatmKLLxrB+XAqafxfRFjv08RZmj/W/ZqaM13AuA==", + "license": "(Apache-2.0 AND MIT)", + "dependencies": { + "cborg": "^1.6.0", + "multiformats": "^9.5.4" + } + }, + "node_modules/ipfs-unixfs-importer": { + "version": "9.0.10", + "resolved": "https://registry.npmjs.org/ipfs-unixfs-importer/-/ipfs-unixfs-importer-9.0.10.tgz", + "integrity": "sha512-W+tQTVcSmXtFh7FWYWwPBGXJ1xDgREbIyI1E5JzDcimZLIyT5gGMfxR3oKPxxWj+GKMpP5ilvMQrbsPzWcm3Fw==", + "license": "Apache-2.0 OR MIT", + "dependencies": { + "@ipld/dag-pb": "^2.0.2", + "@multiformats/murmur3": "^1.0.3", + "bl": "^5.0.0", + "err-code": "^3.0.1", + "hamt-sharding": "^2.0.0", + "interface-blockstore": "^2.0.3", + "ipfs-unixfs": "^6.0.0", + "it-all": "^1.0.5", + "it-batch": "^1.0.8", + "it-first": "^1.0.6", + "it-parallel-batch": "^1.0.9", + "merge-options": "^3.0.4", + "multiformats": "^9.4.2", + "rabin-wasm": "^0.1.4", + "uint8arrays": "^3.0.0" + }, + "engines": { + "node": ">=16.0.0", + "npm": ">=7.0.0" + } + }, + "node_modules/ipfs-utils": { + "version": "9.0.14", + "resolved": "https://registry.npmjs.org/ipfs-utils/-/ipfs-utils-9.0.14.tgz", + "integrity": "sha512-zIaiEGX18QATxgaS0/EOQNoo33W0islREABAcxXE8n7y2MGAlB+hdsxXn4J0hGZge8IqVQhW8sWIb+oJz2yEvg==", + "license": "Apache-2.0 OR MIT", + "dependencies": { + "any-signal": "^3.0.0", + "browser-readablestream-to-it": "^1.0.0", + "buffer": "^6.0.1", + "electron-fetch": "^1.7.2", + "err-code": "^3.0.1", + "is-electron": "^2.2.0", + "iso-url": "^1.1.5", + "it-all": "^1.0.4", + "it-glob": "^1.0.1", + "it-to-stream": "^1.0.0", + "merge-options": "^3.0.4", + "nanoid": "^3.1.20", + "native-fetch": "^3.0.0", + "node-fetch": "^2.6.8", + "react-native-fetch-api": "^3.0.0", + "stream-to-it": "^0.2.2" + }, + "engines": { + "node": ">=16.0.0", + "npm": ">=7.0.0" + } + }, + "node_modules/ipfs-utils/node_modules/any-signal": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/any-signal/-/any-signal-3.0.1.tgz", + "integrity": "sha512-xgZgJtKEa9YmDqXodIgl7Fl1C8yNXr8w6gXjqK3LW4GcEiYT+6AQfJSE/8SPsEpLLmcvbv8YU+qet94UewHxqg==", + "license": "MIT" + }, + "node_modules/ipfsio": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/ipfsio/-/ipfsio-0.0.8.tgz", + "integrity": "sha512-IBmR+wS0YTaWNPpvAauBPFVAX2l1Kdut2vpOV71jmbOTRJv3ICMHeNomTb/BrnR0LYYX1KUkpfzAYgva1qx2dQ==", + "license": "ISC", + "dependencies": { + "@web-std/fetch": "3.0.0", + "axios": "^0.25.0", + "nft.storage": "^5.2.0" + } + }, + "node_modules/ipfsio/node_modules/axios": { + "version": "0.25.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.25.0.tgz", + "integrity": "sha512-cD8FOb0tRH3uuEe6+evtAbgJtfxr7ly3fQjYcMcuPlgkwVS9xboaVIpcDV+cYQe+yGykgwZCs1pzjntcGa6l5g==", + "license": "MIT", + "dependencies": { + "follow-redirects": "^1.14.7" + } + }, + "node_modules/is-arguments": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.2.0.tgz", + "integrity": "sha512-7bVbi0huj/wrIAOzb8U1aszg9kdi3KN/CyU19CTI7tAoZYEZoL9yCDXpbXN+uPsuWnP02cyug1gleqq+TU+YCA==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", + "license": "MIT" + }, + "node_modules/is-callable": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-core-module": { + "version": "2.16.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz", + "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==", + "license": "MIT", + "dependencies": { + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-electron": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/is-electron/-/is-electron-2.2.2.tgz", + "integrity": "sha512-FO/Rhvz5tuw4MCWkpMzHFKWD2LsfHzIb7i6MdPYZ/KW7AlxawyLkqdy+jPZP1WubqEADE3O4FUENlJHDfQASRg==", + "license": "MIT" + }, + "node_modules/is-generator-function": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.1.2.tgz", + "integrity": "sha512-upqt1SkGkODW9tsGNG5mtXTXtECizwtS2kA161M+gJPc1xdb/Ax629af6YrTwcOeQHbewrPNlE5Dx7kzvXTizA==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.4", + "generator-function": "^2.0.0", + "get-proto": "^1.0.1", + "has-tostringtag": "^1.0.2", + "safe-regex-test": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-ip": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-ip/-/is-ip-3.1.0.tgz", + "integrity": "sha512-35vd5necO7IitFPjd/YBeqwWnyDWbuLH9ZXQdMfDA8TEo7pv5X8yfrvVO3xbJbLUlERCMvf6X0hTUamQxCYJ9Q==", + "license": "MIT", + "dependencies": { + "ip-regex": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-plain-obj": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", + "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-regex": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.2.1.tgz", + "integrity": "sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "gopd": "^1.2.0", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-typed-array": { + "version": "1.1.15", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.15.tgz", + "integrity": "sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ==", + "license": "MIT", + "dependencies": { + "which-typed-array": "^1.1.16" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/iso-url": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/iso-url/-/iso-url-1.2.1.tgz", + "integrity": "sha512-9JPDgCN4B7QPkLtYAAOrEuAWvP9rWvR5offAr0/SeF046wIkglqH3VXgYYP6NcsKslH80UIVgmPqNe3j7tG2ng==", + "license": "MIT", + "engines": { + "node": ">=12" + } + }, + "node_modules/it-all": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/it-all/-/it-all-1.0.6.tgz", + "integrity": "sha512-3cmCc6Heqe3uWi3CVM/k51fa/XbMFpQVzFoDsV0IZNHSQDyAXl3c4MjHkFX5kF3922OGj7Myv1nSEUgRtcuM1A==", + "license": "ISC" + }, + "node_modules/it-batch": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/it-batch/-/it-batch-1.0.9.tgz", + "integrity": "sha512-7Q7HXewMhNFltTsAMdSz6luNhyhkhEtGGbYek/8Xb/GiqYMtwUmopE1ocPSiJKKp3rM4Dt045sNFoUu+KZGNyA==", + "license": "ISC" + }, + "node_modules/it-drain": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/it-drain/-/it-drain-1.0.5.tgz", + "integrity": "sha512-r/GjkiW1bZswC04TNmUnLxa6uovme7KKwPhc+cb1hHU65E3AByypHH6Pm91WHuvqfFsm+9ws0kPtDBV3/8vmIg==", + "license": "ISC" + }, + "node_modules/it-filter": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/it-filter/-/it-filter-1.0.3.tgz", + "integrity": "sha512-EI3HpzUrKjTH01miLHWmhNWy3Xpbx4OXMXltgrNprL5lDpF3giVpHIouFpr5l+evXw6aOfxhnt01BIB+4VQA+w==", + "license": "ISC" + }, + "node_modules/it-first": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/it-first/-/it-first-1.0.7.tgz", + "integrity": "sha512-nvJKZoBpZD/6Rtde6FXqwDqDZGF1sCADmr2Zoc0hZsIvnE449gRFnGctxDf09Bzc/FWnHXAdaHVIetY6lrE0/g==", + "license": "ISC" + }, + "node_modules/it-glob": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/it-glob/-/it-glob-1.0.2.tgz", + "integrity": "sha512-Ch2Dzhw4URfB9L/0ZHyY+uqOnKvBNeS/SMcRiPmJfpHiM0TsUZn+GkpcZxAoF3dJVdPm/PuIk3A4wlV7SUo23Q==", + "license": "ISC", + "dependencies": { + "@types/minimatch": "^3.0.4", + "minimatch": "^3.0.4" + } + }, + "node_modules/it-last": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/it-last/-/it-last-1.0.6.tgz", + "integrity": "sha512-aFGeibeiX/lM4bX3JY0OkVCFkAw8+n9lkukkLNivbJRvNz8lI3YXv5xcqhFUV2lDJiraEK3OXRDbGuevnnR67Q==", + "license": "ISC" + }, + "node_modules/it-map": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/it-map/-/it-map-1.0.6.tgz", + "integrity": "sha512-XT4/RM6UHIFG9IobGlQPFQUrlEKkU4eBUFG3qhWhfAdh1JfF2x11ShCrKCdmZ0OiZppPfoLuzcfA4cey6q3UAQ==", + "license": "ISC" + }, + "node_modules/it-parallel-batch": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/it-parallel-batch/-/it-parallel-batch-1.0.11.tgz", + "integrity": "sha512-UWsWHv/kqBpMRmyZJzlmZeoAMA0F3SZr08FBdbhtbe+MtoEBgr/ZUAKrnenhXCBrsopy76QjRH2K/V8kNdupbQ==", + "license": "ISC", + "dependencies": { + "it-batch": "^1.0.9" + } + }, + "node_modules/it-peekable": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/it-peekable/-/it-peekable-1.0.3.tgz", + "integrity": "sha512-5+8zemFS+wSfIkSZyf0Zh5kNN+iGyccN02914BY4w/Dj+uoFEoPSvj5vaWn8pNZJNSxzjW0zHRxC3LUb2KWJTQ==", + "license": "ISC" + }, + "node_modules/it-pipe": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/it-pipe/-/it-pipe-1.1.0.tgz", + "integrity": "sha512-lF0/3qTVeth13TOnHVs0BTFaziwQF7m5Gg+E6JV0BXcLKutC92YjSi7bASgkPOXaLEb+YvNZrPorGMBIJvZfxg==", + "license": "MIT" + }, + "node_modules/it-take": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/it-take/-/it-take-1.0.2.tgz", + "integrity": "sha512-u7I6qhhxH7pSevcYNaMECtkvZW365ARqAIt9K+xjdK1B2WUDEjQSfETkOCT8bxFq/59LqrN3cMLUtTgmDBaygw==", + "license": "ISC" + }, + "node_modules/it-to-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/it-to-stream/-/it-to-stream-1.0.0.tgz", + "integrity": "sha512-pLULMZMAB/+vbdvbZtebC0nWBTbG581lk6w8P7DfIIIKUfa8FbY7Oi0FxZcFPbxvISs7A9E+cMpLDBc1XhpAOA==", + "license": "MIT", + "dependencies": { + "buffer": "^6.0.3", + "fast-fifo": "^1.0.0", + "get-iterator": "^1.0.2", + "p-defer": "^3.0.0", + "p-fifo": "^1.0.0", + "readable-stream": "^3.6.0" + } + }, + "node_modules/jose": { + "version": "6.1.3", + "resolved": "https://registry.npmjs.org/jose/-/jose-6.1.3.tgz", + "integrity": "sha512-0TpaTfihd4QMNwrz/ob2Bp7X04yuxJkjRGi4aKmOqwhov54i6u79oCv7T+C7lo70MKH6BesI3vscD1yb/yzKXQ==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/panva" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "license": "MIT" + }, + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "license": "MIT" + }, + "node_modules/kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "license": "MIT" + }, + "node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "license": "MIT", + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/long": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", + "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==", + "license": "Apache-2.0" + }, + "node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/map-obj": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.3.0.tgz", + "integrity": "sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ==", + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/meow": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/meow/-/meow-9.0.0.tgz", + "integrity": "sha512-+obSblOQmRhcyBt62furQqRAQpNyWXo8BuQ5bN7dG8wmwQ+vwHKp/rCFD4CrTP8CsDQD1sjoZ94K417XEUk8IQ==", + "license": "MIT", + "dependencies": { + "@types/minimist": "^1.2.0", + "camelcase-keys": "^6.2.2", + "decamelize": "^1.2.0", + "decamelize-keys": "^1.1.0", + "hard-rejection": "^2.1.0", + "minimist-options": "4.1.0", + "normalize-package-data": "^3.0.0", + "read-pkg-up": "^7.0.1", + "redent": "^3.0.0", + "trim-newlines": "^3.0.0", + "type-fest": "^0.18.0", + "yargs-parser": "^20.2.3" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/merge-descriptors": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz", + "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/merge-options": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/merge-options/-/merge-options-3.0.4.tgz", + "integrity": "sha512-2Sug1+knBjkaMsMgf1ctR1Ujx+Ayku4EdJN4Z+C2+JzoeF7A3OZ9KM2GY0CpQS51NR61LTurMJrRKPhSs3ZRTQ==", + "license": "MIT", + "dependencies": { + "is-plain-obj": "^2.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "license": "MIT", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/min-indent": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz", + "integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/minimist-options": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-4.1.0.tgz", + "integrity": "sha512-Q4r8ghd80yhO/0j1O3B2BjweX3fiHg9cdOwjJd2J76Q135c+NDxGCqdYKQ1SKBuFfgWbAUzBfvYjPUEeNgqN1A==", + "license": "MIT", + "dependencies": { + "arrify": "^1.0.1", + "is-plain-obj": "^1.1.0", + "kind-of": "^6.0.3" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/minimist-options/node_modules/is-plain-obj": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", + "integrity": "sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/mkdirp": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "license": "MIT", + "dependencies": { + "minimist": "^1.2.6" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/move-file": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/move-file/-/move-file-2.1.0.tgz", + "integrity": "sha512-i9qLW6gqboJ5Ht8bauZi7KlTnQ3QFpBCvMvFfEcHADKgHGeJ9BZMO7SFCTwHPV9Qa0du9DYY1Yx3oqlGt30nXA==", + "license": "MIT", + "dependencies": { + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10.17" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "license": "MIT" + }, + "node_modules/multer": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/multer/-/multer-2.0.2.tgz", + "integrity": "sha512-u7f2xaZ/UG8oLXHvtF/oWTRvT44p9ecwBBqTwgJVq0+4BW1g8OW01TyMEGWBHbyMOYVHXslaut7qEQ1meATXgw==", + "license": "MIT", + "dependencies": { + "append-field": "^1.0.0", + "busboy": "^1.6.0", + "concat-stream": "^2.0.0", + "mkdirp": "^0.5.6", + "object-assign": "^4.1.1", + "type-is": "^1.6.18", + "xtend": "^4.0.2" + }, + "engines": { + "node": ">= 10.16.0" + } + }, + "node_modules/multiaddr": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/multiaddr/-/multiaddr-10.0.1.tgz", + "integrity": "sha512-G5upNcGzEGuTHkzxezPrrD6CaIHR9uo+7MwqhNVcXTs33IInon4y7nMiGxl2CY5hG7chvYQUQhz5V52/Qe3cbg==", + "deprecated": "This module is deprecated, please upgrade to @multiformats/multiaddr", + "license": "MIT", + "dependencies": { + "dns-over-http-resolver": "^1.2.3", + "err-code": "^3.0.1", + "is-ip": "^3.1.0", + "multiformats": "^9.4.5", + "uint8arrays": "^3.0.0", + "varint": "^6.0.0" + } + }, + "node_modules/multiaddr-to-uri": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/multiaddr-to-uri/-/multiaddr-to-uri-8.0.0.tgz", + "integrity": "sha512-dq4p/vsOOUdVEd1J1gl+R2GFrXJQH8yjLtz4hodqdVbieg39LvBOdMQRdQnfbg5LSM/q1BYNVf5CBbwZFFqBgA==", + "deprecated": "This module is deprecated, please upgrade to @multiformats/multiaddr-to-uri", + "license": "MIT", + "dependencies": { + "multiaddr": "^10.0.0" + } + }, + "node_modules/multiformats": { + "version": "9.9.0", + "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-9.9.0.tgz", + "integrity": "sha512-HoMUjhH9T8DDBNT+6xzkrd9ga/XiBI4xLr58LJACwK6G3HTOPeMz4nB4KJs33L2BelrIJa7P0VuNaVF3hMYfjg==", + "license": "(Apache-2.0 AND MIT)" + }, + "node_modules/murmurhash3js-revisited": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/murmurhash3js-revisited/-/murmurhash3js-revisited-3.0.0.tgz", + "integrity": "sha512-/sF3ee6zvScXMb1XFJ8gDsSnY+X8PbOyjIuBhtgis10W2Jx4ZjIhikUCIF9c4gpJxVnQIsPAFrSwTCuAjicP6g==", + "license": "MIT", + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/nanoid": { + "version": "3.3.11", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", + "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/native-abort-controller": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/native-abort-controller/-/native-abort-controller-1.0.4.tgz", + "integrity": "sha512-zp8yev7nxczDJMoP6pDxyD20IU0T22eX8VwN2ztDccKvSZhRaV33yP1BGwKSZfXuqWUzsXopVFjBdau9OOAwMQ==", + "license": "MIT", + "peerDependencies": { + "abort-controller": "*" + } + }, + "node_modules/native-fetch": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/native-fetch/-/native-fetch-3.0.0.tgz", + "integrity": "sha512-G3Z7vx0IFb/FQ4JxvtqGABsOTIqRWvgQz6e+erkB+JJD6LrszQtMozEHI4EkmgZQvnGHrpLVzUWk7t4sJCIkVw==", + "license": "MIT", + "peerDependencies": { + "node-fetch": "*" + } + }, + "node_modules/negotiator": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/nft.storage": { + "version": "5.2.5", + "resolved": "https://registry.npmjs.org/nft.storage/-/nft.storage-5.2.5.tgz", + "integrity": "sha512-ITP9ETleKIZvSRsjpHi6JFFE/YVcp9jwwyi+Q1GtdNmFc5Xyu1g7it+yrk7m5+iSEMcOjSJGPQrktnUTe0qtAg==", + "license": "(Apache-2.0 OR MIT)", + "dependencies": { + "@ipld/car": "^3.2.3", + "@ipld/dag-cbor": "^6.0.13", + "@web-std/blob": "^3.0.1", + "@web-std/fetch": "^3.0.3", + "@web-std/file": "^3.0.0", + "@web-std/form-data": "^3.0.0", + "carbites": "^1.0.6", + "ipfs-car": "^0.6.2", + "multiformats": "^9.6.3", + "p-retry": "^4.6.1", + "streaming-iterables": "^6.0.0" + } + }, + "node_modules/nft.storage/node_modules/@web-std/fetch": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@web-std/fetch/-/fetch-3.0.3.tgz", + "integrity": "sha512-PtaKr6qvw2AmKChugzhQWuTa12dpbogHRBxwcleAZ35UhWucnfD4N+g3f7qYK2OeioSWTK3yMf6n/kOOfqxHaQ==", + "license": "MIT", + "dependencies": { + "@web-std/blob": "^3.0.3", + "@web-std/form-data": "^3.0.2", + "@web3-storage/multipart-parser": "^1.0.0", + "data-uri-to-buffer": "^3.0.1" + }, + "engines": { + "node": "^10.17 || >=12.3" + } + }, + "node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "license": "MIT", + "peer": true, + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/normalize-package-data": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-3.0.3.tgz", + "integrity": "sha512-p2W1sgqij3zMMyRC067Dg16bfzVH+w7hyegmpIvZ4JNjqtGOVAIvLmjBx3yP7YTe9vKJgkoNOPjwQGogDoMXFA==", + "license": "BSD-2-Clause", + "dependencies": { + "hosted-git-info": "^4.0.1", + "is-core-module": "^2.5.0", + "semver": "^7.3.4", + "validate-npm-package-license": "^3.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-inspect": { + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "license": "MIT", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/p-defer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-3.0.0.tgz", + "integrity": "sha512-ugZxsxmtTln604yeYd29EGrNhazN2lywetzpKhfmQjW/VJmhpDmWbiX+h0zL8V91R0UXkhb3KtPmyq9PZw3aYw==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/p-fifo": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-fifo/-/p-fifo-1.0.0.tgz", + "integrity": "sha512-IjoCxXW48tqdtDFz6fqo5q1UfFVjjVZe8TC1QRflvNUJtNfCUhxOUw6MOVZhDPjqhSzc26xKdugsO17gmzd5+A==", + "license": "MIT", + "dependencies": { + "fast-fifo": "^1.0.0", + "p-defer": "^3.0.0" + } + }, + "node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "license": "MIT", + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "license": "MIT", + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/p-retry": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/p-retry/-/p-retry-4.6.2.tgz", + "integrity": "sha512-312Id396EbJdvRONlngUx0NydfrIQ5lsYu0znKVUzVvArzEIt08V1qhtyESbGVd1FGX7UKtiFp5uwKZdM8wIuQ==", + "license": "MIT", + "dependencies": { + "@types/retry": "0.12.0", + "retry": "^0.13.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/parse-duration": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/parse-duration/-/parse-duration-1.1.2.tgz", + "integrity": "sha512-p8EIONG8L0u7f8GFgfVlL4n8rnChTt8O5FSxgxMz2tjc9FMP199wxVKVB6IbKx11uTbKHACSvaLVIKNnoeNR/A==", + "license": "MIT" + }, + "node_modules/parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "license": "MIT" + }, + "node_modules/path-to-regexp": { + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.12.tgz", + "integrity": "sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==", + "license": "MIT" + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "license": "ISC" + }, + "node_modules/possible-typed-array-names": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz", + "integrity": "sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/protobufjs": { + "version": "6.11.4", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.11.4.tgz", + "integrity": "sha512-5kQWPaJHi1WoCpjTGszzQ32PG2F4+wRY6BmAT4Vfw56Q2FZ4YZzK20xUYQH4YkfehY1e6QSICrJquM6xXZNcrw==", + "hasInstallScript": true, + "license": "BSD-3-Clause", + "dependencies": { + "@protobufjs/aspromise": "^1.1.2", + "@protobufjs/base64": "^1.1.2", + "@protobufjs/codegen": "^2.0.4", + "@protobufjs/eventemitter": "^1.1.0", + "@protobufjs/fetch": "^1.1.0", + "@protobufjs/float": "^1.0.2", + "@protobufjs/inquire": "^1.1.0", + "@protobufjs/path": "^1.1.2", + "@protobufjs/pool": "^1.1.0", + "@protobufjs/utf8": "^1.1.0", + "@types/long": "^4.0.1", + "@types/node": ">=13.7.0", + "long": "^4.0.0" + }, + "bin": { + "pbjs": "bin/pbjs", + "pbts": "bin/pbts" + } + }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "license": "MIT", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "license": "MIT" + }, + "node_modules/qs": { + "version": "6.14.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.14.0.tgz", + "integrity": "sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w==", + "license": "BSD-3-Clause", + "dependencies": { + "side-channel": "^1.1.0" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/quick-lru": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-4.0.1.tgz", + "integrity": "sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/rabin-wasm": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/rabin-wasm/-/rabin-wasm-0.1.5.tgz", + "integrity": "sha512-uWgQTo7pim1Rnj5TuWcCewRDTf0PEFTSlaUjWP4eY9EbLV9em08v89oCz/WO+wRxpYuO36XEHp4wgYQnAgOHzA==", + "license": "MIT", + "dependencies": { + "@assemblyscript/loader": "^0.9.4", + "bl": "^5.0.0", + "debug": "^4.3.1", + "minimist": "^1.2.5", + "node-fetch": "^2.6.1", + "readable-stream": "^3.6.0" + }, + "bin": { + "rabin-wasm": "cli/bin.js" + } + }, + "node_modules/rabin-wasm/node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/rabin-wasm/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "2.5.3", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.3.tgz", + "integrity": "sha512-s4VSOf6yN0rvbRZGxs8Om5CWj6seneMwK3oDb4lWDH0UPhWcxwOWw5+qk24bxq87szX1ydrwylIOp2uG1ojUpA==", + "license": "MIT", + "dependencies": { + "bytes": "~3.1.2", + "http-errors": "~2.0.1", + "iconv-lite": "~0.4.24", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/react-native-fetch-api": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/react-native-fetch-api/-/react-native-fetch-api-3.0.0.tgz", + "integrity": "sha512-g2rtqPjdroaboDKTsJCTlcmtw54E25OjyaunUP0anOZn4Fuo2IKs8BVfe02zVggA/UysbmfSnRJIqtNkAgggNA==", + "license": "MIT", + "dependencies": { + "p-defer": "^3.0.0" + } + }, + "node_modules/read-pkg": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", + "integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==", + "license": "MIT", + "dependencies": { + "@types/normalize-package-data": "^2.4.0", + "normalize-package-data": "^2.5.0", + "parse-json": "^5.0.0", + "type-fest": "^0.6.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/read-pkg-up": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-7.0.1.tgz", + "integrity": "sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==", + "license": "MIT", + "dependencies": { + "find-up": "^4.1.0", + "read-pkg": "^5.2.0", + "type-fest": "^0.8.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/read-pkg-up/node_modules/type-fest": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=8" + } + }, + "node_modules/read-pkg/node_modules/hosted-git-info": { + "version": "2.8.9", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", + "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", + "license": "ISC" + }, + "node_modules/read-pkg/node_modules/normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "license": "BSD-2-Clause", + "dependencies": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "node_modules/read-pkg/node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "license": "ISC", + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/read-pkg/node_modules/type-fest": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz", + "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==", + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=8" + } + }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/receptacle": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/receptacle/-/receptacle-1.3.2.tgz", + "integrity": "sha512-HrsFvqZZheusncQRiEE7GatOAETrARKV/lnfYicIm8lbvp/JQOdADOfhjBd2DajvoszEyxSM6RlAAIZgEoeu/A==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/receptacle/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/redent": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/redent/-/redent-3.0.0.tgz", + "integrity": "sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==", + "license": "MIT", + "dependencies": { + "indent-string": "^4.0.0", + "strip-indent": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve": { + "version": "1.22.11", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.11.tgz", + "integrity": "sha512-RfqAvLnMl313r7c9oclB1HhUEAezcpLjz95wFH4LVuhk9JF/r22qmVP9AMmOU4vMX7Q8pN8jwNg/CSpdFnMjTQ==", + "license": "MIT", + "dependencies": { + "is-core-module": "^2.16.1", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/retimer": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/retimer/-/retimer-2.0.0.tgz", + "integrity": "sha512-KLXY85WkEq2V2bKex/LOO1ViXVn2KGYe4PYysAdYdjmraYIUsVkXu8O4am+8+5UbaaGl1qho4aqAAPHNQ4GSbg==", + "license": "MIT" + }, + "node_modules/retry": { + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.13.1.tgz", + "integrity": "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==", + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/safe-regex-test": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.1.0.tgz", + "integrity": "sha512-x/+Cz4YrimQxQccJf5mKEbIa1NzeCRNI5Ecl/ekmlYaampdNLPalVyIcCZNNH3MvmqBugV5TMYZXv0ljslUlaw==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "is-regex": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "license": "MIT" + }, + "node_modules/semver": { + "version": "7.7.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.3.tgz", + "integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/send": { + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/send/-/send-0.19.1.tgz", + "integrity": "sha512-p4rRk4f23ynFEfcD9LA0xRYngj+IyGiEYyqqOak8kaN0TvNmuxC2dcVeBn62GpCeR2CpWqyHCNScTP91QbAVFg==", + "license": "MIT", + "dependencies": { + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "2.4.1", + "range-parser": "~1.2.1", + "statuses": "2.0.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/send/node_modules/http-errors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", + "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "license": "MIT", + "dependencies": { + "depd": "2.0.0", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "toidentifier": "1.0.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/send/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/send/node_modules/statuses": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/serve-static": { + "version": "1.16.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.2.tgz", + "integrity": "sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw==", + "license": "MIT", + "dependencies": { + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "0.19.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/serve-static/node_modules/http-errors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", + "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "license": "MIT", + "dependencies": { + "depd": "2.0.0", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "toidentifier": "1.0.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/serve-static/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/serve-static/node_modules/send": { + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/send/-/send-0.19.0.tgz", + "integrity": "sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw==", + "license": "MIT", + "dependencies": { + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "2.4.1", + "range-parser": "~1.2.1", + "statuses": "2.0.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/serve-static/node_modules/send/node_modules/encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/serve-static/node_modules/statuses": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/set-function-length": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "license": "MIT", + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "license": "ISC" + }, + "node_modules/side-channel": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", + "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3", + "side-channel-list": "^1.0.0", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", + "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/sparse-array": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/sparse-array/-/sparse-array-1.3.2.tgz", + "integrity": "sha512-ZT711fePGn3+kQyLuv1fpd3rNSkNF8vd5Kv2D+qnOANeyKs3fx6bUMGWRPvgTTcYV64QMqZKZwcuaQSP3AZ0tg==", + "license": "ISC" + }, + "node_modules/spdx-correct": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz", + "integrity": "sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==", + "license": "Apache-2.0", + "dependencies": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-exceptions": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.5.0.tgz", + "integrity": "sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w==", + "license": "CC-BY-3.0" + }, + "node_modules/spdx-expression-parse": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", + "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", + "license": "MIT", + "dependencies": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-license-ids": { + "version": "3.0.22", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.22.tgz", + "integrity": "sha512-4PRT4nh1EImPbt2jASOKHX7PB7I+e4IWNLvkKFDxNhJlfjbYlleYQh285Z/3mPTHSAK/AvdMmw5BNNuYH8ShgQ==", + "license": "CC0-1.0" + }, + "node_modules/statuses": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz", + "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/stream-to-it": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/stream-to-it/-/stream-to-it-0.2.4.tgz", + "integrity": "sha512-4vEbkSs83OahpmBybNJXlJd7d6/RxzkkSdT3I0mnGt79Xd2Kk+e1JqbvAvsQfCeKj3aKb0QIWkyK3/n0j506vQ==", + "license": "MIT", + "dependencies": { + "get-iterator": "^1.0.2" + } + }, + "node_modules/streaming-iterables": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/streaming-iterables/-/streaming-iterables-6.2.0.tgz", + "integrity": "sha512-3AYC8oB60WyD1ic7uHmN/vm2oRGzRnQ3XFBl/bFMDi1q1+nc5/vjMmiE4vroIya3jG59t87VpyAj/iXYxyw9AA==", + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/streamsearch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", + "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==", + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/strip-indent": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz", + "integrity": "sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==", + "license": "MIT", + "dependencies": { + "min-indent": "^1.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/timeout-abort-controller": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/timeout-abort-controller/-/timeout-abort-controller-1.1.1.tgz", + "integrity": "sha512-BsF9i3NAJag6T0ZEjki9j654zoafI2X6ayuNd6Tp8+Ul6Tr5s4jo973qFeiWrRSweqvskC+AHDKUmIW4b7pdhQ==", + "license": "MIT", + "dependencies": { + "abort-controller": "^3.0.0", + "retimer": "^2.0.0" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "license": "MIT", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", + "license": "MIT" + }, + "node_modules/trim-newlines": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-3.0.1.tgz", + "integrity": "sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/type-fest": { + "version": "0.18.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.18.1.tgz", + "integrity": "sha512-OIAYXk8+ISY+qTOwkHtKqzAuxchoMiD9Udx+FSGQDuiRR+PJKJHc2NJAXlbhkGwTt/4/nKZxELY1w3ReWOL8mw==", + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "license": "MIT", + "dependencies": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==", + "license": "MIT" + }, + "node_modules/uint8arrays": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/uint8arrays/-/uint8arrays-3.1.1.tgz", + "integrity": "sha512-+QJa8QRnbdXVpHYjLoTpJIdCTiw9Ir62nocClWuXIq2JIh4Uta0cQsTSpFL678p2CN8B+XSApwcU+pQEqVpKWg==", + "license": "MIT", + "dependencies": { + "multiformats": "^9.4.2" + } + }, + "node_modules/undici-types": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz", + "integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==", + "license": "MIT" + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/util": { + "version": "0.12.5", + "resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz", + "integrity": "sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==", + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "is-arguments": "^1.0.4", + "is-generator-function": "^1.0.7", + "is-typed-array": "^1.1.3", + "which-typed-array": "^1.1.2" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "license": "MIT" + }, + "node_modules/utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", + "license": "MIT", + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "license": "Apache-2.0", + "dependencies": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "node_modules/varint": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/varint/-/varint-6.0.0.tgz", + "integrity": "sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg==", + "license": "MIT" + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/web-encoding": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/web-encoding/-/web-encoding-1.1.5.tgz", + "integrity": "sha512-HYLeVCdJ0+lBYV2FvNZmv3HJ2Nt0QYXqZojk3d9FJOLkwnuhzM9tmamh8d7HPM8QqjKH8DeHkFTx+CFlWpZZDA==", + "license": "MIT", + "dependencies": { + "util": "^0.12.3" + }, + "optionalDependencies": { + "@zxing/text-encoding": "0.9.0" + } + }, + "node_modules/web-streams-polyfill": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz", + "integrity": "sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==", + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", + "license": "BSD-2-Clause" + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "license": "MIT", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "node_modules/which-typed-array": { + "version": "1.1.19", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.19.tgz", + "integrity": "sha512-rEvr90Bck4WZt9HHFC4DJMsjvu7x+r6bImz0/BrbWb7A2djJ8hnZMrWnHo9F8ssv0OMErasDhftrfROTyqSDrw==", + "license": "MIT", + "dependencies": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "for-each": "^0.3.5", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "license": "MIT", + "engines": { + "node": ">=0.4" + } + }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "license": "ISC" + }, + "node_modules/yargs-parser": { + "version": "20.2.9", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", + "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", + "license": "ISC", + "engines": { + "node": ">=10" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000000000000000000000000000000000000..4b69ff6a2055b3eabd1785b1993daa5a6b54f877 --- /dev/null +++ b/package.json @@ -0,0 +1,18 @@ +{ + "name": "microipfs", + "version": "0.0.1", + "description": "dead simple microservice for pinning NFT related files to IPFS", + "main": "index.js", + "author": "skogard", + "license": "MIT", + "dependencies": { + "axios": "^1.13.2", + "cors": "^2.8.5", + "dotenv": "^10.0.0", + "express": "^4.17.2", + "ipfsio": "^0.0.8", + "jose": "^6.1.3", + "multer": "^2.0.1" + }, + "devDependencies": {} +} diff --git a/phase_4_proposal.md b/phase_4_proposal.md new file mode 100644 index 0000000000000000000000000000000000000000..240d135cf9987607f1b979f3c2d3b737b605f9a8 --- /dev/null +++ b/phase_4_proposal.md @@ -0,0 +1,45 @@ +# Proposal: Phase 4 — The Verifiable Student + +## 1. Vision: From a Private Portfolio to a Verifiable Record + +Phase 2 of this project gave students a tool for **private, self-sovereign storage**. Phase 4 will give them a tool for **public, verifiable achievement**. + +The goal is to integrate the concepts of Decentralized Identifiers (DIDs) and Verifiable Credentials (VCs) directly into the student portfolio workflow. This will transform the system from a simple storage locker into a true lifelong learning and career passport. When this phase is complete, a student will not only be able to store their work on IPFS but also to hold a cryptographically signed "attestation" from their institution about that work (e.g., a grade, a skill badge, or a formal credit). + +--- + +## 2. Proposed Features + +This phase will introduce two core components: + +### A. The "Institutional Issuer" Endpoint + +* We will create a new, secure API endpoint, `/issue-credential`. +* This endpoint will be used by the **institution** (e.g., a teacher or administrator). +* It will accept a student's DID, the IPFS CID of a piece of student work, and a set of claims (e.g., `grade: "A"`, `skill: "Critical Thinking"`). +* The endpoint will then generate a W3C-compliant Verifiable Credential, sign it with the institution's private key (held on the server), and return the VC to the issuer, who can then transmit it to the student. + +### B. The Student Wallet and Verifier UI + +* We will enhance the `portfolio.html` page to act as a rudimentary **digital wallet**. +* Students will be able to upload and store the VCs they receive from their school. +* We will add a "Share Proof" feature. This will allow a student to generate a **Verifiable Presentation**, which is a package containing their DID, the original credential, and a link to the work on IPFS. +* We will create a simple, public-facing "Verifier" page. Anyone (e.g., an employer) with a link to a Verifiable Presentation can visit this page, and it will automatically verify the cryptographic signatures and confirm that the student's credential is authentic. + +--- + +## 3. Technical Stack + +* **DIDs:** We will use the `did:key` method for simplicity in this proof-of-concept. This method is easy to generate and requires no blockchain interaction. +* **VCs:** We will use a standard JavaScript library (e.g., `veramo` or a similar W3C VC-JWT library) on the server to create and sign the JSON Web Token (JWT)-based credentials. +* **Cryptography:** The server will hold a private key for signing credentials. The verification process on the public page will use the corresponding public key. + +--- + +## 4. User Flow + +1. **Student:** A student uploads an essay using the existing client-side encryption feature and gets an IPFS CID. They generate a `did:key` in their portfolio and share it and the CID with their teacher. +2. **Teacher:** The teacher grades the essay. They access an internal school dashboard and use the `/issue-credential` endpoint, providing the student's DID, the essay's CID, and the grade. +3. **Student:** The student receives the signed VC from their teacher and adds it to their portfolio "wallet." +4. **Student (later):** The student applies for a job. They use the "Share Proof" feature to generate a single URL. +5. **Employer:** The employer clicks the URL, which opens the Verifier page. The page automatically fetches the data, verifies the signatures, and displays a confirmation: "✓ This credential is authentic and was issued by [School Name]." diff --git a/public/index.html b/public/index.html new file mode 100644 index 0000000000000000000000000000000000000000..90f992e20d6bbfcea90954fe146256f94c16e6c0 --- /dev/null +++ b/public/index.html @@ -0,0 +1,58 @@ + + + + + + Learning Object Repository + + + +

Learning Object Repository

+ + + + + diff --git a/public/playground.html b/public/playground.html new file mode 100644 index 0000000000000000000000000000000000000000..c921adfe36362186eea910337824381dd7b9791d --- /dev/null +++ b/public/playground.html @@ -0,0 +1,108 @@ + + + + + + AI Model Playground + + + + +
+

Interactive AI Model Playground

+

This playground is designed to run a pre-trained image classification model (like the MNIST handwritten digit recognizer) that has been stored on IPFS.

+ +
+ + + +
+ + +
+ + +

Prediction:

+
+
+ + + + diff --git a/public/portfolio.html b/public/portfolio.html new file mode 100644 index 0000000000000000000000000000000000000000..06d9b6ecfe466526b78cc547a47fc3285920d494 --- /dev/null +++ b/public/portfolio.html @@ -0,0 +1,260 @@ + + + + + + Student Portfolio - Encrypt & Upload + + + +
+

Encrypt and Upload Portfolio Item

+
+ + +
+
+ + +
+ +
+
+ +
+ +
+

Your Digital Wallet

+
+ + + +
+
+ + + +
+
+
+ +
+ +
+

Decrypt and Download Portfolio Item

+
+ + +
+
+ + +
+ +
+
+ + + + diff --git a/public/vendor/jose/index.js b/public/vendor/jose/index.js new file mode 100644 index 0000000000000000000000000000000000000000..939f09b87ee601132772b7afb2fc0a11498aa592 --- /dev/null +++ b/public/vendor/jose/index.js @@ -0,0 +1,32 @@ +export { compactDecrypt } from './jwe/compact/decrypt.js'; +export { flattenedDecrypt } from './jwe/flattened/decrypt.js'; +export { generalDecrypt } from './jwe/general/decrypt.js'; +export { GeneralEncrypt } from './jwe/general/encrypt.js'; +export { compactVerify } from './jws/compact/verify.js'; +export { flattenedVerify } from './jws/flattened/verify.js'; +export { generalVerify } from './jws/general/verify.js'; +export { jwtVerify } from './jwt/verify.js'; +export { jwtDecrypt } from './jwt/decrypt.js'; +export { CompactEncrypt } from './jwe/compact/encrypt.js'; +export { FlattenedEncrypt } from './jwe/flattened/encrypt.js'; +export { CompactSign } from './jws/compact/sign.js'; +export { FlattenedSign } from './jws/flattened/sign.js'; +export { GeneralSign } from './jws/general/sign.js'; +export { SignJWT } from './jwt/sign.js'; +export { EncryptJWT } from './jwt/encrypt.js'; +export { calculateJwkThumbprint, calculateJwkThumbprintUri } from './jwk/thumbprint.js'; +export { EmbeddedJWK } from './jwk/embedded.js'; +export { createLocalJWKSet } from './jwks/local.js'; +export { createRemoteJWKSet, jwksCache, customFetch } from './jwks/remote.js'; +export { UnsecuredJWT } from './jwt/unsecured.js'; +export { exportPKCS8, exportSPKI, exportJWK } from './key/export.js'; +export { importSPKI, importPKCS8, importX509, importJWK } from './key/import.js'; +export { decodeProtectedHeader } from './util/decode_protected_header.js'; +export { decodeJwt } from './util/decode_jwt.js'; +import * as errors from './util/errors.js'; +export { errors }; +export { generateKeyPair } from './key/generate_key_pair.js'; +export { generateSecret } from './key/generate_secret.js'; +import * as base64url from './util/base64url.js'; +export { base64url }; +export const cryptoRuntime = 'WebCryptoAPI'; diff --git a/public/vendor/jose/jwe/compact/decrypt.js b/public/vendor/jose/jwe/compact/decrypt.js new file mode 100644 index 0000000000000000000000000000000000000000..d74a67b1340dee67081decaf1ad8b8adee45cd36 --- /dev/null +++ b/public/vendor/jose/jwe/compact/decrypt.js @@ -0,0 +1,27 @@ +import { flattenedDecrypt } from '../flattened/decrypt.js'; +import { JWEInvalid } from '../../util/errors.js'; +import { decoder } from '../../lib/buffer_utils.js'; +export async function compactDecrypt(jwe, key, options) { + if (jwe instanceof Uint8Array) { + jwe = decoder.decode(jwe); + } + if (typeof jwe !== 'string') { + throw new JWEInvalid('Compact JWE must be a string or Uint8Array'); + } + const { 0: protectedHeader, 1: encryptedKey, 2: iv, 3: ciphertext, 4: tag, length, } = jwe.split('.'); + if (length !== 5) { + throw new JWEInvalid('Invalid Compact JWE'); + } + const decrypted = await flattenedDecrypt({ + ciphertext, + iv: iv || undefined, + protected: protectedHeader, + tag: tag || undefined, + encrypted_key: encryptedKey || undefined, + }, key, options); + const result = { plaintext: decrypted.plaintext, protectedHeader: decrypted.protectedHeader }; + if (typeof key === 'function') { + return { ...result, key: decrypted.key }; + } + return result; +} diff --git a/public/vendor/jose/jwe/compact/encrypt.js b/public/vendor/jose/jwe/compact/encrypt.js new file mode 100644 index 0000000000000000000000000000000000000000..5492e2c2e1a6221d161622d97cd3dd73d093495e --- /dev/null +++ b/public/vendor/jose/jwe/compact/encrypt.js @@ -0,0 +1,27 @@ +import { FlattenedEncrypt } from '../flattened/encrypt.js'; +export class CompactEncrypt { + #flattened; + constructor(plaintext) { + this.#flattened = new FlattenedEncrypt(plaintext); + } + setContentEncryptionKey(cek) { + this.#flattened.setContentEncryptionKey(cek); + return this; + } + setInitializationVector(iv) { + this.#flattened.setInitializationVector(iv); + return this; + } + setProtectedHeader(protectedHeader) { + this.#flattened.setProtectedHeader(protectedHeader); + return this; + } + setKeyManagementParameters(parameters) { + this.#flattened.setKeyManagementParameters(parameters); + return this; + } + async encrypt(key, options) { + const jwe = await this.#flattened.encrypt(key, options); + return [jwe.protected, jwe.encrypted_key, jwe.iv, jwe.ciphertext, jwe.tag].join('.'); + } +} diff --git a/public/vendor/jose/jwe/flattened/decrypt.js b/public/vendor/jose/jwe/flattened/decrypt.js new file mode 100644 index 0000000000000000000000000000000000000000..d7a846aeaf782196e4dc35a80a82a7eb18eec194 --- /dev/null +++ b/public/vendor/jose/jwe/flattened/decrypt.js @@ -0,0 +1,165 @@ +import { decode as b64u } from '../../util/base64url.js'; +import { decrypt } from '../../lib/decrypt.js'; +import { JOSEAlgNotAllowed, JOSENotSupported, JWEInvalid } from '../../util/errors.js'; +import { isDisjoint } from '../../lib/is_disjoint.js'; +import { isObject } from '../../lib/is_object.js'; +import { decryptKeyManagement } from '../../lib/decrypt_key_management.js'; +import { decoder, concat, encode } from '../../lib/buffer_utils.js'; +import { generateCek } from '../../lib/cek.js'; +import { validateCrit } from '../../lib/validate_crit.js'; +import { validateAlgorithms } from '../../lib/validate_algorithms.js'; +import { normalizeKey } from '../../lib/normalize_key.js'; +import { checkKeyType } from '../../lib/check_key_type.js'; +export async function flattenedDecrypt(jwe, key, options) { + if (!isObject(jwe)) { + throw new JWEInvalid('Flattened JWE must be an object'); + } + if (jwe.protected === undefined && jwe.header === undefined && jwe.unprotected === undefined) { + throw new JWEInvalid('JOSE Header missing'); + } + if (jwe.iv !== undefined && typeof jwe.iv !== 'string') { + throw new JWEInvalid('JWE Initialization Vector incorrect type'); + } + if (typeof jwe.ciphertext !== 'string') { + throw new JWEInvalid('JWE Ciphertext missing or incorrect type'); + } + if (jwe.tag !== undefined && typeof jwe.tag !== 'string') { + throw new JWEInvalid('JWE Authentication Tag incorrect type'); + } + if (jwe.protected !== undefined && typeof jwe.protected !== 'string') { + throw new JWEInvalid('JWE Protected Header incorrect type'); + } + if (jwe.encrypted_key !== undefined && typeof jwe.encrypted_key !== 'string') { + throw new JWEInvalid('JWE Encrypted Key incorrect type'); + } + if (jwe.aad !== undefined && typeof jwe.aad !== 'string') { + throw new JWEInvalid('JWE AAD incorrect type'); + } + if (jwe.header !== undefined && !isObject(jwe.header)) { + throw new JWEInvalid('JWE Shared Unprotected Header incorrect type'); + } + if (jwe.unprotected !== undefined && !isObject(jwe.unprotected)) { + throw new JWEInvalid('JWE Per-Recipient Unprotected Header incorrect type'); + } + let parsedProt; + if (jwe.protected) { + try { + const protectedHeader = b64u(jwe.protected); + parsedProt = JSON.parse(decoder.decode(protectedHeader)); + } + catch { + throw new JWEInvalid('JWE Protected Header is invalid'); + } + } + if (!isDisjoint(parsedProt, jwe.header, jwe.unprotected)) { + throw new JWEInvalid('JWE Protected, JWE Unprotected Header, and JWE Per-Recipient Unprotected Header Parameter names must be disjoint'); + } + const joseHeader = { + ...parsedProt, + ...jwe.header, + ...jwe.unprotected, + }; + validateCrit(JWEInvalid, new Map(), options?.crit, parsedProt, joseHeader); + if (joseHeader.zip !== undefined) { + throw new JOSENotSupported('JWE "zip" (Compression Algorithm) Header Parameter is not supported.'); + } + const { alg, enc } = joseHeader; + if (typeof alg !== 'string' || !alg) { + throw new JWEInvalid('missing JWE Algorithm (alg) in JWE Header'); + } + if (typeof enc !== 'string' || !enc) { + throw new JWEInvalid('missing JWE Encryption Algorithm (enc) in JWE Header'); + } + const keyManagementAlgorithms = options && validateAlgorithms('keyManagementAlgorithms', options.keyManagementAlgorithms); + const contentEncryptionAlgorithms = options && + validateAlgorithms('contentEncryptionAlgorithms', options.contentEncryptionAlgorithms); + if ((keyManagementAlgorithms && !keyManagementAlgorithms.has(alg)) || + (!keyManagementAlgorithms && alg.startsWith('PBES2'))) { + throw new JOSEAlgNotAllowed('"alg" (Algorithm) Header Parameter value not allowed'); + } + if (contentEncryptionAlgorithms && !contentEncryptionAlgorithms.has(enc)) { + throw new JOSEAlgNotAllowed('"enc" (Encryption Algorithm) Header Parameter value not allowed'); + } + let encryptedKey; + if (jwe.encrypted_key !== undefined) { + try { + encryptedKey = b64u(jwe.encrypted_key); + } + catch { + throw new JWEInvalid('Failed to base64url decode the encrypted_key'); + } + } + let resolvedKey = false; + if (typeof key === 'function') { + key = await key(parsedProt, jwe); + resolvedKey = true; + } + checkKeyType(alg === 'dir' ? enc : alg, key, 'decrypt'); + const k = await normalizeKey(key, alg); + let cek; + try { + cek = await decryptKeyManagement(alg, k, encryptedKey, joseHeader, options); + } + catch (err) { + if (err instanceof TypeError || err instanceof JWEInvalid || err instanceof JOSENotSupported) { + throw err; + } + cek = generateCek(enc); + } + let iv; + let tag; + if (jwe.iv !== undefined) { + try { + iv = b64u(jwe.iv); + } + catch { + throw new JWEInvalid('Failed to base64url decode the iv'); + } + } + if (jwe.tag !== undefined) { + try { + tag = b64u(jwe.tag); + } + catch { + throw new JWEInvalid('Failed to base64url decode the tag'); + } + } + const protectedHeader = jwe.protected !== undefined ? encode(jwe.protected) : new Uint8Array(); + let additionalData; + if (jwe.aad !== undefined) { + additionalData = concat(protectedHeader, encode('.'), encode(jwe.aad)); + } + else { + additionalData = protectedHeader; + } + let ciphertext; + try { + ciphertext = b64u(jwe.ciphertext); + } + catch { + throw new JWEInvalid('Failed to base64url decode the ciphertext'); + } + const plaintext = await decrypt(enc, cek, ciphertext, iv, tag, additionalData); + const result = { plaintext }; + if (jwe.protected !== undefined) { + result.protectedHeader = parsedProt; + } + if (jwe.aad !== undefined) { + try { + result.additionalAuthenticatedData = b64u(jwe.aad); + } + catch { + throw new JWEInvalid('Failed to base64url decode the aad'); + } + } + if (jwe.unprotected !== undefined) { + result.sharedUnprotectedHeader = jwe.unprotected; + } + if (jwe.header !== undefined) { + result.unprotectedHeader = jwe.header; + } + if (resolvedKey) { + return { ...result, key: k }; + } + return result; +} diff --git a/public/vendor/jose/jwe/flattened/encrypt.js b/public/vendor/jose/jwe/flattened/encrypt.js new file mode 100644 index 0000000000000000000000000000000000000000..aa2cd1c0b8e39a44f72899c56ec9f03d8f3674ca --- /dev/null +++ b/public/vendor/jose/jwe/flattened/encrypt.js @@ -0,0 +1,169 @@ +import { encode as b64u } from '../../util/base64url.js'; +import { unprotected } from '../../lib/private_symbols.js'; +import { encrypt } from '../../lib/encrypt.js'; +import { encryptKeyManagement } from '../../lib/encrypt_key_management.js'; +import { JOSENotSupported, JWEInvalid } from '../../util/errors.js'; +import { isDisjoint } from '../../lib/is_disjoint.js'; +import { concat, encode } from '../../lib/buffer_utils.js'; +import { validateCrit } from '../../lib/validate_crit.js'; +import { normalizeKey } from '../../lib/normalize_key.js'; +import { checkKeyType } from '../../lib/check_key_type.js'; +export class FlattenedEncrypt { + #plaintext; + #protectedHeader; + #sharedUnprotectedHeader; + #unprotectedHeader; + #aad; + #cek; + #iv; + #keyManagementParameters; + constructor(plaintext) { + if (!(plaintext instanceof Uint8Array)) { + throw new TypeError('plaintext must be an instance of Uint8Array'); + } + this.#plaintext = plaintext; + } + setKeyManagementParameters(parameters) { + if (this.#keyManagementParameters) { + throw new TypeError('setKeyManagementParameters can only be called once'); + } + this.#keyManagementParameters = parameters; + return this; + } + setProtectedHeader(protectedHeader) { + if (this.#protectedHeader) { + throw new TypeError('setProtectedHeader can only be called once'); + } + this.#protectedHeader = protectedHeader; + return this; + } + setSharedUnprotectedHeader(sharedUnprotectedHeader) { + if (this.#sharedUnprotectedHeader) { + throw new TypeError('setSharedUnprotectedHeader can only be called once'); + } + this.#sharedUnprotectedHeader = sharedUnprotectedHeader; + return this; + } + setUnprotectedHeader(unprotectedHeader) { + if (this.#unprotectedHeader) { + throw new TypeError('setUnprotectedHeader can only be called once'); + } + this.#unprotectedHeader = unprotectedHeader; + return this; + } + setAdditionalAuthenticatedData(aad) { + this.#aad = aad; + return this; + } + setContentEncryptionKey(cek) { + if (this.#cek) { + throw new TypeError('setContentEncryptionKey can only be called once'); + } + this.#cek = cek; + return this; + } + setInitializationVector(iv) { + if (this.#iv) { + throw new TypeError('setInitializationVector can only be called once'); + } + this.#iv = iv; + return this; + } + async encrypt(key, options) { + if (!this.#protectedHeader && !this.#unprotectedHeader && !this.#sharedUnprotectedHeader) { + throw new JWEInvalid('either setProtectedHeader, setUnprotectedHeader, or sharedUnprotectedHeader must be called before #encrypt()'); + } + if (!isDisjoint(this.#protectedHeader, this.#unprotectedHeader, this.#sharedUnprotectedHeader)) { + throw new JWEInvalid('JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint'); + } + const joseHeader = { + ...this.#protectedHeader, + ...this.#unprotectedHeader, + ...this.#sharedUnprotectedHeader, + }; + validateCrit(JWEInvalid, new Map(), options?.crit, this.#protectedHeader, joseHeader); + if (joseHeader.zip !== undefined) { + throw new JOSENotSupported('JWE "zip" (Compression Algorithm) Header Parameter is not supported.'); + } + const { alg, enc } = joseHeader; + if (typeof alg !== 'string' || !alg) { + throw new JWEInvalid('JWE "alg" (Algorithm) Header Parameter missing or invalid'); + } + if (typeof enc !== 'string' || !enc) { + throw new JWEInvalid('JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid'); + } + let encryptedKey; + if (this.#cek && (alg === 'dir' || alg === 'ECDH-ES')) { + throw new TypeError(`setContentEncryptionKey cannot be called with JWE "alg" (Algorithm) Header ${alg}`); + } + checkKeyType(alg === 'dir' ? enc : alg, key, 'encrypt'); + let cek; + { + let parameters; + const k = await normalizeKey(key, alg); + ({ cek, encryptedKey, parameters } = await encryptKeyManagement(alg, enc, k, this.#cek, this.#keyManagementParameters)); + if (parameters) { + if (options && unprotected in options) { + if (!this.#unprotectedHeader) { + this.setUnprotectedHeader(parameters); + } + else { + this.#unprotectedHeader = { ...this.#unprotectedHeader, ...parameters }; + } + } + else if (!this.#protectedHeader) { + this.setProtectedHeader(parameters); + } + else { + this.#protectedHeader = { ...this.#protectedHeader, ...parameters }; + } + } + } + let additionalData; + let protectedHeaderS; + let protectedHeaderB; + let aadMember; + if (this.#protectedHeader) { + protectedHeaderS = b64u(JSON.stringify(this.#protectedHeader)); + protectedHeaderB = encode(protectedHeaderS); + } + else { + protectedHeaderS = ''; + protectedHeaderB = new Uint8Array(); + } + if (this.#aad) { + aadMember = b64u(this.#aad); + const aadMemberBytes = encode(aadMember); + additionalData = concat(protectedHeaderB, encode('.'), aadMemberBytes); + } + else { + additionalData = protectedHeaderB; + } + const { ciphertext, tag, iv } = await encrypt(enc, this.#plaintext, cek, this.#iv, additionalData); + const jwe = { + ciphertext: b64u(ciphertext), + }; + if (iv) { + jwe.iv = b64u(iv); + } + if (tag) { + jwe.tag = b64u(tag); + } + if (encryptedKey) { + jwe.encrypted_key = b64u(encryptedKey); + } + if (aadMember) { + jwe.aad = aadMember; + } + if (this.#protectedHeader) { + jwe.protected = protectedHeaderS; + } + if (this.#sharedUnprotectedHeader) { + jwe.unprotected = this.#sharedUnprotectedHeader; + } + if (this.#unprotectedHeader) { + jwe.header = this.#unprotectedHeader; + } + return jwe; + } +} diff --git a/public/vendor/jose/jwe/general/decrypt.js b/public/vendor/jose/jwe/general/decrypt.js new file mode 100644 index 0000000000000000000000000000000000000000..65436afcf0636a321e45eabca889a060386f8a94 --- /dev/null +++ b/public/vendor/jose/jwe/general/decrypt.js @@ -0,0 +1,31 @@ +import { flattenedDecrypt } from '../flattened/decrypt.js'; +import { JWEDecryptionFailed, JWEInvalid } from '../../util/errors.js'; +import { isObject } from '../../lib/is_object.js'; +export async function generalDecrypt(jwe, key, options) { + if (!isObject(jwe)) { + throw new JWEInvalid('General JWE must be an object'); + } + if (!Array.isArray(jwe.recipients) || !jwe.recipients.every(isObject)) { + throw new JWEInvalid('JWE Recipients missing or incorrect type'); + } + if (!jwe.recipients.length) { + throw new JWEInvalid('JWE Recipients has no members'); + } + for (const recipient of jwe.recipients) { + try { + return await flattenedDecrypt({ + aad: jwe.aad, + ciphertext: jwe.ciphertext, + encrypted_key: recipient.encrypted_key, + header: recipient.header, + iv: jwe.iv, + protected: jwe.protected, + tag: jwe.tag, + unprotected: jwe.unprotected, + }, key, options); + } + catch { + } + } + throw new JWEDecryptionFailed(); +} diff --git a/public/vendor/jose/jwe/general/encrypt.js b/public/vendor/jose/jwe/general/encrypt.js new file mode 100644 index 0000000000000000000000000000000000000000..0ee1ebfbccc3f6695ed9db809b8c58790556e337 --- /dev/null +++ b/public/vendor/jose/jwe/general/encrypt.js @@ -0,0 +1,187 @@ +import { FlattenedEncrypt } from '../flattened/encrypt.js'; +import { unprotected } from '../../lib/private_symbols.js'; +import { JOSENotSupported, JWEInvalid } from '../../util/errors.js'; +import { generateCek } from '../../lib/cek.js'; +import { isDisjoint } from '../../lib/is_disjoint.js'; +import { encryptKeyManagement } from '../../lib/encrypt_key_management.js'; +import { encode as b64u } from '../../util/base64url.js'; +import { validateCrit } from '../../lib/validate_crit.js'; +import { normalizeKey } from '../../lib/normalize_key.js'; +import { checkKeyType } from '../../lib/check_key_type.js'; +class IndividualRecipient { + #parent; + unprotectedHeader; + keyManagementParameters; + key; + options; + constructor(enc, key, options) { + this.#parent = enc; + this.key = key; + this.options = options; + } + setUnprotectedHeader(unprotectedHeader) { + if (this.unprotectedHeader) { + throw new TypeError('setUnprotectedHeader can only be called once'); + } + this.unprotectedHeader = unprotectedHeader; + return this; + } + setKeyManagementParameters(parameters) { + if (this.keyManagementParameters) { + throw new TypeError('setKeyManagementParameters can only be called once'); + } + this.keyManagementParameters = parameters; + return this; + } + addRecipient(...args) { + return this.#parent.addRecipient(...args); + } + encrypt(...args) { + return this.#parent.encrypt(...args); + } + done() { + return this.#parent; + } +} +export class GeneralEncrypt { + #plaintext; + #recipients = []; + #protectedHeader; + #unprotectedHeader; + #aad; + constructor(plaintext) { + this.#plaintext = plaintext; + } + addRecipient(key, options) { + const recipient = new IndividualRecipient(this, key, { crit: options?.crit }); + this.#recipients.push(recipient); + return recipient; + } + setProtectedHeader(protectedHeader) { + if (this.#protectedHeader) { + throw new TypeError('setProtectedHeader can only be called once'); + } + this.#protectedHeader = protectedHeader; + return this; + } + setSharedUnprotectedHeader(sharedUnprotectedHeader) { + if (this.#unprotectedHeader) { + throw new TypeError('setSharedUnprotectedHeader can only be called once'); + } + this.#unprotectedHeader = sharedUnprotectedHeader; + return this; + } + setAdditionalAuthenticatedData(aad) { + this.#aad = aad; + return this; + } + async encrypt() { + if (!this.#recipients.length) { + throw new JWEInvalid('at least one recipient must be added'); + } + if (this.#recipients.length === 1) { + const [recipient] = this.#recipients; + const flattened = await new FlattenedEncrypt(this.#plaintext) + .setAdditionalAuthenticatedData(this.#aad) + .setProtectedHeader(this.#protectedHeader) + .setSharedUnprotectedHeader(this.#unprotectedHeader) + .setUnprotectedHeader(recipient.unprotectedHeader) + .encrypt(recipient.key, { ...recipient.options }); + const jwe = { + ciphertext: flattened.ciphertext, + iv: flattened.iv, + recipients: [{}], + tag: flattened.tag, + }; + if (flattened.aad) + jwe.aad = flattened.aad; + if (flattened.protected) + jwe.protected = flattened.protected; + if (flattened.unprotected) + jwe.unprotected = flattened.unprotected; + if (flattened.encrypted_key) + jwe.recipients[0].encrypted_key = flattened.encrypted_key; + if (flattened.header) + jwe.recipients[0].header = flattened.header; + return jwe; + } + let enc; + for (let i = 0; i < this.#recipients.length; i++) { + const recipient = this.#recipients[i]; + if (!isDisjoint(this.#protectedHeader, this.#unprotectedHeader, recipient.unprotectedHeader)) { + throw new JWEInvalid('JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint'); + } + const joseHeader = { + ...this.#protectedHeader, + ...this.#unprotectedHeader, + ...recipient.unprotectedHeader, + }; + const { alg } = joseHeader; + if (typeof alg !== 'string' || !alg) { + throw new JWEInvalid('JWE "alg" (Algorithm) Header Parameter missing or invalid'); + } + if (alg === 'dir' || alg === 'ECDH-ES') { + throw new JWEInvalid('"dir" and "ECDH-ES" alg may only be used with a single recipient'); + } + if (typeof joseHeader.enc !== 'string' || !joseHeader.enc) { + throw new JWEInvalid('JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid'); + } + if (!enc) { + enc = joseHeader.enc; + } + else if (enc !== joseHeader.enc) { + throw new JWEInvalid('JWE "enc" (Encryption Algorithm) Header Parameter must be the same for all recipients'); + } + validateCrit(JWEInvalid, new Map(), recipient.options.crit, this.#protectedHeader, joseHeader); + if (joseHeader.zip !== undefined) { + throw new JOSENotSupported('JWE "zip" (Compression Algorithm) Header Parameter is not supported.'); + } + } + const cek = generateCek(enc); + const jwe = { + ciphertext: '', + recipients: [], + }; + for (let i = 0; i < this.#recipients.length; i++) { + const recipient = this.#recipients[i]; + const target = {}; + jwe.recipients.push(target); + if (i === 0) { + const flattened = await new FlattenedEncrypt(this.#plaintext) + .setAdditionalAuthenticatedData(this.#aad) + .setContentEncryptionKey(cek) + .setProtectedHeader(this.#protectedHeader) + .setSharedUnprotectedHeader(this.#unprotectedHeader) + .setUnprotectedHeader(recipient.unprotectedHeader) + .setKeyManagementParameters(recipient.keyManagementParameters) + .encrypt(recipient.key, { + ...recipient.options, + [unprotected]: true, + }); + jwe.ciphertext = flattened.ciphertext; + jwe.iv = flattened.iv; + jwe.tag = flattened.tag; + if (flattened.aad) + jwe.aad = flattened.aad; + if (flattened.protected) + jwe.protected = flattened.protected; + if (flattened.unprotected) + jwe.unprotected = flattened.unprotected; + target.encrypted_key = flattened.encrypted_key; + if (flattened.header) + target.header = flattened.header; + continue; + } + const alg = recipient.unprotectedHeader?.alg || + this.#protectedHeader?.alg || + this.#unprotectedHeader?.alg; + checkKeyType(alg === 'dir' ? enc : alg, recipient.key, 'encrypt'); + const k = await normalizeKey(recipient.key, alg); + const { encryptedKey, parameters } = await encryptKeyManagement(alg, enc, k, cek, recipient.keyManagementParameters); + target.encrypted_key = b64u(encryptedKey); + if (recipient.unprotectedHeader || parameters) + target.header = { ...recipient.unprotectedHeader, ...parameters }; + } + return jwe; + } +} diff --git a/public/vendor/jose/jwk/embedded.js b/public/vendor/jose/jwk/embedded.js new file mode 100644 index 0000000000000000000000000000000000000000..ac716b3387e8d0a21235ce7425db560ea744beba --- /dev/null +++ b/public/vendor/jose/jwk/embedded.js @@ -0,0 +1,17 @@ +import { importJWK } from '../key/import.js'; +import { isObject } from '../lib/is_object.js'; +import { JWSInvalid } from '../util/errors.js'; +export async function EmbeddedJWK(protectedHeader, token) { + const joseHeader = { + ...protectedHeader, + ...token?.header, + }; + if (!isObject(joseHeader.jwk)) { + throw new JWSInvalid('"jwk" (JSON Web Key) Header Parameter must be a JSON object'); + } + const key = await importJWK({ ...joseHeader.jwk, ext: true }, joseHeader.alg); + if (key instanceof Uint8Array || key.type !== 'public') { + throw new JWSInvalid('"jwk" (JSON Web Key) Header Parameter must be a public key'); + } + return key; +} diff --git a/public/vendor/jose/jwk/thumbprint.js b/public/vendor/jose/jwk/thumbprint.js new file mode 100644 index 0000000000000000000000000000000000000000..51f577244130f00a5f65388202ef8d0d85c74605 --- /dev/null +++ b/public/vendor/jose/jwk/thumbprint.js @@ -0,0 +1,68 @@ +import { digest } from '../lib/digest.js'; +import { encode as b64u } from '../util/base64url.js'; +import { JOSENotSupported, JWKInvalid } from '../util/errors.js'; +import { encode } from '../lib/buffer_utils.js'; +import { isKeyLike } from '../lib/is_key_like.js'; +import { isJWK } from '../lib/is_jwk.js'; +import { exportJWK } from '../key/export.js'; +import { invalidKeyInput } from '../lib/invalid_key_input.js'; +const check = (value, description) => { + if (typeof value !== 'string' || !value) { + throw new JWKInvalid(`${description} missing or invalid`); + } +}; +export async function calculateJwkThumbprint(key, digestAlgorithm) { + let jwk; + if (isJWK(key)) { + jwk = key; + } + else if (isKeyLike(key)) { + jwk = await exportJWK(key); + } + else { + throw new TypeError(invalidKeyInput(key, 'CryptoKey', 'KeyObject', 'JSON Web Key')); + } + digestAlgorithm ??= 'sha256'; + if (digestAlgorithm !== 'sha256' && + digestAlgorithm !== 'sha384' && + digestAlgorithm !== 'sha512') { + throw new TypeError('digestAlgorithm must one of "sha256", "sha384", or "sha512"'); + } + let components; + switch (jwk.kty) { + case 'AKP': + check(jwk.alg, '"alg" (Algorithm) Parameter'); + check(jwk.pub, '"pub" (Public key) Parameter'); + components = { alg: jwk.alg, kty: jwk.kty, pub: jwk.pub }; + break; + case 'EC': + check(jwk.crv, '"crv" (Curve) Parameter'); + check(jwk.x, '"x" (X Coordinate) Parameter'); + check(jwk.y, '"y" (Y Coordinate) Parameter'); + components = { crv: jwk.crv, kty: jwk.kty, x: jwk.x, y: jwk.y }; + break; + case 'OKP': + check(jwk.crv, '"crv" (Subtype of Key Pair) Parameter'); + check(jwk.x, '"x" (Public Key) Parameter'); + components = { crv: jwk.crv, kty: jwk.kty, x: jwk.x }; + break; + case 'RSA': + check(jwk.e, '"e" (Exponent) Parameter'); + check(jwk.n, '"n" (Modulus) Parameter'); + components = { e: jwk.e, kty: jwk.kty, n: jwk.n }; + break; + case 'oct': + check(jwk.k, '"k" (Key Value) Parameter'); + components = { k: jwk.k, kty: jwk.kty }; + break; + default: + throw new JOSENotSupported('"kty" (Key Type) Parameter missing or unsupported'); + } + const data = encode(JSON.stringify(components)); + return b64u(await digest(digestAlgorithm, data)); +} +export async function calculateJwkThumbprintUri(key, digestAlgorithm) { + digestAlgorithm ??= 'sha256'; + const thumbprint = await calculateJwkThumbprint(key, digestAlgorithm); + return `urn:ietf:params:oauth:jwk-thumbprint:sha-${digestAlgorithm.slice(-3)}:${thumbprint}`; +} diff --git a/public/vendor/jose/jwks/local.js b/public/vendor/jose/jwks/local.js new file mode 100644 index 0000000000000000000000000000000000000000..c62bdc79c173a352b31d7ba46bb657f8af60346b --- /dev/null +++ b/public/vendor/jose/jwks/local.js @@ -0,0 +1,119 @@ +import { importJWK } from '../key/import.js'; +import { JWKSInvalid, JOSENotSupported, JWKSNoMatchingKey, JWKSMultipleMatchingKeys, } from '../util/errors.js'; +import { isObject } from '../lib/is_object.js'; +function getKtyFromAlg(alg) { + switch (typeof alg === 'string' && alg.slice(0, 2)) { + case 'RS': + case 'PS': + return 'RSA'; + case 'ES': + return 'EC'; + case 'Ed': + return 'OKP'; + case 'ML': + return 'AKP'; + default: + throw new JOSENotSupported('Unsupported "alg" value for a JSON Web Key Set'); + } +} +function isJWKSLike(jwks) { + return (jwks && + typeof jwks === 'object' && + Array.isArray(jwks.keys) && + jwks.keys.every(isJWKLike)); +} +function isJWKLike(key) { + return isObject(key); +} +class LocalJWKSet { + #jwks; + #cached = new WeakMap(); + constructor(jwks) { + if (!isJWKSLike(jwks)) { + throw new JWKSInvalid('JSON Web Key Set malformed'); + } + this.#jwks = structuredClone(jwks); + } + jwks() { + return this.#jwks; + } + async getKey(protectedHeader, token) { + const { alg, kid } = { ...protectedHeader, ...token?.header }; + const kty = getKtyFromAlg(alg); + const candidates = this.#jwks.keys.filter((jwk) => { + let candidate = kty === jwk.kty; + if (candidate && typeof kid === 'string') { + candidate = kid === jwk.kid; + } + if (candidate && (typeof jwk.alg === 'string' || kty === 'AKP')) { + candidate = alg === jwk.alg; + } + if (candidate && typeof jwk.use === 'string') { + candidate = jwk.use === 'sig'; + } + if (candidate && Array.isArray(jwk.key_ops)) { + candidate = jwk.key_ops.includes('verify'); + } + if (candidate) { + switch (alg) { + case 'ES256': + candidate = jwk.crv === 'P-256'; + break; + case 'ES384': + candidate = jwk.crv === 'P-384'; + break; + case 'ES512': + candidate = jwk.crv === 'P-521'; + break; + case 'Ed25519': + case 'EdDSA': + candidate = jwk.crv === 'Ed25519'; + break; + } + } + return candidate; + }); + const { 0: jwk, length } = candidates; + if (length === 0) { + throw new JWKSNoMatchingKey(); + } + if (length !== 1) { + const error = new JWKSMultipleMatchingKeys(); + const _cached = this.#cached; + error[Symbol.asyncIterator] = async function* () { + for (const jwk of candidates) { + try { + yield await importWithAlgCache(_cached, jwk, alg); + } + catch { } + } + }; + throw error; + } + return importWithAlgCache(this.#cached, jwk, alg); + } +} +async function importWithAlgCache(cache, jwk, alg) { + const cached = cache.get(jwk) || cache.set(jwk, {}).get(jwk); + if (cached[alg] === undefined) { + const key = await importJWK({ ...jwk, ext: true }, alg); + if (key instanceof Uint8Array || key.type !== 'public') { + throw new JWKSInvalid('JSON Web Key Set members must be public keys'); + } + cached[alg] = key; + } + return cached[alg]; +} +export function createLocalJWKSet(jwks) { + const set = new LocalJWKSet(jwks); + const localJWKSet = async (protectedHeader, token) => set.getKey(protectedHeader, token); + Object.defineProperties(localJWKSet, { + jwks: { + value: () => structuredClone(set.jwks()), + enumerable: false, + configurable: false, + writable: false, + }, + }); + return localJWKSet; +} diff --git a/public/vendor/jose/jwks/remote.js b/public/vendor/jose/jwks/remote.js new file mode 100644 index 0000000000000000000000000000000000000000..3a7f0d48bf27bd5048c0e058ee20bdadd836b885 --- /dev/null +++ b/public/vendor/jose/jwks/remote.js @@ -0,0 +1,179 @@ +import { JOSEError, JWKSNoMatchingKey, JWKSTimeout } from '../util/errors.js'; +import { createLocalJWKSet } from './local.js'; +import { isObject } from '../lib/is_object.js'; +function isCloudflareWorkers() { + return (typeof WebSocketPair !== 'undefined' || + (typeof navigator !== 'undefined' && navigator.userAgent === 'Cloudflare-Workers') || + (typeof EdgeRuntime !== 'undefined' && EdgeRuntime === 'vercel')); +} +let USER_AGENT; +if (typeof navigator === 'undefined' || !navigator.userAgent?.startsWith?.('Mozilla/5.0 ')) { + const NAME = 'jose'; + const VERSION = 'v6.1.3'; + USER_AGENT = `${NAME}/${VERSION}`; +} +export const customFetch = Symbol(); +async function fetchJwks(url, headers, signal, fetchImpl = fetch) { + const response = await fetchImpl(url, { + method: 'GET', + signal, + redirect: 'manual', + headers, + }).catch((err) => { + if (err.name === 'TimeoutError') { + throw new JWKSTimeout(); + } + throw err; + }); + if (response.status !== 200) { + throw new JOSEError('Expected 200 OK from the JSON Web Key Set HTTP response'); + } + try { + return await response.json(); + } + catch { + throw new JOSEError('Failed to parse the JSON Web Key Set HTTP response as JSON'); + } +} +export const jwksCache = Symbol(); +function isFreshJwksCache(input, cacheMaxAge) { + if (typeof input !== 'object' || input === null) { + return false; + } + if (!('uat' in input) || typeof input.uat !== 'number' || Date.now() - input.uat >= cacheMaxAge) { + return false; + } + if (!('jwks' in input) || + !isObject(input.jwks) || + !Array.isArray(input.jwks.keys) || + !Array.prototype.every.call(input.jwks.keys, isObject)) { + return false; + } + return true; +} +class RemoteJWKSet { + #url; + #timeoutDuration; + #cooldownDuration; + #cacheMaxAge; + #jwksTimestamp; + #pendingFetch; + #headers; + #customFetch; + #local; + #cache; + constructor(url, options) { + if (!(url instanceof URL)) { + throw new TypeError('url must be an instance of URL'); + } + this.#url = new URL(url.href); + this.#timeoutDuration = + typeof options?.timeoutDuration === 'number' ? options?.timeoutDuration : 5000; + this.#cooldownDuration = + typeof options?.cooldownDuration === 'number' ? options?.cooldownDuration : 30000; + this.#cacheMaxAge = typeof options?.cacheMaxAge === 'number' ? options?.cacheMaxAge : 600000; + this.#headers = new Headers(options?.headers); + if (USER_AGENT && !this.#headers.has('User-Agent')) { + this.#headers.set('User-Agent', USER_AGENT); + } + if (!this.#headers.has('accept')) { + this.#headers.set('accept', 'application/json'); + this.#headers.append('accept', 'application/jwk-set+json'); + } + this.#customFetch = options?.[customFetch]; + if (options?.[jwksCache] !== undefined) { + this.#cache = options?.[jwksCache]; + if (isFreshJwksCache(options?.[jwksCache], this.#cacheMaxAge)) { + this.#jwksTimestamp = this.#cache.uat; + this.#local = createLocalJWKSet(this.#cache.jwks); + } + } + } + pendingFetch() { + return !!this.#pendingFetch; + } + coolingDown() { + return typeof this.#jwksTimestamp === 'number' + ? Date.now() < this.#jwksTimestamp + this.#cooldownDuration + : false; + } + fresh() { + return typeof this.#jwksTimestamp === 'number' + ? Date.now() < this.#jwksTimestamp + this.#cacheMaxAge + : false; + } + jwks() { + return this.#local?.jwks(); + } + async getKey(protectedHeader, token) { + if (!this.#local || !this.fresh()) { + await this.reload(); + } + try { + return await this.#local(protectedHeader, token); + } + catch (err) { + if (err instanceof JWKSNoMatchingKey) { + if (this.coolingDown() === false) { + await this.reload(); + return this.#local(protectedHeader, token); + } + } + throw err; + } + } + async reload() { + if (this.#pendingFetch && isCloudflareWorkers()) { + this.#pendingFetch = undefined; + } + this.#pendingFetch ||= fetchJwks(this.#url.href, this.#headers, AbortSignal.timeout(this.#timeoutDuration), this.#customFetch) + .then((json) => { + this.#local = createLocalJWKSet(json); + if (this.#cache) { + this.#cache.uat = Date.now(); + this.#cache.jwks = json; + } + this.#jwksTimestamp = Date.now(); + this.#pendingFetch = undefined; + }) + .catch((err) => { + this.#pendingFetch = undefined; + throw err; + }); + await this.#pendingFetch; + } +} +export function createRemoteJWKSet(url, options) { + const set = new RemoteJWKSet(url, options); + const remoteJWKSet = async (protectedHeader, token) => set.getKey(protectedHeader, token); + Object.defineProperties(remoteJWKSet, { + coolingDown: { + get: () => set.coolingDown(), + enumerable: true, + configurable: false, + }, + fresh: { + get: () => set.fresh(), + enumerable: true, + configurable: false, + }, + reload: { + value: () => set.reload(), + enumerable: true, + configurable: false, + writable: false, + }, + reloading: { + get: () => set.pendingFetch(), + enumerable: true, + configurable: false, + }, + jwks: { + value: () => set.jwks(), + enumerable: true, + configurable: false, + writable: false, + }, + }); + return remoteJWKSet; +} diff --git a/public/vendor/jose/jws/compact/sign.js b/public/vendor/jose/jws/compact/sign.js new file mode 100644 index 0000000000000000000000000000000000000000..2069b6d2c0acaab288239023e7937316ba4cdcb2 --- /dev/null +++ b/public/vendor/jose/jws/compact/sign.js @@ -0,0 +1,18 @@ +import { FlattenedSign } from '../flattened/sign.js'; +export class CompactSign { + #flattened; + constructor(payload) { + this.#flattened = new FlattenedSign(payload); + } + setProtectedHeader(protectedHeader) { + this.#flattened.setProtectedHeader(protectedHeader); + return this; + } + async sign(key, options) { + const jws = await this.#flattened.sign(key, options); + if (jws.payload === undefined) { + throw new TypeError('use the flattened module for creating JWS with b64: false'); + } + return `${jws.protected}.${jws.payload}.${jws.signature}`; + } +} diff --git a/public/vendor/jose/jws/compact/verify.js b/public/vendor/jose/jws/compact/verify.js new file mode 100644 index 0000000000000000000000000000000000000000..c651ffb944cdd83a85d5858008b15f3616dccb19 --- /dev/null +++ b/public/vendor/jose/jws/compact/verify.js @@ -0,0 +1,21 @@ +import { flattenedVerify } from '../flattened/verify.js'; +import { JWSInvalid } from '../../util/errors.js'; +import { decoder } from '../../lib/buffer_utils.js'; +export async function compactVerify(jws, key, options) { + if (jws instanceof Uint8Array) { + jws = decoder.decode(jws); + } + if (typeof jws !== 'string') { + throw new JWSInvalid('Compact JWS must be a string or Uint8Array'); + } + const { 0: protectedHeader, 1: payload, 2: signature, length } = jws.split('.'); + if (length !== 3) { + throw new JWSInvalid('Invalid Compact JWS'); + } + const verified = await flattenedVerify({ payload, protected: protectedHeader, signature }, key, options); + const result = { payload: verified.payload, protectedHeader: verified.protectedHeader }; + if (typeof key === 'function') { + return { ...result, key: verified.key }; + } + return result; +} diff --git a/public/vendor/jose/jws/flattened/sign.js b/public/vendor/jose/jws/flattened/sign.js new file mode 100644 index 0000000000000000000000000000000000000000..e9d4a7dd5758c2620e986472413451293e064ff4 --- /dev/null +++ b/public/vendor/jose/jws/flattened/sign.js @@ -0,0 +1,92 @@ +import { encode as b64u } from '../../util/base64url.js'; +import { sign } from '../../lib/sign.js'; +import { isDisjoint } from '../../lib/is_disjoint.js'; +import { JWSInvalid } from '../../util/errors.js'; +import { concat, encode } from '../../lib/buffer_utils.js'; +import { checkKeyType } from '../../lib/check_key_type.js'; +import { validateCrit } from '../../lib/validate_crit.js'; +import { normalizeKey } from '../../lib/normalize_key.js'; +export class FlattenedSign { + #payload; + #protectedHeader; + #unprotectedHeader; + constructor(payload) { + if (!(payload instanceof Uint8Array)) { + throw new TypeError('payload must be an instance of Uint8Array'); + } + this.#payload = payload; + } + setProtectedHeader(protectedHeader) { + if (this.#protectedHeader) { + throw new TypeError('setProtectedHeader can only be called once'); + } + this.#protectedHeader = protectedHeader; + return this; + } + setUnprotectedHeader(unprotectedHeader) { + if (this.#unprotectedHeader) { + throw new TypeError('setUnprotectedHeader can only be called once'); + } + this.#unprotectedHeader = unprotectedHeader; + return this; + } + async sign(key, options) { + if (!this.#protectedHeader && !this.#unprotectedHeader) { + throw new JWSInvalid('either setProtectedHeader or setUnprotectedHeader must be called before #sign()'); + } + if (!isDisjoint(this.#protectedHeader, this.#unprotectedHeader)) { + throw new JWSInvalid('JWS Protected and JWS Unprotected Header Parameter names must be disjoint'); + } + const joseHeader = { + ...this.#protectedHeader, + ...this.#unprotectedHeader, + }; + const extensions = validateCrit(JWSInvalid, new Map([['b64', true]]), options?.crit, this.#protectedHeader, joseHeader); + let b64 = true; + if (extensions.has('b64')) { + b64 = this.#protectedHeader.b64; + if (typeof b64 !== 'boolean') { + throw new JWSInvalid('The "b64" (base64url-encode payload) Header Parameter must be a boolean'); + } + } + const { alg } = joseHeader; + if (typeof alg !== 'string' || !alg) { + throw new JWSInvalid('JWS "alg" (Algorithm) Header Parameter missing or invalid'); + } + checkKeyType(alg, key, 'sign'); + let payloadS; + let payloadB; + if (b64) { + payloadS = b64u(this.#payload); + payloadB = encode(payloadS); + } + else { + payloadB = this.#payload; + payloadS = ''; + } + let protectedHeaderString; + let protectedHeaderBytes; + if (this.#protectedHeader) { + protectedHeaderString = b64u(JSON.stringify(this.#protectedHeader)); + protectedHeaderBytes = encode(protectedHeaderString); + } + else { + protectedHeaderString = ''; + protectedHeaderBytes = new Uint8Array(); + } + const data = concat(protectedHeaderBytes, encode('.'), payloadB); + const k = await normalizeKey(key, alg); + const signature = await sign(alg, k, data); + const jws = { + signature: b64u(signature), + payload: payloadS, + }; + if (this.#unprotectedHeader) { + jws.header = this.#unprotectedHeader; + } + if (this.#protectedHeader) { + jws.protected = protectedHeaderString; + } + return jws; + } +} diff --git a/public/vendor/jose/jws/flattened/verify.js b/public/vendor/jose/jws/flattened/verify.js new file mode 100644 index 0000000000000000000000000000000000000000..3e749121e009b7b6596b7b9f37195724f43fb069 --- /dev/null +++ b/public/vendor/jose/jws/flattened/verify.js @@ -0,0 +1,120 @@ +import { decode as b64u } from '../../util/base64url.js'; +import { verify } from '../../lib/verify.js'; +import { JOSEAlgNotAllowed, JWSInvalid, JWSSignatureVerificationFailed } from '../../util/errors.js'; +import { concat, encoder, decoder, encode } from '../../lib/buffer_utils.js'; +import { isDisjoint } from '../../lib/is_disjoint.js'; +import { isObject } from '../../lib/is_object.js'; +import { checkKeyType } from '../../lib/check_key_type.js'; +import { validateCrit } from '../../lib/validate_crit.js'; +import { validateAlgorithms } from '../../lib/validate_algorithms.js'; +import { normalizeKey } from '../../lib/normalize_key.js'; +export async function flattenedVerify(jws, key, options) { + if (!isObject(jws)) { + throw new JWSInvalid('Flattened JWS must be an object'); + } + if (jws.protected === undefined && jws.header === undefined) { + throw new JWSInvalid('Flattened JWS must have either of the "protected" or "header" members'); + } + if (jws.protected !== undefined && typeof jws.protected !== 'string') { + throw new JWSInvalid('JWS Protected Header incorrect type'); + } + if (jws.payload === undefined) { + throw new JWSInvalid('JWS Payload missing'); + } + if (typeof jws.signature !== 'string') { + throw new JWSInvalid('JWS Signature missing or incorrect type'); + } + if (jws.header !== undefined && !isObject(jws.header)) { + throw new JWSInvalid('JWS Unprotected Header incorrect type'); + } + let parsedProt = {}; + if (jws.protected) { + try { + const protectedHeader = b64u(jws.protected); + parsedProt = JSON.parse(decoder.decode(protectedHeader)); + } + catch { + throw new JWSInvalid('JWS Protected Header is invalid'); + } + } + if (!isDisjoint(parsedProt, jws.header)) { + throw new JWSInvalid('JWS Protected and JWS Unprotected Header Parameter names must be disjoint'); + } + const joseHeader = { + ...parsedProt, + ...jws.header, + }; + const extensions = validateCrit(JWSInvalid, new Map([['b64', true]]), options?.crit, parsedProt, joseHeader); + let b64 = true; + if (extensions.has('b64')) { + b64 = parsedProt.b64; + if (typeof b64 !== 'boolean') { + throw new JWSInvalid('The "b64" (base64url-encode payload) Header Parameter must be a boolean'); + } + } + const { alg } = joseHeader; + if (typeof alg !== 'string' || !alg) { + throw new JWSInvalid('JWS "alg" (Algorithm) Header Parameter missing or invalid'); + } + const algorithms = options && validateAlgorithms('algorithms', options.algorithms); + if (algorithms && !algorithms.has(alg)) { + throw new JOSEAlgNotAllowed('"alg" (Algorithm) Header Parameter value not allowed'); + } + if (b64) { + if (typeof jws.payload !== 'string') { + throw new JWSInvalid('JWS Payload must be a string'); + } + } + else if (typeof jws.payload !== 'string' && !(jws.payload instanceof Uint8Array)) { + throw new JWSInvalid('JWS Payload must be a string or an Uint8Array instance'); + } + let resolvedKey = false; + if (typeof key === 'function') { + key = await key(parsedProt, jws); + resolvedKey = true; + } + checkKeyType(alg, key, 'verify'); + const data = concat(jws.protected !== undefined ? encode(jws.protected) : new Uint8Array(), encode('.'), typeof jws.payload === 'string' + ? b64 + ? encode(jws.payload) + : encoder.encode(jws.payload) + : jws.payload); + let signature; + try { + signature = b64u(jws.signature); + } + catch { + throw new JWSInvalid('Failed to base64url decode the signature'); + } + const k = await normalizeKey(key, alg); + const verified = await verify(alg, k, signature, data); + if (!verified) { + throw new JWSSignatureVerificationFailed(); + } + let payload; + if (b64) { + try { + payload = b64u(jws.payload); + } + catch { + throw new JWSInvalid('Failed to base64url decode the payload'); + } + } + else if (typeof jws.payload === 'string') { + payload = encoder.encode(jws.payload); + } + else { + payload = jws.payload; + } + const result = { payload }; + if (jws.protected !== undefined) { + result.protectedHeader = parsedProt; + } + if (jws.header !== undefined) { + result.unprotectedHeader = jws.header; + } + if (resolvedKey) { + return { ...result, key: k }; + } + return result; +} diff --git a/public/vendor/jose/jws/general/sign.js b/public/vendor/jose/jws/general/sign.js new file mode 100644 index 0000000000000000000000000000000000000000..d85de18efdb1736351ad71bdbf45bc2f610d5905 --- /dev/null +++ b/public/vendor/jose/jws/general/sign.js @@ -0,0 +1,73 @@ +import { FlattenedSign } from '../flattened/sign.js'; +import { JWSInvalid } from '../../util/errors.js'; +class IndividualSignature { + #parent; + protectedHeader; + unprotectedHeader; + options; + key; + constructor(sig, key, options) { + this.#parent = sig; + this.key = key; + this.options = options; + } + setProtectedHeader(protectedHeader) { + if (this.protectedHeader) { + throw new TypeError('setProtectedHeader can only be called once'); + } + this.protectedHeader = protectedHeader; + return this; + } + setUnprotectedHeader(unprotectedHeader) { + if (this.unprotectedHeader) { + throw new TypeError('setUnprotectedHeader can only be called once'); + } + this.unprotectedHeader = unprotectedHeader; + return this; + } + addSignature(...args) { + return this.#parent.addSignature(...args); + } + sign(...args) { + return this.#parent.sign(...args); + } + done() { + return this.#parent; + } +} +export class GeneralSign { + #payload; + #signatures = []; + constructor(payload) { + this.#payload = payload; + } + addSignature(key, options) { + const signature = new IndividualSignature(this, key, options); + this.#signatures.push(signature); + return signature; + } + async sign() { + if (!this.#signatures.length) { + throw new JWSInvalid('at least one signature must be added'); + } + const jws = { + signatures: [], + payload: '', + }; + for (let i = 0; i < this.#signatures.length; i++) { + const signature = this.#signatures[i]; + const flattened = new FlattenedSign(this.#payload); + flattened.setProtectedHeader(signature.protectedHeader); + flattened.setUnprotectedHeader(signature.unprotectedHeader); + const { payload, ...rest } = await flattened.sign(signature.key, signature.options); + if (i === 0) { + jws.payload = payload; + } + else if (jws.payload !== payload) { + throw new JWSInvalid('inconsistent use of JWS Unencoded Payload (RFC7797)'); + } + jws.signatures.push(rest); + } + return jws; + } +} diff --git a/public/vendor/jose/jws/general/verify.js b/public/vendor/jose/jws/general/verify.js new file mode 100644 index 0000000000000000000000000000000000000000..cb95d385ea946f58c037142c9b89e9022f6063aa --- /dev/null +++ b/public/vendor/jose/jws/general/verify.js @@ -0,0 +1,24 @@ +import { flattenedVerify } from '../flattened/verify.js'; +import { JWSInvalid, JWSSignatureVerificationFailed } from '../../util/errors.js'; +import { isObject } from '../../lib/is_object.js'; +export async function generalVerify(jws, key, options) { + if (!isObject(jws)) { + throw new JWSInvalid('General JWS must be an object'); + } + if (!Array.isArray(jws.signatures) || !jws.signatures.every(isObject)) { + throw new JWSInvalid('JWS Signatures missing or incorrect type'); + } + for (const signature of jws.signatures) { + try { + return await flattenedVerify({ + header: signature.header, + payload: jws.payload, + protected: signature.protected, + signature: signature.signature, + }, key, options); + } + catch { + } + } + throw new JWSSignatureVerificationFailed(); +} diff --git a/public/vendor/jose/jwt/decrypt.js b/public/vendor/jose/jwt/decrypt.js new file mode 100644 index 0000000000000000000000000000000000000000..d75e3d725eecd664199bc5a188aba8485cf0f5ce --- /dev/null +++ b/public/vendor/jose/jwt/decrypt.js @@ -0,0 +1,23 @@ +import { compactDecrypt } from '../jwe/compact/decrypt.js'; +import { validateClaimsSet } from '../lib/jwt_claims_set.js'; +import { JWTClaimValidationFailed } from '../util/errors.js'; +export async function jwtDecrypt(jwt, key, options) { + const decrypted = await compactDecrypt(jwt, key, options); + const payload = validateClaimsSet(decrypted.protectedHeader, decrypted.plaintext, options); + const { protectedHeader } = decrypted; + if (protectedHeader.iss !== undefined && protectedHeader.iss !== payload.iss) { + throw new JWTClaimValidationFailed('replicated "iss" claim header parameter mismatch', payload, 'iss', 'mismatch'); + } + if (protectedHeader.sub !== undefined && protectedHeader.sub !== payload.sub) { + throw new JWTClaimValidationFailed('replicated "sub" claim header parameter mismatch', payload, 'sub', 'mismatch'); + } + if (protectedHeader.aud !== undefined && + JSON.stringify(protectedHeader.aud) !== JSON.stringify(payload.aud)) { + throw new JWTClaimValidationFailed('replicated "aud" claim header parameter mismatch', payload, 'aud', 'mismatch'); + } + const result = { payload, protectedHeader }; + if (typeof key === 'function') { + return { ...result, key: decrypted.key }; + } + return result; +} diff --git a/public/vendor/jose/jwt/encrypt.js b/public/vendor/jose/jwt/encrypt.js new file mode 100644 index 0000000000000000000000000000000000000000..44282a8839dd0eda16c05f27cf96e4b9c4c4fe9d --- /dev/null +++ b/public/vendor/jose/jwt/encrypt.js @@ -0,0 +1,108 @@ +import { CompactEncrypt } from '../jwe/compact/encrypt.js'; +import { JWTClaimsBuilder } from '../lib/jwt_claims_set.js'; +export class EncryptJWT { + #cek; + #iv; + #keyManagementParameters; + #protectedHeader; + #replicateIssuerAsHeader; + #replicateSubjectAsHeader; + #replicateAudienceAsHeader; + #jwt; + constructor(payload = {}) { + this.#jwt = new JWTClaimsBuilder(payload); + } + setIssuer(issuer) { + this.#jwt.iss = issuer; + return this; + } + setSubject(subject) { + this.#jwt.sub = subject; + return this; + } + setAudience(audience) { + this.#jwt.aud = audience; + return this; + } + setJti(jwtId) { + this.#jwt.jti = jwtId; + return this; + } + setNotBefore(input) { + this.#jwt.nbf = input; + return this; + } + setExpirationTime(input) { + this.#jwt.exp = input; + return this; + } + setIssuedAt(input) { + this.#jwt.iat = input; + return this; + } + setProtectedHeader(protectedHeader) { + if (this.#protectedHeader) { + throw new TypeError('setProtectedHeader can only be called once'); + } + this.#protectedHeader = protectedHeader; + return this; + } + setKeyManagementParameters(parameters) { + if (this.#keyManagementParameters) { + throw new TypeError('setKeyManagementParameters can only be called once'); + } + this.#keyManagementParameters = parameters; + return this; + } + setContentEncryptionKey(cek) { + if (this.#cek) { + throw new TypeError('setContentEncryptionKey can only be called once'); + } + this.#cek = cek; + return this; + } + setInitializationVector(iv) { + if (this.#iv) { + throw new TypeError('setInitializationVector can only be called once'); + } + this.#iv = iv; + return this; + } + replicateIssuerAsHeader() { + this.#replicateIssuerAsHeader = true; + return this; + } + replicateSubjectAsHeader() { + this.#replicateSubjectAsHeader = true; + return this; + } + replicateAudienceAsHeader() { + this.#replicateAudienceAsHeader = true; + return this; + } + async encrypt(key, options) { + const enc = new CompactEncrypt(this.#jwt.data()); + if (this.#protectedHeader && + (this.#replicateIssuerAsHeader || + this.#replicateSubjectAsHeader || + this.#replicateAudienceAsHeader)) { + this.#protectedHeader = { + ...this.#protectedHeader, + iss: this.#replicateIssuerAsHeader ? this.#jwt.iss : undefined, + sub: this.#replicateSubjectAsHeader ? this.#jwt.sub : undefined, + aud: this.#replicateAudienceAsHeader ? this.#jwt.aud : undefined, + }; + } + enc.setProtectedHeader(this.#protectedHeader); + if (this.#iv) { + enc.setInitializationVector(this.#iv); + } + if (this.#cek) { + enc.setContentEncryptionKey(this.#cek); + } + if (this.#keyManagementParameters) { + enc.setKeyManagementParameters(this.#keyManagementParameters); + } + return enc.encrypt(key, options); + } +} diff --git a/public/vendor/jose/jwt/sign.js b/public/vendor/jose/jwt/sign.js new file mode 100644 index 0000000000000000000000000000000000000000..34b96c37f7c0434de8c041c879208b2c9f4e8533 --- /dev/null +++ b/public/vendor/jose/jwt/sign.js @@ -0,0 +1,52 @@ +import { CompactSign } from '../jws/compact/sign.js'; +import { JWTInvalid } from '../util/errors.js'; +import { JWTClaimsBuilder } from '../lib/jwt_claims_set.js'; +export class SignJWT { + #protectedHeader; + #jwt; + constructor(payload = {}) { + this.#jwt = new JWTClaimsBuilder(payload); + } + setIssuer(issuer) { + this.#jwt.iss = issuer; + return this; + } + setSubject(subject) { + this.#jwt.sub = subject; + return this; + } + setAudience(audience) { + this.#jwt.aud = audience; + return this; + } + setJti(jwtId) { + this.#jwt.jti = jwtId; + return this; + } + setNotBefore(input) { + this.#jwt.nbf = input; + return this; + } + setExpirationTime(input) { + this.#jwt.exp = input; + return this; + } + setIssuedAt(input) { + this.#jwt.iat = input; + return this; + } + setProtectedHeader(protectedHeader) { + this.#protectedHeader = protectedHeader; + return this; + } + async sign(key, options) { + const sig = new CompactSign(this.#jwt.data()); + sig.setProtectedHeader(this.#protectedHeader); + if (Array.isArray(this.#protectedHeader?.crit) && + this.#protectedHeader.crit.includes('b64') && + this.#protectedHeader.b64 === false) { + throw new JWTInvalid('JWTs MUST NOT use unencoded payload'); + } + return sig.sign(key, options); + } +} diff --git a/public/vendor/jose/jwt/unsecured.js b/public/vendor/jose/jwt/unsecured.js new file mode 100644 index 0000000000000000000000000000000000000000..18a20c83e6889d6a36ab4ed071e788eff387153f --- /dev/null +++ b/public/vendor/jose/jwt/unsecured.js @@ -0,0 +1,63 @@ +import * as b64u from '../util/base64url.js'; +import { decoder } from '../lib/buffer_utils.js'; +import { JWTInvalid } from '../util/errors.js'; +import { validateClaimsSet, JWTClaimsBuilder } from '../lib/jwt_claims_set.js'; +export class UnsecuredJWT { + #jwt; + constructor(payload = {}) { + this.#jwt = new JWTClaimsBuilder(payload); + } + encode() { + const header = b64u.encode(JSON.stringify({ alg: 'none' })); + const payload = b64u.encode(this.#jwt.data()); + return `${header}.${payload}.`; + } + setIssuer(issuer) { + this.#jwt.iss = issuer; + return this; + } + setSubject(subject) { + this.#jwt.sub = subject; + return this; + } + setAudience(audience) { + this.#jwt.aud = audience; + return this; + } + setJti(jwtId) { + this.#jwt.jti = jwtId; + return this; + } + setNotBefore(input) { + this.#jwt.nbf = input; + return this; + } + setExpirationTime(input) { + this.#jwt.exp = input; + return this; + } + setIssuedAt(input) { + this.#jwt.iat = input; + return this; + } + static decode(jwt, options) { + if (typeof jwt !== 'string') { + throw new JWTInvalid('Unsecured JWT must be a string'); + } + const { 0: encodedHeader, 1: encodedPayload, 2: signature, length } = jwt.split('.'); + if (length !== 3 || signature !== '') { + throw new JWTInvalid('Invalid Unsecured JWT'); + } + let header; + try { + header = JSON.parse(decoder.decode(b64u.decode(encodedHeader))); + if (header.alg !== 'none') + throw new Error(); + } + catch { + throw new JWTInvalid('Invalid Unsecured JWT'); + } + const payload = validateClaimsSet(header, b64u.decode(encodedPayload), options); + return { payload, header }; + } +} diff --git a/public/vendor/jose/jwt/verify.js b/public/vendor/jose/jwt/verify.js new file mode 100644 index 0000000000000000000000000000000000000000..5e4f91559844506b9dc30cad1ce22be9ebf16f94 --- /dev/null +++ b/public/vendor/jose/jwt/verify.js @@ -0,0 +1,15 @@ +import { compactVerify } from '../jws/compact/verify.js'; +import { validateClaimsSet } from '../lib/jwt_claims_set.js'; +import { JWTInvalid } from '../util/errors.js'; +export async function jwtVerify(jwt, key, options) { + const verified = await compactVerify(jwt, key, options); + if (verified.protectedHeader.crit?.includes('b64') && verified.protectedHeader.b64 === false) { + throw new JWTInvalid('JWTs MUST NOT use unencoded payload'); + } + const payload = validateClaimsSet(verified.protectedHeader, verified.payload, options); + const result = { payload, protectedHeader: verified.protectedHeader }; + if (typeof key === 'function') { + return { ...result, key: verified.key }; + } + return result; +} diff --git a/public/vendor/jose/key/export.js b/public/vendor/jose/key/export.js new file mode 100644 index 0000000000000000000000000000000000000000..1d81adb1ed0ed5ed4176e98ad548488181ca1fbd --- /dev/null +++ b/public/vendor/jose/key/export.js @@ -0,0 +1,11 @@ +import { toSPKI as exportPublic, toPKCS8 as exportPrivate } from '../lib/asn1.js'; +import { keyToJWK } from '../lib/key_to_jwk.js'; +export async function exportSPKI(key) { + return exportPublic(key); +} +export async function exportPKCS8(key) { + return exportPrivate(key); +} +export async function exportJWK(key) { + return keyToJWK(key); +} diff --git a/public/vendor/jose/key/generate_key_pair.js b/public/vendor/jose/key/generate_key_pair.js new file mode 100644 index 0000000000000000000000000000000000000000..33d9f5eb52608f0247aae3585ccbba79bea7ecd5 --- /dev/null +++ b/public/vendor/jose/key/generate_key_pair.js @@ -0,0 +1,97 @@ +import { JOSENotSupported } from '../util/errors.js'; +function getModulusLengthOption(options) { + const modulusLength = options?.modulusLength ?? 2048; + if (typeof modulusLength !== 'number' || modulusLength < 2048) { + throw new JOSENotSupported('Invalid or unsupported modulusLength option provided, 2048 bits or larger keys must be used'); + } + return modulusLength; +} +export async function generateKeyPair(alg, options) { + let algorithm; + let keyUsages; + switch (alg) { + case 'PS256': + case 'PS384': + case 'PS512': + algorithm = { + name: 'RSA-PSS', + hash: `SHA-${alg.slice(-3)}`, + publicExponent: Uint8Array.of(0x01, 0x00, 0x01), + modulusLength: getModulusLengthOption(options), + }; + keyUsages = ['sign', 'verify']; + break; + case 'RS256': + case 'RS384': + case 'RS512': + algorithm = { + name: 'RSASSA-PKCS1-v1_5', + hash: `SHA-${alg.slice(-3)}`, + publicExponent: Uint8Array.of(0x01, 0x00, 0x01), + modulusLength: getModulusLengthOption(options), + }; + keyUsages = ['sign', 'verify']; + break; + case 'RSA-OAEP': + case 'RSA-OAEP-256': + case 'RSA-OAEP-384': + case 'RSA-OAEP-512': + algorithm = { + name: 'RSA-OAEP', + hash: `SHA-${parseInt(alg.slice(-3), 10) || 1}`, + publicExponent: Uint8Array.of(0x01, 0x00, 0x01), + modulusLength: getModulusLengthOption(options), + }; + keyUsages = ['decrypt', 'unwrapKey', 'encrypt', 'wrapKey']; + break; + case 'ES256': + algorithm = { name: 'ECDSA', namedCurve: 'P-256' }; + keyUsages = ['sign', 'verify']; + break; + case 'ES384': + algorithm = { name: 'ECDSA', namedCurve: 'P-384' }; + keyUsages = ['sign', 'verify']; + break; + case 'ES512': + algorithm = { name: 'ECDSA', namedCurve: 'P-521' }; + keyUsages = ['sign', 'verify']; + break; + case 'Ed25519': + case 'EdDSA': { + keyUsages = ['sign', 'verify']; + algorithm = { name: 'Ed25519' }; + break; + } + case 'ML-DSA-44': + case 'ML-DSA-65': + case 'ML-DSA-87': { + keyUsages = ['sign', 'verify']; + algorithm = { name: alg }; + break; + } + case 'ECDH-ES': + case 'ECDH-ES+A128KW': + case 'ECDH-ES+A192KW': + case 'ECDH-ES+A256KW': { + keyUsages = ['deriveBits']; + const crv = options?.crv ?? 'P-256'; + switch (crv) { + case 'P-256': + case 'P-384': + case 'P-521': { + algorithm = { name: 'ECDH', namedCurve: crv }; + break; + } + case 'X25519': + algorithm = { name: 'X25519' }; + break; + default: + throw new JOSENotSupported('Invalid or unsupported crv option provided, supported values are P-256, P-384, P-521, and X25519'); + } + break; + } + default: + throw new JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value'); + } + return crypto.subtle.generateKey(algorithm, options?.extractable ?? false, keyUsages); +} diff --git a/public/vendor/jose/key/generate_secret.js b/public/vendor/jose/key/generate_secret.js new file mode 100644 index 0000000000000000000000000000000000000000..0fe2a12b131c7790d4231358f5b347e865f9af59 --- /dev/null +++ b/public/vendor/jose/key/generate_secret.js @@ -0,0 +1,40 @@ +import { JOSENotSupported } from '../util/errors.js'; +export async function generateSecret(alg, options) { + let length; + let algorithm; + let keyUsages; + switch (alg) { + case 'HS256': + case 'HS384': + case 'HS512': + length = parseInt(alg.slice(-3), 10); + algorithm = { name: 'HMAC', hash: `SHA-${length}`, length }; + keyUsages = ['sign', 'verify']; + break; + case 'A128CBC-HS256': + case 'A192CBC-HS384': + case 'A256CBC-HS512': + length = parseInt(alg.slice(-3), 10); + return crypto.getRandomValues(new Uint8Array(length >> 3)); + case 'A128KW': + case 'A192KW': + case 'A256KW': + length = parseInt(alg.slice(1, 4), 10); + algorithm = { name: 'AES-KW', length }; + keyUsages = ['wrapKey', 'unwrapKey']; + break; + case 'A128GCMKW': + case 'A192GCMKW': + case 'A256GCMKW': + case 'A128GCM': + case 'A192GCM': + case 'A256GCM': + length = parseInt(alg.slice(1, 4), 10); + algorithm = { name: 'AES-GCM', length }; + keyUsages = ['encrypt', 'decrypt']; + break; + default: + throw new JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value'); + } + return crypto.subtle.generateKey(algorithm, options?.extractable ?? false, keyUsages); +} diff --git a/public/vendor/jose/key/import.js b/public/vendor/jose/key/import.js new file mode 100644 index 0000000000000000000000000000000000000000..16ba0ce2ee76da5d55ce035e62b4bbec950fe7d1 --- /dev/null +++ b/public/vendor/jose/key/import.js @@ -0,0 +1,57 @@ +import { decode as decodeBase64URL } from '../util/base64url.js'; +import { fromSPKI, fromPKCS8, fromX509 } from '../lib/asn1.js'; +import { jwkToKey } from '../lib/jwk_to_key.js'; +import { JOSENotSupported } from '../util/errors.js'; +import { isObject } from '../lib/is_object.js'; +export async function importSPKI(spki, alg, options) { + if (typeof spki !== 'string' || spki.indexOf('-----BEGIN PUBLIC KEY-----') !== 0) { + throw new TypeError('"spki" must be SPKI formatted string'); + } + return fromSPKI(spki, alg, options); +} +export async function importX509(x509, alg, options) { + if (typeof x509 !== 'string' || x509.indexOf('-----BEGIN CERTIFICATE-----') !== 0) { + throw new TypeError('"x509" must be X.509 formatted string'); + } + return fromX509(x509, alg, options); +} +export async function importPKCS8(pkcs8, alg, options) { + if (typeof pkcs8 !== 'string' || pkcs8.indexOf('-----BEGIN PRIVATE KEY-----') !== 0) { + throw new TypeError('"pkcs8" must be PKCS#8 formatted string'); + } + return fromPKCS8(pkcs8, alg, options); +} +export async function importJWK(jwk, alg, options) { + if (!isObject(jwk)) { + throw new TypeError('JWK must be an object'); + } + let ext; + alg ??= jwk.alg; + ext ??= options?.extractable ?? jwk.ext; + switch (jwk.kty) { + case 'oct': + if (typeof jwk.k !== 'string' || !jwk.k) { + throw new TypeError('missing "k" (Key Value) Parameter value'); + } + return decodeBase64URL(jwk.k); + case 'RSA': + if ('oth' in jwk && jwk.oth !== undefined) { + throw new JOSENotSupported('RSA JWK "oth" (Other Primes Info) Parameter value is not supported'); + } + return jwkToKey({ ...jwk, alg, ext }); + case 'AKP': { + if (typeof jwk.alg !== 'string' || !jwk.alg) { + throw new TypeError('missing "alg" (Algorithm) Parameter value'); + } + if (alg !== undefined && alg !== jwk.alg) { + throw new TypeError('JWK alg and alg option value mismatch'); + } + return jwkToKey({ ...jwk, ext }); + } + case 'EC': + case 'OKP': + return jwkToKey({ ...jwk, alg, ext }); + default: + throw new JOSENotSupported('Unsupported "kty" (Key Type) Parameter value'); + } +} diff --git a/public/vendor/jose/lib/aesgcmkw.js b/public/vendor/jose/lib/aesgcmkw.js new file mode 100644 index 0000000000000000000000000000000000000000..924f4c5cc23626dc0f30977d27d76de9b4e1144b --- /dev/null +++ b/public/vendor/jose/lib/aesgcmkw.js @@ -0,0 +1,16 @@ +import { encrypt } from './encrypt.js'; +import { decrypt } from './decrypt.js'; +import { encode as b64u } from '../util/base64url.js'; +export async function wrap(alg, key, cek, iv) { + const jweAlgorithm = alg.slice(0, 7); + const wrapped = await encrypt(jweAlgorithm, cek, key, iv, new Uint8Array()); + return { + encryptedKey: wrapped.ciphertext, + iv: b64u(wrapped.iv), + tag: b64u(wrapped.tag), + }; +} +export async function unwrap(alg, key, encryptedKey, iv, tag) { + const jweAlgorithm = alg.slice(0, 7); + return decrypt(jweAlgorithm, key, encryptedKey, iv, tag, new Uint8Array()); +} diff --git a/public/vendor/jose/lib/aeskw.js b/public/vendor/jose/lib/aeskw.js new file mode 100644 index 0000000000000000000000000000000000000000..666b69cae96856673042a24314dea1a0458f65aa --- /dev/null +++ b/public/vendor/jose/lib/aeskw.js @@ -0,0 +1,25 @@ +import { checkEncCryptoKey } from './crypto_key.js'; +function checkKeySize(key, alg) { + if (key.algorithm.length !== parseInt(alg.slice(1, 4), 10)) { + throw new TypeError(`Invalid key size for alg: ${alg}`); + } +} +function getCryptoKey(key, alg, usage) { + if (key instanceof Uint8Array) { + return crypto.subtle.importKey('raw', key, 'AES-KW', true, [usage]); + } + checkEncCryptoKey(key, alg, usage); + return key; +} +export async function wrap(alg, key, cek) { + const cryptoKey = await getCryptoKey(key, alg, 'wrapKey'); + checkKeySize(cryptoKey, alg); + const cryptoKeyCek = await crypto.subtle.importKey('raw', cek, { hash: 'SHA-256', name: 'HMAC' }, true, ['sign']); + return new Uint8Array(await crypto.subtle.wrapKey('raw', cryptoKeyCek, cryptoKey, 'AES-KW')); +} +export async function unwrap(alg, key, encryptedKey) { + const cryptoKey = await getCryptoKey(key, alg, 'unwrapKey'); + checkKeySize(cryptoKey, alg); + const cryptoKeyCek = await crypto.subtle.unwrapKey('raw', encryptedKey, cryptoKey, 'AES-KW', { hash: 'SHA-256', name: 'HMAC' }, true, ['sign']); + return new Uint8Array(await crypto.subtle.exportKey('raw', cryptoKeyCek)); +} diff --git a/public/vendor/jose/lib/asn1.js b/public/vendor/jose/lib/asn1.js new file mode 100644 index 0000000000000000000000000000000000000000..e9cd57015034516b554a5ea3d96959c8c9336652 --- /dev/null +++ b/public/vendor/jose/lib/asn1.js @@ -0,0 +1,243 @@ +import { invalidKeyInput } from './invalid_key_input.js'; +import { encodeBase64, decodeBase64 } from '../lib/base64.js'; +import { JOSENotSupported } from '../util/errors.js'; +import { isCryptoKey, isKeyObject } from './is_key_like.js'; +const formatPEM = (b64, descriptor) => { + const newlined = (b64.match(/.{1,64}/g) || []).join('\n'); + return `-----BEGIN ${descriptor}-----\n${newlined}\n-----END ${descriptor}-----`; +}; +const genericExport = async (keyType, keyFormat, key) => { + if (isKeyObject(key)) { + if (key.type !== keyType) { + throw new TypeError(`key is not a ${keyType} key`); + } + return key.export({ format: 'pem', type: keyFormat }); + } + if (!isCryptoKey(key)) { + throw new TypeError(invalidKeyInput(key, 'CryptoKey', 'KeyObject')); + } + if (!key.extractable) { + throw new TypeError('CryptoKey is not extractable'); + } + if (key.type !== keyType) { + throw new TypeError(`key is not a ${keyType} key`); + } + return formatPEM(encodeBase64(new Uint8Array(await crypto.subtle.exportKey(keyFormat, key))), `${keyType.toUpperCase()} KEY`); +}; +export const toSPKI = (key) => genericExport('public', 'spki', key); +export const toPKCS8 = (key) => genericExport('private', 'pkcs8', key); +const bytesEqual = (a, b) => { + if (a.byteLength !== b.length) + return false; + for (let i = 0; i < a.byteLength; i++) { + if (a[i] !== b[i]) + return false; + } + return true; +}; +const createASN1State = (data) => ({ data, pos: 0 }); +const parseLength = (state) => { + const first = state.data[state.pos++]; + if (first & 0x80) { + const lengthOfLen = first & 0x7f; + let length = 0; + for (let i = 0; i < lengthOfLen; i++) { + length = (length << 8) | state.data[state.pos++]; + } + return length; + } + return first; +}; +const skipElement = (state, count = 1) => { + if (count <= 0) + return; + state.pos++; + const length = parseLength(state); + state.pos += length; + if (count > 1) { + skipElement(state, count - 1); + } +}; +const expectTag = (state, expectedTag, errorMessage) => { + if (state.data[state.pos++] !== expectedTag) { + throw new Error(errorMessage); + } +}; +const getSubarray = (state, length) => { + const result = state.data.subarray(state.pos, state.pos + length); + state.pos += length; + return result; +}; +const parseAlgorithmOID = (state) => { + expectTag(state, 0x06, 'Expected algorithm OID'); + const oidLen = parseLength(state); + return getSubarray(state, oidLen); +}; +function parsePKCS8Header(state) { + expectTag(state, 0x30, 'Invalid PKCS#8 structure'); + parseLength(state); + expectTag(state, 0x02, 'Expected version field'); + const verLen = parseLength(state); + state.pos += verLen; + expectTag(state, 0x30, 'Expected algorithm identifier'); + const algIdLen = parseLength(state); + const algIdStart = state.pos; + return { algIdStart, algIdLength: algIdLen }; +} +function parseSPKIHeader(state) { + expectTag(state, 0x30, 'Invalid SPKI structure'); + parseLength(state); + expectTag(state, 0x30, 'Expected algorithm identifier'); + const algIdLen = parseLength(state); + const algIdStart = state.pos; + return { algIdStart, algIdLength: algIdLen }; +} +const parseECAlgorithmIdentifier = (state) => { + const algOid = parseAlgorithmOID(state); + if (bytesEqual(algOid, [0x2b, 0x65, 0x6e])) { + return 'X25519'; + } + if (!bytesEqual(algOid, [0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01])) { + throw new Error('Unsupported key algorithm'); + } + expectTag(state, 0x06, 'Expected curve OID'); + const curveOidLen = parseLength(state); + const curveOid = getSubarray(state, curveOidLen); + for (const { name, oid } of [ + { name: 'P-256', oid: [0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07] }, + { name: 'P-384', oid: [0x2b, 0x81, 0x04, 0x00, 0x22] }, + { name: 'P-521', oid: [0x2b, 0x81, 0x04, 0x00, 0x23] }, + ]) { + if (bytesEqual(curveOid, oid)) { + return name; + } + } + throw new Error('Unsupported named curve'); +}; +const genericImport = async (keyFormat, keyData, alg, options) => { + let algorithm; + let keyUsages; + const isPublic = keyFormat === 'spki'; + const getSigUsages = () => (isPublic ? ['verify'] : ['sign']); + const getEncUsages = () => isPublic ? ['encrypt', 'wrapKey'] : ['decrypt', 'unwrapKey']; + switch (alg) { + case 'PS256': + case 'PS384': + case 'PS512': + algorithm = { name: 'RSA-PSS', hash: `SHA-${alg.slice(-3)}` }; + keyUsages = getSigUsages(); + break; + case 'RS256': + case 'RS384': + case 'RS512': + algorithm = { name: 'RSASSA-PKCS1-v1_5', hash: `SHA-${alg.slice(-3)}` }; + keyUsages = getSigUsages(); + break; + case 'RSA-OAEP': + case 'RSA-OAEP-256': + case 'RSA-OAEP-384': + case 'RSA-OAEP-512': + algorithm = { + name: 'RSA-OAEP', + hash: `SHA-${parseInt(alg.slice(-3), 10) || 1}`, + }; + keyUsages = getEncUsages(); + break; + case 'ES256': + case 'ES384': + case 'ES512': { + const curveMap = { ES256: 'P-256', ES384: 'P-384', ES512: 'P-521' }; + algorithm = { name: 'ECDSA', namedCurve: curveMap[alg] }; + keyUsages = getSigUsages(); + break; + } + case 'ECDH-ES': + case 'ECDH-ES+A128KW': + case 'ECDH-ES+A192KW': + case 'ECDH-ES+A256KW': { + try { + const namedCurve = options.getNamedCurve(keyData); + algorithm = namedCurve === 'X25519' ? { name: 'X25519' } : { name: 'ECDH', namedCurve }; + } + catch (cause) { + throw new JOSENotSupported('Invalid or unsupported key format'); + } + keyUsages = isPublic ? [] : ['deriveBits']; + break; + } + case 'Ed25519': + case 'EdDSA': + algorithm = { name: 'Ed25519' }; + keyUsages = getSigUsages(); + break; + case 'ML-DSA-44': + case 'ML-DSA-65': + case 'ML-DSA-87': + algorithm = { name: alg }; + keyUsages = getSigUsages(); + break; + default: + throw new JOSENotSupported('Invalid or unsupported "alg" (Algorithm) value'); + } + return crypto.subtle.importKey(keyFormat, keyData, algorithm, options?.extractable ?? (isPublic ? true : false), keyUsages); +}; +const processPEMData = (pem, pattern) => { + return decodeBase64(pem.replace(pattern, '')); +}; +export const fromPKCS8 = (pem, alg, options) => { + const keyData = processPEMData(pem, /(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g); + let opts = options; + if (alg?.startsWith?.('ECDH-ES')) { + opts ||= {}; + opts.getNamedCurve = (keyData) => { + const state = createASN1State(keyData); + parsePKCS8Header(state); + return parseECAlgorithmIdentifier(state); + }; + } + return genericImport('pkcs8', keyData, alg, opts); +}; +export const fromSPKI = (pem, alg, options) => { + const keyData = processPEMData(pem, /(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g); + let opts = options; + if (alg?.startsWith?.('ECDH-ES')) { + opts ||= {}; + opts.getNamedCurve = (keyData) => { + const state = createASN1State(keyData); + parseSPKIHeader(state); + return parseECAlgorithmIdentifier(state); + }; + } + return genericImport('spki', keyData, alg, opts); +}; +function spkiFromX509(buf) { + const state = createASN1State(buf); + expectTag(state, 0x30, 'Invalid certificate structure'); + parseLength(state); + expectTag(state, 0x30, 'Invalid tbsCertificate structure'); + parseLength(state); + if (buf[state.pos] === 0xa0) { + skipElement(state, 6); + } + else { + skipElement(state, 5); + } + const spkiStart = state.pos; + expectTag(state, 0x30, 'Invalid SPKI structure'); + const spkiContentLen = parseLength(state); + return buf.subarray(spkiStart, spkiStart + spkiContentLen + (state.pos - spkiStart)); +} +function extractX509SPKI(x509) { + const derBytes = processPEMData(x509, /(?:-----(?:BEGIN|END) CERTIFICATE-----|\s)/g); + return spkiFromX509(derBytes); +} +export const fromX509 = (pem, alg, options) => { + let spki; + try { + spki = extractX509SPKI(pem); + } + catch (cause) { + throw new TypeError('Failed to parse the X.509 certificate', { cause }); + } + return fromSPKI(formatPEM(encodeBase64(spki), 'PUBLIC KEY'), alg, options); +}; diff --git a/public/vendor/jose/lib/base64.js b/public/vendor/jose/lib/base64.js new file mode 100644 index 0000000000000000000000000000000000000000..0ac97a703b384c8c3edd7c28706e3eeec1c31d34 --- /dev/null +++ b/public/vendor/jose/lib/base64.js @@ -0,0 +1,22 @@ +export function encodeBase64(input) { + if (Uint8Array.prototype.toBase64) { + return input.toBase64(); + } + const CHUNK_SIZE = 0x8000; + const arr = []; + for (let i = 0; i < input.length; i += CHUNK_SIZE) { + arr.push(String.fromCharCode.apply(null, input.subarray(i, i + CHUNK_SIZE))); + } + return btoa(arr.join('')); +} +export function decodeBase64(encoded) { + if (Uint8Array.fromBase64) { + return Uint8Array.fromBase64(encoded); + } + const binary = atob(encoded); + const bytes = new Uint8Array(binary.length); + for (let i = 0; i < binary.length; i++) { + bytes[i] = binary.charCodeAt(i); + } + return bytes; +} diff --git a/public/vendor/jose/lib/buffer_utils.js b/public/vendor/jose/lib/buffer_utils.js new file mode 100644 index 0000000000000000000000000000000000000000..64fb377fbe17b786f03d01654d26f46d046a4ee5 --- /dev/null +++ b/public/vendor/jose/lib/buffer_utils.js @@ -0,0 +1,43 @@ +export const encoder = new TextEncoder(); +export const decoder = new TextDecoder(); +const MAX_INT32 = 2 ** 32; +export function concat(...buffers) { + const size = buffers.reduce((acc, { length }) => acc + length, 0); + const buf = new Uint8Array(size); + let i = 0; + for (const buffer of buffers) { + buf.set(buffer, i); + i += buffer.length; + } + return buf; +} +function writeUInt32BE(buf, value, offset) { + if (value < 0 || value >= MAX_INT32) { + throw new RangeError(`value must be >= 0 and <= ${MAX_INT32 - 1}. Received ${value}`); + } + buf.set([value >>> 24, value >>> 16, value >>> 8, value & 0xff], offset); +} +export function uint64be(value) { + const high = Math.floor(value / MAX_INT32); + const low = value % MAX_INT32; + const buf = new Uint8Array(8); + writeUInt32BE(buf, high, 0); + writeUInt32BE(buf, low, 4); + return buf; +} +export function uint32be(value) { + const buf = new Uint8Array(4); + writeUInt32BE(buf, value); + return buf; +} +export function encode(string) { + const bytes = new Uint8Array(string.length); + for (let i = 0; i < string.length; i++) { + const code = string.charCodeAt(i); + if (code > 127) { + throw new TypeError('non-ASCII string encountered in encode()'); + } + bytes[i] = code; + } + return bytes; +} diff --git a/public/vendor/jose/lib/cek.js b/public/vendor/jose/lib/cek.js new file mode 100644 index 0000000000000000000000000000000000000000..d10d2cbd668b0497280d8d63fd05a30b92000e50 --- /dev/null +++ b/public/vendor/jose/lib/cek.js @@ -0,0 +1,19 @@ +import { JOSENotSupported } from '../util/errors.js'; +export function cekLength(alg) { + switch (alg) { + case 'A128GCM': + return 128; + case 'A192GCM': + return 192; + case 'A256GCM': + case 'A128CBC-HS256': + return 256; + case 'A192CBC-HS384': + return 384; + case 'A256CBC-HS512': + return 512; + default: + throw new JOSENotSupported(`Unsupported JWE Algorithm: ${alg}`); + } +} +export const generateCek = (alg) => crypto.getRandomValues(new Uint8Array(cekLength(alg) >> 3)); diff --git a/public/vendor/jose/lib/check_cek_length.js b/public/vendor/jose/lib/check_cek_length.js new file mode 100644 index 0000000000000000000000000000000000000000..8baaa1d4a2c95516a07a8c81f93b5849de1aef62 --- /dev/null +++ b/public/vendor/jose/lib/check_cek_length.js @@ -0,0 +1,7 @@ +import { JWEInvalid } from '../util/errors.js'; +export function checkCekLength(cek, expected) { + const actual = cek.byteLength << 3; + if (actual !== expected) { + throw new JWEInvalid(`Invalid Content Encryption Key length. Expected ${expected} bits, got ${actual} bits`); + } +} diff --git a/public/vendor/jose/lib/check_iv_length.js b/public/vendor/jose/lib/check_iv_length.js new file mode 100644 index 0000000000000000000000000000000000000000..17718b11ffb3496351c477485097b65061adc8c4 --- /dev/null +++ b/public/vendor/jose/lib/check_iv_length.js @@ -0,0 +1,7 @@ +import { JWEInvalid } from '../util/errors.js'; +import { bitLength } from './iv.js'; +export function checkIvLength(enc, iv) { + if (iv.length << 3 !== bitLength(enc)) { + throw new JWEInvalid('Invalid Initialization Vector length'); + } +} diff --git a/public/vendor/jose/lib/check_key_length.js b/public/vendor/jose/lib/check_key_length.js new file mode 100644 index 0000000000000000000000000000000000000000..8a02c979f94bd609d8ca405dffd3b9bacb58aa8d --- /dev/null +++ b/public/vendor/jose/lib/check_key_length.js @@ -0,0 +1,8 @@ +export function checkKeyLength(alg, key) { + if (alg.startsWith('RS') || alg.startsWith('PS')) { + const { modulusLength } = key.algorithm; + if (typeof modulusLength !== 'number' || modulusLength < 2048) { + throw new TypeError(`${alg} requires key modulusLength to be 2048 bits or larger`); + } + } +} diff --git a/public/vendor/jose/lib/check_key_type.js b/public/vendor/jose/lib/check_key_type.js new file mode 100644 index 0000000000000000000000000000000000000000..7d22a992f1e7366f7b224ea0503c583b8699bd2a --- /dev/null +++ b/public/vendor/jose/lib/check_key_type.js @@ -0,0 +1,122 @@ +import { withAlg as invalidKeyInput } from './invalid_key_input.js'; +import { isKeyLike } from './is_key_like.js'; +import * as jwk from './is_jwk.js'; +const tag = (key) => key?.[Symbol.toStringTag]; +const jwkMatchesOp = (alg, key, usage) => { + if (key.use !== undefined) { + let expected; + switch (usage) { + case 'sign': + case 'verify': + expected = 'sig'; + break; + case 'encrypt': + case 'decrypt': + expected = 'enc'; + break; + } + if (key.use !== expected) { + throw new TypeError(`Invalid key for this operation, its "use" must be "${expected}" when present`); + } + } + if (key.alg !== undefined && key.alg !== alg) { + throw new TypeError(`Invalid key for this operation, its "alg" must be "${alg}" when present`); + } + if (Array.isArray(key.key_ops)) { + let expectedKeyOp; + switch (true) { + case usage === 'sign' || usage === 'verify': + case alg === 'dir': + case alg.includes('CBC-HS'): + expectedKeyOp = usage; + break; + case alg.startsWith('PBES2'): + expectedKeyOp = 'deriveBits'; + break; + case /^A\d{3}(?:GCM)?(?:KW)?$/.test(alg): + if (!alg.includes('GCM') && alg.endsWith('KW')) { + expectedKeyOp = usage === 'encrypt' ? 'wrapKey' : 'unwrapKey'; + } + else { + expectedKeyOp = usage; + } + break; + case usage === 'encrypt' && alg.startsWith('RSA'): + expectedKeyOp = 'wrapKey'; + break; + case usage === 'decrypt': + expectedKeyOp = alg.startsWith('RSA') ? 'unwrapKey' : 'deriveBits'; + break; + } + if (expectedKeyOp && key.key_ops?.includes?.(expectedKeyOp) === false) { + throw new TypeError(`Invalid key for this operation, its "key_ops" must include "${expectedKeyOp}" when present`); + } + } + return true; +}; +const symmetricTypeCheck = (alg, key, usage) => { + if (key instanceof Uint8Array) + return; + if (jwk.isJWK(key)) { + if (jwk.isSecretJWK(key) && jwkMatchesOp(alg, key, usage)) + return; + throw new TypeError(`JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present`); + } + if (!isKeyLike(key)) { + throw new TypeError(invalidKeyInput(alg, key, 'CryptoKey', 'KeyObject', 'JSON Web Key', 'Uint8Array')); + } + if (key.type !== 'secret') { + throw new TypeError(`${tag(key)} instances for symmetric algorithms must be of type "secret"`); + } +}; +const asymmetricTypeCheck = (alg, key, usage) => { + if (jwk.isJWK(key)) { + switch (usage) { + case 'decrypt': + case 'sign': + if (jwk.isPrivateJWK(key) && jwkMatchesOp(alg, key, usage)) + return; + throw new TypeError(`JSON Web Key for this operation must be a private JWK`); + case 'encrypt': + case 'verify': + if (jwk.isPublicJWK(key) && jwkMatchesOp(alg, key, usage)) + return; + throw new TypeError(`JSON Web Key for this operation must be a public JWK`); + } + } + if (!isKeyLike(key)) { + throw new TypeError(invalidKeyInput(alg, key, 'CryptoKey', 'KeyObject', 'JSON Web Key')); + } + if (key.type === 'secret') { + throw new TypeError(`${tag(key)} instances for asymmetric algorithms must not be of type "secret"`); + } + if (key.type === 'public') { + switch (usage) { + case 'sign': + throw new TypeError(`${tag(key)} instances for asymmetric algorithm signing must be of type "private"`); + case 'decrypt': + throw new TypeError(`${tag(key)} instances for asymmetric algorithm decryption must be of type "private"`); + } + } + if (key.type === 'private') { + switch (usage) { + case 'verify': + throw new TypeError(`${tag(key)} instances for asymmetric algorithm verifying must be of type "public"`); + case 'encrypt': + throw new TypeError(`${tag(key)} instances for asymmetric algorithm encryption must be of type "public"`); + } + } +}; +export function checkKeyType(alg, key, usage) { + switch (alg.substring(0, 2)) { + case 'A1': + case 'A2': + case 'di': + case 'HS': + case 'PB': + symmetricTypeCheck(alg, key, usage); + break; + default: + asymmetricTypeCheck(alg, key, usage); + } +} diff --git a/public/vendor/jose/lib/crypto_key.js b/public/vendor/jose/lib/crypto_key.js new file mode 100644 index 0000000000000000000000000000000000000000..8154148abe7158d960d201b6870b142cf27e8aba --- /dev/null +++ b/public/vendor/jose/lib/crypto_key.js @@ -0,0 +1,143 @@ +const unusable = (name, prop = 'algorithm.name') => new TypeError(`CryptoKey does not support this operation, its ${prop} must be ${name}`); +const isAlgorithm = (algorithm, name) => algorithm.name === name; +function getHashLength(hash) { + return parseInt(hash.name.slice(4), 10); +} +function getNamedCurve(alg) { + switch (alg) { + case 'ES256': + return 'P-256'; + case 'ES384': + return 'P-384'; + case 'ES512': + return 'P-521'; + default: + throw new Error('unreachable'); + } +} +function checkUsage(key, usage) { + if (usage && !key.usages.includes(usage)) { + throw new TypeError(`CryptoKey does not support this operation, its usages must include ${usage}.`); + } +} +export function checkSigCryptoKey(key, alg, usage) { + switch (alg) { + case 'HS256': + case 'HS384': + case 'HS512': { + if (!isAlgorithm(key.algorithm, 'HMAC')) + throw unusable('HMAC'); + const expected = parseInt(alg.slice(2), 10); + const actual = getHashLength(key.algorithm.hash); + if (actual !== expected) + throw unusable(`SHA-${expected}`, 'algorithm.hash'); + break; + } + case 'RS256': + case 'RS384': + case 'RS512': { + if (!isAlgorithm(key.algorithm, 'RSASSA-PKCS1-v1_5')) + throw unusable('RSASSA-PKCS1-v1_5'); + const expected = parseInt(alg.slice(2), 10); + const actual = getHashLength(key.algorithm.hash); + if (actual !== expected) + throw unusable(`SHA-${expected}`, 'algorithm.hash'); + break; + } + case 'PS256': + case 'PS384': + case 'PS512': { + if (!isAlgorithm(key.algorithm, 'RSA-PSS')) + throw unusable('RSA-PSS'); + const expected = parseInt(alg.slice(2), 10); + const actual = getHashLength(key.algorithm.hash); + if (actual !== expected) + throw unusable(`SHA-${expected}`, 'algorithm.hash'); + break; + } + case 'Ed25519': + case 'EdDSA': { + if (!isAlgorithm(key.algorithm, 'Ed25519')) + throw unusable('Ed25519'); + break; + } + case 'ML-DSA-44': + case 'ML-DSA-65': + case 'ML-DSA-87': { + if (!isAlgorithm(key.algorithm, alg)) + throw unusable(alg); + break; + } + case 'ES256': + case 'ES384': + case 'ES512': { + if (!isAlgorithm(key.algorithm, 'ECDSA')) + throw unusable('ECDSA'); + const expected = getNamedCurve(alg); + const actual = key.algorithm.namedCurve; + if (actual !== expected) + throw unusable(expected, 'algorithm.namedCurve'); + break; + } + default: + throw new TypeError('CryptoKey does not support this operation'); + } + checkUsage(key, usage); +} +export function checkEncCryptoKey(key, alg, usage) { + switch (alg) { + case 'A128GCM': + case 'A192GCM': + case 'A256GCM': { + if (!isAlgorithm(key.algorithm, 'AES-GCM')) + throw unusable('AES-GCM'); + const expected = parseInt(alg.slice(1, 4), 10); + const actual = key.algorithm.length; + if (actual !== expected) + throw unusable(expected, 'algorithm.length'); + break; + } + case 'A128KW': + case 'A192KW': + case 'A256KW': { + if (!isAlgorithm(key.algorithm, 'AES-KW')) + throw unusable('AES-KW'); + const expected = parseInt(alg.slice(1, 4), 10); + const actual = key.algorithm.length; + if (actual !== expected) + throw unusable(expected, 'algorithm.length'); + break; + } + case 'ECDH': { + switch (key.algorithm.name) { + case 'ECDH': + case 'X25519': + break; + default: + throw unusable('ECDH or X25519'); + } + break; + } + case 'PBES2-HS256+A128KW': + case 'PBES2-HS384+A192KW': + case 'PBES2-HS512+A256KW': + if (!isAlgorithm(key.algorithm, 'PBKDF2')) + throw unusable('PBKDF2'); + break; + case 'RSA-OAEP': + case 'RSA-OAEP-256': + case 'RSA-OAEP-384': + case 'RSA-OAEP-512': { + if (!isAlgorithm(key.algorithm, 'RSA-OAEP')) + throw unusable('RSA-OAEP'); + const expected = parseInt(alg.slice(9), 10) || 1; + const actual = getHashLength(key.algorithm.hash); + if (actual !== expected) + throw unusable(`SHA-${expected}`, 'algorithm.hash'); + break; + } + default: + throw new TypeError('CryptoKey does not support this operation'); + } + checkUsage(key, usage); +} diff --git a/public/vendor/jose/lib/decrypt.js b/public/vendor/jose/lib/decrypt.js new file mode 100644 index 0000000000000000000000000000000000000000..efe1e33c220b40644d59e86e1aa7a246460a96d4 --- /dev/null +++ b/public/vendor/jose/lib/decrypt.js @@ -0,0 +1,106 @@ +import { concat, uint64be } from './buffer_utils.js'; +import { checkIvLength } from './check_iv_length.js'; +import { checkCekLength } from './check_cek_length.js'; +import { JOSENotSupported, JWEDecryptionFailed, JWEInvalid } from '../util/errors.js'; +import { checkEncCryptoKey } from './crypto_key.js'; +import { invalidKeyInput } from './invalid_key_input.js'; +import { isCryptoKey } from './is_key_like.js'; +async function timingSafeEqual(a, b) { + if (!(a instanceof Uint8Array)) { + throw new TypeError('First argument must be a buffer'); + } + if (!(b instanceof Uint8Array)) { + throw new TypeError('Second argument must be a buffer'); + } + const algorithm = { name: 'HMAC', hash: 'SHA-256' }; + const key = (await crypto.subtle.generateKey(algorithm, false, ['sign'])); + const aHmac = new Uint8Array(await crypto.subtle.sign(algorithm, key, a)); + const bHmac = new Uint8Array(await crypto.subtle.sign(algorithm, key, b)); + let out = 0; + let i = -1; + while (++i < 32) { + out |= aHmac[i] ^ bHmac[i]; + } + return out === 0; +} +async function cbcDecrypt(enc, cek, ciphertext, iv, tag, aad) { + if (!(cek instanceof Uint8Array)) { + throw new TypeError(invalidKeyInput(cek, 'Uint8Array')); + } + const keySize = parseInt(enc.slice(1, 4), 10); + const encKey = await crypto.subtle.importKey('raw', cek.subarray(keySize >> 3), 'AES-CBC', false, ['decrypt']); + const macKey = await crypto.subtle.importKey('raw', cek.subarray(0, keySize >> 3), { + hash: `SHA-${keySize << 1}`, + name: 'HMAC', + }, false, ['sign']); + const macData = concat(aad, iv, ciphertext, uint64be(aad.length << 3)); + const expectedTag = new Uint8Array((await crypto.subtle.sign('HMAC', macKey, macData)).slice(0, keySize >> 3)); + let macCheckPassed; + try { + macCheckPassed = await timingSafeEqual(tag, expectedTag); + } + catch { + } + if (!macCheckPassed) { + throw new JWEDecryptionFailed(); + } + let plaintext; + try { + plaintext = new Uint8Array(await crypto.subtle.decrypt({ iv: iv, name: 'AES-CBC' }, encKey, ciphertext)); + } + catch { + } + if (!plaintext) { + throw new JWEDecryptionFailed(); + } + return plaintext; +} +async function gcmDecrypt(enc, cek, ciphertext, iv, tag, aad) { + let encKey; + if (cek instanceof Uint8Array) { + encKey = await crypto.subtle.importKey('raw', cek, 'AES-GCM', false, ['decrypt']); + } + else { + checkEncCryptoKey(cek, enc, 'decrypt'); + encKey = cek; + } + try { + return new Uint8Array(await crypto.subtle.decrypt({ + additionalData: aad, + iv: iv, + name: 'AES-GCM', + tagLength: 128, + }, encKey, concat(ciphertext, tag))); + } + catch { + throw new JWEDecryptionFailed(); + } +} +export async function decrypt(enc, cek, ciphertext, iv, tag, aad) { + if (!isCryptoKey(cek) && !(cek instanceof Uint8Array)) { + throw new TypeError(invalidKeyInput(cek, 'CryptoKey', 'KeyObject', 'Uint8Array', 'JSON Web Key')); + } + if (!iv) { + throw new JWEInvalid('JWE Initialization Vector missing'); + } + if (!tag) { + throw new JWEInvalid('JWE Authentication Tag missing'); + } + checkIvLength(enc, iv); + switch (enc) { + case 'A128CBC-HS256': + case 'A192CBC-HS384': + case 'A256CBC-HS512': + if (cek instanceof Uint8Array) + checkCekLength(cek, parseInt(enc.slice(-3), 10)); + return cbcDecrypt(enc, cek, ciphertext, iv, tag, aad); + case 'A128GCM': + case 'A192GCM': + case 'A256GCM': + if (cek instanceof Uint8Array) + checkCekLength(cek, parseInt(enc.slice(1, 4), 10)); + return gcmDecrypt(enc, cek, ciphertext, iv, tag, aad); + default: + throw new JOSENotSupported('Unsupported JWE Content Encryption Algorithm'); + } +} diff --git a/public/vendor/jose/lib/decrypt_key_management.js b/public/vendor/jose/lib/decrypt_key_management.js new file mode 100644 index 0000000000000000000000000000000000000000..1abfc0f0be95299fcdd4c3a62fb5236b94394ab5 --- /dev/null +++ b/public/vendor/jose/lib/decrypt_key_management.js @@ -0,0 +1,127 @@ +import * as aeskw from './aeskw.js'; +import * as ecdhes from './ecdhes.js'; +import * as pbes2kw from './pbes2kw.js'; +import * as rsaes from './rsaes.js'; +import { decode as b64u } from '../util/base64url.js'; +import { JOSENotSupported, JWEInvalid } from '../util/errors.js'; +import { cekLength } from '../lib/cek.js'; +import { importJWK } from '../key/import.js'; +import { isObject } from './is_object.js'; +import { unwrap as aesGcmKw } from './aesgcmkw.js'; +import { assertCryptoKey } from './is_key_like.js'; +export async function decryptKeyManagement(alg, key, encryptedKey, joseHeader, options) { + switch (alg) { + case 'dir': { + if (encryptedKey !== undefined) + throw new JWEInvalid('Encountered unexpected JWE Encrypted Key'); + return key; + } + case 'ECDH-ES': + if (encryptedKey !== undefined) + throw new JWEInvalid('Encountered unexpected JWE Encrypted Key'); + case 'ECDH-ES+A128KW': + case 'ECDH-ES+A192KW': + case 'ECDH-ES+A256KW': { + if (!isObject(joseHeader.epk)) + throw new JWEInvalid(`JOSE Header "epk" (Ephemeral Public Key) missing or invalid`); + assertCryptoKey(key); + if (!ecdhes.allowed(key)) + throw new JOSENotSupported('ECDH with the provided key is not allowed or not supported by your javascript runtime'); + const epk = await importJWK(joseHeader.epk, alg); + assertCryptoKey(epk); + let partyUInfo; + let partyVInfo; + if (joseHeader.apu !== undefined) { + if (typeof joseHeader.apu !== 'string') + throw new JWEInvalid(`JOSE Header "apu" (Agreement PartyUInfo) invalid`); + try { + partyUInfo = b64u(joseHeader.apu); + } + catch { + throw new JWEInvalid('Failed to base64url decode the apu'); + } + } + if (joseHeader.apv !== undefined) { + if (typeof joseHeader.apv !== 'string') + throw new JWEInvalid(`JOSE Header "apv" (Agreement PartyVInfo) invalid`); + try { + partyVInfo = b64u(joseHeader.apv); + } + catch { + throw new JWEInvalid('Failed to base64url decode the apv'); + } + } + const sharedSecret = await ecdhes.deriveKey(epk, key, alg === 'ECDH-ES' ? joseHeader.enc : alg, alg === 'ECDH-ES' ? cekLength(joseHeader.enc) : parseInt(alg.slice(-5, -2), 10), partyUInfo, partyVInfo); + if (alg === 'ECDH-ES') + return sharedSecret; + if (encryptedKey === undefined) + throw new JWEInvalid('JWE Encrypted Key missing'); + return aeskw.unwrap(alg.slice(-6), sharedSecret, encryptedKey); + } + case 'RSA-OAEP': + case 'RSA-OAEP-256': + case 'RSA-OAEP-384': + case 'RSA-OAEP-512': { + if (encryptedKey === undefined) + throw new JWEInvalid('JWE Encrypted Key missing'); + assertCryptoKey(key); + return rsaes.decrypt(alg, key, encryptedKey); + } + case 'PBES2-HS256+A128KW': + case 'PBES2-HS384+A192KW': + case 'PBES2-HS512+A256KW': { + if (encryptedKey === undefined) + throw new JWEInvalid('JWE Encrypted Key missing'); + if (typeof joseHeader.p2c !== 'number') + throw new JWEInvalid(`JOSE Header "p2c" (PBES2 Count) missing or invalid`); + const p2cLimit = options?.maxPBES2Count || 10_000; + if (joseHeader.p2c > p2cLimit) + throw new JWEInvalid(`JOSE Header "p2c" (PBES2 Count) out is of acceptable bounds`); + if (typeof joseHeader.p2s !== 'string') + throw new JWEInvalid(`JOSE Header "p2s" (PBES2 Salt) missing or invalid`); + let p2s; + try { + p2s = b64u(joseHeader.p2s); + } + catch { + throw new JWEInvalid('Failed to base64url decode the p2s'); + } + return pbes2kw.unwrap(alg, key, encryptedKey, joseHeader.p2c, p2s); + } + case 'A128KW': + case 'A192KW': + case 'A256KW': { + if (encryptedKey === undefined) + throw new JWEInvalid('JWE Encrypted Key missing'); + return aeskw.unwrap(alg, key, encryptedKey); + } + case 'A128GCMKW': + case 'A192GCMKW': + case 'A256GCMKW': { + if (encryptedKey === undefined) + throw new JWEInvalid('JWE Encrypted Key missing'); + if (typeof joseHeader.iv !== 'string') + throw new JWEInvalid(`JOSE Header "iv" (Initialization Vector) missing or invalid`); + if (typeof joseHeader.tag !== 'string') + throw new JWEInvalid(`JOSE Header "tag" (Authentication Tag) missing or invalid`); + let iv; + try { + iv = b64u(joseHeader.iv); + } + catch { + throw new JWEInvalid('Failed to base64url decode the iv'); + } + let tag; + try { + tag = b64u(joseHeader.tag); + } + catch { + throw new JWEInvalid('Failed to base64url decode the tag'); + } + return aesGcmKw(alg, key, encryptedKey, iv, tag); + } + default: { + throw new JOSENotSupported('Invalid or unsupported "alg" (JWE Algorithm) header value'); + } + } +} diff --git a/public/vendor/jose/lib/digest.js b/public/vendor/jose/lib/digest.js new file mode 100644 index 0000000000000000000000000000000000000000..697ffe98d0d12e750e9d99c5cc9085cb92ee4430 --- /dev/null +++ b/public/vendor/jose/lib/digest.js @@ -0,0 +1,4 @@ +export async function digest(algorithm, data) { + const subtleDigest = `SHA-${algorithm.slice(-3)}`; + return new Uint8Array(await crypto.subtle.digest(subtleDigest, data)); +} diff --git a/public/vendor/jose/lib/ecdhes.js b/public/vendor/jose/lib/ecdhes.js new file mode 100644 index 0000000000000000000000000000000000000000..4bd950f164c71eab33f6e9c1227ae4b1add663d1 --- /dev/null +++ b/public/vendor/jose/lib/ecdhes.js @@ -0,0 +1,52 @@ +import { encode, concat, uint32be } from './buffer_utils.js'; +import { checkEncCryptoKey } from './crypto_key.js'; +import { digest } from './digest.js'; +function lengthAndInput(input) { + return concat(uint32be(input.length), input); +} +async function concatKdf(Z, L, OtherInfo) { + const dkLen = L >> 3; + const hashLen = 32; + const reps = Math.ceil(dkLen / hashLen); + const dk = new Uint8Array(reps * hashLen); + for (let i = 1; i <= reps; i++) { + const hashInput = new Uint8Array(4 + Z.length + OtherInfo.length); + hashInput.set(uint32be(i), 0); + hashInput.set(Z, 4); + hashInput.set(OtherInfo, 4 + Z.length); + const hashResult = await digest('sha256', hashInput); + dk.set(hashResult, (i - 1) * hashLen); + } + return dk.slice(0, dkLen); +} +export async function deriveKey(publicKey, privateKey, algorithm, keyLength, apu = new Uint8Array(), apv = new Uint8Array()) { + checkEncCryptoKey(publicKey, 'ECDH'); + checkEncCryptoKey(privateKey, 'ECDH', 'deriveBits'); + const algorithmID = lengthAndInput(encode(algorithm)); + const partyUInfo = lengthAndInput(apu); + const partyVInfo = lengthAndInput(apv); + const suppPubInfo = uint32be(keyLength); + const suppPrivInfo = new Uint8Array(); + const otherInfo = concat(algorithmID, partyUInfo, partyVInfo, suppPubInfo, suppPrivInfo); + const Z = new Uint8Array(await crypto.subtle.deriveBits({ + name: publicKey.algorithm.name, + public: publicKey, + }, privateKey, getEcdhBitLength(publicKey))); + return concatKdf(Z, keyLength, otherInfo); +} +function getEcdhBitLength(publicKey) { + if (publicKey.algorithm.name === 'X25519') { + return 256; + } + return (Math.ceil(parseInt(publicKey.algorithm.namedCurve.slice(-3), 10) / 8) << 3); +} +export function allowed(key) { + switch (key.algorithm.namedCurve) { + case 'P-256': + case 'P-384': + case 'P-521': + return true; + default: + return key.algorithm.name === 'X25519'; + } +} diff --git a/public/vendor/jose/lib/encrypt.js b/public/vendor/jose/lib/encrypt.js new file mode 100644 index 0000000000000000000000000000000000000000..44853a23e45737ccd58da374188de98f6dce7260 --- /dev/null +++ b/public/vendor/jose/lib/encrypt.js @@ -0,0 +1,74 @@ +import { concat, uint64be } from './buffer_utils.js'; +import { checkIvLength } from './check_iv_length.js'; +import { checkCekLength } from './check_cek_length.js'; +import { checkEncCryptoKey } from './crypto_key.js'; +import { invalidKeyInput } from './invalid_key_input.js'; +import { generateIv } from './iv.js'; +import { JOSENotSupported } from '../util/errors.js'; +import { isCryptoKey } from './is_key_like.js'; +async function cbcEncrypt(enc, plaintext, cek, iv, aad) { + if (!(cek instanceof Uint8Array)) { + throw new TypeError(invalidKeyInput(cek, 'Uint8Array')); + } + const keySize = parseInt(enc.slice(1, 4), 10); + const encKey = await crypto.subtle.importKey('raw', cek.subarray(keySize >> 3), 'AES-CBC', false, ['encrypt']); + const macKey = await crypto.subtle.importKey('raw', cek.subarray(0, keySize >> 3), { + hash: `SHA-${keySize << 1}`, + name: 'HMAC', + }, false, ['sign']); + const ciphertext = new Uint8Array(await crypto.subtle.encrypt({ + iv: iv, + name: 'AES-CBC', + }, encKey, plaintext)); + const macData = concat(aad, iv, ciphertext, uint64be(aad.length << 3)); + const tag = new Uint8Array((await crypto.subtle.sign('HMAC', macKey, macData)).slice(0, keySize >> 3)); + return { ciphertext, tag, iv }; +} +async function gcmEncrypt(enc, plaintext, cek, iv, aad) { + let encKey; + if (cek instanceof Uint8Array) { + encKey = await crypto.subtle.importKey('raw', cek, 'AES-GCM', false, ['encrypt']); + } + else { + checkEncCryptoKey(cek, enc, 'encrypt'); + encKey = cek; + } + const encrypted = new Uint8Array(await crypto.subtle.encrypt({ + additionalData: aad, + iv: iv, + name: 'AES-GCM', + tagLength: 128, + }, encKey, plaintext)); + const tag = encrypted.slice(-16); + const ciphertext = encrypted.slice(0, -16); + return { ciphertext, tag, iv }; +} +export async function encrypt(enc, plaintext, cek, iv, aad) { + if (!isCryptoKey(cek) && !(cek instanceof Uint8Array)) { + throw new TypeError(invalidKeyInput(cek, 'CryptoKey', 'KeyObject', 'Uint8Array', 'JSON Web Key')); + } + if (iv) { + checkIvLength(enc, iv); + } + else { + iv = generateIv(enc); + } + switch (enc) { + case 'A128CBC-HS256': + case 'A192CBC-HS384': + case 'A256CBC-HS512': + if (cek instanceof Uint8Array) { + checkCekLength(cek, parseInt(enc.slice(-3), 10)); + } + return cbcEncrypt(enc, plaintext, cek, iv, aad); + case 'A128GCM': + case 'A192GCM': + case 'A256GCM': + if (cek instanceof Uint8Array) { + checkCekLength(cek, parseInt(enc.slice(1, 4), 10)); + } + return gcmEncrypt(enc, plaintext, cek, iv, aad); + default: + throw new JOSENotSupported('Unsupported JWE Content Encryption Algorithm'); + } +} diff --git a/public/vendor/jose/lib/encrypt_key_management.js b/public/vendor/jose/lib/encrypt_key_management.js new file mode 100644 index 0000000000000000000000000000000000000000..da24d0515a0facf895a8d9d0f2a8a83656b71278 --- /dev/null +++ b/public/vendor/jose/lib/encrypt_key_management.js @@ -0,0 +1,92 @@ +import * as aeskw from './aeskw.js'; +import * as ecdhes from './ecdhes.js'; +import * as pbes2kw from './pbes2kw.js'; +import * as rsaes from './rsaes.js'; +import { encode as b64u } from '../util/base64url.js'; +import { normalizeKey } from './normalize_key.js'; +import { generateCek, cekLength } from '../lib/cek.js'; +import { JOSENotSupported } from '../util/errors.js'; +import { exportJWK } from '../key/export.js'; +import { wrap as aesGcmKw } from './aesgcmkw.js'; +import { assertCryptoKey } from './is_key_like.js'; +export async function encryptKeyManagement(alg, enc, key, providedCek, providedParameters = {}) { + let encryptedKey; + let parameters; + let cek; + switch (alg) { + case 'dir': { + cek = key; + break; + } + case 'ECDH-ES': + case 'ECDH-ES+A128KW': + case 'ECDH-ES+A192KW': + case 'ECDH-ES+A256KW': { + assertCryptoKey(key); + if (!ecdhes.allowed(key)) { + throw new JOSENotSupported('ECDH with the provided key is not allowed or not supported by your javascript runtime'); + } + const { apu, apv } = providedParameters; + let ephemeralKey; + if (providedParameters.epk) { + ephemeralKey = (await normalizeKey(providedParameters.epk, alg)); + } + else { + ephemeralKey = (await crypto.subtle.generateKey(key.algorithm, true, ['deriveBits'])).privateKey; + } + const { x, y, crv, kty } = await exportJWK(ephemeralKey); + const sharedSecret = await ecdhes.deriveKey(key, ephemeralKey, alg === 'ECDH-ES' ? enc : alg, alg === 'ECDH-ES' ? cekLength(enc) : parseInt(alg.slice(-5, -2), 10), apu, apv); + parameters = { epk: { x, crv, kty } }; + if (kty === 'EC') + parameters.epk.y = y; + if (apu) + parameters.apu = b64u(apu); + if (apv) + parameters.apv = b64u(apv); + if (alg === 'ECDH-ES') { + cek = sharedSecret; + break; + } + cek = providedCek || generateCek(enc); + const kwAlg = alg.slice(-6); + encryptedKey = await aeskw.wrap(kwAlg, sharedSecret, cek); + break; + } + case 'RSA-OAEP': + case 'RSA-OAEP-256': + case 'RSA-OAEP-384': + case 'RSA-OAEP-512': { + cek = providedCek || generateCek(enc); + assertCryptoKey(key); + encryptedKey = await rsaes.encrypt(alg, key, cek); + break; + } + case 'PBES2-HS256+A128KW': + case 'PBES2-HS384+A192KW': + case 'PBES2-HS512+A256KW': { + cek = providedCek || generateCek(enc); + const { p2c, p2s } = providedParameters; + ({ encryptedKey, ...parameters } = await pbes2kw.wrap(alg, key, cek, p2c, p2s)); + break; + } + case 'A128KW': + case 'A192KW': + case 'A256KW': { + cek = providedCek || generateCek(enc); + encryptedKey = await aeskw.wrap(alg, key, cek); + break; + } + case 'A128GCMKW': + case 'A192GCMKW': + case 'A256GCMKW': { + cek = providedCek || generateCek(enc); + const { iv } = providedParameters; + ({ encryptedKey, ...parameters } = await aesGcmKw(alg, key, cek, iv)); + break; + } + default: { + throw new JOSENotSupported('Invalid or unsupported "alg" (JWE Algorithm) header value'); + } + } + return { cek, encryptedKey, parameters }; +} diff --git a/public/vendor/jose/lib/get_sign_verify_key.js b/public/vendor/jose/lib/get_sign_verify_key.js new file mode 100644 index 0000000000000000000000000000000000000000..46b1c161a51c59555824de82c08be3f42b269a00 --- /dev/null +++ b/public/vendor/jose/lib/get_sign_verify_key.js @@ -0,0 +1,12 @@ +import { checkSigCryptoKey } from './crypto_key.js'; +import { invalidKeyInput } from './invalid_key_input.js'; +export async function getSigKey(alg, key, usage) { + if (key instanceof Uint8Array) { + if (!alg.startsWith('HS')) { + throw new TypeError(invalidKeyInput(key, 'CryptoKey', 'KeyObject', 'JSON Web Key')); + } + return crypto.subtle.importKey('raw', key, { hash: `SHA-${alg.slice(-3)}`, name: 'HMAC' }, false, [usage]); + } + checkSigCryptoKey(key, alg, usage); + return key; +} diff --git a/public/vendor/jose/lib/invalid_key_input.js b/public/vendor/jose/lib/invalid_key_input.js new file mode 100644 index 0000000000000000000000000000000000000000..8bb76d4d34298df6fd26cc5b6d140e37005f0ff1 --- /dev/null +++ b/public/vendor/jose/lib/invalid_key_input.js @@ -0,0 +1,27 @@ +function message(msg, actual, ...types) { + types = types.filter(Boolean); + if (types.length > 2) { + const last = types.pop(); + msg += `one of type ${types.join(', ')}, or ${last}.`; + } + else if (types.length === 2) { + msg += `one of type ${types[0]} or ${types[1]}.`; + } + else { + msg += `of type ${types[0]}.`; + } + if (actual == null) { + msg += ` Received ${actual}`; + } + else if (typeof actual === 'function' && actual.name) { + msg += ` Received function ${actual.name}`; + } + else if (typeof actual === 'object' && actual != null) { + if (actual.constructor?.name) { + msg += ` Received an instance of ${actual.constructor.name}`; + } + } + return msg; +} +export const invalidKeyInput = (actual, ...types) => message('Key must be ', actual, ...types); +export const withAlg = (alg, actual, ...types) => message(`Key for the ${alg} algorithm must be `, actual, ...types); diff --git a/public/vendor/jose/lib/is_disjoint.js b/public/vendor/jose/lib/is_disjoint.js new file mode 100644 index 0000000000000000000000000000000000000000..5230e3b4e08c8033db979aaeddf91b8e92b9cae2 --- /dev/null +++ b/public/vendor/jose/lib/is_disjoint.js @@ -0,0 +1,21 @@ +export function isDisjoint(...headers) { + const sources = headers.filter(Boolean); + if (sources.length === 0 || sources.length === 1) { + return true; + } + let acc; + for (const header of sources) { + const parameters = Object.keys(header); + if (!acc || acc.size === 0) { + acc = new Set(parameters); + continue; + } + for (const parameter of parameters) { + if (acc.has(parameter)) { + return false; + } + acc.add(parameter); + } + } + return true; +} diff --git a/public/vendor/jose/lib/is_jwk.js b/public/vendor/jose/lib/is_jwk.js new file mode 100644 index 0000000000000000000000000000000000000000..017b1dd06dd8ecf78d092a65409acd07394dcfd1 --- /dev/null +++ b/public/vendor/jose/lib/is_jwk.js @@ -0,0 +1,6 @@ +import { isObject } from './is_object.js'; +export const isJWK = (key) => isObject(key) && typeof key.kty === 'string'; +export const isPrivateJWK = (key) => key.kty !== 'oct' && + ((key.kty === 'AKP' && typeof key.priv === 'string') || typeof key.d === 'string'); +export const isPublicJWK = (key) => key.kty !== 'oct' && key.d === undefined && key.priv === undefined; +export const isSecretJWK = (key) => key.kty === 'oct' && typeof key.k === 'string'; diff --git a/public/vendor/jose/lib/is_key_like.js b/public/vendor/jose/lib/is_key_like.js new file mode 100644 index 0000000000000000000000000000000000000000..8b65dc2da42bfc998d89342c0639c6feec06d16a --- /dev/null +++ b/public/vendor/jose/lib/is_key_like.js @@ -0,0 +1,17 @@ +export function assertCryptoKey(key) { + if (!isCryptoKey(key)) { + throw new Error('CryptoKey instance expected'); + } +} +export const isCryptoKey = (key) => { + if (key?.[Symbol.toStringTag] === 'CryptoKey') + return true; + try { + return key instanceof CryptoKey; + } + catch { + return false; + } +}; +export const isKeyObject = (key) => key?.[Symbol.toStringTag] === 'KeyObject'; +export const isKeyLike = (key) => isCryptoKey(key) || isKeyObject(key); diff --git a/public/vendor/jose/lib/is_object.js b/public/vendor/jose/lib/is_object.js new file mode 100644 index 0000000000000000000000000000000000000000..246e61d67bc35938ce9dacd615794b6cfa114e46 --- /dev/null +++ b/public/vendor/jose/lib/is_object.js @@ -0,0 +1,14 @@ +const isObjectLike = (value) => typeof value === 'object' && value !== null; +export function isObject(input) { + if (!isObjectLike(input) || Object.prototype.toString.call(input) !== '[object Object]') { + return false; + } + if (Object.getPrototypeOf(input) === null) { + return true; + } + let proto = input; + while (Object.getPrototypeOf(proto) !== null) { + proto = Object.getPrototypeOf(proto); + } + return Object.getPrototypeOf(input) === proto; +} diff --git a/public/vendor/jose/lib/iv.js b/public/vendor/jose/lib/iv.js new file mode 100644 index 0000000000000000000000000000000000000000..53427298be3008516add412dc3fdf02c6830fb58 --- /dev/null +++ b/public/vendor/jose/lib/iv.js @@ -0,0 +1,19 @@ +import { JOSENotSupported } from '../util/errors.js'; +export function bitLength(alg) { + switch (alg) { + case 'A128GCM': + case 'A128GCMKW': + case 'A192GCM': + case 'A192GCMKW': + case 'A256GCM': + case 'A256GCMKW': + return 96; + case 'A128CBC-HS256': + case 'A192CBC-HS384': + case 'A256CBC-HS512': + return 128; + default: + throw new JOSENotSupported(`Unsupported JWE Algorithm: ${alg}`); + } +} +export const generateIv = (alg) => crypto.getRandomValues(new Uint8Array(bitLength(alg) >> 3)); diff --git a/public/vendor/jose/lib/jwk_to_key.js b/public/vendor/jose/lib/jwk_to_key.js new file mode 100644 index 0000000000000000000000000000000000000000..1210d67107523369a64c5a1609c6aaa86a724281 --- /dev/null +++ b/public/vendor/jose/lib/jwk_to_key.js @@ -0,0 +1,109 @@ +import { JOSENotSupported } from '../util/errors.js'; +function subtleMapping(jwk) { + let algorithm; + let keyUsages; + switch (jwk.kty) { + case 'AKP': { + switch (jwk.alg) { + case 'ML-DSA-44': + case 'ML-DSA-65': + case 'ML-DSA-87': + algorithm = { name: jwk.alg }; + keyUsages = jwk.priv ? ['sign'] : ['verify']; + break; + default: + throw new JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value'); + } + break; + } + case 'RSA': { + switch (jwk.alg) { + case 'PS256': + case 'PS384': + case 'PS512': + algorithm = { name: 'RSA-PSS', hash: `SHA-${jwk.alg.slice(-3)}` }; + keyUsages = jwk.d ? ['sign'] : ['verify']; + break; + case 'RS256': + case 'RS384': + case 'RS512': + algorithm = { name: 'RSASSA-PKCS1-v1_5', hash: `SHA-${jwk.alg.slice(-3)}` }; + keyUsages = jwk.d ? ['sign'] : ['verify']; + break; + case 'RSA-OAEP': + case 'RSA-OAEP-256': + case 'RSA-OAEP-384': + case 'RSA-OAEP-512': + algorithm = { + name: 'RSA-OAEP', + hash: `SHA-${parseInt(jwk.alg.slice(-3), 10) || 1}`, + }; + keyUsages = jwk.d ? ['decrypt', 'unwrapKey'] : ['encrypt', 'wrapKey']; + break; + default: + throw new JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value'); + } + break; + } + case 'EC': { + switch (jwk.alg) { + case 'ES256': + algorithm = { name: 'ECDSA', namedCurve: 'P-256' }; + keyUsages = jwk.d ? ['sign'] : ['verify']; + break; + case 'ES384': + algorithm = { name: 'ECDSA', namedCurve: 'P-384' }; + keyUsages = jwk.d ? ['sign'] : ['verify']; + break; + case 'ES512': + algorithm = { name: 'ECDSA', namedCurve: 'P-521' }; + keyUsages = jwk.d ? ['sign'] : ['verify']; + break; + case 'ECDH-ES': + case 'ECDH-ES+A128KW': + case 'ECDH-ES+A192KW': + case 'ECDH-ES+A256KW': + algorithm = { name: 'ECDH', namedCurve: jwk.crv }; + keyUsages = jwk.d ? ['deriveBits'] : []; + break; + default: + throw new JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value'); + } + break; + } + case 'OKP': { + switch (jwk.alg) { + case 'Ed25519': + case 'EdDSA': + algorithm = { name: 'Ed25519' }; + keyUsages = jwk.d ? ['sign'] : ['verify']; + break; + case 'ECDH-ES': + case 'ECDH-ES+A128KW': + case 'ECDH-ES+A192KW': + case 'ECDH-ES+A256KW': + algorithm = { name: jwk.crv }; + keyUsages = jwk.d ? ['deriveBits'] : []; + break; + default: + throw new JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value'); + } + break; + } + default: + throw new JOSENotSupported('Invalid or unsupported JWK "kty" (Key Type) Parameter value'); + } + return { algorithm, keyUsages }; +} +export async function jwkToKey(jwk) { + if (!jwk.alg) { + throw new TypeError('"alg" argument is required when "jwk.alg" is not present'); + } + const { algorithm, keyUsages } = subtleMapping(jwk); + const keyData = { ...jwk }; + if (keyData.kty !== 'AKP') { + delete keyData.alg; + } + delete keyData.use; + return crypto.subtle.importKey('jwk', keyData, algorithm, jwk.ext ?? (jwk.d || jwk.priv ? false : true), jwk.key_ops ?? keyUsages); +} diff --git a/public/vendor/jose/lib/jwt_claims_set.js b/public/vendor/jose/lib/jwt_claims_set.js new file mode 100644 index 0000000000000000000000000000000000000000..86976a86964eaed4fc6a95df9cb3fdc5f3eaf95a --- /dev/null +++ b/public/vendor/jose/lib/jwt_claims_set.js @@ -0,0 +1,238 @@ +import { JWTClaimValidationFailed, JWTExpired, JWTInvalid } from '../util/errors.js'; +import { encoder, decoder } from './buffer_utils.js'; +import { isObject } from './is_object.js'; +const epoch = (date) => Math.floor(date.getTime() / 1000); +const minute = 60; +const hour = minute * 60; +const day = hour * 24; +const week = day * 7; +const year = day * 365.25; +const REGEX = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i; +export function secs(str) { + const matched = REGEX.exec(str); + if (!matched || (matched[4] && matched[1])) { + throw new TypeError('Invalid time period format'); + } + const value = parseFloat(matched[2]); + const unit = matched[3].toLowerCase(); + let numericDate; + switch (unit) { + case 'sec': + case 'secs': + case 'second': + case 'seconds': + case 's': + numericDate = Math.round(value); + break; + case 'minute': + case 'minutes': + case 'min': + case 'mins': + case 'm': + numericDate = Math.round(value * minute); + break; + case 'hour': + case 'hours': + case 'hr': + case 'hrs': + case 'h': + numericDate = Math.round(value * hour); + break; + case 'day': + case 'days': + case 'd': + numericDate = Math.round(value * day); + break; + case 'week': + case 'weeks': + case 'w': + numericDate = Math.round(value * week); + break; + default: + numericDate = Math.round(value * year); + break; + } + if (matched[1] === '-' || matched[4] === 'ago') { + return -numericDate; + } + return numericDate; +} +function validateInput(label, input) { + if (!Number.isFinite(input)) { + throw new TypeError(`Invalid ${label} input`); + } + return input; +} +const normalizeTyp = (value) => { + if (value.includes('/')) { + return value.toLowerCase(); + } + return `application/${value.toLowerCase()}`; +}; +const checkAudiencePresence = (audPayload, audOption) => { + if (typeof audPayload === 'string') { + return audOption.includes(audPayload); + } + if (Array.isArray(audPayload)) { + return audOption.some(Set.prototype.has.bind(new Set(audPayload))); + } + return false; +}; +export function validateClaimsSet(protectedHeader, encodedPayload, options = {}) { + let payload; + try { + payload = JSON.parse(decoder.decode(encodedPayload)); + } + catch { + } + if (!isObject(payload)) { + throw new JWTInvalid('JWT Claims Set must be a top-level JSON object'); + } + const { typ } = options; + if (typ && + (typeof protectedHeader.typ !== 'string' || + normalizeTyp(protectedHeader.typ) !== normalizeTyp(typ))) { + throw new JWTClaimValidationFailed('unexpected "typ" JWT header value', payload, 'typ', 'check_failed'); + } + const { requiredClaims = [], issuer, subject, audience, maxTokenAge } = options; + const presenceCheck = [...requiredClaims]; + if (maxTokenAge !== undefined) + presenceCheck.push('iat'); + if (audience !== undefined) + presenceCheck.push('aud'); + if (subject !== undefined) + presenceCheck.push('sub'); + if (issuer !== undefined) + presenceCheck.push('iss'); + for (const claim of new Set(presenceCheck.reverse())) { + if (!(claim in payload)) { + throw new JWTClaimValidationFailed(`missing required "${claim}" claim`, payload, claim, 'missing'); + } + } + if (issuer && + !(Array.isArray(issuer) ? issuer : [issuer]).includes(payload.iss)) { + throw new JWTClaimValidationFailed('unexpected "iss" claim value', payload, 'iss', 'check_failed'); + } + if (subject && payload.sub !== subject) { + throw new JWTClaimValidationFailed('unexpected "sub" claim value', payload, 'sub', 'check_failed'); + } + if (audience && + !checkAudiencePresence(payload.aud, typeof audience === 'string' ? [audience] : audience)) { + throw new JWTClaimValidationFailed('unexpected "aud" claim value', payload, 'aud', 'check_failed'); + } + let tolerance; + switch (typeof options.clockTolerance) { + case 'string': + tolerance = secs(options.clockTolerance); + break; + case 'number': + tolerance = options.clockTolerance; + break; + case 'undefined': + tolerance = 0; + break; + default: + throw new TypeError('Invalid clockTolerance option type'); + } + const { currentDate } = options; + const now = epoch(currentDate || new Date()); + if ((payload.iat !== undefined || maxTokenAge) && typeof payload.iat !== 'number') { + throw new JWTClaimValidationFailed('"iat" claim must be a number', payload, 'iat', 'invalid'); + } + if (payload.nbf !== undefined) { + if (typeof payload.nbf !== 'number') { + throw new JWTClaimValidationFailed('"nbf" claim must be a number', payload, 'nbf', 'invalid'); + } + if (payload.nbf > now + tolerance) { + throw new JWTClaimValidationFailed('"nbf" claim timestamp check failed', payload, 'nbf', 'check_failed'); + } + } + if (payload.exp !== undefined) { + if (typeof payload.exp !== 'number') { + throw new JWTClaimValidationFailed('"exp" claim must be a number', payload, 'exp', 'invalid'); + } + if (payload.exp <= now - tolerance) { + throw new JWTExpired('"exp" claim timestamp check failed', payload, 'exp', 'check_failed'); + } + } + if (maxTokenAge) { + const age = now - payload.iat; + const max = typeof maxTokenAge === 'number' ? maxTokenAge : secs(maxTokenAge); + if (age - tolerance > max) { + throw new JWTExpired('"iat" claim timestamp check failed (too far in the past)', payload, 'iat', 'check_failed'); + } + if (age < 0 - tolerance) { + throw new JWTClaimValidationFailed('"iat" claim timestamp check failed (it should be in the past)', payload, 'iat', 'check_failed'); + } + } + return payload; +} +export class JWTClaimsBuilder { + #payload; + constructor(payload) { + if (!isObject(payload)) { + throw new TypeError('JWT Claims Set MUST be an object'); + } + this.#payload = structuredClone(payload); + } + data() { + return encoder.encode(JSON.stringify(this.#payload)); + } + get iss() { + return this.#payload.iss; + } + set iss(value) { + this.#payload.iss = value; + } + get sub() { + return this.#payload.sub; + } + set sub(value) { + this.#payload.sub = value; + } + get aud() { + return this.#payload.aud; + } + set aud(value) { + this.#payload.aud = value; + } + set jti(value) { + this.#payload.jti = value; + } + set nbf(value) { + if (typeof value === 'number') { + this.#payload.nbf = validateInput('setNotBefore', value); + } + else if (value instanceof Date) { + this.#payload.nbf = validateInput('setNotBefore', epoch(value)); + } + else { + this.#payload.nbf = epoch(new Date()) + secs(value); + } + } + set exp(value) { + if (typeof value === 'number') { + this.#payload.exp = validateInput('setExpirationTime', value); + } + else if (value instanceof Date) { + this.#payload.exp = validateInput('setExpirationTime', epoch(value)); + } + else { + this.#payload.exp = epoch(new Date()) + secs(value); + } + } + set iat(value) { + if (value === undefined) { + this.#payload.iat = epoch(new Date()); + } + else if (value instanceof Date) { + this.#payload.iat = validateInput('setIssuedAt', epoch(value)); + } + else if (typeof value === 'string') { + this.#payload.iat = validateInput('setIssuedAt', epoch(new Date()) + secs(value)); + } + else { + this.#payload.iat = validateInput('setIssuedAt', value); + } + } +} diff --git a/public/vendor/jose/lib/key_to_jwk.js b/public/vendor/jose/lib/key_to_jwk.js new file mode 100644 index 0000000000000000000000000000000000000000..a236d25fb118cc945dc25746293b4a7a84c8f514 --- /dev/null +++ b/public/vendor/jose/lib/key_to_jwk.js @@ -0,0 +1,31 @@ +import { invalidKeyInput } from './invalid_key_input.js'; +import { encode as b64u } from '../util/base64url.js'; +import { isCryptoKey, isKeyObject } from './is_key_like.js'; +export async function keyToJWK(key) { + if (isKeyObject(key)) { + if (key.type === 'secret') { + key = key.export(); + } + else { + return key.export({ format: 'jwk' }); + } + } + if (key instanceof Uint8Array) { + return { + kty: 'oct', + k: b64u(key), + }; + } + if (!isCryptoKey(key)) { + throw new TypeError(invalidKeyInput(key, 'CryptoKey', 'KeyObject', 'Uint8Array')); + } + if (!key.extractable) { + throw new TypeError('non-extractable CryptoKey cannot be exported as a JWK'); + } + const { ext, key_ops, alg, use, ...jwk } = await crypto.subtle.exportKey('jwk', key); + if (jwk.kty === 'AKP') { + ; + jwk.alg = alg; + } + return jwk; +} diff --git a/public/vendor/jose/lib/normalize_key.js b/public/vendor/jose/lib/normalize_key.js new file mode 100644 index 0000000000000000000000000000000000000000..fa8b709ef70682e06cc4ed5817430bcb5e97f2f5 --- /dev/null +++ b/public/vendor/jose/lib/normalize_key.js @@ -0,0 +1,176 @@ +import { isJWK } from './is_jwk.js'; +import { decode } from '../util/base64url.js'; +import { jwkToKey } from './jwk_to_key.js'; +import { isCryptoKey, isKeyObject } from './is_key_like.js'; +let cache; +const handleJWK = async (key, jwk, alg, freeze = false) => { + cache ||= new WeakMap(); + let cached = cache.get(key); + if (cached?.[alg]) { + return cached[alg]; + } + const cryptoKey = await jwkToKey({ ...jwk, alg }); + if (freeze) + Object.freeze(key); + if (!cached) { + cache.set(key, { [alg]: cryptoKey }); + } + else { + cached[alg] = cryptoKey; + } + return cryptoKey; +}; +const handleKeyObject = (keyObject, alg) => { + cache ||= new WeakMap(); + let cached = cache.get(keyObject); + if (cached?.[alg]) { + return cached[alg]; + } + const isPublic = keyObject.type === 'public'; + const extractable = isPublic ? true : false; + let cryptoKey; + if (keyObject.asymmetricKeyType === 'x25519') { + switch (alg) { + case 'ECDH-ES': + case 'ECDH-ES+A128KW': + case 'ECDH-ES+A192KW': + case 'ECDH-ES+A256KW': + break; + default: + throw new TypeError('given KeyObject instance cannot be used for this algorithm'); + } + cryptoKey = keyObject.toCryptoKey(keyObject.asymmetricKeyType, extractable, isPublic ? [] : ['deriveBits']); + } + if (keyObject.asymmetricKeyType === 'ed25519') { + if (alg !== 'EdDSA' && alg !== 'Ed25519') { + throw new TypeError('given KeyObject instance cannot be used for this algorithm'); + } + cryptoKey = keyObject.toCryptoKey(keyObject.asymmetricKeyType, extractable, [ + isPublic ? 'verify' : 'sign', + ]); + } + switch (keyObject.asymmetricKeyType) { + case 'ml-dsa-44': + case 'ml-dsa-65': + case 'ml-dsa-87': { + if (alg !== keyObject.asymmetricKeyType.toUpperCase()) { + throw new TypeError('given KeyObject instance cannot be used for this algorithm'); + } + cryptoKey = keyObject.toCryptoKey(keyObject.asymmetricKeyType, extractable, [ + isPublic ? 'verify' : 'sign', + ]); + } + } + if (keyObject.asymmetricKeyType === 'rsa') { + let hash; + switch (alg) { + case 'RSA-OAEP': + hash = 'SHA-1'; + break; + case 'RS256': + case 'PS256': + case 'RSA-OAEP-256': + hash = 'SHA-256'; + break; + case 'RS384': + case 'PS384': + case 'RSA-OAEP-384': + hash = 'SHA-384'; + break; + case 'RS512': + case 'PS512': + case 'RSA-OAEP-512': + hash = 'SHA-512'; + break; + default: + throw new TypeError('given KeyObject instance cannot be used for this algorithm'); + } + if (alg.startsWith('RSA-OAEP')) { + return keyObject.toCryptoKey({ + name: 'RSA-OAEP', + hash, + }, extractable, isPublic ? ['encrypt'] : ['decrypt']); + } + cryptoKey = keyObject.toCryptoKey({ + name: alg.startsWith('PS') ? 'RSA-PSS' : 'RSASSA-PKCS1-v1_5', + hash, + }, extractable, [isPublic ? 'verify' : 'sign']); + } + if (keyObject.asymmetricKeyType === 'ec') { + const nist = new Map([ + ['prime256v1', 'P-256'], + ['secp384r1', 'P-384'], + ['secp521r1', 'P-521'], + ]); + const namedCurve = nist.get(keyObject.asymmetricKeyDetails?.namedCurve); + if (!namedCurve) { + throw new TypeError('given KeyObject instance cannot be used for this algorithm'); + } + if (alg === 'ES256' && namedCurve === 'P-256') { + cryptoKey = keyObject.toCryptoKey({ + name: 'ECDSA', + namedCurve, + }, extractable, [isPublic ? 'verify' : 'sign']); + } + if (alg === 'ES384' && namedCurve === 'P-384') { + cryptoKey = keyObject.toCryptoKey({ + name: 'ECDSA', + namedCurve, + }, extractable, [isPublic ? 'verify' : 'sign']); + } + if (alg === 'ES512' && namedCurve === 'P-521') { + cryptoKey = keyObject.toCryptoKey({ + name: 'ECDSA', + namedCurve, + }, extractable, [isPublic ? 'verify' : 'sign']); + } + if (alg.startsWith('ECDH-ES')) { + cryptoKey = keyObject.toCryptoKey({ + name: 'ECDH', + namedCurve, + }, extractable, isPublic ? [] : ['deriveBits']); + } + } + if (!cryptoKey) { + throw new TypeError('given KeyObject instance cannot be used for this algorithm'); + } + if (!cached) { + cache.set(keyObject, { [alg]: cryptoKey }); + } + else { + cached[alg] = cryptoKey; + } + return cryptoKey; +}; +export async function normalizeKey(key, alg) { + if (key instanceof Uint8Array) { + return key; + } + if (isCryptoKey(key)) { + return key; + } + if (isKeyObject(key)) { + if (key.type === 'secret') { + return key.export(); + } + if ('toCryptoKey' in key && typeof key.toCryptoKey === 'function') { + try { + return handleKeyObject(key, alg); + } + catch (err) { + if (err instanceof TypeError) { + throw err; + } + } + } + let jwk = key.export({ format: 'jwk' }); + return handleJWK(key, jwk, alg); + } + if (isJWK(key)) { + if (key.k) { + return decode(key.k); + } + return handleJWK(key, key, alg, true); + } + throw new Error('unreachable'); +} diff --git a/public/vendor/jose/lib/pbes2kw.js b/public/vendor/jose/lib/pbes2kw.js new file mode 100644 index 0000000000000000000000000000000000000000..2b0c20c0a8169da00f159134deab5d3e4b514adf --- /dev/null +++ b/public/vendor/jose/lib/pbes2kw.js @@ -0,0 +1,39 @@ +import { encode as b64u } from '../util/base64url.js'; +import * as aeskw from './aeskw.js'; +import { checkEncCryptoKey } from './crypto_key.js'; +import { concat, encode } from './buffer_utils.js'; +import { JWEInvalid } from '../util/errors.js'; +function getCryptoKey(key, alg) { + if (key instanceof Uint8Array) { + return crypto.subtle.importKey('raw', key, 'PBKDF2', false, [ + 'deriveBits', + ]); + } + checkEncCryptoKey(key, alg, 'deriveBits'); + return key; +} +const concatSalt = (alg, p2sInput) => concat(encode(alg), Uint8Array.of(0x00), p2sInput); +async function deriveKey(p2s, alg, p2c, key) { + if (!(p2s instanceof Uint8Array) || p2s.length < 8) { + throw new JWEInvalid('PBES2 Salt Input must be 8 or more octets'); + } + const salt = concatSalt(alg, p2s); + const keylen = parseInt(alg.slice(13, 16), 10); + const subtleAlg = { + hash: `SHA-${alg.slice(8, 11)}`, + iterations: p2c, + name: 'PBKDF2', + salt, + }; + const cryptoKey = await getCryptoKey(key, alg); + return new Uint8Array(await crypto.subtle.deriveBits(subtleAlg, cryptoKey, keylen)); +} +export async function wrap(alg, key, cek, p2c = 2048, p2s = crypto.getRandomValues(new Uint8Array(16))) { + const derived = await deriveKey(p2s, alg, p2c, key); + const encryptedKey = await aeskw.wrap(alg.slice(-6), derived, cek); + return { encryptedKey, p2c, p2s: b64u(p2s) }; +} +export async function unwrap(alg, key, encryptedKey, p2c, p2s) { + const derived = await deriveKey(p2s, alg, p2c, key); + return aeskw.unwrap(alg.slice(-6), derived, encryptedKey); +} diff --git a/public/vendor/jose/lib/private_symbols.js b/public/vendor/jose/lib/private_symbols.js new file mode 100644 index 0000000000000000000000000000000000000000..fce302b11ec5790d7d3a75552ce57b1b92c5cf22 --- /dev/null +++ b/public/vendor/jose/lib/private_symbols.js @@ -0,0 +1 @@ +export const unprotected = Symbol(); diff --git a/public/vendor/jose/lib/rsaes.js b/public/vendor/jose/lib/rsaes.js new file mode 100644 index 0000000000000000000000000000000000000000..a1f48fa4cd7204a2e9a5da9bd66f05160807f095 --- /dev/null +++ b/public/vendor/jose/lib/rsaes.js @@ -0,0 +1,24 @@ +import { checkEncCryptoKey } from './crypto_key.js'; +import { checkKeyLength } from './check_key_length.js'; +import { JOSENotSupported } from '../util/errors.js'; +const subtleAlgorithm = (alg) => { + switch (alg) { + case 'RSA-OAEP': + case 'RSA-OAEP-256': + case 'RSA-OAEP-384': + case 'RSA-OAEP-512': + return 'RSA-OAEP'; + default: + throw new JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`); + } +}; +export async function encrypt(alg, key, cek) { + checkEncCryptoKey(key, alg, 'encrypt'); + checkKeyLength(alg, key); + return new Uint8Array(await crypto.subtle.encrypt(subtleAlgorithm(alg), key, cek)); +} +export async function decrypt(alg, key, encryptedKey) { + checkEncCryptoKey(key, alg, 'decrypt'); + checkKeyLength(alg, key); + return new Uint8Array(await crypto.subtle.decrypt(subtleAlgorithm(alg), key, encryptedKey)); +} diff --git a/public/vendor/jose/lib/sign.js b/public/vendor/jose/lib/sign.js new file mode 100644 index 0000000000000000000000000000000000000000..baf41d1e7711d028db639e07bac0a62bc6b9e11b --- /dev/null +++ b/public/vendor/jose/lib/sign.js @@ -0,0 +1,9 @@ +import { subtleAlgorithm } from './subtle_dsa.js'; +import { checkKeyLength } from './check_key_length.js'; +import { getSigKey } from './get_sign_verify_key.js'; +export async function sign(alg, key, data) { + const cryptoKey = await getSigKey(alg, key, 'sign'); + checkKeyLength(alg, cryptoKey); + const signature = await crypto.subtle.sign(subtleAlgorithm(alg, cryptoKey.algorithm), cryptoKey, data); + return new Uint8Array(signature); +} diff --git a/public/vendor/jose/lib/subtle_dsa.js b/public/vendor/jose/lib/subtle_dsa.js new file mode 100644 index 0000000000000000000000000000000000000000..0c72c2914d0380986897a6d41120448764889905 --- /dev/null +++ b/public/vendor/jose/lib/subtle_dsa.js @@ -0,0 +1,31 @@ +import { JOSENotSupported } from '../util/errors.js'; +export function subtleAlgorithm(alg, algorithm) { + const hash = `SHA-${alg.slice(-3)}`; + switch (alg) { + case 'HS256': + case 'HS384': + case 'HS512': + return { hash, name: 'HMAC' }; + case 'PS256': + case 'PS384': + case 'PS512': + return { hash, name: 'RSA-PSS', saltLength: parseInt(alg.slice(-3), 10) >> 3 }; + case 'RS256': + case 'RS384': + case 'RS512': + return { hash, name: 'RSASSA-PKCS1-v1_5' }; + case 'ES256': + case 'ES384': + case 'ES512': + return { hash, name: 'ECDSA', namedCurve: algorithm.namedCurve }; + case 'Ed25519': + case 'EdDSA': + return { name: 'Ed25519' }; + case 'ML-DSA-44': + case 'ML-DSA-65': + case 'ML-DSA-87': + return { name: alg }; + default: + throw new JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`); + } +} diff --git a/public/vendor/jose/lib/validate_algorithms.js b/public/vendor/jose/lib/validate_algorithms.js new file mode 100644 index 0000000000000000000000000000000000000000..3417f3f560063c13326ce1d4d15c5e51513039bb --- /dev/null +++ b/public/vendor/jose/lib/validate_algorithms.js @@ -0,0 +1,10 @@ +export function validateAlgorithms(option, algorithms) { + if (algorithms !== undefined && + (!Array.isArray(algorithms) || algorithms.some((s) => typeof s !== 'string'))) { + throw new TypeError(`"${option}" option must be an array of strings`); + } + if (!algorithms) { + return undefined; + } + return new Set(algorithms); +} diff --git a/public/vendor/jose/lib/validate_crit.js b/public/vendor/jose/lib/validate_crit.js new file mode 100644 index 0000000000000000000000000000000000000000..44e77e322ca09d6d1020150ab6cc8722ab10fbf6 --- /dev/null +++ b/public/vendor/jose/lib/validate_crit.js @@ -0,0 +1,33 @@ +import { JOSENotSupported, JWEInvalid, JWSInvalid } from '../util/errors.js'; +export function validateCrit(Err, recognizedDefault, recognizedOption, protectedHeader, joseHeader) { + if (joseHeader.crit !== undefined && protectedHeader?.crit === undefined) { + throw new Err('"crit" (Critical) Header Parameter MUST be integrity protected'); + } + if (!protectedHeader || protectedHeader.crit === undefined) { + return new Set(); + } + if (!Array.isArray(protectedHeader.crit) || + protectedHeader.crit.length === 0 || + protectedHeader.crit.some((input) => typeof input !== 'string' || input.length === 0)) { + throw new Err('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present'); + } + let recognized; + if (recognizedOption !== undefined) { + recognized = new Map([...Object.entries(recognizedOption), ...recognizedDefault.entries()]); + } + else { + recognized = recognizedDefault; + } + for (const parameter of protectedHeader.crit) { + if (!recognized.has(parameter)) { + throw new JOSENotSupported(`Extension Header Parameter "${parameter}" is not recognized`); + } + if (joseHeader[parameter] === undefined) { + throw new Err(`Extension Header Parameter "${parameter}" is missing`); + } + if (recognized.get(parameter) && protectedHeader[parameter] === undefined) { + throw new Err(`Extension Header Parameter "${parameter}" MUST be integrity protected`); + } + } + return new Set(protectedHeader.crit); +} diff --git a/public/vendor/jose/lib/verify.js b/public/vendor/jose/lib/verify.js new file mode 100644 index 0000000000000000000000000000000000000000..9470af5bbe728409a2afa7381768cb5250ab7af8 --- /dev/null +++ b/public/vendor/jose/lib/verify.js @@ -0,0 +1,14 @@ +import { subtleAlgorithm } from './subtle_dsa.js'; +import { checkKeyLength } from './check_key_length.js'; +import { getSigKey } from './get_sign_verify_key.js'; +export async function verify(alg, key, signature, data) { + const cryptoKey = await getSigKey(alg, key, 'verify'); + checkKeyLength(alg, cryptoKey); + const algorithm = subtleAlgorithm(alg, cryptoKey.algorithm); + try { + return await crypto.subtle.verify(algorithm, cryptoKey, signature, data); + } + catch { + return false; + } +} diff --git a/public/vendor/jose/util/base64url.js b/public/vendor/jose/util/base64url.js new file mode 100644 index 0000000000000000000000000000000000000000..d18f1f594c2f87efdf889b067db846dc59c2d2c5 --- /dev/null +++ b/public/vendor/jose/util/base64url.js @@ -0,0 +1,30 @@ +import { encoder, decoder } from '../lib/buffer_utils.js'; +import { encodeBase64, decodeBase64 } from '../lib/base64.js'; +export function decode(input) { + if (Uint8Array.fromBase64) { + return Uint8Array.fromBase64(typeof input === 'string' ? input : decoder.decode(input), { + alphabet: 'base64url', + }); + } + let encoded = input; + if (encoded instanceof Uint8Array) { + encoded = decoder.decode(encoded); + } + encoded = encoded.replace(/-/g, '+').replace(/_/g, '/'); + try { + return decodeBase64(encoded); + } + catch { + throw new TypeError('The input to be decoded is not correctly encoded.'); + } +} +export function encode(input) { + let unencoded = input; + if (typeof unencoded === 'string') { + unencoded = encoder.encode(unencoded); + } + if (Uint8Array.prototype.toBase64) { + return unencoded.toBase64({ alphabet: 'base64url', omitPadding: true }); + } + return encodeBase64(unencoded).replace(/=/g, '').replace(/\+/g, '-').replace(/\//g, '_'); +} diff --git a/public/vendor/jose/util/decode_jwt.js b/public/vendor/jose/util/decode_jwt.js new file mode 100644 index 0000000000000000000000000000000000000000..93d84f04b45e8c87a38ff347f60eaf969c41b3e0 --- /dev/null +++ b/public/vendor/jose/util/decode_jwt.js @@ -0,0 +1,32 @@ +import { decode as b64u } from './base64url.js'; +import { decoder } from '../lib/buffer_utils.js'; +import { isObject } from '../lib/is_object.js'; +import { JWTInvalid } from './errors.js'; +export function decodeJwt(jwt) { + if (typeof jwt !== 'string') + throw new JWTInvalid('JWTs must use Compact JWS serialization, JWT must be a string'); + const { 1: payload, length } = jwt.split('.'); + if (length === 5) + throw new JWTInvalid('Only JWTs using Compact JWS serialization can be decoded'); + if (length !== 3) + throw new JWTInvalid('Invalid JWT'); + if (!payload) + throw new JWTInvalid('JWTs must contain a payload'); + let decoded; + try { + decoded = b64u(payload); + } + catch { + throw new JWTInvalid('Failed to base64url decode the payload'); + } + let result; + try { + result = JSON.parse(decoder.decode(decoded)); + } + catch { + throw new JWTInvalid('Failed to parse the decoded payload as JSON'); + } + if (!isObject(result)) + throw new JWTInvalid('Invalid JWT Claims Set'); + return result; +} diff --git a/public/vendor/jose/util/decode_protected_header.js b/public/vendor/jose/util/decode_protected_header.js new file mode 100644 index 0000000000000000000000000000000000000000..a6da5a63efe3d67d8eef7b15a4696d3b9cffcbd1 --- /dev/null +++ b/public/vendor/jose/util/decode_protected_header.js @@ -0,0 +1,34 @@ +import { decode as b64u } from './base64url.js'; +import { decoder } from '../lib/buffer_utils.js'; +import { isObject } from '../lib/is_object.js'; +export function decodeProtectedHeader(token) { + let protectedB64u; + if (typeof token === 'string') { + const parts = token.split('.'); + if (parts.length === 3 || parts.length === 5) { + ; + [protectedB64u] = parts; + } + } + else if (typeof token === 'object' && token) { + if ('protected' in token) { + protectedB64u = token.protected; + } + else { + throw new TypeError('Token does not contain a Protected Header'); + } + } + try { + if (typeof protectedB64u !== 'string' || !protectedB64u) { + throw new Error(); + } + const result = JSON.parse(decoder.decode(b64u(protectedB64u))); + if (!isObject(result)) { + throw new Error(); + } + return result; + } + catch { + throw new TypeError('Invalid Token or Protected Header formatting'); + } +} diff --git a/public/vendor/jose/util/errors.js b/public/vendor/jose/util/errors.js new file mode 100644 index 0000000000000000000000000000000000000000..6fa9568dd1326a21906b30f458741623d0ed7aae --- /dev/null +++ b/public/vendor/jose/util/errors.js @@ -0,0 +1,99 @@ +export class JOSEError extends Error { + static code = 'ERR_JOSE_GENERIC'; + code = 'ERR_JOSE_GENERIC'; + constructor(message, options) { + super(message, options); + this.name = this.constructor.name; + Error.captureStackTrace?.(this, this.constructor); + } +} +export class JWTClaimValidationFailed extends JOSEError { + static code = 'ERR_JWT_CLAIM_VALIDATION_FAILED'; + code = 'ERR_JWT_CLAIM_VALIDATION_FAILED'; + claim; + reason; + payload; + constructor(message, payload, claim = 'unspecified', reason = 'unspecified') { + super(message, { cause: { claim, reason, payload } }); + this.claim = claim; + this.reason = reason; + this.payload = payload; + } +} +export class JWTExpired extends JOSEError { + static code = 'ERR_JWT_EXPIRED'; + code = 'ERR_JWT_EXPIRED'; + claim; + reason; + payload; + constructor(message, payload, claim = 'unspecified', reason = 'unspecified') { + super(message, { cause: { claim, reason, payload } }); + this.claim = claim; + this.reason = reason; + this.payload = payload; + } +} +export class JOSEAlgNotAllowed extends JOSEError { + static code = 'ERR_JOSE_ALG_NOT_ALLOWED'; + code = 'ERR_JOSE_ALG_NOT_ALLOWED'; +} +export class JOSENotSupported extends JOSEError { + static code = 'ERR_JOSE_NOT_SUPPORTED'; + code = 'ERR_JOSE_NOT_SUPPORTED'; +} +export class JWEDecryptionFailed extends JOSEError { + static code = 'ERR_JWE_DECRYPTION_FAILED'; + code = 'ERR_JWE_DECRYPTION_FAILED'; + constructor(message = 'decryption operation failed', options) { + super(message, options); + } +} +export class JWEInvalid extends JOSEError { + static code = 'ERR_JWE_INVALID'; + code = 'ERR_JWE_INVALID'; +} +export class JWSInvalid extends JOSEError { + static code = 'ERR_JWS_INVALID'; + code = 'ERR_JWS_INVALID'; +} +export class JWTInvalid extends JOSEError { + static code = 'ERR_JWT_INVALID'; + code = 'ERR_JWT_INVALID'; +} +export class JWKInvalid extends JOSEError { + static code = 'ERR_JWK_INVALID'; + code = 'ERR_JWK_INVALID'; +} +export class JWKSInvalid extends JOSEError { + static code = 'ERR_JWKS_INVALID'; + code = 'ERR_JWKS_INVALID'; +} +export class JWKSNoMatchingKey extends JOSEError { + static code = 'ERR_JWKS_NO_MATCHING_KEY'; + code = 'ERR_JWKS_NO_MATCHING_KEY'; + constructor(message = 'no applicable key found in the JSON Web Key Set', options) { + super(message, options); + } +} +export class JWKSMultipleMatchingKeys extends JOSEError { + [Symbol.asyncIterator]; + static code = 'ERR_JWKS_MULTIPLE_MATCHING_KEYS'; + code = 'ERR_JWKS_MULTIPLE_MATCHING_KEYS'; + constructor(message = 'multiple matching keys found in the JSON Web Key Set', options) { + super(message, options); + } +} +export class JWKSTimeout extends JOSEError { + static code = 'ERR_JWKS_TIMEOUT'; + code = 'ERR_JWKS_TIMEOUT'; + constructor(message = 'request timed out', options) { + super(message, options); + } +} +export class JWSSignatureVerificationFailed extends JOSEError { + static code = 'ERR_JWS_SIGNATURE_VERIFICATION_FAILED'; + code = 'ERR_JWS_SIGNATURE_VERIFICATION_FAILED'; + constructor(message = 'signature verification failed', options) { + super(message, options); + } +} diff --git a/public/verify.html b/public/verify.html new file mode 100644 index 0000000000000000000000000000000000000000..0f30d4bbfcb3d74aebd1a5748e8460b1e97befe8 --- /dev/null +++ b/public/verify.html @@ -0,0 +1,91 @@ + + + + + + Credential Verifier + + + +
+

Credential Verifier

+
+
+ + + + diff --git a/strategic_report.md b/strategic_report.md new file mode 100644 index 0000000000000000000000000000000000000000..de1d749baf4c81f934c9c6d61f58e50d8e3fb7e3 --- /dev/null +++ b/strategic_report.md @@ -0,0 +1,83 @@ +# Strategic Report: Leveraging Decentralized Storage for K-12 and Academia + +## 1. Introduction: The Business Problem + +Educational institutions face significant challenges with data storage, including rising costs, the risk of data loss (link rot), vendor lock-in with major cloud providers, and the need to maintain the long-term integrity of academic and student records. This report analyzes the viability of using a decentralized storage solution, based on the `microipfs` project, to address these pain points. + +--- + +## 2. Core Storage Pain Points in Education + +Our research identified several primary challenges: + +* **Cost Management:** Difficulty in predicting cloud costs and funding long-term archival storage. +* **Data Integrity & Archiving:** Ensuring that academic citations, research data, and student work remain accessible and unaltered over decades is a major hurdle (link rot). +* **Data Silos:** Information is often trapped within specific departments or proprietary systems, hindering collaboration and institution-wide analytics. +* **Privacy & Compliance:** Securely managing sensitive student data in accordance with regulations like FERPA is a constant challenge. + +--- + +## 3. SWOT Analysis: Decentralized Storage in an Educational Context + +A SWOT (Strengths, Weaknesses, Opportunities, Threats) analysis was conducted to evaluate the potential of a `microipfs`-like system. + +* **Strengths:** + * **Data Integrity:** IPFS content-addressing (CIDs) provides permanent, immutable links. + * **Resilience:** No single point of failure. + * **Data Sovereignty:** Institutions and students retain full ownership of their data. + * **Cost-Effectiveness:** Potential for cheaper long-term archival, especially for "cold" data. + +* **Weaknesses:** + * **Complexity:** Requires specialized expertise to deploy and maintain. + * **Privacy is Not a Default:** The public nature of IPFS requires a robust, mandatory encryption layer for sensitive data. + * **Performance:** Can be slower than centralized services for frequently accessed "hot" data. + * **Persistence is Not Guaranteed:** Data remains available only as long as it is actively "pinned" by a node. + +* **Opportunities:** + * **Inter-Institutional Collaboration:** Create shared, resilient academic archives. + * **Lifelong Student Portfolios:** Empower students with a permanent, portable record of their work. + * **Hosting Open Educational Resources (OER):** Ensure permanent access to free learning materials. + * **Fueling EdTech Innovation:** Create a common, open data layer for new applications. + +* **Threats:** + * **Regulatory Hurdles:** Navigating data privacy laws like FERPA can be complex. + * **Competition:** Deeply entrenched and user-friendly offerings from Google, Microsoft, etc. + * **Adoption & Usability:** The user experience must be seamless to gain traction. + * **Negative Association with "Crypto":** Proximity to blockchain/NFT technology could create reputational risk. + +--- + +## 4. High-Value Use Cases + +We identified three specific applications that leverage the unique strengths of this technology: + +1. **The Lifelong, Verifiable Student Portfolio:** A student-controlled, permanent portfolio that solves the problem of scattered and lost student work. +2. **The Resilient Learning Object Repository (LOR):** A permanent, inter-institutional archive for OER and course materials that is immune to link rot. +3. **The Interactive AI Model Playground:** A system for hosting and running small AI models directly in the browser, providing hands-on learning experiences without server-side costs. + +--- + +## 5. Strategic Recommendation + +The primary recommendation is to **not** position `microipfs` as a universal replacement for daily-use cloud storage. Instead, it should be adopted as a **specialized tool for creating a permanent, verifiable, and institution-agnostic archival layer.** The strategy is to target high-value, long-term use cases where data integrity and longevity are the highest priorities. + +--- + +## 6. Phased Adoption Roadmap + +A three-phased approach is recommended to manage risk and demonstrate value incrementally: + +* **Phase 1: The Foundational Pilot — Resilient Learning Object Repository (LOR):** Start by archiving and serving institutional learning materials. This is a low-risk, high-impact starting point that solves the immediate problem of link rot. +* **Phase 2: Student-Centric Expansion — The Lifelong Verifiable Portfolio:** Build on the LOR infrastructure to provide students with a tool to manage their own permanent portfolios. This phase requires the implementation of **mandatory client-side encryption.** +* **Phase 3: The Interactive Frontier — The AI Model Playground:** Leverage the populated LOR to host and serve interactive AI models as part of the curriculum, creating innovative, hands-on learning experiences. + +--- + +## 7. Critical Success Factors + +For this initiative to succeed, the following factors are crucial: + +1. **Obsessive User-Friendliness:** The interface must be as simple as current tools. +2. **Privacy by Default:** Client-side encryption must be mandatory and seamless for all student data. +3. **Governance and Collaboration:** A consortium of partner institutions should be formed to share the responsibility and cost of pinning critical data. +4. **Clear Communication:** Stakeholders must understand that this is a specialized archival tool, not a replacement for their everyday file-sharing applications.