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

suborgs tidying #51

Merged
merged 3 commits into from
Oct 27, 2023
Merged

suborgs tidying #51

merged 3 commits into from
Oct 27, 2023

Conversation

andrewkmin
Copy link
Contributor

updating docs to mention v4

todo:

  • update quickstart to use wallets/new signing endpoint(s)
  • revamp quickstart... generally

@vercel
Copy link

vercel bot commented Oct 27, 2023

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

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 27, 2023 6:43pm

"rootQuorumThreshold": 1
"rootQuorumThreshold": 1,
"wallet": {
"walletName": "Default ETH Wallet",
Copy link
Contributor

Choose a reason for hiding this comment

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

let's drop the ETH here since it might confuse people into thinking that you can only use this wallet for ETH

organizationId: "<user sub-organization>",
timestampMs: String(Date.now()),
parameters: {
privateKeys: [
walletName: "New ETH Wallet",
Copy link
Contributor

Choose a reason for hiding this comment

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

since in step 1 we've created a wallet, I wonder if we should show how to derive additional accounts from that wallet instead? ACTIVITY_TYPE_CREATE_WALLET_ACCOUNTS

"addressFormat": "ADDRESS_FORMAT_ETHEREUM",
},
],
},
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

It might be helpful to explain the expected response shape. If you feel like it muddies the water skip it!

{
  sub_organization_id: "" // the organization_id that the end-user must use when signing requests
  wallet: {
    wallet_id: "" // the wallet_id used to generate more accounts
    addresses: "" // the address used to sign with
  }
}

"timestampMs": "<time-in-ms>",
"organizationId": "<your-organization-id>",
"parameters": {
"signWith": "<wallet account address, private key id, or private key address>",
Copy link
Contributor

Choose a reason for hiding this comment

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

since this is a quickstart and we don't mention private keys , let's just put <wallet account address> instead

Copy link
Contributor

@timurnkey timurnkey left a comment

Choose a reason for hiding this comment

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

a few recs, but LGTM


### Overview

Turnkey has built a new model for private key management that utilizes secure enclaves. All transactions are signed within an enclave and private keys are never exposed to Turnkey, your software, or your team. Turnkey’s role is similar to that of a safety deposit box operator — Turnkey secures and provides access to the safety deposit boxes, but our system requires cryptographic proof of ownership to take any action with the keys held within.

In this example wallet implementation, you will create a segregated sub-organization for each end-user, and leverage [passkeys](https://www.passkeys.io/) as cryptographic proof of ownership to ensure only the end user has the ability to approve signing with their private key.
In this example wallet implementation, you will create a segregated sub-organization for each end-user, and leverage [passkeys](https://www.passkeys.io/) as cryptographic proof of ownership to ensure only the end-user has the ability to approve signing with their private key.
Copy link
Contributor

Choose a reason for hiding this comment

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

We could link our own passkey docs here: https://docs.turnkey.com/category/using-passkeys


### Before you start

Make sure you’ve set up your primary Turkey Organization as well as one or more API-only users that will programmatically manage user onboarding within your application. Check out the [quickstart guide](quickstart) if you need help getting started.
Make sure you’ve set up your primary Turkey organization as well as one or more users with API access that will programmatically manage user onboarding within your application. Check out the [quickstart guide](quickstart) if you need help getting started.
Copy link
Contributor

Choose a reason for hiding this comment

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

Turkey -> Turnkey 😁


With this setup each end-user now has sole control over their sub-organization and any resources created within it. Your application cannot take any actions on resources within the sub-organization without explicitly cryptographic authorization from the end-user in the form of a passkey signature.

It's important to note that the initial activity to create a sub-organization has to be authorized by an API key or a user in your main Turnkey organization. Otherwise anyone would be able to create sub-organizations in your organization! Here's an [example](https://github.com/tkhq/sdk/blob/a2bfbf3cbd6040902bbe4c247900ac560be42925/examples/with-federated-passkeys/src/pages/index.tsx#L88-L116) where the initial registration is done, and posted to a NextJS backend. The NextJS backend inserts the attestation and signs the `CREATE_SUB_ORGANIZATION_V4` activity [here](https://github.com/tkhq/sdk/blob/ba360baeb60d80276f7faeca602b99190fe5affe/examples/with-federated-passkeys/src/pages/api/createSubOrg.ts#L27-L106).
Copy link
Contributor

Choose a reason for hiding this comment

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

We can link wallet.tx.xyz as a live link potentially. Might easier for people to grok what's happening if they can both interact with the demo and look at the code.

"addressFormat": "ADDRESS_FORMAT_ETHEREUM",
},
],
},
}
```
Copy link
Contributor

Choose a reason for hiding this comment

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

Wow Github is losing its mind here
image

@andrewkmin andrewkmin merged commit 9d1045b into main Oct 27, 2023
5 checks passed
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.

3 participants