diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 00000000..6da5ab58 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,22 @@ +name: Docs +on: + push: + branches: + - master + # TODO: Keep all historical builds (like the js-sdk) + #tags: ['v*'] +jobs: + build-and-deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: '14' + - run: yarn install + - run: yarn docs + - name: Build and deploy docs + uses: JamesIves/github-pages-deploy-action@4.1.7 + with: + branch: gh-pages + folder: .jsdoc/matrix-bot-sdk/develop diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 63ff44b5..4678d5ec 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,24 +1,77 @@ -name: Docs -on: +name: Main +on: push: - branches: - - master - # TODO: Keep all historical builds (like the js-sdk) - #tags: ['v*'] jobs: - build-and-deploy: + # Global + # ================================================ + + eslint-16: + name: 'ESLint Node 16' runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - name: Extract branch name - shell: bash - run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" - id: extract_branch - - name: Build and deploy docs - uses: JamesIves/github-pages-deploy-action@releases/v2 - env: - ACCESS_TOKEN: ${{ secrets.GH_PAT }} - BASE_BRANCH: ${{ steps.extract_branch.outputs.branch }} - BRANCH: gh-pages - BUILD_SCRIPT: "yarn install && yarn docs" - FOLDER: ".jsdoc/matrix-bot-sdk/develop" + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: '16' + - run: yarn install + - run: yarn lint + + # Node 16 + # ================================================ + + build-16: + name: 'Build Node 16' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: '16' + - run: yarn install + - run: yarn build + - run: yarn build:examples + + tests-16: + name: 'Mocha Tests Node 16' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: '16' + - run: yarn install + - uses: nick-invision/retry@v2 + with: + max_attempts: 5 + timeout_minutes: 5 + command: yarn test + + # Node 14 + # ================================================ + + build-14: + name: 'Build Node 14' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: '14' + - run: yarn install + - run: yarn build + - run: yarn build:examples + + tests-14: + name: 'Mocha Tests Node 14' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: '14' + - run: yarn install + - uses: nick-invision/retry@v2 + with: + max_attempts: 5 + timeout_minutes: 5 + command: yarn test diff --git a/README.md b/README.md index ef7e2cc8..b1881d7c 100644 --- a/README.md +++ b/README.md @@ -5,202 +5,6 @@ TypeScript/JavaScript SDK for Matrix bots. For help and support, visit [#matrix-bot-sdk:t2bot.io](https://matrix.to/#/#matrix-bot-sdk:t2bot.io) -Documentation for the develop branch is available [here](https://turt2live.github.io/matrix-bot-sdk/index.html). +# Documentation -# Templates and guides - -* [matrix.org's guide on the basic functions of the bot](https://matrix.org/docs/guides/usage-of-matrix-bot-sdk) -* [GitHub bot template repository](https://github.com/turt2live/matrix-bot-sdk-bot-template) - -# Installing - -This package can be found on [npm](https://www.npmjs.com): -``` -npm install matrix-bot-sdk -``` - -# Quickstart Bot - -Here's an example of a very simple bot written using this library. It will auto-join rooms and respond to `!hello` as a command. - -```typescript -import { - MatrixClient, - SimpleFsStorageProvider, - AutojoinRoomsMixin, - RichReply, -} from "matrix-bot-sdk"; - -// where you would point a client to talk to a homeserver -const homeserverUrl = "https://matrix.org"; - -// see https://t2bot.io/docs/access_tokens -const accessToken = "YourSecretAccessToken"; - -// We'll want to make sure the bot doesn't have to do an initial sync every -// time it restarts, so we need to prepare a storage provider. Here we use -// a simple JSON database. -const storage = new SimpleFsStorageProvider("hello-bot.json"); - -// Now we can create the client and set it up to automatically join rooms. -const client = new MatrixClient(homeserverUrl, accessToken, storage); -AutojoinRoomsMixin.setupOnClient(client); - -// We also want to make sure we can receive events - this is where we will -// handle our command. -client.on("room.message", handleCommand); - -// Now that the client is all set up and the event handler is registered, start the -// client up. This will start it syncing. -client.start().then(() => console.log("Client started!")); - -// This is our event handler for dealing with the `!hello` command. -async function handleCommand(roomId, event) { - // Don't handle events that don't have contents (they were probably redacted) - if (!event["content"]) return; - - // Don't handle non-text events - if (event["content"]["msgtype"] !== "m.text") return; - - // We never send `m.text` messages so this isn't required, however this is - // how you would filter out events sent by the bot itself. - if (event["sender"] === await client.getUserId()) return; - - // Make sure that the event looks like a command we're expecting - const body = event["content"]["body"]; - if (!body || !body.startsWith("!hello")) return; - - // If we've reached this point, we can safely execute the command. We'll - // send a reply to the user's command saying "Hello World!". - const replyBody = "Hello World!"; // we don't have any special styling to do. - const reply = RichReply.createFor(roomId, event, replyBody, replyBody); - reply["msgtype"] = "m.notice"; - client.sendMessage(roomId, reply); -} -``` - -# Usage - -```typescript -const MatrixClient = require("matrix-bot-sdk").MatrixClient; -const AutojoinRoomsMixin = require("matrix-bot-sdk").AutojoinRoomsMixin; - -const client = new MatrixClient("https://matrix.org", "your_access_token_here"); -AutojoinRoomsMixin.setupOnClient(client); - -// To listen for room messages (m.room.message) only: -client.on("room.message", (roomId, event) => { - if (!event["content"]) return; - console.log(event["sender"] + " says " + event["content"]["body"]); - - client.sendMessage(roomId, { - "msgtype": "m.notice", - "body": "hello!", - }); - - // or... - client.sendNotice(roomId, "hello!"); -}); - -// Or to listen for any event that happens in a room: -client.on("room.event", (roomId, event) => { - if (!event["content"]) return; - console.log(event["sender"] + " sent " + event["type"]); -}); - -client.start().then(() => console.log("Client started!")); -``` - -## Rich replies - -To automatically process rich replies coming into the client: -```typescript -const MatrixClient = require("matrix-bot-sdk").MatrixClient; -const RichRepliesPreprocessor = require("matrix-bot-sdk").RichRepliesPreprocessor; -const IRichReplyMetadata = require("matrix-bot-sdk").IRichReplyMetadata; - -const client = new MatrixClient("https://matrix.org", "your_access_token_here"); - -// Set fetchRealEventContents to true to have the preprocessor get the real event -client.addPreprocessor(new RichRepliesPreprocessor(fetchRealEventContents: false)); - -// regular client usage here. When you encounter an event: -const event = {/* from somewhere, such as on a room message */}; -if (event["mx_richreply"]) { - const reply = event["mx_richreply"]; - console.log("The original event was " + reply.parentEventId + " and the text was " + reply.fallbackPlainBody); -} -``` - -To send a rich reply to an event: -```typescript -const MatrixClient = require("matrix-bot-sdk").MatrixClient; -const AutojoinRoomsMixin = require("matrix-bot-sdk").AutojoinRoomsMixin; -const RichReply = require("matrix-bot-sdk").RichReply; - -const client = new MatrixClient("https://matrix.org", "your_access_token_here"); -AutojoinRoomsMixin.setupOnClient(client); - -client.on("room.message", (roomId, event) => { - if (!event["content"]) return; - - const newEvent = RichReply.createFor(event, "Hello!", "Hello!"); - newEvent["msgtype"] = "m.notice"; - client.sendMessage(roomId, newEvent); -}); - -client.start().then(() => console.log("Client started!")); -``` - - -## Application Services - -Application service support is a feature of the SDK. This does things like Intent management, impersonation, and transaction handling on behalf of the application. - -You'll need to load your registration file from somewhere, however the fastest path is: - -```javascript -const Appservice = require("matrix-bot-sdk").Appservice; - -// The registration is of type AppserviceRegistration, also available from the matrix-bot-sdk -const registration = { - as_token: "YourTokenHere", - hs_token: "YourTokenHere", - sender_localpart: "_some_bridge", - namespaces: { - users: [ - { - exclusive: true, - regex: "@_some_bridge_.*", - }, - ], - rooms: [], - aliases: [], - }, -}; - -// The options are of type AppserviceOptions, also available from the matrix-bot-sdk -const options = { - port: 9000, - bindAddress: "0.0.0.0", - homeserverName: "matrix.org", - homeserverUrl: "https://matrix.org", -}; - -const appservice = new Appservice(options, registration); -appservice.getIntent("_some_bridge_user").sendText("!somewhere:domain.com", "Hello world!"); - -// or if you don't want to do your own parsing to figure out the user prefix: -appservice.getIntentForSuffix("user").sendText("!somewhere:domain.com", "Hello world!"); -``` - - -## Room upgrades - -When a room is upgraded, bots and bridges might have to relocate data to the new room. This SDK can handle the easier part of ensuring the bot/bridge is in the new room, and emits events to make the remainder of the process a little easier. - -An upgrade happens in two phases: a `room.archived` phase where the old room is flagged as being replaced by another room and a `room.upgraded` phase once the bot/bridge is aware of the new room. Bots and appservices can be told to automatically try and join the new room by attaching a `AutojoinUpgradedRoomsMixin` to the client/appservice, much like the `AutojoinRoomsMixin`. - -Bots and appservices should listen for `room.upgraded` to perform a data transfer as this is when there is referential integrity between the two rooms. Prior to an upgrade, there is no guarantee that the replacement room advertised is actually valid. - -To get the full chain of rooms, use `getRoomUpgradeHistory(roomId)` on a `MatrixClient` (ie: the `botIntent.underlyingClient` or your own). +Documentation for the project is available [here](https://turt2live.github.io/matrix-bot-sdk/index.html). diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 00000000..291897b9 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,17 @@ +[![npm version](https://badge.fury.io/js/matrix-bot-sdk.svg)](https://www.npmjs.com/package/matrix-bot-sdk) + +TypeScript/JavaScript SDK for Matrix bots. For help and support, visit [#matrix-bot-sdk:t2bot.io](https://matrix.to/#/#matrix-bot-sdk:t2bot.io) + +## Templates and guides + +* [Bot documentation](https://turt2live.github.io/matrix-bot-sdk/tutorial-bot.html) +* [Appservice/bridge documentation](https://turt2live.github.io/matrix-bot-sdk/tutorial-appservice.html) +* [matrix.org's guide on the basic functions of the bot](https://matrix.org/docs/guides/usage-of-matrix-bot-sdk) +* [GitHub bot template repository](https://github.com/turt2live/matrix-bot-sdk-bot-template) + +## Installing + +This package can be found on [npm](https://www.npmjs.com/package/matrix-bot-sdk): +``` +npm install matrix-bot-sdk +``` diff --git a/docs/tutorials/appservice.md b/docs/tutorials/appservice.md new file mode 100644 index 00000000..2afb4e93 --- /dev/null +++ b/docs/tutorials/appservice.md @@ -0,0 +1,116 @@ +Application services are essentially superpowered bots with a much more capable connection to the homeserver. While bots +can operate on nearly any homeserver, appservices need to be specifically installed and configured by the server admins. +Because of the direct connection nature, and the ability to reserve a whole namespace of user IDs, appservices typically +take the shape of bridges. They also typically take the shape of single-user bots which outgrew the performance of calling +`/sync` in a loop. + +Appservices are added to homeservers using a registration file. Typically, these are YAML files which get added/listed +to the server config somewhere. Check your homeserver software's documentation for how to install an appservice. + +The bot-sdk does not automatically generate a registration file, but it is trivial to generate one by hand. Implementations +typically request that the server admin also supply an exact copy of the registration file so it can be handed off to the +bot-sdk to handle. Advanced uses (ie: multiple namespaces for a single appservice) might require translating the registration +file into something the bot-sdk is willing to accept, however most cases will be perfectly fine to just read it in directly. + +An example registration file is: + +```yaml +# A general purpose identifier for the appservice. Typically, this is just a lowercase version of the application +# name. It should be unique among all other appservices installed on the homeserver. +id: mybridge + +# These are the authentication secrets used to communicate between the homeserver and appservice. They should +# be secret, sufficiently complex, and different from each other and all other appservices installed on the +# homeserver. +as_token: +hs_token: + +# These are the namespaces that the appservice would like to reserve or use. Typically, bridges will want to +# reserve an alias and user namespace. +namespaces: + aliases: + - exclusive: true + # It's good practice to limit the regex to just bridge users on the current homeserver to avoid confusing + # your bridge with other people who might be using it. + regex: "#bridge_.+:example.org" + users: + - exclusive: true + regex: "@bridge_.+:example.org" + rooms: [] # not commonly used, but required to be set + +rate_limited: false # typical bridges don't want to be rate limited + +# This is the localpart of the primary user for the appservice. For bridges, this is typically known as the +# "bridge bot" user. +sender_localpart: "bridge_bot" + +# This is where the homeserver can reach your appservice at. The bot-sdk will automatically expose a webserver +# at the configured port to handle this traffic and turn it into useful events. +url: "http://localhost:9000" + +# If you need ephemeral events (for crypto or other reasons), set this to true. Defaults to false to avoid flooding +# the appservice wtih traffic. +de.sorunome.msc2409.push_ephemeral: true +``` + +## Creating the appservice instance + +The {@link Appservice} class wants a whole bunch of options, though the details are not much different from a regular +bot. Namely, it wants a storage mechanism, config options for the webserver, and an appservice registration to use as +reference. + +```typescript +const registration: {@link IAppserviceRegistration} = {/* ... typically read from the YAML file ... */ }; +const options: {@link IAppserviceOptions} = { + // Webserver options + port: 9000, + bindAddress: "0.0.0.0", + + // Where the appservice can reach the homeserver at. This should be the same URL configured for clients and bots. + homeserverUrl: "https://example.org", + + // The domain name of the homeserver. This is the part that is included in user IDs. + homeserverName: "example.org", + + registration: registration, + storage: new SimpleFsStorageProvider("./path/to/appservice.json"), // or any other {@link IAppserviceStorageProvider} + joinStrategy: new SimpleRetryJoinStrategy(), // just to ensure reliable joins +}; +const appservice = new Appservice(options); + +// Attach listeners here +appservice.on("room.message", (roomId: string, event: any) => { + if (!event['content']?.['msgtype']) return; + + // handle message +}); + +// Typically appservices will want to autojoin all rooms +AutojoinRoomsMixin.setupOnAppservice(appservice); + +// Actually start the appservice +appservice.begin().then(() => console.log("Appservice started")); +``` + +The `appservice` instance will emit all the same stuff as a regular bot. Check out the bot tutorial for more information: +{@tutorial bot}. + +## Intents + +Intents are how the bot-sdk deals with the namespace of users declared in the registration. The bridge bot user is also +an intent, though with a special accessor. + +To get the bridge bot intent, use `appservice.botIntent`. For all other intents, `appservice.getIntentForSuffix("suffix")` +is typically easiest. + +The {@link Intent} class has all sorts of built-in functions, though if you need to do something more complex then you +may need to handle the intent differently: + +```typescript +const intent = appservice.getIntentForSuffix("your_suffix"); // typically a suffix is an identifier from a third party platform +await intent.ensureRegistered(); // can be called multiple times safely +await intent.underlyingClient.setDisplayName("Name"); // or whatever function you'd like to call +``` + +Typically the bridge bot intent is used for anything which doesn't need to be impersonated by a specific user ID, such +as querying room state or inviting users. The bridge client is exposed as `appservice.botClient` for easy access. diff --git a/docs/tutorials/bot-to-appservice.md b/docs/tutorials/bot-to-appservice.md new file mode 100644 index 00000000..6d892b98 --- /dev/null +++ b/docs/tutorials/bot-to-appservice.md @@ -0,0 +1,98 @@ +Once a bot has outgrown the performance of a `/sync` loop, it's typically time to convert it to an appservice. This involves +changing how the application receives events from the server, and possibly even migrating datastores if using custom storage +providers. + +For the purposes of this tutorial, we'll assume the bot has been running as `@bot:example.org` with an access token. + +First, you'll need to create a registration file. Check out the appservices tutorial for more information on what this +is: {@tutorial appservice}. + +```yaml +id: examplebot +as_token: +hs_token: +url: "http://localhost:9000" # where your bot can be reached at the built-in webserver for the bot-sdk +sender_localpart: "bot" + +# We don't need any namespaces, but they need to be declared +namespaces: + users: [] + aliases: [] + rooms: [] + +rate_limited: false +de.sorunome.msc2409.push_ephemeral: true # default false. Keep false if not using typing notifications, encryption, etc. +``` + +That registration will need to be installed on the homeserver. Consult your homeserver documentation for more information. + +Next, you'll need to incorporate that into the bot-sdk's interface. Because the bot-sdk is more geared to bridges, we'll +have to lie to it a bit to ensure it stays happy. + +```typescript +const registration: IAppserviceRegistration = { + id: "examplebot", + as_token: "", + hs_token: "", + url: "http://localhost:9000", // not used by bot-sdk, but good to define for documentation purposes + sender_localpart: "bot", + namespaces: { + users: [{exclusive: true, regex: "@bot.+"}], // we won't be using anything in the namespace, but need to define it + aliases: [], + rooms: [], + }, + + // For documentation purposes: + rate_limited: false, + "de.sorunome.msc2409.push_ephemeral": true, +}; +``` + +Then, you'll need to define the appservice options. This will be things such as where the internal webserver will listen +at and where its data is stored. If you used a storage provider built into the bot-sdk, it can be reused here. + +```typescript +const options: IAppserviceOptions = { + // Webserver options + port: 9000, + bindAddress: "0.0.0.0", + + // This should be the same URL used by the bot. + homeserverUrl: "https://example.org", + + // The domain name of the homeserver. This is the part that is included in user IDs. + homeserverName: "example.org", + + registration: registration, + storage: new SimpleFsStorageProvider("./path/to/bot.json"), + joinStrategy: new SimpleRetryJoinStrategy(), // just to ensure reliable joins +}; +``` + +Now, your listeners from your bot can be attached to the `appservice` instance instead: + +```typescript +// Old code: + +// bot.on("room.message", (roomId: string, event: any) => { +// if (!event['content']?.['msgtype']) return; +// +// // handle message +// }); + +// --------------- + +// New code: + +appservice.on("room.message", (roomId: string, event: any) => { + if (!event['content']?.['msgtype']) return; + + // handle message +}); +``` + +Finally, start the appservice and give it a go: `appservice.begin().then(() => console.log("Appservice started"));` + +If you need to access a {@link MatrixClient} instance for calling functions, use `appservice.botClient`. Note that the +client instance will not emit events because it will not be syncing/will not be started. It should not have `start()` +called on it as this can cause data loss/duplication. diff --git a/docs/tutorials/bot.md b/docs/tutorials/bot.md new file mode 100644 index 00000000..654b6034 --- /dev/null +++ b/docs/tutorials/bot.md @@ -0,0 +1,153 @@ +Bots are typically simple creatures which act on commands and provide utility to rooms. They work very similar to how +normal Matrix clients work, with the added complexity of needing to be run on a server somewhere. Unlike appservices +(bridges), bots do not need to be added by a server admin and can be attached to any regular account. + +For a guide starting from scratch, check out the [matrix.org guide](https://matrix.org/docs/guides/usage-of-matrix-bot-sdk). + +## Creating the bot account + +The bot-sdk can be used to script a simple registration or login script, depending on whether or not an account has +been made prior to deploying the bot. If you already have an access token, skip this section. + +**Registration**: + +```typescript +import { MatrixAuth } from "matrix-bot-sdk"; + +// This will be the URL where clients can reach your homeserver. Note that this might be different +// from where the web/chat interface is hosted. The server must support password registration without +// captcha or terms of service (public servers typically won't work). +const homeserverUrl = "https://example.org"; + +const auth = new MatrixAuth(homeserverUrl); +const client = await auth.passwordRegister("username", "password"); + +console.log("Copy this access token to your bot's config: ", client.accessToken); +``` + +**Login** (preferred): + +```typescript +import { MatrixAuth } from "matrix-bot-sdk"; + +// This will be the URL where clients can reach your homeserver. Note that this might be different +// from where the web/chat interface is hosted. The server must support password registration without +// captcha or terms of service (public servers typically won't work). +const homeserverUrl = "https://example.org"; + +const auth = new MatrixAuth(homeserverUrl); +const client = await auth.passwordLogin("username", "password"); + +console.log("Copy this access token to your bot's config: ", client.accessToken); +``` + +In either case, the access token printed at the end will need copying to your bot's config. + +## Quickstart bot + +As an example, a bot which replies to `!hello` commands would be: + +```typescript +import { + MatrixClient, + SimpleFsStorageProvider, + AutojoinRoomsMixin, +} from "matrix-bot-sdk"; + +// This will be the URL where clients can reach your homeserver. Note that this might be different +// from where the web/chat interface is hosted. The server must support password registration without +// captcha or terms of service (public servers typically won't work). +const homeserverUrl = "https://example.org"; + +// Use the access token you got from login or registration above. +const accessToken = "ACQUIRED_FROM_ABOVE"; + +// In order to make sure the bot doesn't lose its state between restarts, we'll give it a place to cache +// any information it needs to. You can implement your own storage provider if you like, but a JSON file +// will work fine for this example. +const storage = new SimpleFsStorageProvider("hello-bot.json"); + +// Finally, let's create the client and set it to autojoin rooms. Autojoining is typical of bots to ensure +// they can be easily added to any room. +const client = new MatrixClient(homeserverUrl, accessToken, storage); +AutojoinRoomsMixin.setupOnClient(client); + +// Before we start the bot, register our command handler +client.on("room.message", handleCommand); + +// Now that everything is set up, start the bot. This will start the sync loop and run until killed. +client.start().then(() => console.log("Bot started!")); + +// This is the command handler we registered a few lines up +async function handleCommand(roomId: string, event: any) { + // Don't handle unhelpful events (ones that aren't text messages, are redacted, or sent by us) + if (event['content']?.['msgtype'] !== 'm.text') return; + if (event['sender'] === await client.getUserId()) return; + + // Check to ensure that the `!hello` command is being run + const body = event['content']['body']; + if (!body?.startsWith("!hello")) return; + + // Now that we've passed all the checks, we can actually act upon the command + await client.replyNotice(roomId, event, "Hello world!"); +} +``` + +## Watching for events + +A `MatrixClient` instance will call listeners for various different things that might happen after the bot has started. + +### [Room messages](https://spec.matrix.org/latest/client-server-api/#instant-messaging) & [events](https://spec.matrix.org/latest/client-server-api/#events) + +```typescript +client.on("room.message", (roomId: string, event: any) => { + // `event['type']` will always be an `m.room.message` and can be processed as such + + // be sure to check if the event is redacted/invalid though: + if (!event['content']?.['msgtype']) return; +}); +``` + +```typescript +client.on("room.event", (roomId: string, event: any) => { + // Check `event['type']` to see if it is an event you're interested in + if (event['type'] !== 'org.example.custom') return; + + // Note that state events can also be sent down this listener too + if (event['state_key'] !== undefined) return; // state event +}); +``` + +### [Account data](https://spec.matrix.org/latest/client-server-api/#client-config) + +```typescript +client.on("account_data", (event: any) => { + // Handle the account data update +}); +``` + +```typescript +client.on("room.account_data", (roomId: string, event: any) => { + // Handle the room account data update +}); +``` + +### Room membership + +```typescript +client.on("room.join", (roomId: string, event: any) => { + // The client has joined `roomId` +}); +``` + +```typescript +client.on("room.leave", (roomId: string, event: any) => { + // The client has left `roomId` (either voluntarily, kicked, or banned) +}); +``` + +```typescript +client.on("room.join", (roomId: string, event: any) => { + // The client has been invited to `roomId` +}); +``` diff --git a/docs/tutorials/encryption-appservices.md b/docs/tutorials/encryption-appservices.md new file mode 100644 index 00000000..0c4fe1f8 --- /dev/null +++ b/docs/tutorials/encryption-appservices.md @@ -0,0 +1,52 @@ +Encryption for appservices is just about as easy as bots, though involves using a storage mechanism which is capable of +handling the higher traffic. Eventually the SDK will support custom stores, however for now the crypto store must be +a {@link RustSdkAppserviceCryptoStorageProvider}. + +```typescript +const storage = new SimpleFsStorageProvider("./path/to/appservice.json"); // or any other {@link IStorageProvider} +const cryptoStorage = new RustSdkAppserviceCryptoStorageProvider("./path/to/directory"); + +// ⚠⚠ Be sure to back up both `./path/to/appservice.json` and `./path/to/directory` when using this setup + +const registration: IAppserviceRegistration = { + /* ... */ + "de.sorunome.msc2409.push_ephemeral": true, +}; +const options: IAppserviceOptions = { + /* ... */ + storage: storage, + cryptoStorage: cryptoStorage, + intentOptions: { + // Enable encryption on all appservice users, including the `sender_localpart` user + encryption: true, + }, +} +const appservice = new Appservice(options); +``` + +## Advanced usage + +To monitor the encryption/decryption process, add the following listeners: + +```typescript +appservice.on("room.encrypted_event", (roomId: string, event: any) => { + // handle `m.room.encrypted` event that was received from the server +}); +``` + +```typescript +appservice.on("room.decrypted_event", (roomId: string, event: any) => { + // handle a decrypted `m.room.encrypted` event (`event` will be representative of the cleartext event). + + // this is effectively the same as `on('room.event', ...)` though at a different point in the lifecycle. +}); +``` + +```typescript +appservice.on("room.failed_decryption", (roomId: string, event: any, error: Error) => { + // handle `m.room.encrypted` event that could not be decrypted +}); +``` + +To control when encryption is set up for {@link Intent}s, set `intentOptions.encryption = false` in the appservice options +and call `await intent.enableEncryption()` before encryption will be needed. It is safe to call multiple times. diff --git a/docs/tutorials/encryption-bots.md b/docs/tutorials/encryption-bots.md new file mode 100644 index 00000000..6747d76d --- /dev/null +++ b/docs/tutorials/encryption-bots.md @@ -0,0 +1,53 @@ +Setting up encryption for a bot is easy: simply provide a crypto storage provider in addition to your other storage +providers and it'll start working behind the scenes. + +```typescript +const storageProvider = new SimpleFsStorageProvider("./path/to/bot.json"); // or any other {@link IStorageProvider} +const cryptoProvider = new RustSdkCryptoStorageProvider("./path/to/directory"); + +// ⚠⚠ Be sure to back up both `./path/to/bot.json` and `./path/to/directory` when using this setup + +const homeserverUrl = "https://example.org"; // where the bot can reach the homeserver at +const accessToken = "..."; // acquired from login or registration. + +// ℹ The access token for the bot should remain consistent. The crypto storage in particular will assume that the +// device ID (and thus access token) does not change between restarts. If the access token becomes invalid, or the +// crypto storage is lost, a new access token and new crypto storage will need to be created. + +const client = new MatrixClient(homeserverUrl, accessToken, storageProvider, cryptoProvider); + +// set up your listeners here +client.on("room.message", (roomId: string, event: any) => { + if (!event['content']?.['msgtype']) return; + + // handle message here. It'll be decrypted already. +}); + +// This will set up crypto if needed and prepare the client for automatically decrypting and encrypting messages. Simply +// use the client like you would without encryption and it should just work. +client.start().then(() => console.log("Bot started!")); +``` + +## Advanced usage + +To monitor the encryption/decryption process, add the following listeners: + +```typescript +client.on("room.encrypted_event", (roomId: string, event: any) => { + // handle `m.room.encrypted` event that was received from the server +}); +``` + +```typescript +client.on("room.decrypted_event", (roomId: string, event: any) => { + // handle a decrypted `m.room.encrypted` event (`event` will be representative of the cleartext event). + + // this is effectively the same as `on('room.event', ...)` though at a different point in the lifecycle. +}); +``` + +```typescript +client.on("room.failed_decryption", (roomId: string, event: any, error: Error) => { + // handle `m.room.encrypted` event that could not be decrypted +}); +``` diff --git a/docs/tutorials/encryption.md b/docs/tutorials/encryption.md new file mode 100644 index 00000000..0d6d6ad8 --- /dev/null +++ b/docs/tutorials/encryption.md @@ -0,0 +1,13 @@ +Matrix supports end-to-end encryption between users in encrypted rooms. Not all rooms are encrypted, and most bots and +bridges do not support encryption out of the gate. With the bot-sdk, encryption (or crypto) needs to be turned on +deliberately in the code. + +The following guides go into detail on how to enable encryption for different use cases: + +* {@tutorial encryption-bots} +* {@tutorial encryption-appservices} + +## General principles + +For both bots and appservices, an {@link ICryptoStorageProvider} will be needed to actually enable encryption. Eventually +this will be able to be your own implementation, but for now must be a {@link RustSdkCryptoStorageProvider} or derivative. diff --git a/docs/tutorials/index.json b/docs/tutorials/index.json new file mode 100644 index 00000000..b105ca32 --- /dev/null +++ b/docs/tutorials/index.json @@ -0,0 +1,34 @@ +{ + "bot": { + "title": "Bot usage", + "order": 1 + }, + "appservice": { + "title": "Appservice (bridge) usage", + "order": 2, + "children": { + "bot-to-appservice": { + "title": "Converting a bot to an appservice", + "order": 1 + } + } + }, + "room-upgrades": { + "title": "Room upgrades", + "order": 4 + }, + "encryption": { + "title": "Encryption", + "order": 3, + "children": { + "encryption-bots": { + "title": "Encryption for bots", + "order": 1 + }, + "encryption-appservices": { + "title": "Encryption for appservices", + "order": 2 + } + } + } +} diff --git a/docs/tutorials/room-upgrades.md b/docs/tutorials/room-upgrades.md new file mode 100644 index 00000000..d84f9f96 --- /dev/null +++ b/docs/tutorials/room-upgrades.md @@ -0,0 +1,9 @@ + + +When a room is upgraded, bots and bridges might have to relocate data to the new room. This SDK can handle the easier part of ensuring the bot/bridge is in the new room, and emits events to make the remainder of the process a little easier. + +An upgrade happens in two phases: a `room.archived` phase where the old room is flagged as being replaced by another room and a `room.upgraded` phase once the bot/bridge is aware of the new room. Bots and appservices can be told to automatically try and join the new room by attaching a `AutojoinUpgradedRoomsMixin` to the client/appservice, much like the `AutojoinRoomsMixin`. + +Bots and appservices should listen for `room.upgraded` to perform a data transfer as this is when there is referential integrity between the two rooms. Prior to an upgrade, there is no guarantee that the replacement room advertised is actually valid. + +To get the full chain of rooms, use `getRoomUpgradeHistory(roomId)` on a `MatrixClient` (ie: the `botIntent.underlyingClient` or your own). diff --git a/examples/bot.ts b/examples/bot.ts new file mode 100644 index 00000000..ad74f6dd --- /dev/null +++ b/examples/bot.ts @@ -0,0 +1,50 @@ +import { + AutojoinRoomsMixin, + LogLevel, + LogService, + MatrixClient, + MessageEvent, + RichConsoleLogger, + RustSdkCryptoStorageProvider, + SimpleFsStorageProvider, +} from "../src"; + +LogService.setLogger(new RichConsoleLogger()); +LogService.setLevel(LogLevel.TRACE); +LogService.muteModule("Metrics"); +LogService.trace = LogService.debug; + +let creds = null; +try { + creds = require("../../examples/storage/bot.creds.json"); +} catch (e) { + // ignore +} + +const dmTarget = creds?.['dmTarget'] ?? "@admin:localhost"; +const homeserverUrl = creds?.['homeserverUrl'] ?? "http://localhost:8008"; +const accessToken = creds?.['accessToken'] ?? 'YOUR_TOKEN'; +const storage = new SimpleFsStorageProvider("./examples/storage/bot.json"); +const crypto = new RustSdkCryptoStorageProvider("./examples/storage/bot_sled"); + +const client = new MatrixClient(homeserverUrl, accessToken, storage, crypto); +AutojoinRoomsMixin.setupOnClient(client); + +(async function() { + await client.dms.update(); // should update in `start()`, but we're earlier than that here + const targetRoomId = await client.dms.getOrCreateDm(dmTarget); + + client.on("room.message", async (roomId: string, event: any) => { + if (roomId !== targetRoomId) return; + + const message = new MessageEvent(event); + + if (message.messageType !== "m.text") return; + if (message.textBody.startsWith("!ping")) { + await client.replyNotice(roomId, event, "Pong from DM"); + } + }); + + LogService.info("index", "Starting bot..."); + await client.start(); +})(); diff --git a/examples/encryption_appservice.ts b/examples/encryption_appservice.ts new file mode 100644 index 00000000..2ad505e4 --- /dev/null +++ b/examples/encryption_appservice.ts @@ -0,0 +1,144 @@ +import { + Appservice, + EncryptionAlgorithm, + FileMessageEventContent, + IAppserviceOptions, + IAppserviceRegistration, + LogLevel, + LogService, + MessageEvent, + RichConsoleLogger, + RustSdkAppserviceCryptoStorageProvider, + SimpleFsStorageProvider, + SimpleRetryJoinStrategy, +} from "../src"; +import * as fs from "fs"; + +LogService.setLogger(new RichConsoleLogger()); +LogService.setLevel(LogLevel.TRACE); +LogService.muteModule("Metrics"); +LogService.trace = LogService.debug; + +let creds = null; +try { + creds = require("../../examples/storage/encryption_appservice.creds.json"); +} catch (e) { + // ignore +} + +const dmTarget = creds?.['dmTarget'] ?? "@admin:localhost"; +const homeserverUrl = creds?.['homeserverUrl'] ?? "http://localhost:8008"; +const storage = new SimpleFsStorageProvider("./examples/storage/encryption_appservice.json"); +const crypto = new RustSdkAppserviceCryptoStorageProvider("./examples/storage/encryption_appservice_sled"); +const worksImage = fs.readFileSync("./examples/static/it-works.png"); + +const registration: IAppserviceRegistration = { + as_token: creds?.['asToken'] ?? "change_me", + hs_token: creds?.['hsToken'] ?? "change_me", + sender_localpart: "crypto_test_appservice_rust3", + namespaces: { + users: [{ + regex: "@crypto.*:localhost", + exclusive: true, + }], + rooms: [], + aliases: [], + }, + "de.sorunome.msc2409.push_ephemeral": true, +}; + +const options: IAppserviceOptions = { + bindAddress: "0.0.0.0", + port: 9000, + homeserverName: "localhost", + homeserverUrl: homeserverUrl, + + storage: storage, + registration: registration, + joinStrategy: new SimpleRetryJoinStrategy(), + cryptoStorage: crypto, + + intentOptions: { + encryption: true, + }, +}; + +const appservice = new Appservice(options); +// const bot = appservice.botIntent; +const bot = appservice.getIntentForUserId("@crypto_nondefault_test3:localhost"); + +(async function() { + await bot.enableEncryption(); + + let encryptedRoomId: string; + const joinedRooms = await bot.underlyingClient.getJoinedRooms(); + for (const roomId of joinedRooms) { + if (await bot.underlyingClient.crypto.isRoomEncrypted(roomId)) { + const members = await bot.underlyingClient.getJoinedRoomMembers(roomId); + if (members.length >= 2) { + encryptedRoomId = roomId; + break; + } + } + } + if (!encryptedRoomId) { + encryptedRoomId = await bot.underlyingClient.createRoom({ + invite: [dmTarget], + is_direct: true, + visibility: "private", + preset: "trusted_private_chat", + initial_state: [ + {type: "m.room.encryption", state_key: "", content: {algorithm: EncryptionAlgorithm.MegolmV1AesSha2}}, + {type: "m.room.guest_access", state_key: "", content: {guest_access: "can_join"}}, + ], + }); + } + + appservice.on("room.failed_decryption", async (roomId: string, event: any, e: Error) => { + LogService.error("index", `Failed to decrypt ${roomId} ${event['event_id']} because `, e); + }); + + appservice.on("room.message", async (roomId: string, event: any) => { + if (roomId !== encryptedRoomId) return; + + const message = new MessageEvent(event); + + if (message.sender === bot.userId && message.messageType === "m.notice") { + // yay, we decrypted our own message. Communicate that back for testing purposes. + const encrypted = await bot.underlyingClient.crypto.encryptMedia(Buffer.from(worksImage)); + const mxc = await bot.underlyingClient.uploadContent(encrypted.buffer); + await bot.underlyingClient.sendMessage(roomId, { + msgtype: "m.image", + body: "it-works.png", + info: { + // XXX: We know these details, so have hardcoded them. + w: 256, + h: 256, + mimetype: "image/png", + size: worksImage.length, + }, + file: { + url: mxc, + ...encrypted.file, + }, + }); + return; + } + + if (message.messageType === "m.image") { + const fileEvent = new MessageEvent(message.raw); + const decrypted = await bot.underlyingClient.crypto.decryptMedia(fileEvent.content.file); + fs.writeFileSync('./examples/storage/decrypted.png', decrypted); + await bot.underlyingClient.unstableApis.addReactionToEvent(roomId, fileEvent.eventId, 'Decrypted'); + return; + } + + if (message.messageType !== "m.text") return; + if (message.textBody.startsWith("!ping")) { + await bot.underlyingClient.replyNotice(roomId, event, "Pong"); + } + }); + + LogService.info("index", "Starting appservice..."); + await appservice.begin(); +})(); diff --git a/examples/encryption_bot.ts b/examples/encryption_bot.ts index 636c0023..c618f985 100644 --- a/examples/encryption_bot.ts +++ b/examples/encryption_bot.ts @@ -3,11 +3,12 @@ import { FileMessageEventContent, LogLevel, LogService, - MatrixClient, MessageEvent, + MatrixClient, + MessageEvent, RichConsoleLogger, + RustSdkCryptoStorageProvider, SimpleFsStorageProvider, } from "../src"; -import { SqliteCryptoStorageProvider } from "../src/storage/SqliteCryptoStorageProvider"; import * as fs from "fs"; LogService.setLogger(new RichConsoleLogger()); @@ -26,7 +27,7 @@ const dmTarget = creds?.['dmTarget'] ?? "@admin:localhost"; const homeserverUrl = creds?.['homeserverUrl'] ?? "http://localhost:8008"; const accessToken = creds?.['accessToken'] ?? 'YOUR_TOKEN'; const storage = new SimpleFsStorageProvider("./examples/storage/encryption_bot.json"); -const crypto = new SqliteCryptoStorageProvider("./examples/storage/encryption_bot.db"); +const crypto = new RustSdkCryptoStorageProvider("./examples/storage/encryption_bot_sled"); const worksImage = fs.readFileSync("./examples/static/it-works.png"); const client = new MatrixClient(homeserverUrl, accessToken, storage, crypto); diff --git a/jsdoc.json b/jsdoc.json index 763088ad..20727d4a 100644 --- a/jsdoc.json +++ b/jsdoc.json @@ -15,7 +15,7 @@ "opts": { "encoding": "utf8", "destination": ".jsdoc", - "readme": "README.md", + "readme": "docs/index.md", "recurse": true, "verbose": true, "template": "node_modules/better-docs" diff --git a/package.json b/package.json index 6075493a..eed02620 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "matrix-bot-sdk", - "version": "0.6.0-beta.2", + "version": "develop", "description": "TypeScript/JavaScript SDK for Matrix bots and appservices", "repository": { "type": "git", @@ -14,19 +14,21 @@ "homepage": "https://github.com/turt2live/matrix-bot-sdk#readme", "scripts": { "prepublishOnly": "yarn build", - "docs": "jsdoc -c jsdoc.json -P package.json", - "build": "tsc", + "docs": "jsdoc -c jsdoc.json -P package.json -u docs/tutorials", + "build": "tsc --listEmittedFiles", "lint": "eslint 'src/**/*.ts'", "test": "ts-mocha --project ./tsconfig.json test/*Test.ts test/**/*.ts", "build:examples": "tsc -p tsconfig-examples.json", + "example:bot": "yarn build:examples && node lib/examples/bot.js", "example:appservice": "yarn build:examples && node lib/examples/appservice.js", "example:login_register": "yarn build:examples && node lib/examples/login_register.js", - "example:encryption_bot": "yarn build:examples && node lib/examples/encryption_bot.js" + "example:encryption_bot": "yarn build:examples && node lib/examples/encryption_bot.js", + "example:encryption_appservice": "yarn build:examples && node lib/examples/encryption_appservice.js" }, "main": "./lib/index.js", "typings": "./lib/index.d.ts", "engines": { - "node": ">=10.0.0" + "node": ">=14.0.0" }, "keywords": [ "matrix", @@ -48,32 +50,28 @@ "scripts/*", "tsconfig.json" ], - "optionalDependencies": { - "better-sqlite3": "^7.4.3" - }, "dependencies": { - "@matrix-org/olm": "https://gitlab.matrix.org/api/v4/projects/27/packages/npm/@matrix-org/olm/-/@matrix-org/olm-3.2.4.tgz", + "@turt2live/matrix-sdk-crypto-nodejs": "^0.1.0-beta.10", "@types/express": "^4.17.13", "another-json": "^0.2.0", - "chalk": "^4.1.0", - "express": "^4.17.1", + "chalk": "^4", + "express": "^4.17.2", "glob-to-regexp": "^0.4.1", "hash.js": "^1.1.7", - "html-to-text": "^6.0.0", + "html-to-text": "^8.1.0", "htmlencode": "^0.0.4", - "lowdb": "^1.0.0", + "lowdb": "^1", "lru-cache": "^6.0.0", "mkdirp": "^1.0.4", "morgan": "^1.10.0", "request": "^2.88.2", "request-promise": "^4.2.6", - "sanitize-html": "^2.3.2" + "sanitize-html": "^2.6.1" }, "devDependencies": { - "@types/better-sqlite3": "^5.4.3", "@types/expect": "^24.3.0", "@types/mocha": "^8.0.1", - "@types/node": "10", + "@types/node": "^14", "@types/simple-mock": "^0.8.2", "@typescript-eslint/eslint-plugin": "^3.8.0", "@typescript-eslint/eslint-plugin-tslint": "^3.8.0", @@ -89,6 +87,6 @@ "tmp": "^0.2.1", "ts-mocha": "^7.0.0", "tslint": "^6.1.3", - "typescript": "^4.3.5" + "typescript": "^4.5.4" } } diff --git a/src/DMs.ts b/src/DMs.ts new file mode 100644 index 00000000..36ccf7d7 --- /dev/null +++ b/src/DMs.ts @@ -0,0 +1,161 @@ +import { MatrixClient } from "./MatrixClient"; +import { EncryptionAlgorithm } from "./models/Crypto"; +import { LogService } from "./logging/LogService"; +import { redactObjectForLogging } from "./http"; + +/** + * Handles DM (direct messages) matching between users. Note that bots which + * existed prior to this might not have DM rooms populated correctly - the + * account data can be populated externally and that will be reflected here. + * + * Note that DM status is persisted across all access tokens for a user and + * is not persisted with the regular stores. The DM map is instead tracked + * on the homeserver as account data and thus survives the bot's own storage + * being wiped. + * @category Utilities + */ +export class DMs { + private cached = new Map(); + private ready: Promise; + + /** + * Creates a new DM map. + * @param {MatrixClient} client The client the DM map is for. + */ + public constructor(private client: MatrixClient) { + this.client.on("account_data", (ev) => { + if (ev['type'] !== 'm.direct') return; + + // noinspection JSIgnoredPromiseFromCall + this.updateFromAccountData(); + }); + this.client.on("room.invite", (rid, ev) => this.handleInvite(rid, ev)); + } + + private async updateFromAccountData() { + // Don't trust the sync update + let map = {}; + try { + map = await this.client.getAccountData("m.direct"); + } catch (e) { + if (e.body?.errcode !== "M_NOT_FOUND" && e.statusCode !== 404) { + LogService.warn("DMs", "Error getting m.direct account data: ", e); + } + } + + this.cached = new Map(); + + for (const [userId, roomIds] of Object.entries(map)) { + this.cached.set(userId, roomIds as string[]); + } + } + + private async handleInvite(roomId: string, ev: any) { + if (ev['content']?.['is_direct'] === true) { + const userId = ev['sender']; + if (!this.cached.has(userId)) this.cached.set(userId, []); + this.cached.set(userId, [roomId, ...this.cached.get(userId)]); + await this.persistCache(); + } + } + + private async persistCache() { + const obj: Record = {}; + for (const [uid, rids] of this.cached.entries()) { + obj[uid] = rids; + } + await this.client.setAccountData("m.direct", obj); + } + + private async fixDms(userId: string) { + const currentRooms = this.cached.get(userId); + if (!currentRooms) return; + + const toKeep: string[] = []; + for (const roomId of currentRooms) { + try { + const members = await this.client.getRoomMembers(roomId); + const joined = members.filter(m => m.effectiveMembership === "join" || m.effectiveMembership === "invite"); + if (joined.some(m => m.membershipFor === userId)) { + toKeep.push(roomId); + } + } catch (e) { + LogService.warn("DMs", `Unable to check ${roomId} for room members - assuming invalid DM`); + } + } + + if (toKeep.length === currentRooms.length) return; // no change + + if (toKeep.length > 0) { + this.cached.set(userId, toKeep); + } else { + this.cached.delete(userId); + } + await this.persistCache(); + } + + /** + * Forces an update of the DM cache. + * @returns {Promise} Resolves when complete. + */ + public async update(): Promise { + await this.ready; // finish the existing call if present + this.ready = this.updateFromAccountData(); + return this.ready; + } + + /** + * Gets or creates a DM with a given user. If a DM needs to be created, it will + * be created as an encrypted DM (if both the MatrixClient and target user support + * crypto). Otherwise, the createFn can be used to override the call. Note that + * when creating a DM room the room should have `is_direct: true` set. + * @param {string} userId The user ID to get/create a DM for. + * @param {Function} createFn Optional function to use to create the room. Resolves + * to the created room ID. + * @returns {Promise} Resolves to the DM room ID. + */ + public async getOrCreateDm(userId: string, createFn?: (userId: string) => Promise): Promise { + await this.ready; + await this.fixDms(userId); + const rooms = this.cached.get(userId); + if (rooms?.length) return rooms[0]; + + let roomId: string; + if (createFn) { + roomId = await createFn(userId); + } else { + let hasKeys = false; + if (!!this.client.crypto) { + const keys = await this.client.getUserDevices([userId]); + const userKeys = keys?.device_keys?.[userId] ?? {}; + hasKeys = Object.values(userKeys).filter(device => Object.values(device).length > 0).length > 0; + } + roomId = await this.client.createRoom({ + invite: [userId], + is_direct: true, + preset: "trusted_private_chat", + initial_state: hasKeys ? [{type: "m.room.encryption", state_key: "", content: {algorithm: EncryptionAlgorithm.MegolmV1AesSha2}}] : [], + }); + } + + if (!this.cached.has(userId)) this.cached.set(userId, []); + this.cached.set(userId, [roomId, ...this.cached.get(userId)]); + await this.persistCache(); + + return roomId; + } + + /** + * Determines if a given room is a DM according to the cache. + * @param {string} roomId The room ID. + * @returns {boolean} True if the room ID is a cached DM room ID. + */ + public isDm(roomId: string): boolean { + for (const val of this.cached.values()) { + if (val.includes(roomId)) { + return true; + } + } + return false; + } +} diff --git a/src/MatrixClient.ts b/src/MatrixClient.ts index e0754c8c..17c52a48 100644 --- a/src/MatrixClient.ts +++ b/src/MatrixClient.ts @@ -29,16 +29,20 @@ import { DeviceKeyLabel, EncryptionAlgorithm, FallbackKey, + IToDeviceMessage, MultiUserDeviceListResponse, OTKAlgorithm, OTKClaimResponse, OTKCounts, OTKs, + OwnUserDevice, } from "./models/Crypto"; import { requiresCrypto } from "./e2ee/decorators"; import { ICryptoStorageProvider } from "./storage/ICryptoStorageProvider"; import { EncryptedRoomEvent } from "./models/events/EncryptedRoomEvent"; import { IWhoAmI } from "./models/Account"; +import { RustSdkCryptoStorageProvider } from "./storage/RustSdkCryptoStorageProvider"; +import { DMs } from "./DMs"; const SYNC_BACKOFF_MIN_MS = 5000; const SYNC_BACKOFF_MAX_MS = 15000; @@ -72,10 +76,16 @@ export class MatrixClient extends EventEmitter { */ public readonly crypto: CryptoClient; + /** + * The DM manager instance for this client. + */ + public readonly dms: DMs; + private userId: string; private requestId = 0; private lastJoinedRoomIds: string[] = []; private impersonatedUserId: string; + private impersonatedDeviceId: string; private joinStrategy: IJoinRoomStrategy = null; private eventProcessors: { [eventType: string]: IPreprocessor[] } = {}; private filterId = 0; @@ -114,6 +124,9 @@ export class MatrixClient extends EventEmitter { if (!this.storage || this.storage instanceof MemoryStorageProvider) { LogService.warn("MatrixClientLite", "Starting an encryption-capable client with a memory store is not considered a good idea."); } + if (!(this.cryptoStore instanceof RustSdkCryptoStorageProvider)) { + throw new Error("Cannot support custom encryption stores: Use a RustSdkCryptoStorageProvider"); + } this.crypto = new CryptoClient(this); LogService.debug("MatrixClientLite", "End-to-end encryption client created"); } else { @@ -121,6 +134,8 @@ export class MatrixClient extends EventEmitter { } if (!this.storage) this.storage = new MemoryStorageProvider(); + + this.dms = new DMs(this); } /** @@ -168,11 +183,20 @@ export class MatrixClient extends EventEmitter { * is for an application service, and that the userId given is within the reach of the * application service. Setting this to null will stop future impersonation. The user ID is * assumed to already be valid - * @param {string} userId The user ID to masquerade as + * @param {string} userId The user ID to masquerade as, or `null` to clear masquerading. + * @param {string} deviceId Optional device ID to impersonate under the given user, if supported + * by the server. Check the whoami response after setting. */ - public impersonateUserId(userId: string): void { + public impersonateUserId(userId: string | null, deviceId?: string): void { this.impersonatedUserId = userId; this.userId = userId; + if (userId) { + this.impersonatedDeviceId = deviceId; + } else if (deviceId) { + throw new Error("Cannot impersonate just a device: need a user ID"); + } else { + this.impersonatedDeviceId = null; + } } /** @@ -525,21 +549,23 @@ export class MatrixClient extends EventEmitter { * @returns {Promise} The user ID of this client */ @timedMatrixClientFunctionCall() - public getUserId(): Promise { - if (this.userId) return Promise.resolve(this.userId); + public async getUserId(): Promise { + if (this.userId) return this.userId; - return this.getWhoAmI().then(response => { - this.userId = response["user_id"]; - return this.userId; - }); + // getWhoAmI should populate `this.userId` for us + await this.getWhoAmI(); + + return this.userId; } /** * Gets the user's information from the server directly. * @returns {Promise} The "who am I" response. */ - public getWhoAmI(): Promise { - return this.doRequest("GET", "/_matrix/client/r0/account/whoami"); + public async getWhoAmI(): Promise { + const whoami = await this.doRequest("GET", "/_matrix/client/r0/account/whoami"); + this.userId = whoami["user_id"]; + return whoami; } /** @@ -555,6 +581,8 @@ export class MatrixClient extends EventEmitter { * @returns {Promise} Resolves when the client has started syncing */ public async start(filter: any = null): Promise { + await this.dms.update(); + this.stopSyncing = false; if (!filter || typeof (filter) !== "object") { LogService.trace("MatrixClientLite", "No filter given or invalid object - using defaults."); @@ -669,48 +697,29 @@ export class MatrixClient extends EventEmitter { if (!raw) return; // nothing to process - if (raw['device_one_time_keys_count']) { - this.crypto?.updateCounts(raw['device_one_time_keys_count']); - } + if (this.crypto) { + const inbox: IToDeviceMessage[] = []; + if (raw['to_device']?.['events']) { + inbox.push(...raw['to_device']['events']); + // TODO: Emit or do something with unknown messages? + } - let unusedFallbacks: string[] = null; - if (raw['org.matrix.msc2732.device_unused_fallback_key_types']) { - unusedFallbacks = raw['org.matrix.msc2732.device_unused_fallback_key_types']; - } else if (raw['device_unused_fallback_key_types']) { - unusedFallbacks = raw['device_unused_fallback_key_types']; - } + let unusedFallbacks: OTKAlgorithm[] = []; + if (raw['org.matrix.msc2732.device_unused_fallback_key_types']) { + unusedFallbacks = raw['org.matrix.msc2732.device_unused_fallback_key_types']; + } else if (raw['device_unused_fallback_key_types']) { + unusedFallbacks = raw['device_unused_fallback_key_types']; + } - // XXX: We should be able to detect the presence of the array, but Synapse doesn't tell us about - // feature support if we didn't upload one, so assume we're on a latest version of Synapse at least. - if (!unusedFallbacks?.includes(OTKAlgorithm.Signed)) { - await this.crypto?.updateFallbackKey(); - } + const counts = raw['device_one_time_keys_count'] ?? {}; - if (raw['device_lists']) { - const changed = raw['device_lists']['changed']; - const removed = raw['device_lists']['left']; + const changed = raw['device_lists']?.['changed'] ?? []; + const left = raw['device_lists']?.['left'] ?? []; - if (changed) { - this.crypto?.flagUsersDeviceListsOutdated(changed, true); - } - if (removed) { - // Don't resync removed device lists: they are uninteresting according to the server so we - // don't need them. When we request the user's device list again, we'll pull it all back in. - this.crypto?.flagUsersDeviceListsOutdated(removed, false); - } + await this.crypto.updateSyncData(inbox, counts, unusedFallbacks, changed, left); } // Always process device messages first to ensure there are decryption keys - if (raw['to_device']?.['events']) { - const inbox = raw['to_device']['events']; - for (const message of inbox) { - if (message['type'] === 'm.room.encrypted') { - await this.crypto?.processInboundDeviceMessage(message); - } else { - // TODO: Emit or do something with unknown messages? - } - } - } if (raw['groups']) { const leave = raw['groups']['leave'] || {}; @@ -1796,6 +1805,18 @@ export class MatrixClient extends EventEmitter { }); } + /** + * Gets a device list for the client's own account, with metadata. The devices are not verified + * in this response, but should be active on the account. + * @returns {Promise} Resolves to the active devices on the account. + */ + @timedMatrixClientFunctionCall() + public async getOwnDevices(): Promise { + return this.doRequest("GET", "/_matrix/client/r0/devices").then(r => { + return r['devices']; + }); + } + /** * Claims One Time Keys for a set of user devices, returning those keys. The caller is expected to verify * and validate the returned keys. @@ -1849,6 +1870,10 @@ export class MatrixClient extends EventEmitter { if (!qs) qs = {"user_id": this.impersonatedUserId}; else qs["user_id"] = this.impersonatedUserId; } + if (this.impersonatedDeviceId) { + if (!qs) qs = {"org.matrix.msc3202.device_id": this.impersonatedDeviceId}; + else qs["org.matrix.msc3202.device_id"] = this.impersonatedDeviceId; + } const headers = {}; if (this.accessToken) { headers["Authorization"] = `Bearer ${this.accessToken}`; diff --git a/src/SynapseAdminApis.ts b/src/SynapseAdminApis.ts index 34af85f2..18096deb 100644 --- a/src/SynapseAdminApis.ts +++ b/src/SynapseAdminApis.ts @@ -283,6 +283,16 @@ export class SynapseAdminApis { * @returns {Promise} Resolves when complete. */ public async deleteRoom(roomId: string): Promise { - return this.client.doRequest("POST", `/_synapse/admin/v1/rooms/${encodeURIComponent(roomId)}/delete`, {}, {purge: true}); + return this.client.doRequest("DELETE", `/_synapse/admin/v2/rooms/${encodeURIComponent(roomId)}`, {}, {purge: true}); + } + + /** + * Gets the status of all active deletion tasks, and all those completed in the last 24h, for the given room_id. + * @param {string} roomId The room ID to get deletion state for. + * @returns {Promise} Resolves to the room's deletion status results. + */ + public async getDeleteRoomState(roomId: string): Promise { + const r = await this.client.doRequest("GET", `/_synapse/admin/v2/rooms/${encodeURIComponent(roomId)}/delete_status`); + return r?.['results'] || []; } } diff --git a/src/appservice/Appservice.ts b/src/appservice/Appservice.ts index 7091547c..d59dc734 100644 --- a/src/appservice/Appservice.ts +++ b/src/appservice/Appservice.ts @@ -2,14 +2,17 @@ import * as express from "express"; import { Intent } from "./Intent"; import { AppserviceJoinRoomStrategy, + EncryptedRoomEvent, EventKind, + IAppserviceCryptoStorageProvider, IAppserviceStorageProvider, IJoinRoomStrategy, IPreprocessor, LogService, MatrixClient, MemoryStorageProvider, - Metrics + Metrics, + OTKAlgorithm, } from ".."; import { EventEmitter } from "events"; import * as morgan from "morgan"; @@ -17,6 +20,13 @@ import { MatrixBridge } from "./MatrixBridge"; import * as LRU from "lru-cache"; import { IApplicationServiceProtocol } from "./http_responses"; +const EDU_ANNOTATION_KEY = "io.t2bot.sdk.bot.type"; + +enum EduAnnotation { + ToDevice = "to_device", + Ephemeral = "ephemeral", +} + /** * Represents an application service's registration file. This is expected to be * loaded from another source, such as a YAML file. @@ -157,6 +167,12 @@ export interface IAppserviceOptions { */ storage?: IAppserviceStorageProvider; + /** + * The storage provider to use for setting up encryption. Encryption will be + * disabled for all intents and the appservice if not configured. + */ + cryptoStorage?: IAppserviceCryptoStorageProvider; + /** * The registration for this application service. */ @@ -181,6 +197,17 @@ export interface IAppserviceOptions { * the maximum number of intents has been reached. Defaults to 60 minutes. */ maxAgeMs?: number; + + /** + * If false (default), crypto will not be automatically set up for all intent + * instances - it will need to be manually enabled with + * `await intent.enableEncryption()`. + * + * If true, crypto will be automatically set up. + * + * Note that the appservice bot account is considered an intent. + */ + encryption?: boolean; }; } @@ -202,6 +229,7 @@ export class Appservice extends EventEmitter { private readonly aliasPrefix: string | null; private readonly registration: IAppserviceRegistration; private readonly storage: IAppserviceStorageProvider; + private readonly cryptoStorage: IAppserviceCryptoStorageProvider; private readonly bridgeInstance = new MatrixBridge(this); private app = express(); @@ -237,6 +265,7 @@ export class Appservice extends EventEmitter { this.storage = options.storage || new MemoryStorageProvider(); options.storage = this.storage; + this.cryptoStorage = options.cryptoStorage; this.app.use(express.json({limit: Number.MAX_SAFE_INTEGER})); // disable limits, use a reverse proxy this.app.use(morgan("combined")); @@ -333,7 +362,13 @@ export class Appservice extends EventEmitter { public begin(): Promise { return new Promise((resolve, reject) => { this.appServer = this.app.listen(this.options.port, this.options.bindAddress, () => resolve()); - }).then(() => this.botIntent.ensureRegistered()); + }).then(async () => { + if (this.options.intentOptions?.encryption) { + await this.botIntent.enableEncryption(); + } else { + await this.botIntent.ensureRegistered(); + } + }); } /** @@ -393,10 +428,16 @@ export class Appservice extends EventEmitter { * @returns {Intent} An Intent for the user. */ public getIntentForUserId(userId: string): Intent { - let intent = this.intentsCache.get(userId); + let intent: Intent = this.intentsCache.get(userId); if (!intent) { intent = new Intent(this.options, userId, this); this.intentsCache.set(userId, intent); + if (this.options.intentOptions.encryption) { + intent.enableEncryption().catch(e => { + LogService.error("Appservice", `Failed to set up crypto on intent ${userId}`, e); + throw e; // re-throw to cause unhandled exception + }); + } } return intent; } @@ -623,9 +664,147 @@ export class Appservice extends EventEmitter { LogService.info("Appservice", "Processing transaction " + txnId); this.pendingTransactions[txnId] = new Promise(async (resolve) => { + // Process all the crypto stuff first to ensure that future transactions (if not this one) + // will decrypt successfully. We start with EDUs because we need structures to put counts + // and such into in a later stage, and EDUs are independent of crypto. + + const byUserId: { + [userId: string]: { + counts: Record; + toDevice: any[]; + unusedFallbacks: OTKAlgorithm[]; + }; + } = {}; + + const orderedEdus = []; + if (Array.isArray(req.body["de.sorunome.msc2409.to_device"])) { + orderedEdus.push(...req.body["de.sorunome.msc2409.to_device"].map(e => ({ + ...e, + unsigned: { + ...e['unsigned'], + [EDU_ANNOTATION_KEY]: EduAnnotation.ToDevice, + }, + }))); + } + if (Array.isArray(req.body["de.sorunome.msc2409.ephemeral"])) { + orderedEdus.push(...req.body["de.sorunome.msc2409.ephemeral"].map(e => ({ + ...e, + unsigned: { + ...e['unsigned'], + [EDU_ANNOTATION_KEY]: EduAnnotation.Ephemeral, + }, + }))); + } + for (let event of orderedEdus) { + if (event['edu_type']) event['type'] = event['edu_type']; // handle property change during MSC2409's course + + LogService.info("Appservice", `Processing ${event['unsigned'][EDU_ANNOTATION_KEY]} event of type ${event["type"]}`); + event = await this.processEphemeralEvent(event); + + // These events aren't tied to rooms, so just emit them generically + this.emit("ephemeral.event", event); + + if (event["type"] === "m.room.encrypted" || event[EDU_ANNOTATION_KEY] === EduAnnotation.ToDevice) { + const toUser = event["to_user_id"]; + const intent = this.getIntentForUserId(toUser); + await intent.enableEncryption(); + + if (!byUserId[toUser]) byUserId[toUser] = {counts: null, toDevice: null, unusedFallbacks: null}; + if (!byUserId[toUser].toDevice) byUserId[toUser].toDevice = []; + byUserId[toUser].toDevice.push(event); + } + } + + if (this.cryptoStorage) { + const deviceLists: {changed: string[], removed: string[]} = req.body["org.matrix.msc3202.device_lists"] ?? { changed: [], removed: [] }; + + const otks = req.body["org.matrix.msc3202.device_one_time_key_counts"]; + if (otks) { + for (const userId of Object.keys(otks)) { + const intent = this.getIntentForUserId(userId); + await intent.enableEncryption(); + const otksForUser = otks[userId][intent.underlyingClient.crypto.clientDeviceId]; + if (otksForUser) { + if (!byUserId[userId]) byUserId[userId] = {counts: null, toDevice: null, unusedFallbacks: null}; + byUserId[userId].counts = otksForUser; + } + } + } + + const fallbacks = req.body["org.matrix.msc3202.device_unused_fallback_key_types"]; + if (fallbacks) { + for (const userId of Object.keys(fallbacks)) { + const intent = this.getIntentForUserId(userId); + await intent.enableEncryption(); + const fallbacksForUser = fallbacks[userId][intent.underlyingClient.crypto.clientDeviceId]; + if (Array.isArray(fallbacksForUser) && !fallbacksForUser.includes(OTKAlgorithm.Signed)) { + if (!byUserId[userId]) byUserId[userId] = {counts: null, toDevice: null, unusedFallbacks: null}; + byUserId[userId].unusedFallbacks = fallbacksForUser; + } + } + } + + for (const userId of Object.keys(byUserId)) { + const intent = this.getIntentForUserId(userId); + await intent.enableEncryption(); + const info = byUserId[userId]; + const userStorage = this.storage.storageForUser(userId); + + if (!info.toDevice) info.toDevice = []; + if (!info.unusedFallbacks) info.unusedFallbacks = JSON.parse(await userStorage.readValue("last_unused_fallbacks") || "[]"); + if (!info.counts) info.counts = JSON.parse(await userStorage.readValue("last_counts") || "{}"); + + LogService.info("Appservice", `Updating crypto state for ${userId}`); + await intent.underlyingClient.crypto.updateSyncData(info.toDevice, info.counts, info.unusedFallbacks, deviceLists.changed, deviceLists.removed); + } + } + for (let event of req.body["events"]) { LogService.info("Appservice", `Processing event of type ${event["type"]}`); event = await this.processEvent(event); + if (event['type'] === 'm.room.encrypted' && this.cryptoStorage) { + this.emit("room.encrypted_event", event["room_id"], event); + try { + const encrypted = new EncryptedRoomEvent(event); + const roomId = event['room_id']; + try { + event = (await this.botClient.crypto.decryptRoomEvent(encrypted, roomId)).raw; + event = await this.processEvent(event); + this.emit("room.decrypted_event", roomId, event); + + // For logging purposes: show that the event was decrypted + LogService.info("Appservice", `Processing decrypted event of type ${event["type"]}`); + } catch (e1) { + LogService.warn("Appservice", `Bot client was not able to decrypt ${roomId} ${event['event_id']} - trying other intents`); + + let tryUserId: string; + try { + // TODO: This could be more efficient + const userIdsInRoom = await this.botClient.getJoinedRoomMembers(roomId); + tryUserId = userIdsInRoom.find(u => this.isNamespacedUser(u)); + } catch (e) { + LogService.error("Appservice", "Failed to get members of room - cannot decrypt message"); + } + + if (tryUserId) { + const intent = this.getIntentForUserId(tryUserId); + + event = (await intent.underlyingClient.crypto.decryptRoomEvent(encrypted, roomId)).raw; + event = await this.processEvent(event); + this.emit("room.decrypted_event", roomId, event); + + // For logging purposes: show that the event was decrypted + LogService.info("Appservice", `Processing decrypted event of type ${event["type"]}`); + } else { + // noinspection ExceptionCaughtLocallyJS + throw e1; + } + } + } catch (e) { + LogService.error("Appservice", `Decryption error on ${event['room_id']} ${event['event_id']}`, e); + this.emit("room.failed_decryption", event['room_id'], event, e); + } + } this.emit("room.event", event["room_id"], event); if (event['type'] === 'm.room.message') { this.emit("room.message", event["room_id"], event); @@ -641,15 +820,6 @@ export class Appservice extends EventEmitter { } } - if (this.registration["de.sorunome.msc2409.push_ephemeral"] && req.body["de.sorunome.msc2409.ephemeral"]) { - for (let event of req.body["de.sorunome.msc2409.ephemeral"]) { - LogService.info("Appservice", `Processing ephemeral event of type ${event["type"]}`); - event = await this.processEphemeralEvent(event); - // These events aren't tied to rooms, so just emit them generically - this.emit("ephemeral.event", event); - } - } - resolve(); }); diff --git a/src/appservice/Intent.ts b/src/appservice/Intent.ts index b3d70298..4a31e970 100644 --- a/src/appservice/Intent.ts +++ b/src/appservice/Intent.ts @@ -1,4 +1,13 @@ -import { extractRequestError, IAppserviceStorageProvider, LogService, MatrixClient, Metrics } from ".."; +import { + DeviceKeyAlgorithm, + extractRequestError, + IAppserviceCryptoStorageProvider, + IAppserviceStorageProvider, + ICryptoStorageProvider, + LogService, + MatrixClient, + Metrics +} from ".."; import { Appservice, IAppserviceOptions } from "./Appservice"; // noinspection TypeScriptPreferShortImport @@ -21,11 +30,13 @@ export class Intent { */ public readonly metrics: Metrics; - private readonly client: MatrixClient; private readonly storage: IAppserviceStorageProvider; - private readonly unstableApisInstance: UnstableAppserviceApis; + private readonly cryptoStorage: IAppserviceCryptoStorageProvider; + private client: MatrixClient; + private unstableApisInstance: UnstableAppserviceApis; private knownJoinedRooms: string[] = []; + private cryptoSetupPromise: Promise; /** * Creates a new intent. Intended to be created by application services. @@ -33,14 +44,34 @@ export class Intent { * @param {string} impersonateUserId The user ID to impersonate. * @param {Appservice} appservice The application service itself. */ - constructor(options: IAppserviceOptions, private impersonateUserId: string, private appservice: Appservice) { + constructor(private options: IAppserviceOptions, private impersonateUserId: string, private appservice: Appservice) { this.metrics = new Metrics(appservice.metrics); - this.client = new MatrixClient(options.homeserverUrl, options.registration.as_token); - this.client.metrics = new Metrics(appservice.metrics); // Metrics only go up by one parent - this.unstableApisInstance = new UnstableAppserviceApis(this.client); this.storage = options.storage; - if (impersonateUserId !== appservice.botUserId) this.client.impersonateUserId(impersonateUserId); - if (options.joinStrategy) this.client.setJoinStrategy(options.joinStrategy); + this.cryptoStorage = options.cryptoStorage; + this.makeClient(false); + } + + private makeClient(withCrypto: boolean, accessToken?: string) { + let cryptoStore: ICryptoStorageProvider; + const storage = this.storage?.storageForUser?.(this.userId); + if (withCrypto) { + cryptoStore = this.cryptoStorage?.storageForUser(this.userId); + if (!cryptoStore) { + throw new Error("Tried to set up client with crypto when not available"); + } + if (!storage) { + throw new Error("Tried to set up client with crypto, but no persistent storage"); + } + } + this.client = new MatrixClient(this.options.homeserverUrl, accessToken ?? this.options.registration.as_token, storage, cryptoStore); + this.client.metrics = new Metrics(this.appservice.metrics); // Metrics only go up by one parent + this.unstableApisInstance = new UnstableAppserviceApis(this.client); + if (this.impersonateUserId !== this.appservice.botUserId) { + this.client.impersonateUserId(this.impersonateUserId); + } + if (this.options.joinStrategy) { + this.client.setJoinStrategy(this.options.joinStrategy); + } } /** @@ -66,6 +97,88 @@ export class Intent { return this.unstableApisInstance; } + /** + * Sets up crypto on the client if it hasn't already been set up. + * @returns {Promise} Resolves when complete. + */ + @timedIntentFunctionCall() + public async enableEncryption(): Promise { + if (!this.cryptoSetupPromise) { + this.cryptoSetupPromise = new Promise(async (resolve, reject) => { + try { + // Prepare a client first + await this.ensureRegistered(); + const storage = this.storage?.storageForUser?.(this.userId); + this.client.impersonateUserId(this.userId); // make sure the devices call works + + const cryptoStore = this.cryptoStorage?.storageForUser(this.userId); + if (!cryptoStore) { + // noinspection ExceptionCaughtLocallyJS + throw new Error("Failed to create crypto store"); + } + + // Try to impersonate a device ID + const ownDevices = await this.client.getOwnDevices(); + let deviceId = await cryptoStore.getDeviceId(); + if (!deviceId || !ownDevices.some(d => d.device_id === deviceId)) { + const deviceKeys = await this.client.getUserDevices([this.userId]); + const userDeviceKeys = deviceKeys.device_keys[this.userId]; + if (userDeviceKeys) { + // We really should be validating signatures here, but we're actively looking + // for devices without keys to impersonate, so it should be fine. In theory, + // those devices won't even be present but we're cautious. + const devicesWithKeys = Array.from(Object.entries(userDeviceKeys)) + .filter(d => d[0] === d[1].device_id && !!d[1].keys?.[`${DeviceKeyAlgorithm.Curve25519}:${d[1].device_id}`]) + deviceId = devicesWithKeys[0]?.[1]?.device_id; + } + } + let prepared = false; + if (deviceId) { + this.makeClient(true); + this.client.impersonateUserId(this.userId, deviceId); + + // verify that the server supports impersonating the device + const respDeviceId = (await this.client.getWhoAmI()).device_id; + prepared = (respDeviceId === deviceId); + } + + if (!prepared) { + // XXX: We work around servers that don't support device_id impersonation + const accessToken = await Promise.resolve(storage?.readValue("accessToken")); + if (!accessToken) { + const loginBody = { + type: "uk.half-shot.msc2778.login.application_service", + identifier: { + type: "m.id.user", + user: this.userId, + }, + }; + this.client.impersonateUserId(null); // avoid confusing homeserver + const res = await this.client.doRequest("POST", "/_matrix/client/r0/login", {}, loginBody); + this.makeClient(true, res['access_token']); + storage.storeValue("accessToken", this.client.accessToken); + prepared = true; + } else { + this.makeClient(true, accessToken); + prepared = true; + } + } + + if (!prepared) {// noinspection ExceptionCaughtLocallyJS + throw new Error("Unable to establish a device ID"); + } + + // Now set up crypto + await this.client.crypto.prepare(await this.client.getJoinedRooms()); + resolve(); + } catch (e) { + reject(e); + } + }); + } + return this.cryptoSetupPromise; + } + /** * Gets the joined rooms for the intent. Note that by working around * the intent to join rooms may yield inaccurate results. diff --git a/src/e2ee/CryptoClient.ts b/src/e2ee/CryptoClient.ts index 870a9220..db7bcee2 100644 --- a/src/e2ee/CryptoClient.ts +++ b/src/e2ee/CryptoClient.ts @@ -1,39 +1,27 @@ import { MatrixClient } from "../MatrixClient"; import { LogService } from "../logging/LogService"; -import * as Olm from "@matrix-org/olm"; -import * as crypto from "crypto"; -import * as anotherJson from "another-json"; import { DeviceKeyAlgorithm, - EncryptionAlgorithm, - FallbackKey, IMegolmEncrypted, - IMRoomKey, IOlmEncrypted, - IOlmPayload, - IOlmSession, IToDeviceMessage, OTKAlgorithm, OTKCounts, - OTKs, Signatures, - SignedCurve25519OTK, - UserDevice, } from "../models/Crypto"; import { requiresReady } from "./decorators"; import { RoomTracker } from "./RoomTracker"; -import { DeviceTracker } from "./DeviceTracker"; -import { EncryptionEvent } from "../models/events/EncryptionEvent"; import { EncryptedRoomEvent } from "../models/events/EncryptedRoomEvent"; import { RoomEvent } from "../models/events/RoomEvent"; import { EncryptedFile } from "../models/events/MessageEvent"; import { - decodeUnpaddedBase64, - decodeUnpaddedUrlSafeBase64, - encodeUnpaddedBase64, - encodeUnpaddedUrlSafeBase64, -} from "../b64"; -import { PassThrough } from "stream"; + decryptFile as rustDecryptFile, + encryptFile as rustEncryptFile, + OlmMachine, +} from "@turt2live/matrix-sdk-crypto-nodejs"; +import { RustSdkCryptoStorageProvider } from "../storage/RustSdkCryptoStorageProvider"; +import { SdkOlmEngine } from "./SdkOlmEngine"; +import { InternalOlmMachineFactory } from "./InternalOlmMachineFactory"; /** * Manages encryption for a MatrixClient. Get an instance from a MatrixClient directly @@ -43,16 +31,17 @@ import { PassThrough } from "stream"; export class CryptoClient { private ready = false; private deviceId: string; - private pickleKey: string; private deviceEd25519: string; private deviceCurve25519: string; - private maxOTKs: number; private roomTracker: RoomTracker; - private deviceTracker: DeviceTracker; + private machine: OlmMachine; public constructor(private client: MatrixClient) { this.roomTracker = new RoomTracker(this.client); - this.deviceTracker = new DeviceTracker(this.client); + } + + private get storage(): RustSdkCryptoStorageProvider { + return this.client.cryptoStore; } /** @@ -70,18 +59,6 @@ export class CryptoClient { return this.ready; } - private async getOlmAccount(): Promise { - const account = new Olm.Account(); - account.unpickle(this.pickleKey, await this.client.cryptoStore.getPickledAccount()); - return account; - } - - private async storeAndFreeOlmAccount(account: Olm.Account) { - const pickled = account.pickle(this.pickleKey); - await this.client.cryptoStore.setPickledAccount(pickled); - account.free(); - } - /** * Prepares the crypto client for usage. * @param {string[]} roomIds The room IDs the MatrixClient is joined to. @@ -89,6 +66,8 @@ export class CryptoClient { public async prepare(roomIds: string[]) { await this.roomTracker.prepare(roomIds); + if (this.ready) return; // stop re-preparing here + const storedDeviceId = await this.client.cryptoStore.getDeviceId(); if (storedDeviceId) { this.deviceId = storedDeviceId; @@ -103,52 +82,14 @@ export class CryptoClient { LogService.debug("CryptoClient", "Starting with device ID:", this.deviceId); - // We should be in a ready enough shape to kick off Olm - await Olm.init(); - - let pickled = await this.client.cryptoStore.getPickledAccount(); - let pickleKey = await this.client.cryptoStore.getPickleKey(); - - const account = new Olm.Account(); + this.machine = new InternalOlmMachineFactory(await this.client.getUserId(), this.deviceId, new SdkOlmEngine(this.client), this.storage.storagePath).build(); + await this.machine.runEngine(); - const makeReady = () => { - const keys = JSON.parse(account.identity_keys()); - this.deviceCurve25519 = keys['curve25519']; - this.deviceEd25519 = keys['ed25519']; - - this.pickleKey = pickleKey; - this.maxOTKs = account.max_number_of_one_time_keys(); - this.ready = true; - }; + const identity = this.machine.identityKeys; + this.deviceCurve25519 = identity[DeviceKeyAlgorithm.Curve25519]; + this.deviceEd25519 = identity[DeviceKeyAlgorithm.Ed25519]; - try { - if (!pickled || !pickleKey) { - LogService.debug("CryptoClient", "Creating new Olm account: previous session lost or not set up"); - - account.create(); - pickleKey = crypto.randomBytes(64).toString('hex'); - pickled = account.pickle(pickleKey); - await this.client.cryptoStore.setPickleKey(pickleKey); - await this.client.cryptoStore.setPickledAccount(pickled); - - makeReady(); - - const counts = await this.client.uploadDeviceKeys([ - EncryptionAlgorithm.MegolmV1AesSha2, - EncryptionAlgorithm.OlmV1Curve25519AesSha2, - ], { - [`${DeviceKeyAlgorithm.Ed25519}:${this.deviceId}`]: this.deviceEd25519, - [`${DeviceKeyAlgorithm.Curve25519}:${this.deviceId}`]: this.deviceCurve25519, - }); - await this.updateCounts(counts); - } else { - account.unpickle(pickleKey, pickled); - makeReady(); - await this.updateCounts(await this.client.checkOneTimeKeyCounts()); - } - } finally { - account.free(); - } + this.ready = true; } /** @@ -163,65 +104,17 @@ export class CryptoClient { } /** - * Updates the One Time Key counts, potentially triggering an async upload of more - * one time keys. - * @param {OTKCounts} counts The current counts to work within. + * Updates the client's sync-related data. + * @param {IToDeviceMessage} toDeviceMessages The to-device messages received. + * @param {OTKCounts} otkCounts The current OTK counts. + * @param {OTKAlgorithm[]} unusedFallbackKeyAlgs The unused fallback key algorithms. + * @param {string[]} changedDeviceLists The user IDs which had device list changes. + * @param {string[]} leftDeviceLists The user IDs which the server believes we no longer need to track. * @returns {Promise} Resolves when complete. */ @requiresReady() - public async updateCounts(counts: OTKCounts) { - const have = counts[OTKAlgorithm.Signed] || 0; - const need = Math.floor(this.maxOTKs / 2) - have; - if (need <= 0) return; - - LogService.debug("CryptoClient", `Creating ${need} more OTKs`); - - const account = await this.getOlmAccount(); - try { - account.generate_one_time_keys(need); - const { curve25519: keys } = JSON.parse(account.one_time_keys()); - const signed: OTKs = {}; - for (const keyId in keys) { - if (!keys.hasOwnProperty(keyId)) continue; - const obj = {key: keys[keyId]}; - obj['signatures'] = await this.sign(obj); - signed[`${OTKAlgorithm.Signed}:${keyId}`] = obj; - } - await this.client.uploadDeviceOneTimeKeys(signed); - account.mark_keys_as_published(); - } finally { - await this.storeAndFreeOlmAccount(account); - } - } - - /** - * Updates the client's fallback key. - * @returns {Promise} Resolves when complete. - */ - @requiresReady() - public async updateFallbackKey(): Promise { - const account = await this.getOlmAccount(); - try { - account.generate_fallback_key(); - - const key = JSON.parse(account.fallback_key()); - const keyId = Object.keys(key[OTKAlgorithm.Unsigned])[0]; - const obj: Partial = { - key: key[OTKAlgorithm.Unsigned][keyId], - fallback: true, - }; - const signatures = await this.sign(obj); - const fallback: FallbackKey = { - keyId: keyId, - key: { - ...obj, - signatures: signatures, - } as SignedCurve25519OTK & {fallback: true}, - }; - await this.client.uploadFallbackKey(fallback); - } finally { - await this.storeAndFreeOlmAccount(account); - } + public async updateSyncData(toDeviceMessages: IToDeviceMessage[], otkCounts: OTKCounts, unusedFallbackKeyAlgs: OTKAlgorithm[], changedDeviceLists: string[], leftDeviceLists: string[]): Promise { + await this.machine.pushSync(toDeviceMessages, {changed: changedDeviceLists, left: leftDeviceLists}, otkCounts, unusedFallbackKeyAlgs); } /** @@ -237,205 +130,11 @@ export class CryptoClient { delete obj['signatures']; delete obj['unsigned']; - const account = await this.getOlmAccount(); - try { - const sig = account.sign(anotherJson.stringify(obj)); - return { - [await this.client.getUserId()]: { - [`${DeviceKeyAlgorithm.Ed25519}:${this.deviceId}`]: sig, - }, - ...existingSignatures, - }; - } finally { - account.free(); - } - } - - /** - * Verifies a signature on an object. - * @param {object} obj The signed object. - * @param {string} key The key which has supposedly signed the object. - * @param {string} signature The advertised signature. - * @returns {Promise} Resolves to true if a valid signature, false otherwise. - */ - @requiresReady() - public async verifySignature(obj: object, key: string, signature: string): Promise { - obj = JSON.parse(JSON.stringify(obj)); - - delete obj['signatures']; - delete obj['unsigned']; - - const util = new Olm.Utility(); - try { - const message = anotherJson.stringify(obj); - util.ed25519_verify(key, message, signature); - } catch (e) { - // Assume it's a verification failure - return false; - } finally { - util.free(); - } - - return true; - } - - /** - * Flags multiple user's device lists as outdated, optionally queuing an immediate update. - * @param {string} userIds The user IDs to flag the device lists of. - * @param {boolean} resync True (default) to queue an immediate update, false otherwise. - * @returns {Promise} Resolves when the device lists have been flagged. Will also wait - * for the resync if one was requested. - */ - @requiresReady() - public flagUsersDeviceListsOutdated(userIds: string[], resync = true): Promise { - return this.deviceTracker.flagUsersOutdated(userIds, resync); - } - - /** - * Gets or creates Olm sessions for the given users and devices. Where sessions cannot be created, - * the user/device will be excluded from the returned map. - * @param {Record} userDeviceMap Map of user IDs to device IDs - * @param {boolean} force If true, force creation of a session for the referenced users. - * @returns {Promise>>} Resolves to a map of user ID to device - * ID to session. Users/devices which cannot have sessions made will not be included, thus the object - * may be empty. - */ - @requiresReady() - public async getOrCreateOlmSessions(userDeviceMap: Record, force = false): Promise>> { - const otkClaimRequest: Record> = {}; - const userDeviceSessionIds: Record> = {}; - - const myUserId = await this.client.getUserId(); - const myDeviceId = this.clientDeviceId; - for (const userId of Object.keys(userDeviceMap)) { - for (const deviceId of userDeviceMap[userId]) { - if (userId === myUserId && deviceId === myDeviceId) { - // Skip creating a session for our own device - continue; - } - - const existingSession = force ? null : (await this.client.cryptoStore.getCurrentOlmSession(userId, deviceId)); - if (existingSession) { - if (!userDeviceSessionIds[userId]) userDeviceSessionIds[userId] = {}; - userDeviceSessionIds[userId][deviceId] = existingSession; - } else { - if (!otkClaimRequest[userId]) otkClaimRequest[userId] = {}; - otkClaimRequest[userId][deviceId] = OTKAlgorithm.Signed; - } - } - } - - if (Object.keys(otkClaimRequest).length > 0) { - const claimed = await this.client.claimOneTimeKeys(otkClaimRequest); - for (const userId of Object.keys(claimed.one_time_keys)) { - if (!otkClaimRequest[userId]) { - LogService.warn("CryptoClient", `Server injected unexpected user: ${userId} - not claiming keys`); - continue; - } - const storedDevices = await this.client.cryptoStore.getActiveUserDevices(userId); - for (const deviceId of Object.keys(claimed.one_time_keys[userId])) { - try { - if (!otkClaimRequest[userId][deviceId]) { - LogService.warn("CryptoClient", `Server provided an unexpected device in claim response (skipping): ${userId} ${deviceId}`); - continue; - } - - const device = storedDevices.find(d => d.user_id === userId && d.device_id === deviceId); - if (!device) { - LogService.warn("CryptoClient", `Failed to handle claimed OTK: unable to locate stored device for user: ${userId} ${deviceId}`); - continue; - } - - const deviceKeyLabel = `${DeviceKeyAlgorithm.Ed25519}:${deviceId}`; - - const keyId = Object.keys(claimed.one_time_keys[userId][deviceId])[0]; - const signedKey = claimed.one_time_keys[userId][deviceId][keyId]; - const signature = signedKey?.signatures?.[userId]?.[deviceKeyLabel]; - if (!signature) { - LogService.warn("CryptoClient", `Failed to find appropriate signature for claimed OTK ${userId} ${deviceId}`); - continue; - } - - const verified = await this.verifySignature(signedKey, device.keys[deviceKeyLabel], signature); - if (!verified) { - LogService.warn("CryptoClient", `Invalid signature for claimed OTK ${userId} ${deviceId}`); - continue; - } - - // TODO: Handle spec rate limiting - // Clients should rate-limit the number of sessions it creates per device that it receives a message - // from. Clients should not create a new session with another device if it has already created one - // for that given device in the past 1 hour. - - // Finally, we can create a session. We do this on each loop just in case something goes wrong given - // we don't have app-level transaction support here. We want to persist as many outbound sessions as - // we can before exploding. - const account = await this.getOlmAccount(); - const session = new Olm.Session(); - try { - const curveDeviceKey = device.keys[`${DeviceKeyAlgorithm.Curve25519}:${deviceId}`]; - session.create_outbound(account, curveDeviceKey, signedKey.key); - const storedSession: IOlmSession = { - sessionId: session.session_id(), - lastDecryptionTs: Date.now(), - pickled: session.pickle(this.pickleKey), - }; - await this.client.cryptoStore.storeOlmSession(userId, deviceId, storedSession); - - if (!userDeviceSessionIds[userId]) userDeviceSessionIds[userId] = {}; - userDeviceSessionIds[userId][deviceId] = storedSession; - } finally { - session.free(); - await this.storeAndFreeOlmAccount(account); - } - } catch (e) { - LogService.warn("CryptoClient", `Unable to verify signature of claimed OTK ${userId} ${deviceId}:`, e); - } - } - } - } - - return userDeviceSessionIds; - } - - @requiresReady() - private async encryptAndSendOlmMessage(device: UserDevice, session: IOlmSession, type: string, content: any): Promise { - const olmSession = new Olm.Session(); - try { - olmSession.unpickle(this.pickleKey, session.pickled); - const payload: IOlmPayload = { - keys: { - ed25519: this.deviceEd25519, - }, - recipient_keys: { - ed25519: device.keys[`${DeviceKeyAlgorithm.Ed25519}:${device.device_id}`], - }, - recipient: device.user_id, - sender: await this.client.getUserId(), - content: content, - type: type, - }; - const encrypted = olmSession.encrypt(JSON.stringify(payload)); - await this.client.cryptoStore.storeOlmSession(device.user_id, device.device_id, { - pickled: olmSession.pickle(this.pickleKey), - lastDecryptionTs: session.lastDecryptionTs, - sessionId: olmSession.session_id(), - }); - const message: IOlmEncrypted = { - algorithm: EncryptionAlgorithm.OlmV1Curve25519AesSha2, - ciphertext: { - [device.keys[`${DeviceKeyAlgorithm.Curve25519}:${device.device_id}`]]: encrypted as any, - }, - sender_key: this.deviceCurve25519, - }; - await this.client.sendToDevices("m.room.encrypted", { - [device.user_id]: { - [device.device_id]: message, - }, - }); - } finally { - olmSession.free(); - } + const sig = await this.machine.sign(obj); + return { + ...sig, + ...existingSignatures, + }; } /** @@ -455,114 +154,8 @@ export class CryptoClient { throw new Error("Room is not encrypted"); } - let relatesTo: any; - if (content['m.relates_to']) { - relatesTo = JSON.parse(JSON.stringify(content['m.relates_to'])); - delete content['m.relates_to']; - } - - const now = (new Date()).getTime(); - - let currentSession = await this.client.cryptoStore.getCurrentOutboundGroupSession(roomId); - if (currentSession && (currentSession.expiresTs <= now || currentSession.usesLeft <= 0)) { - currentSession = null; // force rotation - } - if (!currentSession) { - // Make a new session, either because we don't have one or it rotated. - const roomConfig = new EncryptionEvent({ - type: "m.room.encryption", - state_key: "", - content: await this.roomTracker.getRoomCryptoConfig(roomId), - }); - - const newSession = new Olm.OutboundGroupSession(); - try { - newSession.create(); - const pickled = newSession.pickle(this.pickleKey); - currentSession = { - sessionId: newSession.session_id(), - roomId: roomId, - pickled: pickled, - isCurrent: true, - usesLeft: roomConfig.rotationPeriodMessages, - expiresTs: now + roomConfig.rotationPeriodMs, - }; - - // Store the session as an inbound session up front. This is to ensure that we have the - // earliest possible ratchet available to our own decryption functions. We don't store - // the outbound session here as it is stored earlier on. - await this.storeInboundGroupSession({ - room_id: roomId, - session_id: newSession.session_id(), - session_key: newSession.session_key(), - algorithm: EncryptionAlgorithm.MegolmV1AesSha2, - }, await this.client.getUserId(), this.clientDeviceId); - } finally { - newSession.free(); - } - } - - // TODO: Include invited members? - const memberUserIds = await this.client.getJoinedRoomMembers(roomId); - const devices = await this.deviceTracker.getDevicesFor(memberUserIds); - - const session = new Olm.OutboundGroupSession(); - try { - session.unpickle(this.pickleKey, currentSession.pickled); - - const neededSessions: Record = {}; - for (const userId of Object.keys(devices)) { - neededSessions[userId] = devices[userId].map(d => d.device_id); - } - const olmSessions = await this.getOrCreateOlmSessions(neededSessions); - - for (const userId of Object.keys(devices)) { - for (const device of devices[userId]) { - const olmSession = olmSessions[userId]?.[device.device_id]; - if (!olmSession) { - LogService.warn("CryptoClient", `Unable to send Megolm session to ${userId} ${device.device_id}: No Olm session`); - continue; - } - const lastSession = await this.client.cryptoStore.getLastSentOutboundGroupSession(userId, device.device_id, roomId); - if (lastSession?.sessionId !== session.session_id() || session.message_index() < (lastSession?.index ?? Number.MAX_SAFE_INTEGER)) { - await this.encryptAndSendOlmMessage(device, olmSession, "m.room_key", { - algorithm: EncryptionAlgorithm.MegolmV1AesSha2, - room_id: roomId, - session_id: session.session_id(), - session_key: session.session_key(), - }); - await this.client.cryptoStore.storeSentOutboundGroupSession(currentSession, session.message_index(), device); - } - } - } - - // Encrypt after to avoid UNKNOWN_MESSAGE_INDEX errors on remote end - const encrypted = session.encrypt(JSON.stringify({ - type: eventType, - content: content, - room_id: roomId, - })); - - currentSession.pickled = session.pickle(this.pickleKey); - currentSession.usesLeft--; - await this.client.cryptoStore.storeOutboundGroupSession(currentSession); - - const body = { - sender_key: this.deviceCurve25519, - ciphertext: encrypted, - session_id: session.session_id(), - device_id: this.clientDeviceId, - }; - if (relatesTo) { - body['m.relates_to'] = relatesTo; - } - return { - ...body, - algorithm: EncryptionAlgorithm.MegolmV1AesSha2, - }; - } finally { - session.free(); - } + const encrypted = await this.machine.encryptRoomEvent(roomId, eventType, content); + return encrypted as IMegolmEncrypted; } /** @@ -574,231 +167,13 @@ export class CryptoClient { */ @requiresReady() public async decryptRoomEvent(event: EncryptedRoomEvent, roomId: string): Promise> { - if (event.algorithm !== EncryptionAlgorithm.MegolmV1AesSha2) { - throw new Error("Unable to decrypt: Unknown algorithm"); - } - - const encrypted = event.megolmProperties; - const senderDevice = await this.client.cryptoStore.getActiveUserDevice(event.sender, encrypted.device_id); - if (!senderDevice) { - throw new Error("Unable to decrypt: Unknown device for sender"); - } - - if (senderDevice.keys[`${DeviceKeyAlgorithm.Curve25519}:${senderDevice.device_id}`] !== encrypted.sender_key) { - throw new Error("Unable to decrypt: Device key mismatch"); - } - - const storedSession = await this.client.cryptoStore.getInboundGroupSession(event.sender, encrypted.device_id, roomId, encrypted.session_id); - if (!storedSession) { - throw new Error("Unable to decrypt: Unknown inbound session ID"); - } - - const session = new Olm.InboundGroupSession(); - try { - session.unpickle(this.pickleKey, storedSession.pickled); - const cleartext = session.decrypt(encrypted.ciphertext) as { plaintext: string, message_index: number }; - const eventBody = JSON.parse(cleartext.plaintext); - const messageIndex = cleartext.message_index; - - const existingEventId = await this.client.cryptoStore.getEventForMessageIndex(roomId, storedSession.sessionId, messageIndex); - if (existingEventId && existingEventId !== event.eventId) { - throw new Error("Unable to decrypt: Message replay attack"); - } - - await this.client.cryptoStore.setMessageIndexForEvent(roomId, event.eventId, storedSession.sessionId, messageIndex); - - storedSession.pickled = session.pickle(this.pickleKey); - await this.client.cryptoStore.storeInboundGroupSession(storedSession); - - return new RoomEvent({ - ...event.raw, - type: eventBody.type || "io.t2bot.unknown", - content: (typeof(eventBody.content) === 'object') ? eventBody.content : {}, - }); - } finally { - session.free(); - } - } - - /** - * Handles an inbound to-device message, decrypting it if needed. This will not throw - * under normal circumstances and should always resolve successfully. - * @param {IToDeviceMessage} message The message to process. - * @returns {Promise} Resolves when complete. Should never fail. - */ - @requiresReady() - public async processInboundDeviceMessage(message: IToDeviceMessage): Promise { - if (!message?.content || !message?.sender || !message?.type) { - LogService.warn("CryptoClient", "Received invalid encrypted message"); - return; - } - try { - if (message.type === "m.room.encrypted") { - if (message.content?.['algorithm'] !== EncryptionAlgorithm.OlmV1Curve25519AesSha2) { - LogService.warn("CryptoClient", "Received encrypted message with unknown encryption algorithm"); - return; - } - - const myMessage = message.content.ciphertext?.[this.deviceCurve25519]; - if (!myMessage) { - LogService.warn("CryptoClient", "Received encrypted message not intended for us (ignoring message)"); - return; - } - - if (!Number.isFinite(myMessage.type) || !myMessage.body) { - LogService.warn("CryptoClient", "Received invalid encrypted message (ignoring message)"); - return; - } - - const userDevices = await this.client.cryptoStore.getActiveUserDevices(message.sender); - const senderDevice = userDevices.find(d => d.keys[`${DeviceKeyAlgorithm.Curve25519}:${d.device_id}`] === message.content.sender_key); - if (!senderDevice) { - LogService.warn("CryptoClient", "Received encrypted message from unknown identity key (ignoring message):", message.content.sender_key); - return; - } - - const sessions = await this.client.cryptoStore.getOlmSessions(senderDevice.user_id, senderDevice.device_id); - let trySession: IOlmSession; - for (const storedSession of sessions) { - const checkSession = new Olm.Session(); - try { - checkSession.unpickle(this.pickleKey, storedSession.pickled); - if (checkSession.matches_inbound(myMessage.body)) { - trySession = storedSession; - break; - } - } finally { - checkSession.free(); - } - } - - if (myMessage.type === 0 && !trySession) { - // Store the session because we can - const inboundSession = new Olm.Session(); - const account = await this.getOlmAccount(); - try { - inboundSession.create_inbound_from(account, message.content.sender_key, myMessage.body); - account.remove_one_time_keys(inboundSession); - trySession = { - pickled: inboundSession.pickle(this.pickleKey), - sessionId: inboundSession.session_id(), - lastDecryptionTs: Date.now(), - }; - await this.client.cryptoStore.storeOlmSession(senderDevice.user_id, senderDevice.device_id, trySession); - } finally { - inboundSession.free(); - await this.storeAndFreeOlmAccount(account); - } - } - - if (myMessage.type !== 0 && !trySession) { - LogService.warn("CryptoClient", "Unable to find suitable session for encrypted to-device message; Establishing new session"); - await this.establishNewOlmSession(senderDevice); - return; - } - - // Try decryption (finally) - const session = new Olm.Session(); - let decrypted: IOlmPayload; - try { - session.unpickle(this.pickleKey, trySession.pickled); - decrypted = JSON.parse(session.decrypt(myMessage.type, myMessage.body)); - } catch (e) { - LogService.warn("CryptoClient", "Decryption error with to-device message, assuming corrupted session and re-establishing.", e); - await this.establishNewOlmSession(senderDevice); - return; - } finally { - session.free(); - } - - const wasForUs = decrypted.recipient === (await this.client.getUserId()); - const wasFromThem = decrypted.sender === message.sender; - const hasType = typeof(decrypted.type) === 'string'; - const hasContent = !!decrypted.content && typeof(decrypted.content) === 'object'; - const ourKeyMatches = decrypted.recipient_keys?.ed25519 === this.deviceEd25519; - const theirKeyMatches = decrypted.keys?.ed25519 === senderDevice.keys[`${DeviceKeyAlgorithm.Ed25519}:${senderDevice.device_id}`]; - if (!wasForUs || !wasFromThem || !hasType || !hasContent || !ourKeyMatches || !theirKeyMatches) { - LogService.warn("CryptoClient", "Successfully decrypted to-device message, but it failed validation. Ignoring message.", { - wasForUs, - wasFromThem, - hasType, - hasContent, - ourKeyMatches, - theirKeyMatches, - }); - return; - } - - trySession.lastDecryptionTs = Date.now(); - await this.client.cryptoStore.storeOlmSession(senderDevice.user_id, senderDevice.device_id, trySession); - - if (decrypted.type === "m.room_key") { - await this.handleInboundRoomKey(decrypted, senderDevice, message); - } else if (decrypted.type === "m.dummy") { - // success! Nothing to do. - } else { - LogService.warn("CryptoClient", `Unknown decrypted to-device message type: ${decrypted.type}`); - } - } else { - LogService.warn("CryptoClient", `Unknown to-device message type: ${message.type}`); - } - } catch (e) { - LogService.error("CryptoClient", "Non-fatal error while processing to-device message:", e); - } - } - - private async handleInboundRoomKey(message: IToDeviceMessage, device: UserDevice, original: IToDeviceMessage): Promise { - if (message.content?.algorithm !== EncryptionAlgorithm.MegolmV1AesSha2) { - LogService.warn("CryptoClient", "Ignoring m.room_key for unknown encryption algorithm"); - return; - } - if (!message.content?.room_id || !message.content?.session_id || !message.content?.session_key) { - LogService.warn("CryptoClient", "Ignoring invalid m.room_key"); - return; - } - - const deviceKey = device.keys[`${DeviceKeyAlgorithm.Curve25519}:${device.device_id}`]; - if (deviceKey !== original.content?.sender_key) { - LogService.warn("CryptoClient", "Ignoring m.room_key message from unexpected sender"); - return; - } + const decrypted = await this.machine.decryptRoomEvent(roomId, event.raw); - // See if we already know about this session (if we do: ignore the message) - const knownSession = await this.client.cryptoStore.getInboundGroupSession(device.user_id, device.device_id, message.content.room_id, message.content.session_id); - if (knownSession) { - return; // ignore - } - - await this.storeInboundGroupSession(message.content, device.user_id, device.device_id); - } - - private async storeInboundGroupSession(key: IMRoomKey, senderUserId: string, senderDeviceId: string): Promise { - const inboundSession = new Olm.InboundGroupSession(); - try { - inboundSession.create(key.session_key); - if (inboundSession.session_id() !== key.session_id) { - LogService.warn("CryptoClient", "Ignoring m.room_key with mismatched session_id"); - return; - } - await this.client.cryptoStore.storeInboundGroupSession({ - roomId: key.room_id, - sessionId: key.session_id, - senderDeviceId: senderDeviceId, - senderUserId: senderUserId, - pickled: inboundSession.pickle(this.pickleKey), - }); - } finally { - inboundSession.free(); - } - } - - private async establishNewOlmSession(device: UserDevice): Promise { - const olmSessions = await this.getOrCreateOlmSessions({ - [device.user_id]: [device.device_id], - }, true); - - // Share the session immediately - await this.encryptAndSendOlmMessage(device, olmSessions[device.user_id][device.device_id], "m.dummy", {}); + return new RoomEvent({ + ...event.raw, + type: decrypted.clearEvent.type || "io.t2bot.unknown", + content: (typeof(decrypted.clearEvent.content) === 'object') ? decrypted.clearEvent.content : {}, + }); } /** @@ -810,53 +185,14 @@ export class CryptoClient { */ @requiresReady() public async encryptMedia(file: Buffer): Promise<{buffer: Buffer, file: Omit}> { - const key = crypto.randomBytes(32); - const iv = new Uint8Array(16); - crypto.randomBytes(8).forEach((v, i) => iv[i] = v); // only fill high side to avoid 64bit overflow - - const cipher = crypto.createCipheriv("aes-256-ctr", key, iv); - - const buffers: Buffer[] = []; - cipher.on('data', b => { - buffers.push(b); - }); - - const stream = new PassThrough(); - stream.pipe(cipher); - stream.end(file); - - const finishPromise = new Promise(resolve => { - cipher.end(() => { - resolve(Buffer.concat(buffers)); - }); - }); - - const cipheredContent = await finishPromise; - - let sha256: string; - const util = new Olm.Utility(); - try { - const arr = new Uint8Array(cipheredContent); - sha256 = util.sha256(arr); - } finally { - util.free(); - } - + const encrypted = rustEncryptFile(file); return { - buffer: Buffer.from(cipheredContent), + buffer: encrypted.data, file: { - hashes: { - sha256: sha256, - }, - key: { - alg: "A256CTR", - ext: true, - key_ops: ['encrypt', 'decrypt'], - kty: "oct", - k: encodeUnpaddedUrlSafeBase64(key), - }, - iv: encodeUnpaddedBase64(iv), - v: 'v2', + iv: encrypted.file.iv, + key: encrypted.file.web_key, + v: encrypted.file.v, + hashes: encrypted.file.hashes as {sha256: string}, }, }; } @@ -866,52 +202,11 @@ export class CryptoClient { * @param {EncryptedFile} file The file to decrypt. * @returns {Promise} Resolves to the decrypted file contents. */ + @requiresReady() public async decryptMedia(file: EncryptedFile): Promise { - if (file.v !== "v2") { - throw new Error("Unknown encrypted file version"); - } - if (file.key?.kty !== "oct" || file.key?.alg !== "A256CTR" || file.key?.ext !== true) { - throw new Error("Improper JWT: Missing or invalid fields"); - } - if (!file.key.key_ops.includes("encrypt") || !file.key.key_ops.includes("decrypt")) { - throw new Error("Missing required key_ops"); - } - if (!file.hashes?.sha256) { - throw new Error("Missing SHA256 hash"); - } - - const key = decodeUnpaddedUrlSafeBase64(file.key.k); - const iv = decodeUnpaddedBase64(file.iv); - const ciphered = (await this.client.downloadContent(file.url)).data; - - let sha256: string; - const util = new Olm.Utility(); - try { - const arr = new Uint8Array(ciphered); - sha256 = util.sha256(arr); - } finally { - util.free(); - } - - if (sha256 !== file.hashes.sha256) { - throw new Error("SHA256 mismatch"); - } - - const decipher = crypto.createDecipheriv("aes-256-ctr", key, iv); - - const buffers: Buffer[] = []; - decipher.on('data', b => { - buffers.push(b); - }); - - const stream = new PassThrough(); - stream.pipe(decipher); - stream.end(ciphered); - - return new Promise(resolve => { - decipher.end(() => { - resolve(Buffer.concat(buffers)); - }); + return rustDecryptFile((await this.client.downloadContent(file.url)).data, { + ...file, + web_key: file.key as any, // we know it is compatible }); } } diff --git a/src/e2ee/DeviceTracker.ts b/src/e2ee/DeviceTracker.ts deleted file mode 100644 index b68c2586..00000000 --- a/src/e2ee/DeviceTracker.ts +++ /dev/null @@ -1,128 +0,0 @@ -import { MatrixClient } from "../MatrixClient"; -import { LogService } from "../logging/LogService"; -import { DeviceKeyAlgorithm, UserDevice } from "../models/Crypto"; - -/** - * Tracks user devices for encryption operations. - * @category Encryption - */ -export class DeviceTracker { - private deviceListUpdates: Record> = {}; - - public constructor(private client: MatrixClient) { - } - - /** - * Gets the device lists for the given user IDs. Outdated device lists will be updated before - * returning. - * @param {string[]} userIds The user IDs to get the device lists of. - * @returns {Promise>} Resolves to a map of user ID to device list. - * If a user has no devices, they may be excluded from the result or appear as an empty array. - */ - public async getDevicesFor(userIds: string[]): Promise> { - const outdatedUserIds: string[] = []; - for (const userId of userIds) { - const isOutdated = await this.client.cryptoStore.isUserOutdated(userId); - if (isOutdated) outdatedUserIds.push(userId); - } - - await this.updateUsersDeviceLists(outdatedUserIds); - - const userDeviceMap: Record = {}; - for (const userId of userIds) { - userDeviceMap[userId] = await this.client.cryptoStore.getActiveUserDevices(userId); - } - return userDeviceMap; - } - - /** - * Flags multiple user's device lists as outdated, optionally queuing an immediate update. - * @param {string} userIds The user IDs to flag the device lists of. - * @param {boolean} resync True (default) to queue an immediate update, false otherwise. - * @returns {Promise} Resolves when the flagging has completed. Will wait for the resync - * if requested too. - */ - public async flagUsersOutdated(userIds: string[], resync = true): Promise { - await this.client.cryptoStore.flagUsersOutdated(userIds); - if (resync) { - await this.updateUsersDeviceLists(userIds); - } - } - - /** - * Updates multiple user's device lists regardless of outdated flag. - * @param {string[]} userIds The user IDs to update. - * @returns {Promise} Resolves when complete. - */ - public async updateUsersDeviceLists(userIds: string[]): Promise { - // We wait for the lock, but still run through with our update just in case we are lagged. - // This can happen if the server is slow to reply to device list queries, but a user is - // changing information about their device a lot. - const existingPromises = userIds.map(u => this.deviceListUpdates[u]).filter(p => !!p); - if (existingPromises.length > 0) { - await Promise.all(existingPromises); - } - - const promise = new Promise(async (resolve, reject) => { - try { - const resp = await this.client.getUserDevices(userIds); - for (const userId of Object.keys(resp.device_keys)) { - if (!userIds.includes(userId)) { - LogService.warn("DeviceTracker", `Server returned unexpected user ID: ${userId} - ignoring user`); - continue; - } - - const validated: UserDevice[] = []; - for (const deviceId of Object.keys(resp.device_keys[userId])) { - const device = resp.device_keys[userId][deviceId]; - if (device.user_id !== userId || device.device_id !== deviceId) { - LogService.warn("DeviceTracker", `Server appears to be lying about device lists: ${userId} ${deviceId} has unexpected device ${device.user_id} ${device.device_id} listed - ignoring device`); - continue; - } - - const ed25519 = device.keys[`${DeviceKeyAlgorithm.Ed25519}:${deviceId}`]; - const curve25519 = device.keys[`${DeviceKeyAlgorithm.Curve25519}:${deviceId}`]; - - if (!ed25519 || !curve25519) { - LogService.warn("DeviceTracker", `Device ${userId} ${deviceId} is missing either an Ed25519 or Curve25519 key - ignoring device`); - continue; - } - - const currentDevices = await this.client.cryptoStore.getAllUserDevices(userId); - const existingDevice = currentDevices.find(d => d.device_id === deviceId); - - if (existingDevice) { - const existingEd25519 = existingDevice.keys[`${DeviceKeyAlgorithm.Ed25519}:${deviceId}`]; - if (existingEd25519 !== ed25519) { - LogService.warn("DeviceTracker", `Device ${userId} ${deviceId} appears compromised: Ed25519 key changed - ignoring device`); - continue; - } - } - - const signature = device.signatures?.[userId]?.[`${DeviceKeyAlgorithm.Ed25519}:${deviceId}`]; - if (!signature) { - LogService.warn("DeviceTracker", `Device ${userId} ${deviceId} is missing a signature - ignoring device`); - continue; - } - - const validSignature = await this.client.crypto.verifySignature(device, ed25519, signature); - if (!validSignature) { - LogService.warn("DeviceTracker", `Device ${userId} ${deviceId} has an invalid signature - ignoring device`); - continue; - } - - validated.push(device); - } - - await this.client.cryptoStore.setActiveUserDevices(userId, validated); - } - } catch (e) { - LogService.error("DeviceTracker", "Error updating device lists:", e); - // return reject(e); - } - resolve(); - }); - userIds.forEach(u => this.deviceListUpdates[u] = promise); - await promise; - } -} diff --git a/src/e2ee/InternalOlmMachineFactory.ts b/src/e2ee/InternalOlmMachineFactory.ts new file mode 100644 index 00000000..47171d81 --- /dev/null +++ b/src/e2ee/InternalOlmMachineFactory.ts @@ -0,0 +1,18 @@ +import { OlmEngine, OlmMachine } from "@turt2live/matrix-sdk-crypto-nodejs"; + +/** + * @internal + */ +export class InternalOlmMachineFactory { + public static FACTORY_OVERRIDE: (userId: string, deviceId: string, engine: OlmEngine, storagePath: string) => OlmMachine; + + constructor(private userId: string, private deviceId: string, private engine: OlmEngine, private storagePath: string) { + } + + public build(): OlmMachine { + if (InternalOlmMachineFactory.FACTORY_OVERRIDE) { + return InternalOlmMachineFactory.FACTORY_OVERRIDE(this.userId, this.deviceId, this.engine, this.storagePath); + } + return OlmMachine.withSledBackend(this.userId, this.deviceId, this.engine, this.storagePath); + } +} diff --git a/src/e2ee/SdkOlmEngine.ts b/src/e2ee/SdkOlmEngine.ts new file mode 100644 index 00000000..6e09899e --- /dev/null +++ b/src/e2ee/SdkOlmEngine.ts @@ -0,0 +1,51 @@ +import { + DeviceKeys, + GenericKeys, + KeyClaim, + KeyClaimResponse, + KeyQueryResults, + OlmEngine, + OTKCounts, + ToDeviceMessages, +} from "@turt2live/matrix-sdk-crypto-nodejs"; +import { MatrixClient } from "../MatrixClient"; +import { OTKAlgorithm } from "../models/Crypto"; + +/** + * A representation of a rust-sdk OlmEngine for the bot-sdk. You should not need to + * instantiate this yourself. + * @category Encryption + */ +export class SdkOlmEngine implements OlmEngine { + public constructor(private client: MatrixClient) { + } + + public claimOneTimeKeys(claim: KeyClaim): Promise { + const reconstructed: Record> = {}; + for (const userId of Object.keys(claim)) { + if (!reconstructed[userId]) reconstructed[userId] = {}; + + for (const deviceId of Object.keys(claim[userId])) { + reconstructed[userId][deviceId] = claim[userId][deviceId] as OTKAlgorithm; + } + } + return this.client.claimOneTimeKeys(reconstructed); + } + + public queryOneTimeKeys(userIds: string[]): Promise { + return this.client.getUserDevices(userIds); + } + + public uploadOneTimeKeys(body: {device_keys?: DeviceKeys, one_time_keys?: GenericKeys}): Promise { + return this.client.doRequest("POST", "/_matrix/client/r0/keys/upload", null, body); + } + + public getEffectiveJoinedUsersInRoom(roomId: string): Promise { + // TODO: Handle pre-shared invite keys too + return this.client.getJoinedRoomMembers(roomId); + } + + public sendToDevices(eventType: string, messages: ToDeviceMessages): Promise { + return this.client.sendToDevices(eventType, messages); + } +} diff --git a/src/http.ts b/src/http.ts index eb90545d..c2c4df35 100644 --- a/src/http.ts +++ b/src/http.ts @@ -48,6 +48,8 @@ export function doHttpRequest(baseUrl: string, method: "GET"|"POST"|"PUT"|"DELET }, timeout: timeout, headers: headers, + // Enable KeepAlive for HTTP + forever: true, }; if (body) { diff --git a/src/index.ts b/src/index.ts index 4486a886..04bd3f45 100644 --- a/src/index.ts +++ b/src/index.ts @@ -9,6 +9,7 @@ export * from "./appservice/UnstableAppserviceApis"; export * from "./e2ee/RoomTracker"; export * from "./e2ee/CryptoClient"; export * from "./e2ee/decorators"; +export * from "./e2ee/SdkOlmEngine"; // Helpers export * from "./helpers/RichReply"; @@ -83,7 +84,7 @@ export * from "./storage/IStorageProvider"; export * from "./storage/MemoryStorageProvider"; export * from "./storage/SimpleFsStorageProvider"; export * from "./storage/ICryptoStorageProvider"; -//export * from "./storage/SqliteCryptoStorageProvider"; // Not exported because of optional dependency +export * from "./storage/RustSdkCryptoStorageProvider"; // Strategies export * from "./strategies/AppserviceJoinRoomStrategy"; diff --git a/src/models/Crypto.ts b/src/models/Crypto.ts index f0f7a5e6..a0da623a 100644 --- a/src/models/Crypto.ts +++ b/src/models/Crypto.ts @@ -99,6 +99,17 @@ export interface UserDevice { }; } +/** + * Represents a user's own device. + * @category Models + */ +export interface OwnUserDevice { + device_id: string; + display_name?: string; + last_seen_ip?: string; + last_seen_ts?: number; +} + /** * Represents a user's stored device. * @category Models diff --git a/src/models/events/Event.ts b/src/models/events/Event.ts index 58154540..c3ccbf42 100644 --- a/src/models/events/Event.ts +++ b/src/models/events/Event.ts @@ -2,7 +2,7 @@ * A Matrix event. * @category Matrix events */ -export class MatrixEvent { +export class MatrixEvent { constructor(protected event: any) { } diff --git a/src/models/events/RoomEvent.ts b/src/models/events/RoomEvent.ts index c830349a..3ccb65fe 100644 --- a/src/models/events/RoomEvent.ts +++ b/src/models/events/RoomEvent.ts @@ -29,7 +29,7 @@ export interface RoomEventContent { * A Matrix room event. * @category Matrix events */ -export class RoomEvent extends MatrixEvent { +export class RoomEvent extends MatrixEvent { constructor(protected event: any) { super(event); } @@ -60,7 +60,7 @@ export class RoomEvent extends MatrixEvent { * A room state event. * @category Matrix events */ -export class StateEvent extends RoomEvent { +export class StateEvent extends RoomEvent { constructor(event: any) { super(event); } diff --git a/src/models/events/_MissingEvents.md b/src/models/events/_MissingEvents.md index 05e6aa17..1a7ca917 100644 --- a/src/models/events/_MissingEvents.md +++ b/src/models/events/_MissingEvents.md @@ -18,9 +18,6 @@ These are the event types that need definitions. * `m.key.verification.accept` * `m.key.verification.key` * `m.key.verification.mac` -* `m.room.encryption` -* `m.room.encrypted` -* `m.room.message` encrypted files * `m.room_key` * `m.room_key_request` * `m.forwarded_room_key` diff --git a/src/simple-validation.ts b/src/simple-validation.ts index 9f205899..3dc3f23b 100644 --- a/src/simple-validation.ts +++ b/src/simple-validation.ts @@ -5,6 +5,7 @@ * @param {string} order The 'order' parameter of a m.space.child * @throws {Error} If the string is not valid * @returns {boolean} True if the string is valid + * @category Utilities */ export function validateSpaceOrderString(order: string): true { if (typeof(order) !== 'string') { diff --git a/src/storage/IAppserviceStorageProvider.ts b/src/storage/IAppserviceStorageProvider.ts index 5f3bf773..da9eb2c0 100644 --- a/src/storage/IAppserviceStorageProvider.ts +++ b/src/storage/IAppserviceStorageProvider.ts @@ -1,3 +1,6 @@ +import { ICryptoStorageProvider } from "./ICryptoStorageProvider"; +import { IStorageProvider } from "./IStorageProvider"; + /** * A storage provider definition for appservices to use. * @category Storage providers @@ -28,4 +31,24 @@ export interface IAppserviceStorageProvider { * @returns {boolean} True if the transaction has been completed. This may be a promise. */ isTransactionCompleted(transactionId: string): boolean | Promise; + + /** + * Gets a storage provider to use for the given user ID. + * @param {string} userId The user ID. + * @returns {ICryptoStorageProvider} The storage provider. + */ + storageForUser?(userId: string): IStorageProvider; +} + +/** + * A storage provider capable of only providing crypto-related storage to appservices. + * @category Storage providers + */ +export interface IAppserviceCryptoStorageProvider { + /** + * Gets a storage provider to use for the given user ID. + * @param {string} userId The user ID. + * @returns {ICryptoStorageProvider} The storage provider. + */ + storageForUser(userId: string): ICryptoStorageProvider; } diff --git a/src/storage/ICryptoStorageProvider.ts b/src/storage/ICryptoStorageProvider.ts index 41acd1f1..8af65007 100644 --- a/src/storage/ICryptoStorageProvider.ts +++ b/src/storage/ICryptoStorageProvider.ts @@ -1,11 +1,4 @@ import { EncryptionEventContent } from "../models/events/EncryptionEvent"; -import { - IInboundGroupSession, - IOlmSession, - IOutboundGroupSession, - StoredUserDevice, - UserDevice, -} from "../models/Crypto"; /** * A storage provider capable of only providing crypto-related storage. @@ -25,34 +18,6 @@ export interface ICryptoStorageProvider { */ getDeviceId(): Promise; - /** - * Sets the pickle key for the client. - * @param {string} pickleKey The pickle key to store. - * @returns {Promise} Resolves when complete. - */ - setPickleKey(pickleKey: string): Promise; - - /** - * Gets the pickle key for the client. If no pickle key is set, this resolves - * to falsy. - * @returns {Promise} Resolves to the pickle key, or falsy if not set. - */ - getPickleKey(): Promise; - - /** - * Sets the pickled copy of the Olm account. This should be stored securely - * if possible. - * @param {string} pickled Encoded, pickled, copy of the Olm account. - * @returns {Promise} Resolves when complete. - */ - setPickledAccount(pickled: string): Promise; - - /** - * Gets the pickled copy of the Olm account, or falsy if not set. - * @returns {Promise} Resolves to the pickled account, or falsy if not set. - */ - getPickledAccount(): Promise; - /** * Stores a room's configuration. * @param {string} roomId The room ID to store the configuration for. @@ -68,164 +33,4 @@ export interface ICryptoStorageProvider { * to falsy if the room is unknown. */ getRoom(roomId: string): Promise>; - - /** - * Sets the user's stored devices to the given array. All devices not in this set will be deleted. - * This will clear the user's outdated flag, if set. - * @param {string} userId The user ID to set the devices for. - * @param {UserDevice[]} devices The devices to set for the user. - * @returns {Promise} Resolves when complete. - */ - setActiveUserDevices(userId: string, devices: UserDevice[]): Promise; - - /** - * Gets the user's active stored devices. If no devices are stored, an empty array is returned. - * @param {string} userId The user ID to get devices for. - * @returns {Promise} Resolves to the array of devices for the user. If no - * devices are known, the array will be empty. - */ - getActiveUserDevices(userId: string): Promise; - - /** - * Gets a user's active stored device. If the device is not known or active, falsy is returned. - * @param {string} userId The user ID. - * @param {string} deviceId The device ID. - * @returns {Promise} Resolves to the user's device, or falsy if not known. - */ - getActiveUserDevice(userId: string, deviceId: string): Promise; - - /** - * Gets all of the user's devices, regardless of whether or not they are active. The active flag - * will be stored in the unsigned portion of the returned device. - * @param {string} userId The user ID to get devices for. - * @returns {Promise} Resolves to the array of devices for the user, or empty - * if no devices are known. - */ - getAllUserDevices(userId: string): Promise; - - /** - * Flags multiple user's device lists as outdated. - * @param {string} userIds The user IDs to flag. - * @returns {Promise} Resolves when complete. - */ - flagUsersOutdated(userIds: string[]): Promise; - - /** - * Checks to see if a user's device list is flagged as outdated. If the user is not known - * then they will be considered outdated. - * @param {string} userId The user ID to check. - * @returns {Promise} Resolves to true if outdated, false otherwise. - */ - isUserOutdated(userId: string): Promise; - - /** - * Stores a pickled outbound group session. If the session is flagged as current, all other sessions - * for the room ID will be flagged as not-current. - * @param {IOutboundGroupSession} session The session to store. - * @returns {Promise} Resolves when complete. - */ - storeOutboundGroupSession(session: IOutboundGroupSession): Promise; - - /** - * Gets a previously stored outbound group session. If the session ID is not known, a falsy value - * will be returned. - * @param {string} sessionId The session ID. - * @param {string} roomId The room ID where the session is stored. - * @returns {Promise} Resolves to the session, or falsy if not known. - */ - getOutboundGroupSession(sessionId: string, roomId: string): Promise; - - /** - * Gets the current outbound group session for a room. If the room does not have a current session, - * a falsy value will be returned. - * @param {string} roomId The room ID. - * @returns {Promise} Resolves to the current session, or falsy if not known. - */ - getCurrentOutboundGroupSession(roomId: string): Promise; - - /** - * Stores a session as sent to a user's device. - * @param {IOutboundGroupSession} session The session that was sent. - * @param {number} index The session index. - * @param {UserDevice} device The device the session was sent to. - * @returns {Promise} Resolves when complete. - */ - storeSentOutboundGroupSession(session: IOutboundGroupSession, index: number, device: UserDevice): Promise; - - /** - * Gets the last sent session that was sent to a user's device. If none is recorded, - * a falsy value is returned. - * @param {string} userId The user ID to look for. - * @param {string} deviceId The device ID to look for. - * @param {string} roomId The room ID to look in. - * @returns {Promise<{sessionId: string, index: number}>} Resolves to the last session - * sent, or falsy if not known. - */ - getLastSentOutboundGroupSession(userId: string, deviceId: string, roomId: string): Promise<{sessionId: string, index: number}>; - - /** - * Stores/updates an Olm session for a user's device. - * @param {string} userId The user ID. - * @param {string} deviceId The device ID. - * @param {IOlmSession} session The session. - * @returns {Promise} Resolves when complete. - */ - storeOlmSession(userId: string, deviceId: string, session: IOlmSession): Promise; - - /** - * Gets the most current Olm session for the user's device. If none is present, a falsy value is returned. - * @param {string} userId The user ID. - * @param {string} deviceId The device ID. - * @returns {Promise} Resolves to the Olm session, or falsy if none found. - */ - getCurrentOlmSession(userId: string, deviceId: string): Promise; - - /** - * Gets all the Olm sessions known for a given user's device. Note that this may not return in order, - * so callers needing to know the "current" Olm session should use the appropriate function. - * @param {string} userId The user ID. - * @param {string} deviceId The device ID. - * @returns {Promise} Resolves to the known Olm sessions, or an empty array if none are known. - */ - getOlmSessions(userId: string, deviceId: string): Promise; - - /** - * Stores an inbound group session. - * @param {IInboundGroupSession} session The session to store. - * @returns {Promise} Resolves when complete. - */ - storeInboundGroupSession(session: IInboundGroupSession): Promise; - - /** - * Gets a previously stored inbound group session. If the session is not known, a falsy value is returned. - * @param {string} senderUserId The user ID who sent the session in the first place. - * @param {string} senderDeviceId The device ID of the sender. - * @param {string} roomId The room ID where the session should belong. - * @param {string} sessionId The session ID itself. - * @returns {Promise} Resolves to the session, or falsy if not known. - */ - getInboundGroupSession(senderUserId: string, senderDeviceId: string, roomId: string, sessionId: string): Promise; - - /** - * Sets the successfully decrypted message index for an event. Useful for tracking replay attacks. - * @param {string} roomId The room ID where the event was sent. - * @param {string} eventId The event ID. - * @param {string} sessionId The inbound group session ID for the event. - * @param {number} messageIndex The message index, as reported after decryption. - * @returns {Promise} Resolves when complete. - */ - setMessageIndexForEvent(roomId: string, eventId: string, sessionId: string, messageIndex: number): Promise; - - /** - * Gets the event ID for a previously successful decryption from a session and message index. If - * no event ID is known, this will return falsy. The caller can use this function to determine if - * a replay attack is being performed by checking the returned event ID, if present, against the - * event ID of the event it is decrypting. If the event IDs do not match but are truthy then the - * session may have been inappropriately re-used. - * @param {string} roomId The room ID. - * @param {string} sessionId The inbound group session ID. - * @param {number} messageIndex The message index. - * @returns {Promise} Resolves to the event ID of the matching event, or falsy if not known. - */ - getEventForMessageIndex(roomId: string, sessionId: string, messageIndex: number): Promise; } diff --git a/src/storage/MemoryStorageProvider.ts b/src/storage/MemoryStorageProvider.ts index e0a22931..0ea2d272 100644 --- a/src/storage/MemoryStorageProvider.ts +++ b/src/storage/MemoryStorageProvider.ts @@ -8,6 +8,7 @@ import { IAppserviceStorageProvider } from "./IAppserviceStorageProvider"; */ export class MemoryStorageProvider implements IStorageProvider, IAppserviceStorageProvider { + private namespaced = new Map(); private syncToken: string; private filter: IFilterInfo; private appserviceUsers: { [userId: string]: { registered: boolean } } = {}; @@ -55,4 +56,11 @@ export class MemoryStorageProvider implements IStorageProvider, IAppserviceStora storeValue(key: string, value: string): void { this.kvStore[key] = value; } + + storageForUser(userId: string): IStorageProvider { + if (!this.namespaced.has(userId)) { + this.namespaced.set(userId, new MemoryStorageProvider()); + } + return this.namespaced.get(userId); + } } diff --git a/src/storage/RustSdkCryptoStorageProvider.ts b/src/storage/RustSdkCryptoStorageProvider.ts new file mode 100644 index 00000000..c789d921 --- /dev/null +++ b/src/storage/RustSdkCryptoStorageProvider.ts @@ -0,0 +1,72 @@ +import { ICryptoStorageProvider } from "./ICryptoStorageProvider"; +import { EncryptionEventContent } from "../models/events/EncryptionEvent"; +import * as lowdb from "lowdb"; +import * as FileSync from "lowdb/adapters/FileSync"; +import * as mkdirp from "mkdirp"; +import * as path from "path"; +import * as sha512 from "hash.js/lib/hash/sha/512"; +import * as sha256 from "hash.js/lib/hash/sha/256" +import { IAppserviceCryptoStorageProvider } from "./IAppserviceStorageProvider"; + +/** + * A crypto storage provider for the default rust-sdk store (sled, file-based). + * @category Storage providers + */ +export class RustSdkCryptoStorageProvider implements ICryptoStorageProvider { + private db: any; + + /** + * Creates a new rust-sdk storage provider. + * @param {string} storagePath The *directory* to persist database details to. + */ + public constructor(public readonly storagePath: string) { + this.storagePath = path.resolve(this.storagePath); + mkdirp.sync(storagePath); + + const adapter = new FileSync(path.join(storagePath, "bot-sdk.json")); + this.db = lowdb(adapter); + + this.db.defaults({ + deviceId: null, + rooms: {}, + }); + } + + public async getDeviceId(): Promise { + return this.db.get('deviceId').value(); + } + + public async setDeviceId(deviceId: string): Promise { + this.db.set('deviceId', deviceId).write(); + } + + public async getRoom(roomId: string): Promise> { + const key = sha512().update(roomId).digest('hex'); + return this.db.get(`rooms.${key}`).value(); + } + + public async storeRoom(roomId: string, config: Partial): Promise { + const key = sha512().update(roomId).digest('hex'); + this.db.set(`rooms.${key}`, config).write(); + } +} + +/** + * An appservice crypto storage provider for the default rust-sdk store (sled, file-based). + * @category Storage providers + */ +export class RustSdkAppserviceCryptoStorageProvider extends RustSdkCryptoStorageProvider implements IAppserviceCryptoStorageProvider { + /** + * Creates a new rust-sdk storage provider. + * @param {string} baseStoragePath The *directory* to persist database details to. + */ + public constructor(private baseStoragePath: string) { + super(path.join(baseStoragePath, "_default")); + } + + public storageForUser(userId: string): ICryptoStorageProvider { + // sha256 because sha512 is a bit big for some operating systems + const key = sha256().update(userId).digest('hex'); + return new RustSdkCryptoStorageProvider(path.join(this.baseStoragePath, key)); + } +} diff --git a/src/storage/SimpleFsStorageProvider.ts b/src/storage/SimpleFsStorageProvider.ts index 9222e4e8..3d54e21c 100644 --- a/src/storage/SimpleFsStorageProvider.ts +++ b/src/storage/SimpleFsStorageProvider.ts @@ -102,4 +102,41 @@ export class SimpleFsStorageProvider implements IStorageProvider, IAppserviceSto kvStore[key] = value; this.db.set("kvStore", kvStore).write(); } + + storageForUser(userId: string): IStorageProvider { + return new NamespacedFsProvider(userId, this); + } +} + +/** + * A namespaced storage provider that uses the disk to store information. + * @category Storage providers + */ +class NamespacedFsProvider implements IStorageProvider { + constructor(private prefix: string, private parent: SimpleFsStorageProvider) { + } + + setFilter(filter: IFilterInfo): Promise | void { + return this.parent.storeValue(`${this.prefix}_int_filter`, JSON.stringify(filter)); + } + + getFilter(): IFilterInfo | Promise { + return Promise.resolve(this.parent.readValue(`${this.prefix}_int_filter`)).then(r => r ? JSON.parse(r) : r); + } + + setSyncToken(token: string | null): Promise | void { + return this.parent.storeValue(`${this.prefix}_int_syncToken`, token); + } + + getSyncToken(): string | Promise | null { + return Promise.resolve(this.parent.readValue(`${this.prefix}_int_syncToken`)).then(r => r ?? null); + } + + readValue(key: string): string | Promise | null | undefined { + return this.parent.readValue(`${this.prefix}_kv_${key}`); + } + + storeValue(key: string, value: string): Promise | void { + return this.parent.storeValue(`${this.prefix}_kv_${key}`, value); + } } diff --git a/src/storage/SqliteCryptoStorageProvider.ts b/src/storage/SqliteCryptoStorageProvider.ts deleted file mode 100644 index df8a9d1d..00000000 --- a/src/storage/SqliteCryptoStorageProvider.ts +++ /dev/null @@ -1,334 +0,0 @@ -import { ICryptoStorageProvider } from "./ICryptoStorageProvider"; -import { EncryptionEventContent } from "../models/events/EncryptionEvent"; -import * as Database from "better-sqlite3"; -import { - IInboundGroupSession, - IOlmSession, - IOutboundGroupSession, - StoredUserDevice, - UserDevice, -} from "../models/Crypto"; - -/** - * Sqlite crypto storage provider. Requires `better-sqlite3` package to be installed. - * @category Storage providers - */ -export class SqliteCryptoStorageProvider implements ICryptoStorageProvider { - private db: Database.Database; - - private kvUpsert: Database.Statement; - private kvSelect: Database.Statement; - private roomUpsert: Database.Statement; - private roomSelect: Database.Statement; - private userUpsert: Database.Statement; - private userSelect: Database.Statement; - private userDeviceUpsert: Database.Statement; - private userDevicesDelete: Database.Statement; - private userDevicesSelect: Database.Statement; - private userActiveDevicesSelect: Database.Statement; - private userActiveDeviceSelect: Database.Statement; - private obGroupSessionUpsert: Database.Statement; - private obGroupSessionSelect: Database.Statement; - private obGroupCurrentSessionSelect: Database.Statement; - private obGroupSessionMarkAllInactive: Database.Statement; - private obSentGroupSessionUpsert: Database.Statement; - private obSentSelectLastSent: Database.Statement; - private olmSessionUpsert: Database.Statement; - private olmSessionCurrentSelect: Database.Statement; - private olmSessionSelect: Database.Statement; - private ibGroupSessionUpsert: Database.Statement; - private ibGroupSessionSelect: Database.Statement; - private deMetadataUpsert: Database.Statement; - private deMetadataSelect: Database.Statement; - - /** - * Creates a new Sqlite storage provider. - * @param {string} path The file path to store the database at. Use ":memory:" to - * store the database entirely in memory, or an empty string to do the equivalent - * on the disk. - */ - public constructor(path: string) { - this.db = new Database(path); - this.db.exec("CREATE TABLE IF NOT EXISTS kv (name TEXT PRIMARY KEY NOT NULL, value TEXT NOT NULL)"); - this.db.exec("CREATE TABLE IF NOT EXISTS rooms (room_id TEXT PRIMARY KEY NOT NULL, config TEXT NOT NULL)"); - this.db.exec("CREATE TABLE IF NOT EXISTS users (user_id TEXT PRIMARY KEY NOT NULL, outdated TINYINT NOT NULL)"); - this.db.exec("CREATE TABLE IF NOT EXISTS user_devices (user_id TEXT NOT NULL, device_id TEXT NOT NULL, device TEXT NOT NULL, active TINYINT NOT NULL, PRIMARY KEY (user_id, device_id))"); - this.db.exec("CREATE TABLE IF NOT EXISTS outbound_group_sessions (session_id TEXT NOT NULL, room_id TEXT NOT NULL, current TINYINT NOT NULL, pickled TEXT NOT NULL, uses_left NUMBER NOT NULL, expires_ts NUMBER NOT NULL, PRIMARY KEY (session_id, room_id))"); - this.db.exec("CREATE TABLE IF NOT EXISTS sent_outbound_group_sessions (session_id TEXT NOT NULL, room_id TEXT NOT NULL, session_index INT NOT NULL, user_id TEXT NOT NULL, device_id TEXT NOT NULL, PRIMARY KEY (session_id, room_id, user_id, device_id, session_index))"); - this.db.exec("CREATE TABLE IF NOT EXISTS olm_sessions (user_id TEXT NOT NULL, device_id TEXT NOT NULL, session_id TEXT NOT NULL, last_decryption_ts NUMBER NOT NULL, pickled TEXT NOT NULL, PRIMARY KEY (user_id, device_id, session_id))"); - this.db.exec("CREATE TABLE IF NOT EXISTS inbound_group_sessions (session_id TEXT NOT NULL, room_id TEXT NOT NULL, user_id TEXT NOT NULL, device_id TEXT NOT NULL, pickled TEXT NOT NULL, PRIMARY KEY (session_id, room_id, user_id, device_id))"); - this.db.exec("CREATE TABLE IF NOT EXISTS decrypted_event_metadata (room_id TEXT NOT NULL, event_id TEXT NOT NULL, session_id TEXT NOT NULL, message_index INT NOT NULL, PRIMARY KEY (room_id, event_id))"); - this.db.exec("CREATE INDEX IF NOT EXISTS idx_decrypted_event_metadata_by_message_index ON decrypted_event_metadata (room_id, session_id, message_index)"); - - this.kvUpsert = this.db.prepare("INSERT INTO kv (name, value) VALUES (@name, @value) ON CONFLICT (name) DO UPDATE SET value = @value"); - this.kvSelect = this.db.prepare("SELECT name, value FROM kv WHERE name = @name"); - - this.roomUpsert = this.db.prepare("INSERT INTO rooms (room_id, config) VALUES (@roomId, @config) ON CONFLICT (room_id) DO UPDATE SET config = @config"); - this.roomSelect = this.db.prepare("SELECT room_id, config FROM rooms WHERE room_id = @roomId"); - - this.userUpsert = this.db.prepare("INSERT INTO users (user_id, outdated) VALUES (@userId, @outdated) ON CONFLICT (user_id) DO UPDATE SET outdated = @outdated"); - this.userSelect = this.db.prepare("SELECT user_id, outdated FROM users WHERE user_id = @userId"); - - this.userDeviceUpsert = this.db.prepare("INSERT INTO user_devices (user_id, device_id, device, active) VALUES (@userId, @deviceId, @device, @active) ON CONFLICT (user_id, device_id) DO UPDATE SET device = @device, active = @active"); - this.userDevicesDelete = this.db.prepare("UPDATE user_devices SET active = 0 WHERE user_id = @userId"); - this.userDevicesSelect = this.db.prepare("SELECT user_id, device_id, device, active FROM user_devices WHERE user_id = @userId"); - this.userActiveDevicesSelect = this.db.prepare("SELECT user_id, device_id, device, active FROM user_devices WHERE user_id = @userId AND active = 1"); - this.userActiveDeviceSelect = this.db.prepare("SELECT user_id, device_id, device, active FROM user_devices WHERE user_id = @userId AND device_id = @deviceId AND active = 1"); - - this.obGroupSessionUpsert = this.db.prepare("INSERT INTO outbound_group_sessions (session_id, room_id, current, pickled, uses_left, expires_ts) VALUES (@sessionId, @roomId, @current, @pickled, @usesLeft, @expiresTs) ON CONFLICT (session_id, room_id) DO UPDATE SET pickled = @pickled, current = @current, uses_left = @usesLeft, expires_ts = @expiresTs"); - this.obGroupSessionSelect = this.db.prepare("SELECT session_id, room_id, current, pickled, uses_left, expires_ts FROM outbound_group_sessions WHERE session_id = @sessionId AND room_id = @roomId"); - this.obGroupCurrentSessionSelect = this.db.prepare("SELECT session_id, room_id, current, pickled, uses_left, expires_ts FROM outbound_group_sessions WHERE room_id = @roomId AND current = 1"); - this.obGroupSessionMarkAllInactive = this.db.prepare("UPDATE outbound_group_sessions SET current = 0 WHERE room_id = @roomId"); - - this.obSentGroupSessionUpsert = this.db.prepare("INSERT INTO sent_outbound_group_sessions (session_id, room_id, session_index, user_id, device_id) VALUES (@sessionId, @roomId, @sessionIndex, @userId, @deviceId) ON CONFLICT (session_id, room_id, user_id, device_id, session_index) DO NOTHING"); - this.obSentSelectLastSent = this.db.prepare("SELECT session_id, room_id, session_index, user_id, device_id FROM sent_outbound_group_sessions WHERE user_id = @userId AND device_id = @deviceId AND room_id = @roomId"); - - this.olmSessionUpsert = this.db.prepare("INSERT INTO olm_sessions (user_id, device_id, session_id, last_decryption_ts, pickled) VALUES (@userId, @deviceId, @sessionId, @lastDecryptionTs, @pickled) ON CONFLICT (user_id, device_id, session_id) DO UPDATE SET last_decryption_ts = @lastDecryptionTs, pickled = @pickled"); - this.olmSessionCurrentSelect = this.db.prepare("SELECT user_id, device_id, session_id, last_decryption_ts, pickled FROM olm_sessions WHERE user_id = @userId AND device_id = @deviceId ORDER BY last_decryption_ts DESC LIMIT 1"); - this.olmSessionSelect = this.db.prepare("SELECT user_id, device_id, session_id, last_decryption_ts, pickled FROM olm_sessions WHERE user_id = @userId AND device_id = @deviceId"); - - this.ibGroupSessionUpsert = this.db.prepare("INSERT INTO inbound_group_sessions (session_id, room_id, user_id, device_id, pickled) VALUES (@sessionId, @roomId, @userId, @deviceId, @pickled) ON CONFLICT (session_id, room_id, user_id, device_id) DO UPDATE SET pickled = @pickled"); - this.ibGroupSessionSelect = this.db.prepare("SELECT session_id, room_id, user_id, device_id, pickled FROM inbound_group_sessions WHERE session_id = @sessionId AND room_id = @roomId AND user_id = @userId AND device_id = @deviceId"); - - this.deMetadataUpsert = this.db.prepare("INSERT INTO decrypted_event_metadata (room_id, event_id, session_id, message_index) VALUES (@roomId, @eventId, @sessionId, @messageIndex) ON CONFLICT (room_id, event_id) DO UPDATE SET message_index = @messageIndex, session_id = @sessionId"); - this.deMetadataSelect = this.db.prepare("SELECT room_id, event_id, session_id, message_index FROM decrypted_event_metadata WHERE room_id = @roomId AND session_id = @sessionId AND message_index = @messageIndex LIMIT 1"); - } - - public async setDeviceId(deviceId: string): Promise { - this.kvUpsert.run({ - name: 'deviceId', - value: deviceId, - }); - } - - public async getDeviceId(): Promise { - const row = this.kvSelect.get({name: 'deviceId'}); - return row?.value; - } - - public async setPickleKey(pickleKey: string): Promise { - this.kvUpsert.run({ - name: 'pickleKey', - value: pickleKey, - }); - } - - public async getPickleKey(): Promise { - const row = this.kvSelect.get({name: 'pickleKey'}); - return row?.value; - } - - public async setPickledAccount(pickled: string): Promise { - this.kvUpsert.run({ - name: 'pickled', - value: pickled, - }); - } - - public async getPickledAccount(): Promise { - const row = this.kvSelect.get({name: 'pickled'}); - return row?.value; - } - - public async storeRoom(roomId: string, config: Partial): Promise { - this.roomUpsert.run({ - roomId: roomId, - config: JSON.stringify(config), - }); - } - - public async getRoom(roomId: string): Promise> { - const row = this.roomSelect.get({roomId: roomId}); - const val = row?.config; - return val ? JSON.parse(val) : null; - } - - public async setActiveUserDevices(userId: string, devices: UserDevice[]): Promise { - this.db.transaction(() => { - this.userUpsert.run({userId: userId, outdated: 0}); - this.userDevicesDelete.run({userId: userId}); - for (const device of devices) { - this.userDeviceUpsert.run({userId: userId, deviceId: device.device_id, device: JSON.stringify(device), active: 1}); - } - })(); - } - - public async getActiveUserDevices(userId: string): Promise { - const results = this.userActiveDevicesSelect.all({userId: userId}) - if (!results) return []; - return results.map(d => JSON.parse(d.device)); - } - - public async getActiveUserDevice(userId: string, deviceId: string): Promise { - const result = this.userActiveDeviceSelect.get({userId: userId, deviceId: deviceId}); - if (!result) return null; - return JSON.parse(result.device); - } - - public async getAllUserDevices(userId: string): Promise { - const results = this.userDevicesSelect.all({userId: userId}) - if (!results) return []; - return results.map(d => Object.assign({}, JSON.parse(d.device), {unsigned: {bsdkIsActive: d.active === 1}})); - } - - public async flagUsersOutdated(userIds: string[]): Promise { - this.db.transaction(() => { - for (const userId of userIds) { - this.userUpsert.run({userId: userId, outdated: 1}); - } - })(); - } - - public async isUserOutdated(userId: string): Promise { - const user = this.userSelect.get({userId: userId}); - return user ? Boolean(user.outdated) : true; - } - - public async storeOutboundGroupSession(session: IOutboundGroupSession): Promise { - this.db.transaction(() => { - if (session.isCurrent) { - this.obGroupSessionMarkAllInactive.run({ - roomId: session.roomId, - }); - } - this.obGroupSessionUpsert.run({ - sessionId: session.sessionId, - roomId: session.roomId, - pickled: session.pickled, - current: session.isCurrent ? 1 : 0, - usesLeft: session.usesLeft, - expiresTs: session.expiresTs, - }); - })(); - } - - public async getOutboundGroupSession(sessionId: string, roomId: string): Promise { - const result = this.obGroupSessionSelect.get({sessionId: sessionId, roomId: roomId}); - if (result) { - return { - sessionId: result.session_id, - roomId: result.room_id, - pickled: result.pickled, - isCurrent: result.current === 1, - usesLeft: result.uses_left, - expiresTs: result.expires_ts, - }; - } - return null; - } - - public async getCurrentOutboundGroupSession(roomId: string): Promise { - const result = this.obGroupCurrentSessionSelect.get({roomId: roomId}); - if (result) { - return { - sessionId: result.session_id, - roomId: result.room_id, - pickled: result.pickled, - isCurrent: result.current === 1, - usesLeft: result.uses_left, - expiresTs: result.expires_ts, - }; - } - return null; - } - - public async storeSentOutboundGroupSession(session: IOutboundGroupSession, index: number, device: UserDevice): Promise { - this.obSentGroupSessionUpsert.run({ - sessionId: session.sessionId, - roomId: session.roomId, - sessionIndex: index, - userId: device.user_id, - deviceId: device.device_id, - }); - } - - public async getLastSentOutboundGroupSession(userId: string, deviceId: string, roomId: string): Promise<{sessionId: string, index: number}> { - const result = this.obSentSelectLastSent.get({userId: userId, deviceId: deviceId, roomId: roomId}); - if (result) { - return {sessionId: result.session_id, index: result.session_index}; - } - return null; - } - - public async storeOlmSession(userId: string, deviceId: string, session: IOlmSession): Promise { - this.olmSessionUpsert.run({ - userId: userId, - deviceId: deviceId, - sessionId: session.sessionId, - lastDecryptionTs: session.lastDecryptionTs, - pickled: session.pickled, - }); - } - - public async getCurrentOlmSession(userId: string, deviceId: string): Promise { - const result = this.olmSessionCurrentSelect.get({userId: userId, deviceId: deviceId}); - if (!result) return null; - return { - sessionId: result.session_id, - pickled: result.pickled, - lastDecryptionTs: result.last_decryption_ts, - }; - } - - public async getOlmSessions(userId: string, deviceId: string): Promise { - const result = this.olmSessionSelect.all({ - userId: userId, - deviceId: deviceId, - }); - return (result || []).map(r => ({ - sessionId: r.session_id, - pickled: r.pickled, - lastDecryptionTs: r.last_decryption_ts, - })); - } - - public async storeInboundGroupSession(session: IInboundGroupSession): Promise { - this.ibGroupSessionUpsert.run({ - sessionId: session.sessionId, - roomId: session.roomId, - userId: session.senderUserId, - deviceId: session.senderDeviceId, - pickled: session.pickled, - }); - } - - public async getInboundGroupSession(senderUserId: string, senderDeviceId: string, roomId: string, sessionId: string): Promise { - const result = this.ibGroupSessionSelect.get({ - sessionId: sessionId, - roomId: roomId, - userId: senderUserId, - deviceId: senderDeviceId, - }); - if (result) { - return { - sessionId: result.session_id, - roomId: result.room_id, - senderUserId: result.user_id, - senderDeviceId: result.device_id, - pickled: result.pickled, - }; - } - return null; - } - - public async setMessageIndexForEvent(roomId: string, eventId: string, sessionId: string, messageIndex: number): Promise { - this.deMetadataUpsert.run({ - roomId: roomId, - eventId: eventId, - sessionId: sessionId, - messageIndex: messageIndex, - }); - } - - public async getEventForMessageIndex(roomId: string, sessionId: string, messageIndex: number): Promise { - const result = this.deMetadataSelect.get({roomId: roomId, sessionId: sessionId, messageIndex: messageIndex}); - return result?.event_id; - } - - /** - * Closes the crypto store. Primarily for testing purposes. - */ - public async close() { - this.db.close(); - } -} diff --git a/test/DMsTest.ts b/test/DMsTest.ts new file mode 100644 index 00000000..16a8d3ba --- /dev/null +++ b/test/DMsTest.ts @@ -0,0 +1,404 @@ +import { createTestClient, TEST_DEVICE_ID } from "./MatrixClientTest"; +import { DMs } from "../src/DMs"; +import * as expect from "expect"; +import * as simple from "simple-mock"; +import { EncryptionAlgorithm } from "../src"; + +describe('DMs', () => { + it('should update the cache when an sync requests happen', async () => { + const selfUserId = "@self:example.org"; + const {client, http} = createTestClient(null, selfUserId); + const dms = client.dms; + + const dmRoomId1 = "!dm:example.org"; + const dmUserId1 = "@one:example.org"; + const dmRoomId2 = "!dm2:example.org"; + const dmUserId2 = "@two:example.org"; + + const accountDataDms = { + [dmUserId2]: [dmRoomId2], + }; + + // noinspection TypeScriptValidateJSTypes + http.when("GET", `/user/${encodeURIComponent(selfUserId)}/account_data/m.direct`).respond(200, accountDataDms); + + // noinspection TypeScriptValidateJSTypes + http.when("PUT", `/user/${encodeURIComponent(selfUserId)}/account_data/m.direct`).respond(200, (path, body) => { + expect(body).toEqual({ + ...accountDataDms, + [dmUserId1]: [dmRoomId1], + }); + return {}; + }); + + http.flushAllExpected(); + + const accountHandleProm = new Promise(resolve => { + const orig = (dms).updateFromAccountData.bind(dms); + (dms).updateFromAccountData = simple.stub().callFn(async (ev) => { + await orig(ev); + resolve(); + }); + }); + const inviteHandleProm = new Promise(resolve => { + const orig = (dms).handleInvite.bind(dms); + (dms).handleInvite = simple.stub().callFn(async (rid, ev) => { + await orig(rid, ev); + resolve(); + }); + }); + + expect(dms.isDm(dmRoomId1)).toBe(false); + expect(dms.isDm(dmRoomId2)).toBe(false); + + client.emit("account_data", { + type: "m.direct", + content: { + "@unused:example.org": [ + "!WRONG:example.org", + ], + }, + }); + await accountHandleProm; + + expect(dms.isDm(dmRoomId1)).toBe(false); + expect(dms.isDm(dmRoomId2)).toBe(true); + + client.emit("room.invite", dmRoomId1, { + type: "m.room.member", + sender: dmUserId1, + state_key: selfUserId, + content: { + membership: "invite", + is_direct: true, + }, + }); + await inviteHandleProm; + + expect(dms.isDm(dmRoomId1)).toBe(true); + expect(dms.isDm(dmRoomId2)).toBe(true); + }); + + it('should update from account data when requested', async () => { + const selfUserId = "@self:example.org"; + const {client, http} = createTestClient(null, selfUserId); + const dms = client.dms; + + const dmRoomId = "!dm:example.org"; + const dmUserId = "@one:example.org"; + + const accountDataDms = { + [dmUserId]: [dmRoomId], + }; + + // noinspection TypeScriptValidateJSTypes + http.when("GET", `/user/${encodeURIComponent(selfUserId)}/account_data/m.direct`).respond(200, accountDataDms); + + http.flushAllExpected(); + expect(dms.isDm(dmRoomId)).toBe(false); + await dms.update(); + expect(dms.isDm(dmRoomId)).toBe(true); + }); + + it('should not fail to update when the account data is missing/fails', async () => { + const selfUserId = "@self:example.org"; + const {client, http} = createTestClient(null, selfUserId); + const dms = client.dms; + + const dmRoomId = "!dm:example.org"; + + // noinspection TypeScriptValidateJSTypes + http.when("GET", `/user/${encodeURIComponent(selfUserId)}/account_data/m.direct`).respond(404); + + http.flushAllExpected(); + expect(dms.isDm(dmRoomId)).toBe(false); + await dms.update(); + expect(dms.isDm(dmRoomId)).toBe(false); + }); + + it('should create a DM if one does not exist', async () => { + const selfUserId = "@self:example.org"; + const {client, http} = createTestClient(null, selfUserId); + const dms = client.dms; + + const dmRoomId = "!dm:example.org"; + const dmUserId = "@target:example.org"; + + // noinspection TypeScriptValidateJSTypes + http.when("POST", `/createRoom`).respond(200, (path, body) => { + expect(body).toEqual({ + invite: [dmUserId], + is_direct: true, + preset: "trusted_private_chat", + initial_state: [], + }); + + return {room_id: dmRoomId}; + }); + + // noinspection TypeScriptValidateJSTypes + http.when("PUT", `/user/${encodeURIComponent(selfUserId)}/account_data/m.direct`).respond(200, (path, body) => { + expect(body).toEqual({ + [dmUserId]: [dmRoomId], + }); + return {}; + }); + + http.flushAllExpected(); + + expect(dms.isDm(dmRoomId)).toBe(false); + const roomId = await dms.getOrCreateDm(dmUserId); + expect(roomId).toEqual(dmRoomId); + expect(dms.isDm(dmRoomId)).toBe(true); + }); + + it('should call the optional create room function when provided', async () => { + const selfUserId = "@self:example.org"; + const {client, http} = createTestClient(null, selfUserId); + const dms = client.dms; + + const dmRoomId = "!dm:example.org"; + const dmUserId = "@target:example.org"; + + const fn = simple.stub().callFn(async (uid) => { + expect(uid).toEqual(dmUserId); + return dmRoomId; + }); + + // noinspection TypeScriptValidateJSTypes + http.when("PUT", `/user/${encodeURIComponent(selfUserId)}/account_data/m.direct`).respond(200, (path, body) => { + expect(body).toEqual({ + [dmUserId]: [dmRoomId], + }); + return {}; + }); + + http.flushAllExpected(); + + expect(dms.isDm(dmRoomId)).toBe(false); + const roomId = await dms.getOrCreateDm(dmUserId, fn); + expect(roomId).toEqual(dmRoomId); + expect(dms.isDm(dmRoomId)).toBe(true); + expect(fn.callCount).toBe(1); + }); + + it('should try to patch up DMs when a DM is potentially known', async () => { + const selfUserId = "@self:example.org"; + const {client, http} = createTestClient(null, selfUserId); + const dms = client.dms; + + const dmRoomId = "!dm:example.org"; + const dmUserId = "@target:example.org"; + const deadRoomId = "!unused:example.org"; + + const accountDataDms = { + [dmUserId]: [deadRoomId, dmRoomId], + }; + + // noinspection TypeScriptValidateJSTypes + http.when("GET", `/user/${encodeURIComponent(selfUserId)}/account_data/m.direct`).respond(200, accountDataDms); + + // noinspection TypeScriptValidateJSTypes + http.when("GET", `rooms/${encodeURIComponent(deadRoomId)}/members`).respond(200, (path, body) => { + return { + chunk: [ + // HACK: These are minimal events for testing purposes only. + { + type: "m.room.member", + state_key: selfUserId, + content: { + membership: "join", + }, + }, + { + type: "m.room.member", + state_key: dmUserId, + content: { + membership: "leave", + }, + }, + ], + }; + }); + + // noinspection TypeScriptValidateJSTypes + http.when("GET", `rooms/${encodeURIComponent(dmRoomId)}/members`).respond(200, (path, body) => { + return { + chunk: [ + // HACK: These are minimal events for testing purposes only. + { + type: "m.room.member", + state_key: selfUserId, + content: { + membership: "join", + }, + }, + { + type: "m.room.member", + state_key: dmUserId, + content: { + membership: "join", + }, + }, + ], + }; + }); + + // noinspection TypeScriptValidateJSTypes + http.when("PUT", `/user/${encodeURIComponent(selfUserId)}/account_data/m.direct`).respond(200, (path, body) => { + expect(body).toEqual({ + [dmUserId]: [dmRoomId], + }); + return {}; + }); + + http.flushAllExpected(); + + await dms.update(); + expect(dms.isDm(dmRoomId)).toBe(true); + expect(dms.isDm(deadRoomId)).toBe(true); + const roomId = await dms.getOrCreateDm(dmUserId); + expect(roomId).toEqual(dmRoomId); + expect(dms.isDm(dmRoomId)).toBe(true); + expect(dms.isDm(deadRoomId)).toBe(false); + }); + + it('should use the cache if a DM already exists', async () => { + const selfUserId = "@self:example.org"; + const {client, http} = createTestClient(null, selfUserId); + const dms = client.dms; + + // Stop calls to `/members` + (dms).fixDms = () => Promise.resolve(); + + const dmRoomId = "!dm:example.org"; + const dmUserId = "@target:example.org"; + + const accountDataDms = { + [dmUserId]: [dmRoomId], + }; + + // noinspection TypeScriptValidateJSTypes + http.when("GET", `/user/${encodeURIComponent(selfUserId)}/account_data/m.direct`).respond(200, accountDataDms); + + http.flushAllExpected(); + + await dms.update(); + expect(dms.isDm(dmRoomId)).toBe(true); + const roomId = await dms.getOrCreateDm(dmUserId); + expect(roomId).toEqual(dmRoomId); + expect(dms.isDm(dmRoomId)).toBe(true); + }); + + it('should create an encrypted DM if supported', async () => { + const selfUserId = "@self:example.org"; + const {client, http} = createTestClient(null, selfUserId, true); + const dms = client.dms; + + const dmRoomId = "!dm:example.org"; + const dmUserId = "@target:example.org"; + + // noinspection TypeScriptValidateJSTypes + http.when("POST", `/keys/query`).respond(200, (path, body) => { + expect(body).toMatchObject({ + device_keys: { + [dmUserId]: [], + }, + }); + + return { + failures: {}, + device_keys: { + [dmUserId]: { + [TEST_DEVICE_ID]: { + user_id: dmUserId, + device_id: TEST_DEVICE_ID, + // mostly unused, but would be a device + }, + }, + }, + }; + }); + + // noinspection TypeScriptValidateJSTypes + http.when("POST", `/createRoom`).respond(200, (path, body) => { + expect(body).toEqual({ + invite: [dmUserId], + is_direct: true, + preset: "trusted_private_chat", + initial_state: [{ + type: "m.room.encryption", + state_key: "", + content: {algorithm: EncryptionAlgorithm.MegolmV1AesSha2}, + }], + }); + + return {room_id: dmRoomId}; + }); + + // noinspection TypeScriptValidateJSTypes + http.when("PUT", `/user/${encodeURIComponent(selfUserId)}/account_data/m.direct`).respond(200, (path, body) => { + expect(body).toEqual({ + [dmUserId]: [dmRoomId], + }); + return {}; + }); + + http.flushAllExpected(); + + expect(dms.isDm(dmRoomId)).toBe(false); + const roomId = await dms.getOrCreateDm(dmUserId); + expect(roomId).toEqual(dmRoomId); + expect(dms.isDm(dmRoomId)).toBe(true); + }); + + it('should create an unencrypted DM when the target user has no devices', async () => { + const selfUserId = "@self:example.org"; + const {client, http} = createTestClient(null, selfUserId, true); + const dms = client.dms; + + const dmRoomId = "!dm:example.org"; + const dmUserId = "@target:example.org"; + + // noinspection TypeScriptValidateJSTypes + http.when("POST", `/keys/query`).respond(200, (path, body) => { + expect(body).toMatchObject({ + device_keys: { + [dmUserId]: [], + }, + }); + + return { + failures: {}, + device_keys: {}, // none! + }; + }); + + // noinspection TypeScriptValidateJSTypes + http.when("POST", `/createRoom`).respond(200, (path, body) => { + expect(body).toEqual({ + invite: [dmUserId], + is_direct: true, + preset: "trusted_private_chat", + initial_state: [], + }); + + return {room_id: dmRoomId}; + }); + + // noinspection TypeScriptValidateJSTypes + http.when("PUT", `/user/${encodeURIComponent(selfUserId)}/account_data/m.direct`).respond(200, (path, body) => { + expect(body).toEqual({ + [dmUserId]: [dmRoomId], + }); + return {}; + }); + + http.flushAllExpected(); + + expect(dms.isDm(dmRoomId)).toBe(false); + const roomId = await dms.getOrCreateDm(dmUserId); + expect(roomId).toEqual(dmRoomId); + expect(dms.isDm(dmRoomId)).toBe(true); + }); +}); diff --git a/test/MatrixClientTest.ts b/test/MatrixClientTest.ts index cba9e9a1..384f5f82 100644 --- a/test/MatrixClientTest.ts +++ b/test/MatrixClientTest.ts @@ -16,14 +16,19 @@ import { OTKs, RoomDirectoryLookupResponse, RoomEvent, + RustSdkCryptoStorageProvider, setRequestFn, } from "../src"; +import * as tmp from "tmp"; import * as simple from "simple-mock"; import * as MockHttpBackend from 'matrix-mock-request'; -import { expectArrayEquals, feedOlmAccount, feedStaticOlmAccount } from "./TestUtils"; +import { expectArrayEquals } from "./TestUtils"; import { redactObjectForLogging } from "../src/http"; import { PowerLevelAction } from "../src/models/PowerLevelAction"; -import { SqliteCryptoStorageProvider } from "../src/storage/SqliteCryptoStorageProvider"; +import { InternalOlmMachineFactory } from "../src/e2ee/InternalOlmMachineFactory"; +import { OlmMachine, Signatures } from "@turt2live/matrix-sdk-crypto-nodejs"; + +tmp.setGracefulCleanup(); export const TEST_DEVICE_ID = "TEST_DEVICE"; @@ -31,28 +36,18 @@ export function createTestClient(storage: IStorageProvider = null, userId: strin const http = new MockHttpBackend(); const hsUrl = "https://localhost"; const accessToken = "s3cret"; - const client = new MatrixClient(hsUrl, accessToken, storage, crypto ? new SqliteCryptoStorageProvider(":memory:") : null); + const client = new MatrixClient(hsUrl, accessToken, storage, crypto ? new RustSdkCryptoStorageProvider(tmp.dirSync().name) : null); (client).userId = userId; // private member access setRequestFn(http.requestFn); return {http, hsUrl, accessToken, client}; } -export async function createPreparedCryptoTestClient(userId: string): Promise<{ client: MatrixClient, http: MockHttpBackend, hsUrl: string, accessToken: string }> { - const r = createTestClient(null, userId, true); - - await r.client.cryptoStore.setDeviceId(TEST_DEVICE_ID); - await feedStaticOlmAccount(r.client); - r.client.uploadDeviceKeys = () => Promise.resolve({}); - r.client.uploadDeviceOneTimeKeys = () => Promise.resolve({}); - r.client.checkOneTimeKeyCounts = () => Promise.resolve({}); - - await r.client.crypto.prepare([]); - - return r; -} - describe('MatrixClient', () => { + afterEach(() => { + InternalOlmMachineFactory.FACTORY_OVERRIDE = null; + }); + describe("constructor", () => { it('should pass through the homeserver URL and access token', () => { const homeserverUrl = "https://example.org"; @@ -78,7 +73,7 @@ describe('MatrixClient', () => { const homeserverUrl = "https://example.org"; const accessToken = "example_token"; - const client = new MatrixClient(homeserverUrl, accessToken, null, new SqliteCryptoStorageProvider(":memory:")); + const client = new MatrixClient(homeserverUrl, accessToken, null, new RustSdkCryptoStorageProvider(tmp.dirSync().name)); expect(client.crypto).toBeDefined(); }); @@ -105,6 +100,8 @@ describe('MatrixClient', () => { it('should reject upon error', async () => { const {client, http} = createTestClient(); + + // noinspection TypeScriptValidateJSTypes http.when("GET", "/test").respond(404, {error: "Not Found"}); try { @@ -122,6 +119,8 @@ describe('MatrixClient', () => { const {client, http} = createTestClient(); const expectedResponse = {test: 1234}; + + // noinspection TypeScriptValidateJSTypes http.when("GET", "/test").respond(200, expectedResponse); http.flushAllExpected(); @@ -133,6 +132,8 @@ describe('MatrixClient', () => { const {client, http} = createTestClient(); const expectedResponse = {test: 1234}; + + // noinspection TypeScriptValidateJSTypes http.when("GET", "/test").respond(200, expectedResponse); http.flushAllExpected(); @@ -144,6 +145,8 @@ describe('MatrixClient', () => { const {client, http} = createTestClient(); const expectedInput = {test: 1234}; + + // noinspection TypeScriptValidateJSTypes http.when("PUT", "/test").respond(200, (path, content) => { expect(content).toMatchObject(expectedInput); return {}; @@ -157,6 +160,8 @@ describe('MatrixClient', () => { const {client, http} = createTestClient(); const expectedInput = {test: 1234}; + + // noinspection TypeScriptValidateJSTypes http.when("GET", "/test").respond(200, (path, content, req) => { expect(req.opts.qs).toMatchObject(expectedInput); return {}; @@ -169,6 +174,7 @@ describe('MatrixClient', () => { it('should send the access token in the Authorization header', async () => { const {client, http, accessToken} = createTestClient(); + // noinspection TypeScriptValidateJSTypes http.when("GET", "/test").respond(200, (path, content, req) => { expect(req.opts.headers["Authorization"]).toEqual(`Bearer ${accessToken}`); return {}; @@ -181,6 +187,7 @@ describe('MatrixClient', () => { it('should send application/json by default', async () => { const {client, http} = createTestClient(); + // noinspection TypeScriptValidateJSTypes http.when("PUT", "/test").respond(200, (path, content, req) => { expect(req.opts.headers["Content-Type"]).toEqual("application/json"); return {}; @@ -197,6 +204,7 @@ describe('MatrixClient', () => { const fakeJson = `{"BUFFER": "HACK"}`; Buffer.isBuffer = (i => i === fakeJson); + // noinspection TypeScriptValidateJSTypes http.when("PUT", "/test").respond(200, (path, content, req) => { expect(req.opts.headers["Content-Type"]).toEqual(contentType); return {}; @@ -211,6 +219,7 @@ describe('MatrixClient', () => { const expectedOutput = {hello: "world"}; + // noinspection TypeScriptValidateJSTypes http.when("PUT", "/test").respond(200, expectedOutput); http.flushAllExpected(); @@ -224,6 +233,7 @@ describe('MatrixClient', () => { const timeout = 10; + // noinspection TypeScriptValidateJSTypes http.when("GET", "/test").respond(200, (path, content, req) => { expect(req.opts.timeout).toBe(timeout); }); @@ -240,13 +250,59 @@ describe('MatrixClient', () => { const userId = "@testing:example.org"; client.impersonateUserId(userId); + // noinspection TypeScriptValidateJSTypes + http.when("GET", "/test").respond(200, (path, content, req) => { + expect(req.opts.qs["user_id"]).toBe(userId); + expect(req.opts.qs["org.matrix.msc3202.device_id"]).toBe(undefined); + }); + + http.flushAllExpected(); + await client.doRequest("GET", "/test"); + }); + + it('should set a device_id param on requests', async () => { + const {client, http} = createTestClient(); + + const userId = "@testing:example.org"; + const deviceId = "DEVICE_TEST"; + client.impersonateUserId(userId, deviceId); + + // noinspection TypeScriptValidateJSTypes + http.when("GET", "/test").respond(200, (path, content, req) => { + expect(req.opts.qs["user_id"]).toBe(userId); + expect(req.opts.qs["org.matrix.msc3202.device_id"]).toBe(deviceId); + }); + + http.flushAllExpected(); + await client.doRequest("GET", "/test"); + }); + + it('should stop impersonation with a null user_id', async () => { + const {client, http} = createTestClient(); + + const userId = "@testing:example.org"; + client.impersonateUserId(userId); // set first + client.impersonateUserId(null); + + // noinspection TypeScriptValidateJSTypes http.when("GET", "/test").respond(200, (path, content, req) => { - expect(req.opts.qs.user_id).toBe(userId); + expect(req.opts.qs?.["user_id"]).toBe(undefined); + expect(req.opts.qs?.["org.matrix.msc3202.device_id"]).toBe(undefined); }); http.flushAllExpected(); await client.doRequest("GET", "/test"); }); + + it('should not allow impersonation of only a device ID', async () => { + const {client} = createTestClient(); + + try { + client.impersonateUserId(null, "DEVICE"); + } catch (e) { + expect(e.message).toBe("Cannot impersonate just a device: need a user ID"); + } + }); }); describe('unstableApis', () => { @@ -267,6 +323,15 @@ describe('MatrixClient', () => { }); }); + describe('dms', () => { + it('should always return an object', async () => { + const {client} = createTestClient(); + + const result = client.dms; + expect(result).toBeDefined(); + }); + }); + describe('getOpenIDConnectToken', () => { it('should call the right endpoint', async () => { const {client, http, hsUrl} = createTestClient(); @@ -281,6 +346,7 @@ describe('MatrixClient', () => { client.getUserId = () => Promise.resolve(userId); + // noinspection TypeScriptValidateJSTypes http.when("POST", "/_matrix/client/r0/user").respond(200, (path) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/user/${encodeURIComponent(userId)}/openid/request_token`); return testToken; @@ -295,7 +361,7 @@ describe('MatrixClient', () => { describe('getIdentityServerClient', () => { // This doubles as the test for IdentityClient#acquire() it('should prepare an identity server client', async () => { - const {client, http, hsUrl} = createTestClient(); + const {client, http} = createTestClient(); const testToken: OpenIDConnectToken = { access_token: "s3cret", @@ -310,6 +376,7 @@ describe('MatrixClient', () => { client.getUserId = () => Promise.resolve(userId); client.getOpenIDConnectToken = () => Promise.resolve(testToken); + // noinspection TypeScriptValidateJSTypes http.when("POST", "/_matrix/identity/v2/account").respond(200, (path) => { expect(path).toEqual(`https://${identityDomain}/_matrix/identity/v2/account/register`); return {token: identityToken}; @@ -330,6 +397,7 @@ describe('MatrixClient', () => { client.getUserId = () => Promise.resolve(userId); + // noinspection TypeScriptValidateJSTypes http.when("GET", "/_matrix/client/r0/user").respond(200, (path) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/user/${encodeURIComponent(userId)}/account_data/${encodeURIComponent(eventType)}`); return {}; @@ -349,6 +417,7 @@ describe('MatrixClient', () => { client.getUserId = () => Promise.resolve(userId); + // noinspection TypeScriptValidateJSTypes http.when("GET", "/_matrix/client/r0/user").respond(200, (path) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/user/${encodeURIComponent(userId)}/account_data/${encodeURIComponent(eventType)}`); return {}; @@ -359,7 +428,7 @@ describe('MatrixClient', () => { }); it('should return the default on error', async () => { - const {client, http, hsUrl} = createTestClient(); + const {client, http} = createTestClient(); const eventType = "io.t2bot.test.data"; const userId = "@test:example.org"; @@ -367,6 +436,7 @@ describe('MatrixClient', () => { client.getUserId = () => Promise.resolve(userId); + // noinspection TypeScriptValidateJSTypes http.when("GET", "/_matrix/client/r0/user").respond(404, {}); http.flushAllExpected(); @@ -389,6 +459,7 @@ describe('MatrixClient', () => { client.getUserId = () => Promise.resolve(userId); + // noinspection TypeScriptValidateJSTypes http.when("GET", "/_matrix/client/r0/presence").respond(200, (path) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/presence/${encodeURIComponent(userId)}/status`); return presenceObj; @@ -412,6 +483,7 @@ describe('MatrixClient', () => { currently_active: true, }; + // noinspection TypeScriptValidateJSTypes http.when("GET", "/_matrix/client/r0/presence").respond(200, (path) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/presence/${encodeURIComponent(userId)}/status`); return presenceObj; @@ -433,6 +505,7 @@ describe('MatrixClient', () => { client.getUserId = () => Promise.resolve(userId); + // noinspection TypeScriptValidateJSTypes http.when("PUT", "/_matrix/client/r0/presence").respond(200, (path, obj) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/presence/${encodeURIComponent(userId)}/status`); expect(obj).toMatchObject({ @@ -457,6 +530,7 @@ describe('MatrixClient', () => { client.getUserId = () => Promise.resolve(userId); + // noinspection TypeScriptValidateJSTypes http.when("GET", "/_matrix/client/r0/user").respond(200, (path) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/user/${encodeURIComponent(userId)}/rooms/${encodeURIComponent(roomId)}/account_data/${encodeURIComponent(eventType)}`); return {}; @@ -477,6 +551,7 @@ describe('MatrixClient', () => { client.getUserId = () => Promise.resolve(userId); + // noinspection TypeScriptValidateJSTypes http.when("GET", "/_matrix/client/r0/user").respond(200, (path) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/user/${encodeURIComponent(userId)}/rooms/${encodeURIComponent(roomId)}/account_data/${encodeURIComponent(eventType)}`); return {}; @@ -487,7 +562,7 @@ describe('MatrixClient', () => { }); it('should return the default on error', async () => { - const {client, http, hsUrl} = createTestClient(); + const {client, http} = createTestClient(); const eventType = "io.t2bot.test.data"; const roomId = "!test:example.org"; @@ -496,6 +571,7 @@ describe('MatrixClient', () => { client.getUserId = () => Promise.resolve(userId); + // noinspection TypeScriptValidateJSTypes http.when("GET", "/_matrix/client/r0/user").respond(404, {}); http.flushAllExpected(); @@ -514,6 +590,7 @@ describe('MatrixClient', () => { client.getUserId = () => Promise.resolve(userId); + // noinspection TypeScriptValidateJSTypes http.when("PUT", "/_matrix/client/r0/user").respond(200, (path, content) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/user/${encodeURIComponent(userId)}/account_data/${encodeURIComponent(eventType)}`); expect(content).toMatchObject(eventContent); @@ -536,6 +613,7 @@ describe('MatrixClient', () => { client.getUserId = () => Promise.resolve(userId); + // noinspection TypeScriptValidateJSTypes http.when("PUT", "/_matrix/client/r0/user").respond(200, (path, content) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/user/${encodeURIComponent(userId)}/rooms/${encodeURIComponent(roomId)}/account_data/${encodeURIComponent(eventType)}`); expect(content).toMatchObject(eventContent); @@ -549,10 +627,11 @@ describe('MatrixClient', () => { describe('getPublishedAlias', () => { it('should return falsey on 404', async () => { - const {client, http, hsUrl} = createTestClient(); + const {client, http} = createTestClient(); const roomId = "!abc:example.org"; + // noinspection TypeScriptValidateJSTypes http.when("GET", "/_matrix/client/r0/rooms/").respond(404, {}); http.flushAllExpected(); @@ -561,10 +640,11 @@ describe('MatrixClient', () => { }); it('should return falsey on no aliases (empty content)', async () => { - const {client, http, hsUrl} = createTestClient(); + const {client, http} = createTestClient(); const roomId = "!abc:example.org"; + // noinspection TypeScriptValidateJSTypes http.when("GET", "/_matrix/client/r0/rooms/").respond(200, {}); http.flushAllExpected(); @@ -573,12 +653,13 @@ describe('MatrixClient', () => { }); it('should return the canonical alias where possible', async () => { - const {client, http, hsUrl} = createTestClient(); + const {client, http} = createTestClient(); const roomId = "!abc:example.org"; const alias1 = "#test1:example.org"; const alias2 = "#test2:example.org"; + // noinspection TypeScriptValidateJSTypes http.when("GET", "/_matrix/client/r0/rooms/").respond(200, { alias: alias1, alt_aliases: [alias2], @@ -590,12 +671,13 @@ describe('MatrixClient', () => { }); it('should return the first alt alias where possible', async () => { - const {client, http, hsUrl} = createTestClient(); + const {client, http} = createTestClient(); const roomId = "!abc:example.org"; const alias1 = "#test1:example.org"; const alias2 = "#test2:example.org"; + // noinspection TypeScriptValidateJSTypes http.when("GET", "/_matrix/client/r0/rooms/").respond(200, { alt_aliases: [alias2, alias1], }); @@ -613,6 +695,7 @@ describe('MatrixClient', () => { const alias = "#test:example.org"; const roomId = "!abc:example.org"; + // noinspection TypeScriptValidateJSTypes http.when("PUT", "/_matrix/client/r0/directory/room/").respond(200, (path, content) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/directory/room/${encodeURIComponent(alias)}`); expect(content).toMatchObject({room_id: roomId}); @@ -630,7 +713,8 @@ describe('MatrixClient', () => { const alias = "#test:example.org"; - http.when("DELETE", "/_matrix/client/r0/directory/room/").respond(200, (path, content) => { + // noinspection TypeScriptValidateJSTypes + http.when("DELETE", "/_matrix/client/r0/directory/room/").respond(200, (path) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/directory/room/${encodeURIComponent(alias)}`); return {}; }); @@ -647,6 +731,7 @@ describe('MatrixClient', () => { const roomId = "!test:example.org"; const visibility = "public"; + // noinspection TypeScriptValidateJSTypes http.when("PUT", "/_matrix/client/r0/directory/list/room/").respond(200, (path, content) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/directory/list/room/${encodeURIComponent(roomId)}`); expect(content).toMatchObject({visibility: visibility}); @@ -664,7 +749,8 @@ describe('MatrixClient', () => { const roomId = "!test:example.org"; - http.when("GET", "/_matrix/client/r0/directory/list/room/").respond(200, (path, content) => { + // noinspection TypeScriptValidateJSTypes + http.when("GET", "/_matrix/client/r0/directory/list/room/").respond(200, (path) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/directory/list/room/${encodeURIComponent(roomId)}`); return {}; }); @@ -679,6 +765,7 @@ describe('MatrixClient', () => { const roomId = "!test:example.org"; const visibility = "public"; + // noinspection TypeScriptValidateJSTypes http.when("GET", "/_matrix/client/r0/directory/list/room/").respond(200, {visibility: visibility}); http.flushAllExpected(); @@ -702,7 +789,7 @@ describe('MatrixClient', () => { const roomId = "!abc123:example.org"; const alias = "#test:example.org"; - const spy = simple.stub().returnWith(new Promise(((resolve, reject) => resolve({ + const spy = simple.stub().returnWith(new Promise(((resolve) => resolve({ roomId: roomId, residentServers: [] })))); @@ -735,7 +822,8 @@ describe('MatrixClient', () => { const alias = "#test:example.org"; const servers = ["example.org", "localhost"]; - http.when("GET", "/_matrix/client/r0/directory/room/").respond(200, (path, content) => { + // noinspection TypeScriptValidateJSTypes + http.when("GET", "/_matrix/client/r0/directory/room/").respond(200, (path) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/directory/room/${encodeURIComponent(alias)}`); return {room_id: roomId, servers: servers}; }); @@ -751,6 +839,7 @@ describe('MatrixClient', () => { const alias = "#test:example.org"; const servers = ["example.org", "localhost"]; + // noinspection TypeScriptValidateJSTypes http.when("GET", "/_matrix/client/r0/directory/room/").respond(200, {room_id: roomId, servers: servers}); http.flushAllExpected(); @@ -764,8 +853,9 @@ describe('MatrixClient', () => { const {client, http, hsUrl} = createTestClient(); const roomId = "!abc123:example.org"; - const userId = "@example:matrix.org"; + const userId = "@example:example.org"; + // noinspection TypeScriptValidateJSTypes http.when("POST", "/_matrix/client/r0/rooms").respond(200, (path, content) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/invite`); expect(content).toMatchObject({user_id: userId}); @@ -782,8 +872,9 @@ describe('MatrixClient', () => { const {client, http, hsUrl} = createTestClient(); const roomId = "!abc123:example.org"; - const userId = "@example:matrix.org"; + const userId = "@example:example.org"; + // noinspection TypeScriptValidateJSTypes http.when("POST", "/_matrix/client/r0/rooms").respond(200, (path, content) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/kick`); expect(content).toMatchObject({user_id: userId}); @@ -798,9 +889,10 @@ describe('MatrixClient', () => { const {client, http, hsUrl} = createTestClient(); const roomId = "!abc123:example.org"; - const userId = "@example:matrix.org"; + const userId = "@example:example.org"; const reason = "Excessive unit testing"; + // noinspection TypeScriptValidateJSTypes http.when("POST", "/_matrix/client/r0/rooms").respond(200, (path, content) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/kick`); expect(content).toMatchObject({user_id: userId, reason: reason}); @@ -817,8 +909,9 @@ describe('MatrixClient', () => { const {client, http, hsUrl} = createTestClient(); const roomId = "!abc123:example.org"; - const userId = "@example:matrix.org"; + const userId = "@example:example.org"; + // noinspection TypeScriptValidateJSTypes http.when("POST", "/_matrix/client/r0/rooms").respond(200, (path, content) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/ban`); expect(content).toMatchObject({user_id: userId}); @@ -833,9 +926,10 @@ describe('MatrixClient', () => { const {client, http, hsUrl} = createTestClient(); const roomId = "!abc123:example.org"; - const userId = "@example:matrix.org"; + const userId = "@example:example.org"; const reason = "Excessive unit testing"; + // noinspection TypeScriptValidateJSTypes http.when("POST", "/_matrix/client/r0/rooms").respond(200, (path, content) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/ban`); expect(content).toMatchObject({user_id: userId, reason: reason}); @@ -852,8 +946,9 @@ describe('MatrixClient', () => { const {client, http, hsUrl} = createTestClient(); const roomId = "!abc123:example.org"; - const userId = "@example:matrix.org"; + const userId = "@example:example.org"; + // noinspection TypeScriptValidateJSTypes http.when("POST", "/_matrix/client/r0/rooms").respond(200, (path, content) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/unban`); expect(content).toMatchObject({user_id: userId}); @@ -869,7 +964,7 @@ describe('MatrixClient', () => { it('should return the user ID if it is already known', async () => { const {client} = createTestClient(); - const userId = "@example:matrix.org"; + const userId = "@example:example.org"; (client).userId = userId; const result = await client.getUserId(); @@ -877,11 +972,18 @@ describe('MatrixClient', () => { }); it('should request the user ID if it is not known', async () => { - const {client} = createTestClient(); + const {client, http} = createTestClient(); + + const userId = "@example:example.org"; + const response = { + user_id: userId, + device_id: "DEVICE", + }; - const userId = "@example:matrix.org"; - client.getWhoAmI = () => Promise.resolve({user_id: userId}); + // noinspection TypeScriptValidateJSTypes + http.when("GET", "/_matrix/client/r0/account/whoami").respond(200, response); + http.flushAllExpected(); const result = await client.getUserId(); expect(result).toEqual(userId); }); @@ -896,6 +998,7 @@ describe('MatrixClient', () => { device_id: "DEVICE", }; + // noinspection TypeScriptValidateJSTypes http.when("GET", "/_matrix/client/r0/account/whoami").respond(200, response); http.flushAllExpected(); @@ -913,12 +1016,17 @@ describe('MatrixClient', () => { const max = 5; let count = 0; + const dmsUpdate = simple.stub(); + client.dms.update = dmsUpdate; + // The sync handler checks which rooms it should ignore + // noinspection TypeScriptValidateJSTypes http.when("GET", "/_matrix/client/r0/joined_rooms").respond(200, {joined_rooms: []}); - const waitPromise = new Promise((resolve, reject) => { + const waitPromise = new Promise((resolve) => { for (let i = 0; i <= max * 2; i++) { - http.when("GET", "/_matrix/client/r0/sync").respond(200, (path, content) => { + // noinspection TypeScriptValidateJSTypes + http.when("GET", "/_matrix/client/r0/sync").respond(200, () => { expect(count).toBeLessThan(max + 1); count++; if (count === max) { @@ -937,6 +1045,7 @@ describe('MatrixClient', () => { expect(count).toBeLessThan(max); await waitPromise; expect(count).toBe(max); + expect(dmsUpdate.callCount).toBe(1); }).timeout(10000); }); @@ -945,6 +1054,9 @@ describe('MatrixClient', () => { const storage = new MemoryStorageProvider(); const {client, http} = createTestClient(storage); + const dmsMock = simple.stub(); + client.dms.update = dmsMock; + (client).userId = "@notused:example.org"; // to prevent calls to /whoami const filter = {rooms: {limit: 12}}; @@ -952,21 +1064,27 @@ describe('MatrixClient', () => { simple.mock(storage, "getFilter").returnWith({id: 12, filter: filter}); // The sync handler checks which rooms it should ignore + // noinspection TypeScriptValidateJSTypes http.when("GET", "/_matrix/client/r0/joined_rooms").respond(200, {joined_rooms: []}); - http.when("GET", "/_matrix/client/r0/sync").respond(200, (path, content) => { + // noinspection TypeScriptValidateJSTypes + http.when("GET", "/_matrix/client/r0/sync").respond(200, () => { client.stop(); return {next_batch: "123"}; }); http.flushAllExpected(); await client.start(filter); + expect(dmsMock.callCount).toBe(1); }); it('should create a filter when the stored filter is outdated', async () => { const storage = new MemoryStorageProvider(); const {client, http, hsUrl} = createTestClient(storage); + const dmsMock = simple.stub(); + client.dms.update = dmsMock; + const userId = "@testuser:example.org"; (client).userId = userId; // to prevent calls to /whoami @@ -981,8 +1099,10 @@ describe('MatrixClient', () => { }); // The sync handler checks which rooms it should ignore + // noinspection TypeScriptValidateJSTypes http.when("GET", "/_matrix/client/r0/joined_rooms").respond(200, {joined_rooms: []}); + // noinspection TypeScriptValidateJSTypes http.when("POST", "/_matrix/client/r0/user").respond(200, (path, content) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/user/${encodeURIComponent(userId)}/filter`); expect(content).toMatchObject(filter); @@ -993,12 +1113,16 @@ describe('MatrixClient', () => { http.flushAllExpected(); await client.start(filter); expect(setFilterFn.callCount).toBe(1); + expect(dmsMock.callCount).toBe(1); }); it('should create a filter when there is no stored filter', async () => { const storage = new MemoryStorageProvider(); const {client, http, hsUrl} = createTestClient(storage); + const dmsMock = simple.stub(); + client.dms.update = dmsMock; + const userId = "@testuser:example.org"; (client).userId = userId; // to prevent calls to /whoami @@ -1013,8 +1137,10 @@ describe('MatrixClient', () => { }); // The sync handler checks which rooms it should ignore + // noinspection TypeScriptValidateJSTypes http.when("GET", "/_matrix/client/r0/joined_rooms").respond(200, {joined_rooms: []}); + // noinspection TypeScriptValidateJSTypes http.when("POST", "/_matrix/client/r0/user").respond(200, (path, content) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/user/${encodeURIComponent(userId)}/filter`); expect(content).toMatchObject(filter); @@ -1026,12 +1152,16 @@ describe('MatrixClient', () => { await client.start(filter); expect(getFilterFn.callCount).toBe(1); expect(setFilterFn.callCount).toBe(1); + expect(dmsMock.callCount).toBe(1); }); it('should use the filter ID when syncing', async () => { const storage = new MemoryStorageProvider(); const {client, http} = createTestClient(storage); + const dmsMock = simple.stub(); + client.dms.update = dmsMock; + (client).userId = "@notused:example.org"; // to prevent calls to /whoami const filter = {rooms: {limit: 12}}; @@ -1040,8 +1170,10 @@ describe('MatrixClient', () => { simple.mock(storage, "getFilter").returnWith({id: filterId, filter: filter}); // The sync handler checks which rooms it should ignore + // noinspection TypeScriptValidateJSTypes http.when("GET", "/_matrix/client/r0/joined_rooms").respond(200, {joined_rooms: []}); + // noinspection TypeScriptValidateJSTypes http.when("GET", "/_matrix/client/r0/sync").respond(200, (path, content, req) => { expect(req).toBeDefined(); expect(req.opts.qs.filter).toEqual(filterId); @@ -1051,6 +1183,7 @@ describe('MatrixClient', () => { http.flushAllExpected(); await client.start(filter); + expect(dmsMock.callCount).toBe(1); }); it('should make sync requests with the new token', async () => { @@ -1059,11 +1192,14 @@ describe('MatrixClient', () => { (client).userId = "@notused:example.org"; // to prevent calls to /whoami + const dmsUpdate = simple.stub(); + client.dms.update = dmsUpdate; + const filter = {rooms: {limit: 12}}; const filterId = "abc12345"; const secondToken = "second"; - const waitPromise = new Promise(((resolve, reject) => { + const waitPromise = new Promise(((resolve) => { simple.mock(storage, "getFilter").returnWith({id: filterId, filter: filter}); const setSyncTokenFn = simple.mock(storage, "setSyncToken").callFn(newToken => { expect(newToken).toEqual(secondToken); @@ -1072,13 +1208,16 @@ describe('MatrixClient', () => { })); // The sync handler checks which rooms it should ignore + // noinspection TypeScriptValidateJSTypes http.when("GET", "/_matrix/client/r0/joined_rooms").respond(200, {joined_rooms: []}); + // noinspection TypeScriptValidateJSTypes http.when("GET", "/_matrix/client/r0/sync").respond(200, (path, content, req) => { expect(req).toBeDefined(); expect(req.opts.qs.since).toBeUndefined(); return {next_batch: secondToken}; }); + // noinspection TypeScriptValidateJSTypes http.when("GET", "/_matrix/client/r0/sync").respond(200, (path, content, req) => { expect(req).toBeDefined(); expect(req.opts.qs.since).toEqual(secondToken); @@ -1089,6 +1228,7 @@ describe('MatrixClient', () => { http.flushAllExpected(); await client.start(filter); await waitPromise; + expect(dmsUpdate.callCount).toBe(1); }); it('should read the sync token from the store', async () => { @@ -1097,13 +1237,16 @@ describe('MatrixClient', () => { (client).userId = "@notused:example.org"; // to prevent calls to /whoami + const dmsUpdate = simple.stub(); + client.dms.update = dmsUpdate; + const filter = {rooms: {limit: 12}}; const filterId = "abc12345"; const syncToken = "testing"; simple.mock(storage, "getFilter").returnWith({id: filterId, filter: filter}); const getSyncTokenFn = simple.mock(storage, "getSyncToken").returnWith(syncToken); - const waitPromise = new Promise(((resolve, reject) => { + const waitPromise = new Promise(((resolve) => { simple.mock(storage, "setSyncToken").callFn(newToken => { expect(newToken).toEqual(syncToken); resolve(); @@ -1111,8 +1254,10 @@ describe('MatrixClient', () => { })); // The sync handler checks which rooms it should ignore + // noinspection TypeScriptValidateJSTypes http.when("GET", "/_matrix/client/r0/joined_rooms").respond(200, {joined_rooms: []}); + // noinspection TypeScriptValidateJSTypes http.when("GET", "/_matrix/client/r0/sync").respond(200, (path, content, req) => { expect(req).toBeDefined(); @@ -1126,6 +1271,7 @@ describe('MatrixClient', () => { await client.start(filter); expect(getSyncTokenFn.callCount).toBe(1); await waitPromise; + expect(dmsUpdate.callCount).toBe(1); }); it('should use the syncing presence variable', async () => { @@ -1134,6 +1280,9 @@ describe('MatrixClient', () => { (client).userId = "@notused:example.org"; // to prevent calls to /whoami + const dmsUpdate = simple.stub(); + client.dms.update = dmsUpdate; + const filter = {rooms: {limit: 12}}; const filterId = "abc12345"; const presence = "online"; @@ -1141,14 +1290,17 @@ describe('MatrixClient', () => { simple.mock(storage, "getFilter").returnWith({id: filterId, filter: filter}); // The sync handler checks which rooms it should ignore + // noinspection TypeScriptValidateJSTypes http.when("GET", "/_matrix/client/r0/joined_rooms").respond(200, {joined_rooms: []}); + // noinspection TypeScriptValidateJSTypes http.when("GET", "/_matrix/client/r0/sync").respond(200, (path, content, req) => { expect(req).toBeDefined(); expect(req.opts.qs.presence).toBeUndefined(); client.syncingPresence = presence; return {next_batch: "testing"}; }); + // noinspection TypeScriptValidateJSTypes http.when("GET", "/_matrix/client/r0/sync").respond(200, (path, content, req) => { expect(req).toBeDefined(); expect(req.opts.qs.presence).toEqual(presence); @@ -1158,6 +1310,7 @@ describe('MatrixClient', () => { http.flushAllExpected(); await client.start(filter); + expect(dmsUpdate.callCount).toBe(1); }); }); @@ -1413,7 +1566,7 @@ describe('MatrixClient', () => { client.userId = userId; - const spy = simple.stub().callFn((rid, ev) => { + const spy = simple.stub().callFn((rid) => { // expect(ev).toMatchObject(events[1]); expect(rid).toEqual(roomId); }); @@ -1597,7 +1750,7 @@ describe('MatrixClient', () => { client.userId = userId; - const spy = simple.stub().callFn((rid, ev) => { + const spy = simple.stub().callFn((rid) => { // expect(ev).toMatchObject(events[1]); expect(rid).toEqual(roomId); }); @@ -2065,164 +2218,36 @@ describe('MatrixClient', () => { expect(eventSpy.callCount).toBe(5); }); - it('should handle to_device messages', async () => { - const { client } = createTestClient(null, "@user:example.org", true); - const syncClient = (client); - - // Override to fix test as we aren't testing this here. - client.crypto.updateFallbackKey = async () => null; - - const deviceMessage = { - type: "m.room.encrypted", - content: { - hello: "world", - }, - }; - const wrongMessage = { - type: "not-m.room.encrypted", - content: { - wrong: true, - }, - }; - - await client.cryptoStore.setDeviceId(TEST_DEVICE_ID); - await feedStaticOlmAccount(client); - client.uploadDeviceKeys = () => Promise.resolve({}); - client.uploadDeviceOneTimeKeys = () => Promise.resolve({}); - client.checkOneTimeKeyCounts = () => Promise.resolve({}); - - await client.crypto.prepare([]); - - const processSpy = simple.stub().callFn(async (message) => { - expect(message).toMatchObject(deviceMessage); - }); - client.crypto.processInboundDeviceMessage = processSpy; - - await syncClient.processSync({ - to_device: { - events: [wrongMessage, deviceMessage], - }, - }); - expect(processSpy.callCount).toBe(1); - }); - - it('should handle fallback key updates', async () => { - const { client } = createTestClient(null, "@user:example.org", true); - const syncClient = (client); - - await client.cryptoStore.setDeviceId(TEST_DEVICE_ID); - await feedStaticOlmAccount(client); - client.uploadDeviceKeys = () => Promise.resolve({}); - client.uploadDeviceOneTimeKeys = () => Promise.resolve({}); - client.checkOneTimeKeyCounts = () => Promise.resolve({}); - - await client.crypto.prepare([]); - - const updateSpy = simple.stub(); - client.crypto.updateFallbackKey = updateSpy; - - // Test workaround for https://github.com/matrix-org/synapse/issues/10618 - await syncClient.processSync({ - // no content - }); - expect(updateSpy.callCount).toBe(1); - updateSpy.reset(); - - // Test "no more fallback keys" state - await syncClient.processSync({ - "org.matrix.msc2732.device_unused_fallback_key_types": [], - "device_unused_fallback_key_types": [], - }); - expect(updateSpy.callCount).toBe(1); - updateSpy.reset(); - - // Test "has remaining fallback keys" - await syncClient.processSync({ - "org.matrix.msc2732.device_unused_fallback_key_types": ["signed_curve25519"], - "device_unused_fallback_key_types": ["signed_curve25519"], - }); - expect(updateSpy.callCount).toBe(0); - }); - - it('should decrypt timeline events', async () => { - const {client: realClient} = await createPreparedCryptoTestClient("@alice:example.org"); + it('should process crypto if enabled', async () => { + const {client: realClient} = createTestClient(null, "@alice:example.org", true); const client = (realClient); - // Override to fix test as we aren't testing this here. - realClient.crypto.updateFallbackKey = async () => null; - - const userId = "@syncing:example.org"; - const roomId = "!testing:example.org"; - const events = [ - { - type: "m.room.encrypted", - content: {newType: "m.room.message"}, + const sync = { + to_device: {events: [{type: "org.example", content: {hello: "world"}}]}, + device_unused_fallback_key_types: [OTKAlgorithm.Signed], + device_one_time_keys_count: { + [OTKAlgorithm.Signed]: 12, + [OTKAlgorithm.Unsigned]: 14, }, - { - type: "m.room.encrypted", - content: {newType: "m.room.not_message"}, + device_lists: { + changed: ["@bob:example.org"], + left: ["@charlie:example.org"], }, - ]; - - realClient.crypto.isRoomEncrypted = async () => true; // for the purposes of this test - - const decryptSpy = simple.stub().callFn(async (ev, rid) => { - expect(events).toContain(ev.raw); - expect(rid).toEqual(roomId); - return new RoomEvent({ - ...ev.raw, - type: ev.content.newType, - }); - }); - realClient.crypto.decryptRoomEvent = decryptSpy; - - const processSpy = simple.stub().callFn(async (ev) => { - if (ev['type'] === 'm.room.encrypted' && (processSpy.callCount%2 !== 0)) { - expect(events).toContain(ev); - } else if (ev['type'] === 'm.room.message') { - expect(ev.content).toMatchObject(events[0].content); - } else { - expect(ev.content).toMatchObject(events[1].content); - } - return ev; - }); - (realClient).processEvent = processSpy; - - client.userId = userId; - - const encryptedSpy = simple.stub(); - const decryptedSpy = simple.stub(); - const failedSpy = simple.stub(); - const messageSpy = simple.stub().callFn((rid, ev) => { - expect(rid).toEqual(roomId); - expect(ev["type"]).toEqual("m.room.message"); - expect(ev.content).toMatchObject(events[0].content); - }); - const eventSpy = simple.stub().callFn((rid, ev) => { - expect(rid).toEqual(roomId); + }; - if (ev['type'] === 'm.room.message') { - expect(ev.content).toMatchObject(events[0].content); - } else { - expect(ev.content).toMatchObject(events[1].content); - } + const spy = simple.stub().callFn((inbox, counts, unusedFallbacks, changed, left) => { + expect({ + to_device: {events: inbox}, + device_one_time_keys_count: counts, + device_unused_fallback_key_types: unusedFallbacks, + device_lists: {changed, left}, + }).toMatchObject(sync); + return Promise.resolve(); }); - realClient.on("room.encrypted_event", encryptedSpy); - realClient.on("room.decrypted_event", decryptedSpy); - realClient.on("room.failed_decryption", failedSpy); - realClient.on("room.message", messageSpy); - realClient.on("room.event", eventSpy); + realClient.crypto.updateSyncData = spy; - const roomsObj = {}; - roomsObj[roomId] = {timeline: {events: events}, invite_state: {events: events}}; - await client.processSync({rooms: {join: roomsObj, leave: roomsObj, invite: roomsObj}}); - expect(encryptedSpy.callCount).toBe(2); - expect(decryptedSpy.callCount).toBe(2); - expect(failedSpy.callCount).toBe(0); - expect(messageSpy.callCount).toBe(1); - expect(eventSpy.callCount).toBe(2); - expect(decryptSpy.callCount).toBe(2); - expect(processSpy.callCount).toBe(4); // 2 for encrypted, 2 for decrypted + await client.processSync(sync); + expect(spy.callCount).toBe(1); }); }); @@ -2231,10 +2256,11 @@ describe('MatrixClient', () => { const {client, http, hsUrl} = createTestClient(); const roomId = "!abc123:example.org"; - const eventId = "$example:matrix.org"; + const eventId = "$example:example.org"; const event = {type: "m.room.message"}; - http.when("GET", "/_matrix/client/r0/rooms").respond(200, (path, content) => { + // noinspection TypeScriptValidateJSTypes + http.when("GET", "/_matrix/client/r0/rooms").respond(200, (path) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/event/${encodeURIComponent(eventId)}`); return event; }); @@ -2248,7 +2274,7 @@ describe('MatrixClient', () => { const {client, http, hsUrl} = createTestClient(); const roomId = "!abc123:example.org"; - const eventId = "$example:matrix.org"; + const eventId = "$example:example.org"; const event = {type: "m.room.message"}; const processor = { processEvent: (ev, procClient, kind?) => { @@ -2260,7 +2286,8 @@ describe('MatrixClient', () => { client.addPreprocessor(processor); - http.when("GET", "/_matrix/client/r0/rooms").respond(200, (path, content) => { + // noinspection TypeScriptValidateJSTypes + http.when("GET", "/_matrix/client/r0/rooms").respond(200, (path) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/event/${encodeURIComponent(eventId)}`); return event; }); @@ -2272,10 +2299,10 @@ describe('MatrixClient', () => { }); it('should try decryption', async () => { - const {client, http, hsUrl} = await createPreparedCryptoTestClient("@alice:example.org"); + const {client, http, hsUrl} = createTestClient(null, "@alice:example.org", true); const roomId = "!abc123:example.org"; - const eventId = "$example:matrix.org"; + const eventId = "$example:example.org"; const event = {type: "m.room.encrypted", content: {encrypted: true}}; const decrypted = {type: "m.room.message", content: {hello: "world"}}; @@ -2302,7 +2329,8 @@ describe('MatrixClient', () => { }); (client).processEvent = processSpy; - http.when("GET", "/_matrix/client/r0/rooms").respond(200, (path, content) => { + // noinspection TypeScriptValidateJSTypes + http.when("GET", "/_matrix/client/r0/rooms").respond(200, (path) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/event/${encodeURIComponent(eventId)}`); return event; }); @@ -2316,10 +2344,10 @@ describe('MatrixClient', () => { }); it('should not try decryption in unencrypted rooms', async () => { - const {client, http, hsUrl} = await createPreparedCryptoTestClient("@alice:example.org"); + const {client, http, hsUrl} = createTestClient(null, "@alice:example.org", true); const roomId = "!abc123:example.org"; - const eventId = "$example:matrix.org"; + const eventId = "$example:example.org"; const event = {type: "m.room.encrypted", content: {encrypted: true}}; const decrypted = {type: "m.room.message", content: {hello: "world"}}; @@ -2346,7 +2374,8 @@ describe('MatrixClient', () => { }); (client).processEvent = processSpy; - http.when("GET", "/_matrix/client/r0/rooms").respond(200, (path, content) => { + // noinspection TypeScriptValidateJSTypes + http.when("GET", "/_matrix/client/r0/rooms").respond(200, (path) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/event/${encodeURIComponent(eventId)}`); return event; }); @@ -2365,10 +2394,11 @@ describe('MatrixClient', () => { const {client, http, hsUrl} = createTestClient(); const roomId = "!abc123:example.org"; - const eventId = "$example:matrix.org"; + const eventId = "$example:example.org"; const event = {type: "m.room.message"}; - http.when("GET", "/_matrix/client/r0/rooms").respond(200, (path, content) => { + // noinspection TypeScriptValidateJSTypes + http.when("GET", "/_matrix/client/r0/rooms").respond(200, (path) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/event/${encodeURIComponent(eventId)}`); return event; }); @@ -2382,7 +2412,7 @@ describe('MatrixClient', () => { const {client, http, hsUrl} = createTestClient(); const roomId = "!abc123:example.org"; - const eventId = "$example:matrix.org"; + const eventId = "$example:example.org"; const event = {type: "m.room.message"}; const processor = { processEvent: (ev, procClient, kind?) => { @@ -2394,7 +2424,8 @@ describe('MatrixClient', () => { client.addPreprocessor(processor); - http.when("GET", "/_matrix/client/r0/rooms").respond(200, (path, content) => { + // noinspection TypeScriptValidateJSTypes + http.when("GET", "/_matrix/client/r0/rooms").respond(200, (path) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/event/${encodeURIComponent(eventId)}`); return event; }); @@ -2406,10 +2437,10 @@ describe('MatrixClient', () => { }); it('should not try decryption in any rooms', async () => { - const {client, http, hsUrl} = await createPreparedCryptoTestClient("@alice:example.org"); + const {client, http, hsUrl} = createTestClient(null, "@alice:example.org", true); const roomId = "!abc123:example.org"; - const eventId = "$example:matrix.org"; + const eventId = "$example:example.org"; const event = {type: "m.room.encrypted", content: {encrypted: true}}; const decrypted = {type: "m.room.message", content: {hello: "world"}}; @@ -2436,7 +2467,8 @@ describe('MatrixClient', () => { }); (client).processEvent = processSpy; - http.when("GET", "/_matrix/client/r0/rooms").respond(200, (path, content) => { + // noinspection TypeScriptValidateJSTypes + http.when("GET", "/_matrix/client/r0/rooms").respond(200, (path) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/event/${encodeURIComponent(eventId)}`); return event; }); @@ -2457,7 +2489,8 @@ describe('MatrixClient', () => { const roomId = "!abc123:example.org"; const events = [{type: "m.room.message"}, {type: "m.room.not_message"}]; - http.when("GET", "/_matrix/client/r0/rooms").respond(200, (path, content) => { + // noinspection TypeScriptValidateJSTypes + http.when("GET", "/_matrix/client/r0/rooms").respond(200, (path) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/state`); return events; }); @@ -2486,7 +2519,8 @@ describe('MatrixClient', () => { client.addPreprocessor(processor); - http.when("GET", "/_matrix/client/r0/rooms").respond(200, (path, content) => { + // noinspection TypeScriptValidateJSTypes + http.when("GET", "/_matrix/client/r0/rooms").respond(200, (path) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/state`); return events; }); @@ -2514,7 +2548,8 @@ describe('MatrixClient', () => { const eventType = "m.room.message"; const event = {type: "m.room.message"}; - http.when("GET", "/_matrix/client/r0/rooms").respond(200, (path, content) => { + // noinspection TypeScriptValidateJSTypes + http.when("GET", "/_matrix/client/r0/rooms").respond(200, (path) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/state/${encodeURIComponent(eventType)}/`); return event; }); @@ -2532,7 +2567,8 @@ describe('MatrixClient', () => { const event = {type: "m.room.message"}; const stateKey = "testing"; - http.when("GET", "/_matrix/client/r0/rooms").respond(200, (path, content) => { + // noinspection TypeScriptValidateJSTypes + http.when("GET", "/_matrix/client/r0/rooms").respond(200, (path) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/state/${encodeURIComponent(eventType)}/${stateKey}`); return event; }); @@ -2558,7 +2594,8 @@ describe('MatrixClient', () => { client.addPreprocessor(processor); - http.when("GET", "/_matrix/client/r0/rooms").respond(200, (path, content) => { + // noinspection TypeScriptValidateJSTypes + http.when("GET", "/_matrix/client/r0/rooms").respond(200, (path) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/state/${encodeURIComponent(eventType)}/`); return event; }); @@ -2586,7 +2623,8 @@ describe('MatrixClient', () => { client.addPreprocessor(processor); - http.when("GET", "/_matrix/client/r0/rooms").respond(200, (path, content) => { + // noinspection TypeScriptValidateJSTypes + http.when("GET", "/_matrix/client/r0/rooms").respond(200, (path) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/state/${encodeURIComponent(eventType)}/${stateKey}`); return event; }); @@ -2619,6 +2657,7 @@ describe('MatrixClient', () => { const roomId = "!abc123:example.org"; const limit = 2; + // noinspection TypeScriptValidateJSTypes http.when("GET", "/_matrix/client/r0/rooms").respond(200, (path, content, req) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/context/${encodeURIComponent(targetEvent.eventId)}`); expect(req.opts.qs['limit']).toEqual(limit); @@ -2663,7 +2702,8 @@ describe('MatrixClient', () => { const userId = "@testing:example.org"; const profile = {displayname: "testing", avatar_url: "testing", extra: "testing"}; - http.when("GET", "/_matrix/client/r0/profile").respond(200, (path, content) => { + // noinspection TypeScriptValidateJSTypes + http.when("GET", "/_matrix/client/r0/profile").respond(200, (path) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/profile/${encodeURIComponent(userId)}`); return profile; }); @@ -2680,6 +2720,7 @@ describe('MatrixClient', () => { const roomId = "!something:example.org"; + // noinspection TypeScriptValidateJSTypes http.when("POST", "/_matrix/client/r0/createRoom").respond(200, (path, content) => { expect(content).toMatchObject({}); return {room_id: roomId}; @@ -2699,6 +2740,7 @@ describe('MatrixClient', () => { preset: "public_chat", }; + // noinspection TypeScriptValidateJSTypes http.when("POST", "/_matrix/client/r0/createRoom").respond(200, (path, content) => { expect(content).toMatchObject(properties); return {room_id: roomId}; @@ -2719,6 +2761,7 @@ describe('MatrixClient', () => { (client).userId = userId; // avoid /whoami lookup + // noinspection TypeScriptValidateJSTypes http.when("PUT", "/_matrix/client/r0/profile").respond(200, (path, content) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/profile/${encodeURIComponent(userId)}/displayname`); expect(content).toMatchObject({displayname: displayName}); @@ -2739,6 +2782,7 @@ describe('MatrixClient', () => { (client).userId = userId; // avoid /whoami lookup + // noinspection TypeScriptValidateJSTypes http.when("PUT", "/_matrix/client/r0/profile").respond(200, (path, content) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/profile/${encodeURIComponent(userId)}/avatar_url`); expect(content).toMatchObject({avatar_url: displayName}); @@ -2758,7 +2802,8 @@ describe('MatrixClient', () => { (client).userId = "@joins:example.org"; // avoid /whoami lookup - http.when("POST", "/_matrix/client/r0/join").respond(200, (path, content) => { + // noinspection TypeScriptValidateJSTypes + http.when("POST", "/_matrix/client/r0/join").respond(200, (path) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/join/${encodeURIComponent(roomId)}`); return {room_id: roomId}; }); @@ -2776,6 +2821,7 @@ describe('MatrixClient', () => { (client).userId = "@joins:example.org"; // avoid /whoami lookup + // noinspection TypeScriptValidateJSTypes http.when("POST", "/_matrix/client/r0/join").respond(200, (path, content, req) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/join/${encodeURIComponent(roomId)}`); expect(req.opts.qs['server_name'].length).toEqual(serverNames.length); @@ -2798,7 +2844,8 @@ describe('MatrixClient', () => { (client).userId = "@joins:example.org"; // avoid /whoami lookup - http.when("POST", "/_matrix/client/r0/join").respond(200, (path, content) => { + // noinspection TypeScriptValidateJSTypes + http.when("POST", "/_matrix/client/r0/join").respond(200, (path) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/join/${encodeURIComponent(roomAlias)}`); return {room_id: roomId}; }); @@ -2826,7 +2873,8 @@ describe('MatrixClient', () => { const strategySpy = simple.mock(strategy, "joinRoom").callOriginal(); - http.when("POST", "/_matrix/client/r0/join").respond(200, (path, content) => { + // noinspection TypeScriptValidateJSTypes + http.when("POST", "/_matrix/client/r0/join").respond(200, (path) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/join/${encodeURIComponent(roomId)}`); return {room_id: roomId}; }); @@ -2856,7 +2904,8 @@ describe('MatrixClient', () => { const strategySpy = simple.mock(strategy, "joinRoom").callOriginal(); - http.when("POST", "/_matrix/client/r0/join").respond(200, (path, content) => { + // noinspection TypeScriptValidateJSTypes + http.when("POST", "/_matrix/client/r0/join").respond(200, (path) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/join/${encodeURIComponent(roomId)}`); return {room_id: roomId}; }); @@ -2874,7 +2923,8 @@ describe('MatrixClient', () => { const roomIds = ["!abc:example.org", "!123:example.org"]; - http.when("GET", "/_matrix/client/r0/joined_rooms").respond(200, (path, content) => { + // noinspection TypeScriptValidateJSTypes + http.when("GET", "/_matrix/client/r0/joined_rooms").respond(200, (path) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/joined_rooms`); return {joined_rooms: roomIds}; }); @@ -2892,7 +2942,8 @@ describe('MatrixClient', () => { const roomId = "!testing:example.org"; const members = ["@alice:example.org", "@bob:example.org"]; - http.when("GET", "/_matrix/client/r0/rooms").respond(200, (path, content) => { + // noinspection TypeScriptValidateJSTypes + http.when("GET", "/_matrix/client/r0/rooms").respond(200, (path) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/joined_members`); const obj = {}; for (const member of members) obj[member] = {membership: "join"}; @@ -2920,6 +2971,7 @@ describe('MatrixClient', () => { } }; + // noinspection TypeScriptValidateJSTypes http.when("GET", "/_matrix/client/r0/rooms").respond(200, path => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/joined_members`); return {joined: members}; @@ -2955,7 +3007,8 @@ describe('MatrixClient', () => { }, ]; - http.when("GET", "/_matrix/client/r0/rooms").respond(200, (path, content) => { + // noinspection TypeScriptValidateJSTypes + http.when("GET", "/_matrix/client/r0/rooms").respond(200, (path) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/members`); return {chunk: memberEvents}; }); @@ -2993,6 +3046,7 @@ describe('MatrixClient', () => { ]; const atToken = "test_token"; + // noinspection TypeScriptValidateJSTypes http.when("GET", "/_matrix/client/r0/rooms").respond(200, (path, content, req) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/members`); expect(req.opts.qs.at).toEqual(atToken); @@ -3033,6 +3087,7 @@ describe('MatrixClient', () => { const forMemberships: Membership[] = ['join', 'leave']; const forNotMemberships: Membership[] = ['ban']; + // noinspection TypeScriptValidateJSTypes http.when("GET", "/_matrix/client/r0/rooms").respond(200, (path, content, req) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/members`); expectArrayEquals(forMemberships, req.opts.qs.membership); @@ -3057,7 +3112,8 @@ describe('MatrixClient', () => { const roomId = "!testing:example.org"; - http.when("POST", "/_matrix/client/r0/rooms").respond(200, (path, content) => { + // noinspection TypeScriptValidateJSTypes + http.when("POST", "/_matrix/client/r0/rooms").respond(200, (path) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/leave`); return {}; }); @@ -3074,7 +3130,8 @@ describe('MatrixClient', () => { const roomId = "!testing:example.org"; const eventId = "$something:example.org"; - http.when("POST", "/_matrix/client/r0/rooms").respond(200, (path, content) => { + // noinspection TypeScriptValidateJSTypes + http.when("POST", "/_matrix/client/r0/rooms").respond(200, (path) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/receipt/m.read/${encodeURIComponent(eventId)}`); return {}; }); @@ -3095,6 +3152,7 @@ describe('MatrixClient', () => { client.getUserId = () => Promise.resolve(userId); + // noinspection TypeScriptValidateJSTypes http.when("PUT", "/_matrix/client/r0/rooms").respond(200, (path, content) => { expect(path).toEqual(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/typing/${encodeURIComponent(userId)}`); expect(content).toMatchObject({typing: typing, timeout: timeout}); @@ -3135,6 +3193,7 @@ describe('MatrixClient', () => { formatted_body: `
In reply to ${originalEvent.sender}
${originalEvent.content.formatted_body}
${replyHtml}`, }; + // noinspection TypeScriptValidateJSTypes http.when("PUT", "/_matrix/client/r0/rooms").respond(200, (path, content) => { const idx = path.indexOf(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/send/m.room.message/`); expect(idx).toBe(0); @@ -3148,7 +3207,7 @@ describe('MatrixClient', () => { }); it('should try to encrypt in encrypted rooms', async () => { - const {client, http, hsUrl} = await createPreparedCryptoTestClient("@alice:example.org"); + const {client, http, hsUrl} = createTestClient(null, "@alice:example.org", true); const roomId = "!testing:example.org"; const eventId = "$something:example.org"; @@ -3187,6 +3246,7 @@ describe('MatrixClient', () => { return expectedContent as any; }; + // noinspection TypeScriptValidateJSTypes http.when("PUT", "/_matrix/client/r0/rooms").respond(200, (path, content) => { const idx = path.indexOf(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/send/m.room.encrypted/`); expect(idx).toBe(0); @@ -3200,7 +3260,7 @@ describe('MatrixClient', () => { }); it('should not try to encrypt in unencrypted rooms', async () => { - const {client, http, hsUrl} = await createPreparedCryptoTestClient("@alice:example.org"); + const {client, http, hsUrl} = createTestClient(null, "@alice:example.org", true); const roomId = "!testing:example.org"; const eventId = "$something:example.org"; @@ -3229,6 +3289,7 @@ describe('MatrixClient', () => { client.crypto.isRoomEncrypted = async () => false; // for this test + // noinspection TypeScriptValidateJSTypes http.when("PUT", "/_matrix/client/r0/rooms").respond(200, (path, content) => { const idx = path.indexOf(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/send/m.room.message/`); expect(idx).toBe(0); @@ -3269,6 +3330,7 @@ describe('MatrixClient', () => { formatted_body: `
In reply to ${originalEvent.sender}
${originalEvent.content.formatted_body}
${replyHtml}`, }; + // noinspection TypeScriptValidateJSTypes http.when("PUT", "/_matrix/client/r0/rooms").respond(200, (path, content) => { const idx = path.indexOf(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/send/m.room.message/`); expect(idx).toBe(0); @@ -3311,6 +3373,7 @@ describe('MatrixClient', () => { formatted_body: `
In reply to ${originalEvent.sender}
${originalEvent.content.formatted_body}
${replyHtml}`, }; + // noinspection TypeScriptValidateJSTypes http.when("PUT", "/_matrix/client/r0/rooms").respond(200, (path, content) => { const idx = path.indexOf(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/send/m.room.message/`); expect(idx).toBe(0); @@ -3324,7 +3387,7 @@ describe('MatrixClient', () => { }); it('should try to encrypt in encrypted rooms', async () => { - const {client, http, hsUrl} = await createPreparedCryptoTestClient("@alice:example.org"); + const {client, http, hsUrl} = createTestClient(null, "@alice:example.org", true); const roomId = "!testing:example.org"; const eventId = "$something:example.org"; @@ -3363,6 +3426,7 @@ describe('MatrixClient', () => { return expectedContent as any; }; + // noinspection TypeScriptValidateJSTypes http.when("PUT", "/_matrix/client/r0/rooms").respond(200, (path, content) => { const idx = path.indexOf(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/send/m.room.encrypted/`); expect(idx).toBe(0); @@ -3376,7 +3440,7 @@ describe('MatrixClient', () => { }); it('should not try to encrypt in unencrypted rooms', async () => { - const {client, http, hsUrl} = await createPreparedCryptoTestClient("@alice:example.org"); + const {client, http, hsUrl} = createTestClient(null, "@alice:example.org", true); const roomId = "!testing:example.org"; const eventId = "$something:example.org"; @@ -3405,6 +3469,7 @@ describe('MatrixClient', () => { client.crypto.isRoomEncrypted = async () => false; // for this test + // noinspection TypeScriptValidateJSTypes http.when("PUT", "/_matrix/client/r0/rooms").respond(200, (path, content) => { const idx = path.indexOf(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/send/m.room.message/`); expect(idx).toBe(0); @@ -3447,6 +3512,7 @@ describe('MatrixClient', () => { formatted_body: `
In reply to ${originalEvent.sender}
${originalEvent.content.formatted_body}
${replyHtml}`, }; + // noinspection TypeScriptValidateJSTypes http.when("PUT", "/_matrix/client/r0/rooms").respond(200, (path, content) => { const idx = path.indexOf(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/send/m.room.message/`); expect(idx).toBe(0); @@ -3460,7 +3526,7 @@ describe('MatrixClient', () => { }); it('should try to encrypt in encrypted rooms', async () => { - const {client, http, hsUrl} = await createPreparedCryptoTestClient("@alice:example.org"); + const {client, http, hsUrl} = createTestClient(null, "@alice:example.org", true); const roomId = "!testing:example.org"; const eventId = "$something:example.org"; @@ -3499,6 +3565,7 @@ describe('MatrixClient', () => { return expectedContent as any; }; + // noinspection TypeScriptValidateJSTypes http.when("PUT", "/_matrix/client/r0/rooms").respond(200, (path, content) => { const idx = path.indexOf(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/send/m.room.encrypted/`); expect(idx).toBe(0); @@ -3512,7 +3579,7 @@ describe('MatrixClient', () => { }); it('should not try to encrypt in unencrypted rooms', async () => { - const {client, http, hsUrl} = await createPreparedCryptoTestClient("@alice:example.org"); + const {client, http, hsUrl} = createTestClient(null, "@alice:example.org", true); const roomId = "!testing:example.org"; const eventId = "$something:example.org"; @@ -3541,6 +3608,7 @@ describe('MatrixClient', () => { client.crypto.isRoomEncrypted = async () => false; // for this test + // noinspection TypeScriptValidateJSTypes http.when("PUT", "/_matrix/client/r0/rooms").respond(200, (path, content) => { const idx = path.indexOf(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/send/m.room.message/`); expect(idx).toBe(0); @@ -3581,6 +3649,7 @@ describe('MatrixClient', () => { formatted_body: `
In reply to ${originalEvent.sender}
${originalEvent.content.formatted_body}
${replyHtml}`, }; + // noinspection TypeScriptValidateJSTypes http.when("PUT", "/_matrix/client/r0/rooms").respond(200, (path, content) => { const idx = path.indexOf(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/send/m.room.message/`); expect(idx).toBe(0); @@ -3623,6 +3692,7 @@ describe('MatrixClient', () => { formatted_body: `
In reply to ${originalEvent.sender}
${originalEvent.content.formatted_body}
${replyHtml}`, }; + // noinspection TypeScriptValidateJSTypes http.when("PUT", "/_matrix/client/r0/rooms").respond(200, (path, content) => { const idx = path.indexOf(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/send/m.room.message/`); expect(idx).toBe(0); @@ -3636,7 +3706,7 @@ describe('MatrixClient', () => { }); it('should try to encrypt in encrypted rooms', async () => { - const {client, http, hsUrl} = await createPreparedCryptoTestClient("@alice:example.org"); + const {client, http, hsUrl} = createTestClient(null, "@alice:example.org", true); const roomId = "!testing:example.org"; const eventId = "$something:example.org"; @@ -3675,6 +3745,7 @@ describe('MatrixClient', () => { return expectedContent as any; }; + // noinspection TypeScriptValidateJSTypes http.when("PUT", "/_matrix/client/r0/rooms").respond(200, (path, content) => { const idx = path.indexOf(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/send/m.room.encrypted/`); expect(idx).toBe(0); @@ -3688,7 +3759,7 @@ describe('MatrixClient', () => { }); it('should not try to encrypt in unencrypted rooms', async () => { - const {client, http, hsUrl} = await createPreparedCryptoTestClient("@alice:example.org"); + const {client, http, hsUrl} = createTestClient(null, "@alice:example.org", true); const roomId = "!testing:example.org"; const eventId = "$something:example.org"; @@ -3717,6 +3788,7 @@ describe('MatrixClient', () => { client.crypto.isRoomEncrypted = async () => false; // for this test + // noinspection TypeScriptValidateJSTypes http.when("PUT", "/_matrix/client/r0/rooms").respond(200, (path, content) => { const idx = path.indexOf(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/send/m.room.message/`); expect(idx).toBe(0); @@ -3741,6 +3813,7 @@ describe('MatrixClient', () => { msgtype: "m.notice", }; + // noinspection TypeScriptValidateJSTypes http.when("PUT", "/_matrix/client/r0/rooms").respond(200, (path, content) => { const idx = path.indexOf(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/send/m.room.message/`); expect(idx).toBe(0); @@ -3754,7 +3827,7 @@ describe('MatrixClient', () => { }); it('should try to encrypt in encrypted rooms', async () => { - const {client, http, hsUrl} = await createPreparedCryptoTestClient("@alice:example.org"); + const {client, http, hsUrl} = createTestClient(null, "@alice:example.org", true); const roomId = "!testing:example.org"; const eventId = "$something:example.org"; @@ -3776,6 +3849,7 @@ describe('MatrixClient', () => { return eventContent as any; }; + // noinspection TypeScriptValidateJSTypes http.when("PUT", "/_matrix/client/r0/rooms").respond(200, (path, content) => { const idx = path.indexOf(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/send/m.room.encrypted/`); expect(idx).toBe(0); @@ -3789,7 +3863,7 @@ describe('MatrixClient', () => { }); it('should not try to encrypt in unencrypted rooms', async () => { - const {client, http, hsUrl} = await createPreparedCryptoTestClient("@alice:example.org"); + const {client, http, hsUrl} = createTestClient(null, "@alice:example.org", true); const roomId = "!testing:example.org"; const eventId = "$something:example.org"; @@ -3800,6 +3874,7 @@ describe('MatrixClient', () => { client.crypto.isRoomEncrypted = async () => false; // for this test + // noinspection TypeScriptValidateJSTypes http.when("PUT", "/_matrix/client/r0/rooms").respond(200, (path, content) => { const idx = path.indexOf(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/send/m.room.message/`); expect(idx).toBe(0); @@ -3826,6 +3901,7 @@ describe('MatrixClient', () => { formatted_body: "

Hello World

", }; + // noinspection TypeScriptValidateJSTypes http.when("PUT", "/_matrix/client/r0/rooms").respond(200, (path, content) => { const idx = path.indexOf(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/send/m.room.message/`); expect(idx).toBe(0); @@ -3839,7 +3915,7 @@ describe('MatrixClient', () => { }); it('should try to encrypt in encrypted rooms', async () => { - const {client, http, hsUrl} = await createPreparedCryptoTestClient("@alice:example.org"); + const {client, http, hsUrl} = createTestClient(null, "@alice:example.org", true); const roomId = "!testing:example.org"; const eventId = "$something:example.org"; @@ -3863,6 +3939,7 @@ describe('MatrixClient', () => { return eventContent as any; }; + // noinspection TypeScriptValidateJSTypes http.when("PUT", "/_matrix/client/r0/rooms").respond(200, (path, content) => { const idx = path.indexOf(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/send/m.room.encrypted/`); expect(idx).toBe(0); @@ -3876,7 +3953,7 @@ describe('MatrixClient', () => { }); it('should not try to encrypt in unencrypted rooms', async () => { - const {client, http, hsUrl} = await createPreparedCryptoTestClient("@alice:example.org"); + const {client, http, hsUrl} = createTestClient(null, "@alice:example.org", true); const roomId = "!testing:example.org"; const eventId = "$something:example.org"; @@ -3889,6 +3966,7 @@ describe('MatrixClient', () => { client.crypto.isRoomEncrypted = async () => false; // for this test + // noinspection TypeScriptValidateJSTypes http.when("PUT", "/_matrix/client/r0/rooms").respond(200, (path, content) => { const idx = path.indexOf(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/send/m.room.message/`); expect(idx).toBe(0); @@ -3913,6 +3991,7 @@ describe('MatrixClient', () => { msgtype: "m.text", }; + // noinspection TypeScriptValidateJSTypes http.when("PUT", "/_matrix/client/r0/rooms").respond(200, (path, content) => { const idx = path.indexOf(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/send/m.room.message/`); expect(idx).toBe(0); @@ -3926,7 +4005,7 @@ describe('MatrixClient', () => { }); it('should try to encrypt in encrypted rooms', async () => { - const {client, http, hsUrl} = await createPreparedCryptoTestClient("@alice:example.org"); + const {client, http, hsUrl} = createTestClient(null, "@alice:example.org", true); const roomId = "!testing:example.org"; const eventId = "$something:example.org"; @@ -3948,6 +4027,7 @@ describe('MatrixClient', () => { return eventContent as any; }; + // noinspection TypeScriptValidateJSTypes http.when("PUT", "/_matrix/client/r0/rooms").respond(200, (path, content) => { const idx = path.indexOf(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/send/m.room.encrypted/`); expect(idx).toBe(0); @@ -3961,7 +4041,7 @@ describe('MatrixClient', () => { }); it('should not try to encrypt in unencrypted rooms', async () => { - const {client, http, hsUrl} = await createPreparedCryptoTestClient("@alice:example.org"); + const {client, http, hsUrl} = createTestClient(null, "@alice:example.org", true); const roomId = "!testing:example.org"; const eventId = "$something:example.org"; @@ -3972,6 +4052,7 @@ describe('MatrixClient', () => { client.crypto.isRoomEncrypted = async () => false; // for this test + // noinspection TypeScriptValidateJSTypes http.when("PUT", "/_matrix/client/r0/rooms").respond(200, (path, content) => { const idx = path.indexOf(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/send/m.room.message/`); expect(idx).toBe(0); @@ -3998,6 +4079,7 @@ describe('MatrixClient', () => { formatted_body: "

Hello World

", }; + // noinspection TypeScriptValidateJSTypes http.when("PUT", "/_matrix/client/r0/rooms").respond(200, (path, content) => { const idx = path.indexOf(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/send/m.room.message/`); expect(idx).toBe(0); @@ -4011,7 +4093,7 @@ describe('MatrixClient', () => { }); it('should try to encrypt in encrypted rooms', async () => { - const {client, http, hsUrl} = await createPreparedCryptoTestClient("@alice:example.org"); + const {client, http, hsUrl} = createTestClient(null, "@alice:example.org", true); const roomId = "!testing:example.org"; const eventId = "$something:example.org"; @@ -4035,6 +4117,7 @@ describe('MatrixClient', () => { return eventContent as any; }; + // noinspection TypeScriptValidateJSTypes http.when("PUT", "/_matrix/client/r0/rooms").respond(200, (path, content) => { const idx = path.indexOf(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/send/m.room.encrypted/`); expect(idx).toBe(0); @@ -4048,7 +4131,7 @@ describe('MatrixClient', () => { }); it('should not try to encrypt in unencrypted rooms', async () => { - const {client, http, hsUrl} = await createPreparedCryptoTestClient("@alice:example.org"); + const {client, http, hsUrl} = createTestClient(null, "@alice:example.org", true); const roomId = "!testing:example.org"; const eventId = "$something:example.org"; @@ -4061,6 +4144,7 @@ describe('MatrixClient', () => { client.crypto.isRoomEncrypted = async () => false; // for this test + // noinspection TypeScriptValidateJSTypes http.when("PUT", "/_matrix/client/r0/rooms").respond(200, (path, content) => { const idx = path.indexOf(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/send/m.room.message/`); expect(idx).toBe(0); @@ -4086,6 +4170,7 @@ describe('MatrixClient', () => { sample: true, }; + // noinspection TypeScriptValidateJSTypes http.when("PUT", "/_matrix/client/r0/rooms").respond(200, (path, content) => { const idx = path.indexOf(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/send/m.room.message/`); expect(idx).toBe(0); @@ -4099,7 +4184,7 @@ describe('MatrixClient', () => { }); it('should try to encrypt in encrypted rooms', async () => { - const {client, http, hsUrl} = await createPreparedCryptoTestClient("@alice:example.org"); + const {client, http, hsUrl} = createTestClient(null, "@alice:example.org", true); const roomId = "!testing:example.org"; const eventId = "$something:example.org"; @@ -4122,6 +4207,7 @@ describe('MatrixClient', () => { return eventContent as any; }; + // noinspection TypeScriptValidateJSTypes http.when("PUT", "/_matrix/client/r0/rooms").respond(200, (path, content) => { const idx = path.indexOf(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/send/m.room.encrypted/`); expect(idx).toBe(0); @@ -4135,7 +4221,7 @@ describe('MatrixClient', () => { }); it('should not try to encrypt in unencrypted rooms', async () => { - const {client, http, hsUrl} = await createPreparedCryptoTestClient("@alice:example.org"); + const {client, http, hsUrl} = createTestClient(null, "@alice:example.org", true); const roomId = "!testing:example.org"; const eventId = "$something:example.org"; @@ -4147,6 +4233,7 @@ describe('MatrixClient', () => { client.crypto.isRoomEncrypted = async () => false; // for this test + // noinspection TypeScriptValidateJSTypes http.when("PUT", "/_matrix/client/r0/rooms").respond(200, (path, content) => { const idx = path.indexOf(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/send/m.room.message/`); expect(idx).toBe(0); @@ -4172,6 +4259,7 @@ describe('MatrixClient', () => { sample: true, }; + // noinspection TypeScriptValidateJSTypes http.when("PUT", "/_matrix/client/r0/rooms").respond(200, (path, content) => { const idx = path.indexOf(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/send/${encodeURIComponent(eventType)}/`); expect(idx).toBe(0); @@ -4185,7 +4273,7 @@ describe('MatrixClient', () => { }); it('should try to encrypt in encrypted rooms', async () => { - const {client, http, hsUrl} = await createPreparedCryptoTestClient("@alice:example.org"); + const {client, http, hsUrl} = createTestClient(null, "@alice:example.org", true); const roomId = "!testing:example.org"; const eventId = "$something:example.org"; @@ -4209,6 +4297,7 @@ describe('MatrixClient', () => { return eventContent as any; }; + // noinspection TypeScriptValidateJSTypes http.when("PUT", "/_matrix/client/r0/rooms").respond(200, (path, content) => { const idx = path.indexOf(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/send/${encodeURIComponent(sEventType)}/`); expect(idx).toBe(0); @@ -4222,7 +4311,7 @@ describe('MatrixClient', () => { }); it('should not try to encrypt in unencrypted rooms', async () => { - const {client, http, hsUrl} = await createPreparedCryptoTestClient("@alice:example.org"); + const {client, http, hsUrl} = createTestClient(null, "@alice:example.org", true); const roomId = "!testing:example.org"; const eventId = "$something:example.org"; @@ -4234,6 +4323,7 @@ describe('MatrixClient', () => { client.crypto.isRoomEncrypted = async () => false; // for this test + // noinspection TypeScriptValidateJSTypes http.when("PUT", "/_matrix/client/r0/rooms").respond(200, (path, content) => { const idx = path.indexOf(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/send/${encodeURIComponent(eventType)}/`); expect(idx).toBe(0); @@ -4259,6 +4349,7 @@ describe('MatrixClient', () => { sample: true, }; + // noinspection TypeScriptValidateJSTypes http.when("PUT", "/_matrix/client/r0/rooms").respond(200, (path, content) => { const idx = path.indexOf(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/send/${encodeURIComponent(eventType)}/`); expect(idx).toBe(0); @@ -4272,7 +4363,7 @@ describe('MatrixClient', () => { }); it('should not try to encrypt in any rooms', async () => { - const {client, http, hsUrl} = await createPreparedCryptoTestClient("@alice:example.org"); + const {client, http, hsUrl} = createTestClient(null, "@alice:example.org", true); const roomId = "!testing:example.org"; const eventId = "$something:example.org"; @@ -4284,6 +4375,7 @@ describe('MatrixClient', () => { client.crypto.isRoomEncrypted = async () => true; // for this test + // noinspection TypeScriptValidateJSTypes http.when("PUT", "/_matrix/client/r0/rooms").respond(200, (path, content) => { const idx = path.indexOf(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/send/${encodeURIComponent(eventType)}/`); expect(idx).toBe(0); @@ -4311,6 +4403,7 @@ describe('MatrixClient', () => { sample: true, }; + // noinspection TypeScriptValidateJSTypes http.when("PUT", "/_matrix/client/r0/rooms").respond(200, (path, content) => { const idx = path.indexOf(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/state/${encodeURIComponent(eventType)}/`); expect(idx).toBe(0); @@ -4336,6 +4429,7 @@ describe('MatrixClient', () => { sample: true, }; + // noinspection TypeScriptValidateJSTypes http.when("PUT", "/_matrix/client/r0/rooms").respond(200, (path, content) => { const idx = path.indexOf(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/state/${encodeURIComponent(eventType)}/`); expect(idx).toBe(0); @@ -4357,6 +4451,7 @@ describe('MatrixClient', () => { const eventId = "$something:example.org"; const reason = "Zvarri!"; + // noinspection TypeScriptValidateJSTypes http.when("PUT", "/_matrix/client/r0/rooms").respond(200, (path, content) => { const idx = path.indexOf(`${hsUrl}/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/redact/${encodeURIComponent(eventId)}/`); expect(idx).toBe(0); @@ -5252,7 +5347,7 @@ describe('MatrixClient', () => { }); it('should error for non-MXC URIs', async () => { - const {client, hsUrl} = createTestClient(); + const {client} = createTestClient(); const domain = "example.org"; const mediaId = "testing/val"; @@ -5285,7 +5380,7 @@ describe('MatrixClient', () => { }); it('should error for non-MXC URIs', async () => { - const {client, hsUrl} = createTestClient(); + const {client} = createTestClient(); const domain = "example.org"; const mediaId = "testing/val"; @@ -5316,6 +5411,7 @@ describe('MatrixClient', () => { Buffer.isBuffer = (i => i === data); + // noinspection TypeScriptValidateJSTypes http.when("POST", "/_matrix/media/r0/upload").respond(200, (path, content, req) => { expect(content).toBeDefined(); expect(req.opts.qs.filename).toEqual(filename); @@ -5339,6 +5435,7 @@ describe('MatrixClient', () => { Buffer.isBuffer = (i => i === data); + // noinspection TypeScriptValidateJSTypes http.when("POST", "/_matrix/media/r0/upload").respond(200, (path, content, req) => { expect(content).toBeDefined(); expect(req.opts.qs.filename).toEqual(filename); @@ -5358,8 +5455,9 @@ describe('MatrixClient', () => { const {client, http} = createTestClient(); const urlPart = "example.org/testing"; const mxcUrl = "mxc://" + urlPart; - const fileContents = new Buffer("12345"); + // const fileContents = new Buffer("12345"); + // noinspection TypeScriptValidateJSTypes http.when("GET", "/_matrix/media/r0/download/").respond(200, (path, _, req) => { expect(path).toContain("/_matrix/media/r0/download/" + urlPart); expect(req.opts.encoding).toEqual(null); @@ -5391,11 +5489,13 @@ describe('MatrixClient', () => { Buffer.isBuffer = (i => i === data); - http.when("GET", "/sample/download").respond(200, (path, content, req) => { + // noinspection TypeScriptValidateJSTypes + http.when("GET", "/sample/download").respond(200, () => { // We can't override headers, so don't bother return data; }); + // noinspection TypeScriptValidateJSTypes http.when("POST", "/_matrix/media/r0/upload").respond(200, (path, content, req) => { expect(content).toBeDefined(); // HACK: We know the mock library will return JSON @@ -6213,6 +6313,7 @@ describe('MatrixClient', () => { }, }; + // noinspection TypeScriptValidateJSTypes http.when("POST", "/_matrix/client/r0/createRoom").respond(200, (path, content) => { expect(content).toMatchObject(expectedRequest); return {room_id: roomId}; @@ -6261,6 +6362,7 @@ describe('MatrixClient', () => { }, }; + // noinspection TypeScriptValidateJSTypes http.when("POST", "/_matrix/client/r0/createRoom").respond(200, (path, content) => { expect(content).toMatchObject(expectedRequest); return {room_id: roomId}; @@ -6334,6 +6436,8 @@ describe('MatrixClient', () => { try { await client.getSpace(roomId); + + // noinspection ExceptionCaughtLocallyJS throw new Error("Failed to fail"); } catch (e) { expect(resolveSpy.callCount).toBe(1); @@ -6358,12 +6462,20 @@ describe('MatrixClient', () => { it('should call the right endpoint', async () => { const userId = "@test:example.org"; + + InternalOlmMachineFactory.FACTORY_OVERRIDE = () => ({ + identityKeys: {}, + runEngine: () => Promise.resolve(), + sign: async (_) => ({ + [userId]: { + [DeviceKeyAlgorithm.Ed25519 + ":" + TEST_DEVICE_ID]: "SIGNATURE_GOES_HERE", + }, + } as Signatures), + } as OlmMachine); + const { client, http } = createTestClient(null, userId, true); client.getWhoAmI = () => Promise.resolve({ user_id: userId, device_id: TEST_DEVICE_ID }); - client.crypto.updateCounts = () => Promise.resolve(); - client.checkOneTimeKeyCounts = () => Promise.resolve({}); - await feedOlmAccount(client); await client.crypto.prepare([]); const algorithms = [EncryptionAlgorithm.MegolmV1AesSha2, EncryptionAlgorithm.OlmV1Curve25519AesSha2]; @@ -6376,6 +6488,7 @@ describe('MatrixClient', () => { [OTKAlgorithm.Unsigned]: 14, }; + // noinspection TypeScriptValidateJSTypes http.when("POST", "/_matrix/client/r0/keys/upload").respond(200, (path, content) => { expect(content).toMatchObject({ device_keys: { @@ -6416,8 +6529,9 @@ describe('MatrixClient', () => { const userId = "@test:example.org"; const { client, http } = createTestClient(null, userId, true); + // @ts-ignore const keys: OTKs = { - [OTKAlgorithm.Signed]: { + [`${OTKAlgorithm.Signed}:AAAAA`]: { key: "test", signatures: { "entity": { @@ -6425,13 +6539,14 @@ describe('MatrixClient', () => { }, }, }, - [OTKAlgorithm.Unsigned]: "unsigned", + [`${OTKAlgorithm.Unsigned}:AAAAA`]: "unsigned", }; const counts: OTKCounts = { [OTKAlgorithm.Signed]: 12, [OTKAlgorithm.Unsigned]: 14, }; + // noinspection TypeScriptValidateJSTypes http.when("POST", "/_matrix/client/r0/keys/upload").respond(200, (path, content) => { expect(content).toMatchObject({ one_time_keys: keys, @@ -6467,6 +6582,7 @@ describe('MatrixClient', () => { [OTKAlgorithm.Unsigned]: 14, }; + // noinspection TypeScriptValidateJSTypes http.when("POST", "/_matrix/client/r0/keys/upload").respond(200, (path, content) => { expect(content).toMatchObject({}); return { one_time_key_counts: counts }; @@ -6502,7 +6618,8 @@ describe('MatrixClient', () => { }, }; - http.when("POST", "/_matrix/client/r0/keys/query").respond(200, (path, content, req) => { + // noinspection TypeScriptValidateJSTypes + http.when("POST", "/_matrix/client/r0/keys/query").respond(200, (path, content) => { expect(content).toMatchObject({ timeout, device_keys: requestBody }); return response; }); @@ -6535,7 +6652,8 @@ describe('MatrixClient', () => { }, }; - http.when("POST", "/_matrix/client/r0/keys/query").respond(200, (path, content, req) => { + // noinspection TypeScriptValidateJSTypes + http.when("POST", "/_matrix/client/r0/keys/query").respond(200, (path, content) => { expect(content).toMatchObject({ timeout: 10000, device_keys: requestBody }); return response; }); @@ -6586,6 +6704,7 @@ describe('MatrixClient', () => { }, }; + // noinspection TypeScriptValidateJSTypes http.when("POST", "/_matrix/client/r0/keys/claim").respond(200, (path, content) => { expect(content).toMatchObject({ timeout: 10000, @@ -6628,6 +6747,7 @@ describe('MatrixClient', () => { const timeout = 60; + // noinspection TypeScriptValidateJSTypes http.when("POST", "/_matrix/client/r0/keys/claim").respond(200, (path, content) => { expect(content).toMatchObject({ timeout: timeout, @@ -6661,6 +6781,7 @@ describe('MatrixClient', () => { }, }; + // noinspection TypeScriptValidateJSTypes http.when("PUT", "/_matrix/client/r0/sendToDevice").respond(200, (path, content) => { const idx = path.indexOf(`${hsUrl}/_matrix/client/r0/sendToDevice/${encodeURIComponent(type)}/`); expect(idx).toBe(0); @@ -6673,6 +6794,24 @@ describe('MatrixClient', () => { }); }); + describe('getOwnDevices', () => { + it('should call the right endpoint', async () => { + const userId = "@test:example.org"; + const { client, http } = createTestClient(null, userId, true); + + const devices = ["schema not followed for simplicity"]; + + // noinspection TypeScriptValidateJSTypes + http.when("GET", "/_matrix/client/r0/devices").respond(200, () => { + return {devices}; + }); + + http.flushAllExpected(); + const res = await client.getOwnDevices(); + expect(res).toMatchObject(devices); + }); + }); + describe('redactObjectForLogging', () => { it('should redact multilevel objects', () => { const input = { diff --git a/test/SynapseAdminApisTest.ts b/test/SynapseAdminApisTest.ts index 04defacc..a14201b4 100644 --- a/test/SynapseAdminApisTest.ts +++ b/test/SynapseAdminApisTest.ts @@ -293,9 +293,9 @@ describe('SynapseAdminApis', () => { const roomId = "!room:example.org"; - http.when("POST", "/_synapse/admin/v1/rooms").respond(200, (path, _content, req) => { + http.when("DELETE", "/_synapse/admin/v2/rooms").respond(200, (path, _content, req) => { expect(JSON.parse(req.opts.body)).toMatchObject({purge: true}); - expect(path).toEqual(`${hsUrl}/_synapse/admin/v1/rooms/${encodeURIComponent(roomId)}/delete`); + expect(path).toEqual(`${hsUrl}/_synapse/admin/v2/rooms/${encodeURIComponent(roomId)}`); return {}; }); @@ -303,5 +303,49 @@ describe('SynapseAdminApis', () => { await client.deleteRoom(roomId); }); }); + + describe('getDeleteRoomState', () => { + it('should call the right endpoint', async () => { + const {client, http, hsUrl} = createTestSynapseAdminClient(); + + const roomId = "!room:example.org"; + const state = [ + { + "delete_id": "delete_id1", + "status": "failed", + "error": "error message", + "shutdown_room": { + "kicked_users": [], + "failed_to_kick_users": [], + "local_aliases": [], + "new_room_id": null + } + }, { + "delete_id": "delete_id2", + "status": "purging", + "shutdown_room": { + "kicked_users": [ + "@foobar:example.com" + ], + "failed_to_kick_users": [], + "local_aliases": [ + "#badroom:example.com", + "#evilsaloon:example.com" + ], + "new_room_id": "!newroomid:example.com" + } + } + ]; + + http.when("GET", "/_synapse/admin/v2/rooms").respond(200, (path, _content, req) => { + expect(path).toEqual(`${hsUrl}/_synapse/admin/v2/rooms/${encodeURIComponent(roomId)}/delete_status`); + return { results: state }; + }); + + http.flushAllExpected(); + const result = await client.getDeleteRoomState(roomId); + expect(result).toMatchObject(state); + }); + }); }); }); diff --git a/test/TestUtils.ts b/test/TestUtils.ts index 10f5d1ed..bcb8cfe3 100644 --- a/test/TestUtils.ts +++ b/test/TestUtils.ts @@ -1,6 +1,4 @@ import * as expect from "expect"; -import { EncryptionAlgorithm, IOlmSession, IOutboundGroupSession, MatrixClient, UserDevice, } from "../src"; -import * as crypto from "crypto"; export function expectArrayEquals(expected: any[], actual: any[]) { expect(expected).toBeDefined(); @@ -22,67 +20,3 @@ export function testDelay(ms: number): Promise { setTimeout(resolve, ms); }); } - -let olmInstance; -export async function prepareOlm(): Promise { - if (olmInstance) return olmInstance; - olmInstance = require("@matrix-org/olm"); - await olmInstance.init({}); - return olmInstance; -} - -export async function feedOlmAccount(client: MatrixClient) { - const pickleKey = crypto.randomBytes(64).toString('hex'); - const account = new (await prepareOlm()).Account(); - try { - account.create(); - const pickled = account.pickle(pickleKey); - - await client.cryptoStore.setPickledAccount(pickled); - await client.cryptoStore.setPickleKey(pickleKey); - } finally { - account.free(); - } -} - -const STATIC_PICKLED_ACCOUNT = "TevMpI7cI4ijCFuRQJOpH4f6VunsywE7PXmKigI5x/Vwnes+hSUEHs3aoMsfptbAEOulbGF5o+m5jRdjKl5mhw0VixOgHTkcJTXtXXldyBYjOWey6YCMcV/Dph5OgBCP3uLyrCT/JSuKhiuxohiqKHENZgeTSQ1/rtZkgR20UOpKdAqPkEjuI4YeLQbV1yDw1Po+JLVz9aRKeZX05rL6kPuIhu+nST++OV06hdAKzr7IDGw0K/xU+2VZIi7y4jct3tjE/QXfr1j7J3ja16xaDA1QLx+/5czZsqPFkJ5kxVetTtlHQ2PdnA9CEKlQugKA02mfD++qG0EZMMT0XqqWJQcBT1zRuQSuE08CHbDFcyq/F/6OQot9wgs9xLCkti7L+vHNHbJQVv+sboM7d2hX0sm5UJUdtnTETZDo1CldhedfDlvPQdC6IQ"; -export const STATIC_PICKLE_KEY = "do not use in production"; -export async function feedStaticOlmAccount(client: MatrixClient) { - await client.cryptoStore.setPickledAccount(STATIC_PICKLED_ACCOUNT); - await client.cryptoStore.setPickleKey(STATIC_PICKLE_KEY); -} - -const OLM_ACCOUNT_RECEIVER_INIT = "6sF6fXEVU52nQxDuXkIX2NWIjff0PDMjhANo5ct7pv60R8A9ntaJbIGlc2YnFGDzLThQKS6sM7cW29jMjXdiYAFJsiU/IwBiUlFW1/eG0pRnbyvnRHI91GkO1MxBgmkNxrHVKwI3ITw9VyE4pXMDrptm+rH0nil+28Z7/PM43qD1LRsNZ6P2FqmdlVvLi+oiNepcAJUA+88ZOombVAXKatBdzTpR+H4ygjpn9Co+atIlxZeNyhngaI47xBtwn69wQfk9Y+3OyKAW9ZTvmbWoPk+Xy57yfhFqgYCcyEeias8GMJlZvK6EDMJFNaAbFvn30QBw6PU9KYMJ1ubTnLOpdw1mzD1T170mXcg4IvRAXStMtHs+5K0qP74C6Lz1FLbZTWVt1SLEGc/k/2fevnHbAchiJA4EdgJsdOgNy5So8yh/OHo8Lh2tLA"; - -export const RECEIVER_DEVICE: UserDevice = { - user_id: "@receiver:example.org", - device_id: "A", - unsigned: { - device_display_name: "Test Device", - }, - keys: { - "curve25519:A": "30KcbZc4ZmLxnLu3MraQ9vIrAjwtjR8uYmwCU/sViDE", - "ed25519:A": "2rSewpuevZRemFhBB/0pa6bU66RwhP8l8bQnUP6j204", - }, - algorithms: [EncryptionAlgorithm.MegolmV1AesSha2, EncryptionAlgorithm.OlmV1Curve25519AesSha2], - signatures: { - "@receiver:example.org": { - "ed25519:A": "+xcZ+TKWhtV6JFy1RB532+BHMSQC7g9MC0Ane7X/OP2sH0ioJFWGcbKt0iBZOIluD7+EgadW7YAyY/33wCbvCg", - }, - }, -}; - -export const RECEIVER_OLM_SESSION: IOlmSession = { - sessionId: "KmlD4H4gK+NukCgsha1mIpjbSd63dH0ZEgTrFFVYHj0", - pickled: "qHo1lPr3YRQLUwvPgTYnYUmLEMAXB/Xh/iBv3on2xvMjn2brZVb42hfkqPRyUW1KMUVRwwzBY+lp1vNx8JTx7EBCLP8/MziQzF+UtDErSNqdVi4TsY6o5vAA+A5BpBKhKiCo3zHO5FXqb36auf1d0Ynj1HTKldMsa2WBCsM6+R1KrY0WAWLi1i7QtlF9lYpk4ZzxhTY9MNMwQ9+h+1+FYxfUSAzQCAbX0WQpI04mq+c6N3bQdrdFVkGndI9c8oegAJDeomBwQI5c2sGFeU4yBLDIL1Cto6K5mO1dM9JW4b8tMJfoE5/lr7Iar+WuCy/AquOwigO1aDn3JsBrtSFyOKbX2nGxkvOh", - lastDecryptionTs: Date.now(), -}; - -export const STATIC_OUTBOUND_SESSION: IOutboundGroupSession = { - sessionId: "5IvzkqqphReuELs8KzYSVmqaWUqrLIJ6d4JFVj8qyBY", - pickled: "gsO94I8oWrkm/zJefnr1/08CMX7qZnOBoPGM7b/ZshjN7UM/Y9y6zRNNY3hGHw+7uP7oYxF1EH60YXa/ClMX0mCEtupqkQlGBKcp78CQj18WURtoATXnV2lEPElx/y1tQfQ1hqRYjd0UXzZtnwGjM78D5vVEoxfpCJ5Gm9kk3aEwOg6EYqirvpciaLCNopnbgh3ngqfmabZJpaafFWRYUkqw4WuzvNVGnzTOmbHq4uWVeZzUTvIC/6AGEq1eLQOEbIoP4GaJDDn+XC+V1HKQ6jmMWuy3439xEfh/FUSI1iHu8oCBcxneSAcmwKUztLkeI3MGu9+1hCA", - roomId: "!test:example.org", - isCurrent: true, - usesLeft: 100, - expiresTs: Date.now() + 3600000, -}; diff --git a/test/appservice/AppserviceTest.ts b/test/appservice/AppserviceTest.ts index 87e0a7ea..9cdfc982 100644 --- a/test/appservice/AppserviceTest.ts +++ b/test/appservice/AppserviceTest.ts @@ -929,7 +929,7 @@ describe('Appservice', () => { } }); - it('should not emit ephemeral events from transactions by default', async () => { + it('should emit ephemeral events from transactions', async () => { const port = await getPort(); const hsToken = "s3cret_token"; const appservice = new Appservice({ @@ -946,71 +946,7 @@ describe('Appservice', () => { rooms: [], aliases: [], }, - // "de.sorunome.msc2409.push_ephemeral": true, // implied false for this test - }, - }); - appservice.botIntent.ensureRegistered = () => { - return null; - }; - - await appservice.begin(); - - try { - const txnBody = { - events: [ - {type: "m.room.message", roomId: "!somewhere:example.org"}, - {type: "m.room.not_message", roomId: "!elsewhere:example.org"}, - ], - "de.sorunome.msc2409.ephemeral": [ - {type: "m.typing", userId: "@someone:example.org"}, - {type: "m.not_typing", userId: "@someone_else:example.org"}, - ] - }; - - const eventSpy = simple.stub().callFn((ev) => { - if (ev["type"] === "m.typing") expect(ev).toMatchObject(txnBody["de.sorunome.msc2409.ephemeral"][0]); - else expect(ev).toMatchObject(txnBody["de.sorunome.msc2409.ephemeral"][1]); - }); - appservice.on("ephemeral.event", eventSpy); - - async function doCall(route: string, opts: any = {}) { - const res = await requestPromise({ - uri: `http://localhost:${port}${route}`, - method: "PUT", - qs: {access_token: hsToken}, - ...opts, - }); - expect(res).toMatchObject({}); - - expect(eventSpy.callCount).toBe(0); - eventSpy.callCount = 0; - } - - await doCall("/transactions/1", {json: txnBody}); - await doCall("/_matrix/app/v1/transactions/2", {json: txnBody}); - } finally { - appservice.stop(); - } - }); - - it('should emit ephemeral events from transactions when enabled', async () => { - const port = await getPort(); - const hsToken = "s3cret_token"; - const appservice = new Appservice({ - port: port, - bindAddress: '127.0.0.1', - homeserverName: 'example.org', - homeserverUrl: 'https://localhost', - registration: { - as_token: "", - hs_token: hsToken, - sender_localpart: "_bot_", - namespaces: { - users: [{exclusive: true, regex: "@_prefix_.*:.+"}], - rooms: [], - aliases: [], - }, - "de.sorunome.msc2409.push_ephemeral": true, + // "de.sorunome.msc2409.push_ephemeral": true, // Shouldn't affect emission }, }); appservice.botIntent.ensureRegistered = () => { @@ -1057,133 +993,6 @@ describe('Appservice', () => { } }); - it('should not emit ephemeral events from transactions when disabled', async () => { - const port = await getPort(); - const hsToken = "s3cret_token"; - const appservice = new Appservice({ - port: port, - bindAddress: '127.0.0.1', - homeserverName: 'example.org', - homeserverUrl: 'https://localhost', - registration: { - as_token: "", - hs_token: hsToken, - sender_localpart: "_bot_", - namespaces: { - users: [{exclusive: true, regex: "@_prefix_.*:.+"}], - rooms: [], - aliases: [], - }, - "de.sorunome.msc2409.push_ephemeral": false, - }, - }); - appservice.botIntent.ensureRegistered = () => { - return null; - }; - - await appservice.begin(); - - try { - const txnBody = { - events: [ - {type: "m.room.message", roomId: "!somewhere:example.org"}, - {type: "m.room.not_message", roomId: "!elsewhere:example.org"}, - ], - "de.sorunome.msc2409.ephemeral": [ - {type: "m.typing", userId: "@someone:example.org"}, - {type: "m.not_typing", userId: "@someone_else:example.org"}, - ], - }; - - const eventSpy = simple.stub().callFn((ev) => { - if (ev["type"] === "m.typing") expect(ev).toMatchObject(txnBody["de.sorunome.msc2409.ephemeral"][0]); - else expect(ev).toMatchObject(txnBody["de.sorunome.msc2409.ephemeral"][1]); - }); - appservice.on("ephemeral.event", eventSpy); - - async function doCall(route: string, opts: any = {}) { - const res = await requestPromise({ - uri: `http://localhost:${port}${route}`, - method: "PUT", - qs: {access_token: hsToken}, - ...opts, - }); - expect(res).toMatchObject({}); - - expect(eventSpy.callCount).toBe(0); - eventSpy.callCount = 0; - } - - await doCall("/transactions/1", {json: txnBody}); - await doCall("/_matrix/app/v1/transactions/2", {json: txnBody}); - } finally { - appservice.stop(); - } - }); - - it('should not emit ephemeral events from transactions when enabled but none present', async () => { - const port = await getPort(); - const hsToken = "s3cret_token"; - const appservice = new Appservice({ - port: port, - bindAddress: '127.0.0.1', - homeserverName: 'example.org', - homeserverUrl: 'https://localhost', - registration: { - as_token: "", - hs_token: hsToken, - sender_localpart: "_bot_", - namespaces: { - users: [{exclusive: true, regex: "@_prefix_.*:.+"}], - rooms: [], - aliases: [], - }, - "de.sorunome.msc2409.push_ephemeral": true, - }, - }); - appservice.botIntent.ensureRegistered = () => { - return null; - }; - - await appservice.begin(); - - try { - const txnBody = { - events: [ - {type: "m.room.message", roomId: "!somewhere:example.org"}, - {type: "m.room.not_message", roomId: "!elsewhere:example.org"}, - ], - // "de.sorunome.msc2409.ephemeral": [ - // {type: "m.typing", userId: "@someone:example.org"}, - // {type: "m.not_typing", userId: "@someone_else:example.org"}, - // ] - }; - - const eventSpy = simple.stub().callFn((ev) => { - throw new Error("Unexpected call: No events anticipated"); - }); - appservice.on("ephemeral.event", eventSpy); - - async function doCall(route: string, opts: any = {}) { - const res = await requestPromise({ - uri: `http://localhost:${port}${route}`, - method: "PUT", - qs: {access_token: hsToken}, - ...opts, - }); - expect(res).toMatchObject({}); - - expect(eventSpy.callCount).toBe(0); - eventSpy.callCount = 0; - } - - await doCall("/transactions/1", {json: txnBody}); - await doCall("/_matrix/app/v1/transactions/2", {json: txnBody}); - } finally { - appservice.stop(); - } - }); - it('should not duplicate transactions', async () => { const port = await getPort(); const hsToken = "s3cret_token"; @@ -1801,6 +1610,32 @@ describe('Appservice', () => { } }); + // TODO: Populate once intent tests are stable + + it.skip('should not try decryption if crypto is not possible', async () => { + + }); + + it.skip('should decrypt events when enabled', async () => { + + }); + + it.skip('should decrypt using non-bot accounts if needed', async () => { + + }); + + it.skip('should create intents which are crypto-ready when enabled', async () => { + + }); + + it.skip('should not create crypto-ready intents when disabled', async () => { + + }); + + it.skip('should prepare the bot intent with encryption at startup if enabled', async () => { + + }); + it('should emit while querying users', async () => { const port = await getPort(); const hsToken = "s3cret_token"; @@ -1834,10 +1669,10 @@ describe('Appservice', () => { userIntent.ensureRegistered = () => { return null; }; - const nameSpy = simple.stub(userIntent.underlyingClient, "setDisplayName").callFn(() => { + const nameSpy = simple.mock(userIntent.underlyingClient, "setDisplayName").callFn(() => { return null; }); - const avatarSpy = simple.stub(userIntent.underlyingClient, "setAvatarUrl").callFn(() => { + const avatarSpy = simple.mock(userIntent.underlyingClient, "setAvatarUrl").callFn(() => { return null; }); @@ -2074,10 +1909,10 @@ describe('Appservice', () => { userIntent.ensureRegistered = () => { return null; }; - const nameSpy = simple.stub(userIntent.underlyingClient, "setDisplayName").callFn(() => { + const nameSpy = simple.mock(userIntent.underlyingClient, "setDisplayName").callFn(() => { return null; }); - const avatarSpy = simple.stub(userIntent.underlyingClient, "setAvatarUrl").callFn(() => { + const avatarSpy = simple.mock(userIntent.underlyingClient, "setAvatarUrl").callFn(() => { return null; }); @@ -2156,10 +1991,10 @@ describe('Appservice', () => { userIntent.ensureRegistered = () => { return null; }; - const nameSpy = simple.stub(userIntent.underlyingClient, "setDisplayName").callFn(() => { + const nameSpy = simple.mock(userIntent.underlyingClient, "setDisplayName").callFn(() => { return null; }); - const avatarSpy = simple.stub(userIntent.underlyingClient, "setAvatarUrl").callFn(() => { + const avatarSpy = simple.mock(userIntent.underlyingClient, "setAvatarUrl").callFn(() => { return null; }); diff --git a/test/appservice/IntentTest.ts b/test/appservice/IntentTest.ts index 0c97b8b6..cf09d85c 100644 --- a/test/appservice/IntentTest.ts +++ b/test/appservice/IntentTest.ts @@ -1,16 +1,21 @@ import { Appservice, + IAppserviceCryptoStorageProvider, IAppserviceOptions, IAppserviceStorageProvider, IJoinRoomStrategy, Intent, MemoryStorageProvider, - setRequestFn + RustSdkAppserviceCryptoStorageProvider, + setRequestFn, } from "../../src"; import * as expect from "expect"; import * as simple from "simple-mock"; import * as MockHttpBackend from 'matrix-mock-request'; import { expectArrayEquals } from "../TestUtils"; +import * as tmp from "tmp"; + +tmp.setGracefulCleanup(); describe('Intent', () => { it('should prepare the underlying client for a bot user', async () => { @@ -524,7 +529,7 @@ describe('Intent', () => { }); const joinSpy = simple.stub().callFn((rid) => { expect(rid).toEqual(targetRoomId); - return {}; + return Promise.resolve("!joined:example.org"); }); intent.underlyingClient.getJoinedRooms = getJoinedSpy; intent.underlyingClient.joinRoom = joinSpy; @@ -558,7 +563,7 @@ describe('Intent', () => { }); const joinSpy = simple.stub().callFn((rid) => { expect(rid).toEqual(targetRoomId); - return {}; + return Promise.resolve("!joined:example.org"); }); intent.underlyingClient.getJoinedRooms = getJoinedSpy; intent.underlyingClient.joinRoom = joinSpy; @@ -633,7 +638,7 @@ describe('Intent', () => { }); const joinSpy = simple.stub().callFn((rid) => { expect(rid).toEqual(targetRoomId); - return {}; + return Promise.resolve("!joined:example.org"); }); intent.underlyingClient.getJoinedRooms = getJoinedSpy; intent.underlyingClient.joinRoom = joinSpy; @@ -968,8 +973,8 @@ describe('Intent', () => { expect(rid).toEqual(targetRoomId); return {}; }); - const refreshJoinedRoomsSpy = simple.mock(intent, "refreshJoinedRooms").callFn(() => { - return Promise.resolve(); + const refreshJoinedRoomsSpy = simple.stub().callFn(() => { + return Promise.resolve([]); }); const joinRoomSpy = simple.stub().callFn((rid) => { @@ -1059,8 +1064,8 @@ describe('Intent', () => { expect(rid).toEqual(targetRoomId); return {}; }); - const refreshJoinedRoomsSpy = simple.mock(intent, "refreshJoinedRooms").callFn(() => { - return Promise.resolve(); + const refreshJoinedRoomsSpy = simple.stub().callFn(() => { + return Promise.resolve([]); }); const leaveRoomSpy = simple.stub().callFn((rid) => { @@ -1122,4 +1127,66 @@ describe('Intent', () => { expect(joinSpy.callCount).toBe(0); }); }); + + describe('enableEncryption', () => { + const userId = "@someone:example.org"; + const botUserId = "@bot:example.org"; + const asToken = "s3cret"; + const hsUrl = "https://localhost"; + const appservice = {botUserId: botUserId}; + let storage: IAppserviceStorageProvider; + let cryptoStorage: IAppserviceCryptoStorageProvider; + let options: IAppserviceOptions; + let intent: Intent; + + beforeEach(() => { + storage = new MemoryStorageProvider(); + cryptoStorage = new RustSdkAppserviceCryptoStorageProvider(tmp.dirSync().name); + options = { + homeserverUrl: hsUrl, + storage: storage, + cryptoStorage: cryptoStorage, + intentOptions: { + encryption: true, + }, + port: 9000, + bindAddress: "127.0.0.1", + homeserverName: "example.org", + registration: { + id: asToken, + as_token: asToken, + hs_token: asToken, + sender_localpart: "bot", + namespaces: { + users: [], + aliases: [], + rooms: [], + }, + }, + }; + intent = new Intent(options, userId, appservice); + }); + + // TODO: Test once device_id impersonation set up + + it.skip('should only set up crypto once', async () => { + + }); + + it.skip('should set up crypto', async () => { + + }); + + it.skip('should impersonate device IDs when known', async () => { + + }); + + it.skip('should use the same device ID when known', async () => { + + }); + + it.skip('should log in to get a device ID if none are viable', async () => { + + }); + }); }); diff --git a/test/encryption/CryptoClientTest.ts b/test/encryption/CryptoClientTest.ts index 84fad4dd..81ec2707 100644 --- a/test/encryption/CryptoClientTest.ts +++ b/test/encryption/CryptoClientTest.ts @@ -4,42 +4,29 @@ import { ConsoleLogger, DeviceKeyAlgorithm, EncryptedFile, - EncryptedRoomEvent, - EncryptionAlgorithm, - ILogger, - IMRoomKey, - IOlmEncrypted, - IOlmPayload, - IOlmSession, - IToDeviceMessage, LogService, MatrixClient, - OTKAlgorithm, - OTKCounts, RoomEncryptionAlgorithm, - UserDevice, } from "../../src"; import { createTestClient, TEST_DEVICE_ID } from "../MatrixClientTest"; -import { - feedOlmAccount, - feedStaticOlmAccount, - prepareOlm, - RECEIVER_DEVICE, - RECEIVER_OLM_SESSION, - STATIC_OUTBOUND_SESSION, -} from "../TestUtils"; -import { DeviceTracker } from "../../src/e2ee/DeviceTracker"; -import { STATIC_TEST_DEVICES } from "./DeviceTrackerTest"; +import { InternalOlmMachineFactory } from "../../src/e2ee/InternalOlmMachineFactory"; +import { OlmMachine, Signatures } from "@turt2live/matrix-sdk-crypto-nodejs"; describe('CryptoClient', () => { + afterEach(() => { + InternalOlmMachineFactory.FACTORY_OVERRIDE = null; + }); + it('should not have a device ID or be ready until prepared', async () => { + InternalOlmMachineFactory.FACTORY_OVERRIDE = () => ({ + identityKeys: {}, + runEngine: () => Promise.resolve(), + } as OlmMachine); + const userId = "@alice:example.org"; const { client } = createTestClient(null, userId, true); client.getWhoAmI = () => Promise.resolve({ user_id: userId, device_id: TEST_DEVICE_ID }); - client.uploadDeviceKeys = () => Promise.resolve({}); - client.uploadDeviceOneTimeKeys = () => Promise.resolve({}); - client.checkOneTimeKeyCounts = () => Promise.resolve({}); expect(client.crypto).toBeDefined(); expect(client.crypto.clientDeviceId).toBeFalsy(); @@ -53,14 +40,16 @@ describe('CryptoClient', () => { describe('prepare', () => { it('should prepare the room tracker', async () => { + InternalOlmMachineFactory.FACTORY_OVERRIDE = () => ({ + identityKeys: {}, + runEngine: () => Promise.resolve(), + } as OlmMachine); + const userId = "@alice:example.org"; const roomIds = ["!a:example.org", "!b:example.org"]; const { client } = createTestClient(null, userId, true); client.getWhoAmI = () => Promise.resolve({ user_id: userId, device_id: TEST_DEVICE_ID }); - client.uploadDeviceKeys = () => Promise.resolve({}); - client.uploadDeviceOneTimeKeys = () => Promise.resolve({}); - client.checkOneTimeKeyCounts = () => Promise.resolve({}); const prepareSpy = simple.stub().callFn((rids: string[]) => { expect(rids).toBe(roomIds); @@ -74,6 +63,11 @@ describe('CryptoClient', () => { }); it('should use a stored device ID', async () => { + InternalOlmMachineFactory.FACTORY_OVERRIDE = () => ({ + identityKeys: {}, + runEngine: () => Promise.resolve(), + } as OlmMachine); + const userId = "@alice:example.org"; const { client } = createTestClient(null, userId, true); @@ -81,77 +75,24 @@ describe('CryptoClient', () => { const whoamiSpy = simple.stub().callFn(() => Promise.resolve({ user_id: userId, device_id: "wrong" })); client.getWhoAmI = whoamiSpy; - client.uploadDeviceKeys = () => Promise.resolve({}); - client.uploadDeviceOneTimeKeys = () => Promise.resolve({}); - client.checkOneTimeKeyCounts = () => Promise.resolve({}); await client.crypto.prepare([]); expect(whoamiSpy.callCount).toEqual(0); expect(client.crypto.clientDeviceId).toEqual(TEST_DEVICE_ID); }); - - it('should create new keys if any of the properties are missing', async () => { - const userId = "@alice:example.org"; - const { client } = createTestClient(null, userId, true); - - await client.cryptoStore.setDeviceId(TEST_DEVICE_ID); - - const deviceKeySpy = simple.stub().callFn(() => Promise.resolve({})); - const otkSpy = simple.stub().callFn(() => Promise.resolve({})); - client.uploadDeviceKeys = deviceKeySpy; - client.uploadDeviceOneTimeKeys = otkSpy; - client.checkOneTimeKeyCounts = () => Promise.resolve({}); - - await client.crypto.prepare([]); - expect(deviceKeySpy.callCount).toEqual(1); - expect(otkSpy.callCount).toEqual(1); - - // NEXT STAGE: Missing Olm Account - - await client.cryptoStore.setPickledAccount(""); - await client.crypto.prepare([]); - expect(deviceKeySpy.callCount).toEqual(2); - expect(otkSpy.callCount).toEqual(2); - - // NEXT STAGE: Missing Pickle - - await client.cryptoStore.setPickleKey(""); - await client.crypto.prepare([]); - expect(deviceKeySpy.callCount).toEqual(3); - expect(otkSpy.callCount).toEqual(3); - }); - - it('should use given values if they are all present', async () => { - const userId = "@alice:example.org"; - const { client } = createTestClient(null, userId, true); - - await client.cryptoStore.setDeviceId(TEST_DEVICE_ID); - await feedOlmAccount(client); - - const deviceKeySpy = simple.stub().callFn(() => Promise.resolve({})); - const otkSpy = simple.stub().callFn(() => Promise.resolve({})); - const checkSpy = simple.stub().callFn(() => Promise.resolve({})); - client.uploadDeviceKeys = deviceKeySpy; - client.uploadDeviceOneTimeKeys = otkSpy; - client.checkOneTimeKeyCounts = checkSpy; - - await client.crypto.prepare([]); - expect(deviceKeySpy.callCount).toEqual(0); - expect(otkSpy.callCount).toEqual(1); - expect(checkSpy.callCount).toEqual(1); - }); }); describe('isRoomEncrypted', () => { it('should fail when the crypto has not been prepared', async () => { + InternalOlmMachineFactory.FACTORY_OVERRIDE = () => ({ + identityKeys: {}, + runEngine: () => Promise.resolve(), + } as OlmMachine); + const userId = "@alice:example.org"; const { client } = createTestClient(null, userId, true); await client.cryptoStore.setDeviceId(TEST_DEVICE_ID); - await feedOlmAccount(client); - client.uploadDeviceKeys = () => Promise.resolve({}); - client.uploadDeviceOneTimeKeys = () => Promise.resolve({}); - client.checkOneTimeKeyCounts = () => Promise.resolve({}); // await client.crypto.prepare([]); // deliberately commented try { @@ -165,14 +106,15 @@ describe('CryptoClient', () => { }); it('should return false for unknown rooms', async () => { + InternalOlmMachineFactory.FACTORY_OVERRIDE = () => ({ + identityKeys: {}, + runEngine: () => Promise.resolve(), + } as OlmMachine); + const userId = "@alice:example.org"; const { client } = createTestClient(null, userId, true); await client.cryptoStore.setDeviceId(TEST_DEVICE_ID); - await feedOlmAccount(client); - client.uploadDeviceKeys = () => Promise.resolve({}); - client.uploadDeviceOneTimeKeys = () => Promise.resolve({}); - client.checkOneTimeKeyCounts = () => Promise.resolve({}); client.getRoomStateEvent = () => Promise.reject("return value not used"); await client.crypto.prepare([]); @@ -181,14 +123,15 @@ describe('CryptoClient', () => { }); it('should return false for unencrypted rooms', async () => { + InternalOlmMachineFactory.FACTORY_OVERRIDE = () => ({ + identityKeys: {}, + runEngine: () => Promise.resolve(), + } as OlmMachine); + const userId = "@alice:example.org"; const { client } = createTestClient(null, userId, true); await client.cryptoStore.setDeviceId(TEST_DEVICE_ID); - await feedOlmAccount(client); - client.uploadDeviceKeys = () => Promise.resolve({}); - client.uploadDeviceOneTimeKeys = () => Promise.resolve({}); - client.checkOneTimeKeyCounts = () => Promise.resolve({}); client.getRoomStateEvent = () => Promise.reject("implying 404"); await client.crypto.prepare([]); @@ -197,14 +140,15 @@ describe('CryptoClient', () => { }); it('should return true for encrypted rooms (redacted state)', async () => { + InternalOlmMachineFactory.FACTORY_OVERRIDE = () => ({ + identityKeys: {}, + runEngine: () => Promise.resolve(), + } as OlmMachine); + const userId = "@alice:example.org"; const { client } = createTestClient(null, userId, true); await client.cryptoStore.setDeviceId(TEST_DEVICE_ID); - await feedOlmAccount(client); - client.uploadDeviceKeys = () => Promise.resolve({}); - client.uploadDeviceOneTimeKeys = () => Promise.resolve({}); - client.checkOneTimeKeyCounts = () => Promise.resolve({}); client.getRoomStateEvent = () => Promise.resolve({}); await client.crypto.prepare([]); @@ -213,13 +157,15 @@ describe('CryptoClient', () => { }); it('should return true for encrypted rooms', async () => { + InternalOlmMachineFactory.FACTORY_OVERRIDE = () => ({ + identityKeys: {}, + runEngine: () => Promise.resolve(), + } as OlmMachine); + const userId = "@alice:example.org"; const { client } = createTestClient(null, userId, true); await client.cryptoStore.setDeviceId(TEST_DEVICE_ID); - await feedOlmAccount(client); - client.uploadDeviceOneTimeKeys = () => Promise.resolve({}); - client.checkOneTimeKeyCounts = () => Promise.resolve({}); client.getRoomStateEvent = () => Promise.resolve({ algorithm: RoomEncryptionAlgorithm.MegolmV1AesSha2 }); await client.crypto.prepare([]); @@ -228,170 +174,25 @@ describe('CryptoClient', () => { }); }); - describe('updateCounts', () => { - it('should imply zero keys when no known counts are given', async () => { - const userId = "@alice:example.org"; - const { client } = createTestClient(null, userId, true); - - const expectedUpload = 50; - - await client.cryptoStore.setDeviceId(TEST_DEVICE_ID); - await feedOlmAccount(client); - client.uploadDeviceOneTimeKeys = () => Promise.resolve({}); - client.checkOneTimeKeyCounts = () => Promise.resolve({}); - await client.crypto.prepare([]); - - const uploadSpy = simple.stub().callFn((signed) => { - expect(Object.keys(signed).length).toEqual(expectedUpload); - return Promise.resolve({}); - }); - client.uploadDeviceOneTimeKeys = uploadSpy; - - await client.crypto.updateCounts({}); - expect(uploadSpy.callCount).toEqual(1); - }); - - it('should create signed OTKs', async () => { - const userId = "@alice:example.org"; - const { client } = createTestClient(null, userId, true); - - const counts: OTKCounts = { [OTKAlgorithm.Signed]: 0, [OTKAlgorithm.Unsigned]: 5 }; - const expectedUpload = 50; - - await client.cryptoStore.setDeviceId(TEST_DEVICE_ID); - await feedOlmAccount(client); - client.uploadDeviceOneTimeKeys = () => Promise.resolve({}); - client.checkOneTimeKeyCounts = () => Promise.resolve({}); - await client.crypto.prepare([]); - - const uploadSpy = simple.stub().callFn((signed) => { - expect(Object.keys(signed).length).toEqual(expectedUpload); - expect(Object.keys(signed).every(k => k.startsWith(OTKAlgorithm.Signed + ":"))).toEqual(true); - return Promise.resolve({}); - }); - client.uploadDeviceOneTimeKeys = uploadSpy; - - await client.crypto.updateCounts(counts); - expect(uploadSpy.callCount).toEqual(1); - }); - - it('should create the needed amount of OTKs', async () => { - const userId = "@alice:example.org"; - const { client } = createTestClient(null, userId, true); - - const counts: OTKCounts = { [OTKAlgorithm.Signed]: 0, [OTKAlgorithm.Unsigned]: 5 }; - const expectedUpload = 50; - - await client.cryptoStore.setDeviceId(TEST_DEVICE_ID); - await feedOlmAccount(client); - client.uploadDeviceOneTimeKeys = () => Promise.resolve({}); - client.checkOneTimeKeyCounts = () => Promise.resolve({}); - await client.crypto.prepare([]); - - const uploadSpy = simple.stub().callFn((signed) => { - expect(Object.keys(signed).length).toEqual(expectedUpload); - expect(Object.keys(signed).every(k => k.startsWith(OTKAlgorithm.Signed + ":"))).toEqual(true); - return Promise.resolve({}); - }); - client.uploadDeviceOneTimeKeys = uploadSpy; - - await client.crypto.updateCounts(counts); - expect(uploadSpy.callCount).toEqual(1); - - await client.crypto.updateCounts(counts); - expect(uploadSpy.callCount).toEqual(2); - - await client.crypto.updateCounts(counts); - expect(uploadSpy.callCount).toEqual(3); - - await client.crypto.updateCounts(counts); - expect(uploadSpy.callCount).toEqual(4); - }); - - it('should not create OTKs if there are enough remaining', async () => { - const userId = "@alice:example.org"; - const { client } = createTestClient(null, userId, true); - - const counts: OTKCounts = { [OTKAlgorithm.Signed]: 14, [OTKAlgorithm.Unsigned]: 5 }; - const expectedUpload = 50 - counts[OTKAlgorithm.Signed]; - - await client.cryptoStore.setDeviceId(TEST_DEVICE_ID); - await feedOlmAccount(client); - client.uploadDeviceOneTimeKeys = () => Promise.resolve({}); - client.checkOneTimeKeyCounts = () => Promise.resolve({}); - await client.crypto.prepare([]); - - const uploadSpy = simple.stub().callFn((signed) => { - expect(Object.keys(signed).length).toEqual(expectedUpload); - expect(Object.keys(signed).every(k => k.startsWith(OTKAlgorithm.Signed + ":"))).toEqual(true); - return Promise.resolve({}); - }); - client.uploadDeviceOneTimeKeys = uploadSpy; - - await client.crypto.updateCounts(counts); - expect(uploadSpy.callCount).toEqual(1); - }); - - it('should persist the Olm account after each upload', async () => { - const userId = "@alice:example.org"; - const { client } = createTestClient(null, userId, true); - - const counts: OTKCounts = { [OTKAlgorithm.Signed]: 0, [OTKAlgorithm.Unsigned]: 5 }; - const expectedUpload = 50; - - await client.cryptoStore.setDeviceId(TEST_DEVICE_ID); - await feedOlmAccount(client); - client.uploadDeviceOneTimeKeys = () => Promise.resolve({}); - client.checkOneTimeKeyCounts = () => Promise.resolve({}); - await client.crypto.prepare([]); - - const uploadSpy = simple.stub().callFn((signed) => { - expect(Object.keys(signed).length).toEqual(expectedUpload); - expect(Object.keys(signed).every(k => k.startsWith(OTKAlgorithm.Signed + ":"))).toEqual(true); - return Promise.resolve({}); - }); - client.uploadDeviceOneTimeKeys = uploadSpy; - - let account = await client.cryptoStore.getPickledAccount(); - - await client.crypto.updateCounts(counts); - expect(uploadSpy.callCount).toEqual(1); - let newAccount = await client.cryptoStore.getPickledAccount(); - expect(account).not.toEqual(newAccount); - account = newAccount; - - await client.crypto.updateCounts(counts); - expect(uploadSpy.callCount).toEqual(2); - newAccount = await client.cryptoStore.getPickledAccount(); - expect(account).not.toEqual(newAccount); - account = newAccount; - - await client.crypto.updateCounts(counts); - expect(uploadSpy.callCount).toEqual(3); - newAccount = await client.cryptoStore.getPickledAccount(); - expect(account).not.toEqual(newAccount); - account = newAccount; - - await client.crypto.updateCounts(counts); - expect(uploadSpy.callCount).toEqual(4); - newAccount = await client.cryptoStore.getPickledAccount(); - expect(account).not.toEqual(newAccount); - }); - }); - describe('sign', () => { const userId = "@alice:example.org"; let client: MatrixClient; beforeEach(async () => { + InternalOlmMachineFactory.FACTORY_OVERRIDE = () => ({ + identityKeys: {}, + runEngine: () => Promise.resolve(), + sign: async (_) => ({ + [userId]: { + [DeviceKeyAlgorithm.Ed25519 + ":" + TEST_DEVICE_ID]: "SIGNATURE_GOES_HERE", + }, + } as Signatures), + } as OlmMachine); + const { client: mclient } = createTestClient(null, userId, true); client = mclient; await client.cryptoStore.setDeviceId(TEST_DEVICE_ID); - await feedStaticOlmAccount(client); - client.uploadDeviceKeys = () => Promise.resolve({}); - client.uploadDeviceOneTimeKeys = () => Promise.resolve({}); - client.checkOneTimeKeyCounts = () => Promise.resolve({}); // client crypto not prepared for the one test which wants that state }); @@ -425,7 +226,7 @@ describe('CryptoClient', () => { const signatures = await client.crypto.sign(obj); expect(signatures).toMatchObject({ [userId]: { - [`ed25519:${TEST_DEVICE_ID}`]: "zb/gbMjWCxfVrN5ASjvKr+leUWdaX026pccfiul+TzE7tABjWqnzjZiy6ox2MQk85IWD+DpR8Mo65a5o+/m4Cw", + [`ed25519:${TEST_DEVICE_ID}`]: expect.any(String), }, ...obj.signatures, }); @@ -434,50 +235,27 @@ describe('CryptoClient', () => { }); }); - describe('verifySignature', () => { - let signed: object; - let key: string; - let signature: string; + describe('encryptRoomEvent', () => { + const userId = "@alice:example.org"; let client: MatrixClient; beforeEach(async () => { - signed = { - algorithms: [EncryptionAlgorithm.OlmV1Curve25519AesSha2, EncryptionAlgorithm.MegolmV1AesSha2], - device_id: "NTTFKSVBSI", - keys: { - "curve25519:NTTFKSVBSI": "zPsrUlEM3DKRcBYKMHgZTLmYJU1FJDzBRnH6DsTxHH8", - "ed25519:NTTFKSVBSI": "2tVcG/+sE7hq4z+E/x6UrMuVEAzc4CknYIGbg3cQg/4", - }, - signatures: { - "@ping:localhost": { - "ed25519:NTTFKSVBSI": "CLm1TOPFFIygs68amMsnywQoLz2evo/O28BVQGPKC986yFt0OpDKcyMUTsRFiRcdLstqtWkhy1p+UTW2/FPEDw", - "ed25519:7jeU3P5Fb8wS+LmhXNhiDSBrPMBI+uBZItlRJnpoHtE": "vx1bb8n1xWIJ+5ZkOrQ91msZbEU/p2wZGdxbnQAQDr/ZhZqwKwvY6G5bkhjvtQTdVRspPC/mFKyH0UW9D30IDA", - }, - }, - user_id: "@ping:localhost", - unsigned: { - device_display_name: "localhost:8080 (Edge, Windows)", - }, - }; - key = "2tVcG/+sE7hq4z+E/x6UrMuVEAzc4CknYIGbg3cQg/4"; - signature = "CLm1TOPFFIygs68amMsnywQoLz2evo/O28BVQGPKC986yFt0OpDKcyMUTsRFiRcdLstqtWkhy1p+UTW2/FPEDw"; + InternalOlmMachineFactory.FACTORY_OVERRIDE = () => ({ + identityKeys: {}, + runEngine: () => Promise.resolve(), + } as OlmMachine); - const userId = "@alice:example.org"; const { client: mclient } = createTestClient(null, userId, true); client = mclient; await client.cryptoStore.setDeviceId(TEST_DEVICE_ID); - await feedOlmAccount(client); - client.uploadDeviceKeys = () => Promise.resolve({}); - client.uploadDeviceOneTimeKeys = () => Promise.resolve({}); - client.checkOneTimeKeyCounts = () => Promise.resolve({}); // client crypto not prepared for the one test which wants that state }); it('should fail when the crypto has not been prepared', async () => { try { - await client.crypto.verifySignature(signed, key, signature); + await client.crypto.encryptRoomEvent("!room:example.org", "org.example", {}); // noinspection ExceptionCaughtLocallyJS throw new Error("Failed to fail"); @@ -486,48 +264,52 @@ describe('CryptoClient', () => { } }); - it('should return true for valid signatures', async () => { + it('should fail in unencrypted rooms', async () => { await client.crypto.prepare([]); - const result = await client.crypto.verifySignature(signed, key, signature); - expect(result).toBe(true); - }); + // Force unencrypted rooms + client.crypto.isRoomEncrypted = async () => false; - it('should return false for invalid signatures', async () => { - await client.crypto.prepare([]); + try { + await client.crypto.encryptRoomEvent("!room:example.org", "type", {}); - let result = await client.crypto.verifySignature(signed, "wrong key", signature); - expect(result).toBe(false); - result = await client.crypto.verifySignature(signed, key, "wrong signature"); - expect(result).toBe(false); - result = await client.crypto.verifySignature({ wrong: "object" }, key, signature); - expect(result).toBe(false); + // noinspection ExceptionCaughtLocallyJS + throw new Error("Failed to fail"); + } catch (e) { + expect(e.message).toEqual("Room is not encrypted"); + } }); - it('should not mutate the provided object', async () => { - await client.crypto.prepare([]); - - const result = await client.crypto.verifySignature(signed, key, signature); - expect(result).toBe(true); - expect(signed["signatures"]).toBeDefined(); - expect(signed["unsigned"]).toBeDefined(); + it.skip('should get devices for invited members', async () => { + // TODO: Support invited members, if history visibility would allow. }); }); - describe('flagUsersDeviceListsOutdated', () => { - it('should fail when the crypto has not been prepared', async () => { - const userId = "@alice:example.org"; - const { client } = createTestClient(null, userId, true); + describe('decryptRoomEvent', () => { + const userId = "@alice:example.org"; + let client: MatrixClient; + + beforeEach(async () => { + InternalOlmMachineFactory.FACTORY_OVERRIDE = () => ({ + identityKeys: {}, + runEngine: () => Promise.resolve(), + } as OlmMachine); + + const { client: mclient } = createTestClient(null, userId, true); + client = mclient; await client.cryptoStore.setDeviceId(TEST_DEVICE_ID); - await feedOlmAccount(client); - client.uploadDeviceKeys = () => Promise.resolve({}); - client.uploadDeviceOneTimeKeys = () => Promise.resolve({}); - client.checkOneTimeKeyCounts = () => Promise.resolve({}); - // await client.crypto.prepare([]); // deliberately commented + // client crypto not prepared for the one test which wants that state + }); + + afterEach(async () => { + LogService.setLogger(new ConsoleLogger()); + }); + + it('should fail when the crypto has not been prepared', async () => { try { - await client.crypto.flagUsersDeviceListsOutdated(["@new:example.org"]); + await client.crypto.decryptRoomEvent(null, null); // noinspection ExceptionCaughtLocallyJS throw new Error("Failed to fail"); @@ -535,82 +317,122 @@ describe('CryptoClient', () => { expect(e.message).toEqual("End-to-end encryption has not initialized"); } }); + }); - it('should pass through to the device tracker (resync=true)', async () => { - const userId = "@alice:example.org"; - const { client } = createTestClient(null, userId, true); + describe('encryptMedia', () => { + const userId = "@alice:example.org"; + let client: MatrixClient; - await client.cryptoStore.setDeviceId(TEST_DEVICE_ID); - await feedOlmAccount(client); - client.uploadDeviceKeys = () => Promise.resolve({}); - client.uploadDeviceOneTimeKeys = () => Promise.resolve({}); - client.checkOneTimeKeyCounts = () => Promise.resolve({}); - client.getRoomStateEvent = () => Promise.reject("return value not used"); - await client.crypto.prepare([]); + beforeEach(async () => { + InternalOlmMachineFactory.FACTORY_OVERRIDE = () => ({ + identityKeys: {}, + runEngine: () => Promise.resolve(), + } as OlmMachine); - const userIds = ["@first:example.org", "@second:example.org"]; - const resync = true; + const { client: mclient } = createTestClient(null, userId, true); + client = mclient; - const tracker: DeviceTracker = (client.crypto).deviceTracker; // private member access - const flagSpy = simple.stub().callFn(async (uids, rsyc) => { - expect(uids).toMatchObject(userIds); - expect(uids.length).toBe(userIds.length); - expect(rsyc).toEqual(resync); - }); - tracker.flagUsersOutdated = flagSpy; + await client.cryptoStore.setDeviceId(TEST_DEVICE_ID); - await client.crypto.flagUsersDeviceListsOutdated(userIds, resync); - expect(flagSpy.callCount).toBe(1); + // client crypto not prepared for the one test which wants that state }); - it('should pass through to the device tracker (resync=false)', async () => { - const userId = "@alice:example.org"; - const { client } = createTestClient(null, userId, true); + afterEach(async () => { + LogService.setLogger(new ConsoleLogger()); + }); - await client.cryptoStore.setDeviceId(TEST_DEVICE_ID); - await feedOlmAccount(client); - client.uploadDeviceKeys = () => Promise.resolve({}); - client.uploadDeviceOneTimeKeys = () => Promise.resolve({}); - client.checkOneTimeKeyCounts = () => Promise.resolve({}); - client.getRoomStateEvent = () => Promise.reject("return value not used"); + it('should fail when the crypto has not been prepared', async () => { + try { + await client.crypto.encryptMedia(null); + + // noinspection ExceptionCaughtLocallyJS + throw new Error("Failed to fail"); + } catch (e) { + expect(e.message).toEqual("End-to-end encryption has not initialized"); + } + }); + + it('should encrypt media', async () => { await client.crypto.prepare([]); - const userIds = ["@first:example.org", "@second:example.org"]; - const resync = false; + const inputBuffer = Buffer.from("test"); + const inputStr = inputBuffer.join(''); - const tracker: DeviceTracker = (client.crypto).deviceTracker; // private member access - const flagSpy = simple.stub().callFn(async (uids, rsyc) => { - expect(uids).toMatchObject(userIds); - expect(uids.length).toBe(userIds.length); - expect(rsyc).toEqual(resync); + const result = await client.crypto.encryptMedia(inputBuffer); + expect(result).toBeDefined(); + expect(result.buffer).toBeDefined(); + expect(result.buffer.join('')).not.toEqual(inputStr); + expect(result.file).toBeDefined(); + expect(result.file.hashes).toBeDefined(); + expect(result.file.hashes.sha256).not.toEqual("n4bQgYhMfWWaL+qgxVrQFaO/TxsrC4Is0V1sFbDwCgg"); + expect(result.file).toMatchObject({ + hashes: { + sha256: expect.any(String), + }, + key: { + alg: "A256CTR", + ext: true, + key_ops: ['encrypt', 'decrypt'], + kty: "oct", + k: expect.any(String), + }, + iv: expect.any(String), + v: "v2", }); - tracker.flagUsersOutdated = flagSpy; - - await client.crypto.flagUsersDeviceListsOutdated(userIds, resync); - expect(flagSpy.callCount).toBe(1); }); }); - describe('getOrCreateOlmSessions', () => { + describe('decryptMedia', () => { const userId = "@alice:example.org"; let client: MatrixClient; + // Created from Element Web + const testFileContents = "THIS IS A TEST FILE."; + const mediaFileContents = Buffer.from("eB15hJlkw8WwgYxwY2mu8vS250s=", "base64"); + const testFile: EncryptedFile = { + v: "v2", + key: { + alg: "A256CTR", + ext: true, + k: "l3OtQ3IJzfJa85j2WMsqNu7J--C-I1hzPxFvinR48mM", + key_ops: [ + "encrypt", + "decrypt" + ], + kty: "oct" + }, + iv: "KJQOebQS1wwAAAAAAAAAAA", + hashes: { + sha256: "Qe4YzmVoPaEcLQeZwFZ4iMp/dlgeFph6mi5DmCaCOzg" + }, + url: "mxc://localhost/uiWuISEVWixompuiiYyUoGrx", + }; + + function copyOfTestFile(): EncryptedFile { + return JSON.parse(JSON.stringify(testFile)); + } + beforeEach(async () => { + InternalOlmMachineFactory.FACTORY_OVERRIDE = () => ({ + identityKeys: {}, + runEngine: () => Promise.resolve(), + } as OlmMachine); + const { client: mclient } = createTestClient(null, userId, true); client = mclient; await client.cryptoStore.setDeviceId(TEST_DEVICE_ID); - await feedStaticOlmAccount(client); - client.uploadDeviceKeys = () => Promise.resolve({}); - client.uploadDeviceOneTimeKeys = () => Promise.resolve({}); - client.checkOneTimeKeyCounts = () => Promise.resolve({}); // client crypto not prepared for the one test which wants that state }); + afterEach(async () => { + LogService.setLogger(new ConsoleLogger()); + }); + it('should fail when the crypto has not been prepared', async () => { try { - await client.crypto.getOrCreateOlmSessions({}); + await client.crypto.encryptMedia(null); // noinspection ExceptionCaughtLocallyJS throw new Error("Failed to fail"); @@ -619,2803 +441,35 @@ describe('CryptoClient', () => { } }); - it('should skip our own user and device', async () => { + it('should be symmetrical', async () => { await client.crypto.prepare([]); - const claimSpy = simple.stub().callFn(async (req) => { - expect(Object.keys(req).length).toBe(0); - return { one_time_keys: {}, failures: {} }; + const mxc = "mxc://example.org/test"; + const inputBuffer = Buffer.from("test"); + const encrypted = await client.crypto.encryptMedia(inputBuffer); + + const downloadSpy = simple.stub().callFn(async (u) => { + expect(u).toEqual(mxc); + return {data: encrypted.buffer, contentType: "application/octet-stream"}; }); - client.claimOneTimeKeys = claimSpy; + client.downloadContent = downloadSpy; - const result = await client.crypto.getOrCreateOlmSessions({ - [userId]: [TEST_DEVICE_ID], + const result = await client.crypto.decryptMedia({ + url: mxc, + ...encrypted.file, }); - expect(Object.keys(result).length).toBe(0); - expect(claimSpy.callCount).toBe(0); // no reason it should be called + expect(result.join('')).toEqual(inputBuffer.join('')); + expect(downloadSpy.callCount).toBe(1); }); - it('should use existing sessions if present', async () => { + it('should decrypt', async () => { await client.crypto.prepare([]); - const targetUserId = "@target:example.org"; - const targetDeviceId = "TARGET"; - - const session: IOlmSession = { - sessionId: "test_session", - lastDecryptionTs: Date.now(), - pickled: "pickled", - }; - - const claimSpy = simple.stub().callFn(async (req) => { - expect(Object.keys(req).length).toBe(0); - return { one_time_keys: {}, failures: {} }; + const downloadSpy = simple.stub().callFn(async (u) => { + expect(u).toEqual(testFile.url); + return {data: Buffer.from(mediaFileContents), contentType: "application/octet-stream"}; }); - client.claimOneTimeKeys = claimSpy; - - client.cryptoStore.getCurrentOlmSession = async (uid, did) => { - expect(uid).toEqual(targetUserId); - expect(did).toEqual(targetDeviceId); - return session; - }; - - const result = await client.crypto.getOrCreateOlmSessions({ - [targetUserId]: [targetDeviceId], - }); - expect(result).toMatchObject({ - [targetUserId]: { - [targetDeviceId]: session, - }, - }); - expect(claimSpy.callCount).toBe(0); // no reason it should be called - }); - - it('should not use existing sessions if asked to force new sessions', async () => { - await client.crypto.prepare([]); - - const targetUserId = "@target:example.org"; - const targetDeviceId = "TARGET"; - - const session: IOlmSession = { - sessionId: "test_session", - lastDecryptionTs: Date.now(), - pickled: "pickled", - }; - - const claimSpy = simple.stub().callFn(async (req) => { - expect(req).toMatchObject({ - [targetUserId]: { - [targetDeviceId]: OTKAlgorithm.Signed, - }, - }); - return { - one_time_keys: { - [targetUserId]: { - [targetDeviceId]: { - [`${OTKAlgorithm.Signed}:${targetDeviceId}`]: { - key: "zKbLg+NrIjpnagy+pIY6uPL4ZwEG2v+8F9lmgsnlZzs", - signatures: { - [targetUserId]: { - [`${DeviceKeyAlgorithm.Ed25519}:${targetDeviceId}`]: "Definitely real", - }, - }, - }, - }, - }, - }, - failures: {}, - }; - }); - client.claimOneTimeKeys = claimSpy; - - client.cryptoStore.getCurrentOlmSession = async (uid, did) => { - throw new Error("Not called appropriately"); - }; - - client.cryptoStore.getActiveUserDevices = async (uid) => { - expect(uid).toEqual(targetUserId); - return [{ - user_id: targetUserId, - device_id: targetDeviceId, - keys: { - [`${DeviceKeyAlgorithm.Curve25519}:${targetDeviceId}`]: "zPsrUlEM3DKRcBYKMHgZTLmYJU1FJDzBRnH6DsTxHH8", - }, - - // We don't end up using a lot of this in this test - unsigned: {}, - signatures: {}, - algorithms: [], - }]; - }; - - // Skip signature verification for this test - client.crypto.verifySignature = () => Promise.resolve(true); - - const result = await client.crypto.getOrCreateOlmSessions({ - [targetUserId]: [targetDeviceId], - }, true); // FORCE!! - expect(result).toMatchObject({ - [targetUserId]: { - [targetDeviceId]: { - sessionId: expect.any(String), - lastDecryptionTs: expect.any(Number), - pickled: expect.any(String), - }, - }, - }); - expect(result[targetUserId][targetDeviceId].sessionId).not.toEqual(session.sessionId); - expect(claimSpy.callCount).toBe(1); - }); - - it('should support mixing of OTK claims and existing sessions', async () => { - await client.crypto.prepare([]); - - const targetUserId = "@target:example.org"; - const targetDeviceId = "TARGET"; - - const claimUserId = "@claim:example.org"; - const claimDeviceId = "CLAIM_ME"; - - const session: IOlmSession = { - sessionId: "test_session", - lastDecryptionTs: Date.now(), - pickled: "pickled", - }; - - const claimSpy = simple.stub().callFn(async (req) => { - expect(req).toMatchObject({ - [claimUserId]: { - [claimDeviceId]: OTKAlgorithm.Signed, - }, - }); - return { - one_time_keys: { - [claimUserId]: { - [claimDeviceId]: { - [`${OTKAlgorithm.Signed}:${claimDeviceId}`]: { - key: "zKbLg+NrIjpnagy+pIY6uPL4ZwEG2v+8F9lmgsnlZzs", - signatures: { - [claimUserId]: { - [`${DeviceKeyAlgorithm.Ed25519}:${claimDeviceId}`]: "Definitely real", - }, - }, - }, - }, - }, - }, - failures: {}, - }; - }); - client.claimOneTimeKeys = claimSpy; - - client.cryptoStore.getCurrentOlmSession = async (uid, did) => { - if (uid === targetUserId) { - expect(did).toEqual(targetDeviceId); - } else if (uid === claimUserId) { - expect(did).toEqual(claimDeviceId); - return null; - } else { - throw new Error("Unexpected user"); - } - return session; - }; - - client.cryptoStore.getActiveUserDevices = async (uid) => { - expect(uid).toEqual(claimUserId); - return [{ - user_id: claimUserId, - device_id: claimDeviceId, - keys: { - [`${DeviceKeyAlgorithm.Curve25519}:${claimDeviceId}`]: "zPsrUlEM3DKRcBYKMHgZTLmYJU1FJDzBRnH6DsTxHH8", - }, - - // We don't end up using a lot of this in this test - unsigned: {}, - signatures: {}, - algorithms: [], - }]; - }; - - // Skip signature verification for this test - client.crypto.verifySignature = () => Promise.resolve(true); - - const result = await client.crypto.getOrCreateOlmSessions({ - [targetUserId]: [targetDeviceId], - [claimUserId]: [claimDeviceId], - }); - expect(result).toMatchObject({ - [targetUserId]: { - [targetDeviceId]: session, - }, - [claimUserId]: { - [claimDeviceId]: { - sessionId: expect.any(String), - lastDecryptionTs: expect.any(Number), - pickled: expect.any(String), - }, - }, - }); - expect(claimSpy.callCount).toBe(1); - }); - - it('should ensure the server is not injecting users in claim requests', async () => { - await client.crypto.prepare([]); - - const targetUserId = "@target:example.org"; - const targetDeviceId = "TARGET"; - - const claimUserId = "@claim:example.org"; - const claimDeviceId = "CLAIM_ME"; - - const claimSpy = simple.stub().callFn(async (req) => { - expect(req).toMatchObject({ - [claimUserId]: { - [claimDeviceId]: OTKAlgorithm.Signed, - }, - }); - return { - one_time_keys: { - // Injected user/device - [targetUserId]: { - [targetDeviceId]: { - [`${OTKAlgorithm.Signed}:${targetDeviceId}`]: { - key: "zKbLg+NrIjpnagy+pIY6uPL4ZwEG2v+8F9lmgsnlZzs", - signatures: { - [targetUserId]: { - [`${DeviceKeyAlgorithm.Ed25519}:${targetDeviceId}`]: "Definitely real", - }, - }, - }, - }, - }, - [claimUserId]: { - [claimDeviceId]: { - [`${OTKAlgorithm.Signed}:${claimDeviceId}`]: { - key: "zKbLg+NrIjpnagy+pIY6uPL4ZwEG2v+8F9lmgsnlZzs", - signatures: { - [claimUserId]: { - [`${DeviceKeyAlgorithm.Ed25519}:${claimDeviceId}`]: "Definitely real", - }, - }, - }, - }, - }, - }, - failures: {}, - }; - }); - client.claimOneTimeKeys = claimSpy; - - client.cryptoStore.getCurrentOlmSession = async (uid, did) => { - expect(uid).toEqual(claimUserId); - expect(did).toEqual(claimDeviceId); - return null; - }; - - client.cryptoStore.getActiveUserDevices = async (uid) => { - expect(uid).toEqual(claimUserId); - return [{ - user_id: claimUserId, - device_id: claimDeviceId, - keys: { - [`${DeviceKeyAlgorithm.Curve25519}:${claimDeviceId}`]: "zPsrUlEM3DKRcBYKMHgZTLmYJU1FJDzBRnH6DsTxHH8", - }, - - // We don't end up using a lot of this in this test - unsigned: {}, - signatures: {}, - algorithms: [], - }]; - }; - - // Skip signature verification for this test - client.crypto.verifySignature = () => Promise.resolve(true); - - const result = await client.crypto.getOrCreateOlmSessions({ - [claimUserId]: [claimDeviceId], - }); - expect(result).toMatchObject({ - [claimUserId]: { - [claimDeviceId]: { - sessionId: expect.any(String), - lastDecryptionTs: expect.any(Number), - pickled: expect.any(String), - }, - }, - }); - expect(claimSpy.callCount).toBe(1); - }); - - it('should ensure the server is not injecting devices in claim requests', async () => { - await client.crypto.prepare([]); - - const targetUserId = "@target:example.org"; - const targetDeviceId = "TARGET"; - - const claimUserId = "@claim:example.org"; - const claimDeviceId = "CLAIM_ME"; - - const claimSpy = simple.stub().callFn(async (req) => { - expect(req).toMatchObject({ - [claimUserId]: { - [claimDeviceId]: OTKAlgorithm.Signed, - }, - }); - return { - one_time_keys: { - [claimUserId]: { - // Injected device - [targetDeviceId]: { - [`${OTKAlgorithm.Signed}:${targetDeviceId}`]: { - key: "zKbLg+NrIjpnagy+pIY6uPL4ZwEG2v+8F9lmgsnlZzs", - signatures: { - [targetUserId]: { - [`${DeviceKeyAlgorithm.Ed25519}:${targetDeviceId}`]: "Definitely real", - }, - }, - }, - }, - [claimDeviceId]: { - [`${OTKAlgorithm.Signed}:${claimDeviceId}`]: { - key: "zKbLg+NrIjpnagy+pIY6uPL4ZwEG2v+8F9lmgsnlZzs", - signatures: { - [claimUserId]: { - [`${DeviceKeyAlgorithm.Ed25519}:${claimDeviceId}`]: "Definitely real", - }, - }, - }, - }, - }, - }, - failures: {}, - }; - }); - client.claimOneTimeKeys = claimSpy; - - client.cryptoStore.getCurrentOlmSession = async (uid, did) => { - expect(uid).toEqual(claimUserId); - expect(did).toEqual(claimDeviceId); - return null; - }; - - client.cryptoStore.getActiveUserDevices = async (uid) => { - expect(uid).toEqual(claimUserId); - return [{ - user_id: claimUserId, - device_id: claimDeviceId, - keys: { - [`${DeviceKeyAlgorithm.Curve25519}:${claimDeviceId}`]: "zPsrUlEM3DKRcBYKMHgZTLmYJU1FJDzBRnH6DsTxHH8", - }, - - // We don't end up using a lot of this in this test - unsigned: {}, - signatures: {}, - algorithms: [], - }]; - }; - - // Skip signature verification for this test - client.crypto.verifySignature = () => Promise.resolve(true); - - const result = await client.crypto.getOrCreateOlmSessions({ - [claimUserId]: [claimDeviceId], - }); - expect(result).toMatchObject({ - [claimUserId]: { - [claimDeviceId]: { - sessionId: expect.any(String), - lastDecryptionTs: expect.any(Number), - pickled: expect.any(String), - }, - }, - }); - expect(claimSpy.callCount).toBe(1); - }); - - it('should ensure the device is known to verify the Curve25519 key', async () => { - await client.crypto.prepare([]); - - const targetUserId = "@target:example.org"; - const targetDeviceId = "TARGET"; - - const claimUserId = "@claim:example.org"; - const claimDeviceId = "CLAIM_ME"; - - const claimSpy = simple.stub().callFn(async (req) => { - expect(req).toMatchObject({ - [claimUserId]: { - [claimDeviceId]: OTKAlgorithm.Signed, - }, - }); - return { - one_time_keys: { - [claimUserId]: { - [targetDeviceId]: { - [`${OTKAlgorithm.Signed}:${targetDeviceId}`]: { - key: "zKbLg+NrIjpnagy+pIY6uPL4ZwEG2v+8F9lmgsnlZzs", - signatures: { - [targetUserId]: { - [`${DeviceKeyAlgorithm.Ed25519}:${targetDeviceId}`]: "Definitely real", - }, - }, - }, - }, - [claimDeviceId]: { - [`${OTKAlgorithm.Signed}:${claimDeviceId}`]: { - key: "zKbLg+NrIjpnagy+pIY6uPL4ZwEG2v+8F9lmgsnlZzs", - signatures: { - [claimUserId]: { - [`${DeviceKeyAlgorithm.Ed25519}:${claimDeviceId}`]: "Definitely real", - }, - }, - }, - }, - }, - }, - failures: {}, - }; - }); - client.claimOneTimeKeys = claimSpy; - - client.cryptoStore.getCurrentOlmSession = async (uid, did) => { - expect(uid).toEqual(claimUserId); - expect([claimDeviceId, targetDeviceId].includes(did)).toBe(true); - return null; - }; - - client.cryptoStore.getActiveUserDevices = async (uid) => { - expect(uid).toEqual(claimUserId); - return [{ - user_id: claimUserId, - device_id: claimDeviceId, - keys: { - [`${DeviceKeyAlgorithm.Curve25519}:${claimDeviceId}`]: "zPsrUlEM3DKRcBYKMHgZTLmYJU1FJDzBRnH6DsTxHH8", - }, - - // We don't end up using a lot of this in this test - unsigned: {}, - signatures: {}, - algorithms: [], - }]; - }; - - // Skip signature verification for this test - client.crypto.verifySignature = () => Promise.resolve(true); - - const result = await client.crypto.getOrCreateOlmSessions({ - [claimUserId]: [claimDeviceId, targetDeviceId], // ask for an unknown device - }); - expect(result).toMatchObject({ - [claimUserId]: { - [claimDeviceId]: { - sessionId: expect.any(String), - lastDecryptionTs: expect.any(Number), - pickled: expect.any(String), - }, - }, - }); - expect(claimSpy.callCount).toBe(1); - }); - - it('should ensure a signature is present on the claim response', async () => { - await client.crypto.prepare([]); - - const claimUserId = "@claim:example.org"; - const claimDeviceId = "CLAIM_ME"; - - const claimSpy = simple.stub().callFn(async (req) => { - expect(req).toMatchObject({ - [claimUserId]: { - [claimDeviceId]: OTKAlgorithm.Signed, - }, - }); - return { - one_time_keys: { - [claimUserId]: { - [claimDeviceId]: { - [`${OTKAlgorithm.Signed}:${claimDeviceId}`]: { - key: "zKbLg+NrIjpnagy+pIY6uPL4ZwEG2v+8F9lmgsnlZzs", - signatures_MISSING: { - [claimUserId]: { - [`${DeviceKeyAlgorithm.Ed25519}:${claimDeviceId}`]: "Definitely real", - }, - }, - }, - }, - }, - }, - failures: {}, - }; - }); - client.claimOneTimeKeys = claimSpy; - - client.cryptoStore.getCurrentOlmSession = async (uid, did) => { - expect(uid).toEqual(claimUserId); - expect(did).toEqual(claimDeviceId); - return null; - }; - - client.cryptoStore.getActiveUserDevices = async (uid) => { - expect(uid).toEqual(claimUserId); - return [{ - user_id: claimUserId, - device_id: claimDeviceId, - keys: { - [`${DeviceKeyAlgorithm.Curve25519}:${claimDeviceId}`]: "zPsrUlEM3DKRcBYKMHgZTLmYJU1FJDzBRnH6DsTxHH8", - }, - - // We don't end up using a lot of this in this test - unsigned: {}, - signatures: {}, - algorithms: [], - }]; - }; - - // Skip signature verification for this test - client.crypto.verifySignature = () => Promise.resolve(true); - - const result = await client.crypto.getOrCreateOlmSessions({ - [claimUserId]: [claimDeviceId], - }); - expect(Object.keys(result).length).toBe(0); - expect(claimSpy.callCount).toBe(1); - }); - - it('should verify the signature of the claimed key', async () => { - await client.crypto.prepare([]); - - const claimUserId = "@claim:example.org"; - const claimDeviceId = "CLAIM_ME"; - - const claimSpy = simple.stub().callFn(async (req) => { - expect(req).toMatchObject({ - [claimUserId]: { - [claimDeviceId]: OTKAlgorithm.Signed, - }, - }); - return { - one_time_keys: { - [claimUserId]: { - [claimDeviceId]: { - [`${OTKAlgorithm.Signed}:${claimDeviceId}`]: { - key: "zKbLg+NrIjpnagy+pIY6uPL4ZwEG2v+8F9lmgsnlZzs", - signatures: { - [claimUserId]: { - [`${DeviceKeyAlgorithm.Ed25519}:${claimDeviceId}`]: "Definitely real", - }, - }, - }, - }, - }, - }, - failures: {}, - }; - }); - client.claimOneTimeKeys = claimSpy; - - client.cryptoStore.getCurrentOlmSession = async (uid, did) => { - expect(uid).toEqual(claimUserId); - expect(did).toEqual(claimDeviceId); - return null; - }; - - client.cryptoStore.getActiveUserDevices = async (uid) => { - expect(uid).toEqual(claimUserId); - return [{ - user_id: claimUserId, - device_id: claimDeviceId, - keys: { - [`${DeviceKeyAlgorithm.Curve25519}:${claimDeviceId}`]: "zPsrUlEM3DKRcBYKMHgZTLmYJU1FJDzBRnH6DsTxHH8", - [`${DeviceKeyAlgorithm.Ed25519}:${claimDeviceId}`]: "ED25519 KEY GOES HERE", - }, - - // We don't end up using a lot of this in this test - unsigned: {}, - signatures: {}, - algorithms: [], - }]; - }; - - const verifySpy = simple.stub().callFn(async (signed, dkey, sig) => { - expect(signed).toMatchObject({ - key: "zKbLg+NrIjpnagy+pIY6uPL4ZwEG2v+8F9lmgsnlZzs", - signatures: { - [claimUserId]: { - [`${DeviceKeyAlgorithm.Ed25519}:${claimDeviceId}`]: "Definitely real", - }, - }, - }); - expect(dkey).toEqual("ED25519 KEY GOES HERE"); - expect(sig).toEqual("Definitely real"); - return true; - }); - client.crypto.verifySignature = verifySpy; - - const result = await client.crypto.getOrCreateOlmSessions({ - [claimUserId]: [claimDeviceId], - }); - expect(result).toMatchObject({ - [claimUserId]: { - [claimDeviceId]: { - sessionId: expect.any(String), - lastDecryptionTs: expect.any(Number), - pickled: expect.any(String), - }, - }, - }); - expect(claimSpy.callCount).toBe(1); - expect(verifySpy.callCount).toBe(1); - }); - - it('should create a new outbound olm session', async () => { - await client.crypto.prepare([]); - - const claimUserId = "@claim:example.org"; - const claimDeviceId = "CLAIM_ME"; - - const claimSpy = simple.stub().callFn(async (req) => { - expect(req).toMatchObject({ - [claimUserId]: { - [claimDeviceId]: OTKAlgorithm.Signed, - }, - }); - return { - one_time_keys: { - [claimUserId]: { - [claimDeviceId]: { - [`${OTKAlgorithm.Signed}:${claimDeviceId}`]: { - key: "zKbLg+NrIjpnagy+pIY6uPL4ZwEG2v+8F9lmgsnlZzs", - signatures: { - [claimUserId]: { - [`${DeviceKeyAlgorithm.Ed25519}:${claimDeviceId}`]: "Definitely real", - }, - }, - }, - }, - }, - }, - failures: {}, - }; - }); - client.claimOneTimeKeys = claimSpy; - - client.cryptoStore.getActiveUserDevices = async (uid) => { - expect(uid).toEqual(claimUserId); - return [{ - user_id: claimUserId, - device_id: claimDeviceId, - keys: { - [`${DeviceKeyAlgorithm.Curve25519}:${claimDeviceId}`]: "zPsrUlEM3DKRcBYKMHgZTLmYJU1FJDzBRnH6DsTxHH8", - [`${DeviceKeyAlgorithm.Ed25519}:${claimDeviceId}`]: "ED25519 KEY GOES HERE", - }, - - // We don't end up using a lot of this in this test - unsigned: {}, - signatures: {}, - algorithms: [], - }]; - }; - - // Skip signature verification for this test - client.crypto.verifySignature = () => Promise.resolve(true); - - const result = await client.crypto.getOrCreateOlmSessions({ - [claimUserId]: [claimDeviceId], - }); - expect(result).toMatchObject({ - [claimUserId]: { - [claimDeviceId]: { - sessionId: expect.any(String), - lastDecryptionTs: expect.any(Number), - pickled: expect.any(String), - }, - }, - }); - expect(claimSpy.callCount).toBe(1); - - const session = result[claimUserId][claimDeviceId]; - expect(await client.cryptoStore.getCurrentOlmSession(claimUserId, claimDeviceId)).toMatchObject(session as any); - }); - }); - - describe('encryptAndSendOlmMessage', () => { - const userId = "@alice:example.org"; - let client: MatrixClient; - - beforeEach(async () => { - const { client: mclient } = createTestClient(null, userId, true); - client = mclient; - - await client.cryptoStore.setDeviceId(TEST_DEVICE_ID); - await feedStaticOlmAccount(client); - client.uploadDeviceKeys = () => Promise.resolve({}); - client.uploadDeviceOneTimeKeys = () => Promise.resolve({}); - client.checkOneTimeKeyCounts = () => Promise.resolve({}); - - // client crypto not prepared for the one test which wants that state - }); - - it('should fail when the crypto has not been prepared', async () => { - try { - await (client.crypto).encryptAndSendOlmMessage(null, null, null, null); - - // noinspection ExceptionCaughtLocallyJS - throw new Error("Failed to fail"); - } catch (e) { - expect(e.message).toEqual("End-to-end encryption has not initialized"); - } - }); - - it('should work', async () => { - await client.crypto.prepare([]); - - const device = RECEIVER_DEVICE; - const session = RECEIVER_OLM_SESSION; - const type = "org.example.test"; - const content = { - isTest: true, - val: "hello world", - n: 42, - }; - - const sendSpy = simple.stub().callFn(async (t, m) => { - expect(t).toEqual("m.room.encrypted"); - expect(m).toMatchObject({ - "@receiver:example.org": { - "A": { - algorithm: "m.olm.v1.curve25519-aes-sha2", - ciphertext: { - "30KcbZc4ZmLxnLu3MraQ9vIrAjwtjR8uYmwCU/sViDE": { - type: 0, - body: "Awog+jA+wNz5Wnpw5isETy9LFDw0hoao06f7ewAhY0+yRGsSIJS/3l725T7pqoV3FKZY/cPH/2dV8W8yZeIWl1DKpaQlGiAFnYCGBRA+tqaR3SpDqbqtwgz1wzA0TV+Mjvzixbd1IyLQAgMKIAIldXBMsoIngiQkuLAvUYrz6QCFAwPeFb6hKlRKcBlTEAAioAKgrDGnYPaJv4asMwVsbNSXQOxRCE/sB0VZrYKH9OKwbZuP+jqHUPa6mtVBu3Sll2ROWJ94YtPycZXX45B4pT8XMvLL/jE6fH4gXZuheb6Q5iYV0XrHMNuIzyODjzbOzpvi7GXTFvb7YMFRskb2k965vfd9NRTpuUT9eb7vkLoIgCb9gK5WApEuS5/4lOIWHKdhqB1m4ViZ4W+eEo9TzniRvAMCfeX0G+OpCv5X9h1UomZl87Kh/q5ZSluuocWFOgG8sGvyLttl3AR3Vc500+9xUt9xvYz5p5hv9UWrnhL2tmKIvVAGCE+GLUDg+eHHSdu6wft5u6qg4ko69tYEmfMbJZc2MU6vmrFKkk3ZJJ27IX4qx8DPaeUWKao169D+982mMWbeZ6lsAQ", - }, - }, - sender_key: "BZ2AhgUQPramkd0qQ6m6rcIM9cMwNE1fjI784sW3dSM", - }, - }, - }); - }); - client.sendToDevices = sendSpy; - - const storeSpy = simple.stub().callFn(async (uid, did, s) => { - expect(uid).toEqual(device.user_id); - expect(did).toEqual(device.device_id); - expect(s).toMatchObject({ - lastDecryptionTs: session.lastDecryptionTs, - sessionId: session.sessionId, - pickled: "qHo1lPr3YRQLUwvPgTYnYUmLEMAXB/Xh/iBv3on2xvMjn2brZVb42hfkqPRyUW1KMUVRwwzBY+lp1vNx8JTx7EBCLP8/MziQzF+UtDErSNqdVi4TsY6o5vAA+A5BpBKhKiCo3zHO5FXqb36auf1d0Ynj1HTKldMsa2WBCsM6+R1KrY0WAWLi1i7QtlF9lYpk4ZzxhTY9MNMwQ9+h+1+FYxfUSAzQCAbX0WQpI04mq+c6N3bQdrdFVkGndI9c8oegFOR0vO920pYgK9479AFoA5D7IkOUwnZ8C8EqYKtYKBd0cs4+cTR9n5jHSvMfba59FYcv5xoWC2slIKez6bKWKfK/0N9psBdq", - }); - }); - client.cryptoStore.storeOlmSession = storeSpy; - - await (client.crypto).encryptAndSendOlmMessage(device, session, type, content); - expect(sendSpy.callCount).toBe(1); - expect(storeSpy.callCount).toBe(1); - }); - }); - - describe('encryptRoomEvent', () => { - const userId = "@alice:example.org"; - let client: MatrixClient; - - beforeEach(async () => { - const { client: mclient } = createTestClient(null, userId, true); - client = mclient; - - await client.cryptoStore.setDeviceId(TEST_DEVICE_ID); - await feedStaticOlmAccount(client); - client.uploadDeviceKeys = () => Promise.resolve({}); - client.uploadDeviceOneTimeKeys = () => Promise.resolve({}); - client.checkOneTimeKeyCounts = () => Promise.resolve({}); - - // client crypto not prepared for the one test which wants that state - }); - - it('should fail when the crypto has not been prepared', async () => { - try { - await client.crypto.encryptRoomEvent("!room:example.org", "org.example", {}); - - // noinspection ExceptionCaughtLocallyJS - throw new Error("Failed to fail"); - } catch (e) { - expect(e.message).toEqual("End-to-end encryption has not initialized"); - } - }); - - it('should fail in unencrypted rooms', async () => { - await client.crypto.prepare([]); - - // Force unencrypted rooms - client.crypto.isRoomEncrypted = async () => false; - - try { - await client.crypto.encryptRoomEvent("!room:example.org", "type", {}); - - // noinspection ExceptionCaughtLocallyJS - throw new Error("Failed to fail"); - } catch (e) { - expect(e.message).toEqual("Room is not encrypted"); - } - }); - - it('should use existing outbound sessions', async () => { - await client.crypto.prepare([]); - - const deviceMap = { - [RECEIVER_DEVICE.user_id]: [RECEIVER_DEVICE], - }; - const roomId = "!test:example.org"; - - // For this test, force all rooms to be encrypted - client.crypto.isRoomEncrypted = async () => true; - - await client.cryptoStore.storeOlmSession(RECEIVER_DEVICE.user_id, RECEIVER_DEVICE.device_id, RECEIVER_OLM_SESSION); - - const getSpy = simple.stub().callFn(async (rid) => { - expect(rid).toEqual(roomId); - return STATIC_OUTBOUND_SESSION; - }); - client.cryptoStore.getCurrentOutboundGroupSession = getSpy; - - const joinedSpy = simple.stub().callFn(async (rid) => { - expect(rid).toEqual(roomId); - return Object.keys(deviceMap); - }); - client.getJoinedRoomMembers = joinedSpy; - - const devicesSpy = simple.stub().callFn(async (uids) => { - expect(uids).toMatchObject(Object.keys(deviceMap)); - return deviceMap; - }); - (client.crypto).deviceTracker.getDevicesFor = devicesSpy; - - // We watch for the to-device messages to make sure we pass through the internal functions correctly - const toDeviceSpy = simple.stub().callFn(async (t, m) => { - expect(t).toEqual("m.room.encrypted"); - expect(m).toMatchObject({ - [RECEIVER_DEVICE.user_id]: { - [RECEIVER_DEVICE.device_id]: { - algorithm: "m.olm.v1.curve25519-aes-sha2", - ciphertext: { - "30KcbZc4ZmLxnLu3MraQ9vIrAjwtjR8uYmwCU/sViDE": { - type: 0, - body: "Awog+jA+wNz5Wnpw5isETy9LFDw0hoao06f7ewAhY0+yRGsSIJS/3l725T7pqoV3FKZY/cPH/2dV8W8yZeIWl1DKpaQlGiAFnYCGBRA+tqaR3SpDqbqtwgz1wzA0TV+Mjvzixbd1IyLgBQMKIAIldXBMsoIngiQkuLAvUYrz6QCFAwPeFb6hKlRKcBlTEAAisAWgrDGnYPaJv4asMwVsbNSXQOxRCE/sB0VZrYKH9OKwbZuP+jqHUPa6mtVBu3Sll2ROWJ94YtPycZXX45B4pT8XMvLL/jE6fH4gXZuheb6Q5iYV0XrHMNuIzyODjzbOzpvi7GXTFvb7YMFRskb2k965vfd9NRTpuUT9eb7vkLoIgCb9gK5WApEuS5/4lOIWHKdhqB1m4ViZ4W+eEo9TzniRvAMCfeX0G+OpCv5X9h1UomZl87Kh/q5ZSluuocWFOgG8sGvyLttl3AR3Vc500+9xc0u7GT6lNvJo9Z1kH1xPcCce4oHWByFgGvdIMHYrB7SFZ/AtbiQDt/BUTgxsLd8gysHqjiiOKblz3iN3kx//f2MCTrjKgWDtmCeTRnb1Z8Rn9hdPbkpX2+yvkrmdMYYXKfQXB6PAY+6gRFqGREFXaKq8n0NPN7mN//sp7CJGmMU+DIyq7cPWcmW7zLTBdyoafn8YkJRqjIVbA271imw77cFvDdU1uWFT14275u7Z0qtOrXZiuDLPQyaARbitv8Cc4VfFB1XwWG0V8+fR3oJvIcCba4Q7ALO6TJqpurETU6eT4BAZBmugWObL2kDxdmuJYWpKvKbPdGhLTfbFFn0Sl1lgNaMrGjDoF+LVx/1Oiq9s0DnKPf9gamGIYr2voiSQvibC5m4UgMKLkiZVbAVs20fSV3TD5XMJYman6Rk8mNHBd+6fXW+C2buXd8WStiZ2/hVNalvV/MJPqdzJDHRz3avjwJryunbO48syLMud0y+6K2e8RJV/974lyfQ6BvJ/C7pN/rY3Rh5F4NtG0pSL9ghBzKuQQvKuVGf7U8L9w52iRQrPso+UhUkn8kpLD6AWklU7o9NenWO7eQLhz33i/A0DnM3ILw0c5XyQrX7/UgIRHkLAeVMHLmYC4IBaY1Y24ToFuVKXdb0", - }, - }, - sender_key: "BZ2AhgUQPramkd0qQ6m6rcIM9cMwNE1fjI784sW3dSM", - }, - }, - }); - }); - client.sendToDevices = toDeviceSpy; - - const result = await client.crypto.encryptRoomEvent(roomId, "org.example.test", { - isTest: true, - hello: "world", - n: 42, - }); - expect(getSpy.callCount).toBe(1); - expect(joinedSpy.callCount).toBe(1); - expect(devicesSpy.callCount).toBe(1); - expect(toDeviceSpy.callCount).toBe(1); - expect(result).toMatchObject({ - algorithm: "m.megolm.v1.aes-sha2", - sender_key: "BZ2AhgUQPramkd0qQ6m6rcIM9cMwNE1fjI784sW3dSM", - ciphertext: "AwgAEnB4om5XWmKYTMTlDUK16C1v7GEXWl0JlNJZVXJYGEhEZIm+Hep8I2l4dFzchv3JdMKnBofYpLjXd6jEP144MsHfATu7g6qu3m/B+gpxsJ6fi0BTsO7GvXwwYsdsqGp8p9O+RvRP2JfUO7dBgW6uCPwQHcExXrA+csPHq/ItVNjnCBW3cAkXc34dZXeGn2LV5JGozaFI/2WEFEEP6r5SLqAPzia3khcL84nko5qtGh57VqG32H3H4v0G", - session_id: STATIC_OUTBOUND_SESSION.sessionId, - device_id: TEST_DEVICE_ID, - }); - }); - - it('should rotate outbound sessions based on time', async () => { - await client.crypto.prepare([]); - - const deviceMap = { - [RECEIVER_DEVICE.user_id]: [RECEIVER_DEVICE], - }; - const roomId = "!test:example.org"; - const rotationIntervals = 200; - const rotationMs = 50000; - - await client.cryptoStore.storeRoom(roomId, { - algorithm: EncryptionAlgorithm.MegolmV1AesSha2, - rotation_period_msgs: rotationIntervals, - rotation_period_ms: rotationMs, - }); - - await client.cryptoStore.storeOlmSession(RECEIVER_DEVICE.user_id, RECEIVER_DEVICE.device_id, RECEIVER_OLM_SESSION); - - const getSpy = simple.stub().callFn(async (rid) => { - expect(rid).toEqual(roomId); - return { - ...STATIC_OUTBOUND_SESSION, - expiresTs: Date.now() / 2, // force expiry - }; - }); - client.cryptoStore.getCurrentOutboundGroupSession = getSpy; - - const storeSpy = simple.stub().callFn(async (s) => { - expect(s.sessionId).not.toEqual(STATIC_OUTBOUND_SESSION.sessionId); - expect(s.roomId).toEqual(roomId); - expect(s.pickled).toBeDefined(); - expect(s.isCurrent).toBe(true); - expect(s.usesLeft).toBe(rotationIntervals - 1); - expect(s.expiresTs - Date.now()).toBeLessThanOrEqual(rotationMs + 1000); - expect(s.expiresTs - Date.now()).toBeGreaterThanOrEqual(rotationMs - 1000); - }); - client.cryptoStore.storeOutboundGroupSession = storeSpy; - - const joinedSpy = simple.stub().callFn(async (rid) => { - expect(rid).toEqual(roomId); - return Object.keys(deviceMap); - }); - client.getJoinedRoomMembers = joinedSpy; - - const devicesSpy = simple.stub().callFn(async (uids) => { - expect(uids).toMatchObject(Object.keys(deviceMap)); - return deviceMap; - }); - (client.crypto).deviceTracker.getDevicesFor = devicesSpy; - - // We watch for the to-device messages to make sure we pass through the internal functions correctly - const toDeviceSpy = simple.stub().callFn(async (t, m) => { - expect(t).toEqual("m.room.encrypted"); - expect(m).toMatchObject({ - [RECEIVER_DEVICE.user_id]: { - [RECEIVER_DEVICE.device_id]: { - algorithm: "m.olm.v1.curve25519-aes-sha2", - ciphertext: { - "30KcbZc4ZmLxnLu3MraQ9vIrAjwtjR8uYmwCU/sViDE": { - type: 0, - body: expect.any(String), - }, - }, - sender_key: "BZ2AhgUQPramkd0qQ6m6rcIM9cMwNE1fjI784sW3dSM", - }, - }, - }); - }); - client.sendToDevices = toDeviceSpy; - - const result = await client.crypto.encryptRoomEvent(roomId, "org.example.test", { - isTest: true, - hello: "world", - n: 42, - }); - expect(getSpy.callCount).toBe(1); - expect(joinedSpy.callCount).toBe(1); - expect(devicesSpy.callCount).toBe(1); - expect(toDeviceSpy.callCount).toBe(1); - expect(storeSpy.callCount).toBe(1); - expect(result).toMatchObject({ - algorithm: "m.megolm.v1.aes-sha2", - sender_key: "BZ2AhgUQPramkd0qQ6m6rcIM9cMwNE1fjI784sW3dSM", - ciphertext: expect.any(String), - session_id: expect.any(String), - device_id: TEST_DEVICE_ID, - }); - expect(result.session_id).not.toEqual(STATIC_OUTBOUND_SESSION.sessionId); - }); - - it('should rotate outbound sessions based on uses', async () => { - await client.crypto.prepare([]); - - const deviceMap = { - [RECEIVER_DEVICE.user_id]: [RECEIVER_DEVICE], - }; - const roomId = "!test:example.org"; - const rotationIntervals = 200; - const rotationMs = 50000; - - await client.cryptoStore.storeRoom(roomId, { - algorithm: EncryptionAlgorithm.MegolmV1AesSha2, - rotation_period_msgs: rotationIntervals, - rotation_period_ms: rotationMs, - }); - - await client.cryptoStore.storeOlmSession(RECEIVER_DEVICE.user_id, RECEIVER_DEVICE.device_id, RECEIVER_OLM_SESSION); - - const getSpy = simple.stub().callFn(async (rid) => { - expect(rid).toEqual(roomId); - return { - ...STATIC_OUTBOUND_SESSION, - usesLeft: 0, - }; - }); - client.cryptoStore.getCurrentOutboundGroupSession = getSpy; - - const storeSpy = simple.stub().callFn(async (s) => { - expect(s.sessionId).not.toEqual(STATIC_OUTBOUND_SESSION.sessionId); - expect(s.roomId).toEqual(roomId); - expect(s.pickled).toBeDefined(); - expect(s.isCurrent).toBe(true); - expect(s.usesLeft).toBe(rotationIntervals - 1); - expect(s.expiresTs - Date.now()).toBeLessThanOrEqual(rotationMs + 1000); - expect(s.expiresTs - Date.now()).toBeGreaterThanOrEqual(rotationMs - 1000); - }); - client.cryptoStore.storeOutboundGroupSession = storeSpy; - - const joinedSpy = simple.stub().callFn(async (rid) => { - expect(rid).toEqual(roomId); - return Object.keys(deviceMap); - }); - client.getJoinedRoomMembers = joinedSpy; - - const devicesSpy = simple.stub().callFn(async (uids) => { - expect(uids).toMatchObject(Object.keys(deviceMap)); - return deviceMap; - }); - (client.crypto).deviceTracker.getDevicesFor = devicesSpy; - - // We watch for the to-device messages to make sure we pass through the internal functions correctly - const toDeviceSpy = simple.stub().callFn(async (t, m) => { - expect(t).toEqual("m.room.encrypted"); - expect(m).toMatchObject({ - [RECEIVER_DEVICE.user_id]: { - [RECEIVER_DEVICE.device_id]: { - algorithm: "m.olm.v1.curve25519-aes-sha2", - ciphertext: { - "30KcbZc4ZmLxnLu3MraQ9vIrAjwtjR8uYmwCU/sViDE": { - type: 0, - body: expect.any(String), - }, - }, - sender_key: "BZ2AhgUQPramkd0qQ6m6rcIM9cMwNE1fjI784sW3dSM", - }, - }, - }); - }); - client.sendToDevices = toDeviceSpy; - - const result = await client.crypto.encryptRoomEvent(roomId, "org.example.test", { - isTest: true, - hello: "world", - n: 42, - }); - expect(getSpy.callCount).toBe(1); - expect(joinedSpy.callCount).toBe(1); - expect(devicesSpy.callCount).toBe(1); - expect(toDeviceSpy.callCount).toBe(1); - expect(storeSpy.callCount).toBe(1); - expect(result).toMatchObject({ - algorithm: "m.megolm.v1.aes-sha2", - sender_key: "BZ2AhgUQPramkd0qQ6m6rcIM9cMwNE1fjI784sW3dSM", - ciphertext: expect.any(String), - session_id: expect.any(String), - device_id: TEST_DEVICE_ID, - }); - expect(result.session_id).not.toEqual(STATIC_OUTBOUND_SESSION.sessionId); - }); - - it('should create new outbound sessions', async () => { - await client.crypto.prepare([]); - - const deviceMap = { - [RECEIVER_DEVICE.user_id]: [RECEIVER_DEVICE], - }; - const roomId = "!test:example.org"; - const rotationIntervals = 200; - const rotationMs = 50000; - - await client.cryptoStore.storeRoom(roomId, { - algorithm: EncryptionAlgorithm.MegolmV1AesSha2, - rotation_period_msgs: rotationIntervals, - rotation_period_ms: rotationMs, - }); - - await client.cryptoStore.storeOlmSession(RECEIVER_DEVICE.user_id, RECEIVER_DEVICE.device_id, RECEIVER_OLM_SESSION); - - const getSpy = simple.stub().callFn(async (rid) => { - expect(rid).toEqual(roomId); - return null; // none for this test - }); - client.cryptoStore.getCurrentOutboundGroupSession = getSpy; - - const storeSpy = simple.stub().callFn(async (s) => { - expect(s.roomId).toEqual(roomId); - expect(s.pickled).toBeDefined(); - expect(s.isCurrent).toBe(true); - expect(s.usesLeft).toBe(rotationIntervals - 1); - expect(s.expiresTs - Date.now()).toBeLessThanOrEqual(rotationMs + 1000); - expect(s.expiresTs - Date.now()).toBeGreaterThanOrEqual(rotationMs - 1000); - }); - client.cryptoStore.storeOutboundGroupSession = storeSpy; - - const ibStoreSpy = simple.stub().callFn(async (s) => { - expect(s.sessionId).toBeDefined(); - expect(s.roomId).toEqual(roomId); - expect(s.senderUserId).toEqual(userId); - expect(s.senderDeviceId).toEqual(TEST_DEVICE_ID); - expect(s.pickled).toBeDefined(); - }); - client.cryptoStore.storeInboundGroupSession = ibStoreSpy; - - const joinedSpy = simple.stub().callFn(async (rid) => { - expect(rid).toEqual(roomId); - return Object.keys(deviceMap); - }); - client.getJoinedRoomMembers = joinedSpy; - - const devicesSpy = simple.stub().callFn(async (uids) => { - expect(uids).toMatchObject(Object.keys(deviceMap)); - return deviceMap; - }); - (client.crypto).deviceTracker.getDevicesFor = devicesSpy; - - // We watch for the to-device messages to make sure we pass through the internal functions correctly - const toDeviceSpy = simple.stub().callFn(async (t, m) => { - expect(t).toEqual("m.room.encrypted"); - expect(m).toMatchObject({ - [RECEIVER_DEVICE.user_id]: { - [RECEIVER_DEVICE.device_id]: { - algorithm: "m.olm.v1.curve25519-aes-sha2", - ciphertext: { - "30KcbZc4ZmLxnLu3MraQ9vIrAjwtjR8uYmwCU/sViDE": { - type: 0, - body: expect.any(String), - }, - }, - sender_key: "BZ2AhgUQPramkd0qQ6m6rcIM9cMwNE1fjI784sW3dSM", - }, - }, - }); - }); - client.sendToDevices = toDeviceSpy; - - const result = await client.crypto.encryptRoomEvent(roomId, "org.example.test", { - isTest: true, - hello: "world", - n: 42, - }); - expect(getSpy.callCount).toBe(1); - expect(joinedSpy.callCount).toBe(1); - expect(devicesSpy.callCount).toBe(1); - expect(toDeviceSpy.callCount).toBe(1); - expect(storeSpy.callCount).toBe(1); - expect(ibStoreSpy.callCount).toBe(1); - expect(result).toMatchObject({ - algorithm: "m.megolm.v1.aes-sha2", - sender_key: "BZ2AhgUQPramkd0qQ6m6rcIM9cMwNE1fjI784sW3dSM", - ciphertext: expect.any(String), - session_id: expect.any(String), - device_id: TEST_DEVICE_ID, - }); - }); - - it.skip('should get devices for invited members', async () => { - // TODO: Support invited members, if history visibility would allow. - }); - - it('should preserve m.relates_to', async () => { - await client.crypto.prepare([]); - - const deviceMap = { - [RECEIVER_DEVICE.user_id]: [RECEIVER_DEVICE], - }; - const roomId = "!test:example.org"; - - // For this test, force all rooms to be encrypted - client.crypto.isRoomEncrypted = async () => true; - - await client.cryptoStore.storeOlmSession(RECEIVER_DEVICE.user_id, RECEIVER_DEVICE.device_id, RECEIVER_OLM_SESSION); - - const getSpy = simple.stub().callFn(async (rid) => { - expect(rid).toEqual(roomId); - return STATIC_OUTBOUND_SESSION; - }); - client.cryptoStore.getCurrentOutboundGroupSession = getSpy; - - const joinedSpy = simple.stub().callFn(async (rid) => { - expect(rid).toEqual(roomId); - return Object.keys(deviceMap); - }); - client.getJoinedRoomMembers = joinedSpy; - - const devicesSpy = simple.stub().callFn(async (uids) => { - expect(uids).toMatchObject(Object.keys(deviceMap)); - return deviceMap; - }); - (client.crypto).deviceTracker.getDevicesFor = devicesSpy; - - // We watch for the to-device messages to make sure we pass through the internal functions correctly - const toDeviceSpy = simple.stub().callFn(async (t, m) => { - expect(t).toEqual("m.room.encrypted"); - expect(m).toMatchObject({ - [RECEIVER_DEVICE.user_id]: { - [RECEIVER_DEVICE.device_id]: { - algorithm: "m.olm.v1.curve25519-aes-sha2", - ciphertext: { - "30KcbZc4ZmLxnLu3MraQ9vIrAjwtjR8uYmwCU/sViDE": { - type: 0, - body: expect.any(String), - }, - }, - sender_key: "BZ2AhgUQPramkd0qQ6m6rcIM9cMwNE1fjI784sW3dSM", - }, - }, - }); - }); - client.sendToDevices = toDeviceSpy; - - const result = await client.crypto.encryptRoomEvent(roomId, "org.example.test", { - "m.relates_to": { - test: true, - }, - isTest: true, - hello: "world", - n: 42, - }); - expect(getSpy.callCount).toBe(1); - expect(joinedSpy.callCount).toBe(1); - expect(devicesSpy.callCount).toBe(1); - expect(toDeviceSpy.callCount).toBe(1); - expect(result).toMatchObject({ - "m.relates_to": { - test: true, - }, - algorithm: "m.megolm.v1.aes-sha2", - sender_key: "BZ2AhgUQPramkd0qQ6m6rcIM9cMwNE1fjI784sW3dSM", - ciphertext: expect.any(String), - session_id: STATIC_OUTBOUND_SESSION.sessionId, - device_id: TEST_DEVICE_ID, - }); - }); - - it('should not spam room keys for multiple calls', async () => { - await client.crypto.prepare([]); - - const deviceMap = { - [RECEIVER_DEVICE.user_id]: [RECEIVER_DEVICE], - }; - const roomId = "!test:example.org"; - - // For this test, force all rooms to be encrypted - client.crypto.isRoomEncrypted = async () => true; - - await client.cryptoStore.storeOlmSession(RECEIVER_DEVICE.user_id, RECEIVER_DEVICE.device_id, RECEIVER_OLM_SESSION); - - const getSpy = simple.stub().callFn(async (rid) => { - expect(rid).toEqual(roomId); - return STATIC_OUTBOUND_SESSION; - }); - client.cryptoStore.getCurrentOutboundGroupSession = getSpy; - - const joinedSpy = simple.stub().callFn(async (rid) => { - expect(rid).toEqual(roomId); - return Object.keys(deviceMap); - }); - client.getJoinedRoomMembers = joinedSpy; - - const devicesSpy = simple.stub().callFn(async (uids) => { - expect(uids).toMatchObject(Object.keys(deviceMap)); - return deviceMap; - }); - (client.crypto).deviceTracker.getDevicesFor = devicesSpy; - - // We watch for the to-device messages to make sure we pass through the internal functions correctly - const toDeviceSpy = simple.stub().callFn(async (t, m) => { - expect(t).toEqual("m.room.encrypted"); - expect(m).toMatchObject({ - [RECEIVER_DEVICE.user_id]: { - [RECEIVER_DEVICE.device_id]: { - algorithm: "m.olm.v1.curve25519-aes-sha2", - ciphertext: { - "30KcbZc4ZmLxnLu3MraQ9vIrAjwtjR8uYmwCU/sViDE": { - type: 0, - body: expect.any(String), - }, - }, - sender_key: "BZ2AhgUQPramkd0qQ6m6rcIM9cMwNE1fjI784sW3dSM", - }, - }, - }); - }); - client.sendToDevices = toDeviceSpy; - - const result = await client.crypto.encryptRoomEvent(roomId, "org.example.test", { - isTest: true, - hello: "world", - n: 42, - }); - expect(getSpy.callCount).toBe(1); - expect(joinedSpy.callCount).toBe(1); - expect(devicesSpy.callCount).toBe(1); - expect(toDeviceSpy.callCount).toBe(1); - expect(result).toMatchObject({ - algorithm: "m.megolm.v1.aes-sha2", - sender_key: "BZ2AhgUQPramkd0qQ6m6rcIM9cMwNE1fjI784sW3dSM", - ciphertext: expect.any(String), - session_id: STATIC_OUTBOUND_SESSION.sessionId, - device_id: TEST_DEVICE_ID, - }); - - const lastSent = await client.cryptoStore.getLastSentOutboundGroupSession(RECEIVER_DEVICE.user_id, RECEIVER_DEVICE.device_id, roomId); - expect(lastSent).toMatchObject({ - sessionId: STATIC_OUTBOUND_SESSION.sessionId, - index: expect.any(Number), - }); - - const result2 = await client.crypto.encryptRoomEvent(roomId, "org.example.test", { - isTest: true, - hello: "world", - n: 42, - }); - expect(getSpy.callCount).toBe(2); - expect(joinedSpy.callCount).toBe(2); - expect(devicesSpy.callCount).toBe(2); - expect(toDeviceSpy.callCount).toBe(1); - expect(result2).toMatchObject({ - algorithm: "m.megolm.v1.aes-sha2", - sender_key: "BZ2AhgUQPramkd0qQ6m6rcIM9cMwNE1fjI784sW3dSM", - ciphertext: expect.any(String), - session_id: STATIC_OUTBOUND_SESSION.sessionId, - device_id: TEST_DEVICE_ID, - }); - - const lastSent2 = await client.cryptoStore.getLastSentOutboundGroupSession(RECEIVER_DEVICE.user_id, RECEIVER_DEVICE.device_id, roomId); - expect(lastSent2).toMatchObject({ - sessionId: STATIC_OUTBOUND_SESSION.sessionId, - index: expect.any(Number), - }); - expect(lastSent2.index).toEqual(lastSent.index); - }); - }); - - describe('processInboundDeviceMessage', () => { - const userId = "@alice:example.org"; - let client: MatrixClient; - - beforeEach(async () => { - const { client: mclient } = createTestClient(null, userId, true); - client = mclient; - - await client.cryptoStore.setDeviceId(TEST_DEVICE_ID); - await feedStaticOlmAccount(client); - client.uploadDeviceKeys = () => Promise.resolve({}); - client.uploadDeviceOneTimeKeys = () => Promise.resolve({}); - client.checkOneTimeKeyCounts = () => Promise.resolve({}); - - // client crypto not prepared for the one test which wants that state - }); - - afterEach(async () => { - LogService.setLogger(new ConsoleLogger()); - }); - - it('should fail when the crypto has not been prepared', async () => { - try { - await client.crypto.processInboundDeviceMessage(null); - - // noinspection ExceptionCaughtLocallyJS - throw new Error("Failed to fail"); - } catch (e) { - expect(e.message).toEqual("End-to-end encryption has not initialized"); - } - }); - - it('should ignore invalid formats', async () => { - await client.crypto.prepare([]); - - const logSpy = simple.stub().callFn((mod, msg) => { - expect(mod).toEqual("CryptoClient"); - expect(msg).toEqual("Received invalid encrypted message"); - }); - LogService.setLogger({ warn: logSpy } as any as ILogger); - - await client.crypto.processInboundDeviceMessage(null); - await client.crypto.processInboundDeviceMessage(undefined); - await client.crypto.processInboundDeviceMessage({ - content: null, - type: "m.room.encrypted", - sender: "@bob:example.org" - }); - await client.crypto.processInboundDeviceMessage({ - type: "m.room.encrypted", - sender: "@bob:example.org" - } as any); - await client.crypto.processInboundDeviceMessage({ - content: { msg: true }, - type: null, - sender: "@bob:example.org" - }); - await client.crypto.processInboundDeviceMessage({ - content: { msg: true }, - sender: "@bob:example.org" - } as any); - await client.crypto.processInboundDeviceMessage({ - content: { msg: true }, - type: "m.room.encrypted", - sender: null - }); - await client.crypto.processInboundDeviceMessage({ - content: { msg: true }, - type: "m.room.encrypted" - } as any); - expect(logSpy.callCount).toBe(8); - }); - - it('should ignore invalid message types', async () => { - await client.crypto.prepare([]); - - const logSpy = simple.stub().callFn((mod, msg) => { - expect(mod).toEqual("CryptoClient"); - expect(msg).toEqual("Unknown to-device message type: org.example"); - }); - LogService.setLogger({ warn: logSpy } as any as ILogger); - - await client.crypto.processInboundDeviceMessage({ - content: { test: true }, - type: "org.example", - sender: "@bob:example.org" - }); - expect(logSpy.callCount).toBe(1); - }); - - it('should ignore unknown algorithms', async () => { - await client.crypto.prepare([]); - - const logSpy = simple.stub().callFn((mod, msg) => { - expect(mod).toEqual("CryptoClient"); - expect(msg).toEqual("Received encrypted message with unknown encryption algorithm"); - }); - LogService.setLogger({ warn: logSpy } as any as ILogger); - - await client.crypto.processInboundDeviceMessage({ - content: { - algorithm: "wrong", - ciphertext: { - "recv_key": { - type: 0, - body: "encrypted", - }, - }, - sender_key: "missing", - }, - type: "m.room.encrypted", - sender: "@bob:example.org", - }); - expect(logSpy.callCount).toBe(1); - }); - - it('should ignore messages not intended for us', async () => { - await client.crypto.prepare([]); - - const logSpy = simple.stub().callFn((mod, msg) => { - expect(mod).toEqual("CryptoClient"); - expect(msg).toEqual("Received encrypted message not intended for us (ignoring message)"); - }); - LogService.setLogger({ warn: logSpy } as any as ILogger); - - await client.crypto.processInboundDeviceMessage({ - content: { - algorithm: EncryptionAlgorithm.OlmV1Curve25519AesSha2, - ciphertext: { - "wrong_receive_key": { - type: 0, - body: "encrypted", - }, - }, - sender_key: "missing", - }, - type: "m.room.encrypted", - sender: "@bob:example.org", - }); - expect(logSpy.callCount).toBe(1); - }); - - it('should ignore messages with invalid ciphertext', async () => { - await client.crypto.prepare([]); - - const logSpy = simple.stub().callFn((mod, msg) => { - expect(mod).toEqual("CryptoClient"); - expect(msg).toEqual("Received invalid encrypted message (ignoring message)"); - }); - LogService.setLogger({ warn: logSpy } as any as ILogger); - - await client.crypto.processInboundDeviceMessage({ - content: { - algorithm: EncryptionAlgorithm.OlmV1Curve25519AesSha2, - ciphertext: { - [(client.crypto).deviceCurve25519]: { - type: "test", // !! - body: "encrypted", - }, - }, - sender_key: "missing", - }, - type: "m.room.encrypted", - sender: "@bob:example.org", - }); - await client.crypto.processInboundDeviceMessage({ - content: { - algorithm: EncryptionAlgorithm.OlmV1Curve25519AesSha2, - ciphertext: { - [(client.crypto).deviceCurve25519]: { - type: 0, - body: null, // !! - }, - }, - sender_key: "missing", - }, - type: "m.room.encrypted", - sender: "@bob:example.org", - }); - expect(logSpy.callCount).toBe(2); - }); - - it('should ignore messages from unknown devices', async () => { - await client.crypto.prepare([]); - - const logSpy = simple.stub().callFn((mod, msg) => { - expect(mod).toEqual("CryptoClient"); - expect(msg).toEqual("Received encrypted message from unknown identity key (ignoring message):"); - }); - LogService.setLogger({ warn: logSpy } as any as ILogger); - - const sender = "@bob:example.org"; - client.cryptoStore.getActiveUserDevices = async (uid) => { - expect(uid).toEqual(sender); - return [STATIC_TEST_DEVICES["NTTFKSVBSI"]]; - }; - - await client.crypto.processInboundDeviceMessage({ - content: { - algorithm: EncryptionAlgorithm.OlmV1Curve25519AesSha2, - ciphertext: { - [(client.crypto).deviceCurve25519]: { - type: 0, - body: "encrypted", - }, - }, - sender_key: "missing", - }, - type: "m.room.encrypted", - sender: sender, - }); - expect(logSpy.callCount).toBe(1); - }); - - describe('decryption', () => { - const senderDevice: UserDevice = { - user_id: "@bob:example.org", - device_id: "TEST_DEVICE_FOR_SENDER", - keys: {}, - signatures: {}, - algorithms: [EncryptionAlgorithm.MegolmV1AesSha2, EncryptionAlgorithm.OlmV1Curve25519AesSha2], - unsigned: {}, - }; - const session: IOlmSession = { - sessionId: "", - pickled: "", - lastDecryptionTs: Date.now(), - }; - const altSession: IOlmSession = { // not used in encryption - sessionId: "", - pickled: "", - lastDecryptionTs: Date.now(), - }; - - async function makeMessage(payload: IOlmPayload, inbounds = true): Promise> { - const senderAccount = new (await prepareOlm()).Account(); - const receiverAccount = await (client.crypto).getOlmAccount(); - const session1 = new (await prepareOlm()).Session(); - const session2 = new (await prepareOlm()).Session(); - const session3 = new (await prepareOlm()).Session(); - const session4 = new (await prepareOlm()).Session(); - try { - senderAccount.create(); - - const keys = JSON.parse(senderAccount.identity_keys()); - senderDevice.keys[`${DeviceKeyAlgorithm.Curve25519}:${senderDevice.device_id}`] = keys['curve25519']; - senderDevice.keys[`${DeviceKeyAlgorithm.Ed25519}:${senderDevice.device_id}`] = keys['ed25519']; - - receiverAccount.generate_one_time_keys(2); - const { curve25519: otks } = JSON.parse(receiverAccount.one_time_keys()); - const keyIds = Object.keys(otks); - const key1 = otks[keyIds[keyIds.length - 2]]; - const key2 = otks[keyIds[keyIds.length - 1]]; - receiverAccount.mark_keys_as_published(); - - session1.create_outbound(senderAccount, JSON.parse(receiverAccount.identity_keys())['curve25519'], key1); - session2.create_outbound(senderAccount, JSON.parse(receiverAccount.identity_keys())['curve25519'], key2); - - if (payload.keys?.ed25519 === "populated") { - payload.keys.ed25519 = keys['ed25519']; - } - - const encrypted1 = session1.encrypt(JSON.stringify(payload)); - const encrypted2 = session2.encrypt(JSON.stringify(payload)); - - if (inbounds) { - session3.create_inbound_from(receiverAccount, keys['curve25519'], encrypted1.body); - session4.create_inbound_from(receiverAccount, keys['curve25519'], encrypted2.body); - - session.sessionId = session3.session_id(); - session.pickled = session3.pickle((client.crypto).pickleKey); - altSession.sessionId = session4.session_id(); - altSession.pickled = session4.pickle((client.crypto).pickleKey); - - receiverAccount.remove_one_time_keys(session3); - receiverAccount.remove_one_time_keys(session4); - } - - return { - type: "m.room.encrypted", - content: { - algorithm: EncryptionAlgorithm.OlmV1Curve25519AesSha2, - sender_key: keys['curve25519'], - ciphertext: { - [JSON.parse(receiverAccount.identity_keys())['curve25519']]: encrypted1, - }, - }, - sender: senderDevice.user_id, - }; - } finally { - senderAccount.free(); - session1.free(); - session2.free(); - session3.free(); - session4.free(); - await (client.crypto).storeAndFreeOlmAccount(receiverAccount); - } - } - - beforeEach(async () => { - await client.crypto.prepare([]); - client.cryptoStore.getActiveUserDevices = async (uid) => { - expect(uid).toEqual(senderDevice.user_id); - return [senderDevice]; - }; - client.cryptoStore.getOlmSessions = async (uid, did) => { - expect(uid).toEqual(senderDevice.user_id); - expect(did).toEqual(senderDevice.device_id); - return [altSession, session]; - }; - - session.pickled = ""; - session.sessionId = ""; - altSession.pickled = ""; - altSession.sessionId = ""; - - LogService.setLogger({ - error: (mod, msg, ...rest) => { - console.error(mod, msg, ...rest); - expect(mod).toEqual("CryptoClient"); - expect(msg).not.toEqual("Non-fatal error while processing to-device message:"); - }, - warn: (...rest) => console.warn(...rest), - } as any as ILogger); - }); - - afterEach(async () => { - LogService.setLogger(new ConsoleLogger()); - }); - - it('should decrypt with a known Olm session', async () => { - const plaintext = { - keys: { - ed25519: "populated", - }, - recipient_keys: { - ed25519: (client.crypto).deviceEd25519, - }, - recipient: await client.getUserId(), - sender: senderDevice.user_id, - content: { - tests: true, - }, - type: "m.room_key", - }; - const deviceMessage = await makeMessage(plaintext); - - const handleSpy = simple.stub().callFn(async (d, dev, m) => { - expect(d).toMatchObject(plaintext); - expect(dev).toMatchObject(senderDevice as any); - expect(m).toMatchObject(deviceMessage as any); - }); - (client.crypto).handleInboundRoomKey = handleSpy; - - await client.crypto.processInboundDeviceMessage(deviceMessage); - expect(handleSpy.callCount).toBe(1); - }); - - it('should decrypt with an unknown but storable Olm session', async () => { - const plaintext = { - keys: { - ed25519: "populated", - }, - recipient_keys: { - ed25519: (client.crypto).deviceEd25519, - }, - recipient: await client.getUserId(), - sender: senderDevice.user_id, - content: { - tests: true, - }, - type: "m.room_key", - }; - const deviceMessage = await makeMessage(plaintext, false); - - const handleSpy = simple.stub().callFn(async (d, dev, m) => { - expect(d).toMatchObject(plaintext); - expect(dev).toMatchObject(senderDevice as any); - expect(m).toMatchObject(deviceMessage as any); - }); - (client.crypto).handleInboundRoomKey = handleSpy; - - const storeSpy = simple.stub().callFn(async (uid, did, s) => { - expect(uid).toEqual(senderDevice.user_id); - expect(did).toEqual(senderDevice.device_id); - expect(s).toMatchObject({ - pickled: expect.any(String), - sessionId: expect.any(String), - lastDecryptionTs: expect.any(Number), - }); - }); - client.cryptoStore.storeOlmSession = storeSpy; - - client.cryptoStore.getOlmSessions = async (uid, did) => { - expect(uid).toEqual(senderDevice.user_id); - expect(did).toEqual(senderDevice.device_id); - return []; - }; - - await client.crypto.processInboundDeviceMessage(deviceMessage); - expect(handleSpy.callCount).toBe(1); - expect(storeSpy.callCount).toBe(2); // once for the inbound session, once after decrypt - }); - - it('should try to create a new Olm session with an unknown type 1 message', async () => { - const plaintext = { - keys: { - ed25519: "populated", - }, - recipient_keys: { - ed25519: (client.crypto).deviceEd25519, - }, - recipient: await client.getUserId(), - sender: senderDevice.user_id, - content: { - tests: true, - }, - type: "m.room_key", - }; - const deviceMessage = await makeMessage(plaintext, false); - const ciphertext = deviceMessage['content']['ciphertext']; - ciphertext[Object.keys(ciphertext)[0]]['type'] = 1; - - const handleSpy = simple.stub().callFn(async (d, dev, m) => { - expect(d).toMatchObject(plaintext); - expect(dev).toMatchObject(senderDevice as any); - expect(m).toMatchObject(deviceMessage as any); - }); - (client.crypto).handleInboundRoomKey = handleSpy; - - const storeSpy = simple.stub().callFn(async (uid, did, s) => { - expect(uid).toEqual(senderDevice.user_id); - expect(did).toEqual(senderDevice.device_id); - expect(s).toMatchObject({ - pickled: expect.any(String), - sessionId: expect.any(String), - lastDecryptionTs: expect.any(Number), - }); - }); - client.cryptoStore.storeOlmSession = storeSpy; - - const establishSpy = simple.stub().callFn(async (d) => { - expect(d).toMatchObject(senderDevice as any); - }); - (client.crypto).establishNewOlmSession = establishSpy; - - client.cryptoStore.getOlmSessions = async (uid, did) => { - expect(uid).toEqual(senderDevice.user_id); - expect(did).toEqual(senderDevice.device_id); - return []; - }; - - await client.crypto.processInboundDeviceMessage(deviceMessage); - expect(handleSpy.callCount).toBe(0); - expect(storeSpy.callCount).toBe(0); - expect(establishSpy.callCount).toBe(1); - }); - - it('should fail decryption if the message validation failed', async () => { - let expectedAddl: any; - let warnCalled = false; - LogService.setLogger({ - error: (mod, msg, ...rest) => { - console.error(mod, msg, ...rest); - expect(mod).toEqual("CryptoClient"); - expect(msg).not.toEqual("Non-fatal error while processing to-device message:"); - }, - warn: (mod, msg, addl, ...rest) => { - console.warn(mod, msg, addl, ...rest); - warnCalled = true; - expect(mod).toEqual("CryptoClient"); - expect(msg).toEqual("Successfully decrypted to-device message, but it failed validation. Ignoring message."); - expect(addl).toMatchObject(expectedAddl); - }, - } as any as ILogger); - - const plainTemplate = { - keys: { - ed25519: "populated", - }, - recipient_keys: { - ed25519: (client.crypto).deviceEd25519, - }, - recipient: await client.getUserId(), - sender: senderDevice.user_id, - content: { - tests: true, - }, - type: "m.room_key", - }; - const addlTemplate = { - wasForUs: true, - wasFromThem: true, - hasType: true, - hasContent: true, - ourKeyMatches: true, - theirKeyMatches: true, - }; - - const makeTestCase = (p: Partial, a: Partial) => { - return [ - JSON.parse(JSON.stringify({ ...plainTemplate, ...p })), - JSON.parse(JSON.stringify({ ...addlTemplate, ...a })), - ]; - }; - - const cases = [ - makeTestCase({ recipient: "@wrong:example.org" }, { wasForUs: false }), - makeTestCase({ sender: "@wrong:example.org" }, { wasFromThem: false }), - makeTestCase({ type: 12 } as any, { hasType: false }), - makeTestCase({ type: null } as any, { hasType: false }), - makeTestCase({ content: 12 } as any, { hasContent: false }), - makeTestCase({ content: null } as any, { hasContent: false }), - makeTestCase({ content: "wrong" } as any, { hasContent: false }), - makeTestCase({ recipient_keys: null }, { ourKeyMatches: false }), - makeTestCase({ recipient_keys: {} } as any, { ourKeyMatches: false }), - makeTestCase({ recipient_keys: { ed25519: "wrong" } }, { ourKeyMatches: false }), - makeTestCase({ keys: null }, { theirKeyMatches: false }), - makeTestCase({ keys: {} } as any, { theirKeyMatches: false }), - makeTestCase({ keys: { ed25519: "wrong" } }, { theirKeyMatches: false }), - ]; - for (let i = 0; i < cases.length; i++) { - const testCase = cases[i]; - const plaintext = testCase[0]; - expectedAddl = testCase[1]; - warnCalled = false; - - console.log(JSON.stringify({ i, testCase }, null, 2)); - - const deviceMessage = await makeMessage(plaintext as any); - - const handleSpy = simple.stub().callFn(async (d, dev, m) => { - expect(d).toMatchObject(plaintext); - expect(dev).toMatchObject(senderDevice as any); - expect(m).toMatchObject(deviceMessage as any); - }); - (client.crypto).handleInboundRoomKey = handleSpy; - - await client.crypto.processInboundDeviceMessage(deviceMessage); - expect(handleSpy.callCount).toBe(0); - expect(warnCalled).toBe(true); - } - }); - }); - }); - - describe('handleInboundRoomKey', () => { - const userId = "@alice:example.org"; - let client: MatrixClient; - - beforeEach(async () => { - const { client: mclient } = createTestClient(null, userId, true); - client = mclient; - - await client.cryptoStore.setDeviceId(TEST_DEVICE_ID); - await feedStaticOlmAccount(client); - client.uploadDeviceKeys = () => Promise.resolve({}); - client.uploadDeviceOneTimeKeys = () => Promise.resolve({}); - client.checkOneTimeKeyCounts = () => Promise.resolve({}); - - await client.crypto.prepare([]); - }); - - afterEach(async () => { - LogService.setLogger(new ConsoleLogger()); - }); - - it('should validate the incoming key', async () => { - let expectedMessage = ""; - const logSpy = simple.stub().callFn((mod, msg) => { - expect(mod).toEqual("CryptoClient"); - expect(msg).toEqual(expectedMessage); - }); - LogService.setLogger({ warn: logSpy } as any as ILogger); - - const expectLogCall = () => { - expect(logSpy.callCount).toBe(1); - logSpy.reset(); - }; - - expectedMessage = "Ignoring m.room_key for unknown encryption algorithm"; - await (client.crypto).handleInboundRoomKey({ content: { algorithm: "wrong" } }, null, null); - expectLogCall(); - await (client.crypto).handleInboundRoomKey({ content: null }, null, null); - expectLogCall(); - - expectedMessage = "Ignoring invalid m.room_key"; - await (client.crypto).handleInboundRoomKey({ content: { algorithm: EncryptionAlgorithm.MegolmV1AesSha2 } }, null, null); - expectLogCall(); - await (client.crypto).handleInboundRoomKey({ - content: { - algorithm: EncryptionAlgorithm.MegolmV1AesSha2, - room_id: "test" - } - }, null, null); - expectLogCall(); - await (client.crypto).handleInboundRoomKey({ - content: { - algorithm: EncryptionAlgorithm.MegolmV1AesSha2, - room_id: "test", - session_id: "test" - } - }, null, null); - expectLogCall(); - - expectedMessage = "Ignoring m.room_key message from unexpected sender"; - await (client.crypto).handleInboundRoomKey({ - content: { - algorithm: EncryptionAlgorithm.MegolmV1AesSha2, - room_id: "test", - session_id: "test", - session_key: "test" - } - }, { - device_id: "DEVICE", - keys: { - "curve25519:DEVICE": "key_goes_here", - }, - }, { - content: { - sender_key: "wrong", - }, - }); - expectLogCall(); - }); - - it('should not store known inbound sessions', async () => { - const storeSpy = simple.stub().callFn(async () => { - throw new Error("Called wrongly"); - }); - (client.crypto).storeInboundGroupSession = storeSpy; - - const readSpy = simple.stub().callFn(async (uid, did, rid, sid) => { - expect(uid).toEqual("@user:example.org"); - expect(did).toEqual("DEVICE"); - expect(rid).toEqual("!test:example.org"); - expect(sid).toEqual("test_session"); - return { testing: true } as any; // return value not important - }); - client.cryptoStore.getInboundGroupSession = readSpy; - - await (client.crypto).handleInboundRoomKey({ - content: { - algorithm: EncryptionAlgorithm.MegolmV1AesSha2, - room_id: "!test:example.org", - session_id: "test_session", - session_key: "session_key_goes_here", - }, - }, { - device_id: "DEVICE", - user_id: "@user:example.org", - keys: { - "curve25519:DEVICE": "key_goes_here", - }, - }, { - content: { - sender_key: "key_goes_here", - }, - }); - expect(storeSpy.callCount).toBe(0); - expect(readSpy.callCount).toBe(1); - }); - - it('should store unknown inbound sessions', async () => { - const content = { - algorithm: EncryptionAlgorithm.MegolmV1AesSha2, - room_id: "!test:example.org", - session_id: "test_session", - session_key: "session_key_goes_here", - }; - const storeSpy = simple.stub().callFn(async (c, uid, did) => { - expect(uid).toEqual("@user:example.org"); - expect(did).toEqual("DEVICE"); - expect(c).toMatchObject(content); - }); - (client.crypto).storeInboundGroupSession = storeSpy; - - const readSpy = simple.stub().callFn(async (uid, did, rid, sid) => { - expect(uid).toEqual("@user:example.org"); - expect(did).toEqual("DEVICE"); - expect(rid).toEqual("!test:example.org"); - expect(sid).toEqual("test_session"); - return null; // assume not known - }); - client.cryptoStore.getInboundGroupSession = readSpy; - - await (client.crypto).handleInboundRoomKey({ - content: content, - }, { - device_id: "DEVICE", - user_id: "@user:example.org", - keys: { - "curve25519:DEVICE": "key_goes_here", - }, - }, { - content: { - sender_key: "key_goes_here", - }, - }); - expect(storeSpy.callCount).toBe(1); - expect(readSpy.callCount).toBe(1); - }); - }); - - describe('storeInboundGroupSession', () => { - const userId = "@alice:example.org"; - let client: MatrixClient; - - beforeEach(async () => { - const { client: mclient } = createTestClient(null, userId, true); - client = mclient; - - await client.cryptoStore.setDeviceId(TEST_DEVICE_ID); - await feedStaticOlmAccount(client); - client.uploadDeviceKeys = () => Promise.resolve({}); - client.uploadDeviceOneTimeKeys = () => Promise.resolve({}); - client.checkOneTimeKeyCounts = () => Promise.resolve({}); - - await client.crypto.prepare([]); - }); - - afterEach(async () => { - LogService.setLogger(new ConsoleLogger()); - }); - - it('should ignore mismatched session IDs', async () => { - const session = new (await prepareOlm()).OutboundGroupSession(); - try { - session.create(); - - const key: IMRoomKey = { - session_key: session.session_key(), - session_id: "wrong", - algorithm: EncryptionAlgorithm.MegolmV1AesSha2, - room_id: "!room:example.org", - }; - - const storeSpy = simple.stub().callFn(async (s) => { - expect(s).toMatchObject({ - roomId: key.room_id, - sessionId: key.session_id, - senderDeviceId: TEST_DEVICE_ID, - senderUserId: userId, - pickled: expect.any(String), - }); - }); - client.cryptoStore.storeInboundGroupSession = storeSpy; - - const logSpy = simple.stub().callFn((mod, msg) => { - expect(mod).toEqual("CryptoClient"); - expect(msg).toEqual("Ignoring m.room_key with mismatched session_id"); - }); - LogService.setLogger({ warn: logSpy } as any as ILogger); - - await (client.crypto).storeInboundGroupSession(key, userId, TEST_DEVICE_ID); - expect(logSpy.callCount).toBe(1); - expect(storeSpy.callCount).toBe(0); - } finally { - session.free(); - } - }); - - it('should store sessions', async () => { - const session = new (await prepareOlm()).OutboundGroupSession(); - try { - session.create(); - - const key: IMRoomKey = { - session_key: session.session_key(), - session_id: session.session_id(), - algorithm: EncryptionAlgorithm.MegolmV1AesSha2, - room_id: "!room:example.org", - }; - - const storeSpy = simple.stub().callFn(async (s) => { - expect(s).toMatchObject({ - roomId: key.room_id, - sessionId: key.session_id, - senderDeviceId: TEST_DEVICE_ID, - senderUserId: userId, - pickled: expect.any(String), - }); - }); - client.cryptoStore.storeInboundGroupSession = storeSpy; - - await (client.crypto).storeInboundGroupSession(key, userId, TEST_DEVICE_ID); - expect(storeSpy.callCount).toBe(1); - } finally { - session.free(); - } - }); - }); - - describe('establishNewOlmSession', () => { - const userId = "@alice:example.org"; - let client: MatrixClient; - - beforeEach(async () => { - const { client: mclient } = createTestClient(null, userId, true); - client = mclient; - - await client.cryptoStore.setDeviceId(TEST_DEVICE_ID); - await feedStaticOlmAccount(client); - client.uploadDeviceKeys = () => Promise.resolve({}); - client.uploadDeviceOneTimeKeys = () => Promise.resolve({}); - client.checkOneTimeKeyCounts = () => Promise.resolve({}); - - await client.crypto.prepare([]); - }); - - it('should force new session creation', async () => { - const session = { - test: true, - }; - - const device = { - user_id: userId, - device_id: TEST_DEVICE_ID, - // rest don't matter - }; - - const genSpy = simple.stub().callFn(async (m, f) => { - expect(m).toMatchObject({[userId]: [TEST_DEVICE_ID]}); - expect(f).toBe(true); - return { - [userId]: { - [TEST_DEVICE_ID]: session, - }, - }; - }); - (client.crypto).getOrCreateOlmSessions = genSpy; - - const sendSpy = simple.stub().callFn(async (d, s, t, c) => { - expect(d).toMatchObject(device); - expect(s).toMatchObject(session); - expect(t).toEqual("m.dummy"); - expect(JSON.stringify(c)).toEqual("{}"); - }); - (client.crypto).encryptAndSendOlmMessage = sendSpy; - - await (client.crypto).establishNewOlmSession(device); - expect(genSpy.callCount).toBe(1); - expect(sendSpy.callCount).toBe(1); - }); - }); - - describe('decryptRoomEvent', () => { - const userId = "@alice:example.org"; - let client: MatrixClient; - - beforeEach(async () => { - const { client: mclient } = createTestClient(null, userId, true); - client = mclient; - - await client.cryptoStore.setDeviceId(TEST_DEVICE_ID); - await feedStaticOlmAccount(client); - client.uploadDeviceKeys = () => Promise.resolve({}); - client.uploadDeviceOneTimeKeys = () => Promise.resolve({}); - client.checkOneTimeKeyCounts = () => Promise.resolve({}); - - // client crypto not prepared for the one test which wants that state - }); - - afterEach(async () => { - LogService.setLogger(new ConsoleLogger()); - }); - - it('should fail when the crypto has not been prepared', async () => { - try { - await client.crypto.decryptRoomEvent(null, null); - - // noinspection ExceptionCaughtLocallyJS - throw new Error("Failed to fail"); - } catch (e) { - expect(e.message).toEqual("End-to-end encryption has not initialized"); - } - }); - - it('should fail if the algorithm is not known', async () => { - await client.crypto.prepare([]); - - const event = new EncryptedRoomEvent({ - content: { - algorithm: "wrong", - }, - }); - const roomId = "!room:example.org"; - - try { - await client.crypto.decryptRoomEvent(event, roomId); - - // noinspection ExceptionCaughtLocallyJS - throw new Error("Failed to fail"); - } catch (e) { - expect(e.message).toEqual("Unable to decrypt: Unknown algorithm"); - } - }); - - it('should fail if the sending device is unknown', async () => { - await client.crypto.prepare([]); - - const event = new EncryptedRoomEvent({ - content: { - algorithm: EncryptionAlgorithm.MegolmV1AesSha2, - sender_key: "sender", - ciphertext: "cipher", - session_id: "session", - device_id: TEST_DEVICE_ID, - }, - sender: userId, - }); - const roomId = "!room:example.org"; - - const getSpy = simple.stub().callFn(async (uid, did) => { - expect(uid).toEqual(userId); - expect(did).toEqual(event.content.device_id); - return null; - }); - client.cryptoStore.getActiveUserDevice = getSpy; - - try { - await client.crypto.decryptRoomEvent(event, roomId); - - // noinspection ExceptionCaughtLocallyJS - throw new Error("Failed to fail"); - } catch (e) { - expect(e.message).toEqual("Unable to decrypt: Unknown device for sender"); - } - - expect(getSpy.callCount).toBe(1); - }); - - it('should fail if the sending device has a key mismatch', async () => { - await client.crypto.prepare([]); - - const event = new EncryptedRoomEvent({ - content: { - algorithm: EncryptionAlgorithm.MegolmV1AesSha2, - sender_key: "wrong", - ciphertext: "cipher", - session_id: "session", - device_id: TEST_DEVICE_ID, - }, - sender: userId, - }); - const roomId = "!room:example.org"; - - const getSpy = simple.stub().callFn(async (uid, did) => { - expect(uid).toEqual(userId); - expect(did).toEqual(event.content.device_id); - return RECEIVER_DEVICE; - }); - client.cryptoStore.getActiveUserDevice = getSpy; - - try { - await client.crypto.decryptRoomEvent(event, roomId); - - // noinspection ExceptionCaughtLocallyJS - throw new Error("Failed to fail"); - } catch (e) { - expect(e.message).toEqual("Unable to decrypt: Device key mismatch"); - } - - expect(getSpy.callCount).toBe(1); - }); - - it('should fail if the session is unknown', async () => { - await client.crypto.prepare([]); - - const event = new EncryptedRoomEvent({ - content: { - algorithm: EncryptionAlgorithm.MegolmV1AesSha2, - sender_key: RECEIVER_DEVICE.keys[`${DeviceKeyAlgorithm.Curve25519}:${RECEIVER_DEVICE.device_id}`], - ciphertext: "cipher", - session_id: "test", - device_id: TEST_DEVICE_ID, - }, - sender: userId, - }); - const roomId = "!room:example.org"; - - const getDeviceSpy = simple.stub().callFn(async (uid, did) => { - expect(uid).toEqual(userId); - expect(did).toEqual(event.content.device_id); - return RECEIVER_DEVICE; - }); - client.cryptoStore.getActiveUserDevice = getDeviceSpy; - - const getSessionSpy = simple.stub().callFn(async (uid, did, rid, sid) => { - expect(uid).toEqual(userId); - expect(did).toEqual(event.content.device_id); - expect(rid).toEqual(roomId); - expect(sid).toEqual(event.content.session_id); - return null; - }); - client.cryptoStore.getInboundGroupSession = getSessionSpy; - - try { - await client.crypto.decryptRoomEvent(event, roomId); - - // noinspection ExceptionCaughtLocallyJS - throw new Error("Failed to fail"); - } catch (e) { - expect(e.message).toEqual("Unable to decrypt: Unknown inbound session ID"); - } - - expect(getDeviceSpy.callCount).toBe(1); - expect(getSessionSpy.callCount).toBe(1); - }); - - it('should fail the decryption looks like a replay attack', async () => { - await client.crypto.prepare([]); - - await client.cryptoStore.setActiveUserDevices(RECEIVER_DEVICE.user_id, [RECEIVER_DEVICE]); - - // Make an encrypted event, and store the outbound keys as inbound - const plainType = "org.example.plain"; - const plainContent = { - tests: true, - hello: "world", - }; - let event: EncryptedRoomEvent; - const roomId = "!room:example.org"; - const outboundSession = new (await prepareOlm()).OutboundGroupSession(); - try { - outboundSession.create(); - await (client.crypto).storeInboundGroupSession({ - room_id: roomId, - session_id: outboundSession.session_id(), - session_key: outboundSession.session_key(), - algorithm: EncryptionAlgorithm.MegolmV1AesSha2, - }, RECEIVER_DEVICE.user_id, RECEIVER_DEVICE.device_id); - event = new EncryptedRoomEvent({ - sender: RECEIVER_DEVICE.user_id, - type: "m.room.encrypted", - event_id: "$sent", - content: { - algorithm: EncryptionAlgorithm.MegolmV1AesSha2, - sender_key: RECEIVER_DEVICE.keys[`${DeviceKeyAlgorithm.Curve25519}:${RECEIVER_DEVICE.device_id}`], - ciphertext: outboundSession.encrypt(JSON.stringify({ - type: plainType, - content: plainContent, - room_id: roomId, - })), - session_id: outboundSession.session_id(), - device_id: RECEIVER_DEVICE.device_id, - }, - }); - } finally { - outboundSession.free(); - } - - const getIndexSpy = simple.stub().callFn(async (rid, sid, idx) => { - expect(rid).toEqual(roomId); - expect(sid).toEqual(event.content.session_id); - expect(idx).toBe(0); - return "$wrong"; - }); - client.cryptoStore.getEventForMessageIndex = getIndexSpy; - - try { - await client.crypto.decryptRoomEvent(event, roomId); - - // noinspection ExceptionCaughtLocallyJS - throw new Error("Failed to fail"); - } catch (e) { - expect(e.message).toEqual("Unable to decrypt: Message replay attack"); - } - - expect(getIndexSpy.callCount).toBe(1); - }); - - it('should succeed at re-decryption (valid replay)', async () => { - await client.crypto.prepare([]); - - await client.cryptoStore.setActiveUserDevices(RECEIVER_DEVICE.user_id, [RECEIVER_DEVICE]); - - // Make an encrypted event, and store the outbound keys as inbound - const plainType = "org.example.plain"; - const plainContent = { - tests: true, - hello: "world", - }; - let event: EncryptedRoomEvent; - const roomId = "!room:example.org"; - const outboundSession = new (await prepareOlm()).OutboundGroupSession(); - try { - outboundSession.create(); - await (client.crypto).storeInboundGroupSession({ - room_id: roomId, - session_id: outboundSession.session_id(), - session_key: outboundSession.session_key(), - algorithm: EncryptionAlgorithm.MegolmV1AesSha2, - }, RECEIVER_DEVICE.user_id, RECEIVER_DEVICE.device_id); - event = new EncryptedRoomEvent({ - sender: RECEIVER_DEVICE.user_id, - type: "m.room.encrypted", - event_id: "$sent", - content: { - algorithm: EncryptionAlgorithm.MegolmV1AesSha2, - sender_key: RECEIVER_DEVICE.keys[`${DeviceKeyAlgorithm.Curve25519}:${RECEIVER_DEVICE.device_id}`], - ciphertext: outboundSession.encrypt(JSON.stringify({ - type: plainType, - content: plainContent, - room_id: roomId, - })), - session_id: outboundSession.session_id(), - device_id: RECEIVER_DEVICE.device_id, - }, - }); - } finally { - outboundSession.free(); - } - - const getIndexSpy = simple.stub().callFn(async (rid, sid, idx) => { - expect(rid).toEqual(roomId); - expect(sid).toEqual(event.content.session_id); - expect(idx).toBe(0); - return event.eventId; - }); - client.cryptoStore.getEventForMessageIndex = getIndexSpy; - - const setIndexSpy = simple.stub().callFn(async (rid, eid, sid, idx) => { - expect(rid).toEqual(roomId); - expect(eid).toEqual(event.eventId); - expect(sid).toEqual(event.content.session_id); - expect(idx).toBe(0); - }); - client.cryptoStore.setMessageIndexForEvent = setIndexSpy; - - const result = await client.crypto.decryptRoomEvent(event, roomId); - expect(result).toBeDefined(); - expect(result.type).toEqual(plainType); - expect(result.content).toMatchObject(plainContent); - expect(result.raw).toMatchObject(Object.assign({}, event.raw, {type: plainType, content: plainContent})); - expect(getIndexSpy.callCount).toBe(1); - expect(setIndexSpy.callCount).toBe(1); - }); - - it('should succeed at decryption', async () => { - await client.crypto.prepare([]); - - await client.cryptoStore.setActiveUserDevices(RECEIVER_DEVICE.user_id, [RECEIVER_DEVICE]); - - // Make an encrypted event, and store the outbound keys as inbound - const plainType = "org.example.plain"; - const plainContent = { - tests: true, - hello: "world", - }; - const roomId = "!room:example.org"; - let event: EncryptedRoomEvent; - const outboundSession = new (await prepareOlm()).OutboundGroupSession(); - try { - outboundSession.create(); - await (client.crypto).storeInboundGroupSession({ - room_id: roomId, - session_id: outboundSession.session_id(), - session_key: outboundSession.session_key(), - algorithm: EncryptionAlgorithm.MegolmV1AesSha2, - }, RECEIVER_DEVICE.user_id, RECEIVER_DEVICE.device_id); - event = new EncryptedRoomEvent({ - sender: RECEIVER_DEVICE.user_id, - type: "m.room.encrypted", - event_id: "$sent", - content: { - algorithm: EncryptionAlgorithm.MegolmV1AesSha2, - sender_key: RECEIVER_DEVICE.keys[`${DeviceKeyAlgorithm.Curve25519}:${RECEIVER_DEVICE.device_id}`], - ciphertext: outboundSession.encrypt(JSON.stringify({ - type: plainType, - content: plainContent, - room_id: roomId, - })), - session_id: outboundSession.session_id(), - device_id: RECEIVER_DEVICE.device_id, - }, - }); - } finally { - outboundSession.free(); - } - - const getIndexSpy = simple.stub().callFn(async (rid, sid, idx) => { - expect(rid).toEqual(roomId); - expect(sid).toEqual(event.content.session_id); - expect(idx).toBe(0); - return null; // assume not known - }); - client.cryptoStore.getEventForMessageIndex = getIndexSpy; - - const setIndexSpy = simple.stub().callFn(async (rid, eid, sid, idx) => { - expect(rid).toEqual(roomId); - expect(eid).toEqual(event.eventId); - expect(sid).toEqual(event.content.session_id); - expect(idx).toBe(0); - }); - client.cryptoStore.setMessageIndexForEvent = setIndexSpy; - - const result = await client.crypto.decryptRoomEvent(event, roomId); - expect(result).toBeDefined(); - expect(result.type).toEqual(plainType); - expect(result.content).toMatchObject(plainContent); - expect(result.raw).toMatchObject(Object.assign({}, event.raw, {type: plainType, content: plainContent})); - expect(getIndexSpy.callCount).toBe(1); - expect(setIndexSpy.callCount).toBe(1); - }); - }); - - describe('encryptMedia', () => { - const userId = "@alice:example.org"; - let client: MatrixClient; - - beforeEach(async () => { - const { client: mclient } = createTestClient(null, userId, true); - client = mclient; - - await client.cryptoStore.setDeviceId(TEST_DEVICE_ID); - await feedStaticOlmAccount(client); - client.uploadDeviceKeys = () => Promise.resolve({}); - client.uploadDeviceOneTimeKeys = () => Promise.resolve({}); - client.checkOneTimeKeyCounts = () => Promise.resolve({}); - - // client crypto not prepared for the one test which wants that state - }); - - afterEach(async () => { - LogService.setLogger(new ConsoleLogger()); - }); - - it('should fail when the crypto has not been prepared', async () => { - try { - await client.crypto.encryptMedia(null); - - // noinspection ExceptionCaughtLocallyJS - throw new Error("Failed to fail"); - } catch (e) { - expect(e.message).toEqual("End-to-end encryption has not initialized"); - } - }); - - it('should encrypt media', async () => { - await client.crypto.prepare([]); - - const inputBuffer = Buffer.from("test"); - const inputStr = inputBuffer.join(''); - - const result = await client.crypto.encryptMedia(inputBuffer); - expect(result).toBeDefined(); - expect(result.buffer).toBeDefined(); - expect(result.buffer.join('')).not.toEqual(inputStr); - expect(result.file).toBeDefined(); - expect(result.file.hashes).toBeDefined(); - expect(result.file.hashes.sha256).not.toEqual("n4bQgYhMfWWaL+qgxVrQFaO/TxsrC4Is0V1sFbDwCgg"); - expect(result.file).toMatchObject({ - hashes: { - sha256: expect.any(String), - }, - key: { - alg: "A256CTR", - ext: true, - key_ops: ['encrypt', 'decrypt'], - kty: "oct", - k: expect.any(String), - }, - iv: expect.any(String), - v: "v2", - }); - }); - }); - - describe('decryptMedia', () => { - const userId = "@alice:example.org"; - let client: MatrixClient; - - // Created from Element Web - const testFileContents = "THIS IS A TEST FILE."; - const mediaFileContents = Buffer.from("eB15hJlkw8WwgYxwY2mu8vS250s=", "base64"); - const testFile: EncryptedFile = { - v: "v2", - key: { - alg: "A256CTR", - ext: true, - k: "l3OtQ3IJzfJa85j2WMsqNu7J--C-I1hzPxFvinR48mM", - key_ops: [ - "encrypt", - "decrypt" - ], - kty: "oct" - }, - iv: "KJQOebQS1wwAAAAAAAAAAA", - hashes: { - sha256: "Qe4YzmVoPaEcLQeZwFZ4iMp/dlgeFph6mi5DmCaCOzg" - }, - url: "mxc://localhost/uiWuISEVWixompuiiYyUoGrx", - }; - - function copyOfTestFile(): EncryptedFile { - return JSON.parse(JSON.stringify(testFile)); - } - - beforeEach(async () => { - const { client: mclient } = createTestClient(null, userId, true); - client = mclient; - - await client.cryptoStore.setDeviceId(TEST_DEVICE_ID); - await feedStaticOlmAccount(client); - client.uploadDeviceKeys = () => Promise.resolve({}); - client.uploadDeviceOneTimeKeys = () => Promise.resolve({}); - client.checkOneTimeKeyCounts = () => Promise.resolve({}); - - // client crypto not prepared for the one test which wants that state - }); - - afterEach(async () => { - LogService.setLogger(new ConsoleLogger()); - }); - - it('should fail when the crypto has not been prepared', async () => { - try { - await client.crypto.encryptMedia(null); - - // noinspection ExceptionCaughtLocallyJS - throw new Error("Failed to fail"); - } catch (e) { - expect(e.message).toEqual("End-to-end encryption has not initialized"); - } - }); - - it('should be symmetrical', async () => { - await client.crypto.prepare([]); - - const mxc = "mxc://example.org/test"; - const inputBuffer = Buffer.from("test"); - const encrypted = await client.crypto.encryptMedia(inputBuffer); - - const downloadSpy = simple.stub().callFn(async (u) => { - expect(u).toEqual(mxc); - return {data: encrypted.buffer, contentType: "application/octet-stream"}; - }); - client.downloadContent = downloadSpy; - - const result = await client.crypto.decryptMedia({ - url: mxc, - ...encrypted.file, - }); - expect(result.join('')).toEqual(inputBuffer.join('')); - expect(downloadSpy.callCount).toBe(1); - }); - - it('should fail on unknown or invalid fields', async () => { - await client.crypto.prepare([]); - - try { - const f = copyOfTestFile(); - // @ts-ignore - f.v = "wrong"; - await client.crypto.decryptMedia(f); - - // noinspection ExceptionCaughtLocallyJS - throw new Error("Failed to fail"); - } catch (e) { - expect(e.message).toEqual("Unknown encrypted file version"); - } - - try { - const f = copyOfTestFile(); - // @ts-ignore - f.key.kty = "wrong"; - await client.crypto.decryptMedia(f); - - // noinspection ExceptionCaughtLocallyJS - throw new Error("Failed to fail"); - } catch (e) { - expect(e.message).toEqual("Improper JWT: Missing or invalid fields"); - } - - try { - const f = copyOfTestFile(); - // @ts-ignore - f.key.alg = "wrong"; - await client.crypto.decryptMedia(f); - - // noinspection ExceptionCaughtLocallyJS - throw new Error("Failed to fail"); - } catch (e) { - expect(e.message).toEqual("Improper JWT: Missing or invalid fields"); - } - - try { - const f = copyOfTestFile(); - // @ts-ignore - f.key.ext = "wrong"; - await client.crypto.decryptMedia(f); - - // noinspection ExceptionCaughtLocallyJS - throw new Error("Failed to fail"); - } catch (e) { - expect(e.message).toEqual("Improper JWT: Missing or invalid fields"); - } - - try { - const f = copyOfTestFile(); - // @ts-ignore - f.key.key_ops = ["wrong"]; - await client.crypto.decryptMedia(f); - - // noinspection ExceptionCaughtLocallyJS - throw new Error("Failed to fail"); - } catch (e) { - expect(e.message).toEqual("Missing required key_ops"); - } - - try { - const f = copyOfTestFile(); - // @ts-ignore - f.hashes = {}; - await client.crypto.decryptMedia(f); - - // noinspection ExceptionCaughtLocallyJS - throw new Error("Failed to fail"); - } catch (e) { - expect(e.message).toEqual("Missing SHA256 hash"); - } - }); - - it('should fail on mismatched SHA256 hashes', async () => { - await client.crypto.prepare([]); - - const downloadSpy = simple.stub().callFn(async (u) => { - expect(u).toEqual(testFile.url); - return {data: Buffer.from(mediaFileContents), contentType: "application/octet-stream"}; - }); - client.downloadContent = downloadSpy; - - try { - const f = copyOfTestFile(); - f.hashes.sha256 = "wrong"; - await client.crypto.decryptMedia(f); - - // noinspection ExceptionCaughtLocallyJS - throw new Error("Failed to fail"); - } catch (e) { - expect(e.message).toEqual("SHA256 mismatch"); - } - - expect(downloadSpy.callCount).toBe(1); - }); - - it('should decrypt', async () => { - await client.crypto.prepare([]); - - const downloadSpy = simple.stub().callFn(async (u) => { - expect(u).toEqual(testFile.url); - return {data: Buffer.from(mediaFileContents), contentType: "application/octet-stream"}; - }); - client.downloadContent = downloadSpy; + client.downloadContent = downloadSpy; const f = copyOfTestFile(); const result = await client.crypto.decryptMedia(f); @@ -3423,57 +477,4 @@ describe('CryptoClient', () => { expect(downloadSpy.callCount).toBe(1); }); }); - - describe('updateFallbackKey', () => { - const userId = "@alice:example.org"; - let client: MatrixClient; - - beforeEach(async () => { - const { client: mclient } = createTestClient(null, userId, true); - client = mclient; - - await client.cryptoStore.setDeviceId(TEST_DEVICE_ID); - await feedStaticOlmAccount(client); - client.uploadDeviceKeys = () => Promise.resolve({}); - client.uploadDeviceOneTimeKeys = () => Promise.resolve({}); - client.checkOneTimeKeyCounts = () => Promise.resolve({}); - - // client crypto not prepared for the one test which wants that state - }); - - it('should fail when the crypto has not been prepared', async () => { - try { - await client.crypto.updateFallbackKey(); - - // noinspection ExceptionCaughtLocallyJS - throw new Error("Failed to fail"); - } catch (e) { - expect(e.message).toEqual("End-to-end encryption has not initialized"); - } - }); - - it('should create new keys', async () => { - await client.crypto.prepare([]); - - const uploadSpy = simple.stub().callFn(async (k) => { - expect(k).toMatchObject({ - keyId: expect.any(String), - key: { - key: expect.any(String), - fallback: true, - signatures: { - [userId]: { - [`${DeviceKeyAlgorithm.Ed25519}:${TEST_DEVICE_ID}`]: expect.any(String), - }, - }, - }, - }); - return null; // return not used - }); - client.uploadFallbackKey = uploadSpy; - - await client.crypto.updateFallbackKey(); - expect(uploadSpy.callCount).toBe(1); - }); - }); }); diff --git a/test/encryption/DeviceTrackerTest.ts b/test/encryption/DeviceTrackerTest.ts deleted file mode 100644 index 1aa3d610..00000000 --- a/test/encryption/DeviceTrackerTest.ts +++ /dev/null @@ -1,621 +0,0 @@ -import * as expect from "expect"; -import * as simple from "simple-mock"; -import { EncryptionAlgorithm, UserDevice } from "../../src"; -import { createTestClient, TEST_DEVICE_ID } from "../MatrixClientTest"; -import { DeviceTracker } from "../../src/e2ee/DeviceTracker"; - -const STATIC_TEST_USER = "@ping:localhost"; -export const STATIC_TEST_DEVICES = { - "NTTFKSVBSI": { - "algorithms": [EncryptionAlgorithm.OlmV1Curve25519AesSha2, EncryptionAlgorithm.MegolmV1AesSha2], - "device_id": "NTTFKSVBSI", - "keys": { - "curve25519:NTTFKSVBSI": "zPsrUlEM3DKRcBYKMHgZTLmYJU1FJDzBRnH6DsTxHH8", - "ed25519:NTTFKSVBSI": "2tVcG/+sE7hq4z+E/x6UrMuVEAzc4CknYIGbg3cQg/4", - }, - "signatures": { - "@ping:localhost": { - "ed25519:NTTFKSVBSI": "CLm1TOPFFIygs68amMsnywQoLz2evo/O28BVQGPKC986yFt0OpDKcyMUTsRFiRcdLstqtWkhy1p+UTW2/FPEDw", - "ed25519:7jeU3P5Fb8wS+LmhXNhiDSBrPMBI+uBZItlRJnpoHtE": "vx1bb8n1xWIJ+5ZkOrQ91msZbEU/p2wZGdxbnQAQDr/ZhZqwKwvY6G5bkhjvtQTdVRspPC/mFKyH0UW9D30IDA", - }, - }, - "user_id": "@ping:localhost", - "unsigned": { "device_display_name": "localhost:8080 (Edge, Windows)" }, - }, - "HCDJLDXQHQ": { - "algorithms": [EncryptionAlgorithm.OlmV1Curve25519AesSha2, EncryptionAlgorithm.MegolmV1AesSha2], - "device_id": "HCDJLDXQHQ", - "keys": { - "curve25519:HCDJLDXQHQ": "c20OI51bT8iiX9t40g5g7FcBCHORIbep+6SbkrD3FRU", - "ed25519:HCDJLDXQHQ": "hTxK3DSJit7N7eqGuOnuDIeAdj4P7S57DOMKj6ruQok", - }, - "signatures": { - "@ping:localhost": { - "ed25519:HCDJLDXQHQ": "2CzR6Vfru6wZYaeF9MuHNrHuOh5iZ/jaw0dgRmyuMOsJwmuWZEeyit/csjg53oY10H3xfC4tOTKXc5SU5NIdBQ", - }, - }, - "user_id": "@ping:localhost", - "unsigned": { "device_display_name": "localhost:8080 (Edge, Windows)" }, - }, -}; - -describe('DeviceTracker', () => { - describe('updateUsersDeviceLists', () => { - it('should perform updates', async () => { - const userId = "@user:example.org"; - const { client } = createTestClient(null, userId, true); - client.getWhoAmI = () => Promise.resolve({ user_id: userId, device_id: TEST_DEVICE_ID }); - client.uploadDeviceKeys = () => Promise.resolve({}); - client.uploadDeviceOneTimeKeys = () => Promise.resolve({}); - client.checkOneTimeKeyCounts = () => Promise.resolve({}); - await client.crypto.prepare([]); - - client.getUserDevices = async (userIds) => { - expect(userIds).toMatchObject([STATIC_TEST_USER]); - return { - device_keys: { - [userIds[0]]: STATIC_TEST_DEVICES, - ["@should_be_ignored:example.org"]: STATIC_TEST_DEVICES, - }, - failures: {}, - }; - }; - - client.cryptoStore.getActiveUserDevices = async (uid) => { - expect(uid).toEqual(STATIC_TEST_USER); - return []; - }; - - const storeSpy = simple.stub().callFn(async (uid, validated) => { - expect(uid).toEqual(STATIC_TEST_USER); - expect(validated).toMatchObject([ - STATIC_TEST_DEVICES["NTTFKSVBSI"], - STATIC_TEST_DEVICES["HCDJLDXQHQ"], - ]); - expect(validated.length).toBe(2); - }); - client.cryptoStore.setActiveUserDevices = storeSpy; - - const tracker = new DeviceTracker(client); - await tracker.updateUsersDeviceLists([STATIC_TEST_USER]); - expect(storeSpy.callCount).toBe(1); - }); - - it('should wait for existing requests to complete first', async () => { - const userId = "@user:example.org"; - const { client } = createTestClient(null, userId, true); - client.getWhoAmI = () => Promise.resolve({ user_id: userId, device_id: TEST_DEVICE_ID }); - client.uploadDeviceKeys = () => Promise.resolve({}); - client.uploadDeviceOneTimeKeys = () => Promise.resolve({}); - client.checkOneTimeKeyCounts = () => Promise.resolve({}); - await client.crypto.prepare([]); - - const fetchedOrder: string[] = []; - - client.getUserDevices = async (userIds) => { - expect(userIds).toMatchObject(fetchedOrder.length === 0 ? [STATIC_TEST_USER, "@other:example.org"] : [STATIC_TEST_USER, "@another:example.org"]); - fetchedOrder.push(...userIds); - return { - device_keys: { - [userIds[0]]: STATIC_TEST_DEVICES, - ["@should_be_ignored:example.org"]: STATIC_TEST_DEVICES, - }, - failures: {}, - }; - }; - - client.cryptoStore.getActiveUserDevices = async (uid) => { - expect(uid).toEqual(STATIC_TEST_USER); - return []; - }; - - const storeSpy = simple.stub().callFn(async (uid, validated) => { - expect(uid).toEqual(STATIC_TEST_USER); - expect(validated).toMatchObject([ - STATIC_TEST_DEVICES["NTTFKSVBSI"], - STATIC_TEST_DEVICES["HCDJLDXQHQ"], - ]); - expect(validated.length).toBe(2); - }); - client.cryptoStore.setActiveUserDevices = storeSpy; - - const tracker = new DeviceTracker(client); - tracker.updateUsersDeviceLists([STATIC_TEST_USER, "@other:example.org"]).then(() => fetchedOrder.push("----")); - await tracker.updateUsersDeviceLists([STATIC_TEST_USER, "@another:example.org"]); - expect(storeSpy.callCount).toBe(2); - expect(fetchedOrder).toMatchObject([ - STATIC_TEST_USER, - "@other:example.org", - "----", // inserted by finished call to update device lists - STATIC_TEST_USER, - "@another:example.org", - ]); - }); - - it('should check for servers changing device IDs', async () => { - const userId = "@user:example.org"; - const { client } = createTestClient(null, userId, true); - client.getWhoAmI = () => Promise.resolve({ user_id: userId, device_id: TEST_DEVICE_ID }); - client.uploadDeviceKeys = () => Promise.resolve({}); - client.uploadDeviceOneTimeKeys = () => Promise.resolve({}); - client.checkOneTimeKeyCounts = () => Promise.resolve({}); - await client.crypto.prepare([]); - - client.getUserDevices = async (userIds) => { - expect(userIds).toMatchObject([STATIC_TEST_USER]); - return { - device_keys: { - [userIds[0]]: { - "HCDJLDXQHQ": { - device_id: "WRONG_DEVICE", - ...STATIC_TEST_DEVICES['HCDJLDXQHQ'], - }, - ...STATIC_TEST_DEVICES, - }, - ["@should_be_ignored:example.org"]: STATIC_TEST_DEVICES, - }, - failures: {}, - }; - }; - - client.cryptoStore.getActiveUserDevices = async (uid) => { - expect(uid).toEqual(STATIC_TEST_USER); - return []; - }; - - const storeSpy = simple.stub().callFn(async (uid, validated) => { - expect(uid).toEqual(STATIC_TEST_USER); - expect(validated).toMatchObject([ - STATIC_TEST_DEVICES["NTTFKSVBSI"], - //STATIC_TEST_DEVICES["HCDJLDXQHQ"], // falsified by server - ]); - expect(validated.length).toBe(1); - }); - client.cryptoStore.setActiveUserDevices = storeSpy; - - const tracker = new DeviceTracker(client); - await tracker.updateUsersDeviceLists([STATIC_TEST_USER]); - expect(storeSpy.callCount).toBe(1); - }); - - it('should check for servers changing user IDs', async () => { - const userId = "@user:example.org"; - const { client } = createTestClient(null, userId, true); - client.getWhoAmI = () => Promise.resolve({ user_id: userId, device_id: TEST_DEVICE_ID }); - client.uploadDeviceKeys = () => Promise.resolve({}); - client.uploadDeviceOneTimeKeys = () => Promise.resolve({}); - client.checkOneTimeKeyCounts = () => Promise.resolve({}); - await client.crypto.prepare([]); - - client.getUserDevices = async (userIds) => { - expect(userIds).toMatchObject([STATIC_TEST_USER]); - return { - device_keys: { - [userIds[0]]: { - "HCDJLDXQHQ": { - user_id: "@wrong:example.org", - ...STATIC_TEST_DEVICES['HCDJLDXQHQ'], - }, - ...STATIC_TEST_DEVICES, - }, - ["@should_be_ignored:example.org"]: STATIC_TEST_DEVICES, - }, - failures: {}, - }; - }; - - client.cryptoStore.getActiveUserDevices = async (uid) => { - expect(uid).toEqual(STATIC_TEST_USER); - return []; - }; - - const storeSpy = simple.stub().callFn(async (uid, validated) => { - expect(uid).toEqual(STATIC_TEST_USER); - expect(validated).toMatchObject([ - STATIC_TEST_DEVICES["NTTFKSVBSI"], - //STATIC_TEST_DEVICES["HCDJLDXQHQ"], // falsified by server - ]); - expect(validated.length).toBe(1); - }); - client.cryptoStore.setActiveUserDevices = storeSpy; - - const tracker = new DeviceTracker(client); - await tracker.updateUsersDeviceLists([STATIC_TEST_USER]); - expect(storeSpy.callCount).toBe(1); - }); - - it('should ensure all devices have Curve25519 keys', async () => { - const userId = "@user:example.org"; - const { client } = createTestClient(null, userId, true); - client.getWhoAmI = () => Promise.resolve({ user_id: userId, device_id: TEST_DEVICE_ID }); - client.uploadDeviceKeys = () => Promise.resolve({}); - client.uploadDeviceOneTimeKeys = () => Promise.resolve({}); - client.checkOneTimeKeyCounts = () => Promise.resolve({}); - await client.crypto.prepare([]); - - client.getUserDevices = async (userIds) => { - expect(userIds).toMatchObject([STATIC_TEST_USER]); - return { - device_keys: { - [userIds[0]]: { - "HCDJLDXQHQ": { - keys: { - "ed25519:HCDJLDXQHQ": "hTxK3DSJit7N7eqGuOnuDIeAdj4P7S57DOMKj6ruQok", - // no curve25519 key for test - }, - ...STATIC_TEST_DEVICES['HCDJLDXQHQ'], - }, - ...STATIC_TEST_DEVICES, - }, - ["@should_be_ignored:example.org"]: STATIC_TEST_DEVICES, - }, - failures: {}, - }; - }; - - client.cryptoStore.getActiveUserDevices = async (uid) => { - expect(uid).toEqual(STATIC_TEST_USER); - return []; - }; - - const storeSpy = simple.stub().callFn(async (uid, validated) => { - expect(uid).toEqual(STATIC_TEST_USER); - expect(validated).toMatchObject([ - STATIC_TEST_DEVICES["NTTFKSVBSI"], - //STATIC_TEST_DEVICES["HCDJLDXQHQ"], // falsified by server - ]); - expect(validated.length).toBe(1); - }); - client.cryptoStore.setActiveUserDevices = storeSpy; - - const tracker = new DeviceTracker(client); - await tracker.updateUsersDeviceLists([STATIC_TEST_USER]); - expect(storeSpy.callCount).toBe(1); - }); - - it('should ensure all devices have Ed25519 keys', async () => { - const userId = "@user:example.org"; - const { client } = createTestClient(null, userId, true); - client.getWhoAmI = () => Promise.resolve({ user_id: userId, device_id: TEST_DEVICE_ID }); - client.uploadDeviceKeys = () => Promise.resolve({}); - client.uploadDeviceOneTimeKeys = () => Promise.resolve({}); - client.checkOneTimeKeyCounts = () => Promise.resolve({}); - await client.crypto.prepare([]); - - client.getUserDevices = async (userIds) => { - expect(userIds).toMatchObject([STATIC_TEST_USER]); - return { - device_keys: { - [userIds[0]]: { - "HCDJLDXQHQ": { - keys: { - "curve25519:HCDJLDXQHQ": "c20OI51bT8iiX9t40g5g7FcBCHORIbep+6SbkrD3FRU", - // no ed25519 key for test - }, - ...STATIC_TEST_DEVICES['HCDJLDXQHQ'], - }, - ...STATIC_TEST_DEVICES, - }, - ["@should_be_ignored:example.org"]: STATIC_TEST_DEVICES, - }, - failures: {}, - }; - }; - - client.cryptoStore.getActiveUserDevices = async (uid) => { - expect(uid).toEqual(STATIC_TEST_USER); - return []; - }; - - const storeSpy = simple.stub().callFn(async (uid, validated) => { - expect(uid).toEqual(STATIC_TEST_USER); - expect(validated).toMatchObject([ - STATIC_TEST_DEVICES["NTTFKSVBSI"], - //STATIC_TEST_DEVICES["HCDJLDXQHQ"], // falsified by server - ]); - expect(validated.length).toBe(1); - }); - client.cryptoStore.setActiveUserDevices = storeSpy; - - const tracker = new DeviceTracker(client); - await tracker.updateUsersDeviceLists([STATIC_TEST_USER]); - expect(storeSpy.callCount).toBe(1); - }); - - it('should ensure all devices have signatures', async () => { - const userId = "@user:example.org"; - const { client } = createTestClient(null, userId, true); - client.getWhoAmI = () => Promise.resolve({ user_id: userId, device_id: TEST_DEVICE_ID }); - client.uploadDeviceKeys = () => Promise.resolve({}); - client.uploadDeviceOneTimeKeys = () => Promise.resolve({}); - client.checkOneTimeKeyCounts = () => Promise.resolve({}); - await client.crypto.prepare([]); - - client.getUserDevices = async (userIds) => { - expect(userIds).toMatchObject([STATIC_TEST_USER]); - return { - device_keys: { - [userIds[0]]: { - "HCDJLDXQHQ": { - signatures: {}, - ...STATIC_TEST_DEVICES['HCDJLDXQHQ'], - }, - ...STATIC_TEST_DEVICES, - }, - ["@should_be_ignored:example.org"]: STATIC_TEST_DEVICES, - }, - failures: {}, - }; - }; - - client.cryptoStore.getActiveUserDevices = async (uid) => { - expect(uid).toEqual(STATIC_TEST_USER); - return []; - }; - - const storeSpy = simple.stub().callFn(async (uid, validated) => { - expect(uid).toEqual(STATIC_TEST_USER); - expect(validated).toMatchObject([ - STATIC_TEST_DEVICES["NTTFKSVBSI"], - //STATIC_TEST_DEVICES["HCDJLDXQHQ"], // falsified by server - ]); - expect(validated.length).toBe(1); - }); - client.cryptoStore.setActiveUserDevices = storeSpy; - - const tracker = new DeviceTracker(client); - await tracker.updateUsersDeviceLists([STATIC_TEST_USER]); - expect(storeSpy.callCount).toBe(1); - }); - - it('should ensure all devices have device signatures', async () => { - const userId = "@user:example.org"; - const { client } = createTestClient(null, userId, true); - client.getWhoAmI = () => Promise.resolve({ user_id: userId, device_id: TEST_DEVICE_ID }); - client.uploadDeviceKeys = () => Promise.resolve({}); - client.uploadDeviceOneTimeKeys = () => Promise.resolve({}); - client.checkOneTimeKeyCounts = () => Promise.resolve({}); - await client.crypto.prepare([]); - - client.getUserDevices = async (userIds) => { - expect(userIds).toMatchObject([STATIC_TEST_USER]); - return { - device_keys: { - [userIds[0]]: { - "HCDJLDXQHQ": { - signatures: { - "@ping:localhost": { - "ed25519:NOT_THIS_DEVICE": "2CzR6Vfru6wZYaeF9MuHNrHuOh5iZ/jaw0dgRmyuMOsJwmuWZEeyit/csjg53oY10H3xfC4tOTKXc5SU5NIdBQ", - }, - }, - ...STATIC_TEST_DEVICES['HCDJLDXQHQ'], - }, - ...STATIC_TEST_DEVICES, - }, - ["@should_be_ignored:example.org"]: STATIC_TEST_DEVICES, - }, - failures: {}, - }; - }; - - client.cryptoStore.getActiveUserDevices = async (uid) => { - expect(uid).toEqual(STATIC_TEST_USER); - return []; - }; - - const storeSpy = simple.stub().callFn(async (uid, validated) => { - expect(uid).toEqual(STATIC_TEST_USER); - expect(validated).toMatchObject([ - STATIC_TEST_DEVICES["NTTFKSVBSI"], - //STATIC_TEST_DEVICES["HCDJLDXQHQ"], // falsified by server - ]); - expect(validated.length).toBe(1); - }); - client.cryptoStore.setActiveUserDevices = storeSpy; - - const tracker = new DeviceTracker(client); - await tracker.updateUsersDeviceLists([STATIC_TEST_USER]); - expect(storeSpy.callCount).toBe(1); - }); - - it('should validate the signature of a device', async () => { - const userId = "@user:example.org"; - const { client } = createTestClient(null, userId, true); - client.getWhoAmI = () => Promise.resolve({ user_id: userId, device_id: TEST_DEVICE_ID }); - client.uploadDeviceKeys = () => Promise.resolve({}); - client.uploadDeviceOneTimeKeys = () => Promise.resolve({}); - client.checkOneTimeKeyCounts = () => Promise.resolve({}); - await client.crypto.prepare([]); - - client.getUserDevices = async (userIds) => { - expect(userIds).toMatchObject([STATIC_TEST_USER]); - return { - device_keys: { - [userIds[0]]: { - "HCDJLDXQHQ": { - signatures: { - "@ping:localhost": { - "ed25519:HCDJLDXQHQ": "WRONG", - }, - }, - ...STATIC_TEST_DEVICES['HCDJLDXQHQ'], - }, - ...STATIC_TEST_DEVICES, - }, - ["@should_be_ignored:example.org"]: STATIC_TEST_DEVICES, - }, - failures: {}, - }; - }; - - client.cryptoStore.getActiveUserDevices = async (uid) => { - expect(uid).toEqual(STATIC_TEST_USER); - return []; - }; - - const storeSpy = simple.stub().callFn(async (uid, validated) => { - expect(uid).toEqual(STATIC_TEST_USER); - expect(validated).toMatchObject([ - STATIC_TEST_DEVICES["NTTFKSVBSI"], - //STATIC_TEST_DEVICES["HCDJLDXQHQ"], // falsified by server - ]); - expect(validated.length).toBe(1); - }); - client.cryptoStore.setActiveUserDevices = storeSpy; - - const tracker = new DeviceTracker(client); - await tracker.updateUsersDeviceLists([STATIC_TEST_USER]); - expect(storeSpy.callCount).toBe(1); - }); - - it('should protect against device reuse', async () => { - const userId = "@user:example.org"; - const { client } = createTestClient(null, userId, true); - client.getWhoAmI = () => Promise.resolve({ user_id: userId, device_id: TEST_DEVICE_ID }); - client.uploadDeviceKeys = () => Promise.resolve({}); - client.uploadDeviceOneTimeKeys = () => Promise.resolve({}); - client.checkOneTimeKeyCounts = () => Promise.resolve({}); - await client.crypto.prepare([]); - - client.getUserDevices = async (userIds) => { - expect(userIds).toMatchObject([STATIC_TEST_USER]); - return { - device_keys: { - [userIds[0]]: STATIC_TEST_DEVICES, - ["@should_be_ignored:example.org"]: STATIC_TEST_DEVICES, - }, - failures: {}, - }; - }; - - client.cryptoStore.getAllUserDevices = async (uid) => { - expect(uid).toEqual(STATIC_TEST_USER); - return [{ - device_id: "HCDJLDXQHQ", - user_id: STATIC_TEST_USER, - algorithms: [EncryptionAlgorithm.OlmV1Curve25519AesSha2, EncryptionAlgorithm.MegolmV1AesSha2], - keys: { - "curve25519:HCDJLDXQHQ": "LEGACY_KEY", - "ed25519:HCDJLDXQHQ": "LEGACY_KEY", - }, - signatures: { - "@ping:localhost": { - "ed25519:HCDJLDXQHQ": "FAKE_SIGNED", - }, - }, - unsigned: { - device_display_name: "Injected Device", - bsdkIsActive: false, // specifically inactive to test that the code doesn't care - }, - }]; - }; - - const storeSpy = simple.stub().callFn(async (uid, validated) => { - expect(uid).toEqual(STATIC_TEST_USER); - expect(validated).toMatchObject([ - STATIC_TEST_DEVICES["NTTFKSVBSI"], - //STATIC_TEST_DEVICES["HCDJLDXQHQ"], // falsified by server - ]); - expect(validated.length).toBe(1); - }); - client.cryptoStore.setActiveUserDevices = storeSpy; - - const tracker = new DeviceTracker(client); - await tracker.updateUsersDeviceLists([STATIC_TEST_USER]); - expect(storeSpy.callCount).toBe(1); - }); - }); - - describe('flagUsersOutdated', () => { - it('should flag devices as outdated appropriately', async () => { - const userId = "@user:example.org"; - const { client } = createTestClient(null, userId, true); - const targetUserIds = ["@one:example.org", "@two:example.org"]; - - const flagSpy = simple.stub().callFn(async (uids) => { - expect(uids).toMatchObject(targetUserIds); - expect(uids.length).toBe(targetUserIds.length); - }); - client.cryptoStore.flagUsersOutdated = flagSpy; - - const deviceTracker = new DeviceTracker(client); - - const updateSpy = simple.stub().callFn(async (uids) => { - expect(uids).toMatchObject(targetUserIds); - expect(uids.length).toBe(targetUserIds.length); - }); - deviceTracker.updateUsersDeviceLists = updateSpy; - - await deviceTracker.flagUsersOutdated(targetUserIds, false); - expect(updateSpy.callCount).toBe(0); - expect(flagSpy.callCount).toBe(1); - }); - - it('should resync the devices if requested', async () => { - const userId = "@user:example.org"; - const { client } = createTestClient(null, userId, true); - const targetUserIds = ["@one:example.org", "@two:example.org"]; - - const flagSpy = simple.stub().callFn(async (uids) => { - expect(uids).toMatchObject(targetUserIds); - expect(uids.length).toBe(targetUserIds.length); - }); - client.cryptoStore.flagUsersOutdated = flagSpy; - - const deviceTracker = new DeviceTracker(client); - - const updateSpy = simple.stub().callFn(async (uids) => { - expect(uids).toMatchObject(targetUserIds); - expect(uids.length).toBe(targetUserIds.length); - }); - deviceTracker.updateUsersDeviceLists = updateSpy; - - await deviceTracker.flagUsersOutdated(targetUserIds, true); - expect(updateSpy.callCount).toBe(1); - expect(flagSpy.callCount).toBe(1); - }); - }); - - describe('getDevicesFor', () => { - it('should update devices if needed', async () => { - const userId = "@user:example.org"; - const { client } = createTestClient(null, userId, true); - const targetUserIds = ["@one:example.org", "@two:example.org", "@three:example.org", "@four:example.org"]; - const fakeOutdatedUsers = ["@two:example.org", "@three:example.org"]; - const deviceMaps = { - [targetUserIds[0]]: [{device: 1}, {device: 2}] as any as UserDevice[], - [targetUserIds[1]]: [{device: 33}, {device: 44}] as any as UserDevice[], - [targetUserIds[2]]: [{device: "A"}, {device: "B"}] as any as UserDevice[], - [targetUserIds[3]]: [{device: "B1"}, {device: "C1"}] as any as UserDevice[], - }; - - const checkSpy = simple.stub().callFn(async (uid) => { - expect(uid).toEqual(targetUserIds[checkSpy.callCount - 1]); - return fakeOutdatedUsers.includes(uid); - }); - client.cryptoStore.isUserOutdated = checkSpy; - - const getSpy = simple.stub().callFn(async (uid) => { - expect(updateSpy.callCount).toBe(1); - expect(uid).toEqual(targetUserIds[getSpy.callCount - 1]); - return deviceMaps[uid]; - }); - client.cryptoStore.getActiveUserDevices = getSpy; - - const deviceTracker = new DeviceTracker(client); - - const updateSpy = simple.stub().callFn(async (uids) => { - expect(checkSpy.callCount).toBe(targetUserIds.length); - expect(uids).toMatchObject(fakeOutdatedUsers); - expect(uids.length).toBe(fakeOutdatedUsers.length); - }); - deviceTracker.updateUsersDeviceLists = updateSpy; - - const results = await deviceTracker.getDevicesFor(targetUserIds); - expect(checkSpy.callCount).toBe(targetUserIds.length); - expect(updateSpy.callCount).toBe(1); - expect(getSpy.callCount).toBe(targetUserIds.length); - expect(results).toMatchObject(deviceMaps); - }); - }); -}); diff --git a/test/storage/MemoryStorageProviderTest.ts b/test/storage/MemoryStorageProviderTest.ts index 3c568f4b..37c08330 100644 --- a/test/storage/MemoryStorageProviderTest.ts +++ b/test/storage/MemoryStorageProviderTest.ts @@ -6,18 +6,18 @@ describe('MemoryStorageProvider', () => { const provider = new MemoryStorageProvider(); const value = "testing"; - expect(provider.getSyncToken()).toBeFalsy(); - provider.setSyncToken(value); - expect(provider.getSyncToken()).toEqual(value); + expect(await provider.getSyncToken()).toBeFalsy(); + await provider.setSyncToken(value); + expect(await provider.getSyncToken()).toEqual(value); }); it('should return the right filter object', async () => { const provider = new MemoryStorageProvider(); const value: IFilterInfo = {id: 12, filter: {hello: "world"}}; - expect(provider.getFilter()).toBeFalsy(); - provider.setFilter(value); - expect(provider.getFilter()).toMatchObject(value); + expect(await provider.getFilter()).toBeFalsy(); + await provider.setFilter(value); + expect(await provider.getFilter()).toMatchObject(value); }); it('should track registered users', async () => { @@ -26,17 +26,17 @@ describe('MemoryStorageProvider', () => { const userIdA = "@first:example.org"; const userIdB = "@second:example.org"; - expect(provider.isUserRegistered(userIdA)).toBeFalsy(); - expect(provider.isUserRegistered(userIdB)).toBeFalsy(); - provider.addRegisteredUser(userIdA); - expect(provider.isUserRegistered(userIdA)).toBeTruthy(); - expect(provider.isUserRegistered(userIdB)).toBeFalsy(); - provider.addRegisteredUser(userIdA); // duplicated to make sure it is safe to do so - expect(provider.isUserRegistered(userIdA)).toBeTruthy(); - expect(provider.isUserRegistered(userIdB)).toBeFalsy(); - provider.addRegisteredUser(userIdB); - expect(provider.isUserRegistered(userIdA)).toBeTruthy(); - expect(provider.isUserRegistered(userIdB)).toBeTruthy(); + expect(await provider.isUserRegistered(userIdA)).toBeFalsy(); + expect(await provider.isUserRegistered(userIdB)).toBeFalsy(); + await provider.addRegisteredUser(userIdA); + expect(await provider.isUserRegistered(userIdA)).toBeTruthy(); + expect(await provider.isUserRegistered(userIdB)).toBeFalsy(); + await provider.addRegisteredUser(userIdA); // duplicated to make sure it is safe to do so + expect(await provider.isUserRegistered(userIdA)).toBeTruthy(); + expect(await provider.isUserRegistered(userIdB)).toBeFalsy(); + await provider.addRegisteredUser(userIdB); + expect(await provider.isUserRegistered(userIdA)).toBeTruthy(); + expect(await provider.isUserRegistered(userIdB)).toBeTruthy(); }); it('should track completed transactions', async () => { @@ -45,17 +45,17 @@ describe('MemoryStorageProvider', () => { const txnA = "@first:example.org"; const txnB = "@second:example.org"; - expect(provider.isTransactionCompleted(txnA)).toBeFalsy(); - expect(provider.isTransactionCompleted(txnB)).toBeFalsy(); - provider.setTransactionCompleted(txnA); - expect(provider.isTransactionCompleted(txnA)).toBeTruthy(); - expect(provider.isTransactionCompleted(txnB)).toBeFalsy(); - provider.setTransactionCompleted(txnA); // duplicated to make sure it is safe to do so - expect(provider.isTransactionCompleted(txnA)).toBeTruthy(); - expect(provider.isTransactionCompleted(txnB)).toBeFalsy(); - provider.setTransactionCompleted(txnB); - expect(provider.isTransactionCompleted(txnA)).toBeTruthy(); - expect(provider.isTransactionCompleted(txnB)).toBeTruthy(); + expect(await provider.isTransactionCompleted(txnA)).toBeFalsy(); + expect(await provider.isTransactionCompleted(txnB)).toBeFalsy(); + await provider.setTransactionCompleted(txnA); + expect(await provider.isTransactionCompleted(txnA)).toBeTruthy(); + expect(await provider.isTransactionCompleted(txnB)).toBeFalsy(); + await provider.setTransactionCompleted(txnA); // duplicated to make sure it is safe to do so + expect(await provider.isTransactionCompleted(txnA)).toBeTruthy(); + expect(await provider.isTransactionCompleted(txnB)).toBeFalsy(); + await provider.setTransactionCompleted(txnB); + expect(await provider.isTransactionCompleted(txnA)).toBeTruthy(); + expect(await provider.isTransactionCompleted(txnB)).toBeTruthy(); }); it('should track arbitrary key value pairs', async () => { @@ -64,8 +64,59 @@ describe('MemoryStorageProvider', () => { const key = "test"; const value = "example"; - expect(provider.readValue(key)).toBeFalsy(); - provider.storeValue(key, value); - expect(provider.readValue(key)).toEqual(value); + expect(await provider.readValue(key)).toBeFalsy(); + await provider.storeValue(key, value); + expect(await provider.readValue(key)).toEqual(value); + }); + + describe('namespacing', () => { + it('should return the right sync token', async () => { + const provider = new MemoryStorageProvider(); + + const value = "testing"; + const namespace = "@user:example.org"; + + const nsProvider = provider.storageForUser(namespace); + expect(nsProvider).toBeDefined(); + + expect(await provider.getSyncToken()).toBeFalsy(); + expect(await nsProvider.getSyncToken()).toBeFalsy(); + await nsProvider.setSyncToken(value); + expect(await provider.getSyncToken()).toBeFalsy(); + expect(await nsProvider.getSyncToken()).toEqual(value); + }); + + it('should return the right filter object', async () => { + const provider = new MemoryStorageProvider(); + + const value: IFilterInfo = {id: 12, filter: {hello: "world"}}; + const namespace = "@user:example.org"; + + const nsProvider = provider.storageForUser(namespace); + expect(nsProvider).toBeDefined(); + + expect(await provider.getFilter()).toBeFalsy(); + expect(await nsProvider.getFilter()).toBeFalsy(); + await nsProvider.setFilter(value); + expect(await provider.getFilter()).toBeFalsy(); + expect(await nsProvider.getFilter()).toMatchObject(value); + }); + + it('should track arbitrary key value pairs', async () => { + const provider = new MemoryStorageProvider(); + + const key = "test"; + const value = "example"; + const namespace = "@user:example.org"; + + const nsProvider = provider.storageForUser(namespace); + expect(nsProvider).toBeDefined(); + + expect(await provider.readValue(key)).toBeFalsy(); + expect(await nsProvider.readValue(key)).toBeFalsy(); + await nsProvider.storeValue(key, value); + expect(await provider.readValue(key)).toBeFalsy(); + expect(await nsProvider.readValue(key)).toEqual(value); + }); }); }); diff --git a/test/storage/SimpleFsStorageProviderTest.ts b/test/storage/SimpleFsStorageProviderTest.ts index 3fba9908..270421e9 100644 --- a/test/storage/SimpleFsStorageProviderTest.ts +++ b/test/storage/SimpleFsStorageProviderTest.ts @@ -17,20 +17,20 @@ describe('SimpleFsStorageProvider', () => { const {writeProvider, readProviderFn} = createSimpleFsStorageProvider(); const value = "testing"; - expect(writeProvider.getSyncToken()).toBeFalsy(); - writeProvider.setSyncToken(value); - expect(writeProvider.getSyncToken()).toEqual(value); - expect(readProviderFn().getSyncToken()).toEqual(value); + expect(await writeProvider.getSyncToken()).toBeFalsy(); + await writeProvider.setSyncToken(value); + expect(await writeProvider.getSyncToken()).toEqual(value); + expect(await readProviderFn().getSyncToken()).toEqual(value); }); it('should return the right filter object', async () => { const {writeProvider, readProviderFn} = createSimpleFsStorageProvider(); const value: IFilterInfo = {id: 12, filter: {hello: "world"}}; - expect(writeProvider.getFilter()).toBeFalsy(); - writeProvider.setFilter(value); - expect(writeProvider.getFilter()).toMatchObject(value); - expect(readProviderFn().getFilter()).toMatchObject(value); + expect(await writeProvider.getFilter()).toBeFalsy(); + await writeProvider.setFilter(value); + expect(await writeProvider.getFilter()).toMatchObject(value); + expect(await readProviderFn().getFilter()).toMatchObject(value); }); it('should track registered users', async () => { @@ -39,23 +39,23 @@ describe('SimpleFsStorageProvider', () => { const userIdA = "@first:example.org"; const userIdB = "@second:example.org"; - expect(writeProvider.isUserRegistered(userIdA)).toBeFalsy(); - expect(writeProvider.isUserRegistered(userIdB)).toBeFalsy(); - writeProvider.addRegisteredUser(userIdA); - expect(writeProvider.isUserRegistered(userIdA)).toBeTruthy(); - expect(writeProvider.isUserRegistered(userIdB)).toBeFalsy(); - expect(readProviderFn().isUserRegistered(userIdA)).toBeTruthy(); - expect(readProviderFn().isUserRegistered(userIdB)).toBeFalsy(); - writeProvider.addRegisteredUser(userIdA); // duplicated to make sure it is safe to do so - expect(writeProvider.isUserRegistered(userIdA)).toBeTruthy(); - expect(writeProvider.isUserRegistered(userIdB)).toBeFalsy(); - expect(readProviderFn().isUserRegistered(userIdA)).toBeTruthy(); - expect(readProviderFn().isUserRegistered(userIdB)).toBeFalsy(); - writeProvider.addRegisteredUser(userIdB); - expect(writeProvider.isUserRegistered(userIdA)).toBeTruthy(); - expect(writeProvider.isUserRegistered(userIdB)).toBeTruthy(); - expect(readProviderFn().isUserRegistered(userIdA)).toBeTruthy(); - expect(readProviderFn().isUserRegistered(userIdB)).toBeTruthy(); + expect(await writeProvider.isUserRegistered(userIdA)).toBeFalsy(); + expect(await writeProvider.isUserRegistered(userIdB)).toBeFalsy(); + await writeProvider.addRegisteredUser(userIdA); + expect(await writeProvider.isUserRegistered(userIdA)).toBeTruthy(); + expect(await writeProvider.isUserRegistered(userIdB)).toBeFalsy(); + expect(await readProviderFn().isUserRegistered(userIdA)).toBeTruthy(); + expect(await readProviderFn().isUserRegistered(userIdB)).toBeFalsy(); + await writeProvider.addRegisteredUser(userIdA); // duplicated to make sure it is safe to do so + expect(await writeProvider.isUserRegistered(userIdA)).toBeTruthy(); + expect(await writeProvider.isUserRegistered(userIdB)).toBeFalsy(); + expect(await readProviderFn().isUserRegistered(userIdA)).toBeTruthy(); + expect(await readProviderFn().isUserRegistered(userIdB)).toBeFalsy(); + await writeProvider.addRegisteredUser(userIdB); + expect(await writeProvider.isUserRegistered(userIdA)).toBeTruthy(); + expect(await writeProvider.isUserRegistered(userIdB)).toBeTruthy(); + expect(await readProviderFn().isUserRegistered(userIdA)).toBeTruthy(); + expect(await readProviderFn().isUserRegistered(userIdB)).toBeTruthy(); }); it('should track completed transactions', async () => { @@ -64,23 +64,23 @@ describe('SimpleFsStorageProvider', () => { const txnA = "@first:example.org"; const txnB = "@second:example.org"; - expect(writeProvider.isTransactionCompleted(txnA)).toBeFalsy(); - expect(writeProvider.isTransactionCompleted(txnB)).toBeFalsy(); - writeProvider.setTransactionCompleted(txnA); - expect(writeProvider.isTransactionCompleted(txnA)).toBeTruthy(); - expect(writeProvider.isTransactionCompleted(txnB)).toBeFalsy(); - expect(readProviderFn().isTransactionCompleted(txnA)).toBeTruthy(); - expect(readProviderFn().isTransactionCompleted(txnB)).toBeFalsy(); - writeProvider.setTransactionCompleted(txnA); // duplicated to make sure it is safe to do so - expect(writeProvider.isTransactionCompleted(txnA)).toBeTruthy(); - expect(writeProvider.isTransactionCompleted(txnB)).toBeFalsy(); - expect(readProviderFn().isTransactionCompleted(txnA)).toBeTruthy(); - expect(readProviderFn().isTransactionCompleted(txnB)).toBeFalsy(); - writeProvider.setTransactionCompleted(txnB); - expect(writeProvider.isTransactionCompleted(txnA)).toBeTruthy(); - expect(writeProvider.isTransactionCompleted(txnB)).toBeTruthy(); - expect(readProviderFn().isTransactionCompleted(txnA)).toBeTruthy(); - expect(readProviderFn().isTransactionCompleted(txnB)).toBeTruthy(); + expect(await writeProvider.isTransactionCompleted(txnA)).toBeFalsy(); + expect(await writeProvider.isTransactionCompleted(txnB)).toBeFalsy(); + await writeProvider.setTransactionCompleted(txnA); + expect(await writeProvider.isTransactionCompleted(txnA)).toBeTruthy(); + expect(await writeProvider.isTransactionCompleted(txnB)).toBeFalsy(); + expect(await readProviderFn().isTransactionCompleted(txnA)).toBeTruthy(); + expect(await readProviderFn().isTransactionCompleted(txnB)).toBeFalsy(); + await writeProvider.setTransactionCompleted(txnA); // duplicated to make sure it is safe to do so + expect(await writeProvider.isTransactionCompleted(txnA)).toBeTruthy(); + expect(await writeProvider.isTransactionCompleted(txnB)).toBeFalsy(); + expect(await readProviderFn().isTransactionCompleted(txnA)).toBeTruthy(); + expect(await readProviderFn().isTransactionCompleted(txnB)).toBeFalsy(); + await writeProvider.setTransactionCompleted(txnB); + expect(await writeProvider.isTransactionCompleted(txnA)).toBeTruthy(); + expect(await writeProvider.isTransactionCompleted(txnB)).toBeTruthy(); + expect(await readProviderFn().isTransactionCompleted(txnA)).toBeTruthy(); + expect(await readProviderFn().isTransactionCompleted(txnB)).toBeTruthy(); }); it('should track a limited number of completed transactions in memory', async () => { @@ -94,37 +94,37 @@ describe('SimpleFsStorageProvider', () => { // The read provider results should always be falsey because the write provider // should not be writing to disk. - expect(writeProvider.isTransactionCompleted(txnA)).toBeFalsy(); - expect(writeProvider.isTransactionCompleted(txnB)).toBeFalsy(); - expect(writeProvider.isTransactionCompleted(txnC)).toBeFalsy(); - writeProvider.setTransactionCompleted(txnA); - expect(writeProvider.isTransactionCompleted(txnA)).toBeTruthy(); - expect(writeProvider.isTransactionCompleted(txnB)).toBeFalsy(); - expect(writeProvider.isTransactionCompleted(txnC)).toBeFalsy(); - expect(readProviderFn().isTransactionCompleted(txnA)).toBeFalsy(); - expect(readProviderFn().isTransactionCompleted(txnB)).toBeFalsy(); - expect(readProviderFn().isTransactionCompleted(txnC)).toBeFalsy(); - writeProvider.setTransactionCompleted(txnA); // duplicated to make sure it is safe to do so - expect(writeProvider.isTransactionCompleted(txnA)).toBeTruthy(); - expect(writeProvider.isTransactionCompleted(txnB)).toBeFalsy(); - expect(writeProvider.isTransactionCompleted(txnC)).toBeFalsy(); - expect(readProviderFn().isTransactionCompleted(txnA)).toBeFalsy(); - expect(readProviderFn().isTransactionCompleted(txnB)).toBeFalsy(); - expect(readProviderFn().isTransactionCompleted(txnC)).toBeFalsy(); - writeProvider.setTransactionCompleted(txnB); - expect(writeProvider.isTransactionCompleted(txnA)).toBeTruthy(); - expect(writeProvider.isTransactionCompleted(txnB)).toBeTruthy(); - expect(writeProvider.isTransactionCompleted(txnC)).toBeFalsy(); - expect(readProviderFn().isTransactionCompleted(txnA)).toBeFalsy(); - expect(readProviderFn().isTransactionCompleted(txnB)).toBeFalsy(); - expect(readProviderFn().isTransactionCompleted(txnC)).toBeFalsy(); - writeProvider.setTransactionCompleted(txnC); - expect(writeProvider.isTransactionCompleted(txnA)).toBeFalsy(); // No longer in memory - expect(writeProvider.isTransactionCompleted(txnB)).toBeTruthy(); - expect(writeProvider.isTransactionCompleted(txnC)).toBeTruthy(); - expect(readProviderFn().isTransactionCompleted(txnA)).toBeFalsy(); - expect(readProviderFn().isTransactionCompleted(txnB)).toBeFalsy(); - expect(readProviderFn().isTransactionCompleted(txnC)).toBeFalsy(); + expect(await writeProvider.isTransactionCompleted(txnA)).toBeFalsy(); + expect(await writeProvider.isTransactionCompleted(txnB)).toBeFalsy(); + expect(await writeProvider.isTransactionCompleted(txnC)).toBeFalsy(); + await writeProvider.setTransactionCompleted(txnA); + expect(await writeProvider.isTransactionCompleted(txnA)).toBeTruthy(); + expect(await writeProvider.isTransactionCompleted(txnB)).toBeFalsy(); + expect(await writeProvider.isTransactionCompleted(txnC)).toBeFalsy(); + expect(await readProviderFn().isTransactionCompleted(txnA)).toBeFalsy(); + expect(await readProviderFn().isTransactionCompleted(txnB)).toBeFalsy(); + expect(await readProviderFn().isTransactionCompleted(txnC)).toBeFalsy(); + await writeProvider.setTransactionCompleted(txnA); // duplicated to make sure it is safe to do so + expect(await writeProvider.isTransactionCompleted(txnA)).toBeTruthy(); + expect(await writeProvider.isTransactionCompleted(txnB)).toBeFalsy(); + expect(await writeProvider.isTransactionCompleted(txnC)).toBeFalsy(); + expect(await readProviderFn().isTransactionCompleted(txnA)).toBeFalsy(); + expect(await readProviderFn().isTransactionCompleted(txnB)).toBeFalsy(); + expect(await readProviderFn().isTransactionCompleted(txnC)).toBeFalsy(); + await writeProvider.setTransactionCompleted(txnB); + expect(await writeProvider.isTransactionCompleted(txnA)).toBeTruthy(); + expect(await writeProvider.isTransactionCompleted(txnB)).toBeTruthy(); + expect(await writeProvider.isTransactionCompleted(txnC)).toBeFalsy(); + expect(await readProviderFn().isTransactionCompleted(txnA)).toBeFalsy(); + expect(await readProviderFn().isTransactionCompleted(txnB)).toBeFalsy(); + expect(await readProviderFn().isTransactionCompleted(txnC)).toBeFalsy(); + await writeProvider.setTransactionCompleted(txnC); + expect(await writeProvider.isTransactionCompleted(txnA)).toBeFalsy(); // No longer in memory + expect(await writeProvider.isTransactionCompleted(txnB)).toBeTruthy(); + expect(await writeProvider.isTransactionCompleted(txnC)).toBeTruthy(); + expect(await readProviderFn().isTransactionCompleted(txnA)).toBeFalsy(); + expect(await readProviderFn().isTransactionCompleted(txnB)).toBeFalsy(); + expect(await readProviderFn().isTransactionCompleted(txnC)).toBeFalsy(); }); it('should track arbitrary key value pairs', async () => { @@ -138,4 +138,62 @@ describe('SimpleFsStorageProvider', () => { expect(writeProvider.readValue(key)).toEqual(value); expect(readProviderFn().readValue(key)).toEqual(value); }); + + describe('namespacing', () => { + it('should return the right sync token', async () => { + const {writeProvider, readProviderFn} = createSimpleFsStorageProvider(); + + const value = "testing"; + const namespace = "@user:example.org"; + + const nsWriter = writeProvider.storageForUser(namespace); + expect(nsWriter).toBeDefined(); + + expect(await writeProvider.getSyncToken()).toBeFalsy(); + expect(await nsWriter.getSyncToken()).toBeFalsy(); + await nsWriter.setSyncToken(value); + expect(await nsWriter.getSyncToken()).toEqual(value); + expect(await writeProvider.getSyncToken()).toBeFalsy(); + expect(await readProviderFn().storageForUser(namespace).getSyncToken()).toEqual(value); + expect(await readProviderFn().getSyncToken()).toBeFalsy(); + }); + + it('should return the right filter object', async () => { + const {writeProvider, readProviderFn} = createSimpleFsStorageProvider(); + + const value: IFilterInfo = {id: 12, filter: {hello: "world"}}; + const namespace = "@user:example.org"; + + const nsWriter = writeProvider.storageForUser(namespace); + expect(nsWriter).toBeDefined(); + + expect(await writeProvider.getFilter()).toBeFalsy(); + expect(await nsWriter.getFilter()).toBeFalsy(); + await nsWriter.setFilter(value); + expect(await nsWriter.getFilter()).toMatchObject(value); + expect(await writeProvider.getFilter()).toBeFalsy(); + expect(await readProviderFn().storageForUser(namespace).getFilter()).toMatchObject(value); + expect(await readProviderFn().getFilter()).toBeFalsy(); + }); + + it('should track arbitrary key value pairs', async () => { + const { writeProvider, readProviderFn } = createSimpleFsStorageProvider(); + + const key = "test"; + const value = "testing"; + const namespace = "@user:example.org"; + const nsKey = `${namespace}_kv_${key}`; + + const nsWriter = writeProvider.storageForUser(namespace); + expect(nsWriter).toBeDefined(); + + expect(await nsWriter.readValue(key)).toBeFalsy(); + expect(await writeProvider.readValue(nsKey)).toBeFalsy(); + await nsWriter.storeValue(key, value); + expect(await nsWriter.readValue(key)).toEqual(value); + expect(await writeProvider.readValue(nsKey)).toEqual(value); + expect(await readProviderFn().storageForUser(namespace).readValue(key)).toEqual(value); + expect(await readProviderFn().readValue(nsKey)).toEqual(value); + }); + }); }); diff --git a/test/storage/SqliteCryptoStorageProvider.ts b/test/storage/SqliteCryptoStorageProvider.ts deleted file mode 100644 index a31f6ddd..00000000 --- a/test/storage/SqliteCryptoStorageProvider.ts +++ /dev/null @@ -1,576 +0,0 @@ -import * as expect from "expect"; -import * as tmp from "tmp"; -import { SqliteCryptoStorageProvider } from "../../src/storage/SqliteCryptoStorageProvider"; -import { TEST_DEVICE_ID } from "../MatrixClientTest"; -import { EncryptionAlgorithm, IInboundGroupSession, IOlmSession } from "../../src"; - -tmp.setGracefulCleanup(); - -describe('SqliteCryptoStorageProvider', () => { - it('should return the right device ID', async () => { - const name = tmp.fileSync().name; - let store = new SqliteCryptoStorageProvider(name); - - expect(await store.getDeviceId()).toBeFalsy(); - await store.setDeviceId(TEST_DEVICE_ID); - expect(await store.getDeviceId()).toEqual(TEST_DEVICE_ID); - await store.close(); - store = new SqliteCryptoStorageProvider(name); - expect(await store.getDeviceId()).toEqual(TEST_DEVICE_ID); - await store.close(); - }); - - it('should return the right pickle key', async () => { - const name = tmp.fileSync().name; - let store = new SqliteCryptoStorageProvider(name); - - expect(await store.getPickleKey()).toBeFalsy(); - await store.setPickleKey("pickle"); - expect(await store.getPickleKey()).toEqual("pickle"); - await store.close(); - store = new SqliteCryptoStorageProvider(name); - expect(await store.getPickleKey()).toEqual("pickle"); - await store.close(); - }); - - it('should return the right pickle account', async () => { - const name = tmp.fileSync().name; - let store = new SqliteCryptoStorageProvider(name); - - expect(await store.getPickledAccount()).toBeFalsy(); - await store.setPickledAccount("pickled"); - expect(await store.getPickledAccount()).toEqual("pickled"); - await store.close(); - store = new SqliteCryptoStorageProvider(name); - expect(await store.getPickledAccount()).toEqual("pickled"); - await store.close(); - }); - - it('should store rooms', async () => { - const roomId1 = "!first:example.org"; - const roomId2 = "!second:example.org"; - const roomId3 = "!no_config:example.org"; - - const config1: any = {val: "test"}; - const config2 = {algorithm: EncryptionAlgorithm.MegolmV1AesSha2}; - - const name = tmp.fileSync().name; - let store = new SqliteCryptoStorageProvider(name); - expect(await store.getRoom(roomId1)).toBeFalsy(); - expect(await store.getRoom(roomId2)).toBeFalsy(); - expect(await store.getRoom(roomId3)).toBeFalsy(); - await store.storeRoom(roomId1, config1); - expect(await store.getRoom(roomId1)).toMatchObject(config1); - expect(await store.getRoom(roomId2)).toBeFalsy(); - expect(await store.getRoom(roomId3)).toBeFalsy(); - await store.storeRoom(roomId2, config2); - expect(await store.getRoom(roomId1)).toMatchObject(config1); - expect(await store.getRoom(roomId2)).toMatchObject(config2); - expect(await store.getRoom(roomId3)).toBeFalsy(); - await store.close(); - store = new SqliteCryptoStorageProvider(name); - expect(await store.getRoom(roomId1)).toMatchObject(config1); - expect(await store.getRoom(roomId2)).toMatchObject(config2); - expect(await store.getRoom(roomId3)).toBeFalsy(); - await store.close(); - }); - - it('should flag users as outdated by default', async () => { - const userId = "@user:example.org"; - - const name = tmp.fileSync().name; - let store = new SqliteCryptoStorageProvider(name); - expect(await store.isUserOutdated(userId)).toEqual(true); - await store.flagUsersOutdated([userId]); - expect(await store.isUserOutdated(userId)).toEqual(true); - await store.close(); - store = new SqliteCryptoStorageProvider(name); - expect(await store.isUserOutdated(userId)).toEqual(true); - await store.setActiveUserDevices(userId, []); - expect(await store.isUserOutdated(userId)).toEqual(false); - await store.close(); - store = new SqliteCryptoStorageProvider(name); - expect(await store.isUserOutdated(userId)).toEqual(false); - await store.close(); - }); - - it('should track multiple users', async () => { - const userId1 = "@user:example.org"; - const userId2 = "@two:example.org"; - - // Not real UserDevices, but this is a test. - const devices1: any = [{device_id: "one"}, {device_id: "two"}]; - const devices2: any = [{device_id: "three"}, {device_id: "four"}]; - - const deviceSortFn = (a, b) => a.device_id < b.device_id ? -1 : (a.device_id === b.device_id ? 0 : 1); - - const name = tmp.fileSync().name; - let store = new SqliteCryptoStorageProvider(name); - - expect(await store.isUserOutdated(userId1)).toEqual(true); - expect(await store.isUserOutdated(userId2)).toEqual(true); - await store.setActiveUserDevices(userId1, devices1); - await store.setActiveUserDevices(userId2, devices2); - expect(await store.isUserOutdated(userId1)).toEqual(false); - expect(await store.isUserOutdated(userId2)).toEqual(false); - expect((await store.getActiveUserDevices(userId1)).sort(deviceSortFn)).toEqual(devices1.sort(deviceSortFn)); - expect((await store.getActiveUserDevices(userId2)).sort(deviceSortFn)).toEqual(devices2.sort(deviceSortFn)); - await store.close(); - store = new SqliteCryptoStorageProvider(name); - expect(await store.isUserOutdated(userId1)).toEqual(false); - expect(await store.isUserOutdated(userId2)).toEqual(false); - expect((await store.getActiveUserDevices(userId1)).sort(deviceSortFn)).toEqual(devices1.sort(deviceSortFn)); - expect((await store.getActiveUserDevices(userId2)).sort(deviceSortFn)).toEqual(devices2.sort(deviceSortFn)); - await store.flagUsersOutdated([userId1, userId2]); - expect(await store.isUserOutdated(userId1)).toEqual(true); - expect(await store.isUserOutdated(userId2)).toEqual(true); - expect((await store.getActiveUserDevices(userId1)).sort(deviceSortFn)).toEqual(devices1.sort(deviceSortFn)); - expect((await store.getActiveUserDevices(userId2)).sort(deviceSortFn)).toEqual(devices2.sort(deviceSortFn)); - await store.close(); - store = new SqliteCryptoStorageProvider(name); - expect(await store.isUserOutdated(userId1)).toEqual(true); - expect(await store.isUserOutdated(userId2)).toEqual(true); - expect((await store.getActiveUserDevices(userId1)).sort(deviceSortFn)).toEqual(devices1.sort(deviceSortFn)); - expect((await store.getActiveUserDevices(userId2)).sort(deviceSortFn)).toEqual(devices2.sort(deviceSortFn)); - await store.close(); - }); - - it('should track current outbound sessions', async () => { - const sessionIds = ["one", "two", "3"]; - const roomIds = ["!one:example.org", "!one:example.org", "!one:example.org"]; // all the same room ID intentionally - const pickles = ["p1", "p2", "p3"]; - const expiresTs = Date.now(); - const usesLeft = 101; - - const name = tmp.fileSync().name; - let store = new SqliteCryptoStorageProvider(name); - - await store.storeOutboundGroupSession({ - sessionId: sessionIds[0], - roomId: roomIds[0], - pickled: pickles[0], - expiresTs: expiresTs, - usesLeft: usesLeft, - isCurrent: false, - }); - await store.storeOutboundGroupSession({ - sessionId: sessionIds[1], - roomId: roomIds[1], - pickled: pickles[1], - expiresTs: expiresTs, - usesLeft: usesLeft, - isCurrent: true, - }); - await store.storeOutboundGroupSession({ - sessionId: sessionIds[2], - roomId: roomIds[2], - pickled: pickles[2], - expiresTs: expiresTs, - usesLeft: usesLeft, - isCurrent: false, - }); - expect(await store.getOutboundGroupSession(sessionIds[0], roomIds[0])).toMatchObject({ - sessionId: sessionIds[0], - roomId: roomIds[0], - pickled: pickles[0], - expiresTs: expiresTs, - usesLeft: usesLeft, - isCurrent: false, - }); - expect(await store.getOutboundGroupSession(sessionIds[1], roomIds[1])).toMatchObject({ - sessionId: sessionIds[1], - roomId: roomIds[1], - pickled: pickles[1], - expiresTs: expiresTs, - usesLeft: usesLeft, - isCurrent: true, - }); - expect(await store.getOutboundGroupSession(sessionIds[2], roomIds[2])).toMatchObject({ - sessionId: sessionIds[2], - roomId: roomIds[2], - pickled: pickles[2], - expiresTs: expiresTs, - usesLeft: usesLeft, - isCurrent: false, - }); - expect(await store.getCurrentOutboundGroupSession(roomIds[0])).toMatchObject({ // just testing the flag - sessionId: sessionIds[1], - roomId: roomIds[1], - pickled: pickles[1], - expiresTs: expiresTs, - usesLeft: usesLeft, - isCurrent: true, - }); - await store.close(); - store = new SqliteCryptoStorageProvider(name); - expect(await store.getOutboundGroupSession(sessionIds[0], roomIds[0])).toMatchObject({ - sessionId: sessionIds[0], - roomId: roomIds[0], - pickled: pickles[0], - expiresTs: expiresTs, - usesLeft: usesLeft, - isCurrent: false, - }); - expect(await store.getOutboundGroupSession(sessionIds[1], roomIds[1])).toMatchObject({ - sessionId: sessionIds[1], - roomId: roomIds[1], - pickled: pickles[1], - expiresTs: expiresTs, - usesLeft: usesLeft, - isCurrent: true, - }); - expect(await store.getOutboundGroupSession(sessionIds[2], roomIds[2])).toMatchObject({ - sessionId: sessionIds[2], - roomId: roomIds[2], - pickled: pickles[2], - expiresTs: expiresTs, - usesLeft: usesLeft, - isCurrent: false, - }); - expect(await store.getCurrentOutboundGroupSession(roomIds[0])).toMatchObject({ // just testing the flag - sessionId: sessionIds[1], - roomId: roomIds[1], - pickled: pickles[1], - expiresTs: expiresTs, - usesLeft: usesLeft, - isCurrent: true, - }); - await store.close(); - }); - - it('should overwrite any previously current outbound sessions', async () => { - const sessionIds = ["one", "two", "3"]; - const roomIds = ["!one:example.org", "!one:example.org", "!one:example.org"]; // all the same room ID intentionally - const pickles = ["p1", "p2", "p3"]; - const expiresTs = Date.now(); - const usesLeft = 101; - - const name = tmp.fileSync().name; - let store = new SqliteCryptoStorageProvider(name); - - await store.storeOutboundGroupSession({ - sessionId: sessionIds[0], - roomId: roomIds[0], - pickled: pickles[0], - expiresTs: expiresTs, - usesLeft: usesLeft, - isCurrent: true, - }); - await store.storeOutboundGroupSession({ - sessionId: sessionIds[1], - roomId: roomIds[1], - pickled: pickles[1], - expiresTs: expiresTs, - usesLeft: usesLeft, - isCurrent: true, - }); - await store.storeOutboundGroupSession({ - sessionId: sessionIds[2], - roomId: roomIds[2], - pickled: pickles[2], - expiresTs: expiresTs, - usesLeft: usesLeft, - isCurrent: true, - }); - expect(await store.getOutboundGroupSession(sessionIds[0], roomIds[0])).toMatchObject({ - sessionId: sessionIds[0], - roomId: roomIds[0], - pickled: pickles[0], - expiresTs: expiresTs, - usesLeft: usesLeft, - isCurrent: false, - }); - expect(await store.getOutboundGroupSession(sessionIds[1], roomIds[1])).toMatchObject({ - sessionId: sessionIds[1], - roomId: roomIds[1], - pickled: pickles[1], - expiresTs: expiresTs, - usesLeft: usesLeft, - isCurrent: false, - }); - expect(await store.getOutboundGroupSession(sessionIds[2], roomIds[2])).toMatchObject({ - sessionId: sessionIds[2], - roomId: roomIds[2], - pickled: pickles[2], - expiresTs: expiresTs, - usesLeft: usesLeft, - isCurrent: true, - }); - expect(await store.getCurrentOutboundGroupSession(roomIds[0])).toMatchObject({ // just testing the flag - sessionId: sessionIds[2], - roomId: roomIds[2], - pickled: pickles[2], - expiresTs: expiresTs, - usesLeft: usesLeft, - isCurrent: true, - }); - await store.close(); - store = new SqliteCryptoStorageProvider(name); - expect(await store.getOutboundGroupSession(sessionIds[0], roomIds[0])).toMatchObject({ - sessionId: sessionIds[0], - roomId: roomIds[0], - pickled: pickles[0], - expiresTs: expiresTs, - usesLeft: usesLeft, - isCurrent: false, - }); - expect(await store.getOutboundGroupSession(sessionIds[1], roomIds[1])).toMatchObject({ - sessionId: sessionIds[1], - roomId: roomIds[1], - pickled: pickles[1], - expiresTs: expiresTs, - usesLeft: usesLeft, - isCurrent: false, - }); - expect(await store.getOutboundGroupSession(sessionIds[2], roomIds[2])).toMatchObject({ - sessionId: sessionIds[2], - roomId: roomIds[2], - pickled: pickles[2], - expiresTs: expiresTs, - usesLeft: usesLeft, - isCurrent: true, - }); - expect(await store.getCurrentOutboundGroupSession(roomIds[0])).toMatchObject({ // just testing the flag - sessionId: sessionIds[2], - roomId: roomIds[2], - pickled: pickles[2], - expiresTs: expiresTs, - usesLeft: usesLeft, - isCurrent: true, - }); - await store.close(); - }); - - it('should track sent outbound sessions', async () => { - const sessionId = "session"; - const roomId = "!room:example.org"; - const usesLeft = 100; - const expiresTs = Date.now(); - const pickle = "pickled"; - const userId = "@user:example.org"; - const index = 1; - const deviceId = "DEVICE"; - - const name = tmp.fileSync().name; - let store = new SqliteCryptoStorageProvider(name); - - await store.storeSentOutboundGroupSession({ - sessionId: sessionId, - roomId: roomId, - pickled: pickle, - expiresTs: expiresTs, - usesLeft: usesLeft, - isCurrent: true, - }, index, { - device_id: deviceId, - keys: {}, - user_id: userId, - signatures: {}, - algorithms: [EncryptionAlgorithm.MegolmV1AesSha2], - unsigned: {}, - }); - await store.storeSentOutboundGroupSession({ - sessionId: sessionId, - roomId: roomId, - pickled: pickle, - expiresTs: expiresTs, - usesLeft: usesLeft, - isCurrent: true, - }, index, { - device_id: deviceId + "_NOTUSED", - keys: {}, - user_id: userId, - signatures: {}, - algorithms: [EncryptionAlgorithm.MegolmV1AesSha2], - unsigned: {}, - }); - expect(await store.getLastSentOutboundGroupSession(userId, deviceId, roomId)).toMatchObject({ - sessionId: sessionId, - index: index, - }); - await store.close(); - store = new SqliteCryptoStorageProvider(name); - expect(await store.getLastSentOutboundGroupSession(userId, deviceId, roomId)).toMatchObject({ - sessionId: sessionId, - index: index, - }); - await store.close(); - }); - - it('should fetch single user devices', async () => { - const userId1 = "@user:example.org"; - const userId2 = "@two:example.org"; - - // Not real UserDevices, but this is a test. - const devices1: any = [{device_id: "one"}, {device_id: "two"}]; - const devices2: any = [{device_id: "three"}, {device_id: "four"}]; - - const name = tmp.fileSync().name; - let store = new SqliteCryptoStorageProvider(name); - - await store.setActiveUserDevices(userId1, devices1); - await store.setActiveUserDevices(userId2, devices2); - expect(await store.getActiveUserDevice(userId1, devices1[0].device_id)).toMatchObject(devices1[0]); - expect(await store.getActiveUserDevice(userId1, devices1[1].device_id)).toMatchObject(devices1[1]); - expect(await store.getActiveUserDevice(userId2, devices2[0].device_id)).toMatchObject(devices2[0]); - expect(await store.getActiveUserDevice(userId2, devices2[1].device_id)).toMatchObject(devices2[1]); - await store.close(); - store = new SqliteCryptoStorageProvider(name); - expect(await store.getActiveUserDevice(userId1, devices1[0].device_id)).toMatchObject(devices1[0]); - expect(await store.getActiveUserDevice(userId1, devices1[1].device_id)).toMatchObject(devices1[1]); - expect(await store.getActiveUserDevice(userId2, devices2[0].device_id)).toMatchObject(devices2[0]); - expect(await store.getActiveUserDevice(userId2, devices2[1].device_id)).toMatchObject(devices2[1]); - await store.close(); - }); - - it('should track user devices as inactive when considered removed', async () => { - const userId = "@user:example.org"; - // Not real UserDevices, but this is a test. - const devices: any = [{device_id: "one"}, {device_id: "two"}]; - - const name = tmp.fileSync().name; - let store = new SqliteCryptoStorageProvider(name); - - expect((await store.getAllUserDevices(userId)).length).toBe(0); - await store.setActiveUserDevices(userId, [devices[0]]); - expect(await store.getAllUserDevices(userId)).toMatchObject([ - Object.assign({}, devices[0], {unsigned: {bsdkIsActive: true}}), - ]); - expect(await store.getActiveUserDevices(userId)).toMatchObject([devices[0]]); - await store.close(); - store = new SqliteCryptoStorageProvider(name); - expect(await store.getAllUserDevices(userId)).toMatchObject([ - Object.assign({}, devices[0], {unsigned: {bsdkIsActive: true}}), - ]); - await store.setActiveUserDevices(userId, [devices[1]]); - expect(await store.getAllUserDevices(userId)).toMatchObject([ - Object.assign({}, devices[0], {unsigned: {bsdkIsActive: false}}), - Object.assign({}, devices[1], {unsigned: {bsdkIsActive: true}}), - ]); - expect(await store.getActiveUserDevices(userId)).toMatchObject([devices[1]]); - await store.close(); - store = new SqliteCryptoStorageProvider(name); - expect(await store.getAllUserDevices(userId)).toMatchObject([ - Object.assign({}, devices[0], {unsigned: {bsdkIsActive: false}}), - Object.assign({}, devices[1], {unsigned: {bsdkIsActive: true}}), - ]); - expect(await store.getActiveUserDevices(userId)).toMatchObject([devices[1]]); - await store.close(); - }); - - it('should track current Olm sessions', async () => { - const userId1 = "@user:example.org"; - const userId2 = "@two:example.org"; - - const deviceId1 = "ONE"; - const deviceId2 = "TWO"; - - const session1: IOlmSession = { - sessionId: "SESSION_ONE", - pickled: "pickled_one", - lastDecryptionTs: Date.now(), - }; - const session2: IOlmSession = { - sessionId: "SESSION_TWO", - pickled: "pickled_two", - lastDecryptionTs: Date.now() + 5, - }; - const session3: IOlmSession = { - sessionId: "SESSION_THREE", - pickled: "pickled_three", - lastDecryptionTs: Date.now() - 10, - }; - const session4: IOlmSession = { - sessionId: "SESSION_FOUR", - pickled: "pickled_four", - lastDecryptionTs: Date.now() + 10, - }; - - const name = tmp.fileSync().name; - let store = new SqliteCryptoStorageProvider(name); - - const sessionSortFn = (a, b) => a.sessionId < b.sessionId ? -1 : (a.sessionId === b.sessionId ? 0 : 1); - - await store.storeOlmSession(userId1, deviceId1, session1); - await store.storeOlmSession(userId2, deviceId2, session2); - expect(await store.getCurrentOlmSession(userId1, deviceId1)).toMatchObject(session1 as any); - expect(await store.getCurrentOlmSession(userId2, deviceId2)).toMatchObject(session2 as any); - expect((await store.getOlmSessions(userId1, deviceId1)).sort(sessionSortFn)).toMatchObject([session1].sort(sessionSortFn)); - expect((await store.getOlmSessions(userId2, deviceId2)).sort(sessionSortFn)).toMatchObject([session2].sort(sessionSortFn)); - await store.close(); - store = new SqliteCryptoStorageProvider(name); - expect(await store.getCurrentOlmSession(userId1, deviceId1)).toMatchObject(session1 as any); - expect(await store.getCurrentOlmSession(userId2, deviceId2)).toMatchObject(session2 as any); - expect((await store.getOlmSessions(userId1, deviceId1)).sort(sessionSortFn)).toMatchObject([session1].sort(sessionSortFn)); - expect((await store.getOlmSessions(userId2, deviceId2)).sort(sessionSortFn)).toMatchObject([session2].sort(sessionSortFn)); - - // insert an updated session for the first user to ensure the lastDecryptionTs logic works - await store.storeOlmSession(userId1, deviceId1, session4); - expect(await store.getCurrentOlmSession(userId1, deviceId1)).toMatchObject(session4 as any); - expect(await store.getCurrentOlmSession(userId2, deviceId2)).toMatchObject(session2 as any); - expect((await store.getOlmSessions(userId1, deviceId1)).sort(sessionSortFn)).toMatchObject([session1, session4].sort(sessionSortFn)); - expect((await store.getOlmSessions(userId2, deviceId2)).sort(sessionSortFn)).toMatchObject([session2].sort(sessionSortFn)); - await store.close(); - store = new SqliteCryptoStorageProvider(name); - expect(await store.getCurrentOlmSession(userId1, deviceId1)).toMatchObject(session4 as any); - expect(await store.getCurrentOlmSession(userId2, deviceId2)).toMatchObject(session2 as any); - expect((await store.getOlmSessions(userId1, deviceId1)).sort(sessionSortFn)).toMatchObject([session1, session4].sort(sessionSortFn)); - expect((await store.getOlmSessions(userId2, deviceId2)).sort(sessionSortFn)).toMatchObject([session2].sort(sessionSortFn)); - - // now test that we'll keep session 4 even after inserting session 3 (an older session) - await store.storeOlmSession(userId1, deviceId1, session3); - expect(await store.getCurrentOlmSession(userId1, deviceId1)).toMatchObject(session4 as any); - expect(await store.getCurrentOlmSession(userId2, deviceId2)).toMatchObject(session2 as any); - expect((await store.getOlmSessions(userId1, deviceId1)).sort(sessionSortFn)).toMatchObject([session1, session4, session3].sort(sessionSortFn)); - expect((await store.getOlmSessions(userId2, deviceId2)).sort(sessionSortFn)).toMatchObject([session2].sort(sessionSortFn)); - await store.close(); - store = new SqliteCryptoStorageProvider(name); - expect(await store.getCurrentOlmSession(userId1, deviceId1)).toMatchObject(session4 as any); - expect(await store.getCurrentOlmSession(userId2, deviceId2)).toMatchObject(session2 as any); - expect((await store.getOlmSessions(userId1, deviceId1)).sort(sessionSortFn)).toMatchObject([session1, session4, session3].sort(sessionSortFn)); - expect((await store.getOlmSessions(userId2, deviceId2)).sort(sessionSortFn)).toMatchObject([session2].sort(sessionSortFn)); - - await store.close(); - }); - - it('should store inbound group sessions', async () => { - const session: IInboundGroupSession = { - sessionId: "ID", - roomId: "!room:example.org", - pickled: "pickled_text", - senderDeviceId: "SENDER", - senderUserId: "@sender:example.org", - }; - - const name = tmp.fileSync().name; - let store = new SqliteCryptoStorageProvider(name); - - expect(await store.getInboundGroupSession(session.senderUserId, session.senderDeviceId, session.roomId, session.sessionId)).toBeFalsy(); - await store.storeInboundGroupSession(session); - expect(await store.getInboundGroupSession(session.senderUserId, session.senderDeviceId, session.roomId, session.sessionId)).toMatchObject(session as any); - await store.close(); - store = new SqliteCryptoStorageProvider(name); - expect(await store.getInboundGroupSession(session.senderUserId, session.senderDeviceId, session.roomId, session.sessionId)).toMatchObject(session as any); - - await store.close(); - }); - - it('should store message indices', async () => { - const roomId = "!room:example.org"; - const eventId = "$event"; - const sessionId = "session_id_here"; - const messageIndex = 12; - - const name = tmp.fileSync().name; - let store = new SqliteCryptoStorageProvider(name); - - expect(await store.getEventForMessageIndex(roomId, sessionId, messageIndex)).toBeFalsy(); - await store.setMessageIndexForEvent(roomId, eventId, sessionId, messageIndex); - expect(await store.getEventForMessageIndex(roomId, sessionId, messageIndex)).toEqual(eventId); - await store.close(); - store = new SqliteCryptoStorageProvider(name); - expect(await store.getEventForMessageIndex(roomId, sessionId, messageIndex)).toEqual(eventId); - - await store.close(); - }); -}); diff --git a/yarn.lock b/yarn.lock index 5a7b2b0d..efda6f27 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,331 +2,336 @@ # yarn lockfile v1 -"@babel/code-frame@^7.0.0": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.5.5.tgz#bc0782f6d69f7b7d49531219699b988f669a8f9d" - integrity sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw== +"@babel/code-frame@7.12.11": + version "7.12.11" + resolved "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.11.tgz" + integrity sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw== dependencies: - "@babel/highlight" "^7.0.0" + "@babel/highlight" "^7.10.4" -"@babel/code-frame@^7.10.4": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.10.4.tgz#168da1a36e90da68ae8d49c0f1b48c7c6249213a" - integrity sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg== +"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.16.7": + version "7.16.7" + resolved "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.7.tgz" + integrity sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg== dependencies: - "@babel/highlight" "^7.10.4" + "@babel/highlight" "^7.16.7" + +"@babel/compat-data@^7.16.4": + version "7.16.8" + resolved "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.16.8.tgz" + integrity sha512-m7OkX0IdKLKPpBlJtF561YJal5y/jyI5fNfWbPxh2D/nbzzGI4qRyrD8xO2jB24u7l+5I2a43scCG2IrfjC50Q== "@babel/core@^7.7.5": - version "7.11.1" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.11.1.tgz#2c55b604e73a40dc21b0e52650b11c65cf276643" - integrity sha512-XqF7F6FWQdKGGWAzGELL+aCO1p+lRY5Tj5/tbT3St1G8NaH70jhhDIKknIZaDans0OQBG5wRAldROLHSt44BgQ== - dependencies: - "@babel/code-frame" "^7.10.4" - "@babel/generator" "^7.11.0" - "@babel/helper-module-transforms" "^7.11.0" - "@babel/helpers" "^7.10.4" - "@babel/parser" "^7.11.1" - "@babel/template" "^7.10.4" - "@babel/traverse" "^7.11.0" - "@babel/types" "^7.11.0" + version "7.16.7" + resolved "https://registry.npmjs.org/@babel/core/-/core-7.16.7.tgz" + integrity sha512-aeLaqcqThRNZYmbMqtulsetOQZ/5gbR/dWruUCJcpas4Qoyy+QeagfDsPdMrqwsPRDNxJvBlRiZxxX7THO7qtA== + dependencies: + "@babel/code-frame" "^7.16.7" + "@babel/generator" "^7.16.7" + "@babel/helper-compilation-targets" "^7.16.7" + "@babel/helper-module-transforms" "^7.16.7" + "@babel/helpers" "^7.16.7" + "@babel/parser" "^7.16.7" + "@babel/template" "^7.16.7" + "@babel/traverse" "^7.16.7" + "@babel/types" "^7.16.7" convert-source-map "^1.7.0" debug "^4.1.0" - gensync "^1.0.0-beta.1" + gensync "^1.0.0-beta.2" json5 "^2.1.2" - lodash "^4.17.19" - resolve "^1.3.2" - semver "^5.4.1" + semver "^6.3.0" source-map "^0.5.0" -"@babel/generator@^7.11.0": - version "7.11.0" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.11.0.tgz#4b90c78d8c12825024568cbe83ee6c9af193585c" - integrity sha512-fEm3Uzw7Mc9Xi//qU20cBKatTfs2aOtKqmvy/Vm7RkJEGFQ4xc9myCfbXxqK//ZS8MR/ciOHw6meGASJuKmDfQ== +"@babel/generator@^7.12.11", "@babel/generator@^7.16.7", "@babel/generator@^7.16.8": + version "7.16.8" + resolved "https://registry.npmjs.org/@babel/generator/-/generator-7.16.8.tgz" + integrity sha512-1ojZwE9+lOXzcWdWmO6TbUzDfqLD39CmEhN8+2cX9XkDo5yW1OpgfejfliysR2AWLpMamTiOiAp/mtroaymhpw== dependencies: - "@babel/types" "^7.11.0" + "@babel/types" "^7.16.8" jsesc "^2.5.1" source-map "^0.5.0" -"@babel/helper-function-name@^7.10.4": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.10.4.tgz#d2d3b20c59ad8c47112fa7d2a94bc09d5ef82f1a" - integrity sha512-YdaSyz1n8gY44EmN7x44zBn9zQ1Ry2Y+3GTA+3vH6Mizke1Vw0aWDM66FOYEPw8//qKkmqOckrGgTYa+6sceqQ== - dependencies: - "@babel/helper-get-function-arity" "^7.10.4" - "@babel/template" "^7.10.4" - "@babel/types" "^7.10.4" - -"@babel/helper-get-function-arity@^7.10.4": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.10.4.tgz#98c1cbea0e2332f33f9a4661b8ce1505b2c19ba2" - integrity sha512-EkN3YDB+SRDgiIUnNgcmiD361ti+AVbL3f3Henf6dqqUyr5dMsorno0lJWJuLhDhkI5sYEpgj6y9kB8AOU1I2A== - dependencies: - "@babel/types" "^7.10.4" - -"@babel/helper-member-expression-to-functions@^7.10.4": - version "7.11.0" - resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.11.0.tgz#ae69c83d84ee82f4b42f96e2a09410935a8f26df" - integrity sha512-JbFlKHFntRV5qKw3YC0CvQnDZ4XMwgzzBbld7Ly4Mj4cbFy3KywcR8NtNctRToMWJOVvLINJv525Gd6wwVEx/Q== - dependencies: - "@babel/types" "^7.11.0" - -"@babel/helper-module-imports@^7.10.4": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.10.4.tgz#4c5c54be04bd31670a7382797d75b9fa2e5b5620" - integrity sha512-nEQJHqYavI217oD9+s5MUBzk6x1IlvoS9WTPfgG43CbMEeStE0v+r+TucWdx8KFGowPGvyOkDT9+7DHedIDnVw== - dependencies: - "@babel/types" "^7.10.4" - -"@babel/helper-module-transforms@^7.11.0": - version "7.11.0" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.11.0.tgz#b16f250229e47211abdd84b34b64737c2ab2d359" - integrity sha512-02EVu8COMuTRO1TAzdMtpBPbe6aQ1w/8fePD2YgQmxZU4gpNWaL9gK3Jp7dxlkUlUCJOTaSeA+Hrm1BRQwqIhg== - dependencies: - "@babel/helper-module-imports" "^7.10.4" - "@babel/helper-replace-supers" "^7.10.4" - "@babel/helper-simple-access" "^7.10.4" - "@babel/helper-split-export-declaration" "^7.11.0" - "@babel/template" "^7.10.4" - "@babel/types" "^7.11.0" - lodash "^4.17.19" - -"@babel/helper-optimise-call-expression@^7.10.4": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.10.4.tgz#50dc96413d594f995a77905905b05893cd779673" - integrity sha512-n3UGKY4VXwXThEiKrgRAoVPBMqeoPgHVqiHZOanAJCG9nQUL2pLRQirUzl0ioKclHGpGqRgIOkgcIJaIWLpygg== - dependencies: - "@babel/types" "^7.10.4" - -"@babel/helper-replace-supers@^7.10.4": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.10.4.tgz#d585cd9388ea06e6031e4cd44b6713cbead9e6cf" - integrity sha512-sPxZfFXocEymYTdVK1UNmFPBN+Hv5mJkLPsYWwGBxZAxaWfFu+xqp7b6qWD0yjNuNL2VKc6L5M18tOXUP7NU0A== - dependencies: - "@babel/helper-member-expression-to-functions" "^7.10.4" - "@babel/helper-optimise-call-expression" "^7.10.4" - "@babel/traverse" "^7.10.4" - "@babel/types" "^7.10.4" - -"@babel/helper-simple-access@^7.10.4": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.10.4.tgz#0f5ccda2945277a2a7a2d3a821e15395edcf3461" - integrity sha512-0fMy72ej/VEvF8ULmX6yb5MtHG4uH4Dbd6I/aHDb/JVg0bbivwt9Wg+h3uMvX+QSFtwr5MeItvazbrc4jtRAXw== - dependencies: - "@babel/template" "^7.10.4" - "@babel/types" "^7.10.4" - -"@babel/helper-split-export-declaration@^7.11.0": - version "7.11.0" - resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.11.0.tgz#f8a491244acf6a676158ac42072911ba83ad099f" - integrity sha512-74Vejvp6mHkGE+m+k5vHY93FX2cAtrw1zXrZXRlG4l410Nm9PxfEiVTn1PjDPV5SnmieiueY4AFg2xqhNFuuZg== - dependencies: - "@babel/types" "^7.11.0" - -"@babel/helper-validator-identifier@^7.10.4": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz#a78c7a7251e01f616512d31b10adcf52ada5e0d2" - integrity sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw== - -"@babel/helpers@^7.10.4": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.10.4.tgz#2abeb0d721aff7c0a97376b9e1f6f65d7a475044" - integrity sha512-L2gX/XeUONeEbI78dXSrJzGdz4GQ+ZTA/aazfUsFaWjSe95kiCuOZ5HsXvkiw3iwF+mFHSRUfJU8t6YavocdXA== - dependencies: - "@babel/template" "^7.10.4" - "@babel/traverse" "^7.10.4" - "@babel/types" "^7.10.4" - -"@babel/highlight@^7.0.0": - version "7.5.0" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.5.0.tgz#56d11312bd9248fa619591d02472be6e8cb32540" - integrity sha512-7dV4eu9gBxoM0dAnj/BCFDW9LFU0zvTrkq0ugM7pnHEgguOEeOz1so2ZghEdzviYzQEED0r4EAgpsBChKy1TRQ== - dependencies: - chalk "^2.0.0" - esutils "^2.0.2" - js-tokens "^4.0.0" - -"@babel/highlight@^7.10.4": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.10.4.tgz#7d1bdfd65753538fabe6c38596cdb76d9ac60143" - integrity sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA== - dependencies: - "@babel/helper-validator-identifier" "^7.10.4" +"@babel/helper-compilation-targets@^7.16.7": + version "7.16.7" + resolved "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.16.7.tgz" + integrity sha512-mGojBwIWcwGD6rfqgRXVlVYmPAv7eOpIemUG3dGnDdCY4Pae70ROij3XmfrH6Fa1h1aiDylpglbZyktfzyo/hA== + dependencies: + "@babel/compat-data" "^7.16.4" + "@babel/helper-validator-option" "^7.16.7" + browserslist "^4.17.5" + semver "^6.3.0" + +"@babel/helper-environment-visitor@^7.16.7": + version "7.16.7" + resolved "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.16.7.tgz" + integrity sha512-SLLb0AAn6PkUeAfKJCCOl9e1R53pQlGAfc4y4XuMRZfqeMYLE0dM1LMhqbGAlGQY0lfw5/ohoYWAe9V1yibRag== + dependencies: + "@babel/types" "^7.16.7" + +"@babel/helper-function-name@^7.16.7": + version "7.16.7" + resolved "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.16.7.tgz" + integrity sha512-QfDfEnIUyyBSR3HtrtGECuZ6DAyCkYFp7GHl75vFtTnn6pjKeK0T1DB5lLkFvBea8MdaiUABx3osbgLyInoejA== + dependencies: + "@babel/helper-get-function-arity" "^7.16.7" + "@babel/template" "^7.16.7" + "@babel/types" "^7.16.7" + +"@babel/helper-get-function-arity@^7.16.7": + version "7.16.7" + resolved "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.16.7.tgz" + integrity sha512-flc+RLSOBXzNzVhcLu6ujeHUrD6tANAOU5ojrRx/as+tbzf8+stUCj7+IfRRoAbEZqj/ahXEMsjhOhgeZsrnTw== + dependencies: + "@babel/types" "^7.16.7" + +"@babel/helper-hoist-variables@^7.16.7": + version "7.16.7" + resolved "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.16.7.tgz" + integrity sha512-m04d/0Op34H5v7pbZw6pSKP7weA6lsMvfiIAMeIvkY/R4xQtBSMFEigu9QTZ2qB/9l22vsxtM8a+Q8CzD255fg== + dependencies: + "@babel/types" "^7.16.7" + +"@babel/helper-module-imports@^7.16.7": + version "7.16.7" + resolved "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.16.7.tgz" + integrity sha512-LVtS6TqjJHFc+nYeITRo6VLXve70xmq7wPhWTqDJusJEgGmkAACWwMiTNrvfoQo6hEhFwAIixNkvB0jPXDL8Wg== + dependencies: + "@babel/types" "^7.16.7" + +"@babel/helper-module-transforms@^7.16.7": + version "7.16.7" + resolved "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.16.7.tgz" + integrity sha512-gaqtLDxJEFCeQbYp9aLAefjhkKdjKcdh6DB7jniIGU3Pz52WAmP268zK0VgPz9hUNkMSYeH976K2/Y6yPadpng== + dependencies: + "@babel/helper-environment-visitor" "^7.16.7" + "@babel/helper-module-imports" "^7.16.7" + "@babel/helper-simple-access" "^7.16.7" + "@babel/helper-split-export-declaration" "^7.16.7" + "@babel/helper-validator-identifier" "^7.16.7" + "@babel/template" "^7.16.7" + "@babel/traverse" "^7.16.7" + "@babel/types" "^7.16.7" + +"@babel/helper-simple-access@^7.16.7": + version "7.16.7" + resolved "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.16.7.tgz" + integrity sha512-ZIzHVyoeLMvXMN/vok/a4LWRy8G2v205mNP0XOuf9XRLyX5/u9CnVulUtDgUTama3lT+bf/UqucuZjqiGuTS1g== + dependencies: + "@babel/types" "^7.16.7" + +"@babel/helper-split-export-declaration@^7.16.7": + version "7.16.7" + resolved "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.16.7.tgz" + integrity sha512-xbWoy/PFoxSWazIToT9Sif+jJTlrMcndIsaOKvTA6u7QEo7ilkRZpjew18/W3c7nm8fXdUDXh02VXTbZ0pGDNw== + dependencies: + "@babel/types" "^7.16.7" + +"@babel/helper-validator-identifier@^7.16.7": + version "7.16.7" + resolved "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz" + integrity sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw== + +"@babel/helper-validator-option@^7.16.7": + version "7.16.7" + resolved "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.16.7.tgz" + integrity sha512-TRtenOuRUVo9oIQGPC5G9DgK4743cdxvtOw0weQNpZXaS16SCBi5MNjZF8vba3ETURjZpTbVn7Vvcf2eAwFozQ== + +"@babel/helpers@^7.16.7": + version "7.16.7" + resolved "https://registry.npmjs.org/@babel/helpers/-/helpers-7.16.7.tgz" + integrity sha512-9ZDoqtfY7AuEOt3cxchfii6C7GDyyMBffktR5B2jvWv8u2+efwvpnVKXMWzNehqy68tKgAfSwfdw/lWpthS2bw== + dependencies: + "@babel/template" "^7.16.7" + "@babel/traverse" "^7.16.7" + "@babel/types" "^7.16.7" + +"@babel/highlight@^7.10.4", "@babel/highlight@^7.16.7": + version "7.16.7" + resolved "https://registry.npmjs.org/@babel/highlight/-/highlight-7.16.7.tgz" + integrity sha512-aKpPMfLvGO3Q97V0qhw/V2SWNWlwfJknuwAunU7wZLSfrM4xTBvg7E5opUVi1kJTBKihE38CPg4nBiqX83PWYw== + dependencies: + "@babel/helper-validator-identifier" "^7.16.7" chalk "^2.0.0" js-tokens "^4.0.0" -"@babel/parser@^7.10.4", "@babel/parser@^7.11.0", "@babel/parser@^7.11.1", "@babel/parser@^7.9.4": - version "7.11.3" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.11.3.tgz#9e1eae46738bcd08e23e867bab43e7b95299a8f9" - integrity sha512-REo8xv7+sDxkKvoxEywIdsNFiZLybwdI7hcT5uEPyQrSMB4YQ973BfC9OOrD/81MaIjh6UxdulIQXkjmiH3PcA== - -"@babel/parser@^7.2.3": - version "7.7.3" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.7.3.tgz#5fad457c2529de476a248f75b0f090b3060af043" - integrity sha512-bqv+iCo9i+uLVbI0ILzKkvMorqxouI+GbV13ivcARXn9NNEabi2IEz912IgNpT/60BNXac5dgcfjb94NjsF33A== +"@babel/parser@^7.16.7", "@babel/parser@^7.16.8", "@babel/parser@^7.2.3", "@babel/parser@^7.9.4": + version "7.16.8" + resolved "https://registry.npmjs.org/@babel/parser/-/parser-7.16.8.tgz" + integrity sha512-i7jDUfrVBWc+7OKcBzEe5n7fbv3i2fWtxKzzCvOjnzSxMfWMigAhtfJ7qzZNGFNMsCCd67+uz553dYKWXPvCKw== "@babel/polyfill@^7.4.4": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/polyfill/-/polyfill-7.7.0.tgz#e1066e251e17606ec7908b05617f9b7f8180d8f3" - integrity sha512-/TS23MVvo34dFmf8mwCisCbWGrfhbiWZSwBo6HkADTBhUa2Q/jWltyY/tpofz/b6/RIhqaqQcquptCirqIhOaQ== + version "7.12.1" + resolved "https://registry.npmjs.org/@babel/polyfill/-/polyfill-7.12.1.tgz" + integrity sha512-X0pi0V6gxLi6lFZpGmeNa4zxtwEmCs42isWLNjZZDE0Y8yVfgu0T2OAHlzBbdYlqbW/YXVvoBHpATEM+goCj8g== dependencies: core-js "^2.6.5" - regenerator-runtime "^0.13.2" + regenerator-runtime "^0.13.4" "@babel/runtime@^7.7.6": - version "7.11.2" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.11.2.tgz#f549c13c754cc40b87644b9fa9f09a6a95fe0736" - integrity sha512-TeWkU52so0mPtDcaCTxNBI/IHiz0pZgr8VEFqXFtZWpYD08ZB6FaSwVAS8MKRQAP3bYKiVjwysOJgMFY28o6Tw== + version "7.16.7" + resolved "https://registry.npmjs.org/@babel/runtime/-/runtime-7.16.7.tgz" + integrity sha512-9E9FJowqAsytyOY6LG+1KuueckRL+aQW+mKvXRXnuFGyRAyepJPmEo9vgMfXUA6O9u3IeEdv9MAkppFcaQwogQ== dependencies: regenerator-runtime "^0.13.4" -"@babel/template@^7.10.4": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.10.4.tgz#3251996c4200ebc71d1a8fc405fba940f36ba278" - integrity sha512-ZCjD27cGJFUB6nmCB1Enki3r+L5kJveX9pq1SvAUKoICy6CZ9yD8xO086YXdYhvNjBdnekm4ZnaP5yC8Cs/1tA== - dependencies: - "@babel/code-frame" "^7.10.4" - "@babel/parser" "^7.10.4" - "@babel/types" "^7.10.4" - -"@babel/traverse@^7.10.4", "@babel/traverse@^7.11.0": - version "7.11.0" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.11.0.tgz#9b996ce1b98f53f7c3e4175115605d56ed07dd24" - integrity sha512-ZB2V+LskoWKNpMq6E5UUCrjtDUh5IOTAyIl0dTjIEoXum/iKWkoIEKIRDnUucO6f+2FzNkE0oD4RLKoPIufDtg== - dependencies: - "@babel/code-frame" "^7.10.4" - "@babel/generator" "^7.11.0" - "@babel/helper-function-name" "^7.10.4" - "@babel/helper-split-export-declaration" "^7.11.0" - "@babel/parser" "^7.11.0" - "@babel/types" "^7.11.0" +"@babel/template@^7.16.7": + version "7.16.7" + resolved "https://registry.npmjs.org/@babel/template/-/template-7.16.7.tgz" + integrity sha512-I8j/x8kHUrbYRTUxXrrMbfCa7jxkE7tZre39x3kjr9hvI82cK1FfqLygotcWN5kdPGWcLdWMHpSBavse5tWw3w== + dependencies: + "@babel/code-frame" "^7.16.7" + "@babel/parser" "^7.16.7" + "@babel/types" "^7.16.7" + +"@babel/traverse@^7.1.6", "@babel/traverse@^7.16.7": + version "7.16.8" + resolved "https://registry.npmjs.org/@babel/traverse/-/traverse-7.16.8.tgz" + integrity sha512-xe+H7JlvKsDQwXRsBhSnq1/+9c+LlQcCK3Tn/l5sbx02HYns/cn7ibp9+RV1sIUqu7hKg91NWsgHurO9dowITQ== + dependencies: + "@babel/code-frame" "^7.16.7" + "@babel/generator" "^7.16.8" + "@babel/helper-environment-visitor" "^7.16.7" + "@babel/helper-function-name" "^7.16.7" + "@babel/helper-hoist-variables" "^7.16.7" + "@babel/helper-split-export-declaration" "^7.16.7" + "@babel/parser" "^7.16.8" + "@babel/types" "^7.16.8" debug "^4.1.0" globals "^11.1.0" - lodash "^4.17.19" -"@babel/types@^7.0.0": - version "7.7.2" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.7.2.tgz#550b82e5571dcd174af576e23f0adba7ffc683f7" - integrity sha512-YTf6PXoh3+eZgRCBzzP25Bugd2ngmpQVrk7kXX0i5N9BO7TFBtIgZYs7WtxtOGs8e6A4ZI7ECkbBCEHeXocvOA== +"@babel/types@^7.0.0", "@babel/types@^7.16.7", "@babel/types@^7.16.8", "@babel/types@^7.2.0": + version "7.16.8" + resolved "https://registry.npmjs.org/@babel/types/-/types-7.16.8.tgz" + integrity sha512-smN2DQc5s4M7fntyjGtyIPbRJv6wW4rU/94fmYJ7PKQuZkC0qGMHXJbg6sNGt12JmVr4k5YaptI/XtiLJBnmIg== dependencies: - esutils "^2.0.2" - lodash "^4.17.13" + "@babel/helper-validator-identifier" "^7.16.7" to-fast-properties "^2.0.0" -"@babel/types@^7.10.4", "@babel/types@^7.11.0": - version "7.11.0" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.11.0.tgz#2ae6bf1ba9ae8c3c43824e5861269871b206e90d" - integrity sha512-O53yME4ZZI0jO1EVGtF1ePGl0LHirG4P1ibcD80XyzZcKhcMFeCXmh4Xb1ifGBIV233Qg12x4rBfQgA+tmOukA== - dependencies: - "@babel/helper-validator-identifier" "^7.10.4" - lodash "^4.17.19" - to-fast-properties "^2.0.0" +"@bcoe/v8-coverage@^0.2.3": + version "0.2.3" + resolved "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz" + integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@jest/console@^24.9.0": - version "24.9.0" - resolved "https://registry.yarnpkg.com/@jest/console/-/console-24.9.0.tgz#79b1bc06fb74a8cfb01cbdedf945584b1b9707f0" - integrity sha512-Zuj6b8TnKXi3q4ymac8EQfc3ea/uhLeCGThFqXeC8H9/raaH8ARPUTdId+XyGd03Z4In0/VjD2OYFcBF09fNLQ== +"@eslint/eslintrc@^0.4.3": + version "0.4.3" + resolved "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.3.tgz" + integrity sha512-J6KFFz5QCYUJq3pf0mjEcCJVERbzv71PUIDczuh9JkwGEzced6CO5ADLHB1rbf/+oPBtoPfMYNOpGDzCANlbXw== dependencies: - "@jest/source-map" "^24.9.0" - chalk "^2.0.1" - slash "^2.0.0" + ajv "^6.12.4" + debug "^4.1.1" + espree "^7.3.0" + globals "^13.9.0" + ignore "^4.0.6" + import-fresh "^3.2.1" + js-yaml "^3.13.1" + minimatch "^3.0.4" + strip-json-comments "^3.1.1" -"@jest/source-map@^24.9.0": - version "24.9.0" - resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-24.9.0.tgz#0e263a94430be4b41da683ccc1e6bffe2a191714" - integrity sha512-/Xw7xGlsZb4MJzNDgB7PW5crou5JqWiBQaz6xyPd3ArOg2nfn/PunV8+olXbbEZzNl591o5rWKE9BRDaFAuIBg== +"@humanwhocodes/config-array@^0.5.0": + version "0.5.0" + resolved "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.5.0.tgz" + integrity sha512-FagtKFz74XrTl7y6HCzQpwDfXP0yhxe9lHLD1UZxjvZIcbyRz8zTFF/yYNfSfzU414eDwZ1SrO0Qvtyf+wFMQg== dependencies: - callsites "^3.0.0" - graceful-fs "^4.1.15" - source-map "^0.6.0" + "@humanwhocodes/object-schema" "^1.2.0" + debug "^4.1.1" + minimatch "^3.0.4" -"@jest/test-result@^24.9.0": - version "24.9.0" - resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-24.9.0.tgz#11796e8aa9dbf88ea025757b3152595ad06ba0ca" - integrity sha512-XEFrHbBonBJ8dGp2JmF8kP/nQI/ImPpygKHwQ/SY+es59Z3L5PI4Qb9TQQMAEeYsThG1xF0k6tmG0tIKATNiiA== - dependencies: - "@jest/console" "^24.9.0" - "@jest/types" "^24.9.0" - "@types/istanbul-lib-coverage" "^2.0.0" +"@humanwhocodes/object-schema@^1.2.0": + version "1.2.1" + resolved "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz" + integrity sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA== + +"@istanbuljs/schema@^0.1.2": + version "0.1.3" + resolved "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz" + integrity sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA== -"@jest/types@^24.9.0": - version "24.9.0" - resolved "https://registry.yarnpkg.com/@jest/types/-/types-24.9.0.tgz#63cb26cb7500d069e5a389441a7c6ab5e909fc59" - integrity sha512-XKK7ze1apu5JWQ5eZjHITP66AX+QsLlbaJRBGYr8pNzwcAE2JVkwnf0yqjHTsDRcjR0mujy/NmZMXw5kl+kGBw== +"@jest/types@^26.6.2": + version "26.6.2" + resolved "https://registry.npmjs.org/@jest/types/-/types-26.6.2.tgz" + integrity sha512-fC6QCp7Sc5sX6g8Tvbmj4XUTbyrik0akgRy03yjXbQaBWWNWGE7SGtJk98m0N8nzegD/7SggrUlivxo5ax4KWQ== dependencies: "@types/istanbul-lib-coverage" "^2.0.0" - "@types/istanbul-reports" "^1.1.1" - "@types/yargs" "^13.0.0" + "@types/istanbul-reports" "^3.0.0" + "@types/node" "*" + "@types/yargs" "^15.0.0" + chalk "^4.0.0" -"@jest/types@^26.2.0": - version "26.2.0" - resolved "https://registry.yarnpkg.com/@jest/types/-/types-26.2.0.tgz#b28ca1fb517a4eb48c0addea7fcd9edc4ab45721" - integrity sha512-lvm3rJvctxd7+wxKSxxbzpDbr4FXDLaC57WEKdUIZ2cjTYuxYSc0zlyD7Z4Uqr5VdKxRUrtwIkiqBuvgf8uKJA== +"@jest/types@^27.4.2": + version "27.4.2" + resolved "https://registry.npmjs.org/@jest/types/-/types-27.4.2.tgz" + integrity sha512-j35yw0PMTPpZsUoOBiuHzr1zTYoad1cVIE0ajEjcrJONxxrko/IRGKkXx3os0Nsi4Hu3+5VmDbVfq5WhG/pWAg== dependencies: "@types/istanbul-lib-coverage" "^2.0.0" - "@types/istanbul-reports" "^1.1.1" + "@types/istanbul-reports" "^3.0.0" "@types/node" "*" - "@types/yargs" "^15.0.0" + "@types/yargs" "^16.0.0" chalk "^4.0.0" -"@matrix-org/olm@https://gitlab.matrix.org/api/v4/projects/27/packages/npm/@matrix-org/olm/-/@matrix-org/olm-3.2.4.tgz": - version "3.2.4" - resolved "https://gitlab.matrix.org/api/v4/projects/27/packages/npm/@matrix-org/olm/-/@matrix-org/olm-3.2.4.tgz#edc0156a17eb1087df44f6e0b153ef0c9d454495" +"@napi-rs/cli@^2.2.0": + version "2.4.2" + resolved "https://registry.yarnpkg.com/@napi-rs/cli/-/cli-2.4.2.tgz#89b32c7d8776004bc9617915605aea769339cf6f" + integrity sha512-+yCOuPqernvD8BMphbadF87ElaJ0rjanOZrbnauaEdR07YyoalGw3FTk15HHyflIwQKlYd69gkG5EM4WFkICKw== + +"@selderee/plugin-htmlparser2@^0.6.0": + version "0.6.0" + resolved "https://registry.npmjs.org/@selderee/plugin-htmlparser2/-/plugin-htmlparser2-0.6.0.tgz" + integrity sha512-J3jpy002TyBjd4N/p6s+s90eX42H2eRhK3SbsZuvTDv977/E8p2U3zikdiehyJja66do7FlxLomZLPlvl2/xaA== + dependencies: + domhandler "^4.2.0" + selderee "^0.6.0" + +"@turt2live/matrix-sdk-crypto-nodejs@^0.1.0-beta.10": + version "0.1.0-beta.10" + resolved "https://registry.yarnpkg.com/@turt2live/matrix-sdk-crypto-nodejs/-/matrix-sdk-crypto-nodejs-0.1.0-beta.10.tgz#9b0a8e1f48badeb37a0b0f8eb0fb6dc9bbb1949a" + integrity sha512-y5TA8fD5a7xaIwjZhQ66eT3scDsU47GkcCuQ0vjlXB0shY2cCMB4MF1nY/7c1/DniM+KvDXxrhs2VXphlPLpaA== + dependencies: + "@napi-rs/cli" "^2.2.0" + shelljs "^0.8.4" "@types/babel-types@*", "@types/babel-types@^7.0.0": - version "7.0.9" - resolved "https://registry.yarnpkg.com/@types/babel-types/-/babel-types-7.0.9.tgz#01d7b86949f455402a94c788883fe4ba574cad41" - integrity sha512-qZLoYeXSTgQuK1h7QQS16hqLGdmqtRmN8w/rl3Au/l5x/zkHx+a4VHrHyBsi1I1vtK2oBHxSzKIu0R5p6spdOA== + version "7.0.11" + resolved "https://registry.npmjs.org/@types/babel-types/-/babel-types-7.0.11.tgz" + integrity sha512-pkPtJUUY+Vwv6B1inAz55rQvivClHJxc9aVEPPmaq2cbyeMLCiDpbKpcKyX4LAwpNGi+SHBv0tHv6+0gXv0P2A== "@types/babylon@^6.16.2": - version "6.16.5" - resolved "https://registry.yarnpkg.com/@types/babylon/-/babylon-6.16.5.tgz#1c5641db69eb8cdf378edd25b4be7754beeb48b4" - integrity sha512-xH2e58elpj1X4ynnKp9qSnWlsRTIs6n3tgLGNfwAGHwePw0mulHQllV34n0T25uYSu1k0hRKkWXF890B1yS47w== + version "6.16.6" + resolved "https://registry.npmjs.org/@types/babylon/-/babylon-6.16.6.tgz" + integrity sha512-G4yqdVlhr6YhzLXFKy5F7HtRBU8Y23+iWy7UKthMq/OSQnL1hbsoeXESQ2LY8zEDlknipDG3nRGhUC9tkwvy/w== dependencies: "@types/babel-types" "*" -"@types/better-sqlite3@^5.4.3": - version "5.4.3" - resolved "https://registry.yarnpkg.com/@types/better-sqlite3/-/better-sqlite3-5.4.3.tgz#4f1142c02db111627d9c5792f8aa349fcf46d100" - integrity sha512-d4T8Htgz3sQL3u5oVwkWipZLBYUooKEA4fhU9Sp4F6VDIhifQo1NR/IDtnAIID0Y9IXV3TQnNhv6S+m8TnkEdg== - dependencies: - "@types/integer" "*" - "@types/body-parser@*": - version "1.19.0" - resolved "https://registry.yarnpkg.com/@types/body-parser/-/body-parser-1.19.0.tgz#0685b3c47eb3006ffed117cdd55164b61f80538f" - integrity sha512-W98JrE0j2K78swW4ukqMleo8R7h/pFETjM2DQ90MF6XK2i4LO4W3gQ71Lt4w3bfm2EvVSyWHplECvB5sK22yFQ== + version "1.19.2" + resolved "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.2.tgz" + integrity sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g== dependencies: "@types/connect" "*" "@types/node" "*" -"@types/color-name@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@types/color-name/-/color-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0" - integrity sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ== - "@types/connect@*": - version "3.4.33" - resolved "https://registry.yarnpkg.com/@types/connect/-/connect-3.4.33.tgz#31610c901eca573b8713c3330abc6e6b9f588546" - integrity sha512-2+FrkXY4zllzTNfJth7jOqEHC+enpLeGslEhpnTAkg21GkRrWV4SsAtqchtT4YS9/nODBU2/ZfsBY2X4J/dX7A== + version "3.4.35" + resolved "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz" + integrity sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ== dependencies: "@types/node" "*" "@types/eslint-visitor-keys@^1.0.0": version "1.0.0" - resolved "https://registry.yarnpkg.com/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#1ee30d79544ca84d68d4b3cdb0af4f205663dd2d" + resolved "https://registry.npmjs.org/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz" integrity sha512-OCutwjDZ4aFS6PB1UZ988C4YgwlBHJd6wCeQqaLdmadZ/7e+w79+hbMUFC1QXDNCmdyoRfAFdm0RypzwR+Qpag== "@types/expect@^24.3.0": version "24.3.0" - resolved "https://registry.yarnpkg.com/@types/expect/-/expect-24.3.0.tgz#d7cab8b3c10c2d92a0cbb31981feceb81d3486f1" + resolved "https://registry.npmjs.org/@types/expect/-/expect-24.3.0.tgz" integrity sha512-aq5Z+YFBz5o2b6Sp1jigx5nsmoZMK5Ceurjwy6PZmRv7dEi1jLtkARfvB1ME+OXJUG+7TZUDcv3WoCr/aor6dQ== dependencies: expect "*" "@types/express-serve-static-core@^4.17.18": - version "4.17.24" - resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-4.17.24.tgz#ea41f93bf7e0d59cd5a76665068ed6aab6815c07" - integrity sha512-3UJuW+Qxhzwjq3xhwXm2onQcFHn76frIYVbTu+kn24LFxI+dEhdfISDFovPB8VpEgW8oQCTpRuCe+0zJxB7NEA== + version "4.17.28" + resolved "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.28.tgz" + integrity sha512-P1BJAEAW3E2DJUlkgq4tOL3RyMunoWXqbSCygWo5ZIWTjUgN1YnaXWW4VWl/oc8vs/XoYibEGBKP0uZyF4AHig== dependencies: "@types/node" "*" "@types/qs" "*" @@ -334,7 +339,7 @@ "@types/express@^4.17.13": version "4.17.13" - resolved "https://registry.yarnpkg.com/@types/express/-/express-4.17.13.tgz#a76e2995728999bab51a33fabce1d705a3709034" + resolved "https://registry.npmjs.org/@types/express/-/express-4.17.13.tgz" integrity sha512-6bSZTPaTIACxn48l50SR+axgrqm6qXFIxrdAKaG6PaJk3+zuUr35hBlgT7vOmJcum+OEaIBLtHV/qloEAFITeA== dependencies: "@types/body-parser" "*" @@ -342,74 +347,68 @@ "@types/qs" "*" "@types/serve-static" "*" -"@types/integer@*": - version "4.0.1" - resolved "https://registry.yarnpkg.com/@types/integer/-/integer-4.0.1.tgz#022f2c77a899e383e6d3dd374142416c22a5b9df" - integrity sha512-QQojPymFcV1hrvWXA1h0pP9RmFBFNuWikZcUEjjVsS19IyKO+jqOX24lp2ZHF4A21EmkosJhJDX7CLG67F2s7A== - -"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0": - version "2.0.1" - resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz#42995b446db9a48a11a07ec083499a860e9138ff" - integrity sha512-hRJD2ahnnpLgsj6KWMYSrmXkM3rm2Dl1qkx6IOFD5FnuNPXJIG5L0dhgKXCYTRMGzU4n0wImQ/xfmRc4POUFlg== +"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0", "@types/istanbul-lib-coverage@^2.0.1": + version "2.0.4" + resolved "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz" + integrity sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g== "@types/istanbul-lib-report@*": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@types/istanbul-lib-report/-/istanbul-lib-report-1.1.1.tgz#e5471e7fa33c61358dd38426189c037a58433b8c" - integrity sha512-3BUTyMzbZa2DtDI2BkERNC6jJw2Mr2Y0oGI7mRxYNBPxppbtEK1F66u3bKwU2g+wxwWI7PAoRpJnOY1grJqzHg== + version "3.0.0" + resolved "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz" + integrity sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg== dependencies: "@types/istanbul-lib-coverage" "*" -"@types/istanbul-reports@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-1.1.1.tgz#7a8cbf6a406f36c8add871625b278eaf0b0d255a" - integrity sha512-UpYjBi8xefVChsCoBpKShdxTllC9pwISirfoZsUa2AAdQg/Jd2KQGtSbw+ya7GPo7x/wAPlH6JBhKhAsXUEZNA== +"@types/istanbul-reports@^3.0.0": + version "3.0.1" + resolved "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz" + integrity sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw== dependencies: - "@types/istanbul-lib-coverage" "*" "@types/istanbul-lib-report" "*" "@types/json-schema@^7.0.3": - version "7.0.5" - resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.5.tgz#dcce4430e64b443ba8945f0290fb564ad5bac6dd" - integrity sha512-7+2BITlgjgDhH0vvwZU/HZJVyk+2XUlvxXe8dFMedNX/aMkaOq++rMAFXc0tM7ij15QaWlbdQASBR9dihi+bDQ== + version "7.0.9" + resolved "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.9.tgz" + integrity sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ== "@types/json5@^0.0.29": version "0.0.29" - resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" + resolved "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz" integrity sha1-7ihweulOEdK4J7y+UnC86n8+ce4= "@types/mime@^1": version "1.3.2" - resolved "https://registry.yarnpkg.com/@types/mime/-/mime-1.3.2.tgz#93e25bf9ee75fe0fd80b594bc4feb0e862111b5a" + resolved "https://registry.npmjs.org/@types/mime/-/mime-1.3.2.tgz" integrity sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw== "@types/mocha@^8.0.1": - version "8.0.1" - resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-8.0.1.tgz#813b4ff8dd9920d652e1e6b451ff1e371a4561d2" - integrity sha512-TBZ6YdX7IZz4U9/mBoB8zCMRN1vXw8QdihRcZxD3I0Cv/r8XF8RggZ8WiXFws4aj5atzRR5hJrYer7g8nXwpnQ== + version "8.2.3" + resolved "https://registry.npmjs.org/@types/mocha/-/mocha-8.2.3.tgz" + integrity sha512-ekGvFhFgrc2zYQoX4JeZPmVzZxw6Dtllga7iGHzfbYIYkAMUx/sAFP2GdFpLff+vdHXu5fl7WX9AT+TtqYcsyw== "@types/node@*": - version "12.12.8" - resolved "https://registry.yarnpkg.com/@types/node/-/node-12.12.8.tgz#dab418655af39ce2fa99286a0bed21ef8072ac9d" - integrity sha512-XLla8N+iyfjvsa0KKV+BP/iGSoTmwxsu5Ci5sM33z9TjohF72DEz95iNvD6pPmemvbQgxAv/909G73gUn8QR7w== + version "17.0.8" + resolved "https://registry.npmjs.org/@types/node/-/node-17.0.8.tgz" + integrity sha512-YofkM6fGv4gDJq78g4j0mMuGMkZVxZDgtU0JRdx6FgiJDG+0fY0GKVolOV8WqVmEhLCXkQRjwDdKyPxJp/uucg== -"@types/node@10": - version "10.17.4" - resolved "https://registry.yarnpkg.com/@types/node/-/node-10.17.4.tgz#8993a4fe3c4022fda66bf4ea660d615fc5659c6f" - integrity sha512-F2pgg+LcIr/elguz+x+fdBX5KeZXGUOp7TV8M0TVIrDezYLFRNt8oMTyps0VQ1kj5WGGoR18RdxnRDHXrIFHMQ== +"@types/node@^14": + version "14.18.5" + resolved "https://registry.npmjs.org/@types/node/-/node-14.18.5.tgz" + integrity sha512-LMy+vDDcQR48EZdEx5wRX1q/sEl6NdGuHXPnfeL8ixkwCOSZ2qnIyIZmcCbdX0MeRqHhAcHmX+haCbrS8Run+A== "@types/qs@*": - version "6.9.4" - resolved "https://registry.yarnpkg.com/@types/qs/-/qs-6.9.4.tgz#a59e851c1ba16c0513ea123830dd639a0a15cb6a" - integrity sha512-+wYo+L6ZF6BMoEjtf8zB2esQsqdV6WsjRK/GP9WOgLPrq87PbNWgIxS76dS5uvl/QXtHGakZmwTznIfcPXcKlQ== + version "6.9.7" + resolved "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz" + integrity sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw== "@types/range-parser@*": - version "1.2.3" - resolved "https://registry.yarnpkg.com/@types/range-parser/-/range-parser-1.2.3.tgz#7ee330ba7caafb98090bece86a5ee44115904c2c" - integrity sha512-ewFXqrQHlFsgc09MK5jP5iR7vumV/BYayNC6PgJO2LPe8vrnNFyjQjSppfEngITi0qvfKtzFvgKymGheFM9UOA== + version "1.2.4" + resolved "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.4.tgz" + integrity sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw== "@types/serve-static@*": version "1.13.10" - resolved "https://registry.yarnpkg.com/@types/serve-static/-/serve-static-1.13.10.tgz#f5e0ce8797d2d7cc5ebeda48a52c96c4fa47a8d9" + resolved "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.13.10.tgz" integrity sha512-nCkHGI4w7ZgAdNkrEu0bv+4xNV/XDqW+DydknebMOQwkpDGx8G+HTlj7R7ABI8i8nKxVw0wtKPi1D+lPOkh4YQ== dependencies: "@types/mime" "^1" @@ -417,87 +416,87 @@ "@types/simple-mock@^0.8.2": version "0.8.2" - resolved "https://registry.yarnpkg.com/@types/simple-mock/-/simple-mock-0.8.2.tgz#84acf2b5b10f3f92923e3022cc62488312d8f48a" + resolved "https://registry.npmjs.org/@types/simple-mock/-/simple-mock-0.8.2.tgz" integrity sha512-qBnFpNNlMyiHN9X7U3g50o1ADDkniYGIqhkWSkDSpJMvu5XzYO9PPvvyazEDrXwhByPXDxlpAaQXGAjZmvwLYQ== -"@types/stack-utils@^1.0.1": - version "1.0.1" - resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-1.0.1.tgz#0a851d3bd96498fa25c33ab7278ed3bd65f06c3e" - integrity sha512-l42BggppR6zLmpfU6fq9HEa2oGPEI8yrSPL3GITjfRInppYFahObbIQOQK3UGxEnyQpltZLaPe75046NOZQikw== +"@types/stack-utils@^2.0.0": + version "2.0.1" + resolved "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.1.tgz" + integrity sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw== "@types/yargs-parser@*": - version "13.1.0" - resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-13.1.0.tgz#c563aa192f39350a1d18da36c5a8da382bbd8228" - integrity sha512-gCubfBUZ6KxzoibJ+SCUc/57Ms1jz5NjHe4+dI2krNmU5zCPAphyLJYyTOg06ueIyfj+SaCUqmzun7ImlxDcKg== + version "20.2.1" + resolved "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-20.2.1.tgz" + integrity sha512-7tFImggNeNBVMsn0vLrpn1H1uPrUBdnARPTpZoitY37ZrdJREzf7I16tMrlK3hen349gr1NYh8CmZQa7CTG6Aw== -"@types/yargs@^13.0.0": - version "13.0.3" - resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-13.0.3.tgz#76482af3981d4412d65371a318f992d33464a380" - integrity sha512-K8/LfZq2duW33XW/tFwEAfnZlqIfVsoyRB3kfXdPXYhl0nfM8mmh7GS0jg7WrX2Dgq/0Ha/pR1PaR+BvmWwjiQ== +"@types/yargs@^15.0.0": + version "15.0.14" + resolved "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.14.tgz" + integrity sha512-yEJzHoxf6SyQGhBhIYGXQDSCkJjB6HohDShto7m8vaKg9Yp0Yn8+71J9eakh2bnPg6BfsH9PRMhiRTZnd4eXGQ== dependencies: "@types/yargs-parser" "*" -"@types/yargs@^15.0.0": - version "15.0.5" - resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-15.0.5.tgz#947e9a6561483bdee9adffc983e91a6902af8b79" - integrity sha512-Dk/IDOPtOgubt/IaevIUbTgV7doaKkoorvOyYM2CMwuDyP89bekI7H4xLIwunNYiK9jhCkmc6pUrJk3cj2AB9w== +"@types/yargs@^16.0.0": + version "16.0.4" + resolved "https://registry.npmjs.org/@types/yargs/-/yargs-16.0.4.tgz" + integrity sha512-T8Yc9wt/5LbJyCaLiHPReJa0kApcIgJ7Bn735GjItUfh08Z1pJvu8QZqb9s+mMvKV6WUQRV7K2R46YbjMXTTJw== dependencies: "@types/yargs-parser" "*" "@typescript-eslint/eslint-plugin-tslint@^3.8.0": - version "3.8.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin-tslint/-/eslint-plugin-tslint-3.8.0.tgz#9b0f1d0f26408c2ab170f878eb51d1a096d9b82c" - integrity sha512-21JffyPyqES8g5dG4ae+gLQDdujsf0CsGzQTIsttToJLE/Q3i682N2weg0re3Y4L44DBvuyxw4EpVE31vFFuAg== + version "3.10.1" + resolved "https://registry.npmjs.org/@typescript-eslint/eslint-plugin-tslint/-/eslint-plugin-tslint-3.10.1.tgz" + integrity sha512-DD2sr8Qkoi0TUYlbxLGMivTvMz3i5s8qt7n3/ptWSO3fSQlnf43OeM6tQCujC1MWEKoOwDnyCuMehWwNm3Xi0w== dependencies: - "@typescript-eslint/experimental-utils" "3.8.0" + "@typescript-eslint/experimental-utils" "3.10.1" lodash "^4.17.15" "@typescript-eslint/eslint-plugin@^3.8.0": - version "3.8.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-3.8.0.tgz#f82947bcdd9a4e42be7ad80dfd61f1dc411dd1df" - integrity sha512-lFb4VCDleFSR+eo4Ew+HvrJ37ZH1Y9ZyE+qyP7EiwBpcCVxwmUc5PAqhShCQ8N8U5vqYydm74nss+a0wrrCErw== + version "3.10.1" + resolved "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-3.10.1.tgz" + integrity sha512-PQg0emRtzZFWq6PxBcdxRH3QIQiyFO3WCVpRL3fgj5oQS3CDs3AeAKfv4DxNhzn8ITdNJGJ4D3Qw8eAJf3lXeQ== dependencies: - "@typescript-eslint/experimental-utils" "3.8.0" + "@typescript-eslint/experimental-utils" "3.10.1" debug "^4.1.1" functional-red-black-tree "^1.0.1" regexpp "^3.0.0" semver "^7.3.2" tsutils "^3.17.1" -"@typescript-eslint/experimental-utils@3.8.0": - version "3.8.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-3.8.0.tgz#ac1f7c88322dcfb7635ece6f0441516dd951099a" - integrity sha512-o8T1blo1lAJE0QDsW7nSyvZHbiDzQDjINJKyB44Z3sSL39qBy5L10ScI/XwDtaiunoyKGLiY9bzRk4YjsUZl8w== +"@typescript-eslint/experimental-utils@3.10.1": + version "3.10.1" + resolved "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-3.10.1.tgz" + integrity sha512-DewqIgscDzmAfd5nOGe4zm6Bl7PKtMG2Ad0KG8CUZAHlXfAKTF9Ol5PXhiMh39yRL2ChRH1cuuUGOcVyyrhQIw== dependencies: "@types/json-schema" "^7.0.3" - "@typescript-eslint/types" "3.8.0" - "@typescript-eslint/typescript-estree" "3.8.0" + "@typescript-eslint/types" "3.10.1" + "@typescript-eslint/typescript-estree" "3.10.1" eslint-scope "^5.0.0" eslint-utils "^2.0.0" "@typescript-eslint/parser@^3.8.0": - version "3.8.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-3.8.0.tgz#8e1dcd404299bf79492409c81c415fa95a7c622b" - integrity sha512-u5vjOBaCsnMVQOvkKCXAmmOhyyMmFFf5dbkM3TIbg3MZ2pyv5peE4gj81UAbTHwTOXEwf7eCQTUMKrDl/+qGnA== + version "3.10.1" + resolved "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-3.10.1.tgz" + integrity sha512-Ug1RcWcrJP02hmtaXVS3axPPTTPnZjupqhgj+NnZ6BCkwSImWk/283347+x9wN+lqOdK9Eo3vsyiyDHgsmiEJw== dependencies: "@types/eslint-visitor-keys" "^1.0.0" - "@typescript-eslint/experimental-utils" "3.8.0" - "@typescript-eslint/types" "3.8.0" - "@typescript-eslint/typescript-estree" "3.8.0" + "@typescript-eslint/experimental-utils" "3.10.1" + "@typescript-eslint/types" "3.10.1" + "@typescript-eslint/typescript-estree" "3.10.1" eslint-visitor-keys "^1.1.0" -"@typescript-eslint/types@3.8.0": - version "3.8.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-3.8.0.tgz#58581dd863f86e0cd23353d94362bb90b4bea796" - integrity sha512-8kROmEQkv6ss9kdQ44vCN1dTrgu4Qxrd2kXr10kz2NP5T8/7JnEfYNxCpPkArbLIhhkGLZV3aVMplH1RXQRF7Q== +"@typescript-eslint/types@3.10.1": + version "3.10.1" + resolved "https://registry.npmjs.org/@typescript-eslint/types/-/types-3.10.1.tgz" + integrity sha512-+3+FCUJIahE9q0lDi1WleYzjCwJs5hIsbugIgnbB+dSCYUxl8L6PwmsyOPFZde2hc1DlTo/xnkOgiTLSyAbHiQ== -"@typescript-eslint/typescript-estree@3.8.0": - version "3.8.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-3.8.0.tgz#0606d19f629f813dbdd5a34c7a1e895d6191cac6" - integrity sha512-MTv9nPDhlKfclwnplRNDL44mP2SY96YmPGxmMbMy6x12I+pERcxpIUht7DXZaj4mOKKtet53wYYXU0ABaiXrLw== +"@typescript-eslint/typescript-estree@3.10.1": + version "3.10.1" + resolved "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-3.10.1.tgz" + integrity sha512-QbcXOuq6WYvnB3XPsZpIwztBoquEYLXh2MtwVU+kO8jgYCiv4G5xrSP/1wg4tkvrEE+esZVquIPX/dxPlePk1w== dependencies: - "@typescript-eslint/types" "3.8.0" - "@typescript-eslint/visitor-keys" "3.8.0" + "@typescript-eslint/types" "3.10.1" + "@typescript-eslint/visitor-keys" "3.10.1" debug "^4.1.1" glob "^7.1.6" is-glob "^4.0.1" @@ -505,16 +504,21 @@ semver "^7.3.2" tsutils "^3.17.1" -"@typescript-eslint/visitor-keys@3.8.0": - version "3.8.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-3.8.0.tgz#ad35110249fb3fc30a36bfcbfeea93e710cfaab1" - integrity sha512-gfqQWyVPpT9NpLREXNR820AYwgz+Kr1GuF3nf1wxpHD6hdxI62tq03ToomFnDxY0m3pUB39IF7sil7D5TQexLA== +"@typescript-eslint/visitor-keys@3.10.1": + version "3.10.1" + resolved "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-3.10.1.tgz" + integrity sha512-9JgC82AaQeglebjZMgYR5wgmfUdUc+EitGUUMW8u2nDckaeimzW+VsoLV6FoimPv2id3VQzfjwBxEMVz08ameQ== dependencies: eslint-visitor-keys "^1.1.0" +"@ungap/promise-all-settled@1.1.2": + version "1.1.2" + resolved "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz" + integrity sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q== + accepts@~1.3.7: version "1.3.7" - resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.7.tgz#531bc726517a3b2b41f850021c6cc15eaab507cd" + resolved "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz" integrity sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA== dependencies: mime-types "~2.1.24" @@ -522,44 +526,54 @@ accepts@~1.3.7: acorn-globals@^3.0.0: version "3.1.0" - resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-3.1.0.tgz#fd8270f71fbb4996b004fa880ee5d46573a731bf" + resolved "https://registry.npmjs.org/acorn-globals/-/acorn-globals-3.1.0.tgz" integrity sha1-/YJw9x+7SZawBPqIDuXUZXOnMb8= dependencies: acorn "^4.0.4" -acorn-jsx@^5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.2.0.tgz#4c66069173d6fdd68ed85239fc256226182b2ebe" - integrity sha512-HiUX/+K2YpkpJ+SzBffkM/AQ2YE03S0U1kjTLVpoJdhZMOWy8qvXVN9JdLqv2QsaQ6MPYQIuNmwD8zOiYUofLQ== +acorn-jsx@^5.3.1: + version "5.3.2" + resolved "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz" + integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== acorn@^3.1.0: version "3.3.0" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a" + resolved "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz" integrity sha1-ReN/s56No/JbruP/U2niu18iAXo= acorn@^4.0.4, acorn@~4.0.2: version "4.0.13" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.13.tgz#105495ae5361d697bd195c825192e1ad7f253787" + resolved "https://registry.npmjs.org/acorn/-/acorn-4.0.13.tgz" integrity sha1-EFSVrlNh1pe9GVyCUZLhrX8lN4c= -acorn@^7.3.1: - version "7.4.0" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.0.tgz#e1ad486e6c54501634c6c397c5c121daa383607c" - integrity sha512-+G7P8jJmCHr+S+cLfQxygbWhXy+8YTVGzAkpEbcLo2mLoL7tij/VG41QSHACSf5QgYRhMZYHuNc6drJaO0Da+w== +acorn@^7.4.0: + version "7.4.1" + resolved "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz" + integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A== -ajv@^6.10.0, ajv@^6.10.2, ajv@^6.12.3: - version "6.12.3" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.3.tgz#18c5af38a111ddeb4f2697bd78d68abc1cabd706" - integrity sha512-4K0cK3L1hsqk9xIb2z9vs/XU+PGJZ9PNpJRDS9YLzmNdX6jmVPfamLvTJr0aDAusnHyCHO6MjzlkAsgtqp9teA== +ajv@^6.10.0, ajv@^6.12.3, ajv@^6.12.4: + version "6.12.6" + resolved "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz" + integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== dependencies: fast-deep-equal "^3.1.1" fast-json-stable-stringify "^2.0.0" json-schema-traverse "^0.4.1" uri-js "^4.2.2" +ajv@^8.0.1: + version "8.8.2" + resolved "https://registry.npmjs.org/ajv/-/ajv-8.8.2.tgz" + integrity sha512-x9VuX+R/jcFj1DHo/fCp99esgGDWiHENrKxaCENuCxpoMCmAt/COCGVDwA7kleEpEzJjDnvh3yGoOuLu0Dtllw== + dependencies: + fast-deep-equal "^3.1.1" + json-schema-traverse "^1.0.0" + require-from-string "^2.0.2" + uri-js "^4.2.2" + align-text@^0.1.1, align-text@^0.1.3: version "0.1.4" - resolved "https://registry.yarnpkg.com/align-text/-/align-text-0.1.4.tgz#0cd90a561093f35d0a99256c22b7069433fad117" + resolved "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz" integrity sha1-DNkKVhCT810KmSVsIrcGlDP60Rc= dependencies: kind-of "^3.0.2" @@ -568,185 +582,130 @@ align-text@^0.1.1, align-text@^0.1.3: another-json@^0.2.0: version "0.2.0" - resolved "https://registry.yarnpkg.com/another-json/-/another-json-0.2.0.tgz#b5f4019c973b6dd5c6506a2d93469cb6d32aeedc" + resolved "https://registry.npmjs.org/another-json/-/another-json-0.2.0.tgz" integrity sha1-tfQBnJc7bdXGUGotk0acttMq7tw= ansi-colors@4.1.1, ansi-colors@^4.1.1: version "4.1.1" - resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.1.tgz#cbb9ae256bf750af1eab344f229aa27fe94ba348" + resolved "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz" integrity sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA== -ansi-regex@^2.0.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" - integrity sha1-w7M6te42DYbg5ijwRorn7yfWVN8= - ansi-regex@^3.0.0: version "3.0.0" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" + resolved "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz" integrity sha1-7QMXwyIGT3lGbAKWa922Bas32Zg= -ansi-regex@^4.0.0, ansi-regex@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997" - integrity sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg== - -ansi-regex@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75" - integrity sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg== +ansi-regex@^5.0.0, ansi-regex@^5.0.1: + version "5.0.1" + resolved "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz" + integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== -ansi-styles@^3.2.0, ansi-styles@^3.2.1: +ansi-styles@^3.2.1: version "3.2.1" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" + resolved "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz" integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== dependencies: color-convert "^1.9.0" -ansi-styles@^4.0.0: - version "4.2.1" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.2.1.tgz#90ae75c424d008d2624c5bf29ead3177ebfcf359" - integrity sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA== +ansi-styles@^4.0.0, ansi-styles@^4.1.0: + version "4.3.0" + resolved "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz" + integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== dependencies: - "@types/color-name" "^1.1.1" color-convert "^2.0.1" -ansi-styles@^4.1.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.2.0.tgz#5681f0dcf7ae5880a7841d8831c4724ed9cc0172" - integrity sha512-7kFQgnEaMdRtwf6uSfUnVr9gSGC7faurn+J/Mv90/W+iTtN0405/nLdopfMWwchyxhbGYl6TC4Sccn9TUkGAgg== - dependencies: - "@types/color-name" "^1.1.1" - color-convert "^2.0.1" +ansi-styles@^5.0.0: + version "5.2.0" + resolved "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz" + integrity sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA== anymatch@~3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.1.tgz#c55ecf02185e2469259399310c173ce31233b142" - integrity sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg== + version "3.1.2" + resolved "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz" + integrity sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg== dependencies: normalize-path "^3.0.0" picomatch "^2.0.4" -aproba@^1.0.3: - version "1.2.0" - resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a" - integrity sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw== - -are-we-there-yet@~1.1.2: - version "1.1.5" - resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz#4b35c2944f062a8bfcda66410760350fe9ddfc21" - integrity sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w== - dependencies: - delegates "^1.0.0" - readable-stream "^2.0.6" - argparse@^1.0.7: version "1.0.10" - resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" + resolved "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz" integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== dependencies: sprintf-js "~1.0.2" -arr-diff@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520" - integrity sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA= - -arr-flatten@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/arr-flatten/-/arr-flatten-1.1.0.tgz#36048bbff4e7b47e136644316c99669ea5ae91f1" - integrity sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg== - -arr-union@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4" - integrity sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ= +argparse@^2.0.1: + version "2.0.1" + resolved "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz" + integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== array-flatten@1.1.1: version "1.1.1" - resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2" + resolved "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz" integrity sha1-ml9pkFGx5wczKPKgCJaLZOopVdI= -array-unique@^0.3.2: - version "0.3.2" - resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" - integrity sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg= - -array.prototype.map@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/array.prototype.map/-/array.prototype.map-1.0.2.tgz#9a4159f416458a23e9483078de1106b2ef68f8ec" - integrity sha512-Az3OYxgsa1g7xDYp86l0nnN4bcmuEITGe1rbdEBVkrqkzMgDcbdQ2R7r41pNzti+4NMces3H8gMmuioZUilLgw== - dependencies: - define-properties "^1.1.3" - es-abstract "^1.17.0-next.1" - es-array-method-boxes-properly "^1.0.0" - is-string "^1.0.4" - arrify@^1.0.0: version "1.0.1" - resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" + resolved "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz" integrity sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0= asap@~2.0.3: version "2.0.6" - resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46" + resolved "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz" integrity sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY= asn1@~0.2.3: - version "0.2.4" - resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.4.tgz#8d2475dfab553bb33e77b54e59e880bb8ce23136" - integrity sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg== + version "0.2.6" + resolved "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz" + integrity sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ== dependencies: safer-buffer "~2.1.0" assert-plus@1.0.0, assert-plus@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" + resolved "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz" integrity sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU= -assign-symbols@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367" - integrity sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c= - ast-types@0.12.4, ast-types@^0.12.2: version "0.12.4" - resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.12.4.tgz#71ce6383800f24efc9a1a3308f3a6e420a0974d1" + resolved "https://registry.npmjs.org/ast-types/-/ast-types-0.12.4.tgz" integrity sha512-ky/YVYCbtVAS8TdMIaTiPFHwEpRB5z1hctepJplTr3UW5q8TDrpIMCILyk8pmLxGtn2KCtC/lSn7zOsaI7nzDw== -ast-types@^0.13.2: - version "0.13.3" - resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.13.3.tgz#50da3f28d17bdbc7969a3a2d83a0e4a72ae755a7" - integrity sha512-XTZ7xGML849LkQP86sWdQzfhwbt3YwIO6MqbX9mUNYY98VKaaVZP7YNNm70IpwecbkkxmfC5IYAzOQ/2p29zRA== +ast-types@^0.14.2: + version "0.14.2" + resolved "https://registry.npmjs.org/ast-types/-/ast-types-0.14.2.tgz" + integrity sha512-O0yuUDnZeQDL+ncNGlJ78BiO4jnYI3bvMsD5prT0/nsgijG/LpNBIr63gTjVTNsiGkgQhiyCShTgxt8oXOrklA== + dependencies: + tslib "^2.0.1" -astral-regex@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9" - integrity sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg== +astral-regex@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz" + integrity sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ== asynckit@^0.4.0: version "0.4.0" - resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" + resolved "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz" integrity sha1-x57Zf380y48robyXkLzDZkdLS3k= -atob@^2.1.1: - version "2.1.2" - resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" - integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg== +available-typed-arrays@^1.0.5: + version "1.0.5" + resolved "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz" + integrity sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw== aws-sign2@~0.7.0: version "0.7.0" - resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" + resolved "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz" integrity sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg= aws4@^1.8.0: - version "1.8.0" - resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.8.0.tgz#f0e003d9ca9e7f59c7a508945d7b2ef9a04a542f" - integrity sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ== + version "1.11.0" + resolved "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz" + integrity sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA== babel-runtime@^6.26.0: version "6.26.0" - resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe" + resolved "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz" integrity sha1-llxwWGaOgrVde/4E/yM3vItWR/4= dependencies: core-js "^2.4.0" @@ -754,7 +713,7 @@ babel-runtime@^6.26.0: babel-types@^6.26.0: version "6.26.0" - resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.26.0.tgz#a3b073f94ab49eb6fa55cd65227a334380632497" + resolved "https://registry.npmjs.org/babel-types/-/babel-types-6.26.0.tgz" integrity sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc= dependencies: babel-runtime "^6.26.0" @@ -764,49 +723,31 @@ babel-types@^6.26.0: babylon@^6.18.0: version "6.18.0" - resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.18.0.tgz#af2f3b88fa6f5c1e4c634d1a0f8eac4f55b395e3" + resolved "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz" integrity sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ== balanced-match@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" - integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= - -base64-js@^1.3.1: - version "1.5.1" - resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" - integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== - -base@^0.11.1: - version "0.11.2" - resolved "https://registry.yarnpkg.com/base/-/base-0.11.2.tgz#7bde5ced145b6d551a90db87f83c558b4eb48a8f" - integrity sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg== - dependencies: - cache-base "^1.0.1" - class-utils "^0.3.5" - component-emitter "^1.2.1" - define-property "^1.0.0" - isobject "^3.0.1" - mixin-deep "^1.2.0" - pascalcase "^0.1.1" + version "1.0.2" + resolved "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz" + integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== basic-auth@~2.0.1: version "2.0.1" - resolved "https://registry.yarnpkg.com/basic-auth/-/basic-auth-2.0.1.tgz#b998279bf47ce38344b4f3cf916d4679bbf51e3a" + resolved "https://registry.npmjs.org/basic-auth/-/basic-auth-2.0.1.tgz" integrity sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg== dependencies: safe-buffer "5.1.2" bcrypt-pbkdf@^1.0.0: version "1.0.2" - resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz#a4301d389b6a43f9b67ff3ca11a3f6637e360e9e" + resolved "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz" integrity sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4= dependencies: tweetnacl "^0.14.3" better-docs@^2.3.2: version "2.3.2" - resolved "https://registry.yarnpkg.com/better-docs/-/better-docs-2.3.2.tgz#0de059301c49669a4350409d8c235868cf8bcbf7" + resolved "https://registry.npmjs.org/better-docs/-/better-docs-2.3.2.tgz" integrity sha512-VlbXQgEftaynJSaPa853XB5WqTlPoQQr2TnxIkKi6OsyJJxF42Ke+9SIES/hqTe58aaBnuoDGrIzOso8RdNx6Q== dependencies: brace "^0.11.1" @@ -818,65 +759,35 @@ better-docs@^2.3.2: vue-docgen-api "^3.22.0" vue2-ace-editor "^0.0.13" -better-sqlite3@^7.4.3: - version "7.4.3" - resolved "https://registry.yarnpkg.com/better-sqlite3/-/better-sqlite3-7.4.3.tgz#8e45a4164bf4b4e128d97375023550f780550997" - integrity sha512-07bKjClZg/f4KMVRkzWtoIvazVPcF1gsvVKVIXlxwleC2DxuIhnra3KCMlUT1rFeRYXXckot2a46UciF2d9KLw== - dependencies: - bindings "^1.5.0" - prebuild-install "^6.0.1" - tar "^6.1.0" - binary-extensions@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.1.0.tgz#30fa40c9e7fe07dbc895678cd287024dea241dd9" - integrity sha512-1Yj8h9Q+QDF5FzhMs/c9+6UntbD5MkRfRwac8DoEm9ZfUBZ7tZ55YcGVAzEe4bXsdQHEk+s9S5wsOKVdZrw0tQ== - -bindings@^1.5.0: - version "1.5.0" - resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.5.0.tgz#10353c9e945334bc0511a6d90b38fbc7c9c504df" - integrity sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ== - dependencies: - file-uri-to-path "1.0.0" - -bl@^4.0.3: - version "4.1.0" - resolved "https://registry.yarnpkg.com/bl/-/bl-4.1.0.tgz#451535264182bec2fbbc83a62ab98cf11d9f7b3a" - integrity sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w== - dependencies: - buffer "^5.5.0" - inherits "^2.0.4" - readable-stream "^3.4.0" - -bluebird@^3.5.0: - version "3.7.1" - resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.1.tgz#df70e302b471d7473489acf26a93d63b53f874de" - integrity sha512-DdmyoGCleJnkbp3nkbxTLJ18rjDsE4yCggEwKNXkeV123sPNfOCYeDoeuOY+F2FrSjO1YXcTU+dsy96KMy+gcg== + version "2.2.0" + resolved "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz" + integrity sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA== -bluebird@^3.7.2: +bluebird@^3.5.0, bluebird@^3.7.2: version "3.7.2" - resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" + resolved "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz" integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== -body-parser@1.19.0: - version "1.19.0" - resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.19.0.tgz#96b2709e57c9c4e09a6fd66a8fd979844f69f08a" - integrity sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw== +body-parser@1.19.1: + version "1.19.1" + resolved "https://registry.npmjs.org/body-parser/-/body-parser-1.19.1.tgz" + integrity sha512-8ljfQi5eBk8EJfECMrgqNGWPEY5jWP+1IzkzkGdFFEwFQZZyaZ21UqdaHktgiMlH0xLHqIFtE/u2OYE5dOtViA== dependencies: - bytes "3.1.0" + bytes "3.1.1" content-type "~1.0.4" debug "2.6.9" depd "~1.1.2" - http-errors "1.7.2" + http-errors "1.8.1" iconv-lite "0.4.24" on-finished "~2.3.0" - qs "6.7.0" - raw-body "2.4.0" - type-is "~1.6.17" + qs "6.9.6" + raw-body "2.4.2" + type-is "~1.6.18" brace-expansion@^1.1.7: version "1.1.11" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" + resolved "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz" integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== dependencies: balanced-match "^1.0.0" @@ -884,138 +795,141 @@ brace-expansion@^1.1.7: brace@^0.11.0, brace@^0.11.1: version "0.11.1" - resolved "https://registry.yarnpkg.com/brace/-/brace-0.11.1.tgz#4896fcc9d544eef45f4bb7660db320d3b379fe58" + resolved "https://registry.npmjs.org/brace/-/brace-0.11.1.tgz" integrity sha1-SJb8ydVE7vRfS7dmDbMg07N5/lg= -braces@^2.3.1: - version "2.3.2" - resolved "https://registry.yarnpkg.com/braces/-/braces-2.3.2.tgz#5979fd3f14cd531565e5fa2df1abfff1dfaee729" - integrity sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w== - dependencies: - arr-flatten "^1.1.0" - array-unique "^0.3.2" - extend-shallow "^2.0.1" - fill-range "^4.0.0" - isobject "^3.0.1" - repeat-element "^1.1.2" - snapdragon "^0.8.1" - snapdragon-node "^2.0.1" - split-string "^3.0.2" - to-regex "^3.0.1" - braces@^3.0.1, braces@~3.0.2: version "3.0.2" - resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" + resolved "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz" integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== dependencies: fill-range "^7.0.1" browser-stdout@1.3.1: version "1.3.1" - resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.1.tgz#baa559ee14ced73452229bad7326467c61fabd60" + resolved "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz" integrity sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw== -buffer-from@^1.0.0, buffer-from@^1.1.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" - integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== - -buffer@^5.5.0: - version "5.7.1" - resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.7.1.tgz#ba62e7c13133053582197160851a8f648e99eed0" - integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ== +browserslist@^4.17.5: + version "4.19.1" + resolved "https://registry.npmjs.org/browserslist/-/browserslist-4.19.1.tgz" + integrity sha512-u2tbbG5PdKRTUoctO3NBD8FQ5HdPh1ZXPHzp1rwaa5jTc+RV9/+RlWiAIKmjRPQF+xbGM9Kklj5bZQFa2s/38A== dependencies: - base64-js "^1.3.1" - ieee754 "^1.1.13" + caniuse-lite "^1.0.30001286" + electron-to-chromium "^1.4.17" + escalade "^3.1.1" + node-releases "^2.0.1" + picocolors "^1.0.0" + +buffer-from@^1.0.0, buffer-from@^1.1.0: + version "1.1.2" + resolved "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz" + integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== builtin-modules@^1.1.1: version "1.1.1" - resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" + resolved "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz" integrity sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8= -bytes@3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.0.tgz#f6cf7933a360e0588fa9fde85651cdc7f805d1f6" - integrity sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg== +bytes@3.1.1: + version "3.1.1" + resolved "https://registry.npmjs.org/bytes/-/bytes-3.1.1.tgz" + integrity sha512-dWe4nWO/ruEOY7HkUJ5gFt1DCFV9zPRoJr8pV0/ASQermOZjtq8jMjOprC0Kd10GLN+l7xaUPvxzJFWtxGu8Fg== -cache-base@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/cache-base/-/cache-base-1.0.1.tgz#0a7f46416831c8b662ee36fe4e7c59d76f666ab2" - integrity sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ== - dependencies: - collection-visit "^1.0.0" - component-emitter "^1.2.1" - get-value "^2.0.6" - has-value "^1.0.0" - isobject "^3.0.1" - set-value "^2.0.0" - to-object-path "^0.3.0" - union-value "^1.0.0" - unset-value "^1.0.0" +c8@^7.6.0: + version "7.11.0" + resolved "https://registry.npmjs.org/c8/-/c8-7.11.0.tgz" + integrity sha512-XqPyj1uvlHMr+Y1IeRndC2X5P7iJzJlEJwBpCdBbq2JocXOgJfr+JVfJkyNMGROke5LfKrhSFXGFXnwnRJAUJw== + dependencies: + "@bcoe/v8-coverage" "^0.2.3" + "@istanbuljs/schema" "^0.1.2" + find-up "^5.0.0" + foreground-child "^2.0.0" + istanbul-lib-coverage "^3.0.1" + istanbul-lib-report "^3.0.0" + istanbul-reports "^3.0.2" + rimraf "^3.0.0" + test-exclude "^6.0.0" + v8-to-istanbul "^8.0.0" + yargs "^16.2.0" + yargs-parser "^20.2.7" + +call-bind@^1.0.0, call-bind@^1.0.2: + version "1.0.2" + resolved "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz" + integrity sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA== + dependencies: + function-bind "^1.1.1" + get-intrinsic "^1.0.2" callsites@^3.0.0: version "3.1.0" - resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" + resolved "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz" integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== camelcase@^1.0.2: version "1.2.1" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-1.2.1.tgz#9bb5304d2e0b56698b2c758b08a3eaa9daa58a39" + resolved "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz" integrity sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk= -camelcase@^5.0.0, camelcase@^5.3.1: - version "5.3.1" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" - integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== +camelcase@^6.0.0: + version "6.3.0" + resolved "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz" + integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== + +caniuse-lite@^1.0.30001286: + version "1.0.30001299" + resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001299.tgz" + integrity sha512-iujN4+x7QzqA2NCSrS5VUy+4gLmRd4xv6vbBBsmfVqTx8bLAD8097euLqQgKxSVLvxjSDcvF1T/i9ocgnUFexw== caseless@~0.12.0: version "0.12.0" - resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" + resolved "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz" integrity sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw= catharsis@^0.9.0: version "0.9.0" - resolved "https://registry.yarnpkg.com/catharsis/-/catharsis-0.9.0.tgz#40382a168be0e6da308c277d3a2b3eb40c7d2121" + resolved "https://registry.npmjs.org/catharsis/-/catharsis-0.9.0.tgz" integrity sha512-prMTQVpcns/tzFgFVkVp6ak6RykZyWb3gu8ckUpd6YkTlacOd3DXGJjIpD4Q6zJirizvaiAjSSHlOsA+6sNh2A== dependencies: lodash "^4.17.15" center-align@^0.1.1: version "0.1.3" - resolved "https://registry.yarnpkg.com/center-align/-/center-align-0.1.3.tgz#aa0d32629b6ee972200411cbd4461c907bc2b7ad" + resolved "https://registry.npmjs.org/center-align/-/center-align-0.1.3.tgz" integrity sha1-qg0yYptu6XIgBBHL1EYckHvCt60= dependencies: align-text "^0.1.3" lazy-cache "^1.0.3" -chalk@^2.0.0, chalk@^2.0.1, chalk@^2.3.0, chalk@^2.4.2: +chalk@^2.0.0, chalk@^2.3.0: version "2.4.2" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" + resolved "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz" integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== dependencies: ansi-styles "^3.2.1" escape-string-regexp "^1.0.5" supports-color "^5.3.0" -chalk@^4.0.0, chalk@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.0.tgz#4e14870a618d9e2edd97dd8345fd9d9dc315646a" - integrity sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A== +chalk@^4, chalk@^4.0.0: + version "4.1.2" + resolved "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz" + integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== dependencies: ansi-styles "^4.1.0" supports-color "^7.1.0" character-parser@^2.1.1: version "2.2.0" - resolved "https://registry.yarnpkg.com/character-parser/-/character-parser-2.2.0.tgz#c7ce28f36d4bcd9744e5ffc2c5fcde1c73261fc0" + resolved "https://registry.npmjs.org/character-parser/-/character-parser-2.2.0.tgz" integrity sha1-x84o821LzZdE5f/CxfzeHHMmH8A= dependencies: is-regex "^1.0.3" -chokidar@3.3.1: - version "3.3.1" - resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.3.1.tgz#c84e5b3d18d9a4d77558fef466b1bf16bbeb3450" - integrity sha512-4QYCEWOcK3OJrxwvyyAOxFuhpvOVCYkr33LPfFNBjAD/w3sEzWsp2BUOkI4l9bHvWioAd0rc6NlHUOEaWkTeqg== +chokidar@3.5.1: + version "3.5.1" + resolved "https://registry.npmjs.org/chokidar/-/chokidar-3.5.1.tgz" + integrity sha512-9+s+Od+W0VJJzawDma/gvBNQqkTiqYTWLuZoyAsivsI4AaWTCzHG06/TMjsf1cYe9Cb97UCEhjz7HvnPk2p/tw== dependencies: anymatch "~3.1.1" braces "~3.0.2" @@ -1023,127 +937,79 @@ chokidar@3.3.1: is-binary-path "~2.1.0" is-glob "~4.0.1" normalize-path "~3.0.0" - readdirp "~3.3.0" + readdirp "~3.5.0" optionalDependencies: - fsevents "~2.1.2" - -chownr@^1.1.1: - version "1.1.4" - resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.4.tgz#6fc9d7b42d32a583596337666e7d08084da2cc6b" - integrity sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg== - -chownr@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/chownr/-/chownr-2.0.0.tgz#15bfbe53d2eab4cf70f18a8cd68ebe5b3cb1dece" - integrity sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ== - -class-utils@^0.3.5: - version "0.3.6" - resolved "https://registry.yarnpkg.com/class-utils/-/class-utils-0.3.6.tgz#f93369ae8b9a7ce02fd41faad0ca83033190c463" - integrity sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg== - dependencies: - arr-union "^3.1.0" - define-property "^0.2.5" - isobject "^3.0.0" - static-extend "^0.1.1" + fsevents "~2.3.1" clean-css@^4.1.11: - version "4.2.1" - resolved "https://registry.yarnpkg.com/clean-css/-/clean-css-4.2.1.tgz#2d411ef76b8569b6d0c84068dabe85b0aa5e5c17" - integrity sha512-4ZxI6dy4lrY6FHzfiy1aEOXgu4LIsW2MhwG0VBKdcoGoH/XLFgaHSdLTGr4O8Be6A8r3MOphEiI8Gc1n0ecf3g== + version "4.2.4" + resolved "https://registry.npmjs.org/clean-css/-/clean-css-4.2.4.tgz" + integrity sha512-EJUDT7nDVFDvaQgAo2G/PJvxmp1o/c6iXLbswsBbUFXi1Nr+AjA2cKmfbKDMjMvzEe75g3P6JkaDDAKk96A85A== dependencies: source-map "~0.6.0" cliui@^2.1.0: version "2.1.0" - resolved "https://registry.yarnpkg.com/cliui/-/cliui-2.1.0.tgz#4b475760ff80264c762c3a1719032e91c7fea0d1" + resolved "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz" integrity sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE= dependencies: center-align "^0.1.1" right-align "^0.1.1" wordwrap "0.0.2" -cliui@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/cliui/-/cliui-5.0.0.tgz#deefcfdb2e800784aa34f46fa08e06851c7bbbc5" - integrity sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA== - dependencies: - string-width "^3.1.0" - strip-ansi "^5.2.0" - wrap-ansi "^5.1.0" - -code-point-at@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" - integrity sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c= - -collection-visit@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/collection-visit/-/collection-visit-1.0.0.tgz#4bc0373c164bc3291b4d368c829cf1a80a59dca0" - integrity sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA= +cliui@^7.0.2: + version "7.0.4" + resolved "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz" + integrity sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ== dependencies: - map-visit "^1.0.0" - object-visit "^1.0.0" + string-width "^4.2.0" + strip-ansi "^6.0.0" + wrap-ansi "^7.0.0" color-convert@^1.9.0: version "1.9.3" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" + resolved "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz" integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== dependencies: color-name "1.1.3" color-convert@^2.0.1: version "2.0.1" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" + resolved "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz" integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== dependencies: color-name "~1.1.4" color-name@1.1.3: version "1.1.3" - resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" + resolved "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz" integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= color-name@~1.1.4: version "1.1.4" - resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" + resolved "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz" integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== -colorette@^1.2.2: - version "1.2.2" - resolved "https://registry.yarnpkg.com/colorette/-/colorette-1.2.2.tgz#cbcc79d5e99caea2dbf10eb3a26fd8b3e6acfa94" - integrity sha512-MKGMzyfeuutC/ZJ1cba9NqcNpfeqMUcYmyF1ZFY6/Cn7CNSAKx6a+s48sqLqyAiZuaP2TcqMhoo+dlwFnVxT9w== - combined-stream@^1.0.6, combined-stream@~1.0.6: version "1.0.8" - resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" + resolved "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz" integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== dependencies: delayed-stream "~1.0.0" commander@^2.12.1, commander@^2.19.0: version "2.20.3" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" + resolved "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz" integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== -component-emitter@^1.2.1: - version "1.3.0" - resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.3.0.tgz#16e4070fba8ae29b679f2215853ee181ab2eabc0" - integrity sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg== - concat-map@0.0.1: version "0.0.1" - resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + resolved "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz" integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= -console-control-strings@^1.0.0, console-control-strings@~1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" - integrity sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4= - constantinople@^3.0.1, constantinople@^3.1.2: version "3.1.2" - resolved "https://registry.yarnpkg.com/constantinople/-/constantinople-3.1.2.tgz#d45ed724f57d3d10500017a7d3a889c1381ae647" + resolved "https://registry.npmjs.org/constantinople/-/constantinople-3.1.2.tgz" integrity sha512-yePcBqEFhLOqSBtwYOGGS1exHo/s1xjekXiinh4itpNQGCu4KA1euPh1fg07N2wMITZXQkBz75Ntdt1ctGZouw== dependencies: "@types/babel-types" "^7.0.0" @@ -1151,58 +1017,48 @@ constantinople@^3.0.1, constantinople@^3.1.2: babel-types "^6.26.0" babylon "^6.18.0" -content-disposition@0.5.3: - version "0.5.3" - resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-0.5.3.tgz#e130caf7e7279087c5616c2007d0485698984fbd" - integrity sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g== +content-disposition@0.5.4: + version "0.5.4" + resolved "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz" + integrity sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ== dependencies: - safe-buffer "5.1.2" + safe-buffer "5.2.1" content-type@~1.0.4: version "1.0.4" - resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.4.tgz#e138cc75e040c727b1966fe5e5f8c9aee256fe3b" + resolved "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz" integrity sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA== -convert-source-map@^1.7.0: - version "1.7.0" - resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.7.0.tgz#17a2cb882d7f77d3490585e2ce6c524424a3a442" - integrity sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA== +convert-source-map@^1.6.0, convert-source-map@^1.7.0: + version "1.8.0" + resolved "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.8.0.tgz" + integrity sha512-+OQdjP49zViI/6i7nIJpA8rAl4sV/JdPfU9nZs3VqOwGIgizICvuN2ru6fMd+4llL0tar18UYJXfZ/TWtmhUjA== dependencies: safe-buffer "~5.1.1" cookie-signature@1.0.6: version "1.0.6" - resolved "https://registry.yarnpkg.com/cookie-signature/-/cookie-signature-1.0.6.tgz#e303a882b342cc3ee8ca513a79999734dab3ae2c" + resolved "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz" integrity sha1-4wOogrNCzD7oylE6eZmXNNqzriw= -cookie@0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.4.0.tgz#beb437e7022b3b6d49019d088665303ebe9c14ba" - integrity sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg== - -copy-descriptor@^0.1.0: - version "0.1.1" - resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" - integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40= +cookie@0.4.1: + version "0.4.1" + resolved "https://registry.npmjs.org/cookie/-/cookie-0.4.1.tgz" + integrity sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA== -core-js@^2.4.0: +core-js@^2.4.0, core-js@^2.6.5: version "2.6.12" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.12.tgz#d9333dfa7b065e347cc5682219d6f690859cc2ec" + resolved "https://registry.npmjs.org/core-js/-/core-js-2.6.12.tgz" integrity sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ== -core-js@^2.6.5: - version "2.6.10" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.10.tgz#8a5b8391f8cc7013da703411ce5b585706300d7f" - integrity sha512-I39t74+4t+zau64EN1fE5v2W31Adtc/REhzWN+gWRRXg6WH5qAsZm62DHpQ1+Yhe4047T55jvzz7MUqF/dBBlA== - -core-util-is@1.0.2, core-util-is@~1.0.0: +core-util-is@1.0.2: version "1.0.2" - resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" + resolved "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz" integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= -cross-spawn@^7.0.2: +cross-spawn@^7.0.0, cross-spawn@^7.0.2: version "7.0.3" - resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" + resolved "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz" integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== dependencies: path-key "^3.1.0" @@ -1211,219 +1067,156 @@ cross-spawn@^7.0.2: dashdash@^1.12.0: version "1.14.1" - resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" + resolved "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz" integrity sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA= dependencies: assert-plus "^1.0.0" de-indent@^1.0.2: version "1.0.2" - resolved "https://registry.yarnpkg.com/de-indent/-/de-indent-1.0.2.tgz#b2038e846dc33baa5796128d0804b455b8c1e21d" + resolved "https://registry.npmjs.org/de-indent/-/de-indent-1.0.2.tgz" integrity sha1-sgOOhG3DO6pXlhKNCAS0VbjB4h0= -debug@2.6.9, debug@^2.2.0, debug@^2.3.3: +debug@2.6.9: version "2.6.9" - resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" + resolved "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz" integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== dependencies: ms "2.0.0" -debug@3.2.6: - version "3.2.6" - resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b" - integrity sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ== +debug@4.3.1: + version "4.3.1" + resolved "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz" + integrity sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ== dependencies: - ms "^2.1.1" + ms "2.1.2" debug@^4.0.1, debug@^4.1.0, debug@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791" - integrity sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw== + version "4.3.3" + resolved "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz" + integrity sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q== dependencies: - ms "^2.1.1" + ms "2.1.2" -decamelize@^1.0.0, decamelize@^1.2.0: +decamelize@^1.0.0: version "1.2.0" - resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" + resolved "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz" integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA= -decode-uri-component@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" - integrity sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU= - -decompress-response@^4.2.0: - version "4.2.1" - resolved "https://registry.yarnpkg.com/decompress-response/-/decompress-response-4.2.1.tgz#414023cc7a302da25ce2ec82d0d5238ccafd8986" - integrity sha512-jOSne2qbyE+/r8G1VU+G/82LBs2Fs4LAsTiLSHOCOMZQl2OKZ6i8i4IyHemTe+/yIXOtTcRQMzPcgyhoFlqPkw== - dependencies: - mimic-response "^2.0.0" - -deep-extend@^0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" - integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA== +decamelize@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz" + integrity sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ== deep-is@^0.1.3: - version "0.1.3" - resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" - integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ= + version "0.1.4" + resolved "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz" + integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== deepmerge@^4.2.2: version "4.2.2" - resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.2.2.tgz#44d2ea3679b8f4d4ffba33f03d865fc1e7bf4955" + resolved "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz" integrity sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg== -define-properties@^1.1.2, define-properties@^1.1.3, define-properties@~1.1.2: +define-properties@^1.1.3, define-properties@~1.1.2: version "1.1.3" - resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1" + resolved "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz" integrity sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ== dependencies: object-keys "^1.0.12" -define-property@^0.2.5: - version "0.2.5" - resolved "https://registry.yarnpkg.com/define-property/-/define-property-0.2.5.tgz#c35b1ef918ec3c990f9a5bc57be04aacec5c8116" - integrity sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY= - dependencies: - is-descriptor "^0.1.0" - -define-property@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/define-property/-/define-property-1.0.0.tgz#769ebaaf3f4a63aad3af9e8d304c9bbe79bfb0e6" - integrity sha1-dp66rz9KY6rTr56NMEybvnm/sOY= - dependencies: - is-descriptor "^1.0.0" - -define-property@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/define-property/-/define-property-2.0.2.tgz#d459689e8d654ba77e02a817f8710d702cb16e9d" - integrity sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ== - dependencies: - is-descriptor "^1.0.2" - isobject "^3.0.1" - delayed-stream@~1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" + resolved "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz" integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk= -delegates@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" - integrity sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o= - depd@~1.1.2: version "1.1.2" - resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.2.tgz#9bcd52e14c097763e749b274c4346ed2e560b5a9" + resolved "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz" integrity sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak= depd@~2.0.0: version "2.0.0" - resolved "https://registry.yarnpkg.com/depd/-/depd-2.0.0.tgz#b696163cc757560d09cf22cc8fad1571b79e76df" + resolved "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz" integrity sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw== destroy@~1.0.4: version "1.0.4" - resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.0.4.tgz#978857442c44749e4206613e37946205826abd80" + resolved "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz" integrity sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA= -detect-libc@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b" - integrity sha1-+hN8S9aY7fVc1c0CrFWfkaTEups= - diff-match-patch@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/diff-match-patch/-/diff-match-patch-1.0.4.tgz#6ac4b55237463761c4daf0dc603eb869124744b1" - integrity sha512-Uv3SW8bmH9nAtHKaKSanOQmj2DnlH65fUpcrMdfdaOxUG02QQ4YGZ8AE7kKOMisF7UqvOlGKVYWRvezdncW9lg== + version "1.0.5" + resolved "https://registry.npmjs.org/diff-match-patch/-/diff-match-patch-1.0.5.tgz" + integrity sha512-IayShXAgj/QMXgB0IWmKx+rOPuGMhqm5w6jvFxmVenXKIzRqTAAsbBPT3kWQeGANj3jGgvcvv4yK6SxqYmikgw== -diff-sequences@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-24.9.0.tgz#5715d6244e2aa65f48bba0bc972db0b0b11e95b5" - integrity sha512-Dj6Wk3tWyTE+Fo1rW8v0Xhwk80um6yFYKbuAxc9c3EZxIHFDYwbi34Uk42u1CdnIiVorvt4RmlSDjIPyzGC2ew== +diff-sequences@^26.6.2: + version "26.6.2" + resolved "https://registry.npmjs.org/diff-sequences/-/diff-sequences-26.6.2.tgz" + integrity sha512-Mv/TDa3nZ9sbc5soK+OoA74BsS3mL37yixCvUAQkiuA4Wz6YtwP/K47n2rv2ovzHZvoiQeA5FTQOschKkEwB0Q== -diff-sequences@^26.0.0: - version "26.0.0" - resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-26.0.0.tgz#0760059a5c287637b842bd7085311db7060e88a6" - integrity sha512-JC/eHYEC3aSS0vZGjuoc4vHA0yAQTzhQQldXMeMF+JlxLGJlCO38Gma82NV9gk1jGFz8mDzUMeaKXvjRRdJ2dg== +diff-sequences@^27.4.0: + version "27.4.0" + resolved "https://registry.npmjs.org/diff-sequences/-/diff-sequences-27.4.0.tgz" + integrity sha512-YqiQzkrsmHMH5uuh8OdQFU9/ZpADnwzml8z0O5HvRNda+5UZsaX/xN+AAxfR2hWq1Y7HZnAzO9J5lJXOuDz2Ww== -diff@4.0.2, diff@^4.0.1: - version "4.0.2" - resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" - integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== +diff@5.0.0: + version "5.0.0" + resolved "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz" + integrity sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w== diff@^3.1.0: version "3.5.0" - resolved "https://registry.yarnpkg.com/diff/-/diff-3.5.0.tgz#800c0dd1e0a8bfbc95835c202ad220fe317e5a12" + resolved "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz" integrity sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA== +diff@^4.0.1: + version "4.0.2" + resolved "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz" + integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== + +discontinuous-range@1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/discontinuous-range/-/discontinuous-range-1.0.0.tgz" + integrity sha1-44Mx8IRLukm5qctxx3FYWqsbxlo= + doctrine@^3.0.0: version "3.0.0" - resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961" + resolved "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz" integrity sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w== dependencies: esutils "^2.0.2" doctypes@^1.1.0: version "1.1.0" - resolved "https://registry.yarnpkg.com/doctypes/-/doctypes-1.1.0.tgz#ea80b106a87538774e8a3a4a5afe293de489e0a9" + resolved "https://registry.npmjs.org/doctypes/-/doctypes-1.1.0.tgz" integrity sha1-6oCxBqh1OHdOijpKWv4pPeSJ4Kk= -dom-serializer@^0.2.1: - version "0.2.2" - resolved "https://registry.yarnpkg.com/dom-serializer/-/dom-serializer-0.2.2.tgz#1afb81f533717175d478655debc5e332d9f9bb51" - integrity sha512-2/xPb3ORsQ42nHYiSunXkDjPLBaEj/xTwUO4B7XCZQTRk7EBtTOPaygh10YAAh2OI1Qrp6NWfpAhzswj0ydt9g== - dependencies: - domelementtype "^2.0.1" - entities "^2.0.0" - dom-serializer@^1.0.1: - version "1.3.1" - resolved "https://registry.yarnpkg.com/dom-serializer/-/dom-serializer-1.3.1.tgz#d845a1565d7c041a95e5dab62184ab41e3a519be" - integrity sha512-Pv2ZluG5ife96udGgEDovOOOA5UELkltfJpnIExPrAk1LTvecolUGn6lIaoLh86d83GiB86CjzciMd9BuRB71Q== + version "1.3.2" + resolved "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.3.2.tgz" + integrity sha512-5c54Bk5Dw4qAxNOI1pFEizPSjVsx5+bpJKmL2kPn8JhBUq2q09tTCa3mjijun2NfK78NMouDYNMBkOrPZiS+ig== dependencies: domelementtype "^2.0.1" - domhandler "^4.0.0" + domhandler "^4.2.0" entities "^2.0.0" -domelementtype@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-2.0.1.tgz#1f8bdfe91f5a78063274e803b4bdcedf6e94f94d" - integrity sha512-5HOHUDsYZWV8FGWN0Njbr/Rn7f/eWSQi1v7+HsUVwXgn8nWWlL64zKDkS0n8ZmQ3mlWOMuXOnR+7Nx/5tMO5AQ== - -domelementtype@^2.2.0: +domelementtype@^2.0.1, domelementtype@^2.2.0: version "2.2.0" - resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-2.2.0.tgz#9a0b6c2782ed6a1c7323d42267183df9bd8b1d57" + resolved "https://registry.npmjs.org/domelementtype/-/domelementtype-2.2.0.tgz" integrity sha512-DtBMo82pv1dFtUmHyr48beiuq792Sxohr+8Hm9zoxklYPfa6n0Z3Byjj2IV7bmr2IyqClnqEQhfgHJJ5QF0R5A== -domhandler@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/domhandler/-/domhandler-3.0.0.tgz#51cd13efca31da95bbb0c5bee3a48300e333b3e9" - integrity sha512-eKLdI5v9m67kbXQbJSNn1zjh0SDzvzWVWtX+qEI3eMjZw8daH9k8rlj1FZY9memPwjiskQFbe7vHVVJIAqoEhw== - dependencies: - domelementtype "^2.0.1" - domhandler@^4.0.0, domhandler@^4.2.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/domhandler/-/domhandler-4.2.0.tgz#f9768a5f034be60a89a27c2e4d0f74eba0d8b059" - integrity sha512-zk7sgt970kzPks2Bf+dwT/PLzghLnsivb9CcxkvR8Mzr66Olr0Ofd8neSbglHJHaHa2MadfoSdNlKYAaafmWfA== + version "4.3.0" + resolved "https://registry.npmjs.org/domhandler/-/domhandler-4.3.0.tgz" + integrity sha512-fC0aXNQXqKSFTr2wDNZDhsEYjCiYsDWl3D01kwt25hm1YIPyDGHvvi3rw+PLqHAl/m71MaiF7d5zvBr0p5UB2g== dependencies: domelementtype "^2.2.0" -domutils@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/domutils/-/domutils-2.1.0.tgz#7ade3201af43703fde154952e3a868eb4b635f16" - integrity sha512-CD9M0Dm1iaHfQ1R/TI+z3/JWp/pgub0j4jIQKH89ARR4ATAV2nbaOQS5XxU9maJP5jHaPdDDQSEHuE2UmpUTKg== - dependencies: - dom-serializer "^0.2.1" - domelementtype "^2.0.1" - domhandler "^3.0.0" - domutils@^2.5.2: - version "2.6.0" - resolved "https://registry.yarnpkg.com/domutils/-/domutils-2.6.0.tgz#2e15c04185d43fb16ae7057cb76433c6edb938b7" - integrity sha512-y0BezHuy4MDYxh6OvolXYsH+1EMGmFbwv5FKW7ovwMG6zTPWqNPq3WF9ayZssFq+UlKdffGLbOEaghNdaOm1WA== + version "2.8.0" + resolved "https://registry.npmjs.org/domutils/-/domutils-2.8.0.tgz" + integrity sha512-w96Cjofp72M5IIhpjgobBimYEfoPjx1Vx0BSX9P30WBdZW2WIKU0T1Bd0kz2eNZ9ikjKgHbEyKx8BB6H1L3h3A== dependencies: dom-serializer "^1.0.1" domelementtype "^2.2.0" @@ -1431,7 +1224,7 @@ domutils@^2.5.2: ecc-jsbn@~0.1.1: version "0.1.2" - resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9" + resolved "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz" integrity sha1-OoOpBOVDUyh4dMVkt1SThoSamMk= dependencies: jsbn "~0.1.0" @@ -1439,174 +1232,166 @@ ecc-jsbn@~0.1.1: ee-first@1.1.1: version "1.1.1" - resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" + resolved "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz" integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0= -emoji-regex@^7.0.1: - version "7.0.3" - resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156" - integrity sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA== +electron-to-chromium@^1.4.17: + version "1.4.46" + resolved "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.46.tgz" + integrity sha512-UtV0xUA/dibCKKP2JMxOpDtXR74zABevuUEH4K0tvduFSIoxRVcYmQsbB51kXsFTX8MmOyWMt8tuZAlmDOqkrQ== + +emoji-regex@^8.0.0: + version "8.0.0" + resolved "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz" + integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== encodeurl@~1.0.2: version "1.0.2" - resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59" + resolved "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz" integrity sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k= -end-of-stream@^1.1.0, end-of-stream@^1.4.1: - version "1.4.4" - resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0" - integrity sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q== - dependencies: - once "^1.4.0" - enquirer@^2.3.5: version "2.3.6" - resolved "https://registry.yarnpkg.com/enquirer/-/enquirer-2.3.6.tgz#2a7fe5dd634a1e4125a975ec994ff5456dc3734d" + resolved "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz" integrity sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg== dependencies: ansi-colors "^4.1.1" entities@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/entities/-/entities-2.0.0.tgz#68d6084cab1b079767540d80e56a39b423e4abf4" - integrity sha512-D9f7V0JSRwIxlRI2mjMqufDrRDnx8p+eEOz7aUM9SuvF8gsBzra0/6tbjl1m8eQHrZlYj6PxqE00hZ1SAIKPLw== + version "2.2.0" + resolved "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz" + integrity sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A== entities@~2.0.0: version "2.0.3" - resolved "https://registry.yarnpkg.com/entities/-/entities-2.0.3.tgz#5c487e5742ab93c15abb5da22759b8590ec03b7f" + resolved "https://registry.npmjs.org/entities/-/entities-2.0.3.tgz" integrity sha512-MyoZ0jgnLvB2X3Lg5HqpFmn1kybDiIfEQmKzTb5apr51Rb+T3KdmMiqa70T+bhGnyv7bQ6WMj2QMHpGMmlrUYQ== -es-abstract@^1.12.0: - version "1.16.0" - resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.16.0.tgz#d3a26dc9c3283ac9750dca569586e976d9dcc06d" - integrity sha512-xdQnfykZ9JMEiasTAJZJdMWCQ1Vm00NBw79/AWi7ELfZuuPCSOMDZbT9mkOfSctVtfhb+sAAzrm+j//GjjLHLg== - dependencies: - es-to-primitive "^1.2.0" - function-bind "^1.1.1" - has "^1.0.3" - has-symbols "^1.0.0" - is-callable "^1.1.4" - is-regex "^1.0.4" - object-inspect "^1.6.0" - object-keys "^1.1.1" - string.prototype.trimleft "^2.1.0" - string.prototype.trimright "^2.1.0" - -es-abstract@^1.17.0-next.1, es-abstract@^1.17.4, es-abstract@^1.17.5: - version "1.17.6" - resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.17.6.tgz#9142071707857b2cacc7b89ecb670316c3e2d52a" - integrity sha512-Fr89bON3WFyUi5EvAeI48QTWX0AyekGgLA8H+c+7fbfCkJwRWRMLd8CQedNEyJuoYYhmtEqY92pgte1FAhBlhw== +es-abstract@^1.18.5, es-abstract@^1.19.0, es-abstract@^1.19.1: + version "1.19.1" + resolved "https://registry.npmjs.org/es-abstract/-/es-abstract-1.19.1.tgz" + integrity sha512-2vJ6tjA/UfqLm2MPs7jxVybLoB8i1t1Jd9R3kISld20sIxPcTbLuggQOUxeWeAvIUkduv/CfMjuh4WmiXr2v9w== dependencies: + call-bind "^1.0.2" es-to-primitive "^1.2.1" function-bind "^1.1.1" + get-intrinsic "^1.1.1" + get-symbol-description "^1.0.0" has "^1.0.3" - has-symbols "^1.0.1" - is-callable "^1.2.0" - is-regex "^1.1.0" - object-inspect "^1.7.0" + has-symbols "^1.0.2" + internal-slot "^1.0.3" + is-callable "^1.2.4" + is-negative-zero "^2.0.1" + is-regex "^1.1.4" + is-shared-array-buffer "^1.0.1" + is-string "^1.0.7" + is-weakref "^1.0.1" + object-inspect "^1.11.0" object-keys "^1.1.1" - object.assign "^4.1.0" - string.prototype.trimend "^1.0.1" - string.prototype.trimstart "^1.0.1" - -es-array-method-boxes-properly@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/es-array-method-boxes-properly/-/es-array-method-boxes-properly-1.0.0.tgz#873f3e84418de4ee19c5be752990b2e44718d09e" - integrity sha512-wd6JXUmyHmt8T5a2xreUwKcGPq6f1f+WwIJkijUqiGcJz1qqnZgP6XIK+QyIWU5lT7imeNxUll48bziG+TSYcA== + object.assign "^4.1.2" + string.prototype.trimend "^1.0.4" + string.prototype.trimstart "^1.0.4" + unbox-primitive "^1.0.1" -es-get-iterator@^1.0.2: - version "1.1.0" - resolved "https://registry.yarnpkg.com/es-get-iterator/-/es-get-iterator-1.1.0.tgz#bb98ad9d6d63b31aacdc8f89d5d0ee57bcb5b4c8" - integrity sha512-UfrmHuWQlNMTs35e1ypnvikg6jCz3SK8v8ImvmDsh36fCVUR1MqoFDiyn0/k52C8NqO3YsO8Oe0azeesNuqSsQ== +es-get-iterator@^1.1.2: + version "1.1.2" + resolved "https://registry.npmjs.org/es-get-iterator/-/es-get-iterator-1.1.2.tgz" + integrity sha512-+DTO8GYwbMCwbywjimwZMHp8AuYXOS2JZFWoi2AlPOS3ebnII9w/NLpNZtA7A0YLaVDw+O7KFCeoIV7OPvM7hQ== dependencies: - es-abstract "^1.17.4" + call-bind "^1.0.2" + get-intrinsic "^1.1.0" has-symbols "^1.0.1" - is-arguments "^1.0.4" - is-map "^2.0.1" - is-set "^2.0.1" + is-arguments "^1.1.0" + is-map "^2.0.2" + is-set "^2.0.2" is-string "^1.0.5" isarray "^2.0.5" -es-to-primitive@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.2.0.tgz#edf72478033456e8dda8ef09e00ad9650707f377" - integrity sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg== - dependencies: - is-callable "^1.1.4" - is-date-object "^1.0.1" - is-symbol "^1.0.2" - es-to-primitive@^1.2.1: version "1.2.1" - resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.2.1.tgz#e55cd4c9cdc188bcefb03b366c736323fc5c898a" + resolved "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz" integrity sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA== dependencies: is-callable "^1.1.4" is-date-object "^1.0.1" is-symbol "^1.0.2" +escalade@^3.1.1: + version "3.1.1" + resolved "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz" + integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw== + escape-html@~1.0.3: version "1.0.3" - resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" + resolved "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz" integrity sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg= -escape-string-regexp@1.0.5, escape-string-regexp@^1.0.5: +escape-string-regexp@4.0.0, escape-string-regexp@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz" + integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== + +escape-string-regexp@^1.0.5: version "1.0.5" - resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + resolved "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz" integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= escape-string-regexp@^2.0.0: version "2.0.0" - resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz#a30304e99daa32e23b2fd20f51babd07cffca344" + resolved "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz" integrity sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w== -escape-string-regexp@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" - integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== - -eslint-scope@^5.0.0, eslint-scope@^5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.0.tgz#d0f971dfe59c69e0cada684b23d49dbf82600ce5" - integrity sha512-iiGRvtxWqgtx5m8EyQUJihBloE4EnYeGE/bz1wSPwJE6tZuJUtHlhqDM4Xj2ukE8Dyy1+HCZ4hE0fzIVMzb58w== +eslint-scope@^5.0.0, eslint-scope@^5.1.1: + version "5.1.1" + resolved "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz" + integrity sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw== dependencies: - esrecurse "^4.1.0" + esrecurse "^4.3.0" estraverse "^4.1.1" eslint-utils@^2.0.0, eslint-utils@^2.1.0: version "2.1.0" - resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-2.1.0.tgz#d2de5e03424e707dc10c74068ddedae708741b27" + resolved "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz" integrity sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg== dependencies: eslint-visitor-keys "^1.1.0" eslint-visitor-keys@^1.1.0, eslint-visitor-keys@^1.3.0: version "1.3.0" - resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz#30ebd1ef7c2fdff01c3a4f151044af25fab0523e" + resolved "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz" integrity sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ== +eslint-visitor-keys@^2.0.0: + version "2.1.0" + resolved "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz" + integrity sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw== + eslint@^7.6.0: - version "7.6.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.6.0.tgz#522d67cfaea09724d96949c70e7a0550614d64d6" - integrity sha512-QlAManNtqr7sozWm5TF4wIH9gmUm2hE3vNRUvyoYAa4y1l5/jxD/PQStEjBMQtCqZmSep8UxrcecI60hOpe61w== + version "7.32.0" + resolved "https://registry.npmjs.org/eslint/-/eslint-7.32.0.tgz" + integrity sha512-VHZ8gX+EDfz+97jGcgyGCyRia/dPOd6Xh9yPv8Bl1+SoaIwD+a/vlrOmGRUyOYu7MwUhc7CxqeaDZU13S4+EpA== dependencies: - "@babel/code-frame" "^7.0.0" + "@babel/code-frame" "7.12.11" + "@eslint/eslintrc" "^0.4.3" + "@humanwhocodes/config-array" "^0.5.0" ajv "^6.10.0" chalk "^4.0.0" cross-spawn "^7.0.2" debug "^4.0.1" doctrine "^3.0.0" enquirer "^2.3.5" - eslint-scope "^5.1.0" + escape-string-regexp "^4.0.0" + eslint-scope "^5.1.1" eslint-utils "^2.1.0" - eslint-visitor-keys "^1.3.0" - espree "^7.2.0" - esquery "^1.2.0" + eslint-visitor-keys "^2.0.0" + espree "^7.3.1" + esquery "^1.4.0" esutils "^2.0.2" - file-entry-cache "^5.0.1" + fast-deep-equal "^3.1.3" + file-entry-cache "^6.0.1" functional-red-black-tree "^1.0.1" - glob-parent "^5.0.0" - globals "^12.1.0" + glob-parent "^5.1.2" + globals "^13.6.0" ignore "^4.0.6" import-fresh "^3.0.0" imurmurhash "^0.1.4" @@ -1614,7 +1399,7 @@ eslint@^7.6.0: js-yaml "^3.13.1" json-stable-stringify-without-jsonify "^1.0.1" levn "^0.4.1" - lodash "^4.17.19" + lodash.merge "^4.6.2" minimatch "^3.0.4" natural-compare "^1.4.0" optionator "^0.9.1" @@ -1623,91 +1408,80 @@ eslint@^7.6.0: semver "^7.2.1" strip-ansi "^6.0.0" strip-json-comments "^3.1.0" - table "^5.2.3" + table "^6.0.9" text-table "^0.2.0" v8-compile-cache "^2.0.3" -espree@^7.2.0: - version "7.2.0" - resolved "https://registry.yarnpkg.com/espree/-/espree-7.2.0.tgz#1c263d5b513dbad0ac30c4991b93ac354e948d69" - integrity sha512-H+cQ3+3JYRMEIOl87e7QdHX70ocly5iW4+dttuR8iYSPr/hXKFb+7dBsZ7+u1adC4VrnPlTkv0+OwuPnDop19g== +espree@^7.3.0, espree@^7.3.1: + version "7.3.1" + resolved "https://registry.npmjs.org/espree/-/espree-7.3.1.tgz" + integrity sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g== dependencies: - acorn "^7.3.1" - acorn-jsx "^5.2.0" + acorn "^7.4.0" + acorn-jsx "^5.3.1" eslint-visitor-keys "^1.3.0" esprima@^4.0.0, esprima@~4.0.0: version "4.0.1" - resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" + resolved "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== -esquery@^1.2.0: - version "1.3.1" - resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.3.1.tgz#b78b5828aa8e214e29fb74c4d5b752e1c033da57" - integrity sha512-olpvt9QG0vniUBZspVRN6lwB7hOZoTRtT+jzR+tS4ffYx2mzbw+z0XCOk44aaLYKApNX5nMm+E+P6o25ip/DHQ== +esquery@^1.4.0: + version "1.4.0" + resolved "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz" + integrity sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w== dependencies: estraverse "^5.1.0" -esrecurse@^4.1.0: - version "4.2.1" - resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.2.1.tgz#007a3b9fdbc2b3bb87e4879ea19c92fdbd3942cf" - integrity sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ== +esrecurse@^4.3.0: + version "4.3.0" + resolved "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz" + integrity sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag== dependencies: - estraverse "^4.1.0" + estraverse "^5.2.0" -estraverse@^4.1.0, estraverse@^4.1.1: +estraverse@^4.1.1: version "4.3.0" - resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d" + resolved "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz" integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== -estraverse@^5.1.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.2.0.tgz#307df42547e6cc7324d3cf03c155d5cdb8c53880" - integrity sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ== +estraverse@^5.1.0, estraverse@^5.2.0: + version "5.3.0" + resolved "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz" + integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== + +estree-to-babel@^3.1.0: + version "3.2.1" + resolved "https://registry.npmjs.org/estree-to-babel/-/estree-to-babel-3.2.1.tgz" + integrity sha512-YNF+mZ/Wu2FU/gvmzuWtYc8rloubL7wfXCTgouFrnjGVXPA/EeYYA7pupXWrb3Iv1cTBeSSxxJIbK23l4MRNqg== + dependencies: + "@babel/traverse" "^7.1.6" + "@babel/types" "^7.2.0" + c8 "^7.6.0" esutils@^2.0.2: version "2.0.3" - resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" + resolved "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz" integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== etag@~1.8.1: version "1.8.1" - resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" + resolved "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz" integrity sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc= -expand-brackets@^2.1.4: - version "2.1.4" - resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-2.1.4.tgz#b77735e315ce30f6b6eff0f83b04151a22449622" - integrity sha1-t3c14xXOMPa27/D4OwQVGiJEliI= - dependencies: - debug "^2.3.3" - define-property "^0.2.5" - extend-shallow "^2.0.1" - posix-character-classes "^0.1.0" - regex-not "^1.0.0" - snapdragon "^0.8.1" - to-regex "^3.0.1" - -expand-template@^2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/expand-template/-/expand-template-2.0.3.tgz#6e14b3fcee0f3a6340ecb57d2e8918692052a47c" - integrity sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg== - expect@*: - version "24.9.0" - resolved "https://registry.yarnpkg.com/expect/-/expect-24.9.0.tgz#b75165b4817074fa4a157794f46fe9f1ba15b6ca" - integrity sha512-wvVAx8XIol3Z5m9zvZXiyZOQ+sRJqNTIm6sGjdWlaZIeupQGO3WbYI+15D/AmEwZywL6wtJkbAbJtzkOfBuR0Q== + version "27.4.6" + resolved "https://registry.npmjs.org/expect/-/expect-27.4.6.tgz" + integrity sha512-1M/0kAALIaj5LaG66sFJTbRsWTADnylly82cu4bspI0nl+pgP4E6Bh/aqdHlTUjul06K7xQnnrAoqfxVU0+/ag== dependencies: - "@jest/types" "^24.9.0" - ansi-styles "^3.2.0" - jest-get-type "^24.9.0" - jest-matcher-utils "^24.9.0" - jest-message-util "^24.9.0" - jest-regex-util "^24.9.0" + "@jest/types" "^27.4.2" + jest-get-type "^27.4.0" + jest-matcher-utils "^27.4.6" + jest-message-util "^27.4.6" expect@^1.20.2: version "1.20.2" - resolved "https://registry.yarnpkg.com/expect/-/expect-1.20.2.tgz#d458fe4c56004036bae3232416a3f6361f04f965" + resolved "https://registry.npmjs.org/expect/-/expect-1.20.2.tgz" integrity sha1-1Fj+TFYAQDa64yMkFqP2Nh8E+WU= dependencies: define-properties "~1.1.2" @@ -1719,28 +1493,28 @@ expect@^1.20.2: tmatch "^2.0.1" expect@^26.2.0: - version "26.2.0" - resolved "https://registry.yarnpkg.com/expect/-/expect-26.2.0.tgz#0140dd9cc7376d7833852e9cda88c05414f1efba" - integrity sha512-8AMBQ9UVcoUXt0B7v+5/U5H6yiUR87L6eKCfjE3spx7Ya5lF+ebUo37MCFBML2OiLfkX1sxmQOZhIDonyVTkcw== + version "26.6.2" + resolved "https://registry.npmjs.org/expect/-/expect-26.6.2.tgz" + integrity sha512-9/hlOBkQl2l/PLHJx6JjoDF6xPKcJEsUlWKb23rKE7KzeDqUZKXKNMW27KIue5JMdBV9HgmoJPcc8HtO85t9IA== dependencies: - "@jest/types" "^26.2.0" + "@jest/types" "^26.6.2" ansi-styles "^4.0.0" - jest-get-type "^26.0.0" - jest-matcher-utils "^26.2.0" - jest-message-util "^26.2.0" + jest-get-type "^26.3.0" + jest-matcher-utils "^26.6.2" + jest-message-util "^26.6.2" jest-regex-util "^26.0.0" -express@^4.17.1: - version "4.17.1" - resolved "https://registry.yarnpkg.com/express/-/express-4.17.1.tgz#4491fc38605cf51f8629d39c2b5d026f98a4c134" - integrity sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g== +express@^4.17.2: + version "4.17.2" + resolved "https://registry.npmjs.org/express/-/express-4.17.2.tgz" + integrity sha512-oxlxJxcQlYwqPWKVJJtvQiwHgosH/LrLSPA+H4UxpyvSS6jC5aH+5MoHFM+KABgTOt0APue4w66Ha8jCUo9QGg== dependencies: accepts "~1.3.7" array-flatten "1.1.1" - body-parser "1.19.0" - content-disposition "0.5.3" + body-parser "1.19.1" + content-disposition "0.5.4" content-type "~1.0.4" - cookie "0.4.0" + cookie "0.4.1" cookie-signature "1.0.6" debug "2.6.9" depd "~1.1.2" @@ -1754,109 +1528,65 @@ express@^4.17.1: on-finished "~2.3.0" parseurl "~1.3.3" path-to-regexp "0.1.7" - proxy-addr "~2.0.5" - qs "6.7.0" + proxy-addr "~2.0.7" + qs "6.9.6" range-parser "~1.2.1" - safe-buffer "5.1.2" - send "0.17.1" - serve-static "1.14.1" - setprototypeof "1.1.1" + safe-buffer "5.2.1" + send "0.17.2" + serve-static "1.14.2" + setprototypeof "1.2.0" statuses "~1.5.0" type-is "~1.6.18" utils-merge "1.0.1" vary "~1.1.2" -extend-shallow@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f" - integrity sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8= - dependencies: - is-extendable "^0.1.0" - -extend-shallow@^3.0.0, extend-shallow@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-3.0.2.tgz#26a71aaf073b39fb2127172746131c2704028db8" - integrity sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg= - dependencies: - assign-symbols "^1.0.0" - is-extendable "^1.0.1" - extend@~3.0.2: version "3.0.2" - resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" + resolved "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz" integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g== -extglob@^2.0.4: - version "2.0.4" - resolved "https://registry.yarnpkg.com/extglob/-/extglob-2.0.4.tgz#ad00fe4dc612a9232e8718711dc5cb5ab0285543" - integrity sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw== - dependencies: - array-unique "^0.3.2" - define-property "^1.0.0" - expand-brackets "^2.1.4" - extend-shallow "^2.0.1" - fragment-cache "^0.2.1" - regex-not "^1.0.0" - snapdragon "^0.8.1" - to-regex "^3.0.1" - extsprintf@1.3.0: version "1.3.0" - resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" + resolved "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz" integrity sha1-lpGEQOMEGnpBT4xS48V06zw+HgU= extsprintf@^1.2.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f" - integrity sha1-4mifjzVvrWLMplo6kcXfX5VRaS8= + version "1.4.1" + resolved "https://registry.npmjs.org/extsprintf/-/extsprintf-1.4.1.tgz" + integrity sha512-Wrk35e8ydCKDj/ArClo1VrPVmN8zph5V4AtHwIuHhvMXsKf73UT3BOD+azBIW+3wOJ4FhEH7zyaJCFvChjYvMA== -fast-deep-equal@^3.1.1: +fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: version "3.1.3" - resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" + resolved "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz" integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== fast-json-stable-stringify@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" - integrity sha1-1RQsDK7msRifh9OnYREGT4bIu/I= + version "2.1.0" + resolved "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz" + integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== fast-levenshtein@^2.0.6: version "2.0.6" - resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" + resolved "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz" integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= -file-entry-cache@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-5.0.1.tgz#ca0f6efa6dd3d561333fb14515065c2fafdf439c" - integrity sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g== - dependencies: - flat-cache "^2.0.1" - -file-uri-to-path@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz#553a7b8446ff6f684359c445f1e37a05dacc33dd" - integrity sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw== - -fill-range@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-4.0.0.tgz#d544811d428f98eb06a63dc402d2403c328c38f7" - integrity sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc= +file-entry-cache@^6.0.1: + version "6.0.1" + resolved "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz" + integrity sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg== dependencies: - extend-shallow "^2.0.1" - is-number "^3.0.0" - repeat-string "^1.6.1" - to-regex-range "^2.1.0" + flat-cache "^3.0.4" fill-range@^7.0.1: version "7.0.1" - resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" + resolved "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz" integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== dependencies: to-regex-range "^5.0.1" finalhandler@~1.1.2: version "1.1.2" - resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-1.1.2.tgz#b7e7d000ffd11938d0fdb053506f6ebabe9f587d" + resolved "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz" integrity sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA== dependencies: debug "2.6.9" @@ -1867,171 +1597,158 @@ finalhandler@~1.1.2: statuses "~1.5.0" unpipe "~1.0.0" -find-up@4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19" - integrity sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw== +find-up@5.0.0, find-up@^5.0.0: + version "5.0.0" + resolved "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz" + integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== dependencies: - locate-path "^5.0.0" + locate-path "^6.0.0" path-exists "^4.0.0" -find-up@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/find-up/-/find-up-3.0.0.tgz#49169f1d7993430646da61ecc5ae355c21c97b73" - integrity sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg== +flat-cache@^3.0.4: + version "3.0.4" + resolved "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz" + integrity sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg== dependencies: - locate-path "^3.0.0" + flatted "^3.1.0" + rimraf "^3.0.2" -flat-cache@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-2.0.1.tgz#5d296d6f04bda44a4630a301413bdbc2ec085ec0" - integrity sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA== - dependencies: - flatted "^2.0.0" - rimraf "2.6.3" - write "1.0.3" +flat@^5.0.2: + version "5.0.2" + resolved "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz" + integrity sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ== -flat@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/flat/-/flat-4.1.0.tgz#090bec8b05e39cba309747f1d588f04dbaf98db2" - integrity sha512-Px/TiLIznH7gEDlPXcUD4KnBusa6kR6ayRUVcnEAbreRIuhkqow/mun59BuRXwoYk7ZQOLW1ZM05ilIvK38hFw== - dependencies: - is-buffer "~2.0.3" +flatted@^3.1.0: + version "3.2.4" + resolved "https://registry.npmjs.org/flatted/-/flatted-3.2.4.tgz" + integrity sha512-8/sOawo8tJ4QOBX8YlQBMxL8+RLZfxMQOif9o0KUKTNTjMYElWPE0r/m5VNFxTRd0NSw8qSy8dajrwX4RYI1Hw== -flatted@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.2.tgz#4575b21e2bcee7434aa9be662f4b7b5f9c2b5138" - integrity sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA== +foreach@^2.0.5: + version "2.0.5" + resolved "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz" + integrity sha1-C+4AUBiusmDQo6865ljdATbsG5k= -for-in@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" - integrity sha1-gQaNKVqBQuwKxybG4iAMMPttXoA= +foreground-child@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/foreground-child/-/foreground-child-2.0.0.tgz" + integrity sha512-dCIq9FpEcyQyXKCkyzmlPTFNgrCzPudOe+mhvJU5zAtlBnGVy2yKxtfsxK2tQBThwq225jcvBjpw1Gr40uzZCA== + dependencies: + cross-spawn "^7.0.0" + signal-exit "^3.0.2" forever-agent@~0.6.1: version "0.6.1" - resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" + resolved "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz" integrity sha1-+8cfDEGt6zf5bFd60e1C2P2sypE= form-data@~2.3.2: version "2.3.3" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6" + resolved "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz" integrity sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ== dependencies: asynckit "^0.4.0" combined-stream "^1.0.6" mime-types "^2.1.12" -forwarded@~0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.1.2.tgz#98c23dab1175657b8c0573e8ceccd91b0ff18c84" - integrity sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ= - -fragment-cache@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/fragment-cache/-/fragment-cache-0.2.1.tgz#4290fad27f13e89be7f33799c6bc5a0abfff0d19" - integrity sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk= - dependencies: - map-cache "^0.2.2" +forwarded@0.2.0: + version "0.2.0" + resolved "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz" + integrity sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow== fresh@0.5.2: version "0.5.2" - resolved "https://registry.yarnpkg.com/fresh/-/fresh-0.5.2.tgz#3d8cadd90d976569fa835ab1f8e4b23a105605a7" + resolved "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz" integrity sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac= -fs-constants@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/fs-constants/-/fs-constants-1.0.0.tgz#6be0de9be998ce16af8afc24497b9ee9b7ccd9ad" - integrity sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow== - -fs-minipass@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-2.1.0.tgz#7f5036fdbf12c63c169190cbe4199c852271f9fb" - integrity sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg== - dependencies: - minipass "^3.0.0" - fs.realpath@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + resolved "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz" integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= -fsevents@~2.1.2: - version "2.1.3" - resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.1.3.tgz#fb738703ae8d2f9fe900c33836ddebee8b97f23e" - integrity sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ== +fsevents@~2.3.1: + version "2.3.2" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" + integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== function-bind@^1.1.1: version "1.1.1" - resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" + resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz" integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== +function.prototype.name@^1.1.4: + version "1.1.5" + resolved "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.5.tgz" + integrity sha512-uN7m/BzVKQnCUF/iW8jYea67v++2u7m5UgENbHRtdDVclOUP+FMPlCNdmk0h/ysGyo2tavMJEDqJAkJdRa1vMA== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.3" + es-abstract "^1.19.0" + functions-have-names "^1.2.2" + functional-red-black-tree@^1.0.1: version "1.0.1" - resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" + resolved "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz" integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc= -gauge@~2.7.3: - version "2.7.4" - resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7" - integrity sha1-LANAXHU4w51+s3sxcCLjJfsBi/c= - dependencies: - aproba "^1.0.3" - console-control-strings "^1.0.0" - has-unicode "^2.0.0" - object-assign "^4.1.0" - signal-exit "^3.0.0" - string-width "^1.0.1" - strip-ansi "^3.0.1" - wide-align "^1.1.0" +functions-have-names@^1.2.2: + version "1.2.2" + resolved "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.2.tgz" + integrity sha512-bLgc3asbWdwPbx2mNk2S49kmJCuQeu0nfmaOgbs8WIyzzkw3r4htszdIi9Q9EMezDPTYuJx2wvjZ/EwgAthpnA== -gensync@^1.0.0-beta.1: - version "1.0.0-beta.1" - resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.1.tgz#58f4361ff987e5ff6e1e7a210827aa371eaac269" - integrity sha512-r8EC6NO1sngH/zdD9fiRDLdcgnbayXah+mLgManTaIZJqEC1MZstmnox8KpnI2/fxQwrp5OpCOYWLp4rBl4Jcg== +gensync@^1.0.0-beta.2: + version "1.0.0-beta.2" + resolved "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz" + integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg== -get-caller-file@^2.0.1: +get-caller-file@^2.0.5: version "2.0.5" - resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" + resolved "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz" integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== +get-intrinsic@^1.0.2, get-intrinsic@^1.1.0, get-intrinsic@^1.1.1: + version "1.1.1" + resolved "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz" + integrity sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q== + dependencies: + function-bind "^1.1.1" + has "^1.0.3" + has-symbols "^1.0.1" + get-port@^5.1.1: version "5.1.1" - resolved "https://registry.yarnpkg.com/get-port/-/get-port-5.1.1.tgz#0469ed07563479de6efb986baf053dcd7d4e3193" + resolved "https://registry.npmjs.org/get-port/-/get-port-5.1.1.tgz" integrity sha512-g/Q1aTSDOxFpchXC4i8ZWvxA1lnPqx/JHqcpIw0/LX9T8x/GBbi6YnlN5nhaKIFkT8oFsscUKgDJYxfwfS6QsQ== -get-value@^2.0.3, get-value@^2.0.6: - version "2.0.6" - resolved "https://registry.yarnpkg.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28" - integrity sha1-3BXKHGcjh8p2vTesCjlbogQqLCg= +get-symbol-description@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz" + integrity sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw== + dependencies: + call-bind "^1.0.2" + get-intrinsic "^1.1.1" getpass@^0.1.1: version "0.1.7" - resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa" + resolved "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz" integrity sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo= dependencies: assert-plus "^1.0.0" -github-from-package@0.0.0: - version "0.0.0" - resolved "https://registry.yarnpkg.com/github-from-package/-/github-from-package-0.0.0.tgz#97fb5d96bfde8973313f20e8288ef9a167fa64ce" - integrity sha1-l/tdlr/eiXMxPyDoKI75oWf6ZM4= - -glob-parent@^5.0.0, glob-parent@~5.1.0: +glob-parent@^5.1.2, glob-parent@~5.1.0: version "5.1.2" - resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" + resolved "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz" integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== dependencies: is-glob "^4.0.1" glob-to-regexp@^0.4.1: version "0.4.1" - resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz#c75297087c851b9a578bd217dd59a92f59fe546e" + resolved "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz" integrity sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw== -glob@7.1.6, glob@^7.1.1, glob@^7.1.3, glob@^7.1.6: +glob@7.1.6: version "7.1.6" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" + resolved "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz" integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== dependencies: fs.realpath "^1.0.0" @@ -2041,117 +1758,95 @@ glob@7.1.6, glob@^7.1.1, glob@^7.1.3, glob@^7.1.6: once "^1.3.0" path-is-absolute "^1.0.0" +glob@^7.0.0, glob@^7.1.1, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6: + version "7.2.0" + resolved "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz" + integrity sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + globals@^11.1.0: version "11.12.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" + resolved "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz" integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== -globals@^12.1.0: - version "12.4.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-12.4.0.tgz#a18813576a41b00a24a97e7f815918c2e19925f8" - integrity sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg== +globals@^13.6.0, globals@^13.9.0: + version "13.12.0" + resolved "https://registry.npmjs.org/globals/-/globals-13.12.0.tgz" + integrity sha512-uS8X6lSKN2JumVoXrbUz+uG4BYG+eiawqm3qFcT7ammfbUHeCBoJMlHcec/S3krSk73/AE/f0szYFmgAA3kYZg== dependencies: - type-fest "^0.8.1" - -graceful-fs@^4.1.15, graceful-fs@^4.1.3, graceful-fs@^4.1.9: - version "4.2.3" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.3.tgz#4a12ff1b60376ef09862c2093edd908328be8423" - integrity sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ== + type-fest "^0.20.2" -graceful-fs@^4.2.4: - version "4.2.4" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.4.tgz#2256bde14d3632958c465ebc96dc467ca07a29fb" - integrity sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw== +graceful-fs@^4.1.3, graceful-fs@^4.1.9, graceful-fs@^4.2.4: + version "4.2.9" + resolved "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz" + integrity sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ== growl@1.10.5: version "1.10.5" - resolved "https://registry.yarnpkg.com/growl/-/growl-1.10.5.tgz#f2735dc2283674fa67478b10181059355c369e5e" + resolved "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz" integrity sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA== har-schema@^2.0.0: version "2.0.0" - resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" + resolved "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz" integrity sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI= har-validator@~5.1.3: version "5.1.5" - resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-5.1.5.tgz#1f0803b9f8cb20c0fa13822df1ecddb36bde1efd" + resolved "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz" integrity sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w== dependencies: ajv "^6.12.3" har-schema "^2.0.0" +has-bigints@^1.0.1: + version "1.0.1" + resolved "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.1.tgz" + integrity sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA== + has-flag@^3.0.0: version "3.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" + resolved "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz" integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0= has-flag@^4.0.0: version "4.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" + resolved "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz" integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== -has-symbols@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.0.tgz#ba1a8f1af2a0fc39650f5c850367704122063b44" - integrity sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q= - -has-symbols@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.1.tgz#9f5214758a44196c406d9bd76cebf81ec2dd31e8" - integrity sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg== - -has-unicode@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" - integrity sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk= - -has-value@^0.3.1: - version "0.3.1" - resolved "https://registry.yarnpkg.com/has-value/-/has-value-0.3.1.tgz#7b1f58bada62ca827ec0a2078025654845995e1f" - integrity sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8= - dependencies: - get-value "^2.0.3" - has-values "^0.1.4" - isobject "^2.0.0" - -has-value@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/has-value/-/has-value-1.0.0.tgz#18b281da585b1c5c51def24c930ed29a0be6b177" - integrity sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc= - dependencies: - get-value "^2.0.6" - has-values "^1.0.0" - isobject "^3.0.0" - -has-values@^0.1.4: - version "0.1.4" - resolved "https://registry.yarnpkg.com/has-values/-/has-values-0.1.4.tgz#6d61de95d91dfca9b9a02089ad384bff8f62b771" - integrity sha1-bWHeldkd/Km5oCCJrThL/49it3E= +has-symbols@^1.0.1, has-symbols@^1.0.2: + version "1.0.2" + resolved "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz" + integrity sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw== -has-values@^1.0.0: +has-tostringtag@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/has-values/-/has-values-1.0.0.tgz#95b0b63fec2146619a6fe57fe75628d5a39efe4f" - integrity sha1-lbC2P+whRmGab+V/51Yo1aOe/k8= + resolved "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz" + integrity sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ== dependencies: - is-number "^3.0.0" - kind-of "^4.0.0" + has-symbols "^1.0.2" has@^1.0.1, has@^1.0.3: version "1.0.3" - resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" + resolved "https://registry.npmjs.org/has/-/has-1.0.3.tgz" integrity sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw== dependencies: function-bind "^1.1.1" hash-sum@^1.0.2: version "1.0.2" - resolved "https://registry.yarnpkg.com/hash-sum/-/hash-sum-1.0.2.tgz#33b40777754c6432573c120cc3808bbd10d47f04" + resolved "https://registry.npmjs.org/hash-sum/-/hash-sum-1.0.2.tgz" integrity sha1-M7QHd3VMZDJXPBIMw4CLvRDUfwQ= hash.js@^1.1.7: version "1.1.7" - resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42" + resolved "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz" integrity sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA== dependencies: inherits "^2.0.3" @@ -2159,38 +1854,34 @@ hash.js@^1.1.7: he@1.2.0, he@^1.1.0, he@^1.2.0: version "1.2.0" - resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" + resolved "https://registry.npmjs.org/he/-/he-1.2.0.tgz" integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== -html-to-text@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/html-to-text/-/html-to-text-6.0.0.tgz#8b48adb1b781a8378f374c5bb481864a169f59f4" - integrity sha512-r0KNC5aqCAItsjlgtirW6RW25c92Ee3ybQj8z//4Sl4suE3HIPqM4deGpYCUJULLjtVPEP1+Ma+1ZeX1iMsCiA== +html-escaper@^2.0.0: + version "2.0.2" + resolved "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz" + integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg== + +html-to-text@^8.1.0: + version "8.1.0" + resolved "https://registry.npmjs.org/html-to-text/-/html-to-text-8.1.0.tgz" + integrity sha512-Z9iYAqYK2c18GswSbnxJSeMs7lyJgwR2oIkDOyOHGBbYsPsG4HvT379jj3Lcbfko8A5ceyyMHAfkmp/BiXA9/Q== dependencies: + "@selderee/plugin-htmlparser2" "^0.6.0" deepmerge "^4.2.2" he "^1.2.0" - htmlparser2 "^4.1.0" - lodash "^4.17.20" + htmlparser2 "^6.1.0" minimist "^1.2.5" + selderee "^0.6.0" htmlencode@^0.0.4: version "0.0.4" - resolved "https://registry.yarnpkg.com/htmlencode/-/htmlencode-0.0.4.tgz#f7e2d6afbe18a87a78e63ba3308e753766740e3f" + resolved "https://registry.npmjs.org/htmlencode/-/htmlencode-0.0.4.tgz" integrity sha1-9+LWr74YqHp45jujMI51N2Z0Dj8= -htmlparser2@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/htmlparser2/-/htmlparser2-4.1.0.tgz#9a4ef161f2e4625ebf7dfbe6c0a2f52d18a59e78" - integrity sha512-4zDq1a1zhE4gQso/c5LP1OtrhYTncXNSpvJYtWJBtXAETPlMfi3IFNjGuQbYLuVY4ZR0QMqRVvo4Pdy9KLyP8Q== - dependencies: - domelementtype "^2.0.1" - domhandler "^3.0.0" - domutils "^2.0.0" - entities "^2.0.0" - -htmlparser2@^6.0.0: +htmlparser2@^6.0.0, htmlparser2@^6.1.0: version "6.1.0" - resolved "https://registry.yarnpkg.com/htmlparser2/-/htmlparser2-6.1.0.tgz#c4d762b6c3371a05dbe65e94ae43a9f845fb8fb7" + resolved "https://registry.npmjs.org/htmlparser2/-/htmlparser2-6.1.0.tgz" integrity sha512-gyyPk6rgonLFEDGoeRgQNaEUvdJ4ktTmmUh/h2t7s+M8oPpIPxgNACWa+6ESR57kXstwqPiCut0V8NRpcwgU7A== dependencies: domelementtype "^2.0.1" @@ -2198,31 +1889,20 @@ htmlparser2@^6.0.0: domutils "^2.5.2" entities "^2.0.0" -http-errors@1.7.2: - version "1.7.2" - resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-1.7.2.tgz#4f5029cf13239f31036e5b2e55292bcfbcc85c8f" - integrity sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg== - dependencies: - depd "~1.1.2" - inherits "2.0.3" - setprototypeof "1.1.1" - statuses ">= 1.5.0 < 2" - toidentifier "1.0.0" - -http-errors@~1.7.2: - version "1.7.3" - resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-1.7.3.tgz#6c619e4f9c60308c38519498c14fbb10aacebb06" - integrity sha512-ZTTX0MWrsQ2ZAhA1cejAwDLycFsd7I7nVtnkT3Ol0aqodaKW+0CTZDQ1uBv5whptCnc8e8HeRRJxRs0kmm/Qfw== +http-errors@1.8.1: + version "1.8.1" + resolved "https://registry.npmjs.org/http-errors/-/http-errors-1.8.1.tgz" + integrity sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g== dependencies: depd "~1.1.2" inherits "2.0.4" - setprototypeof "1.1.1" + setprototypeof "1.2.0" statuses ">= 1.5.0 < 2" - toidentifier "1.0.0" + toidentifier "1.0.1" http-signature@~1.2.0: version "1.2.0" - resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1" + resolved "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz" integrity sha1-muzZJRFHcvPZW2WmCruPfBj7rOE= dependencies: assert-plus "^1.0.0" @@ -2231,479 +1911,465 @@ http-signature@~1.2.0: iconv-lite@0.4.24: version "0.4.24" - resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" + resolved "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz" integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== dependencies: safer-buffer ">= 2.1.2 < 3" -ieee754@^1.1.13: - version "1.2.1" - resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" - integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== - ignore@^4.0.6: version "4.0.6" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" + resolved "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz" integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg== -import-fresh@^3.0.0: - version "3.2.1" - resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.2.1.tgz#633ff618506e793af5ac91bf48b72677e15cbe66" - integrity sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ== +import-fresh@^3.0.0, import-fresh@^3.2.1: + version "3.3.0" + resolved "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz" + integrity sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw== dependencies: parent-module "^1.0.0" resolve-from "^4.0.0" imurmurhash@^0.1.4: version "0.1.4" - resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" + resolved "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz" integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= inflight@^1.0.4: version "1.0.6" - resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + resolved "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz" integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= dependencies: once "^1.3.0" wrappy "1" -inherits@2, inherits@2.0.4, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.3: +inherits@2, inherits@2.0.4, inherits@^2.0.3: version "2.0.4" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + resolved "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== -inherits@2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" - integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4= - -ini@~1.3.0: - version "1.3.8" - resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.8.tgz#a29da425b48806f34767a4efce397269af28432c" - integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew== +internal-slot@^1.0.3: + version "1.0.3" + resolved "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.3.tgz" + integrity sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA== + dependencies: + get-intrinsic "^1.1.0" + has "^1.0.3" + side-channel "^1.0.4" -ipaddr.js@1.9.0: - version "1.9.0" - resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-1.9.0.tgz#37df74e430a0e47550fe54a2defe30d8acd95f65" - integrity sha512-M4Sjn6N/+O6/IXSJseKqHoFc+5FdGJ22sXqnjTpdZweHK64MzEPAyQZyEU3R/KRv2GLoa7nNtg/C2Ev6m7z+eA== +interpret@^1.0.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.4.0.tgz#665ab8bc4da27a774a40584e812e3e0fa45b1a1e" + integrity sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA== -is-accessor-descriptor@^0.1.6: - version "0.1.6" - resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz#a9e12cb3ae8d876727eeef3843f8a0897b5c98d6" - integrity sha1-qeEss66Nh2cn7u84Q/igiXtcmNY= - dependencies: - kind-of "^3.0.2" +ipaddr.js@1.9.1: + 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== -is-accessor-descriptor@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz#169c2f6d3df1f992618072365c9b0ea1f6878656" - integrity sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ== +is-arguments@^1.1.0: + version "1.1.1" + resolved "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz" + integrity sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA== dependencies: - kind-of "^6.0.0" - -is-arguments@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/is-arguments/-/is-arguments-1.0.4.tgz#3faf966c7cba0ff437fb31f6250082fcf0448cf3" - integrity sha512-xPh0Rmt8NE65sNzvyUmWgI1tz3mKq74lGA0mL8LYZcoIzKOzDh6HmrYm3d18k60nHerC8A9Km8kYu87zfSFnLA== + call-bind "^1.0.2" + has-tostringtag "^1.0.0" is-arrow-function@^2.0.3: version "2.0.3" - resolved "https://registry.yarnpkg.com/is-arrow-function/-/is-arrow-function-2.0.3.tgz#29be2c2d8d9450852b8bbafb635ba7b8d8e87ec2" + resolved "https://registry.npmjs.org/is-arrow-function/-/is-arrow-function-2.0.3.tgz" integrity sha1-Kb4sLY2UUIUri7r7Y1unuNjofsI= dependencies: is-callable "^1.0.4" +is-async-fn@^1.1.0: + version "1.1.0" + resolved "https://registry.npmjs.org/is-async-fn/-/is-async-fn-1.1.0.tgz" + integrity sha1-oaFbEdShFVzCOxHpGzAbRaPKrRY= + +is-bigint@^1.0.1, is-bigint@^1.0.4: + version "1.0.4" + resolved "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz" + integrity sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg== + dependencies: + has-bigints "^1.0.1" + is-binary-path@~2.1.0: version "2.1.0" - resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09" + resolved "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz" integrity sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw== dependencies: binary-extensions "^2.0.0" -is-boolean-object@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-boolean-object/-/is-boolean-object-1.0.0.tgz#98f8b28030684219a95f375cfbd88ce3405dff93" - integrity sha1-mPiygDBoQhmpXzdc+9iM40Bd/5M= +is-boolean-object@^1.1.0, is-boolean-object@^1.1.2: + version "1.1.2" + resolved "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz" + integrity sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA== + dependencies: + call-bind "^1.0.2" + has-tostringtag "^1.0.0" is-buffer@^1.1.5: version "1.1.6" - resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" + resolved "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz" integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w== -is-buffer@~2.0.3: - version "2.0.4" - resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-2.0.4.tgz#3e572f23c8411a5cfd9557c849e3665e0b290623" - integrity sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A== - -is-callable@^1.0.4, is-callable@^1.1.3, is-callable@^1.1.4: - version "1.1.4" - resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.4.tgz#1e1adf219e1eeb684d691f9d6a05ff0d30a24d75" - integrity sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA== - -is-callable@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.0.tgz#83336560b54a38e35e3a2df7afd0454d691468bb" - integrity sha512-pyVD9AaGLxtg6srb2Ng6ynWJqkHU9bEM087AKck0w8QwDarTfNcpIYoU8x8Hv2Icm8u6kFJM18Dag8lyqGkviw== - -is-data-descriptor@^0.1.4: - version "0.1.4" - resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56" - integrity sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y= - dependencies: - kind-of "^3.0.2" - -is-data-descriptor@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz#d84876321d0e7add03990406abbbbd36ba9268c7" - integrity sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ== - dependencies: - kind-of "^6.0.0" - -is-date-object@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16" - integrity sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY= +is-callable@^1.0.4, is-callable@^1.1.4, is-callable@^1.2.4: + version "1.2.4" + resolved "https://registry.npmjs.org/is-callable/-/is-callable-1.2.4.tgz" + integrity sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w== -is-descriptor@^0.1.0: - version "0.1.6" - resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-0.1.6.tgz#366d8240dde487ca51823b1ab9f07a10a78251ca" - integrity sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg== +is-core-module@^2.8.0: + version "2.8.1" + resolved "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.1.tgz" + integrity sha512-SdNCUs284hr40hFTFP6l0IfZ/RSrMXF3qgoRHd3/79unUTvrFO/JoXwkGm+5J/Oe3E/b5GsnG330uUNgRpu1PA== dependencies: - is-accessor-descriptor "^0.1.6" - is-data-descriptor "^0.1.4" - kind-of "^5.0.0" + has "^1.0.3" -is-descriptor@^1.0.0, is-descriptor@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-1.0.2.tgz#3b159746a66604b04f8c81524ba365c5f14d86ec" - integrity sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg== +is-date-object@^1.0.1, is-date-object@^1.0.5: + version "1.0.5" + resolved "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz" + integrity sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ== dependencies: - is-accessor-descriptor "^1.0.0" - is-data-descriptor "^1.0.0" - kind-of "^6.0.2" + has-tostringtag "^1.0.0" is-equal@^1.5.1: - version "1.5.5" - resolved "https://registry.yarnpkg.com/is-equal/-/is-equal-1.5.5.tgz#5e85f1957e052883247feb386965a3bba15fbb3d" - integrity sha1-XoXxlX4FKIMkf+s4aWWju6Ffuz0= + version "1.6.4" + resolved "https://registry.npmjs.org/is-equal/-/is-equal-1.6.4.tgz" + integrity sha512-NiPOTBb5ahmIOYkJ7mVTvvB1bydnTzixvfO+59AjJKBpyjPBIULL3EHGxySyZijlVpewveJyhiLQThcivkkAtw== dependencies: - has "^1.0.1" + es-get-iterator "^1.1.2" + functions-have-names "^1.2.2" + has "^1.0.3" + has-bigints "^1.0.1" + has-symbols "^1.0.2" is-arrow-function "^2.0.3" - is-boolean-object "^1.0.0" - is-callable "^1.1.3" - is-date-object "^1.0.1" - is-generator-function "^1.0.6" - is-number-object "^1.0.3" - is-regex "^1.0.3" - is-string "^1.0.4" - is-symbol "^1.0.1" - object.entries "^1.0.4" + is-bigint "^1.0.4" + is-boolean-object "^1.1.2" + is-callable "^1.2.4" + is-date-object "^1.0.5" + is-generator-function "^1.0.10" + is-number-object "^1.0.6" + is-regex "^1.1.4" + is-string "^1.0.7" + is-symbol "^1.0.4" + isarray "^2.0.5" + object-inspect "^1.12.0" + object.entries "^1.1.5" + object.getprototypeof "^1.0.3" + which-boxed-primitive "^1.0.2" + which-collection "^1.0.1" is-expression@^3.0.0: version "3.0.0" - resolved "https://registry.yarnpkg.com/is-expression/-/is-expression-3.0.0.tgz#39acaa6be7fd1f3471dc42c7416e61c24317ac9f" + resolved "https://registry.npmjs.org/is-expression/-/is-expression-3.0.0.tgz" integrity sha1-Oayqa+f9HzRx3ELHQW5hwkMXrJ8= dependencies: acorn "~4.0.2" object-assign "^4.0.1" -is-extendable@^0.1.0, is-extendable@^0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" - integrity sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik= - -is-extendable@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-1.0.1.tgz#a7470f9e426733d81bd81e1155264e3a3507cab4" - integrity sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA== - dependencies: - is-plain-object "^2.0.4" - is-extglob@^2.1.1: version "2.1.1" - resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" + resolved "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz" integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI= -is-fullwidth-code-point@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" - integrity sha1-754xOG8DGn8NZDr4L95QxFfvAMs= +is-finalizationregistry@^1.0.1: + version "1.0.2" + resolved "https://registry.npmjs.org/is-finalizationregistry/-/is-finalizationregistry-1.0.2.tgz" + integrity sha512-0by5vtUJs8iFQb5TYUHHPudOR+qXYIMKtiUzvLIZITZUjknFmziyBJuLhVRc+Ds0dREFlskDNJKYIdIzu/9pfw== dependencies: - number-is-nan "^1.0.0" + call-bind "^1.0.2" is-fullwidth-code-point@^2.0.0: version "2.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" + resolved "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz" integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= -is-generator-function@^1.0.6: - version "1.0.7" - resolved "https://registry.yarnpkg.com/is-generator-function/-/is-generator-function-1.0.7.tgz#d2132e529bb0000a7f80794d4bdf5cd5e5813522" - integrity sha512-YZc5EwyO4f2kWCax7oegfuSr9mFz1ZvieNYBEjmukLxgXfBUbxAWGVF7GZf0zidYtoBl3WvC07YK0wT76a+Rtw== +is-fullwidth-code-point@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz" + integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== + +is-generator-function@^1.0.10: + version "1.0.10" + resolved "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz" + integrity sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A== + dependencies: + has-tostringtag "^1.0.0" is-glob@^4.0.0, is-glob@^4.0.1, is-glob@~4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.1.tgz#7567dbe9f2f5e2467bc77ab83c4a29482407a5dc" - integrity sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg== + version "4.0.3" + resolved "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz" + integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== dependencies: is-extglob "^2.1.1" -is-map@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/is-map/-/is-map-2.0.1.tgz#520dafc4307bb8ebc33b813de5ce7c9400d644a1" - integrity sha512-T/S49scO8plUiAOA2DBTBG3JHpn1yiw0kRp6dgiZ0v2/6twi5eiB0rHtHFH9ZIrvlWc6+4O+m4zg5+Z833aXgw== +is-map@^2.0.1, is-map@^2.0.2: + version "2.0.2" + resolved "https://registry.npmjs.org/is-map/-/is-map-2.0.2.tgz" + integrity sha512-cOZFQQozTha1f4MxLFzlgKYPTyj26picdZTx82hbc/Xf4K/tZOOXSCkMvU4pKioRXGDLJRn0GM7Upe7kR721yg== -is-number-object@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/is-number-object/-/is-number-object-1.0.3.tgz#f265ab89a9f445034ef6aff15a8f00b00f551799" - integrity sha1-8mWrian0RQNO9q/xWo8AsA9VF5k= +is-negative-zero@^2.0.1: + version "2.0.2" + resolved "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz" + integrity sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA== -is-number@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" - integrity sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU= +is-number-object@^1.0.4, is-number-object@^1.0.6: + version "1.0.6" + resolved "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.6.tgz" + integrity sha512-bEVOqiRcvo3zO1+G2lVMy+gkkEm9Yh7cDMRusKKu5ZJKPUYSJwICTKZrNKHA2EbSP0Tu0+6B/emsYNHZyn6K8g== dependencies: - kind-of "^3.0.2" + has-tostringtag "^1.0.0" is-number@^7.0.0: version "7.0.0" - resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" + resolved "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz" integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== -is-plain-obj@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-1.1.0.tgz#71a50c8429dfca773c92a390a4a03b39fcd51d3e" - integrity sha1-caUMhCnfync8kqOQpKA7OfzVHT4= - -is-plain-object@^2.0.3, is-plain-object@^2.0.4: - version "2.0.4" - resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677" - integrity sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og== - dependencies: - isobject "^3.0.1" +is-plain-obj@^2.1.0: + 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== is-plain-object@^5.0.0: version "5.0.0" - resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-5.0.0.tgz#4427f50ab3429e9025ea7d52e9043a9ef4159344" + resolved "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz" integrity sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q== is-promise@^2.0.0, is-promise@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa" - integrity sha1-eaKp7OfwlugPNtKy87wWwf9L8/o= + version "2.2.2" + resolved "https://registry.npmjs.org/is-promise/-/is-promise-2.2.2.tgz" + integrity sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ== -is-regex@^1.0.3, is-regex@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491" - integrity sha1-VRdIm1RwkbCTDglWVM7SXul+lJE= +is-regex@^1.0.3, is-regex@^1.1.4: + version "1.1.4" + resolved "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz" + integrity sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg== dependencies: - has "^1.0.1" + call-bind "^1.0.2" + has-tostringtag "^1.0.0" -is-regex@^1.1.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.1.1.tgz#c6f98aacc546f6cec5468a07b7b153ab564a57b9" - integrity sha512-1+QkEcxiLlB7VEyFtyBg94e08OAsvq7FUBgApTq/w2ymCLyKJgDPsybBENVtA7XCQEgEXxKPonG+mvYRxh/LIg== - dependencies: - has-symbols "^1.0.1" +is-set@^2.0.1, is-set@^2.0.2: + version "2.0.2" + resolved "https://registry.npmjs.org/is-set/-/is-set-2.0.2.tgz" + integrity sha512-+2cnTEZeY5z/iXGbLhPrOAaK/Mau5k5eXq9j14CpRTftq0pAJu2MwVRSZhyZWBzx3o6X795Lz6Bpb6R0GKf37g== -is-set@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/is-set/-/is-set-2.0.1.tgz#d1604afdab1724986d30091575f54945da7e5f43" - integrity sha512-eJEzOtVyenDs1TMzSQ3kU3K+E0GUS9sno+F0OBT97xsgcJsF9nXMBtkT9/kut5JEpM7oL7X/0qxR17K3mcwIAA== +is-shared-array-buffer@^1.0.1: + version "1.0.1" + resolved "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.1.tgz" + integrity sha512-IU0NmyknYZN0rChcKhRO1X8LYz5Isj/Fsqh8NJOSf+N/hCOTwy29F32Ik7a+QszE63IdvmwdTPDd6cZ5pg4cwA== -is-string@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.0.4.tgz#cc3a9b69857d621e963725a24caeec873b826e64" - integrity sha1-zDqbaYV9Yh6WNyWiTK7shzuCbmQ= +is-string@^1.0.5, is-string@^1.0.7: + version "1.0.7" + resolved "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz" + integrity sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg== + dependencies: + has-tostringtag "^1.0.0" -is-string@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.0.5.tgz#40493ed198ef3ff477b8c7f92f644ec82a5cd3a6" - integrity sha512-buY6VNRjhQMiF1qWDouloZlQbRhDPCebwxSjxMjxgemYT46YMd2NR0/H+fBhEfWX4A/w9TBJ+ol+okqJKFE6vQ== +is-symbol@^1.0.2, is-symbol@^1.0.3, is-symbol@^1.0.4: + version "1.0.4" + resolved "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz" + integrity sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg== + dependencies: + has-symbols "^1.0.2" -is-symbol@^1.0.1, is-symbol@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.2.tgz#a055f6ae57192caee329e7a860118b497a950f38" - integrity sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw== +is-typed-array@^1.1.7: + version "1.1.8" + resolved "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.8.tgz" + integrity sha512-HqH41TNZq2fgtGT8WHVFVJhBVGuY3AnP3Q36K8JKXUxSxRgk/d+7NjmwG2vo2mYmXK8UYZKu0qH8bVP5gEisjA== dependencies: - has-symbols "^1.0.0" + available-typed-arrays "^1.0.5" + call-bind "^1.0.2" + es-abstract "^1.18.5" + foreach "^2.0.5" + has-tostringtag "^1.0.0" is-typedarray@~1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" + resolved "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz" integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo= -is-windows@^1.0.2: +is-weakmap@^2.0.1: + version "2.0.1" + resolved "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.1.tgz" + integrity sha512-NSBR4kH5oVj1Uwvv970ruUkCV7O1mzgVFO4/rev2cLRda9Tm9HrL70ZPut4rOHgY0FNrUu9BCbXA2sdQ+x0chA== + +is-weakref@^1.0.1: version "1.0.2" - resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" - integrity sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA== + resolved "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz" + integrity sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ== + dependencies: + call-bind "^1.0.2" -isarray@1.0.0, isarray@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" - integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= +is-weakset@^2.0.1: + version "2.0.2" + resolved "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.2.tgz" + integrity sha512-t2yVvttHkQktwnNNmBQ98AhENLdPUTDTE21uPqAQ0ARwQfGeQKRVS0NNurH7bTf7RrvcVn1OOge45CnBeHCSmg== + dependencies: + call-bind "^1.0.2" + get-intrinsic "^1.1.1" isarray@^2.0.5: version "2.0.5" - resolved "https://registry.yarnpkg.com/isarray/-/isarray-2.0.5.tgz#8af1e4c1221244cc62459faf38940d4e644a5723" + resolved "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz" integrity sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw== isexe@^2.0.0: version "2.0.0" - resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + resolved "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz" integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= -isobject@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89" - integrity sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk= - dependencies: - isarray "1.0.0" - -isobject@^3.0.0, isobject@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" - integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8= - isstream@~0.1.2: version "0.1.2" - resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" + resolved "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz" integrity sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo= -iterate-iterator@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/iterate-iterator/-/iterate-iterator-1.0.1.tgz#1693a768c1ddd79c969051459453f082fe82e9f6" - integrity sha512-3Q6tudGN05kbkDQDI4CqjaBf4qf85w6W6GnuZDtUVYwKgtC1q8yxYX7CZed7N+tLzQqS6roujWvszf13T+n9aw== +istanbul-lib-coverage@^3.0.0, istanbul-lib-coverage@^3.0.1: + version "3.2.0" + resolved "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz" + integrity sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw== -iterate-value@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/iterate-value/-/iterate-value-1.0.2.tgz#935115bd37d006a52046535ebc8d07e9c9337f57" - integrity sha512-A6fMAio4D2ot2r/TYzr4yUWrmwNdsN5xL7+HUiyACE4DXm+q8HtPcnFTp+NnW3k4N05tZ7FVYFFb2CR13NxyHQ== +istanbul-lib-report@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz" + integrity sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw== dependencies: - es-get-iterator "^1.0.2" - iterate-iterator "^1.0.1" + istanbul-lib-coverage "^3.0.0" + make-dir "^3.0.0" + supports-color "^7.1.0" -jest-diff@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-24.9.0.tgz#931b7d0d5778a1baf7452cb816e325e3724055da" - integrity sha512-qMfrTs8AdJE2iqrTp0hzh7kTd2PQWrsFyj9tORoKmu32xjPjeE4NyjVRDz8ybYwqS2ik8N4hsIpiVTyFeo2lBQ== +istanbul-reports@^3.0.2: + version "3.1.3" + resolved "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.3.tgz" + integrity sha512-x9LtDVtfm/t1GFiLl3NffC7hz+I1ragvgX1P/Lg1NlIagifZDKUkuuaAxH/qpwj2IuEfD8G2Bs/UKp+sZ/pKkg== dependencies: - chalk "^2.0.1" - diff-sequences "^24.9.0" - jest-get-type "^24.9.0" - pretty-format "^24.9.0" + html-escaper "^2.0.0" + istanbul-lib-report "^3.0.0" -jest-diff@^26.2.0: - version "26.2.0" - resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-26.2.0.tgz#dee62c771adbb23ae585f3f1bd289a6e8ef4f298" - integrity sha512-Wu4Aopi2nzCsHWLBlD48TgRy3Z7OsxlwvHNd1YSnHc7q1NJfrmyCPoUXrTIrydQOG5ApaYpsAsdfnMbJqV1/wQ== +jest-diff@^26.6.2: + version "26.6.2" + resolved "https://registry.npmjs.org/jest-diff/-/jest-diff-26.6.2.tgz" + integrity sha512-6m+9Z3Gv9wN0WFVasqjCL/06+EFCMTqDEUl/b87HYK2rAPTyfz4ZIuSlPhY51PIQRWx5TaxeF1qmXKe9gfN3sA== dependencies: chalk "^4.0.0" - diff-sequences "^26.0.0" - jest-get-type "^26.0.0" - pretty-format "^26.2.0" + diff-sequences "^26.6.2" + jest-get-type "^26.3.0" + pretty-format "^26.6.2" -jest-get-type@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-24.9.0.tgz#1684a0c8a50f2e4901b6644ae861f579eed2ef0e" - integrity sha512-lUseMzAley4LhIcpSP9Jf+fTrQ4a1yHQwLNeeVa2cEmbCGeoZAtYPOIv8JaxLD/sUpKxetKGP+gsHl8f8TSj8Q== +jest-diff@^27.4.6: + version "27.4.6" + resolved "https://registry.npmjs.org/jest-diff/-/jest-diff-27.4.6.tgz" + integrity sha512-zjaB0sh0Lb13VyPsd92V7HkqF6yKRH9vm33rwBt7rPYrpQvS1nCvlIy2pICbKta+ZjWngYLNn4cCK4nyZkjS/w== + dependencies: + chalk "^4.0.0" + diff-sequences "^27.4.0" + jest-get-type "^27.4.0" + pretty-format "^27.4.6" -jest-get-type@^26.0.0: - version "26.0.0" - resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-26.0.0.tgz#381e986a718998dbfafcd5ec05934be538db4039" - integrity sha512-zRc1OAPnnws1EVfykXOj19zo2EMw5Hi6HLbFCSjpuJiXtOWAYIjNsHVSbpQ8bDX7L5BGYGI8m+HmKdjHYFF0kg== +jest-get-type@^26.3.0: + version "26.3.0" + resolved "https://registry.npmjs.org/jest-get-type/-/jest-get-type-26.3.0.tgz" + integrity sha512-TpfaviN1R2pQWkIihlfEanwOXK0zcxrKEE4MlU6Tn7keoXdN6/3gK/xl0yEh8DOunn5pOVGKf8hB4R9gVh04ig== -jest-matcher-utils@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-24.9.0.tgz#f5b3661d5e628dffe6dd65251dfdae0e87c3a073" - integrity sha512-OZz2IXsu6eaiMAwe67c1T+5tUAtQyQx27/EMEkbFAGiw52tB9em+uGbzpcgYVpA8wl0hlxKPZxrly4CXU/GjHA== - dependencies: - chalk "^2.0.1" - jest-diff "^24.9.0" - jest-get-type "^24.9.0" - pretty-format "^24.9.0" +jest-get-type@^27.4.0: + version "27.4.0" + resolved "https://registry.npmjs.org/jest-get-type/-/jest-get-type-27.4.0.tgz" + integrity sha512-tk9o+ld5TWq41DkK14L4wox4s2D9MtTpKaAVzXfr5CUKm5ZK2ExcaFE0qls2W71zE/6R2TxxrK9w2r6svAFDBQ== -jest-matcher-utils@^26.2.0: - version "26.2.0" - resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-26.2.0.tgz#b107af98c2b8c557ffd46c1adf06f794aa52d622" - integrity sha512-2cf/LW2VFb3ayPHrH36ZDjp9+CAeAe/pWBAwsV8t3dKcrINzXPVxq8qMWOxwt5BaeBCx4ZupVGH7VIgB8v66vQ== +jest-matcher-utils@^26.6.2: + version "26.6.2" + resolved "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-26.6.2.tgz" + integrity sha512-llnc8vQgYcNqDrqRDXWwMr9i7rS5XFiCwvh6DTP7Jqa2mqpcCBBlpCbn+trkG0KNhPu/h8rzyBkriOtBstvWhw== dependencies: chalk "^4.0.0" - jest-diff "^26.2.0" - jest-get-type "^26.0.0" - pretty-format "^26.2.0" + jest-diff "^26.6.2" + jest-get-type "^26.3.0" + pretty-format "^26.6.2" -jest-message-util@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-24.9.0.tgz#527f54a1e380f5e202a8d1149b0ec872f43119e3" - integrity sha512-oCj8FiZ3U0hTP4aSui87P4L4jC37BtQwUMqk+zk/b11FR19BJDeZsZAvIHutWnmtw7r85UmR3CEWZ0HWU2mAlw== +jest-matcher-utils@^27.4.6: + version "27.4.6" + resolved "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-27.4.6.tgz" + integrity sha512-XD4PKT3Wn1LQnRAq7ZsTI0VRuEc9OrCPFiO1XL7bftTGmfNF0DcEwMHRgqiu7NGf8ZoZDREpGrCniDkjt79WbA== dependencies: - "@babel/code-frame" "^7.0.0" - "@jest/test-result" "^24.9.0" - "@jest/types" "^24.9.0" - "@types/stack-utils" "^1.0.1" - chalk "^2.0.1" - micromatch "^3.1.10" - slash "^2.0.0" - stack-utils "^1.0.1" - -jest-message-util@^26.2.0: - version "26.2.0" - resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-26.2.0.tgz#757fbc1323992297092bb9016a71a2eb12fd22ea" - integrity sha512-g362RhZaJuqeqG108n1sthz5vNpzTNy926eNDszo4ncRbmmcMRIUAZibnd6s5v2XSBCChAxQtCoN25gnzp7JbQ== + chalk "^4.0.0" + jest-diff "^27.4.6" + jest-get-type "^27.4.0" + pretty-format "^27.4.6" + +jest-message-util@^26.6.2: + version "26.6.2" + resolved "https://registry.npmjs.org/jest-message-util/-/jest-message-util-26.6.2.tgz" + integrity sha512-rGiLePzQ3AzwUshu2+Rn+UMFk0pHN58sOG+IaJbk5Jxuqo3NYO1U2/MIR4S1sKgsoYSXSzdtSa0TgrmtUwEbmA== dependencies: "@babel/code-frame" "^7.0.0" - "@jest/types" "^26.2.0" - "@types/stack-utils" "^1.0.1" + "@jest/types" "^26.6.2" + "@types/stack-utils" "^2.0.0" chalk "^4.0.0" graceful-fs "^4.2.4" micromatch "^4.0.2" + pretty-format "^26.6.2" slash "^3.0.0" stack-utils "^2.0.2" -jest-regex-util@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-24.9.0.tgz#c13fb3380bde22bf6575432c493ea8fe37965636" - integrity sha512-05Cmb6CuxaA+Ys6fjr3PhvV3bGQmO+2p2La4hFbU+W5uOc479f7FdLXUWXw4pYMAhhSZIuKHwSXSu6CsSBAXQA== +jest-message-util@^27.4.6: + version "27.4.6" + resolved "https://registry.npmjs.org/jest-message-util/-/jest-message-util-27.4.6.tgz" + integrity sha512-0p5szriFU0U74czRSFjH6RyS7UYIAkn/ntwMuOwTGWrQIOh5NzXXrq72LOqIkJKKvFbPq+byZKuBz78fjBERBA== + dependencies: + "@babel/code-frame" "^7.12.13" + "@jest/types" "^27.4.2" + "@types/stack-utils" "^2.0.0" + chalk "^4.0.0" + graceful-fs "^4.2.4" + micromatch "^4.0.4" + pretty-format "^27.4.6" + slash "^3.0.0" + stack-utils "^2.0.3" jest-regex-util@^26.0.0: version "26.0.0" - resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-26.0.0.tgz#d25e7184b36e39fd466c3bc41be0971e821fee28" + resolved "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-26.0.0.tgz" integrity sha512-Gv3ZIs/nA48/Zvjrl34bf+oD76JHiGDUxNOVgUjh3j890sblXryjY4rss71fPtD/njchl6PSE2hIhvyWa1eT0A== js-stringify@^1.0.1: version "1.0.2" - resolved "https://registry.yarnpkg.com/js-stringify/-/js-stringify-1.0.2.tgz#1736fddfd9724f28a3682adc6230ae7e4e9679db" + resolved "https://registry.npmjs.org/js-stringify/-/js-stringify-1.0.2.tgz" integrity sha1-Fzb939lyTyijaCrcYjCufk6Weds= "js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: version "4.0.0" - resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" + resolved "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz" integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== -js-yaml@3.13.1, js-yaml@^3.13.1: - version "3.13.1" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847" - integrity sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw== +js-yaml@4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/js-yaml/-/js-yaml-4.0.0.tgz" + integrity sha512-pqon0s+4ScYUvX30wxQi3PogGFAlUyH0awepWvwkj4jD4v+ova3RiYw8bmA6x2rDrEaj8i/oWKoRxpVNW+Re8Q== + dependencies: + argparse "^2.0.1" + +js-yaml@^3.13.1: + version "3.14.1" + resolved "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz" + integrity sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g== dependencies: argparse "^1.0.7" esprima "^4.0.0" js2xmlparser@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/js2xmlparser/-/js2xmlparser-4.0.1.tgz#670ef71bc5661f089cc90481b99a05a1227ae3bd" - integrity sha512-KrPTolcw6RocpYjdC7pL7v62e55q7qOMHvLX1UCLc5AAS8qeJ6nukarEJAF2KL2PZxlbGueEbINqZR2bDe/gUw== + version "4.0.2" + resolved "https://registry.npmjs.org/js2xmlparser/-/js2xmlparser-4.0.2.tgz" + integrity sha512-6n4D8gLlLf1n5mNLQPRfViYzu9RATblzPEtm1SthMX1Pjao0r9YI9nw7ZIfRxQMERS87mcswrg+r/OYrPRX6jA== dependencies: - xmlcreate "^2.0.3" + xmlcreate "^2.0.4" jsbn@~0.1.0: version "0.1.1" - resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" + resolved "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz" integrity sha1-peZUwuWi3rXyAdls77yoDA7y9RM= jsdoc@^3.6.7: version "3.6.7" - resolved "https://registry.yarnpkg.com/jsdoc/-/jsdoc-3.6.7.tgz#00431e376bed7f9de4716c6f15caa80e64492b89" + resolved "https://registry.npmjs.org/jsdoc/-/jsdoc-3.6.7.tgz" integrity sha512-sxKt7h0vzCd+3Y81Ey2qinupL6DpRSZJclS04ugHDNmRUXGzqicMJ6iwayhSA0S0DwwX30c5ozyUthr1QKF6uw== dependencies: "@babel/parser" "^7.9.4" @@ -2723,105 +2389,88 @@ jsdoc@^3.6.7: jsesc@^2.5.1: version "2.5.2" - resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" + resolved "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz" integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== json-schema-traverse@^0.4.1: version "0.4.1" - resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" + resolved "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz" integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== -json-schema@0.2.3: - version "0.2.3" - resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" - integrity sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM= +json-schema-traverse@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz" + integrity sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug== + +json-schema@0.4.0: + version "0.4.0" + resolved "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz" + integrity sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA== json-stable-stringify-without-jsonify@^1.0.1: version "1.0.1" - resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" + resolved "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz" integrity sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE= json-stringify-safe@~5.0.1: version "5.0.1" - resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" + resolved "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz" integrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus= json5@^1.0.1: version "1.0.1" - resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.1.tgz#779fb0018604fa854eacbf6252180d83543e3dbe" + resolved "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz" integrity sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow== dependencies: minimist "^1.2.0" json5@^2.1.2: - version "2.1.3" - resolved "https://registry.yarnpkg.com/json5/-/json5-2.1.3.tgz#c9b0f7fa9233bfe5807fe66fcf3a5617ed597d43" - integrity sha512-KXPvOm8K9IJKFM0bmdn8QXh7udDh1g/giieX0NLCaMnb4hEiVFqnop2ImTXCc5e0/oHz3LTqmHGtExn5hfMkOA== + version "2.2.0" + resolved "https://registry.npmjs.org/json5/-/json5-2.2.0.tgz" + integrity sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA== dependencies: minimist "^1.2.5" jsprim@^1.2.2: - version "1.4.1" - resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2" - integrity sha1-MT5mvB5cwG5Di8G3SZwuXFastqI= + version "1.4.2" + resolved "https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz" + integrity sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw== dependencies: assert-plus "1.0.0" extsprintf "1.3.0" - json-schema "0.2.3" + json-schema "0.4.0" verror "1.10.0" jstransformer@1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/jstransformer/-/jstransformer-1.0.0.tgz#ed8bf0921e2f3f1ed4d5c1a44f68709ed24722c3" + resolved "https://registry.npmjs.org/jstransformer/-/jstransformer-1.0.0.tgz" integrity sha1-7Yvwkh4vPx7U1cGkT2hwntJHIsM= dependencies: is-promise "^2.0.0" promise "^7.0.1" -kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0: +kind-of@^3.0.2: version "3.2.2" - resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" + resolved "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz" integrity sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ= dependencies: is-buffer "^1.1.5" -kind-of@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-4.0.0.tgz#20813df3d712928b207378691a45066fae72dd57" - integrity sha1-IIE989cSkosgc3hpGkUGb65y3Vc= - dependencies: - is-buffer "^1.1.5" - -kind-of@^5.0.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-5.1.0.tgz#729c91e2d857b7a419a1f9aa65685c4c33f5845d" - integrity sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw== - -kind-of@^6.0.0, kind-of@^6.0.2: - version "6.0.2" - resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.2.tgz#01146b36a6218e64e58f3a8d66de5d7fc6f6d051" - integrity sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA== - klaw@^3.0.0: version "3.0.0" - resolved "https://registry.yarnpkg.com/klaw/-/klaw-3.0.0.tgz#b11bec9cf2492f06756d6e809ab73a2910259146" + resolved "https://registry.npmjs.org/klaw/-/klaw-3.0.0.tgz" integrity sha512-0Fo5oir+O9jnXu5EefYbVK+mHMBeEVEy2cmctR1O1NECcCkPRreJKrS6Qt/j3KC2C148Dfo9i3pCmCMsdqGr0g== dependencies: graceful-fs "^4.1.9" -klona@^2.0.3: - version "2.0.4" - resolved "https://registry.yarnpkg.com/klona/-/klona-2.0.4.tgz#7bb1e3affb0cb8624547ef7e8f6708ea2e39dfc0" - integrity sha512-ZRbnvdg/NxqzC7L9Uyqzf4psi1OM4Cuc+sJAkQPjO6XkQIJTNbfK2Rsmbw8fx1p2mkZdp2FZYo2+LwXYY/uwIA== - lazy-cache@^1.0.3: version "1.0.4" - resolved "https://registry.yarnpkg.com/lazy-cache/-/lazy-cache-1.0.4.tgz#a1d78fc3a50474cb80845d3b3b6e1da49a446e8e" + resolved "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz" integrity sha1-odePw6UEdMuAhF07O24dpJpEbo4= levn@^0.4.1: version "0.4.1" - resolved "https://registry.yarnpkg.com/levn/-/levn-0.4.1.tgz#ae4562c007473b932a6200d403268dd2fffc6ade" + resolved "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz" integrity sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ== dependencies: prelude-ls "^1.2.1" @@ -2829,63 +2478,65 @@ levn@^0.4.1: linkify-it@^2.0.0: version "2.2.0" - resolved "https://registry.yarnpkg.com/linkify-it/-/linkify-it-2.2.0.tgz#e3b54697e78bf915c70a38acd78fd09e0058b1cf" + resolved "https://registry.npmjs.org/linkify-it/-/linkify-it-2.2.0.tgz" integrity sha512-GnAl/knGn+i1U/wjBz3akz2stz+HrHLsxMwHQGofCDfPvlf+gDKN58UtfmUquTY4/MXeE2x7k19KQmeoZi94Iw== dependencies: uc.micro "^1.0.1" -locate-path@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e" - integrity sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A== - dependencies: - p-locate "^3.0.0" - path-exists "^3.0.0" - -locate-path@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0" - integrity sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g== +locate-path@^6.0.0: + version "6.0.0" + resolved "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz" + integrity sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw== dependencies: - p-locate "^4.1.0" + p-locate "^5.0.0" lodash.get@^4.4.2: version "4.4.2" - resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99" + resolved "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz" integrity sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk= lodash.isequal@^4.5.0: version "4.5.0" - resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0" + resolved "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz" integrity sha1-QVxEePK8wwEgwizhDtMib30+GOA= -lodash@4, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.4: +lodash.merge@^4.6.2: + version "4.6.2" + resolved "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz" + integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== + +lodash.truncate@^4.4.2: + version "4.4.2" + resolved "https://registry.npmjs.org/lodash.truncate/-/lodash.truncate-4.4.2.tgz" + integrity sha1-WjUNoLERO4N+z//VgSy+WNbq4ZM= + +lodash@4, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.4: version "4.17.21" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" + resolved "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== -log-symbols@3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-3.0.0.tgz#f3a08516a5dea893336a7dee14d18a1cfdab77c4" - integrity sha512-dSkNGuI7iG3mfvDzUuYZyvk5dD9ocYCYzNU6CYDE6+Xqd+gwme6Z00NS3dUh8mq/73HaEtT7m6W+yUPtU6BZnQ== +log-symbols@4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/log-symbols/-/log-symbols-4.0.0.tgz" + integrity sha512-FN8JBzLx6CzeMrB0tg6pqlGU1wCrXW+ZXGH481kfsBqer0hToTIiHdjH4Mq8xJUbvATujKCvaREGWpGUionraA== dependencies: - chalk "^2.4.2" + chalk "^4.0.0" longest@^1.0.1: version "1.0.1" - resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097" + resolved "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz" integrity sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc= loose-envify@^1.4.0: version "1.4.0" - resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" + resolved "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz" integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q== dependencies: js-tokens "^3.0.0 || ^4.0.0" -lowdb@^1.0.0: +lowdb@^1: version "1.0.0" - resolved "https://registry.yarnpkg.com/lowdb/-/lowdb-1.0.0.tgz#5243be6b22786ccce30e50c9a33eac36b20c8064" + resolved "https://registry.npmjs.org/lowdb/-/lowdb-1.0.0.tgz" integrity sha512-2+x8esE/Wb9SQ1F9IHaYWfsC9FIecLOPrK4g17FGEayjUWH172H6nwicRovGvSE2CPZouc2MCIqCI7h9d+GftQ== dependencies: graceful-fs "^4.1.3" @@ -2896,7 +2547,7 @@ lowdb@^1.0.0: lru-cache@^4.1.5: version "4.1.5" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.5.tgz#8bbe50ea85bed59bc9e33dcab8235ee9bcf443cd" + resolved "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz" integrity sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g== dependencies: pseudomap "^1.0.2" @@ -2904,36 +2555,31 @@ lru-cache@^4.1.5: lru-cache@^6.0.0: version "6.0.0" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" + resolved "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz" integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== dependencies: yallist "^4.0.0" -make-error@^1.1.1: - version "1.3.5" - resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.5.tgz#efe4e81f6db28cadd605c70f29c831b58ef776c8" - integrity sha512-c3sIjNUow0+8swNwVpqoH4YCShKNFkMaw6oH1mNS2haDZQqkeZFlHS3dhoeEbKKmJB4vXpJucU6oH75aDYeE9g== - -map-cache@^0.2.2: - version "0.2.2" - resolved "https://registry.yarnpkg.com/map-cache/-/map-cache-0.2.2.tgz#c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf" - integrity sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8= - -map-visit@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/map-visit/-/map-visit-1.0.0.tgz#ecdca8f13144e660f1b5bd41f12f3479d98dfb8f" - integrity sha1-7Nyo8TFE5mDxtb1B8S80edmN+48= +make-dir@^3.0.0: + version "3.1.0" + resolved "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz" + integrity sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw== dependencies: - object-visit "^1.0.0" + semver "^6.0.0" + +make-error@^1.1.1: + version "1.3.6" + resolved "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz" + integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== markdown-it-anchor@^5.2.7: version "5.3.0" - resolved "https://registry.yarnpkg.com/markdown-it-anchor/-/markdown-it-anchor-5.3.0.tgz#d549acd64856a8ecd1bea58365ef385effbac744" + resolved "https://registry.npmjs.org/markdown-it-anchor/-/markdown-it-anchor-5.3.0.tgz" integrity sha512-/V1MnLL/rgJ3jkMWo84UR+K+jF1cxNG1a+KwqeXqTIJ+jtA8aWSHuigx8lTzauiIjBDbwF3NcWQMotd0Dm39jA== markdown-it@^10.0.0: version "10.0.0" - resolved "https://registry.yarnpkg.com/markdown-it/-/markdown-it-10.0.0.tgz#abfc64f141b1722d663402044e43927f1f50a8dc" + resolved "https://registry.npmjs.org/markdown-it/-/markdown-it-10.0.0.tgz" integrity sha512-YWOP1j7UbDNz+TumYP1kpwnP0aEa711cJjrAQrzd0UXlbJfc5aAq0F/PZHjiioqDC1NKgvIMX+o+9Bk7yuM2dg== dependencies: argparse "^1.0.7" @@ -2944,12 +2590,12 @@ markdown-it@^10.0.0: marked@^2.0.3: version "2.1.3" - resolved "https://registry.yarnpkg.com/marked/-/marked-2.1.3.tgz#bd017cef6431724fd4b27e0657f5ceb14bff3753" + resolved "https://registry.npmjs.org/marked/-/marked-2.1.3.tgz" integrity sha512-/Q+7MGzaETqifOMWYEA7HVMaZb4XbcRfaOzcSsHZEith83KGlvaSG33u0SKu89Mj5h+T8V2hM+8O45Qc5XTgwA== matrix-mock-request@^1.2.3: version "1.2.3" - resolved "https://registry.yarnpkg.com/matrix-mock-request/-/matrix-mock-request-1.2.3.tgz#56b15d86e2601a9b48a854844396d18caab649c8" + resolved "https://registry.npmjs.org/matrix-mock-request/-/matrix-mock-request-1.2.3.tgz" integrity sha512-Tr7LDHweTW8Ql4C8XhGQFGMzuh+HmPjOcQqrHH1qfSesq0cwdPWanvdnllNjeHoAMcZ43HpMFMzFZfNW1/6HYg== dependencies: bluebird "^3.5.0" @@ -2957,186 +2603,122 @@ matrix-mock-request@^1.2.3: mdurl@^1.0.1: version "1.0.1" - resolved "https://registry.yarnpkg.com/mdurl/-/mdurl-1.0.1.tgz#fe85b2ec75a59037f2adfec100fd6c601761152e" + resolved "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz" integrity sha1-/oWy7HWlkDfyrf7BAP1sYBdhFS4= media-typer@0.3.0: version "0.3.0" - resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" + resolved "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz" integrity sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g= merge-descriptors@1.0.1: version "1.0.1" - resolved "https://registry.yarnpkg.com/merge-descriptors/-/merge-descriptors-1.0.1.tgz#b00aaa556dd8b44568150ec9d1b953f3f90cbb61" + resolved "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz" integrity sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E= methods@~1.1.2: version "1.1.2" - resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" + resolved "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz" integrity sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4= -micromatch@^3.1.10: - version "3.1.10" - resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23" - integrity sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg== - dependencies: - arr-diff "^4.0.0" - array-unique "^0.3.2" - braces "^2.3.1" - define-property "^2.0.2" - extend-shallow "^3.0.2" - extglob "^2.0.4" - fragment-cache "^0.2.1" - kind-of "^6.0.2" - nanomatch "^1.2.9" - object.pick "^1.3.0" - regex-not "^1.0.0" - snapdragon "^0.8.1" - to-regex "^3.0.2" - -micromatch@^4.0.2: - version "4.0.2" - resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.2.tgz#4fcb0999bf9fbc2fcbdd212f6d629b9a56c39259" - integrity sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q== +micromatch@^4.0.2, micromatch@^4.0.4: + version "4.0.4" + resolved "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz" + integrity sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg== dependencies: braces "^3.0.1" - picomatch "^2.0.5" - -mime-db@1.40.0: - version "1.40.0" - resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.40.0.tgz#a65057e998db090f732a68f6c276d387d4126c32" - integrity sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA== + picomatch "^2.2.3" -mime-db@1.42.0: - version "1.42.0" - resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.42.0.tgz#3e252907b4c7adb906597b4b65636272cf9e7bac" - integrity sha512-UbfJCR4UAVRNgMpfImz05smAXK7+c+ZntjaA26ANtkXLlOe947Aag5zdIcKQULAiF9Cq4WxBi9jUs5zkA84bYQ== +mime-db@1.51.0: + version "1.51.0" + resolved "https://registry.npmjs.org/mime-db/-/mime-db-1.51.0.tgz" + integrity sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g== -mime-types@^2.1.12, mime-types@~2.1.19: - version "2.1.24" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.24.tgz#b6f8d0b3e951efb77dedeca194cff6d16f676f81" - integrity sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ== +mime-types@^2.1.12, mime-types@~2.1.19, mime-types@~2.1.24: + version "2.1.34" + resolved "https://registry.npmjs.org/mime-types/-/mime-types-2.1.34.tgz" + integrity sha512-6cP692WwGIs9XXdOO4++N+7qjqv0rqxxVvJ3VHPh/Sc9mVZcQP+ZGhkKiTvWMQRr2tbHkJP/Yn7Y0npb3ZBs4A== dependencies: - mime-db "1.40.0" - -mime-types@~2.1.24: - version "2.1.25" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.25.tgz#39772d46621f93e2a80a856c53b86a62156a6437" - integrity sha512-5KhStqB5xpTAeGqKBAMgwaYMnQik7teQN4IAzC7npDv6kzeU6prfkR67bc87J1kWMPGkoaZSq1npmexMgkmEVg== - dependencies: - mime-db "1.42.0" + mime-db "1.51.0" mime@1.6.0: version "1.6.0" - resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1" + resolved "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz" integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg== -mimic-response@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-2.1.0.tgz#d13763d35f613d09ec37ebb30bac0469c0ee8f43" - integrity sha512-wXqjST+SLt7R009ySCglWBCFpjUygmCIfD790/kVbiGmUgfYGuB14PiTd5DwVxSV4NcYHjzMkoj5LjQZwTQLEA== - min-indent@^1.0.0: version "1.0.1" - resolved "https://registry.yarnpkg.com/min-indent/-/min-indent-1.0.1.tgz#a63f681673b30571fbe8bc25686ae746eefa9869" + resolved "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz" integrity sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg== minimalistic-assert@^1.0.1: version "1.0.1" - resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" + resolved "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz" integrity sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A== minimatch@3.0.4, minimatch@^3.0.2, minimatch@^3.0.4: version "3.0.4" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" + resolved "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz" integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== dependencies: brace-expansion "^1.1.7" -minimist@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" - integrity sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ= - -minimist@^1.2.3, minimist@^1.2.5: +minimist@^1.2.0, minimist@^1.2.5: version "1.2.5" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602" + resolved "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz" integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw== -minipass@^3.0.0: - version "3.1.3" - resolved "https://registry.yarnpkg.com/minipass/-/minipass-3.1.3.tgz#7d42ff1f39635482e15f9cdb53184deebd5815fd" - integrity sha512-Mgd2GdMVzY+x3IJ+oHnVM+KG3lA5c8tnabyJKmHSaG2kAGpudxuOf8ToDkhumF7UzME7DecbQE9uOZhNm7PuJg== - dependencies: - yallist "^4.0.0" - -minizlib@^2.1.1: - version "2.1.2" - resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-2.1.2.tgz#e90d3466ba209b932451508a11ce3d3632145931" - integrity sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg== - dependencies: - minipass "^3.0.0" - yallist "^4.0.0" - -mixin-deep@^1.2.0: - version "1.3.2" - resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.2.tgz#1120b43dc359a785dce65b55b82e257ccf479566" - integrity sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA== - dependencies: - for-in "^1.0.2" - is-extendable "^1.0.1" - -mkdirp-classic@^0.5.2, mkdirp-classic@^0.5.3: - version "0.5.3" - resolved "https://registry.yarnpkg.com/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz#fa10c9115cc6d8865be221ba47ee9bed78601113" - integrity sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A== - mkdirp@^0.5.1, mkdirp@^0.5.3: version "0.5.5" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.5.tgz#d91cefd62d1436ca0f41620e251288d420099def" + resolved "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz" integrity sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ== dependencies: minimist "^1.2.5" -mkdirp@^1.0.3, mkdirp@^1.0.4: +mkdirp@^1.0.4: version "1.0.4" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" + resolved "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz" integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== mocha@^8.1.1: - version "8.1.1" - resolved "https://registry.yarnpkg.com/mocha/-/mocha-8.1.1.tgz#1de1ba4e9a2c955d96b84e469d7540848223592d" - integrity sha512-p7FuGlYH8t7gaiodlFreseLxEmxTgvyG9RgPHODFPySNhwUehu8NIb0vdSt3WFckSneswZ0Un5typYcWElk7HQ== + version "8.4.0" + resolved "https://registry.npmjs.org/mocha/-/mocha-8.4.0.tgz" + integrity sha512-hJaO0mwDXmZS4ghXsvPVriOhsxQ7ofcpQdm8dE+jISUOKopitvnXFQmpRR7jd2K6VBG6E26gU3IAbXXGIbu4sQ== dependencies: + "@ungap/promise-all-settled" "1.1.2" ansi-colors "4.1.1" browser-stdout "1.3.1" - chokidar "3.3.1" - debug "3.2.6" - diff "4.0.2" - escape-string-regexp "1.0.5" - find-up "4.1.0" + chokidar "3.5.1" + debug "4.3.1" + diff "5.0.0" + escape-string-regexp "4.0.0" + find-up "5.0.0" glob "7.1.6" growl "1.10.5" he "1.2.0" - js-yaml "3.13.1" - log-symbols "3.0.0" + js-yaml "4.0.0" + log-symbols "4.0.0" minimatch "3.0.4" - ms "2.1.2" - object.assign "4.1.0" - promise.allsettled "1.0.2" - serialize-javascript "4.0.0" - strip-json-comments "3.0.1" - supports-color "7.1.0" + ms "2.1.3" + nanoid "3.1.20" + serialize-javascript "5.0.1" + strip-json-comments "3.1.1" + supports-color "8.1.1" which "2.0.2" wide-align "1.1.3" - workerpool "6.0.0" - yargs "13.3.2" - yargs-parser "13.1.2" - yargs-unparser "1.6.1" + workerpool "6.1.0" + yargs "16.2.0" + yargs-parser "20.2.4" + yargs-unparser "2.0.0" + +moo@^0.5.0, moo@^0.5.1: + version "0.5.1" + resolved "https://registry.npmjs.org/moo/-/moo-0.5.1.tgz" + integrity sha512-I1mnb5xn4fO80BH9BLcF0yLypy2UKl+Cb01Fu0hJRkJjlCRtxZMWkTdAtDd5ZqCOxtCkhmRwyI57vWT+1iZ67w== morgan@^1.10.0: version "1.10.0" - resolved "https://registry.yarnpkg.com/morgan/-/morgan-1.10.0.tgz#091778abc1fc47cd3509824653dae1faab6b17d7" + resolved "https://registry.npmjs.org/morgan/-/morgan-1.10.0.tgz" integrity sha512-AbegBVI4sh6El+1gNwvD5YIck7nSA36weD7xvIxG4in80j/UoK8AEGaWnnz8v1GxonMCltmlNs5ZKbGvl9b1XQ== dependencies: basic-auth "~2.0.1" @@ -3147,185 +2729,142 @@ morgan@^1.10.0: ms@2.0.0: version "2.0.0" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" + resolved "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz" integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= -ms@2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.1.tgz#30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a" - integrity sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg== - -ms@2.1.2, ms@^2.1.1: +ms@2.1.2: version "2.1.2" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" + resolved "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== -nanoid@^3.1.22: - version "3.1.22" - resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.22.tgz#b35f8fb7d151990a8aebd5aa5015c03cf726f844" - integrity sha512-/2ZUaJX2ANuLtTvqTlgqBQNJoQO398KyJgZloL0PZkC0dpysjncRUPsFe3DUPzz/y3h+u7C46np8RMuvF3jsSQ== - -nanomatch@^1.2.9: - version "1.2.13" - resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119" - integrity sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA== - dependencies: - arr-diff "^4.0.0" - array-unique "^0.3.2" - define-property "^2.0.2" - extend-shallow "^3.0.2" - fragment-cache "^0.2.1" - is-windows "^1.0.2" - kind-of "^6.0.2" - object.pick "^1.3.0" - regex-not "^1.0.0" - snapdragon "^0.8.1" - to-regex "^3.0.1" - -napi-build-utils@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/napi-build-utils/-/napi-build-utils-1.0.2.tgz#b1fddc0b2c46e380a0b7a76f984dd47c41a13806" - integrity sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg== +ms@2.1.3: + version "2.1.3" + resolved "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz" + integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== + +nanoid@3.1.20: + version "3.1.20" + resolved "https://registry.npmjs.org/nanoid/-/nanoid-3.1.20.tgz" + integrity sha512-a1cQNyczgKbLX9jwbS/+d7W8fX/RfgYR7lVWwWOGIPNgK2m0MWvrGF6/m4kk6U3QcFMnZf3RIhL0v2Jgh/0Uxw== + +nanoid@^3.1.30: + version "3.1.32" + resolved "https://registry.npmjs.org/nanoid/-/nanoid-3.1.32.tgz" + integrity sha512-F8mf7R3iT9bvThBoW4tGXhXFHCctyCiUUPrWF8WaTqa3h96d9QybkSeba43XVOOE3oiLfkVDe4bT8MeGmkrTxw== natural-compare@^1.4.0: version "1.4.0" - resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" + resolved "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz" integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= +nearley@^2.20.1: + version "2.20.1" + resolved "https://registry.npmjs.org/nearley/-/nearley-2.20.1.tgz" + integrity sha512-+Mc8UaAebFzgV+KpI5n7DasuuQCHA89dmwm7JXw3TV43ukfNQ9DnBH3Mdb2g/I4Fdxc26pwimBWvjIw0UAILSQ== + dependencies: + commander "^2.19.0" + moo "^0.5.0" + railroad-diagrams "^1.0.0" + randexp "0.4.6" + negotiator@0.6.2: version "0.6.2" - resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.2.tgz#feacf7ccf525a77ae9634436a64883ffeca346fb" + resolved "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz" integrity sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw== neo-async@^2.6.1: version "2.6.2" - resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" + resolved "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz" integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw== -node-abi@^2.21.0: - version "2.30.0" - resolved "https://registry.yarnpkg.com/node-abi/-/node-abi-2.30.0.tgz#8be53bf3e7945a34eea10e0fc9a5982776cf550b" - integrity sha512-g6bZh3YCKQRdwuO/tSZZYJAw622SjsRfJ2X0Iy4sSOHZ34/sPPdVBn8fev2tj7njzLwuqPw9uMtGsGkO5kIQvg== - dependencies: - semver "^5.4.1" - node-dir@^0.1.10: version "0.1.17" - resolved "https://registry.yarnpkg.com/node-dir/-/node-dir-0.1.17.tgz#5f5665d93351335caabef8f1c554516cf5f1e4e5" + resolved "https://registry.npmjs.org/node-dir/-/node-dir-0.1.17.tgz" integrity sha1-X1Zl2TNRM1yqvvjxxVRRbPXx5OU= dependencies: minimatch "^3.0.2" +node-releases@^2.0.1: + version "2.0.1" + resolved "https://registry.npmjs.org/node-releases/-/node-releases-2.0.1.tgz" + integrity sha512-CqyzN6z7Q6aMeF/ktcMVTzhAHCEpf8SOarwpzpf8pNBY2k5/oM34UHldUwp8VKI7uxct2HxSRdJjBaZeESzcxA== + normalize-path@^3.0.0, normalize-path@~3.0.0: version "3.0.0" - resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" + resolved "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz" integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== -npmlog@^4.0.1: - version "4.1.2" - resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b" - integrity sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg== - dependencies: - are-we-there-yet "~1.1.2" - console-control-strings "~1.1.0" - gauge "~2.7.3" - set-blocking "~2.0.0" - -number-is-nan@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" - integrity sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0= - oauth-sign@~0.9.0: version "0.9.0" - resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455" + resolved "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz" integrity sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ== object-assign@^4.0.1, object-assign@^4.1.0, object-assign@^4.1.1: version "4.1.1" - resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" + resolved "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz" integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= -object-copy@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/object-copy/-/object-copy-0.1.0.tgz#7e7d858b781bd7c991a41ba975ed3812754e998c" - integrity sha1-fn2Fi3gb18mRpBupde04EnVOmYw= - dependencies: - copy-descriptor "^0.1.0" - define-property "^0.2.5" - kind-of "^3.0.3" - -object-inspect@^1.1.0, object-inspect@^1.6.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.6.0.tgz#c70b6cbf72f274aab4c34c0c82f5167bf82cf15b" - integrity sha512-GJzfBZ6DgDAmnuaM3104jR4s1Myxr3Y3zfIyN4z3UdqN69oSRacNK8UhnobDdC+7J2AHCjGwxQubNJfE70SXXQ== - -object-inspect@^1.7.0: - version "1.8.0" - resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.8.0.tgz#df807e5ecf53a609cc6bfe93eac3cc7be5b3a9d0" - integrity sha512-jLdtEOB112fORuypAyl/50VRVIBIdVQOSUUGQHzJ4xBSbit81zRarz7GThkEFZy1RceYrWYcPcBFPQwHyAc1gA== +object-inspect@^1.1.0, object-inspect@^1.11.0, object-inspect@^1.12.0, object-inspect@^1.9.0: + version "1.12.0" + resolved "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.0.tgz" + integrity sha512-Ho2z80bVIvJloH+YzRmpZVQe87+qASmBUKZDWgx9cu+KDrX2ZDH/3tMy+gXbZETVGs2M8YdxObOh7XAtim9Y0g== -object-keys@^1.0.11, object-keys@^1.0.12, object-keys@^1.0.9, object-keys@^1.1.1: +object-keys@^1.0.12, object-keys@^1.0.9, object-keys@^1.1.1: version "1.1.1" - resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" + resolved "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz" integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== -object-visit@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/object-visit/-/object-visit-1.0.1.tgz#f79c4493af0c5377b59fe39d395e41042dd045bb" - integrity sha1-95xEk68MU3e1n+OdOV5BBC3QRbs= - dependencies: - isobject "^3.0.0" - -object.assign@4.1.0, object.assign@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.0.tgz#968bf1100d7956bb3ca086f006f846b3bc4008da" - integrity sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w== +object.assign@^4.1.2: + version "4.1.2" + resolved "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz" + integrity sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ== dependencies: - define-properties "^1.1.2" - function-bind "^1.1.1" - has-symbols "^1.0.0" - object-keys "^1.0.11" + call-bind "^1.0.0" + define-properties "^1.1.3" + has-symbols "^1.0.1" + object-keys "^1.1.1" -object.entries@^1.0.4: - version "1.1.0" - resolved "https://registry.yarnpkg.com/object.entries/-/object.entries-1.1.0.tgz#2024fc6d6ba246aee38bdb0ffd5cfbcf371b7519" - integrity sha512-l+H6EQ8qzGRxbkHOd5I/aHRhHDKoQXQ8g0BYt4uSweQU1/J6dZUOyWh9a2Vky35YCKjzmgxOzta2hH6kf9HuXA== +object.entries@^1.1.5: + version "1.1.5" + resolved "https://registry.npmjs.org/object.entries/-/object.entries-1.1.5.tgz" + integrity sha512-TyxmjUoZggd4OrrU1W66FMDG6CuqJxsFvymeyXI51+vQLN67zYfZseptRge703kKQdo4uccgAKebXFcRCzk4+g== dependencies: + call-bind "^1.0.2" define-properties "^1.1.3" - es-abstract "^1.12.0" - function-bind "^1.1.1" - has "^1.0.3" + es-abstract "^1.19.1" -object.pick@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/object.pick/-/object.pick-1.3.0.tgz#87a10ac4c1694bd2e1cbf53591a66141fb5dd747" - integrity sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c= +object.getprototypeof@^1.0.3: + version "1.0.3" + resolved "https://registry.npmjs.org/object.getprototypeof/-/object.getprototypeof-1.0.3.tgz" + integrity sha512-EP3J0rXZA4OuvSl98wYa0hY5zHUJo2kGrp2eYDro0yCe3yrKm7xtXDgbpT+YPK2RzdtdvJtm0IfaAyXeehQR0w== dependencies: - isobject "^3.0.1" + call-bind "^1.0.2" + define-properties "^1.1.3" + es-abstract "^1.19.1" + reflect.getprototypeof "^1.0.2" on-finished@~2.3.0: version "2.3.0" - resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.3.0.tgz#20f1336481b083cd75337992a16971aa2d906947" + resolved "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz" integrity sha1-IPEzZIGwg811M3mSoWlxqi2QaUc= dependencies: ee-first "1.1.1" on-headers@~1.0.2: version "1.0.2" - resolved "https://registry.yarnpkg.com/on-headers/-/on-headers-1.0.2.tgz#772b0ae6aaa525c399e489adfad90c403eb3c28f" + resolved "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz" integrity sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA== -once@^1.3.0, once@^1.3.1, once@^1.4.0: +once@^1.3.0: version "1.4.0" - resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + resolved "https://registry.npmjs.org/once/-/once-1.4.0.tgz" integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= dependencies: wrappy "1" optionator@^0.9.1: version "0.9.1" - resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.1.tgz#4f236a6373dae0566a6d43e1326674f50c291499" + resolved "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz" integrity sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw== dependencies: deep-is "^0.1.3" @@ -3335,227 +2874,170 @@ optionator@^0.9.1: type-check "^0.4.0" word-wrap "^1.2.3" -p-limit@^2.0.0: - version "2.2.1" - resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.2.1.tgz#aa07a788cc3151c939b5131f63570f0dd2009537" - integrity sha512-85Tk+90UCVWvbDavCLKPOLC9vvY8OwEX/RtKF+/1OADJMVlFfEHOiMTPVyxg7mk/dKa+ipdHm0OUkTvCpMTuwg== - dependencies: - p-try "^2.0.0" - -p-limit@^2.2.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" - integrity sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w== - dependencies: - p-try "^2.0.0" - -p-locate@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-3.0.0.tgz#322d69a05c0264b25997d9f40cd8a891ab0064a4" - integrity sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ== - dependencies: - p-limit "^2.0.0" - -p-locate@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-4.1.0.tgz#a3428bb7088b3a60292f66919278b7c297ad4f07" - integrity sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A== +p-limit@^3.0.2: + version "3.1.0" + resolved "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz" + integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ== dependencies: - p-limit "^2.2.0" + yocto-queue "^0.1.0" -p-try@^2.0.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" - integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== +p-locate@^5.0.0: + version "5.0.0" + resolved "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz" + integrity sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw== + dependencies: + p-limit "^3.0.2" parent-module@^1.0.0: version "1.0.1" - resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" + resolved "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz" integrity sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g== dependencies: callsites "^3.0.0" parse-srcset@^1.0.2: version "1.0.2" - resolved "https://registry.yarnpkg.com/parse-srcset/-/parse-srcset-1.0.2.tgz#f2bd221f6cc970a938d88556abc589caaaa2bde1" + resolved "https://registry.npmjs.org/parse-srcset/-/parse-srcset-1.0.2.tgz" integrity sha1-8r0iH2zJcKk42IVWq8WJyqqiveE= +parseley@^0.7.0: + version "0.7.0" + resolved "https://registry.npmjs.org/parseley/-/parseley-0.7.0.tgz" + integrity sha512-xyOytsdDu077M3/46Am+2cGXEKM9U9QclBDv7fimY7e+BBlxh2JcBp2mgNsmkyA9uvgyTjVzDi7cP1v4hcFxbw== + dependencies: + moo "^0.5.1" + nearley "^2.20.1" + parseurl@~1.3.3: version "1.3.3" - resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4" + resolved "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz" integrity sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ== -pascalcase@^0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/pascalcase/-/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14" - integrity sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ= - -path-exists@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" - integrity sha1-zg6+ql94yxiSXqfYENe1mwEP1RU= - path-exists@^4.0.0: version "4.0.0" - resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" + resolved "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz" integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== path-is-absolute@^1.0.0: version "1.0.1" - resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + resolved "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz" integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= path-key@^3.1.0: version "3.1.1" - resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" + resolved "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz" integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== -path-parse@^1.0.6: +path-parse@^1.0.7: version "1.0.7" - resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" + resolved "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== path-to-regexp@0.1.7: version "0.1.7" - resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c" + resolved "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz" integrity sha1-32BBeABfUi8V60SQ5yR6G/qmf4w= performance-now@^2.1.0: version "2.1.0" - resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" + resolved "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz" integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns= -picomatch@^2.0.4, picomatch@^2.0.5, picomatch@^2.0.7: - version "2.2.2" - resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.2.2.tgz#21f333e9b6b8eaff02468f5146ea406d345f4dad" - integrity sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg== +picocolors@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz" + integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== + +picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.3: + version "2.3.1" + resolved "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz" + integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== pify@^3.0.0: version "3.0.0" - resolved "https://registry.yarnpkg.com/pify/-/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176" + resolved "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz" integrity sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY= -posix-character-classes@^0.1.0: - version "0.1.1" - resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" - integrity sha1-AerA/jta9xoqbAL+q7jB/vfgDqs= - -postcss@^8.0.2: - version "8.2.14" - resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.2.14.tgz#dcf313eb8247b3ce8078d048c0e8262ca565ad2b" - integrity sha512-+jD0ZijcvyCqPQo/m/CW0UcARpdFylq04of+Q7RKX6f/Tu+dvpUI/9Sp81+i6/vJThnOBX09Quw0ZLOVwpzX3w== +postcss@^8.3.11: + version "8.4.5" + resolved "https://registry.npmjs.org/postcss/-/postcss-8.4.5.tgz" + integrity sha512-jBDboWM8qpaqwkMwItqTQTiFikhs/67OYVvblFFTM7MrZjt6yMKd6r2kgXizEbTTljacm4NldIlZnhbjr84QYg== dependencies: - colorette "^1.2.2" - nanoid "^3.1.22" - source-map "^0.6.1" - -prebuild-install@^6.0.1: - version "6.1.3" - resolved "https://registry.yarnpkg.com/prebuild-install/-/prebuild-install-6.1.3.tgz#8ea1f9d7386a0b30f7ef20247e36f8b2b82825a2" - integrity sha512-iqqSR84tNYQUQHRXalSKdIaM8Ov1QxOVuBNWI7+BzZWv6Ih9k75wOnH1rGQ9WWTaaLkTpxWKIciOF0KyfM74+Q== - dependencies: - detect-libc "^1.0.3" - expand-template "^2.0.3" - github-from-package "0.0.0" - minimist "^1.2.3" - mkdirp-classic "^0.5.3" - napi-build-utils "^1.0.1" - node-abi "^2.21.0" - npmlog "^4.0.1" - pump "^3.0.0" - rc "^1.2.7" - simple-get "^3.0.3" - tar-fs "^2.0.0" - tunnel-agent "^0.6.0" + nanoid "^3.1.30" + picocolors "^1.0.0" + source-map-js "^1.0.1" prelude-ls@^1.2.1: version "1.2.1" - resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" + resolved "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz" integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== -pretty-format@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-24.9.0.tgz#12fac31b37019a4eea3c11aa9a959eb7628aa7c9" - integrity sha512-00ZMZUiHaJrNfk33guavqgvfJS30sLYf0f8+Srklv0AMPodGGHcoHgksZ3OThYnIvOd+8yMCn0YiEOogjlgsnA== +pretty-format@^26.6.2: + version "26.6.2" + resolved "https://registry.npmjs.org/pretty-format/-/pretty-format-26.6.2.tgz" + integrity sha512-7AeGuCYNGmycyQbCqd/3PWH4eOoX/OiCa0uphp57NVTeAGdJGaAliecxwBDHYQCIvrW7aDBZCYeNTP/WX69mkg== dependencies: - "@jest/types" "^24.9.0" - ansi-regex "^4.0.0" - ansi-styles "^3.2.0" - react-is "^16.8.4" - -pretty-format@^26.2.0: - version "26.2.0" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-26.2.0.tgz#83ecc8d7de676ff224225055e72bd64821cec4f1" - integrity sha512-qi/8IuBu2clY9G7qCXgCdD1Bf9w+sXakdHTRToknzMtVy0g7c4MBWaZy7MfB7ndKZovRO6XRwJiAYqq+MC7SDA== - dependencies: - "@jest/types" "^26.2.0" + "@jest/types" "^26.6.2" ansi-regex "^5.0.0" ansi-styles "^4.0.0" - react-is "^16.12.0" + react-is "^17.0.1" + +pretty-format@^27.4.6: + version "27.4.6" + resolved "https://registry.npmjs.org/pretty-format/-/pretty-format-27.4.6.tgz" + integrity sha512-NblstegA1y/RJW2VyML+3LlpFjzx62cUrtBIKIWDXEDkjNeleA7Od7nrzcs/VLQvAeV4CgSYhrN39DRN88Qi/g== + dependencies: + ansi-regex "^5.0.1" + ansi-styles "^5.0.0" + react-is "^17.0.1" private@^0.1.8: version "0.1.8" - resolved "https://registry.yarnpkg.com/private/-/private-0.1.8.tgz#2381edb3689f7a53d653190060fcf822d2f368ff" + resolved "https://registry.npmjs.org/private/-/private-0.1.8.tgz" integrity sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg== -process-nextick-args@~2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" - integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== - progress@^2.0.0: version "2.0.3" - resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" + resolved "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz" integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA== -promise.allsettled@1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/promise.allsettled/-/promise.allsettled-1.0.2.tgz#d66f78fbb600e83e863d893e98b3d4376a9c47c9" - integrity sha512-UpcYW5S1RaNKT6pd+s9jp9K9rlQge1UXKskec0j6Mmuq7UJCvlS2J2/s/yuPN8ehftf9HXMxWlKiPbGGUzpoRg== - dependencies: - array.prototype.map "^1.0.1" - define-properties "^1.1.3" - es-abstract "^1.17.0-next.1" - function-bind "^1.1.1" - iterate-value "^1.0.0" - promise@^7.0.1: version "7.3.1" - resolved "https://registry.yarnpkg.com/promise/-/promise-7.3.1.tgz#064b72602b18f90f29192b8b1bc418ffd1ebd3bf" + resolved "https://registry.npmjs.org/promise/-/promise-7.3.1.tgz" integrity sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg== dependencies: asap "~2.0.3" prop-types@^15.7.2: - version "15.7.2" - resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5" - integrity sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ== + version "15.8.1" + resolved "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz" + integrity sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg== dependencies: loose-envify "^1.4.0" object-assign "^4.1.1" - react-is "^16.8.1" + react-is "^16.13.1" -proxy-addr@~2.0.5: - version "2.0.5" - resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.5.tgz#34cbd64a2d81f4b1fd21e76f9f06c8a45299ee34" - integrity sha512-t/7RxHXPH6cJtP0pRG6smSr9QJidhB+3kXu0KgXnbGYMgzEnUxRQ4/LDdfOwZEMyIh3/xHb8PX3t+lfL9z+YVQ== +proxy-addr@~2.0.7: + 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== dependencies: - forwarded "~0.1.2" - ipaddr.js "1.9.0" + forwarded "0.2.0" + ipaddr.js "1.9.1" pseudomap@^1.0.2: version "1.0.2" - resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" + resolved "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz" integrity sha1-8FKijacOYYkX7wqKw0wa5aaChrM= psl@^1.1.28: - version "1.4.0" - resolved "https://registry.yarnpkg.com/psl/-/psl-1.4.0.tgz#5dd26156cdb69fa1fdb8ab1991667d3f80ced7c2" - integrity sha512-HZzqCGPecFLyoRj5HLfuDSKYTJkAfB5thKBIkRHtGjWwY7p1dAyveIbXIq4tO0KYfDF2tHqPUgY9SDnGm00uFw== + version "1.8.0" + resolved "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz" + integrity sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ== pug-attrs@^2.0.4: version "2.0.4" - resolved "https://registry.yarnpkg.com/pug-attrs/-/pug-attrs-2.0.4.tgz#b2f44c439e4eb4ad5d4ef25cac20d18ad28cc336" + resolved "https://registry.npmjs.org/pug-attrs/-/pug-attrs-2.0.4.tgz" integrity sha512-TaZ4Z2TWUPDJcV3wjU3RtUXMrd3kM4Wzjbe3EWnSsZPsJ3LDI0F3yCnf2/W7PPFF+edUFQ0HgDL1IoxSz5K8EQ== dependencies: constantinople "^3.0.1" @@ -3564,7 +3046,7 @@ pug-attrs@^2.0.4: pug-code-gen@^2.0.2: version "2.0.3" - resolved "https://registry.yarnpkg.com/pug-code-gen/-/pug-code-gen-2.0.3.tgz#122eb9ada9b5bf601705fe15aaa0a7d26bc134ab" + resolved "https://registry.npmjs.org/pug-code-gen/-/pug-code-gen-2.0.3.tgz" integrity sha512-r9sezXdDuZJfW9J91TN/2LFbiqDhmltTFmGpHTsGdrNGp3p4SxAjjXEfnuK2e4ywYsRIVP0NeLbSAMHUcaX1EA== dependencies: constantinople "^3.1.2" @@ -3578,12 +3060,12 @@ pug-code-gen@^2.0.2: pug-error@^1.3.3: version "1.3.3" - resolved "https://registry.yarnpkg.com/pug-error/-/pug-error-1.3.3.tgz#f342fb008752d58034c185de03602dd9ffe15fa6" + resolved "https://registry.npmjs.org/pug-error/-/pug-error-1.3.3.tgz" integrity sha512-qE3YhESP2mRAWMFJgKdtT5D7ckThRScXRwkfo+Erqga7dyJdY3ZquspprMCj/9sJ2ijm5hXFWQE/A3l4poMWiQ== pug-filters@^3.1.1: version "3.1.1" - resolved "https://registry.yarnpkg.com/pug-filters/-/pug-filters-3.1.1.tgz#ab2cc82db9eeccf578bda89130e252a0db026aa7" + resolved "https://registry.npmjs.org/pug-filters/-/pug-filters-3.1.1.tgz" integrity sha512-lFfjNyGEyVWC4BwX0WyvkoWLapI5xHSM3xZJFUhx4JM4XyyRdO8Aucc6pCygnqV2uSgJFaJWW3Ft1wCWSoQkQg== dependencies: clean-css "^4.1.11" @@ -3596,7 +3078,7 @@ pug-filters@^3.1.1: pug-lexer@^4.1.0: version "4.1.0" - resolved "https://registry.yarnpkg.com/pug-lexer/-/pug-lexer-4.1.0.tgz#531cde48c7c0b1fcbbc2b85485c8665e31489cfd" + resolved "https://registry.npmjs.org/pug-lexer/-/pug-lexer-4.1.0.tgz" integrity sha512-i55yzEBtjm0mlplW4LoANq7k3S8gDdfC6+LThGEvsK4FuobcKfDAwt6V4jKPH9RtiE3a2Akfg5UpafZ1OksaPA== dependencies: character-parser "^2.1.1" @@ -3605,7 +3087,7 @@ pug-lexer@^4.1.0: pug-linker@^3.0.6: version "3.0.6" - resolved "https://registry.yarnpkg.com/pug-linker/-/pug-linker-3.0.6.tgz#f5bf218b0efd65ce6670f7afc51658d0f82989fb" + resolved "https://registry.npmjs.org/pug-linker/-/pug-linker-3.0.6.tgz" integrity sha512-bagfuHttfQOpANGy1Y6NJ+0mNb7dD2MswFG2ZKj22s8g0wVsojpRlqveEQHmgXXcfROB2RT6oqbPYr9EN2ZWzg== dependencies: pug-error "^1.3.3" @@ -3613,7 +3095,7 @@ pug-linker@^3.0.6: pug-load@^2.0.12: version "2.0.12" - resolved "https://registry.yarnpkg.com/pug-load/-/pug-load-2.0.12.tgz#d38c85eb85f6e2f704dea14dcca94144d35d3e7b" + resolved "https://registry.npmjs.org/pug-load/-/pug-load-2.0.12.tgz" integrity sha512-UqpgGpyyXRYgJs/X60sE6SIf8UBsmcHYKNaOccyVLEuT6OPBIMo6xMPhoJnqtB3Q3BbO4Z3Bjz5qDsUWh4rXsg== dependencies: object-assign "^4.1.0" @@ -3621,7 +3103,7 @@ pug-load@^2.0.12: pug-parser@^5.0.1: version "5.0.1" - resolved "https://registry.yarnpkg.com/pug-parser/-/pug-parser-5.0.1.tgz#03e7ada48b6840bd3822f867d7d90f842d0ffdc9" + resolved "https://registry.npmjs.org/pug-parser/-/pug-parser-5.0.1.tgz" integrity sha512-nGHqK+w07p5/PsPIyzkTQfzlYfuqoiGjaoqHv1LjOv2ZLXmGX1O+4Vcvps+P4LhxZ3drYSljjq4b+Naid126wA== dependencies: pug-error "^1.3.3" @@ -3629,24 +3111,24 @@ pug-parser@^5.0.1: pug-runtime@^2.0.5: version "2.0.5" - resolved "https://registry.yarnpkg.com/pug-runtime/-/pug-runtime-2.0.5.tgz#6da7976c36bf22f68e733c359240d8ae7a32953a" + resolved "https://registry.npmjs.org/pug-runtime/-/pug-runtime-2.0.5.tgz" integrity sha512-P+rXKn9un4fQY77wtpcuFyvFaBww7/91f3jHa154qU26qFAnOe6SW1CbIDcxiG5lLK9HazYrMCCuDvNgDQNptw== pug-strip-comments@^1.0.4: version "1.0.4" - resolved "https://registry.yarnpkg.com/pug-strip-comments/-/pug-strip-comments-1.0.4.tgz#cc1b6de1f6e8f5931cf02ec66cdffd3f50eaf8a8" + resolved "https://registry.npmjs.org/pug-strip-comments/-/pug-strip-comments-1.0.4.tgz" integrity sha512-i5j/9CS4yFhSxHp5iKPHwigaig/VV9g+FgReLJWWHEHbvKsbqL0oP/K5ubuLco6Wu3Kan5p7u7qk8A4oLLh6vw== dependencies: pug-error "^1.3.3" pug-walk@^1.1.8: version "1.1.8" - resolved "https://registry.yarnpkg.com/pug-walk/-/pug-walk-1.1.8.tgz#b408f67f27912f8c21da2f45b7230c4bd2a5ea7a" + resolved "https://registry.npmjs.org/pug-walk/-/pug-walk-1.1.8.tgz" integrity sha512-GMu3M5nUL3fju4/egXwZO0XLi6fW/K3T3VTgFQ14GxNi8btlxgT5qZL//JwZFm/2Fa64J/PNS8AZeys3wiMkVA== pug@^2.0.3: version "2.0.4" - resolved "https://registry.yarnpkg.com/pug/-/pug-2.0.4.tgz#ee7682ec0a60494b38d48a88f05f3b0ac931377d" + resolved "https://registry.npmjs.org/pug/-/pug-2.0.4.tgz" integrity sha512-XhoaDlvi6NIzL49nu094R2NA6P37ijtgMDuWE+ofekDChvfKnzFal60bhSdiy8y2PBO6fmz3oMEIcfpBVRUdvw== dependencies: pug-code-gen "^2.0.2" @@ -3658,64 +3140,59 @@ pug@^2.0.3: pug-runtime "^2.0.5" pug-strip-comments "^1.0.4" -pump@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.0.tgz#b4a2116815bde2f4e1ea602354e8c75565107a64" - integrity sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww== - dependencies: - end-of-stream "^1.1.0" - once "^1.3.1" - punycode@^2.1.0, punycode@^2.1.1: version "2.1.1" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" + resolved "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz" integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== -qs@6.7.0: - version "6.7.0" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.7.0.tgz#41dc1a015e3d581f1621776be31afb2876a9b1bc" - integrity sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ== +qs@6.9.6: + version "6.9.6" + resolved "https://registry.npmjs.org/qs/-/qs-6.9.6.tgz" + integrity sha512-TIRk4aqYLNoJUbd+g2lEdz5kLWIuTMRagAXxl78Q0RiVjAOugHmeKNGdd3cwo/ktpf9aL9epCfFqWDEKysUlLQ== qs@~6.5.2: - version "6.5.2" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" - integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA== + version "6.5.3" + resolved "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz" + integrity sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA== + +railroad-diagrams@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/railroad-diagrams/-/railroad-diagrams-1.0.0.tgz" + integrity sha1-635iZ1SN3t+4mcG5Dlc3RVnN234= + +randexp@0.4.6: + version "0.4.6" + resolved "https://registry.npmjs.org/randexp/-/randexp-0.4.6.tgz" + integrity sha512-80WNmd9DA0tmZrw9qQa62GPPWfuXJknrmVmLcxvq4uZBdYqb1wYoKTmnlGUchvVWe0XiLupYkBoXVOxz3C8DYQ== + dependencies: + discontinuous-range "1.0.0" + ret "~0.1.10" randombytes@^2.1.0: version "2.1.0" - resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" + resolved "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz" integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== dependencies: safe-buffer "^5.1.0" range-parser@~1.2.1: version "1.2.1" - resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031" + resolved "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz" integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg== -raw-body@2.4.0: - version "2.4.0" - resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.4.0.tgz#a1ce6fb9c9bc356ca52e89256ab59059e13d0332" - integrity sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q== +raw-body@2.4.2: + version "2.4.2" + resolved "https://registry.npmjs.org/raw-body/-/raw-body-2.4.2.tgz" + integrity sha512-RPMAFUJP19WIet/99ngh6Iv8fzAbqum4Li7AD6DtGaW2RpMB/11xDoalPiJMTbu6I3hkbMVkATvZrqb9EEqeeQ== dependencies: - bytes "3.1.0" - http-errors "1.7.2" + bytes "3.1.1" + http-errors "1.8.1" iconv-lite "0.4.24" unpipe "1.0.0" -rc@^1.2.7: - version "1.2.8" - resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" - integrity sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw== - dependencies: - deep-extend "^0.6.0" - ini "~1.3.0" - minimist "^1.2.0" - strip-json-comments "~2.0.1" - react-ace@^6.5.0: version "6.6.0" - resolved "https://registry.yarnpkg.com/react-ace/-/react-ace-6.6.0.tgz#a79457ef03c3b1f8d4fc598a003b1d6ad464f1a0" + resolved "https://registry.npmjs.org/react-ace/-/react-ace-6.6.0.tgz" integrity sha512-Jehhp8bxa8kqiXk07Jzy+uD5qZMBwo43O+raniGHjdX7Qk93xFkKaAz8LxtUVZPJGlRnV5ODMNj0qHwDSN+PBw== dependencies: "@babel/polyfill" "^7.4.4" @@ -3726,71 +3203,46 @@ react-ace@^6.5.0: prop-types "^15.7.2" react-docgen@^5.3.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/react-docgen/-/react-docgen-5.3.0.tgz#9aabde5e69f1993c8ba839fd9a86696504654589" - integrity sha512-hUrv69k6nxazOuOmdGeOpC/ldiKy7Qj/UFpxaQi0eDMrUFUTIPGtY5HJu7BggSmiyAMfREaESbtBL9UzdQ+hyg== + version "5.4.0" + resolved "https://registry.npmjs.org/react-docgen/-/react-docgen-5.4.0.tgz" + integrity sha512-JBjVQ9cahmNlfjMGxWUxJg919xBBKAoy3hgDgKERbR+BcF4ANpDuzWAScC7j27hZfd8sJNmMPOLWo9+vB/XJEQ== dependencies: "@babel/core" "^7.7.5" + "@babel/generator" "^7.12.11" "@babel/runtime" "^7.7.6" - ast-types "^0.13.2" + ast-types "^0.14.2" commander "^2.19.0" doctrine "^3.0.0" + estree-to-babel "^3.1.0" neo-async "^2.6.1" node-dir "^0.1.10" strip-indent "^3.0.0" react-frame-component@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/react-frame-component/-/react-frame-component-4.1.1.tgz#ea8f7c518ef6b5ad72146dd1f648752369826894" - integrity sha512-NfJp90AvYA1R6+uSYafQ+n+UM2HjHqi4WGHeprVXa6quU9d8o6ZFRzQ36uemY82dlkZFzf2jigFx6E4UzNFajA== + version "4.1.3" + resolved "https://registry.npmjs.org/react-frame-component/-/react-frame-component-4.1.3.tgz" + integrity sha512-4PurhctiqnmC1F5prPZ+LdsalH7pZ3SFA5xoc0HBe8mSHctdLLt4Cr2WXfXOoajHBYq/yiipp9zOgx+vy8GiEA== -react-is@^16.12.0: +react-is@^16.13.1: version "16.13.1" - resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" + resolved "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz" integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== -react-is@^16.8.1: - version "16.12.0" - resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.12.0.tgz#2cc0fe0fba742d97fd527c42a13bec4eeb06241c" - integrity sha512-rPCkf/mWBtKc97aLL9/txD8DZdemK0vkA3JMLShjlJB3Pj3s+lpf1KaBzMfQrAmhMQB0n1cU/SUGgKKBCe837Q== - -react-is@^16.8.4: - version "16.11.0" - resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.11.0.tgz#b85dfecd48ad1ce469ff558a882ca8e8313928fa" - integrity sha512-gbBVYR2p8mnriqAwWx9LbuUrShnAuSCNnuPGyc7GJrMVQtPDAh8iLpv7FRuMPFb56KkaVZIYSz1PrjI9q0QPCw== - -readable-stream@^2.0.6: - version "2.3.7" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.7.tgz#1eca1cf711aef814c04f62252a36a62f6cb23b57" - integrity sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw== - dependencies: - core-util-is "~1.0.0" - inherits "~2.0.3" - isarray "~1.0.0" - process-nextick-args "~2.0.0" - safe-buffer "~5.1.1" - string_decoder "~1.1.1" - util-deprecate "~1.0.1" - -readable-stream@^3.1.1, readable-stream@^3.4.0: - version "3.6.0" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198" - integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== - dependencies: - inherits "^2.0.3" - string_decoder "^1.1.1" - util-deprecate "^1.0.1" +react-is@^17.0.1: + version "17.0.2" + resolved "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz" + integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w== -readdirp@~3.3.0: - version "3.3.0" - resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.3.0.tgz#984458d13a1e42e2e9f5841b129e162f369aff17" - integrity sha512-zz0pAkSPOXXm1viEwygWIPSPkcBYjW1xU5j/JBh5t9bGCJwa6f9+BJa6VaB2g+b55yVrmXzqkyLf4xaWYM0IkQ== +readdirp@~3.5.0: + version "3.5.0" + resolved "https://registry.npmjs.org/readdirp/-/readdirp-3.5.0.tgz" + integrity sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ== dependencies: - picomatch "^2.0.7" + picomatch "^2.2.1" recast@^0.17.3: version "0.17.6" - resolved "https://registry.yarnpkg.com/recast/-/recast-0.17.6.tgz#64ae98d0d2dfb10ff92ff5fb9ffb7371823b69fa" + resolved "https://registry.npmjs.org/recast/-/recast-0.17.6.tgz" integrity sha512-yoQRMRrK1lszNtbkGyM4kN45AwylV5hMiuEveUBlxytUViWevjvX6w+tzJt1LH4cfUhWt4NZvy3ThIhu6+m5wQ== dependencies: ast-types "0.12.4" @@ -3798,54 +3250,54 @@ recast@^0.17.3: private "^0.1.8" source-map "~0.6.1" +rechoir@^0.6.2: + version "0.6.2" + resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384" + integrity sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q= + dependencies: + resolve "^1.1.6" + +reflect.getprototypeof@^1.0.2: + version "1.0.2" + resolved "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.2.tgz" + integrity sha512-C1+ANgX50UkWlntmOJ8SD1VTuk28+7X1ackBdfXzLQG5+bmriEMHvBaor9YlotCfBHo277q/YWd/JKEOzr5Dxg== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.3" + es-abstract "^1.19.1" + get-intrinsic "^1.1.1" + which-builtin-type "^1.1.1" + regenerator-runtime@^0.11.0: version "0.11.1" - resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9" + resolved "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz" integrity sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg== -regenerator-runtime@^0.13.2: - version "0.13.3" - resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.3.tgz#7cf6a77d8f5c6f60eb73c5fc1955b2ceb01e6bf5" - integrity sha512-naKIZz2GQ8JWh///G7L3X6LaQUAMp2lvb1rvwwsURe/VXwD6VMfr+/1NuNw3ag8v2kY1aQ/go5SNn79O9JU7yw== - regenerator-runtime@^0.13.4: - version "0.13.7" - resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.7.tgz#cac2dacc8a1ea675feaabaeb8ae833898ae46f55" - integrity sha512-a54FxoJDIr27pgf7IgeQGxmqUNYrcV338lf/6gH456HZ/PhX+5BcwHXG9ajESmwe6WRO0tAzRUrRmNONWgkrew== - -regex-not@^1.0.0, regex-not@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/regex-not/-/regex-not-1.0.2.tgz#1f4ece27e00b0b65e0247a6810e6a85d83a5752c" - integrity sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A== - dependencies: - extend-shallow "^3.0.2" - safe-regex "^1.1.0" + version "0.13.9" + resolved "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz" + integrity sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA== regexpp@^3.0.0, regexpp@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.1.0.tgz#206d0ad0a5648cffbdb8ae46438f3dc51c9f78e2" - integrity sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q== - -repeat-element@^1.1.2: - version "1.1.3" - resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.3.tgz#782e0d825c0c5a3bb39731f84efee6b742e6b1ce" - integrity sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g== + version "3.2.0" + resolved "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz" + integrity sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg== -repeat-string@^1.5.2, repeat-string@^1.6.1: +repeat-string@^1.5.2: version "1.6.1" - resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" + resolved "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz" integrity sha1-jcrkcOHIirwtYA//Sndihtp15jc= request-promise-core@1.1.4: version "1.1.4" - resolved "https://registry.yarnpkg.com/request-promise-core/-/request-promise-core-1.1.4.tgz#3eedd4223208d419867b78ce815167d10593a22f" + resolved "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.4.tgz" integrity sha512-TTbAfBBRdWD7aNNOoVOBH4pN/KigV6LyapYNNlAPA8JwbovRti1E88m3sYAwsLi5ryhPKsE9APwnjFTgdUjTpw== dependencies: lodash "^4.17.19" request-promise@^4.2.6: version "4.2.6" - resolved "https://registry.yarnpkg.com/request-promise/-/request-promise-4.2.6.tgz#7e7e5b9578630e6f598e3813c0f8eb342a27f0a2" + resolved "https://registry.npmjs.org/request-promise/-/request-promise-4.2.6.tgz" integrity sha512-HCHI3DJJUakkOr8fNoCc73E5nU5bqITjOYFMDrKHYOXWXrgD/SBaC7LjwuPymUprRyuF06UK7hd/lMHkmUXglQ== dependencies: bluebird "^3.5.0" @@ -3855,7 +3307,7 @@ request-promise@^4.2.6: request@^2.88.2: version "2.88.2" - resolved "https://registry.yarnpkg.com/request/-/request-2.88.2.tgz#d73c918731cb5a87da047e207234146f664d12b3" + resolved "https://registry.npmjs.org/request/-/request-2.88.2.tgz" integrity sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw== dependencies: aws-sign2 "~0.7.0" @@ -3881,118 +3333,109 @@ request@^2.88.2: require-directory@^2.1.1: version "2.1.1" - resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" + resolved "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz" integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I= -require-main-filename@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" - integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg== +require-from-string@^2.0.2: + version "2.0.2" + resolved "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz" + integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw== requizzle@^0.2.3: version "0.2.3" - resolved "https://registry.yarnpkg.com/requizzle/-/requizzle-0.2.3.tgz#4675c90aacafb2c036bd39ba2daa4a1cb777fded" + resolved "https://registry.npmjs.org/requizzle/-/requizzle-0.2.3.tgz" integrity sha512-YanoyJjykPxGHii0fZP0uUPEXpvqfBDxWV7s6GKAiiOsiqhX6vHNyW3Qzdmqp/iq/ExbhaGbVrjB4ruEVSM4GQ== dependencies: lodash "^4.17.14" resolve-from@^4.0.0: version "4.0.0" - resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" + resolved "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz" integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== -resolve-url@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" - integrity sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo= - resolve@^1.1.6, resolve@^1.3.2: - version "1.12.0" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.12.0.tgz#3fc644a35c84a48554609ff26ec52b66fa577df6" - integrity sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w== + version "1.21.0" + resolved "https://registry.npmjs.org/resolve/-/resolve-1.21.0.tgz" + integrity sha512-3wCbTpk5WJlyE4mSOtDLhqQmGFi0/TD9VPwmiolnk8U0wRgMEktqCXd3vy5buTO3tljvalNvKrjHEfrd2WpEKA== dependencies: - path-parse "^1.0.6" + is-core-module "^2.8.0" + path-parse "^1.0.7" + supports-preserve-symlinks-flag "^1.0.0" ret@~0.1.10: version "0.1.15" - resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" + resolved "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz" integrity sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg== right-align@^0.1.1: version "0.1.3" - resolved "https://registry.yarnpkg.com/right-align/-/right-align-0.1.3.tgz#61339b722fe6a3515689210d24e14c96148613ef" + resolved "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz" integrity sha1-YTObci/mo1FWiSENJOFMlhSGE+8= dependencies: align-text "^0.1.1" -rimraf@2.6.3: - version "2.6.3" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab" - integrity sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA== - dependencies: - glob "^7.1.3" - -rimraf@^3.0.0: +rimraf@^3.0.0, rimraf@^3.0.2: version "3.0.2" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" + resolved "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz" integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== dependencies: glob "^7.1.3" -safe-buffer@5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1: +safe-buffer@5.1.2, safe-buffer@~5.1.1: version "5.1.2" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" + resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz" integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== -safe-buffer@^5.0.1, safe-buffer@^5.1.2: - version "5.2.0" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.0.tgz#b74daec49b1148f88c64b68d49b1e815c1f2f519" - integrity sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg== - -safe-buffer@^5.1.0, safe-buffer@~5.2.0: +safe-buffer@5.2.1, safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.2: version "5.2.1" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" + resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz" integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== -safe-regex@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/safe-regex/-/safe-regex-1.1.0.tgz#40a3669f3b077d1e943d44629e157dd48023bf2e" - integrity sha1-QKNmnzsHfR6UPURinhV91IAjvy4= - dependencies: - ret "~0.1.10" - "safer-buffer@>= 2.1.2 < 3", safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0: version "2.1.2" - resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" + resolved "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== -sanitize-html@^2.3.2: - version "2.3.2" - resolved "https://registry.yarnpkg.com/sanitize-html/-/sanitize-html-2.3.2.tgz#a1954aea877a096c408aca7b0c260bef6e4fc402" - integrity sha512-p7neuskvC8pSurUjdVmbWPXmc9A4+QpOXIL+4gwFC+av5h+lYCXFT8uEneqsFQg/wEA1IH+cKQA60AaQI6p3cg== +sanitize-html@^2.6.1: + version "2.6.1" + resolved "https://registry.npmjs.org/sanitize-html/-/sanitize-html-2.6.1.tgz" + integrity sha512-DzjSz3H5qDntD7s1TcWCSoRPmNR8UmA+y+xZQOvWgjATe2Br9ZW73+vD3Pj6Snrg0RuEuJdXgrKvnYuiuixRkA== dependencies: deepmerge "^4.2.2" escape-string-regexp "^4.0.0" htmlparser2 "^6.0.0" is-plain-object "^5.0.0" - klona "^2.0.3" parse-srcset "^1.0.2" - postcss "^8.0.2" + postcss "^8.3.11" -semver@^5.3.0, semver@^5.4.1: +selderee@^0.6.0: + version "0.6.0" + resolved "https://registry.npmjs.org/selderee/-/selderee-0.6.0.tgz" + integrity sha512-ibqWGV5aChDvfVdqNYuaJP/HnVBhlRGSRrlbttmlMpHcLuTqqbMH36QkSs9GEgj5M88JDYLI8eyP94JaQ8xRlg== + dependencies: + parseley "^0.7.0" + +semver@^5.3.0: version "5.7.1" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" + resolved "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz" integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== +semver@^6.0.0, semver@^6.3.0: + version "6.3.0" + resolved "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz" + integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== + semver@^7.2.1, semver@^7.3.2: - version "7.3.2" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.2.tgz#604962b052b81ed0786aae84389ffba70ffd3938" - integrity sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ== + version "7.3.5" + resolved "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz" + integrity sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ== + dependencies: + lru-cache "^6.0.0" -send@0.17.1: - version "0.17.1" - resolved "https://registry.yarnpkg.com/send/-/send-0.17.1.tgz#c1d8b059f7900f7466dd4938bdc44e11ddb376c8" - integrity sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg== +send@0.17.2: + version "0.17.2" + resolved "https://registry.npmjs.org/send/-/send-0.17.2.tgz" + integrity sha512-UJYB6wFSJE3G00nEivR5rgWp8c2xXvJ3OPWPhmuteU0IKj8nKbG3DrjiOmLwpnHGYWAVwA69zmTm++YG0Hmwww== dependencies: debug "2.6.9" depd "~1.1.2" @@ -4001,185 +3444,126 @@ send@0.17.1: escape-html "~1.0.3" etag "~1.8.1" fresh "0.5.2" - http-errors "~1.7.2" + http-errors "1.8.1" mime "1.6.0" - ms "2.1.1" + ms "2.1.3" on-finished "~2.3.0" range-parser "~1.2.1" statuses "~1.5.0" -serialize-javascript@4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-4.0.0.tgz#b525e1238489a5ecfc42afacc3fe99e666f4b1aa" - integrity sha512-GaNA54380uFefWghODBWEGisLZFj00nS5ACs6yHa9nLqlLpVLO8ChDGeKRjZnV4Nh4n0Qi7nhYZD/9fCPzEqkw== +serialize-javascript@5.0.1: + version "5.0.1" + resolved "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-5.0.1.tgz" + integrity sha512-SaaNal9imEO737H2c05Og0/8LUXG7EnsZyMa8MzkmuHoELfT6txuj0cMqRj6zfPKnmQ1yasR4PCJc8x+M4JSPA== dependencies: randombytes "^2.1.0" -serve-static@1.14.1: - version "1.14.1" - resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-1.14.1.tgz#666e636dc4f010f7ef29970a88a674320898b2f9" - integrity sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg== +serve-static@1.14.2: + version "1.14.2" + resolved "https://registry.npmjs.org/serve-static/-/serve-static-1.14.2.tgz" + integrity sha512-+TMNA9AFxUEGuC0z2mevogSnn9MXKb4fa7ngeRMJaaGv8vTwnIEkKi+QGvPt33HSnf8pRS+WGM0EbMtCJLKMBQ== dependencies: encodeurl "~1.0.2" escape-html "~1.0.3" parseurl "~1.3.3" - send "0.17.1" - -set-blocking@^2.0.0, set-blocking@~2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" - integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc= - -set-value@^2.0.0, set-value@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/set-value/-/set-value-2.0.1.tgz#a18d40530e6f07de4228c7defe4227af8cad005b" - integrity sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw== - dependencies: - extend-shallow "^2.0.1" - is-extendable "^0.1.1" - is-plain-object "^2.0.3" - split-string "^3.0.1" + send "0.17.2" -setprototypeof@1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.1.1.tgz#7e95acb24aa92f5885e0abef5ba131330d4ae683" - integrity sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw== +setprototypeof@1.2.0: + version "1.2.0" + resolved "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz" + integrity sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw== shebang-command@^2.0.0: version "2.0.0" - resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" + resolved "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz" integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== dependencies: shebang-regex "^3.0.0" shebang-regex@^3.0.0: version "3.0.0" - resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" + resolved "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz" integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== -signal-exit@^3.0.0: - version "3.0.3" - resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.3.tgz#a1410c2edd8f077b08b4e253c8eacfcaf057461c" - integrity sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA== - -simple-concat@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/simple-concat/-/simple-concat-1.0.1.tgz#f46976082ba35c2263f1c8ab5edfe26c41c9552f" - integrity sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q== +shelljs@^0.8.4: + version "0.8.5" + resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.8.5.tgz#de055408d8361bed66c669d2f000538ced8ee20c" + integrity sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow== + dependencies: + glob "^7.0.0" + interpret "^1.0.0" + rechoir "^0.6.2" -simple-get@^3.0.3: - version "3.1.0" - resolved "https://registry.yarnpkg.com/simple-get/-/simple-get-3.1.0.tgz#b45be062435e50d159540b576202ceec40b9c6b3" - integrity sha512-bCR6cP+aTdScaQCnQKbPKtJOKDp/hj9EDLJo3Nw4y1QksqaovlW/bnptB6/c1e+qmNIDHRK+oXFDdEqBT8WzUA== +side-channel@^1.0.4: + version "1.0.4" + resolved "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz" + integrity sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw== dependencies: - decompress-response "^4.2.0" - once "^1.3.1" - simple-concat "^1.0.0" + call-bind "^1.0.0" + get-intrinsic "^1.0.2" + object-inspect "^1.9.0" + +signal-exit@^3.0.2: + version "3.0.6" + resolved "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.6.tgz" + integrity sha512-sDl4qMFpijcGw22U5w63KmD3cZJfBuFlVNbVMKje2keoKML7X2UzWbc4XrmEbDwg0NXJc3yv4/ox7b+JWb57kQ== simple-mock@^0.8.0: version "0.8.0" - resolved "https://registry.yarnpkg.com/simple-mock/-/simple-mock-0.8.0.tgz#49c9a223fa6eea8e2c4fd6948fe8300cd8a594f3" + resolved "https://registry.npmjs.org/simple-mock/-/simple-mock-0.8.0.tgz" integrity sha1-ScmiI/pu6o4sT9aUj+gwDNillPM= -slash@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/slash/-/slash-2.0.0.tgz#de552851a1759df3a8f206535442f5ec4ddeab44" - integrity sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A== - slash@^3.0.0: version "3.0.0" - resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" + resolved "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz" integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== -slice-ansi@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-2.1.0.tgz#cacd7693461a637a5788d92a7dd4fba068e81636" - integrity sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ== - dependencies: - ansi-styles "^3.2.0" - astral-regex "^1.0.0" - is-fullwidth-code-point "^2.0.0" - -snapdragon-node@^2.0.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/snapdragon-node/-/snapdragon-node-2.1.1.tgz#6c175f86ff14bdb0724563e8f3c1b021a286853b" - integrity sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw== - dependencies: - define-property "^1.0.0" - isobject "^3.0.0" - snapdragon-util "^3.0.1" - -snapdragon-util@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/snapdragon-util/-/snapdragon-util-3.0.1.tgz#f956479486f2acd79700693f6f7b805e45ab56e2" - integrity sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ== +slice-ansi@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz" + integrity sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ== dependencies: - kind-of "^3.2.0" + ansi-styles "^4.0.0" + astral-regex "^2.0.0" + is-fullwidth-code-point "^3.0.0" -snapdragon@^0.8.1: - version "0.8.2" - resolved "https://registry.yarnpkg.com/snapdragon/-/snapdragon-0.8.2.tgz#64922e7c565b0e14204ba1aa7d6964278d25182d" - integrity sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg== - dependencies: - base "^0.11.1" - debug "^2.2.0" - define-property "^0.2.5" - extend-shallow "^2.0.1" - map-cache "^0.2.2" - source-map "^0.5.6" - source-map-resolve "^0.5.0" - use "^3.1.0" - -source-map-resolve@^0.5.0: - version "0.5.2" - resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.2.tgz#72e2cc34095543e43b2c62b2c4c10d4a9054f259" - integrity sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA== - dependencies: - atob "^2.1.1" - decode-uri-component "^0.2.0" - resolve-url "^0.2.1" - source-map-url "^0.4.0" - urix "^0.1.0" +source-map-js@^1.0.1: + version "1.0.1" + resolved "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.1.tgz" + integrity sha512-4+TN2b3tqOCd/kaGRJ/sTYA0tR0mdXx26ipdolxcwtJVqEnqNYvlCAt1q3ypy4QMlYus+Zh34RNtYLoq2oQ4IA== source-map-support@^0.5.6: - version "0.5.16" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.16.tgz#0ae069e7fe3ba7538c64c98515e35339eac5a042" - integrity sha512-efyLRJDr68D9hBBNIPWFjhpFzURh+KJykQwvMyW5UiZzYwoF6l4YMMDIJJEyFWxWCqfyxLzz6tSfUFR+kXXsVQ== + version "0.5.21" + resolved "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz" + integrity sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w== dependencies: buffer-from "^1.0.0" source-map "^0.6.0" -source-map-url@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3" - integrity sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM= - -source-map@^0.5.0, source-map@^0.5.6, source-map@~0.5.1: +source-map@^0.5.0, source-map@~0.5.1: version "0.5.7" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" + resolved "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz" integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w= -source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.0, source-map@~0.6.1: +source-map@^0.6.0, source-map@~0.6.0, source-map@~0.6.1: version "0.6.1" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" + resolved "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== -split-string@^3.0.1, split-string@^3.0.2: - version "3.1.0" - resolved "https://registry.yarnpkg.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2" - integrity sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw== - dependencies: - extend-shallow "^3.0.0" +source-map@^0.7.3: + version "0.7.3" + resolved "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz" + integrity sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ== sprintf-js@~1.0.2: version "1.0.3" - resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" + resolved "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz" integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= sshpk@^1.7.0: - version "1.16.1" - resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.16.1.tgz#fb661c0bef29b39db40769ee39fa70093d6f6877" - integrity sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg== + version "1.17.0" + resolved "https://registry.npmjs.org/sshpk/-/sshpk-1.17.0.tgz" + integrity sha512-/9HIEs1ZXGhSPE8X6Ccm7Nam1z8KcoCqPdI7ecm1N33EzAetWahvQWVqLZtaZQ+IDKX4IyA2o0gBzqIMkAagHQ== dependencies: asn1 "~0.2.3" assert-plus "^1.0.0" @@ -4191,304 +3575,192 @@ sshpk@^1.7.0: safer-buffer "^2.0.2" tweetnacl "~0.14.0" -stack-utils@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-1.0.2.tgz#33eba3897788558bebfc2db059dc158ec36cebb8" - integrity sha512-MTX+MeG5U994cazkjd/9KNAapsHnibjMLnfXodlkXw76JEea0UiNzrqidzo1emMwk7w5Qhc9jd4Bn9TBb1MFwA== - -stack-utils@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-2.0.2.tgz#5cf48b4557becb4638d0bc4f21d23f5d19586593" - integrity sha512-0H7QK2ECz3fyZMzQ8rH0j2ykpfbnd20BFtfg/SqVC2+sCTtcw0aDTGB7dk+de4U4uUeuz6nOtJcrkFFLG1B0Rg== +stack-utils@^2.0.2, stack-utils@^2.0.3: + version "2.0.5" + resolved "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.5.tgz" + integrity sha512-xrQcmYhOsn/1kX+Vraq+7j4oE2j/6BFscZ0etmYg81xuM8Gq0022Pxb8+IqgOFUIaxHs0KaSb7T1+OegiNrNFA== dependencies: escape-string-regexp "^2.0.0" -static-extend@^0.1.1: - version "0.1.2" - resolved "https://registry.yarnpkg.com/static-extend/-/static-extend-0.1.2.tgz#60809c39cbff55337226fd5e0b520f341f1fb5c6" - integrity sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY= - dependencies: - define-property "^0.2.5" - object-copy "^0.1.0" - "statuses@>= 1.5.0 < 2", statuses@~1.5.0: version "1.5.0" - resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c" + resolved "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz" integrity sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow= stealthy-require@^1.1.1: version "1.1.1" - resolved "https://registry.yarnpkg.com/stealthy-require/-/stealthy-require-1.1.1.tgz#35b09875b4ff49f26a777e509b3090a3226bf24b" + resolved "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz" integrity sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks= steno@^0.4.1: version "0.4.4" - resolved "https://registry.yarnpkg.com/steno/-/steno-0.4.4.tgz#071105bdfc286e6615c0403c27e9d7b5dcb855cb" + resolved "https://registry.npmjs.org/steno/-/steno-0.4.4.tgz" integrity sha1-BxEFvfwobmYVwEA8J+nXtdy4Vcs= dependencies: graceful-fs "^4.1.3" -string-width@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" - integrity sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M= - dependencies: - code-point-at "^1.0.0" - is-fullwidth-code-point "^1.0.0" - strip-ansi "^3.0.0" - "string-width@^1.0.2 || 2": version "2.1.1" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" + resolved "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz" integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw== dependencies: is-fullwidth-code-point "^2.0.0" strip-ansi "^4.0.0" -string-width@^3.0.0, string-width@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-3.1.0.tgz#22767be21b62af1081574306f69ac51b62203961" - integrity sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w== - dependencies: - emoji-regex "^7.0.1" - is-fullwidth-code-point "^2.0.0" - strip-ansi "^5.1.0" - -string.prototype.trimend@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.1.tgz#85812a6b847ac002270f5808146064c995fb6913" - integrity sha512-LRPxFUaTtpqYsTeNKaFOw3R4bxIzWOnbQ837QfBylo8jIxtcbK/A/sMV7Q+OAV/vWo+7s25pOE10KYSjaSO06g== - dependencies: - define-properties "^1.1.3" - es-abstract "^1.17.5" - -string.prototype.trimleft@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/string.prototype.trimleft/-/string.prototype.trimleft-2.1.0.tgz#6cc47f0d7eb8d62b0f3701611715a3954591d634" - integrity sha512-FJ6b7EgdKxxbDxc79cOlok6Afd++TTs5szo+zJTUyow3ycrRfJVE2pq3vcN53XexvKZu/DJMDfeI/qMiZTrjTw== +string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: + version "4.2.3" + resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== dependencies: - define-properties "^1.1.3" - function-bind "^1.1.1" + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" -string.prototype.trimright@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/string.prototype.trimright/-/string.prototype.trimright-2.1.0.tgz#669d164be9df9b6f7559fa8e89945b168a5a6c58" - integrity sha512-fXZTSV55dNBwv16uw+hh5jkghxSnc5oHq+5K/gXgizHwAvMetdAJlHqqoFC1FSDVPYWLkAKl2cxpUT41sV7nSg== +string.prototype.trimend@^1.0.4: + version "1.0.4" + resolved "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz" + integrity sha512-y9xCjw1P23Awk8EvTpcyL2NIr1j7wJ39f+k6lvRnSMz+mz9CGz9NYPelDk42kOz6+ql8xjfK8oYzy3jAP5QU5A== dependencies: + call-bind "^1.0.2" define-properties "^1.1.3" - function-bind "^1.1.1" -string.prototype.trimstart@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/string.prototype.trimstart/-/string.prototype.trimstart-1.0.1.tgz#14af6d9f34b053f7cfc89b72f8f2ee14b9039a54" - integrity sha512-XxZn+QpvrBI1FOcg6dIpxUPgWCPuNXvMD72aaRaUQv1eD4e/Qy8i/hFTe0BUmD60p/QA6bh1avmuPTfNjqVWRw== +string.prototype.trimstart@^1.0.4: + version "1.0.4" + resolved "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.4.tgz" + integrity sha512-jh6e984OBfvxS50tdY2nRZnoC5/mLFKOREQfw8t5yytkoUsJRNxvI/E39qu1sD0OtWI3OC0XgKSmcWwziwYuZw== dependencies: + call-bind "^1.0.2" define-properties "^1.1.3" - es-abstract "^1.17.5" - -string_decoder@^1.1.1: - version "1.3.0" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" - integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== - dependencies: - safe-buffer "~5.2.0" - -string_decoder@~1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" - integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== - dependencies: - safe-buffer "~5.1.0" - -strip-ansi@^3.0.0, strip-ansi@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" - integrity sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8= - dependencies: - ansi-regex "^2.0.0" strip-ansi@^4.0.0: version "4.0.0" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" + resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz" integrity sha1-qEeQIusaw2iocTibY1JixQXuNo8= dependencies: ansi-regex "^3.0.0" -strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.2.0.tgz#8c9a536feb6afc962bdfa5b104a5091c1ad9c0ae" - integrity sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA== - dependencies: - ansi-regex "^4.1.0" - -strip-ansi@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.0.tgz#0b1571dd7669ccd4f3e06e14ef1eed26225ae532" - integrity sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w== +strip-ansi@^6.0.0, strip-ansi@^6.0.1: + version "6.0.1" + resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== dependencies: - ansi-regex "^5.0.0" + ansi-regex "^5.0.1" strip-bom@^3.0.0: version "3.0.0" - resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" + resolved "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz" integrity sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM= strip-indent@^3.0.0: version "3.0.0" - resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-3.0.0.tgz#c32e1cee940b6b3432c771bc2c54bcce73cd3001" + resolved "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz" integrity sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ== dependencies: min-indent "^1.0.0" -strip-json-comments@3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.0.1.tgz#85713975a91fb87bf1b305cca77395e40d2a64a7" - integrity sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw== - -strip-json-comments@^3.1.0: +strip-json-comments@3.1.1, strip-json-comments@^3.1.0, strip-json-comments@^3.1.1: version "3.1.1" - resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" + resolved "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz" integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== -strip-json-comments@~2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" - integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo= - -supports-color@7.1.0, supports-color@^7.1.0: - version "7.1.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.1.0.tgz#68e32591df73e25ad1c4b49108a2ec507962bfd1" - integrity sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g== +supports-color@8.1.1: + version "8.1.1" + resolved "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz" + integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== dependencies: has-flag "^4.0.0" supports-color@^5.3.0: version "5.5.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" + resolved "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz" integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== dependencies: has-flag "^3.0.0" -table@^5.2.3: - version "5.4.6" - resolved "https://registry.yarnpkg.com/table/-/table-5.4.6.tgz#1292d19500ce3f86053b05f0e8e7e4a3bb21079e" - integrity sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug== +supports-color@^7.1.0: + version "7.2.0" + resolved "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz" + integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== dependencies: - ajv "^6.10.2" - lodash "^4.17.14" - slice-ansi "^2.1.0" - string-width "^3.0.0" + has-flag "^4.0.0" + +supports-preserve-symlinks-flag@^1.0.0: + 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== + +table@^6.0.9: + version "6.8.0" + resolved "https://registry.npmjs.org/table/-/table-6.8.0.tgz" + integrity sha512-s/fitrbVeEyHKFa7mFdkuQMWlH1Wgw/yEXMt5xACT4ZpzWFluehAxRtUUQKPuWhaLAWhFcVx6w3oC8VKaUfPGA== + dependencies: + ajv "^8.0.1" + lodash.truncate "^4.4.2" + slice-ansi "^4.0.0" + string-width "^4.2.3" + strip-ansi "^6.0.1" taffydb@2.6.2: version "2.6.2" - resolved "https://registry.yarnpkg.com/taffydb/-/taffydb-2.6.2.tgz#7cbcb64b5a141b6a2efc2c5d2c67b4e150b2a268" + resolved "https://registry.npmjs.org/taffydb/-/taffydb-2.6.2.tgz" integrity sha1-fLy2S1oUG2ou/CxdLGe04VCyomg= -tar-fs@^2.0.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/tar-fs/-/tar-fs-2.1.1.tgz#489a15ab85f1f0befabb370b7de4f9eb5cbe8784" - integrity sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng== - dependencies: - chownr "^1.1.1" - mkdirp-classic "^0.5.2" - pump "^3.0.0" - tar-stream "^2.1.4" - -tar-stream@^2.1.4: - version "2.2.0" - resolved "https://registry.yarnpkg.com/tar-stream/-/tar-stream-2.2.0.tgz#acad84c284136b060dc3faa64474aa9aebd77287" - integrity sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ== +test-exclude@^6.0.0: + version "6.0.0" + resolved "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz" + integrity sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w== dependencies: - bl "^4.0.3" - end-of-stream "^1.4.1" - fs-constants "^1.0.0" - inherits "^2.0.3" - readable-stream "^3.1.1" - -tar@^6.1.0: - version "6.1.11" - resolved "https://registry.yarnpkg.com/tar/-/tar-6.1.11.tgz#6760a38f003afa1b2ffd0ffe9e9abbd0eab3d621" - integrity sha512-an/KZQzQUkZCkuoAA64hM92X0Urb6VpRhAFllDzz44U2mcD5scmT3zBc4VgVpkugF580+DQn8eAFSyoQt0tznA== - dependencies: - chownr "^2.0.0" - fs-minipass "^2.0.0" - minipass "^3.0.0" - minizlib "^2.1.1" - mkdirp "^1.0.3" - yallist "^4.0.0" + "@istanbuljs/schema" "^0.1.2" + glob "^7.1.4" + minimatch "^3.0.4" text-table@^0.2.0: version "0.2.0" - resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" + resolved "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz" integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= tmatch@^2.0.1: version "2.0.1" - resolved "https://registry.yarnpkg.com/tmatch/-/tmatch-2.0.1.tgz#0c56246f33f30da1b8d3d72895abaf16660f38cf" + resolved "https://registry.npmjs.org/tmatch/-/tmatch-2.0.1.tgz" integrity sha1-DFYkbzPzDaG409colauvFmYPOM8= tmp@^0.2.1: version "0.2.1" - resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.2.1.tgz#8457fc3037dcf4719c251367a1af6500ee1ccf14" + resolved "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz" integrity sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ== dependencies: rimraf "^3.0.0" to-fast-properties@^1.0.3: version "1.0.3" - resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-1.0.3.tgz#b83571fa4d8c25b82e231b06e3a3055de4ca1a47" + resolved "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz" integrity sha1-uDVx+k2MJbguIxsG46MFXeTKGkc= to-fast-properties@^2.0.0: version "2.0.0" - resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" + resolved "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz" integrity sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4= -to-object-path@^0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/to-object-path/-/to-object-path-0.3.0.tgz#297588b7b0e7e0ac08e04e672f85c1f4999e17af" - integrity sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68= - dependencies: - kind-of "^3.0.2" - -to-regex-range@^2.1.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-2.1.1.tgz#7c80c17b9dfebe599e27367e0d4dd5590141db38" - integrity sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg= - dependencies: - is-number "^3.0.0" - repeat-string "^1.6.1" - to-regex-range@^5.0.1: version "5.0.1" - resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" + resolved "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz" integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== dependencies: is-number "^7.0.0" -to-regex@^3.0.1, to-regex@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/to-regex/-/to-regex-3.0.2.tgz#13cfdd9b336552f30b51f33a8ae1b42a7a7599ce" - integrity sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw== - dependencies: - define-property "^2.0.2" - extend-shallow "^3.0.2" - regex-not "^1.0.2" - safe-regex "^1.1.0" - -toidentifier@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.0.tgz#7e1be3470f1e77948bc43d94a3c8f4d7752ba553" - integrity sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw== +toidentifier@1.0.1: + version "1.0.1" + resolved "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz" + integrity sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA== token-stream@0.0.1: version "0.0.1" - resolved "https://registry.yarnpkg.com/token-stream/-/token-stream-0.0.1.tgz#ceeefc717a76c4316f126d0b9dbaa55d7e7df01a" + resolved "https://registry.npmjs.org/token-stream/-/token-stream-0.0.1.tgz" integrity sha1-zu78cXp2xDFvEm0LnbqlXX598Bo= tough-cookie@^2.3.3, tough-cookie@~2.5.0: version "2.5.0" - resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.5.0.tgz#cd9fb2a0aa1d5a12b473bd9fb96fa3dcff65ade2" + resolved "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz" integrity sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g== dependencies: psl "^1.1.28" @@ -4496,12 +3768,12 @@ tough-cookie@^2.3.3, tough-cookie@~2.5.0: ts-map@^1.0.3: version "1.0.3" - resolved "https://registry.yarnpkg.com/ts-map/-/ts-map-1.0.3.tgz#1c4d218dec813d2103b7e04e4bcf348e1471c1ff" + resolved "https://registry.npmjs.org/ts-map/-/ts-map-1.0.3.tgz" integrity sha512-vDWbsl26LIcPGmDpoVzjEP6+hvHZkBkLW7JpvwbCv/5IYPJlsbzCVXY3wsCeAxAUeTclNOUZxnLdGh3VBD/J6w== ts-mocha@^7.0.0: version "7.0.0" - resolved "https://registry.yarnpkg.com/ts-mocha/-/ts-mocha-7.0.0.tgz#f1549b48b46f53d7ae1dccbb26313c7879acb190" + resolved "https://registry.npmjs.org/ts-mocha/-/ts-mocha-7.0.0.tgz" integrity sha512-7WfkQw1W6JZXG5m4E1w2e945uWzBoZqmnOHvpMu0v+zvyKLdUQeTtRMfcQsVEKsUnYL6nTyH4okRt2PZucmFXQ== dependencies: ts-node "7.0.1" @@ -4510,7 +3782,7 @@ ts-mocha@^7.0.0: ts-node@7.0.1: version "7.0.1" - resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-7.0.1.tgz#9562dc2d1e6d248d24bc55f773e3f614337d9baf" + resolved "https://registry.npmjs.org/ts-node/-/ts-node-7.0.1.tgz" integrity sha512-BVwVbPJRspzNh2yfslyT1PSbl5uIk03EZlb493RKHN4qej/D06n1cEhjlOJG69oFsE7OT8XjpTUcYf6pKTLMhw== dependencies: arrify "^1.0.0" @@ -4523,28 +3795,28 @@ ts-node@7.0.1: yn "^2.0.0" tsconfig-paths@^3.5.0: - version "3.9.0" - resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.9.0.tgz#098547a6c4448807e8fcb8eae081064ee9a3c90b" - integrity sha512-dRcuzokWhajtZWkQsDVKbWyY+jgcLC5sqJhg2PSgf4ZkH2aHPvaOY8YWGhmjb68b5qqTfasSsDO9k7RUiEmZAw== + version "3.12.0" + resolved "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.12.0.tgz" + integrity sha512-e5adrnOYT6zqVnWqZu7i/BQ3BnhzvGbjEjejFXO20lKIKpwTaupkCPgEfv4GZK1IBciJUEhYs3J3p75FdaTFVg== dependencies: "@types/json5" "^0.0.29" json5 "^1.0.1" minimist "^1.2.0" strip-bom "^3.0.0" -tslib@^1.13.0: +tslib@^1.13.0, tslib@^1.8.1: version "1.14.1" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" + resolved "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz" integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== -tslib@^1.8.1: - version "1.10.0" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" - integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ== +tslib@^2.0.1: + version "2.3.1" + resolved "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz" + integrity sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw== tslint@^6.1.3: version "6.1.3" - resolved "https://registry.yarnpkg.com/tslint/-/tslint-6.1.3.tgz#5c23b2eccc32487d5523bd3a470e9aa31789d904" + resolved "https://registry.npmjs.org/tslint/-/tslint-6.1.3.tgz" integrity sha512-IbR4nkT96EQOvKE2PW/djGz8iGNeJ4rF2mBfiYaR/nvUWYKJhLwimoJKgjIFEIDibBtOevj7BqCRL4oHeWWUCg== dependencies: "@babel/code-frame" "^7.0.0" @@ -4563,73 +3835,68 @@ tslint@^6.1.3: tsutils@^2.29.0: version "2.29.0" - resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-2.29.0.tgz#32b488501467acbedd4b85498673a0812aca0b99" + resolved "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz" integrity sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA== dependencies: tslib "^1.8.1" tsutils@^3.17.1: - version "3.17.1" - resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.17.1.tgz#ed719917f11ca0dee586272b2ac49e015a2dd759" - integrity sha512-kzeQ5B8H3w60nFY2g8cJIuH7JDpsALXySGtwGJ0p2LSjLgay3NdIpqq5SoOBe46bKDW2iq25irHCr8wjomUS2g== + version "3.21.0" + resolved "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz" + integrity sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA== dependencies: tslib "^1.8.1" tunnel-agent@^0.6.0: version "0.6.0" - resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" + resolved "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz" integrity sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0= dependencies: safe-buffer "^5.0.1" tweetnacl@^0.14.3, tweetnacl@~0.14.0: version "0.14.5" - resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" + resolved "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz" integrity sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q= type-check@^0.4.0, type-check@~0.4.0: version "0.4.0" - resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1" + resolved "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz" integrity sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew== dependencies: prelude-ls "^1.2.1" -type-fest@^0.8.1: - version "0.8.1" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d" - integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA== +type-fest@^0.20.2: + version "0.20.2" + resolved "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz" + integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ== -type-is@~1.6.17, type-is@~1.6.18: +type-is@~1.6.18: version "1.6.18" - resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131" + resolved "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz" integrity sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g== dependencies: media-typer "0.3.0" mime-types "~2.1.24" -typescript@^3.2.2: - version "3.7.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.2.tgz#27e489b95fa5909445e9fef5ee48d81697ad18fb" - integrity sha512-ml7V7JfiN2Xwvcer+XAf2csGO1bPBdRbFCkYBczNZggrBZ9c7G3riSUeJmqEU5uOtXNPMhE3n+R4FA/3YOAWOQ== - -typescript@^3.7.5: - version "3.9.7" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.7.tgz#98d600a5ebdc38f40cb277522f12dc800e9e25fa" - integrity sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw== +typescript@^3.2.2, typescript@^3.7.5: + version "3.9.10" + resolved "https://registry.npmjs.org/typescript/-/typescript-3.9.10.tgz" + integrity sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q== -typescript@^4.3.5: - version "4.3.5" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.3.5.tgz#4d1c37cc16e893973c45a06886b7113234f119f4" - integrity sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA== +typescript@^4.5.4: + version "4.5.4" + resolved "https://registry.npmjs.org/typescript/-/typescript-4.5.4.tgz" + integrity sha512-VgYs2A2QIRuGphtzFV7aQJduJ2gyfTljngLzjpfW9FoYZF6xuw1W0vW9ghCKLfcWrCFxK81CSGRAvS1pn4fIUg== uc.micro@^1.0.1, uc.micro@^1.0.5: version "1.0.6" - resolved "https://registry.yarnpkg.com/uc.micro/-/uc.micro-1.0.6.tgz#9c411a802a409a91fc6cf74081baba34b24499ac" + resolved "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz" integrity sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA== uglify-js@^2.6.1: version "2.8.29" - resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.29.tgz#29c5733148057bb4e1f75df35b7a9cb72e6a59dd" + resolved "https://registry.npmjs.org/uglify-js/-/uglify-js-2.8.29.tgz" integrity sha1-KcVzMUgFe7Th913zW3qcty5qWd0= dependencies: source-map "~0.5.1" @@ -4639,82 +3906,68 @@ uglify-js@^2.6.1: uglify-to-browserify@~1.0.0: version "1.0.2" - resolved "https://registry.yarnpkg.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7" + resolved "https://registry.npmjs.org/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz" integrity sha1-bgkk1r2mta/jSeOabWMoUKD4grc= -underscore@^1.9.1, underscore@~1.13.1: - version "1.13.1" - resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.13.1.tgz#0c1c6bd2df54b6b69f2314066d65b6cde6fcf9d1" - integrity sha512-hzSoAVtJF+3ZtiFX0VgfFPHEDRm7Y/QPjGyNo4TVdnDTdft3tr8hEkD25a1jC+TjTuE7tkHGKkhwCgs9dgBB2g== - -union-value@^1.0.0: +unbox-primitive@^1.0.1: version "1.0.1" - resolved "https://registry.yarnpkg.com/union-value/-/union-value-1.0.1.tgz#0b6fe7b835aecda61c6ea4d4f02c14221e109847" - integrity sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg== + resolved "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.1.tgz" + integrity sha512-tZU/3NqK3dA5gpE1KtyiJUrEB0lxnGkMFHptJ7q6ewdZ8s12QrODwNbhIJStmJkd1QDXa1NRA8aF2A1zk/Ypyw== dependencies: - arr-union "^3.1.0" - get-value "^2.0.6" - is-extendable "^0.1.1" - set-value "^2.0.1" + function-bind "^1.1.1" + has-bigints "^1.0.1" + has-symbols "^1.0.2" + which-boxed-primitive "^1.0.2" + +underscore@^1.9.1, underscore@~1.13.1: + version "1.13.2" + resolved "https://registry.npmjs.org/underscore/-/underscore-1.13.2.tgz" + integrity sha512-ekY1NhRzq0B08g4bGuX4wd2jZx5GnKz6mKSqFL4nqBlfyMGiG10gDFhDTMEfYmDL6Jy0FUIZp7wiRB+0BP7J2g== unpipe@1.0.0, unpipe@~1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" + resolved "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz" integrity sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw= -unset-value@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/unset-value/-/unset-value-1.0.0.tgz#8376873f7d2335179ffb1e6fc3a8ed0dfc8ab559" - integrity sha1-g3aHP30jNRef+x5vw6jtDfyKtVk= - dependencies: - has-value "^0.3.1" - isobject "^3.0.0" - uri-js@^4.2.2: - version "4.2.2" - resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0" - integrity sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ== + version "4.4.1" + resolved "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz" + integrity sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg== dependencies: punycode "^2.1.0" -urix@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72" - integrity sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI= - -use@^3.1.0: - version "3.1.1" - resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f" - integrity sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ== - -util-deprecate@^1.0.1, util-deprecate@~1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" - integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= - utils-merge@1.0.1: version "1.0.1" - resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" + resolved "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz" integrity sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM= uuid@^3.3.2: - version "3.3.3" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.3.tgz#4568f0216e78760ee1dbf3a4d2cf53e224112866" - integrity sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ== + version "3.4.0" + resolved "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz" + integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== v8-compile-cache@^2.0.3: - version "2.1.1" - resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.1.1.tgz#54bc3cdd43317bca91e35dcaf305b1a7237de745" - integrity sha512-8OQ9CL+VWyt3JStj7HX7/ciTL2V3Rl1Wf5OL+SNTm0yK1KvtReVulksyeRnCANHHuUxHlQig+JJDlUhBt1NQDQ== + version "2.3.0" + resolved "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz" + integrity sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA== + +v8-to-istanbul@^8.0.0: + version "8.1.1" + resolved "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-8.1.1.tgz" + integrity sha512-FGtKtv3xIpR6BYhvgH8MI/y78oT7d8Au3ww4QIxymrCtZEh5b8gCw2siywE+puhEmuWKDtmfrvF5UlB298ut3w== + dependencies: + "@types/istanbul-lib-coverage" "^2.0.1" + convert-source-map "^1.6.0" + source-map "^0.7.3" vary@~1.1.2: version "1.1.2" - resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" + resolved "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz" integrity sha1-IpnwLG3tMNSllhsLn3RSShj2NPw= verror@1.10.0: version "1.10.0" - resolved "https://registry.yarnpkg.com/verror/-/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400" + resolved "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz" integrity sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA= dependencies: assert-plus "^1.0.0" @@ -4723,12 +3976,12 @@ verror@1.10.0: void-elements@^2.0.1: version "2.0.1" - resolved "https://registry.yarnpkg.com/void-elements/-/void-elements-2.0.1.tgz#c066afb582bb1cb4128d60ea92392e94d5e9dbec" + resolved "https://registry.npmjs.org/void-elements/-/void-elements-2.0.1.tgz" integrity sha1-wGavtYK7HLQSjWDqkjkulNXp2+w= vue-docgen-api@^3.22.0: version "3.26.0" - resolved "https://registry.yarnpkg.com/vue-docgen-api/-/vue-docgen-api-3.26.0.tgz#2afc6a39e72862fbbc60ceb8510c681749f05460" + resolved "https://registry.npmjs.org/vue-docgen-api/-/vue-docgen-api-3.26.0.tgz" integrity sha512-ujdg4i5ZI/wE46RZQMFzKnDGyhEuPCu+fMA86CAd9EIek/6+OqraSVBm5ZkLrbEd5f8xxdnqMU4yiSGHHeao/Q== dependencies: "@babel/parser" "^7.2.3" @@ -4743,47 +3996,93 @@ vue-docgen-api@^3.22.0: vue-template-compiler "^2.0.0" vue-template-compiler@^2.0.0: - version "2.6.10" - resolved "https://registry.yarnpkg.com/vue-template-compiler/-/vue-template-compiler-2.6.10.tgz#323b4f3495f04faa3503337a82f5d6507799c9cc" - integrity sha512-jVZkw4/I/HT5ZMvRnhv78okGusqe0+qH2A0Em0Cp8aq78+NK9TII263CDVz2QXZsIT+yyV/gZc/j/vlwa+Epyg== + version "2.6.14" + resolved "https://registry.npmjs.org/vue-template-compiler/-/vue-template-compiler-2.6.14.tgz" + integrity sha512-ODQS1SyMbjKoO1JBJZojSw6FE4qnh9rIpUZn2EUT86FKizx9uH5z6uXiIrm4/Nb/gwxTi/o17ZDEGWAXHvtC7g== dependencies: de-indent "^1.0.2" he "^1.1.0" vue2-ace-editor@^0.0.13: version "0.0.13" - resolved "https://registry.yarnpkg.com/vue2-ace-editor/-/vue2-ace-editor-0.0.13.tgz#5528998ce2c13e8ed3a294f714298199fd107dc2" + resolved "https://registry.npmjs.org/vue2-ace-editor/-/vue2-ace-editor-0.0.13.tgz" integrity sha512-uQICyvJzYNix16xeYjNAINuNUQhPbqMR7UQsJeI+ycpEd2otsiNNU73jcZqHkpjuz0uaHDHnrpzQuI/RApsKXA== dependencies: brace "^0.11.0" -which-module@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" - integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho= +which-boxed-primitive@^1.0.2: + version "1.0.2" + resolved "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz" + integrity sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg== + dependencies: + is-bigint "^1.0.1" + is-boolean-object "^1.1.0" + is-number-object "^1.0.4" + is-string "^1.0.5" + is-symbol "^1.0.3" + +which-builtin-type@^1.1.1: + version "1.1.1" + resolved "https://registry.npmjs.org/which-builtin-type/-/which-builtin-type-1.1.1.tgz" + integrity sha512-zY3bUNzl/unBfSDS6ePT+/dwu6hZ7RMVMqHFvYxZEhisGEwCV/pYnXQ70nd3Hn2X6l8BNOWge5sHk3wAR3L42w== + dependencies: + function.prototype.name "^1.1.4" + has-tostringtag "^1.0.0" + is-async-fn "^1.1.0" + is-date-object "^1.0.5" + is-finalizationregistry "^1.0.1" + is-generator-function "^1.0.10" + is-regex "^1.1.4" + is-weakref "^1.0.1" + isarray "^2.0.5" + which-boxed-primitive "^1.0.2" + which-collection "^1.0.1" + which-typed-array "^1.1.5" + +which-collection@^1.0.1: + version "1.0.1" + resolved "https://registry.npmjs.org/which-collection/-/which-collection-1.0.1.tgz" + integrity sha512-W8xeTUwaln8i3K/cY1nGXzdnVZlidBcagyNFtBdD5kxnb4TvGKR7FfSIS3mYpwWS1QUCutfKz8IY8RjftB0+1A== + dependencies: + is-map "^2.0.1" + is-set "^2.0.1" + is-weakmap "^2.0.1" + is-weakset "^2.0.1" + +which-typed-array@^1.1.5: + version "1.1.7" + resolved "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.7.tgz" + integrity sha512-vjxaB4nfDqwKI0ws7wZpxIlde1XrLX5uB0ZjpfshgmapJMD7jJWhZI+yToJTqaFByF0eNBcYxbjmCzoRP7CfEw== + dependencies: + available-typed-arrays "^1.0.5" + call-bind "^1.0.2" + es-abstract "^1.18.5" + foreach "^2.0.5" + has-tostringtag "^1.0.0" + is-typed-array "^1.1.7" which@2.0.2, which@^2.0.1: version "2.0.2" - resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" + resolved "https://registry.npmjs.org/which/-/which-2.0.2.tgz" integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== dependencies: isexe "^2.0.0" -wide-align@1.1.3, wide-align@^1.1.0: +wide-align@1.1.3: version "1.1.3" - resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.3.tgz#ae074e6bdc0c14a431e804e624549c633b000457" + resolved "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz" integrity sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA== dependencies: string-width "^1.0.2 || 2" window-size@0.1.0: version "0.1.0" - resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.0.tgz#5438cd2ea93b202efa3a19fe8887aee7c94f9c9d" + resolved "https://registry.npmjs.org/window-size/-/window-size-0.1.0.tgz" integrity sha1-VDjNLqk7IC76Ohn+iIeu58lPnJ0= with@^5.0.0: version "5.1.1" - resolved "https://registry.yarnpkg.com/with/-/with-5.1.1.tgz#fa4daa92daf32c4ea94ed453c81f04686b575dfe" + resolved "https://registry.npmjs.org/with/-/with-5.1.1.tgz" integrity sha1-+k2qktrzLE6pTtRTyB8EaGtXXf4= dependencies: acorn "^3.1.0" @@ -4791,123 +4090,89 @@ with@^5.0.0: word-wrap@^1.2.3: version "1.2.3" - resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c" + resolved "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz" integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ== wordwrap@0.0.2: version "0.0.2" - resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.2.tgz#b79669bb42ecb409f83d583cad52ca17eaa1643f" + resolved "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz" integrity sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8= -workerpool@6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.0.0.tgz#85aad67fa1a2c8ef9386a1b43539900f61d03d58" - integrity sha512-fU2OcNA/GVAJLLyKUoHkAgIhKb0JoCpSjLC/G2vYKxUjVmQwGbRVeoPJ1a8U4pnVofz4AQV5Y/NEw8oKqxEBtA== +workerpool@6.1.0: + version "6.1.0" + resolved "https://registry.npmjs.org/workerpool/-/workerpool-6.1.0.tgz" + integrity sha512-toV7q9rWNYha963Pl/qyeZ6wG+3nnsyvolaNUS8+R5Wtw6qJPTxIlOP1ZSvcGhEJw+l3HMMmtiNo9Gl61G4GVg== -wrap-ansi@^5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-5.1.0.tgz#1fd1f67235d5b6d0fee781056001bfb694c03b09" - integrity sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q== +wrap-ansi@^7.0.0: + version "7.0.0" + resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== dependencies: - ansi-styles "^3.2.0" - string-width "^3.0.0" - strip-ansi "^5.0.0" + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" wrappy@1: version "1.0.2" - resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + resolved "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz" integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= -write@1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/write/-/write-1.0.3.tgz#0800e14523b923a387e415123c865616aae0f5c3" - integrity sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig== - dependencies: - mkdirp "^0.5.1" - -xmlcreate@^2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/xmlcreate/-/xmlcreate-2.0.3.tgz#df9ecd518fd3890ab3548e1b811d040614993497" - integrity sha512-HgS+X6zAztGa9zIK3Y3LXuJes33Lz9x+YyTxgrkIdabu2vqcGOWwdfCpf1hWLRrd553wd4QCDf6BBO6FfdsRiQ== +xmlcreate@^2.0.4: + version "2.0.4" + resolved "https://registry.npmjs.org/xmlcreate/-/xmlcreate-2.0.4.tgz" + integrity sha512-nquOebG4sngPmGPICTS5EnxqhKbCmz5Ox5hsszI2T6U5qdrJizBc+0ilYSEjTSzU0yZcmvppztXe/5Al5fUwdg== -y18n@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.1.tgz#8db2b83c31c5d75099bb890b23f3094891e247d4" - integrity sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ== +y18n@^5.0.5: + version "5.0.8" + resolved "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz" + integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== yallist@^2.1.2: version "2.1.2" - resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" + resolved "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz" integrity sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI= yallist@^4.0.0: version "4.0.0" - resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" + resolved "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz" integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== -yargs-parser@13.1.2, yargs-parser@^13.1.2: - version "13.1.2" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-13.1.2.tgz#130f09702ebaeef2650d54ce6e3e5706f7a4fb38" - integrity sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg== - dependencies: - camelcase "^5.0.0" - decamelize "^1.2.0" +yargs-parser@20.2.4: + version "20.2.4" + resolved "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz" + integrity sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA== -yargs-parser@^15.0.1: - version "15.0.1" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-15.0.1.tgz#54786af40b820dcb2fb8025b11b4d659d76323b3" - integrity sha512-0OAMV2mAZQrs3FkNpDQcBk1x5HXb8X4twADss4S0Iuk+2dGnLOE/fRHrsYm542GduMveyA77OF4wrNJuanRCWw== - dependencies: - camelcase "^5.0.0" - decamelize "^1.2.0" +yargs-parser@^20.2.2, yargs-parser@^20.2.7: + version "20.2.9" + resolved "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz" + integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w== -yargs-unparser@1.6.1: - version "1.6.1" - resolved "https://registry.yarnpkg.com/yargs-unparser/-/yargs-unparser-1.6.1.tgz#bd4b0ee05b4c94d058929c32cb09e3fce71d3c5f" - integrity sha512-qZV14lK9MWsGCmcr7u5oXGH0dbGqZAIxTDrWXZDo5zUr6b6iUmelNKO6x6R1dQT24AH3LgRxJpr8meWy2unolA== - dependencies: - camelcase "^5.3.1" - decamelize "^1.2.0" - flat "^4.1.0" - is-plain-obj "^1.1.0" - yargs "^14.2.3" - -yargs@13.3.2: - version "13.3.2" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-13.3.2.tgz#ad7ffefec1aa59565ac915f82dccb38a9c31a2dd" - integrity sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw== - dependencies: - cliui "^5.0.0" - find-up "^3.0.0" - get-caller-file "^2.0.1" - require-directory "^2.1.1" - require-main-filename "^2.0.0" - set-blocking "^2.0.0" - string-width "^3.0.0" - which-module "^2.0.0" - y18n "^4.0.0" - yargs-parser "^13.1.2" - -yargs@^14.2.3: - version "14.2.3" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-14.2.3.tgz#1a1c3edced1afb2a2fea33604bc6d1d8d688a414" - integrity sha512-ZbotRWhF+lkjijC/VhmOT9wSgyBQ7+zr13+YLkhfsSiTriYsMzkTUFP18pFhWwBeMa5gUc1MzbhrO6/VB7c9Xg== - dependencies: - cliui "^5.0.0" - decamelize "^1.2.0" - find-up "^3.0.0" - get-caller-file "^2.0.1" +yargs-unparser@2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz" + integrity sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA== + dependencies: + camelcase "^6.0.0" + decamelize "^4.0.0" + flat "^5.0.2" + is-plain-obj "^2.1.0" + +yargs@16.2.0, yargs@^16.2.0: + version "16.2.0" + resolved "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz" + integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw== + dependencies: + cliui "^7.0.2" + escalade "^3.1.1" + get-caller-file "^2.0.5" require-directory "^2.1.1" - require-main-filename "^2.0.0" - set-blocking "^2.0.0" - string-width "^3.0.0" - which-module "^2.0.0" - y18n "^4.0.0" - yargs-parser "^15.0.1" + string-width "^4.2.0" + y18n "^5.0.5" + yargs-parser "^20.2.2" yargs@~3.10.0: version "3.10.0" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-3.10.0.tgz#f7ee7bd857dd7c1d2d38c0e74efbd681d1431fd1" + resolved "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz" integrity sha1-9+572FfdfB0tOMDnTvvWgdFDH9E= dependencies: camelcase "^1.0.2" @@ -4917,5 +4182,10 @@ yargs@~3.10.0: yn@^2.0.0: version "2.0.0" - resolved "https://registry.yarnpkg.com/yn/-/yn-2.0.0.tgz#e5adabc8acf408f6385fc76495684c88e6af689a" + resolved "https://registry.npmjs.org/yn/-/yn-2.0.0.tgz" integrity sha1-5a2ryKz0CPY4X8dklWhMiOavaJo= + +yocto-queue@^0.1.0: + version "0.1.0" + resolved "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz" + integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==