This guide shows how to set up a bidirectional client/server authentication for plain TLS sockets.
Newer versions of openssl are stricter about certificate purposes. Use extensions accordingly.
Generate a Certificate Authority:
| /* eslint-disable @typescript-eslint/no-explicit-any */ | |
| type FormMetadata = { | |
| fields: FieldsRules | |
| options?: { | |
| errorFieldName: string | symbol | |
| } & Required<ErrorField> | |
| touchedFields?: WeakMap<any, Set<string | symbol>> | |
| } | |
| type FieldsRules = Map<string | symbol, FieldsRule> | |
| type FieldsRule = { | 
| class AsyncBarrier { | |
| private open = true; | |
| private barrier = Promise.resolve(); | |
| private resolver = () => {}; | |
| public events = new Set<string>(); | |
| private resolvedEvents = new Set<string>(); | |
| constructor(...events: string[]) { | |
| if (events.length === 0) return; | 
This guide shows how to set up a bidirectional client/server authentication for plain TLS sockets.
Newer versions of openssl are stricter about certificate purposes. Use extensions accordingly.
Generate a Certificate Authority:
| /** | |
| * _Explicitly declare modifications_ to an existing object type via a fluent interface which yields a mapping function | |
| * from the original data type to the type derived from the modification commands. | |
| * | |
| * The value over authoring a simple mapping function directly | |
| * * harder to make a mistake due to the explicit nature | |
| * * easier to read. | |
| * | |
| * This is _not_ production quality code but rather a _proof of concept_ gist for applying conditional/mapped | |
| * types to mapper generation. A real-world usage might involve also generating the type-guard function | 
| /** | |
| * Imagine a Fluent Builder where some subset of the fluent methods are valid to call | |
| * * after one or more fluent methods have been called | |
| * * before one or more fluent methods have been called | |
| * * limited number of times. | |
| * | |
| * There is no way to enforce such constraints in statically typed languages such as C++, C# or Java when using a single builder | |
| * class/interface. Developers would need to author many interfaces to represent the different shapes and would likely need to | |
| * author many versions of the builder itself (proxies with a specific signature delegating to an underlying source builder). | |
| * | 
| const PLUGIN_NAME = "MutateRuntimePlugin"; | |
| class MutateRuntimePlugin { | |
| /** | |
| * | |
| * @param {FederationDashboardPluginOptions} options | |
| */ | |
| constructor(options) {} | |
| /** | 
| /* eslint-disable no-console */ | |
| const resolver = require('babel-plugin-module-resolver') | |
| const resolve = require('enhanced-resolve') | |
| const path = require('path') | |
| const { DEBUG, BABEL_ENV, NODE_ENV, TARGET } = process.env | |
| const isProduction = NODE_ENV === 'production' | |
| const isServer = TARGET === 'server' | |
| const resolverTs = resolve.create.sync({ | |
| extensions: ['.ts', '.tsx', '.js', '.json'], | 
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"/> | |
| <title>join vs concat when dealing with very long lists of single-character strings</title> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script> | |
| <script src="./suite.js"></script> | |
| </head> | |
| <body> | |
| <h1>Open the console to view the results</h1> | 
| let cache = new Map(); | |
| let pending = new Map(); | |
| function fetchTextSync(url) { | |
| if (cache.has(url)) { | |
| return cache.get(url); | |
| } | |
| if (pending.has(url)) { | |
| throw pending.get(url); | |
| } |