waltid-permissions
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Kotlin Multiplatform Permissions library

by walt.id

Define, apply, and check permissions seamlessly across different platforms.

Join community! Follow @walt_id

Installation

You can install the library via npm:

npm install waltid-permissions

Usage

Here's a quick guide on how to use the library in your JavaScript environment.

Importing the Library

First, import the library into your JavaScript file:

import lib from 'waltid-permissions';

Example Code

Below is an example of how to create a PermissionChecker, define a permission set, apply permissions, and check specific permissions:

// Create a new instance of PermissionChecker
const permissionChecker = new lib.id.walt.permissions.PermissionChecker();

// Create a permission set from a permission string
const permissionSet = lib.id.walt.permissions.FlowPermissionSet.Companion.fromPermissionStringFlow('orgA.a', 'orgA.tenant1:+issue,+config');

// Apply permissions asynchronously
await permissionChecker.applyPermissionsAsync(permissionSet);

// Check if a specific permission is granted
console.log(permissionChecker.checkPermission("orgA.tenant1.abc", "issue")); // Outputs: true/false

Readme

Keywords

none

Package Sidebar

Install

npm i waltid-permissions

Weekly Downloads

19

Version

1.0.0

License

none

Unpacked Size

982 kB

Total Files

23

Last publish

Collaborators

  • waltid