Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add skipKeyValidation option (to slshx handler) to skip key validation #3

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

SkyfallWasTaken
Copy link

Sometimes, it's useful to skip key validation for some reason (for example, I'm validating keys and creating a cooldown system for commands) This PR adds an option to do just that. Haven't tested it out yet, but IMO it should work.

@mrbbot
Copy link
Owner

mrbbot commented Mar 22, 2022

Hey! 👋 Thanks for the PR! I'm still a little bit confused why you need this though. Discord's API docs state that "you must validate the request each time you receive an interaction".

Could you get around this by writing a custom fetch handler?

const slshxHandler = createHandler({ ... });

export default {
  async fetch(request, env, ctx) {
    if(request.url === "..." /* or any other conditions on request */) {
      // Only perform request validation here
      return slshxHandler(request, env, ctx);
    }
    return new Response("Bad Request", { status: 400 });
  },
};

@SkyfallWasTaken
Copy link
Author

SkyfallWasTaken commented Mar 22, 2022

What I'm trying to do is verify the signatures myself so that I can do some logic before handling the interaction, a custom fetch handler would either be spoofable (it's run for each initial user) or perform signature validation twice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants