Skip to content

[SDK] Operations only work on PDS registered in sdk instance #75

@Kzoeps

Description

@Kzoeps

Which area(s) of Hypercerts are affected? (leave empty if unsure)

SDK

To Reproduce

1, Set up the SDK instance with a PDS url

const sdk = createATProtoSDK({
  oauth: {
    clientId: `${process.env.NEXT_PUBLIC_APP_URL}/client-metadata.json`,
    redirectUri: `${process.env.NEXT_PUBLIC_APP_URL}/api/auth/callback`,
    scope: "atproto transition:generic",
    jwksUri: `${process.env.NEXT_PUBLIC_APP_URL}/jwks.json`,
    jwkPrivate: process.env.ATPROTO_JWK_PRIVATE,
  },
  storage: {
    sessionStore,
    stateStore,
  },
  servers: {
    pds: "https://shiitake.us-east.host.bsky.network",
  },
});
  1. Authenticate on using the sdk with an account that is not on the PDS provided when creating the SDK instance. i.e. for the above configuration authenticate with an account not on https://shiitake.us-east.host.bsky.network.

Describe the Bug

Currently when we define the sdk instance we need to provider the pds url.

const sdk = createATProtoSDK({
  oauth: {
    clientId: `${process.env.NEXT_PUBLIC_APP_URL}/client-metadata.json`,
    redirectUri: `${process.env.NEXT_PUBLIC_APP_URL}/api/auth/callback`,
    scope: "atproto transition:generic",
    jwksUri: `${process.env.NEXT_PUBLIC_APP_URL}/jwks.json`,
    jwkPrivate: process.env.ATPROTO_JWK_PRIVATE,
  },
  storage: {
    sessionStore,
    stateStore,
  },
  servers: {
    pds: "https://shiitake.us-east.host.bsky.network",
  },
});

However this means that the sdk only works if the user has an account on the same PDS as the one configured in the sdk. And so it fails when a user logs in with an account on a different PDS.

Image

Gives the above error

Expected Behavior

More of a feature request as well but the PDS url should be autodetected through the users session/did. And this would allow for accounts on different PDSs to still use the sdk for all the operations

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions