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 updates to keyless integration guide #343

Closed
wants to merge 1 commit into from
Closed

Conversation

heliuchuan
Copy link
Contributor

Description

Checklist

  • Do all Lints pass?
    • [] Have you ran pnpm spellcheck?
    • [] Have you ran pnpm fmt?
    • [] Have you ran pnpm lint?

Copy link

vercel bot commented May 17, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
developer-docs-nextra ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 17, 2024 3:17pm

Copy link

netlify bot commented May 17, 2024

Deploy Preview for aptos-developer-docs ready!

Name Link
🔨 Latest commit be27f3f
🔍 Latest deploy log https://app.netlify.com/sites/aptos-developer-docs/deploys/66477469fb33b0000830c4af
😎 Deploy Preview https://deploy-preview-343--aptos-developer-docs.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.

Copy link
Collaborator

@gregnazario gregnazario left a comment

Choose a reason for hiding this comment

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

Let's move this guide to Nextra see the guide here https://preview.aptos.dev/en/developer-platforms/contribute


Eventually your EphemeralKeyPair will expire or the JWK used to validate the token will be rotated. In these cases the KeylessAccount must be refreshed with a new JWT token. To detect errors, use a try catch on sign and submit and switch on the KeylessError.type.

```tsx
Copy link
Collaborator

Choose a reason for hiding this comment

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

change to ts

Developers may opt to use their own pepper service/scheme and can override use of the labs hosted pepper service.

Example
```tsx
Copy link
Collaborator

Choose a reason for hiding this comment

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

change to ts

Certain dApps may want to use 'email' instead of the default 'sub' claim to identify user. This allows dApps to mint NFTs to a user's email even if the user has not created an account yet. Note that this also means that if a user changes their emails with respect to the IdP, they may love access to their account.

Example
```tsx
Copy link
Collaborator

Choose a reason for hiding this comment

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

change to ts


Eventually your EphemeralKeyPair will expire or the JWK used to validate the token will be rotated. In these cases the KeylessAccount must be refreshed with a new JWT token. To detect errors, use a try catch on sign and submit and switch on the KeylessError.type.

```tsx
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
```tsx
```ts

Comment on lines +62 to +67
## Example Implementaion

You can find an example app demonstrating how to do basic Keyless integration with Google in the repository below. Follow the directions in the README to get started quickly with Keyless. For more detailed instructions please read the rest of the integration guide.

https://github.com/aptos-labs/aptos-keyless-example/

Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
## Example Implementaion
You can find an example app demonstrating how to do basic Keyless integration with Google in the repository below. Follow the directions in the README to get started quickly with Keyless. For more detailed instructions please read the rest of the integration guide.
https://github.com/aptos-labs/aptos-keyless-example/
## Example Implementaion
You can find an example app demonstrating basic Keyless integration with Google in the [aptos-keyless-example repository](https://github.com/aptos-labs/aptos-keyless-example/). Follow the directions in the README to start with the example. For more detailed instructions on keyless, please read the rest of this integration guide.

Developers may opt to use their own pepper service/scheme and can override use of the labs hosted pepper service.

Example
```tsx
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
```tsx
```ts

Certain dApps may want to use 'email' instead of the default 'sub' claim to identify user. This allows dApps to mint NFTs to a user's email even if the user has not created an account yet. Note that this also means that if a user changes their emails with respect to the IdP, they may love access to their account.

Example
```tsx
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
```tsx
```ts


## SDK Configurable Options

The Keyless SDK provides several configurable options for Keyless Account derivation
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
The Keyless SDK provides several configurable options for Keyless Account derivation
The Keyless SDK provides several options for Keyless Account derivation.

Fetching the proof may take a few seconds and can be done in the background to allow for a more responsive user experience. To enable asyncronous proof fetching just provide a callback to be invoked on proof fetch completion.

Example
```tsx
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
```tsx
```ts

Comment on lines +469 to +472
By default, the expiry time of the EphemeralKeyPair is set to be maximum allowed time in the future, now + 10000000 seconds. To avoid proofs that are long lived which can be a security risk,
```tsx
const ephemeralKeyPair = EphemeralKeyPair.generate({expiryDateSecs: 1721397500});
```
Copy link
Collaborator

Choose a reason for hiding this comment

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

This doesn't describe the purpose of this well. And I think it's taking some jumps assuming the user knows what these mean. It says security risk, and it says to avoid it, but why?

Suggested change
By default, the expiry time of the EphemeralKeyPair is set to be maximum allowed time in the future, now + 10000000 seconds. To avoid proofs that are long lived which can be a security risk,
```tsx
const ephemeralKeyPair = EphemeralKeyPair.generate({expiryDateSecs: 1721397500});
```
By default, the expiry time of the EphemeralKeyPair is set to be the maximum allowed time in the future, now + 10000000 seconds. To reduce the amount of time that a proof expires, you can override the expiration date seconds.
```ts
const ephemeralKeyPair = EphemeralKeyPair.generate({expiryDateSecs: 1721397500});


## Pepper Service API

The pepper service is an Aptos Labs hosted API that computes a pepper as a result of a verifiable unpredictible function (VUF). The inputs to the VUF are the iss, uid_key (defaults to sub), uid_val, aud.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Okay... there are like 10 abbreviations here, and it doesn't read well. Should we describe what a pepper is?

Pepper service makes peppers, but why?

Suggested change
The pepper service is an Aptos Labs hosted API that computes a pepper as a result of a verifiable unpredictible function (VUF). The inputs to the VUF are the iss, uid_key (defaults to sub), uid_val, aud.
The pepper service is an Aptos Labs hosted API that computes a pepper as a result of a verifiable unpredictible function (VUF). The inputs to the VUF are the `iss`, `uid_key` (defaults to `sub`), `uid_val`, `aud`.


## Prover Service API

The prover service is an Aptos Labs hosted API that computes zero-knowledge proofs.
Copy link
Collaborator

Choose a reason for hiding this comment

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

proofs for what?


The prover service is an Aptos Labs hosted API that computes zero-knowledge proofs.

The input to the prover consists of the same request to the pepper service with the addition of the pepper and the max expiry horizon. The inputs to the prover must satisfy the circuit relation for secret witness generation.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Prover must satisfy circuit relation is a weird sentence

Suggested change
The input to the prover consists of the same request to the pepper service with the addition of the pepper and the max expiry horizon. The inputs to the prover must satisfy the circuit relation for secret witness generation.
The prover service takes the same request as the pepper service with two additional inputs, the pepper and the max expiry horizon. The inputs to the prover must satisfy the circuit relation for secret witness generation.

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