
Product
Introducing Custom Pull Request Alert Comment Headers
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
@civic/solana-derived-pass
Advanced tools
An extension to the Identity.com Gateway solution that allows one pass type (a.k.a. gatekeeper network) to be derived from another.
The core idea here is as follows:
This smart contract allows for the generation of derived pass types, that are issued if a caller presents a wallet with active passes from each of the constituent pass types.
Derived Pass issuance is "self-serve" i.e. the recipient of the pass is the only signer needed. This makes it ideal for integrating with dApps.
Constituent pass issuers can register a Fee for use of a constituent pass in a derived pass issuance.
Fees are paid from the derived pass recipient to the gatekeeper(s) that issued the constituent passes. Fees are registered per gatekeeper network + gatekeeper.
Note: SOL only is supported at present, with plans to support SPL-Tokens in the future.
This program is limited in what it can do, and care should be taken that it is not used in a way that is not intended.
This application uses Anchor. To create an Anchor provider from a Solana wallet and connection, do the following:
import * as anchor from "@project-serum/anchor";
import { Connection } from "@solana/web3.js";
const connection = new Connection(...);
// If running locally via a script (most typical during derived pass creation),
// this can be obtained from a Keypair using:
const wallet = new anchor.Wallet(keypair);
// if using solana-wallet-adapter (e.g. during issuance on a dApp),
// this will be the wallet provided by the adapter
const wallet = useWallet();
const provider = new anchor.AnchorProvider({
connection,
wallet,
opts: anchor.AnchorProvider.defaultOptions(),
});
The provider is an authority keypair, used once during creation of the derived pass.
import { DerivedPassService } from "@civic/solana-derived-pass";
const service = await DerivedPassService.build(provider);
const [txSignature, derivedPass] = await service.derivePass([
new PublicKey("..."), // pass 1
new PublicKey("..."), // pass 2
]);
Keep the authority public key, and derived pass public key, and add it to the dApp.
import { DerivedPassService } from "@civic/solana-derived-pass";
const service = await DerivedPassService.build(provider);
const [txSignature, gatewayToken] = await service.issue(authority, derivedPass);
Create an anchor provider with the gatekeeper wallet.
import { DerivedPassService } from "@civic/solana-derived-pass";
const gatekeeperService = await DerivedPassService.build(provider);
const fee = 100_000_000 // 0.1 SOL
const txSignature = await gatekeeperService.setFee(gatekeeperNetwork, fee);
Fees can be changed after being set:
const new_fee = 200_000_000 // 0.2 SOL
const txSignature = await gatekeeperService.setFee(gatekeeperNetwork, fee);
or removed:
const txSignature = await gatekeeperService.unsetFee(gatekeeperNetwork);
A fee can also be set for refresh (see expiry below)
const txSignature = await gatekeeperService.setFee(gatekeeperNetwork, issueFee, refreshFee);
import { DerivedPassService } from "@civic/solana-derived-pass";
const service = await DerivedPassService.build(provider);
const [txSignature, derivedPass] = await service.derivePass([
new PublicKey("..."), // pass 1
new PublicKey("..."), // pass 2
], {
expireDuration: 60 * 60 * 24 // expires after one day
});
If you want the pass to require refresh after every use,
then you can use the expireOnUse
option.
This is useful for component passes that have short expiry, so that the state of the component pass is checked automatically on every use.
Note: For the expireOnUse function to be executed, the integrating program must also call the expireToken instruction on the gateway program via CPI. ExpireOnUse does not happen automatically.
import { DerivedPassService } from "@civic/solana-derived-pass";
const service = await DerivedPassService.build(provider);
const [txSignature, derivedPass] = await service.derivePass([
new PublicKey("..."), // pass 1
new PublicKey("..."), // pass 2
], {
expireOnUse: true
});
You may also want a single-use pass. For this, use the option:
refreshDisabled: true
alongside the expireOnUse
feature.
FAQs
A Civic-Pass derivation library for Solana
We found that @civic/solana-derived-pass demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 16 open source maintainers 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.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.