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

feat: enable ext communication helper #10

Merged
merged 1 commit into from
May 3, 2023
Merged

Conversation

weichweich
Copy link
Contributor

@weichweich weichweich commented May 3, 2023

related KILTprotocol/ticket/issues/2126

This PR adds a helper to signal the extension that the DApp supports the credential API.

The Credential API version is hard coded inside this library as it is expected that downstream projects support exactly the version that is supported by this library. If this library updates the Credential API version all downstream project will be required to update their code to support the new version.

Support for possible other APIs

If there are new APIs added to the wallets this method can be extended in the following way:

export function initializeKiltExtensionAPI(options: {
  credentialApi: boolean,
  newApi: boolean,
} = {
  credentialApi: true,
  newApi: false,
})

This would be a non breaking change.

@weichweich weichweich requested a review from arty-name May 3, 2023 07:26
Object.defineProperty(apiWindow.kilt, 'meta', {
value: {
versions: {
credentials: '3.0'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the specific version of the API be customizable? We also have 3.1 now and 3.2 is in the works.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we would always update this library with the new types/changed API. So if you want to support 3.1 or 3.2 you would update this library and get the changes as part of the library.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That could be rather inconvenient for the application developer who wants flexibility

@weichweich weichweich merged commit 7db3a47 into main May 3, 2023
@weichweich weichweich deleted the aw-init-extension branch May 3, 2023 08:08
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