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 discovery.authn.exclude #1937

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .changeset/shiny-pumas-guess.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
"@onflow/fcl-core": minor
---

Allow apps to exclude certain wallets from FCL Discovery.

```javascript
import { config } from "@onflow/fcl";

// Include supports discovery.wallet or discovery.authn.endpoint
config({
"discovery.wallet": "https://fcl-discovery.onflow.org/testnet/authn",
"discovery.authn.endpoint":
"https://fcl-discovery.onflow.org/api/testnet/authn",
"discovery.authn.exclude": ["0x123"], // Exclude a wallet by address
});
```
2 changes: 2 additions & 0 deletions packages/fcl-core/src/current-user/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,13 @@ async function getAccountProofData() {

const makeConfig = async ({
discoveryAuthnInclude,
discoveryAuthnExclude,
discoveryFeaturesSuggested,
}) => {
return {
client: {
discoveryAuthnInclude,
discoveryAuthnExclude,
discoveryFeaturesSuggested,
clientServices: await makeDiscoveryServices(),
supportedStrategies: getServiceRegistry().getStrategies(),
Expand Down
2 changes: 2 additions & 0 deletions packages/fcl-core/src/discovery/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export async function getServices({types}) {
)

const include = await config.get("discovery.authn.include", [])
const exclude = await config.get("discovery.authn.exclude", [])
const url = new URL(endpoint)

return fetch(url, {
Expand All @@ -25,6 +26,7 @@ export async function getServices({types}) {
type: types,
fclVersion: VERSION,
include,
exclude,
features: {
suggested: await config.get("discovery.features.suggested", []),
},
Expand Down
2 changes: 2 additions & 0 deletions packages/fcl-core/src/discovery/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export const makeDiscoveryServices = async () => {

export async function getDiscoveryService(service) {
const discoveryAuthnInclude = await config.get("discovery.authn.include", [])
const discoveryAuthnExclude = await config.get("discovery.authn.exclude", [])
const discoveryFeaturesSuggested = await config.get(
"discovery.features.suggested",
[]
Expand Down Expand Up @@ -36,6 +37,7 @@ export async function getDiscoveryService(service) {
endpoint,
method,
discoveryAuthnInclude,
discoveryAuthnExclude,
discoveryFeaturesSuggested,
}
}
Loading