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

Use typings from polaris-web (or common shared project) #194

Open
edeykholt opened this issue Sep 18, 2024 · 3 comments
Open

Use typings from polaris-web (or common shared project) #194

edeykholt opened this issue Sep 18, 2024 · 3 comments

Comments

@edeykholt
Copy link
Contributor

The communications between the content script and the page should follow the same typescript interfaces, from here: https://github.com/WebOfTrust/polaris-web/blob/main/src/client.ts. I suggest these be added as imports, instead of redundantly maintaining separate interface definitions or inline object construction, such as the following:

// from https://github.com/WebOfTrust/signify-browser-extension/blob/b20e1abff1fccbed62ca895411446b78dbbecd20/src/pages/content/index.tsx#L109C13-L117C15

window.postMessage(
{
type: "/signify/reply",
payload: autoSigninData,
requestId,
rurl,
},
"*"
);

Explicit constructors might also be helpful to assure constraints beyond the typescript interface, such as when a reply might be required to have a payload of one-of AID or Credential.

There is some overlap with the ui-events defined here: https://github.com/WebOfTrust/signify-browser-extension/blob/main/src/config/event-types.ts

These kind of changes will help assure polaris-web and signify-browser-extension adhere to consistent interfaces communications.

@edeykholt
Copy link
Contributor Author

See refactoring proposal at WebOfTrust/polaris-web#31

@edeykholt
Copy link
Contributor Author

After reconsidering this, it's polaris-web that needs to introduce its typing's / interfaces that any extension's content script would be compatible with.

@edeykholt
Copy link
Contributor Author

Reopening this. Polaris-web does have its typings exposed in its built dist/client.d.ts. Although, there's a build issue: WebOfTrust/polaris-web#32

@edeykholt edeykholt reopened this Dec 31, 2024
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

No branches or pull requests

1 participant