-
Notifications
You must be signed in to change notification settings - Fork 19
sync docs with latest sdk release #433
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
Open
moeodeh3
wants to merge
2
commits into
main
Choose a base branch
from
moeO/sync
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| --- | ||
| title: "addOauthProvider()" | ||
| --- | ||
|
|
||
| import { H3Bordered } from "/snippets/h3-bordered.mdx"; | ||
| import { NestedParam } from "/snippets/nested-param.mdx"; | ||
|
|
||
| <H3Bordered text="Overview" /> | ||
|
|
||
| Adds an OAuth provider to the user. | ||
|
|
||
| <ul> | ||
| <li>This function adds an OAuth provider (e.g., Google, Apple) to the user account.</li> | ||
| <li>If a userId is provided, it adds the provider for that specific user; otherwise, it uses the current session's userId.</li> | ||
| <li>Automatically checks if an account already exists for the provided OIDC token and prevents duplicate associations.</li> | ||
| <li>If the user's email is not set or not verified, attempts to update and verify the email using the email from the OIDC token.</li> | ||
| <li>Handles session management and error reporting for the add provider flow.</li> | ||
| <li>Optionally allows stamping the request with a specific stamper (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet).</li> | ||
| </ul> | ||
|
|
||
| <p><strong>Package:</strong> <code>core</code></p> | ||
|
|
||
| <p><strong>Defined in:</strong> <a href="https://github.com/tkhq/sdk/blob/main/packages/core/src/__clients__/core.ts#L3135">__clients__/core.ts:3135</a></p> | ||
|
|
||
| <H3Bordered text="Parameters" /> | ||
|
|
||
| <ParamField body="params" type='AddOauthProviderParams' required={true} > | ||
| <Expandable title="params details"> | ||
| <NestedParam parentKey="params" childKey="oidcToken" type='string' required={true}> | ||
| OIDC token for the OAuth provider. | ||
| </NestedParam> | ||
| <NestedParam parentKey="params" childKey="organizationId" type='string' required={false}> | ||
| organization ID to specify the sub-organization (defaults to the current session's organizationId). | ||
| </NestedParam> | ||
| <NestedParam parentKey="params" childKey="providerName" type='string' required={true}> | ||
| name of the OAuth provider to add (e.g., "Google", "Apple"). | ||
| </NestedParam> | ||
| <NestedParam parentKey="params" childKey="stampWith" type='StamperType' required={false}> | ||
| parameter to stamp the request with a specific stamper (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). | ||
| </NestedParam> | ||
| <NestedParam parentKey="params" childKey="userId" type='string' required={false}> | ||
| user ID to add the provider for a specific user (defaults to current session's userId). | ||
| </NestedParam> | ||
| </Expandable> | ||
| </ParamField> | ||
|
|
||
| <H3Bordered text="Response" /> | ||
| A successful response returns the following fields: | ||
|
|
||
| <ResponseField name="returns" type="string[]" required={true} > | ||
| A promise that resolves to an array of provider IDs associated with the user. | ||
| </ResponseField> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| --- | ||
| title: "addPasskey()" | ||
| --- | ||
|
|
||
| import { H3Bordered } from "/snippets/h3-bordered.mdx"; | ||
| import { NestedParam } from "/snippets/nested-param.mdx"; | ||
|
|
||
| <H3Bordered text="Overview" /> | ||
|
|
||
| Adds a new passkey authenticator for the user. | ||
|
|
||
| <ul> | ||
| <li>This function prompts the user to create a new passkey (WebAuthn/FIDO2) and adds it as an authenticator for the user.</li> | ||
| <li>Handles both web and React Native environments, automatically selecting the appropriate passkey creation flow.</li> | ||
| <li>If a userId is provided, the passkey is added for that specific user; otherwise, it uses the current session's userId.</li> | ||
| <li>The passkey's name and display name can be customized; if not provided, defaults are generated.</li> | ||
| <li>The resulting passkey attestation and challenge are registered with Turnkey as a new authenticator.</li> | ||
| </ul> | ||
|
|
||
| <p><strong>Package:</strong> <code>core</code></p> | ||
|
|
||
| <p><strong>Defined in:</strong> <a href="https://github.com/tkhq/sdk/blob/main/packages/core/src/__clients__/core.ts#L3311">__clients__/core.ts:3311</a></p> | ||
|
|
||
| <H3Bordered text="Parameters" /> | ||
|
|
||
| <ParamField body="params" type='AddPasskeyParams' required={false} > | ||
| <Expandable title="params details"> | ||
| <NestedParam parentKey="params" childKey="displayName" type='string' required={false}> | ||
| display name of the passkey (defaults to the value of `name`). | ||
| </NestedParam> | ||
| <NestedParam parentKey="params" childKey="name" type='string' required={false}> | ||
| name of the passkey (defaults to "Turnkey Passkey-`timestamp`"). | ||
| </NestedParam> | ||
| <NestedParam parentKey="params" childKey="organizationId" type='string' required={false}> | ||
| organization ID to specify the sub-organization (defaults to the current session's organizationId). | ||
| </NestedParam> | ||
| <NestedParam parentKey="params" childKey="stampWith" type='StamperType' required={false}> | ||
| parameter to stamp the request with a specific stamper (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). | ||
| </NestedParam> | ||
| <NestedParam parentKey="params" childKey="userId" type='string' required={false}> | ||
| user ID to add the passkey for a specific user (defaults to the current session's userId). | ||
| </NestedParam> | ||
| </Expandable> | ||
| </ParamField> | ||
|
|
||
| <H3Bordered text="Response" /> | ||
| A successful response returns the following fields: | ||
|
|
||
| <ResponseField name="returns" type="string[]" required={true} > | ||
| A promise that resolves to an array of authenticator IDs for the newly added passkey(s). | ||
| </ResponseField> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| --- | ||
| title: "clearAllSessions()" | ||
| --- | ||
|
|
||
| import { H3Bordered } from "/snippets/h3-bordered.mdx"; | ||
| import { NestedParam } from "/snippets/nested-param.mdx"; | ||
|
|
||
| <H3Bordered text="Overview" /> | ||
|
|
||
| Clears all sessions and resets the active session state. | ||
|
|
||
| <ul> | ||
| <li>This function removes all session data from the client and persistent storage, including all associated key pairs.</li> | ||
| <li>Iterates through all stored session keys, clearing each session and deleting its corresponding API key pair.</li> | ||
| <li>After clearing, there will be no active session, and all session-related data will be removed from local storage.</li> | ||
| <li>Throws an error if no sessions exist or if there is an error during the clearing process.</li> | ||
| </ul> | ||
|
|
||
| <p><strong>Package:</strong> <code>core</code></p> | ||
|
|
||
| <p><strong>Defined in:</strong> <a href="https://github.com/tkhq/sdk/blob/main/packages/core/src/__clients__/core.ts#L4080">__clients__/core.ts:4080</a></p> | ||
|
|
||
| <H3Bordered text="Parameters" /> | ||
|
|
||
| <p>No parameters.</p> | ||
|
|
||
| <H3Bordered text="Response" /> | ||
| A successful response returns the following fields: | ||
|
|
||
| <ResponseField name="returns" type="void" required={true} > | ||
| A promise that resolves when all sessions are successfully cleared. | ||
| </ResponseField> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| --- | ||
| title: "clearSession()" | ||
| --- | ||
|
|
||
| import { H3Bordered } from "/snippets/h3-bordered.mdx"; | ||
| import { NestedParam } from "/snippets/nested-param.mdx"; | ||
|
|
||
| <H3Bordered text="Overview" /> | ||
|
|
||
| Clears the session associated with the specified session key, or the active session by default. | ||
|
|
||
| <ul> | ||
| <li>This function deletes the session and its associated key pair from storage.</li> | ||
| <li>If a sessionKey is provided, it will clear the session under that key; otherwise, it will clear the default (active) session.</li> | ||
| <li>Removes the session data from local storage and deletes the corresponding API key pair from the key store.</li> | ||
| <li>Throws an error if the session does not exist or if there is an error during the clearing process.</li> | ||
| </ul> | ||
|
|
||
| <p><strong>Package:</strong> <code>core</code></p> | ||
|
|
||
| <p><strong>Defined in:</strong> <a href="https://github.com/tkhq/sdk/blob/main/packages/core/src/__clients__/core.ts#L4047">__clients__/core.ts:4047</a></p> | ||
|
|
||
| <H3Bordered text="Parameters" /> | ||
|
|
||
| <ParamField body="params" type='ClearSessionParams' required={false} > | ||
| <Expandable title="params details"> | ||
| <NestedParam parentKey="params" childKey="sessionKey" type='string' required={false}> | ||
| session key to clear the session under (defaults to the default session key). | ||
| </NestedParam> | ||
| </Expandable> | ||
| </ParamField> | ||
|
|
||
| <H3Bordered text="Response" /> | ||
| A successful response returns the following fields: | ||
|
|
||
| <ResponseField name="returns" type="void" required={true} > | ||
| A promise that resolves when the session is successfully cleared. | ||
| </ResponseField> |
32 changes: 32 additions & 0 deletions
32
generated-docs/core/turnkey-client-clear-unused-key-pairs.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| --- | ||
| title: "clearUnusedKeyPairs()" | ||
| --- | ||
|
|
||
| import { H3Bordered } from "/snippets/h3-bordered.mdx"; | ||
| import { NestedParam } from "/snippets/nested-param.mdx"; | ||
|
|
||
| <H3Bordered text="Overview" /> | ||
|
|
||
| Clears any unused API key pairs from persistent storage. | ||
|
|
||
| <ul> | ||
| <li>This function scans all API key pairs stored in indexedDB and removes any key pairs that are not associated with a session in persistent storage.</li> | ||
| <li>Ensures that only key pairs referenced by existing sessions are retained, preventing orphaned or stale key pairs from accumulating.</li> | ||
| <li>Iterates through all stored session keys and builds a map of in-use public keys, then deletes any key pairs not present in this map.</li> | ||
| <li>Intended to be called after session changes (e.g., login, logout, session replacement) to keep key storage clean and secure.</li> | ||
| </ul> | ||
|
|
||
| <p><strong>Package:</strong> <code>core</code></p> | ||
|
|
||
| <p><strong>Defined in:</strong> <a href="https://github.com/tkhq/sdk/blob/main/packages/core/src/__clients__/core.ts#L4305">__clients__/core.ts:4305</a></p> | ||
|
|
||
| <H3Bordered text="Parameters" /> | ||
|
|
||
| <p>No parameters.</p> | ||
|
|
||
| <H3Bordered text="Response" /> | ||
| A successful response returns the following fields: | ||
|
|
||
| <ResponseField name="returns" type="void" required={true} > | ||
| A promise that resolves when all unused key pairs are successfully cleared. | ||
| </ResponseField> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what are we gonna do with everything in https://github.com/tkhq/docs/tree/main/generated-docs/formatted ?
are we just nuking that namespace?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also I'm noticing it's a bit hard to see the real diff here in terms of net new endpoints covered, existing endpoints deleted, etc. but will trust the tooling on this that there are no omissions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, nuking the namespace now. I don't think that should cause any issues, will double check though