How to use the @authx/strategy-password.PasswordCredential function in @authx/strategy-password

To help you get started, we’ve selected a few @authx/strategy-password 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 / tools / src / scripts / bootstrap.ts View on Github external
name: "AuthX Root User"
  });

  const authority = new PasswordAuthority({
    id: v4(),
    enabled: true,
    strategy: "password",
    name: "Password",
    description: "The password authority.",
    details: {
      rounds: 12
    }
  });

  const password = randomBytes(16).toString("hex");
  const credential = new PasswordCredential({
    id: v4(),
    enabled: true,
    authorityId: authority.id,
    authorityUserId: user.id,
    userId: user.id,
    details: {
      hash: await hash(password, authority.details.rounds)
    }
  });

  const role = new Role({
    id: v4(),
    enabled: true,
    name: "Super Administrator",
    description: "A super administrator has full access to all resources.",
    scopes: ["**:**:**"],