A Turnkey organization is a collection of users, their authentication methods, their wallets, and the policies that govern what actions those users can perform. Each organization is uniquely identified by an organization ID.
A Turnkey parent organization can be used to represent an application, for example a trading application. A Turnkey sub-organization can be used to represent one of your application’s end users.
Every user must have at least one authentication method to make requests to the Turnkey API. In this example, we’ll use API keys (a public/private key pair) for user authentication.
A common flow for applications using Turnkey is:
- When a new user signs up for your app, your parent organization creates a new sub-organization for that user.
- That sub-organization holds the user’s keys, wallets, and policy controls.
For this example, a Turnkey parent organization has already been created, and an API key for making requests to the Turnkey API has been provided via the .env file.
- Create a new Turnkey sub-organization with a user account for which we’ll generate an API key shortly.
- Create a new Ethereum wallet on this new sub-organization.
- Sign a transaction using this newly created wallet account.
Resources:
- Turnkey API Reference: https://docs.turnkey.com/api-reference/overview
- Turnkey Organization Overview: https://docs.turnkey.com/concepts/overview#organizations
- Turnkey SDK Documentation: https://docs.turnkey.com/sdks/javascript-server
Clone the repo
git clone https://github.com/tkhq/product-eng-interview.git
cd product-eng-interview
Copy .env.example and rename it .env and fill in the provided information.
cp .env.example .env
Download the dependencies
npm install
Open src/index.ts in a code editor of your choice!