Androz2091 / discord-player

🎧 Complete framework to simplify the implementation of music commands using discord.js v14
https://discord-player.js.org/
MIT License
589 stars 192 forks source link

Introduce CredentialManager #1905

Closed twlite closed 1 month ago

twlite commented 3 months ago

Describe the feature you would like

A CredentialManager to safely provide sensitive credentials to the extractors in non-leaking way.

Expected behavior

// User sets cookie
player.credentials.set(CredentialType.YouTube, {
  cookie: ...
});

// Extractor gets cookie
const { cookie } = await this.context.requestCredentials(CredentialType.YouTube)
// ^ this code should throw error if the extractor is not supposed to access the credential

// Capture actions
player.credentials.onAccessRequest((extractor) => {
    // Validate extractor manually
    return true // or false to disallow
});

Screenshots

N/A

Additional context

Fixes confusing behavior of current "ytdlOptions" as well as setting access tokens for other extractors