How to use the @authx/scopes/dist/scope.simplify function in @authx/scopes

To help you get started, we’ve selected a few @authx/scopes examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github the-control-group / authx / packages / authx / src / util / scopeTemplates.ts View on Github external
export function simplify(templates: string[]): string[] {
  if (!isValid(templates)) {
    throw new InvalidScopeError("One of the provided templates is invalid.");
  }

  // We are bypassing the default exports of @authx/scopes which ensure the
  // validity of passed scopes. This is undocumented behavior, but by far the
  // simplest approach to acheiving simplification with a characterset beyond
  // those allowed by the scope spec.
  return unsafeSimplify(templates);
}

@authx/scopes

This is a small collection of utility functions for AuthX scopes. These scopes are human-readable, fully OAuth2-compatible, and support both pattern matching and set algebra.

MIT
Latest version published 4 months ago

Package Health Score

73 / 100
Full package analysis