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

sapphire: initial notes on authenticated calls & contract authentication #476

Merged
merged 30 commits into from
Oct 10, 2023

Conversation

CedarMist
Copy link
Member

@CedarMist CedarMist commented Jul 25, 2023

This covers patterns for verifying caller identity for view calls.

Preview: https://deploy-preview-476--trusting-archimedes-14c863.netlify.app/dapp/sapphire/authentication

@netlify
Copy link

netlify bot commented Jul 25, 2023

Deploy Preview for trusting-archimedes-14c863 ready!

Name Link
🔨 Latest commit e9a8410
🔍 Latest deploy log https://app.netlify.com/sites/trusting-archimedes-14c863/deploys/65250d2be56ae40008f043e2
😎 Deploy Preview https://deploy-preview-476--trusting-archimedes-14c863.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@CedarMist CedarMist self-assigned this Jul 25, 2023
@CedarMist CedarMist added the documentation Improvements or additions to documentation label Jul 25, 2023
@CedarMist CedarMist marked this pull request as ready for review July 25, 2023 21:36
docs/dapp/sapphire/authentication.md Outdated Show resolved Hide resolved
docs/dapp/sapphire/authentication.md Outdated Show resolved Hide resolved
docs/dapp/sapphire/authentication.md Outdated Show resolved Hide resolved
docs/dapp/sapphire/authentication.md Outdated Show resolved Hide resolved
docs/dapp/sapphire/authentication.md Outdated Show resolved Hide resolved
docs/dapp/sapphire/authentication.md Outdated Show resolved Hide resolved
Copy link
Member

@matevz matevz left a comment

Choose a reason for hiding this comment

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

First pass.

Also, can you wrap the lines to 80 characters, so it's easier to read the source code and review it on github.

And also we should mention this chapter in https://deploy-preview-476--trusting-archimedes-14c863.netlify.app/dapp/sapphire/guide#transactions--calls section where we already talk about signed/unsigned calls and MetaMask popups.

docs/dapp/sapphire/authentication.md Outdated Show resolved Hide resolved
docs/dapp/sapphire/authentication.md Outdated Show resolved Hide resolved
docs/dapp/sapphire/authentication.md Outdated Show resolved Hide resolved
docs/dapp/sapphire/authentication.md Outdated Show resolved Hide resolved
docs/dapp/sapphire/authentication.md Outdated Show resolved Hide resolved
docs/dapp/sapphire/authentication.md Outdated Show resolved Hide resolved
docs/dapp/sapphire/authentication.md Outdated Show resolved Hide resolved
docs/dapp/sapphire/authentication.md Outdated Show resolved Hide resolved
docs/dapp/sapphire/authentication.md Outdated Show resolved Hide resolved
docs/dapp/sapphire/authentication.md Outdated Show resolved Hide resolved
Copy link
Member

@matevz matevz left a comment

Choose a reason for hiding this comment

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

Another pass.

docs/dapp/sapphire/authentication.md Outdated Show resolved Hide resolved
docs/dapp/sapphire/authentication.md Outdated Show resolved Hide resolved
docs/dapp/sapphire/authentication.md Outdated Show resolved Hide resolved
docs/dapp/sapphire/authentication.md Outdated Show resolved Hide resolved
another contract in a way which could reveal sensitive information, the calling
contract must implement access control or authentication.

By default all `eth_call` queries used to invoke contract functions have the
Copy link
Member

Choose a reason for hiding this comment

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

By default? I don't think you can easily change this behavior in Sapphire so I would remove "By default".

docs/dapp/sapphire/authentication.md Outdated Show resolved Hide resolved
docs/dapp/sapphire/authentication.md Outdated Show resolved Hide resolved
Comment on lines +85 to +86
These parameters are visible in the EIP-712 popup signed by the user. Queries
with the same parameters will use the same leash.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
These parameters are visible in the EIP-712 popup signed by the user. Queries
with the same parameters will use the same leash.
These parameters are visible in the [EIP-712][eip-712] popup signed by the user. **Queries
with the same parameters will use the same leash.**

Perhaps this would be a good place to have a screenshot of Metamask showing some EIP-712 content?

docs/dapp/sapphire/authentication.md Outdated Show resolved Hide resolved
docs/dapp/sapphire/authentication.md Show resolved Hide resolved
@CedarMist CedarMist requested review from matevz and aefhm August 29, 2023 06:14
Copy link
Contributor

@aefhm aefhm left a comment

Choose a reason for hiding this comment

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

I think the sections on types of contract calls, and Sapphire's treatment of signed queries are straightforward and informative and good to go.

With regards to the authenticated calls and SignInExample, I'd say we give it a try.

docs/dapp/sapphire/authentication.md Outdated Show resolved Hide resolved
docs/dapp/sapphire/authentication.md Outdated Show resolved Hide resolved
Copy link
Member

@matevz matevz left a comment

Choose a reason for hiding this comment

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

Some minor nits. Otherwise LGTM!


Behind the scenes the signed queries use a "leash" to specify validity conditions
so the query can only be performed within a block and account `nonce` range.
These parameters are visible in the EIP-712 popup signed by the user. Queries
Copy link
Member

Choose a reason for hiding this comment

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

If the query is cached, then no user interaction is required? Where does EIP-712 popup then come from?


Behind the scenes the signed queries use a "leash" to specify validity conditions
so the query can only be performed within a block and account `nonce` range.
These parameters are visible in the EIP-712 popup signed by the user. Queries
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
These parameters are visible in the EIP-712 popup signed by the user. Queries
These parameters are visible in the [EIP-712][eip-712] popup signed by the user. Queries

docs/dapp/sapphire/authentication.md Outdated Show resolved Hide resolved
docs/dapp/sapphire/authentication.md Outdated Show resolved Hide resolved
docs/dapp/sapphire/authentication.md Outdated Show resolved Hide resolved
docs/dapp/sapphire/authentication.md Outdated Show resolved Hide resolved
@CedarMist CedarMist merged commit d581600 into oasisprotocol:main Oct 10, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants