rayauth-session

Crates.iorayauth-session
lib.rsrayauth-session
version0.1.0
sourcesrc
created_at2023-03-14 10:28:54.095165
updated_at2023-03-14 10:28:54.095165
descriptionRayAuth Session keys program crate, uses Anchor
homepagehttps://rayauth.com
repositoryhttps://github.com/AnishDe12020/rayauth
max_upload_size
id809703
size6,543
Anish De (AnishDe12020)

documentation

README

RayAuth Session Keys Crate

This crate contains the session keys program which can be used by other anchor programs to determine the validity of a session keypair

Program ID: QMj41mN3j168KTuUWNrCgbSAYQ7o9QTaaSnT9gLvW9s

To install, add the following to your Cargo.toml:

[dependencies]
rayauth-session = "0.1.0"

Usage

use rayauth_session::program::RayauthSession;
use rayauth_session::SessionKey;

#[derive(Accounts)]
#[instruction(maker_twitter: String, name: String, description: String, logo_url: String, website_url: String, twitter_url: String)]
pub struct SessionKeypairIx<'info> {
    #[account(mut)]
    pub payer: Signer<'info>,
    #[account(
        seeds = [SessionKey::SEED_PREFIX.as_ref(), hunter_signer.session_key.as_ref()],
        seeds::program = RayauthSession::id(),
        bump,
        constraint = signer_key.is_valid()? == true,         // check if the session key has expired or not
        constraint = signer_key.session_key == signer.key(), // checks if the signer is valid
    )]
    pub signer_key: Account<'info, SessionKey>,
    pub signer: Signer<'info>,
}
Commit count: 359

cargo fmt