npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@fluidframework/test-client-utils

v1.4.0

Published

Fluid client development and test utilities

Downloads

11,112

Readme

@fluidframework/test-client-utils

Utilities to use while developing and testing using the service-specific clients (i.e. AzureClient, TinyliciousClient) supplied by the FluidFramework.

InsecureTokenProvider

The InsecureTokenProvider provides a class for locally generating JWT tokens, signed using a tenant key, that can be sent to Fluid services. These tokens will be used to authenticate and identify which user is sending operations from the client.

It takes in two parameters:

  • tenantKey - Used for signing the token for use with the tenantId that we are attempting to connect to on the service
  • user - Used to populate the current user's details in the audience currently editing the container

The AzureClient, from the @fluidframework/azure-client package, takes in a tokenProvider parameter as part of its constructor. This parameter can be fulfilled by using the InsecureTokenProvider that is exported here. However, it is advised to only use this for development or testing purposes as it risks exposing your Azure Fluid Relay service tenant key secret on your client side code.

Usage for Development with Local Tinylicious Instance

When using the AzureClient, you can configure it to run against a local Tinylicous instance. Please see the client's documentation on local development for more information on how to do so. In this scenario, the InsecureTokenProvider will take any value for its tenantKey parameter since we're working with a local Tinylicious instance that doesn't require any authentication. As such, we can create an instance of it like this:

const tokenProvider = new InsecureTokenProvider("fooBar", { id: "123", name: "Test User" });

Usage for Development with Azure Fluid Relay service

The AzureClient can also be configured to a deployed Azure Fluid Relay service instance as described here. Now, the configuration is using a real tenantId and the InsecureTokenProvider will need the matching tenantKey as provided during the service onboarding.

const tokenProvider = new InsecureTokenProvider("YOUR-TENANT-KEY-HERE", { id: "123", name: "Test User" });

Again, this should ONLY be used for local development as including the tenant key in the client code risks allowing malicious users to sniff it from the client bundle. Please consider using the AzureFunctionTokenProvider or your own implementation that fulfills the ITokenProvider interface as an alternative for production scenarios.

generateTestUser

A simple function that will generate a test user. This is to be used in conjuntion with InsecureTokenProvider. The response object will be { id: string, name: string}. id will be a uuid and name will be a randomly generated friendly first and last name seperated by a space.

Usage

const tokenProvider = new InsecureTokenProvider("YOUR-TENANT-KEY-HERE", generateTestUser());