Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
});
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: ["**:**:**"],
userIds: [user.id]
});
const authorization = new Authorization({
id: v4(),
enabled: true,
scopes: ["**:**:**"],
userId: user.id,
grantId: null,
secret: randomBytes(16).toString("hex")
});