Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Setup


Table of contents

  1. Create Sol Cerberus app
  2. Adding SC app ID to an Anchor program

Create Sol Cerberus app

The Sol Cerberus app manages roles and permissions, enforcing the access rules in your Solana program. There are two ways to create your SC app, you can either:

Normally you would use an independent SC app for each Solana program, but you can also use multiple SC apps, allowing your users to setup/manage their own access permissions.

Adding SC app ID to an Anchor program

The Anchor program needs to know the SC app ID in order to be able to authenticate requests. To add the SC app ID generated on previous step into your Anchor program, create a constant called SOL_CERBERUS_APP_ID within the lib.rs file located at ./programs/NAME-OF-YOUR-PROGRAM/src/lib.rs of your anchor program:

 # Your program ID (will be different on each program)
declare_id!("s0M3k3ytX83crd4vAgRrvmwXgVQ2r69uCpg8xzh8A5X124x");

# Add the following line using your own Sol Cerberus app ID:
const SOL_CERBERUS_APP_ID: Pubkey = pubkey!("PASTE_HERE_YOUR_SC_APP_ID");

#[program]
pub mod my_anchor_program {

    use super::*;

    ...
}