Skip to content

ICP Motoko code: explains how to implement Principal Access List and restric or allow callers authenticated with Internet Identity from calling Query/Update Functions. Hope it helps!

Notifications You must be signed in to change notification settings

Czarean/Internet_Identity-Principal-Access-Lists

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Internet_Identity and Principal Access Lists

On this program you can learn how to implement an Access List hashmap that will contain a list of Principal IDs(Internet Identities)
-The Principals that are part of this Access List Hashmap will be able to call specific Query and Update functions.
-The Princials that call the functions, that are not stored on the Access List Hashmap, will be denied Access.

Instructions:
1-The Anonymous Principal is already allowed on the Access List "acl.hashmap"
2-The addPrincipal, and Authgreet Functions are restricted, meaning only Anonymous PID can call it right off the bat! (Unless you add more PIDs via the AddPrincipal Function)
3-You can test this by login in with a new Internet Identity and try calling both functions, you will find out you cannot call them and get the error message!
4-Copy the Principal ID of the new Internet Identity, open a new window, and log out of the new window.
5-With the Anonymous logged in, add the new Principal via the addPrincipal Function.
6-Go back to the window where the New Internet Identity is logged in, and try calling the addPrincipal, and Authgreet Functions
7-You now should be able to call the restricted functions addPrincipal, and Authgreet.

Note: This might not be the best, more efficient or optimal code to accomplish this, but this certainly does the job, I did what I could with the lil knowledge I have gathered this past few weeks, So if you have any advise or feedback please let me know, I would appreciate it a lot, Thanks.

Any questions let me know, Ill be appy to help a fellow dev! :D

Im new to coding so I still suck, but I will try my best to help xD

Developer: Cesar Anaya
Twitter
https://github.com/Czarean
czardcryptopirate@gmail.com
Discord: crypto_pirate.

I am a Junior Motoko developer: Motoko is my first language, and if you wish to help or advise me on the code, I would be very grateful and excited to collaborate and learn from other Motoko and Frontend developers. You can contact me via email, or private message on my X (Twitter) account, or Discord.

About

ICP Motoko code: explains how to implement Principal Access List and restric or allow callers authenticated with Internet Identity from calling Query/Update Functions. Hope it helps!

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages