August 31, 2023

peaq SDK now includes the peaq access function

What’s happening?

peaq SDK now supports peaq access - decentralized role-based access control (RBAC). With a few lines of code in JavaScript, developers can now import this crucial function into their DePIN or dApp, greatly reducing development time.

Why is it important?

Access control is an important part of most interactions involving connected devices, whether reserving a parking spot, getting access to energy while charging a car, or opening a car when using a car sharing service. As such, peaq access is an essential backend functionality for any DePIN or dApp building on peaq.

What does this mean for the community?

One of the crucial parts required for application development is now available off-the-shelf in the peaq SDK, making dApp development in JavaScript, the world’s most popular coding language, easier and more straightforward.

What's in a role?

Imagine a ride-hailing service where anybody can do whatever they want. The passengers are behind the wheel making sure the tech support team gets where it needs to get. The drivers are deploying another backend update, which adds 10 new features and 10,000 new bugs. The devs are at the call center pondering how it all got to this point.

Whatever dark magic was involved in this, it probably had something to do with who can and should be able to do what. With roles, you might say, such as passenger, driver, developer, and associated access to devices and processes. Which brings us to the importance of role-based access control (RBAC) in designing apps to do with connected devices. You want to make sure that drivers can drive, passengers can get in and out, et cetera.

peaq access is one of peaq’s core Modular DePIN Functions alongside peaq ID and peaq pay. It has been around for a while, but to use it, developers would have had to implement it as a Substrate pallet, using a coding language called Rust. Rust isn’t the most widely-used language — that crown belongs to JavaScript. What does that mean in lay terms? For a JavaScript dev, implementing peaq access is not unlike trying to put together an IKEA wardrobe with a manual in a language that you don’t know. It kinda makes sense, and it will work eventually, but seriously, is this thing upside down or something?

peaq access in just a few lines of code

Have no fear: peaq SDK is here to make life easier for any JavaScript devs building on peaq. You can think of the SDK as a set of LEGO bricks that enables you to build cool things with just a few quick snaps. With the new update, peaq access joins the ranks of the Modular DePIN Functions available through the SDK.

Anyone building a DePIN or dApp on peaq can now import role-based access control into their applications with a few lines of JavaScript. This dramatically reduces the barrier to entry for builders and makes the peaqosystem a notch friendlier to both Web2 and Web3 builders used to different coding languages. peaq access is the second feature to be added to the SDK, with the original release featuring peaq ID.

For a more in-depth look under the bonnet, check out the documentation focused on peaq access on peaq’s SDK including a detailed guide to creating new roles, groups, and permissions. 

Join the Economy of Things


All blogposts