
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
@permify/node-permify
Advanced tools
Use Permify in server-side Node.js Projects.
npm install @permify/node-permify
To get started, create Permify client using your Workspace id and API private key:
with require
const Permify = require("@permify/node-permify");
const permifyClient = new Permify.Client("workspace_id", "private_token");
with import
import { Client as PermifyClient } from "@permify/node-permify";
const permifyClient = new PermifyClient("workspace_id", "private_token");
In order to start using Permify you need to have at least one group entity which is part of your workspace. This method creates a group entity in Permify.
const payload = {
//If your app is a multi-tenant, id represents your group or tenant's id.
//If your app is not multi-tenant or haven't got group entity,
//Give any kind of identier value in here to create one.
id: 'test_cs1234utg',
//Name of the group
name: 'test_name'
}
permifyClient.createGroup(payload)
.then((group) => {
console.log(group)
})
.catch((error) => {
console.log(error.response)
});
This method creates a user entity in Permify. You need a group, which the created user must belong.
const payload = {
//Id of the user to be created in your app
id: "id",
//id of group
group_id: "group id",
// name of the user
name: "name",
// photo url of the user
photo: "",
// role names array
role_names: [],
// custom attributes
attributes: {}
};
permifyClient.createUser(payload).then((user) => {
console.log(user)
})
.catch((error) => {
console.log(error.response)
});
This method creates a role entity in Permify.
permifyClient.createRole('group_id', {name: 'test_role'})
.then((role) => {
console.log(role)
})
.catch((error) => {
console.log(error.response)
});
This method creates a rule entity in Permify.
user.attributes.tenure > 8
"manager" in user.roles
"admin" in user.roles
user.id == resource.attributes.owner_id
const payload = {
// name of rule
name: "name",
// conditions
conditions: []
};
permifyClient.createRule(payload).then((rule) => {
console.log(rule)
})
.catch((error) => {
console.log(error.response.data)
});
This method creates a option entity in Permify.
const payload = {
// name of option
name: "name",
// rule names
rule_names: []
};
permifyClient.createOption(payload).then((option) => {
console.log(option)
})
.catch((error) => {
console.log(error.response.data)
});
This method creates a policy entity in Permify.
const payload = {
// name of policy
name: "name",
// rule names
option_names: []
};
permifyClient.createPolicy(payload).then((policy) => {
console.log(policy)
})
.catch((error) => {
console.log(error.response.data)
});
This method returns a decision about whether the user is authorized for this action with the given parameters.
PolicyName (mandatory)Custom Permify Policy name.
UserID (optional)Id of the User
ResourceID (optional)Id of the Resource, mandatory if any resource used or accessed when creating Rule/Rules.
ResourceType (optional)Type or name of the Resource, mandatory if any resource used or accessed when creating Rule/Rules.
const payload = {
// name of policy
policy_name: "policy name",
// id of user
user_id: "user id",
// resource (optional)
resource_id: "resource id",
resource_type: "resource type"
};
permifyClient.isAuthorized(payload)
.then((rule) => {
if(rule.data.allow){
// action
}
})
.catch((error) => {
console.log(error.response)
});
For more information on how to use the Permify API, please refer to the Permify API Reference.
FAQs
Node Client of Permify
The npm package @permify/node-permify receives a total of 0 weekly downloads. As such, @permify/node-permify popularity was classified as not popular.
We found that @permify/node-permify demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.