pub struct TurnkeyClient<S: Stamp> { /* private fields */ }
Expand description
Base client. To create a new client, see TurnkeyClient::<S>::builder
.
Implementations§
Source§impl<S: Stamp> TurnkeyClient<S>
impl<S: Stamp> TurnkeyClient<S>
Sourcepub async fn get_whoami(
&self,
request: GetWhoamiRequest,
) -> Result<GetWhoamiResponse, TurnkeyClientError>
pub async fn get_whoami( &self, request: GetWhoamiRequest, ) -> Result<GetWhoamiResponse, TurnkeyClientError>
Who am I?
Get basic information about your current API or WebAuthN user and their organization. Affords sub-organization look ups via parent organization for WebAuthN or API key users.
Sourcepub async fn get_sub_org_ids(
&self,
request: GetSubOrgIdsRequest,
) -> Result<GetSubOrgIdsResponse, TurnkeyClientError>
pub async fn get_sub_org_ids( &self, request: GetSubOrgIdsRequest, ) -> Result<GetSubOrgIdsResponse, TurnkeyClientError>
Get sub-organizations
Get all suborg IDs associated given a parent org ID and an optional filter.
Sourcepub async fn get_verified_sub_org_ids(
&self,
request: GetVerifiedSubOrgIdsRequest,
) -> Result<GetVerifiedSubOrgIdsResponse, TurnkeyClientError>
pub async fn get_verified_sub_org_ids( &self, request: GetVerifiedSubOrgIdsRequest, ) -> Result<GetVerifiedSubOrgIdsResponse, TurnkeyClientError>
Get verified sub-organizations
Get all email or phone verified suborg IDs associated given a parent org ID.
Sourcepub async fn get_activity(
&self,
request: GetActivityRequest,
) -> Result<ActivityResponse, TurnkeyClientError>
pub async fn get_activity( &self, request: GetActivityRequest, ) -> Result<ActivityResponse, TurnkeyClientError>
Get activity
Get details about an activity.
Sourcepub async fn get_activities(
&self,
request: GetActivitiesRequest,
) -> Result<GetActivitiesResponse, TurnkeyClientError>
pub async fn get_activities( &self, request: GetActivitiesRequest, ) -> Result<GetActivitiesResponse, TurnkeyClientError>
List activities
List all activities within an organization.
Sourcepub async fn approve_activity(
&self,
organization_id: String,
timestamp_ms: u128,
params: ApproveActivityIntent,
) -> Result<Activity, TurnkeyClientError>
pub async fn approve_activity( &self, organization_id: String, timestamp_ms: u128, params: ApproveActivityIntent, ) -> Result<Activity, TurnkeyClientError>
Approve activity
Approve an activity.
Sourcepub async fn reject_activity(
&self,
organization_id: String,
timestamp_ms: u128,
params: RejectActivityIntent,
) -> Result<Activity, TurnkeyClientError>
pub async fn reject_activity( &self, organization_id: String, timestamp_ms: u128, params: RejectActivityIntent, ) -> Result<Activity, TurnkeyClientError>
Reject activity
Reject an activity.
Sourcepub async fn get_user(
&self,
request: GetUserRequest,
) -> Result<GetUserResponse, TurnkeyClientError>
pub async fn get_user( &self, request: GetUserRequest, ) -> Result<GetUserResponse, TurnkeyClientError>
Get user
Get details about a user.
Sourcepub async fn get_users(
&self,
request: GetUsersRequest,
) -> Result<GetUsersResponse, TurnkeyClientError>
pub async fn get_users( &self, request: GetUsersRequest, ) -> Result<GetUsersResponse, TurnkeyClientError>
List users
List all users within an organization.
Sourcepub async fn delete_users(
&self,
organization_id: String,
timestamp_ms: u128,
params: DeleteUsersIntent,
) -> Result<DeleteUsersResult, TurnkeyClientError>
pub async fn delete_users( &self, organization_id: String, timestamp_ms: u128, params: DeleteUsersIntent, ) -> Result<DeleteUsersResult, TurnkeyClientError>
Delete users
Delete users within an organization.
Sourcepub async fn create_policy(
&self,
organization_id: String,
timestamp_ms: u128,
params: CreatePolicyIntentV3,
) -> Result<CreatePolicyResult, TurnkeyClientError>
pub async fn create_policy( &self, organization_id: String, timestamp_ms: u128, params: CreatePolicyIntentV3, ) -> Result<CreatePolicyResult, TurnkeyClientError>
Create policy
Create a new policy.
Sourcepub async fn create_policies(
&self,
organization_id: String,
timestamp_ms: u128,
params: CreatePoliciesIntent,
) -> Result<CreatePoliciesResult, TurnkeyClientError>
pub async fn create_policies( &self, organization_id: String, timestamp_ms: u128, params: CreatePoliciesIntent, ) -> Result<CreatePoliciesResult, TurnkeyClientError>
Create policies
Create new policies.
Sourcepub async fn update_policy(
&self,
organization_id: String,
timestamp_ms: u128,
params: UpdatePolicyIntentV2,
) -> Result<UpdatePolicyResultV2, TurnkeyClientError>
pub async fn update_policy( &self, organization_id: String, timestamp_ms: u128, params: UpdatePolicyIntentV2, ) -> Result<UpdatePolicyResultV2, TurnkeyClientError>
Update policy
Update an existing policy.
Sourcepub async fn delete_policy(
&self,
organization_id: String,
timestamp_ms: u128,
params: DeletePolicyIntent,
) -> Result<DeletePolicyResult, TurnkeyClientError>
pub async fn delete_policy( &self, organization_id: String, timestamp_ms: u128, params: DeletePolicyIntent, ) -> Result<DeletePolicyResult, TurnkeyClientError>
Delete policy
Delete an existing policy.
Sourcepub async fn get_policies(
&self,
request: GetPoliciesRequest,
) -> Result<GetPoliciesResponse, TurnkeyClientError>
pub async fn get_policies( &self, request: GetPoliciesRequest, ) -> Result<GetPoliciesResponse, TurnkeyClientError>
List policies
List all policies within an organization.
Sourcepub async fn get_policy(
&self,
request: GetPolicyRequest,
) -> Result<GetPolicyResponse, TurnkeyClientError>
pub async fn get_policy( &self, request: GetPolicyRequest, ) -> Result<GetPolicyResponse, TurnkeyClientError>
Get policy
Get details about a policy.
Sourcepub async fn create_read_only_session(
&self,
organization_id: String,
timestamp_ms: u128,
params: CreateReadOnlySessionIntent,
) -> Result<CreateReadOnlySessionResult, TurnkeyClientError>
pub async fn create_read_only_session( &self, organization_id: String, timestamp_ms: u128, params: CreateReadOnlySessionIntent, ) -> Result<CreateReadOnlySessionResult, TurnkeyClientError>
Create read only session
Create a read only session for a user (valid for 1 hour).
Sourcepub async fn create_read_write_session(
&self,
organization_id: String,
timestamp_ms: u128,
params: CreateReadWriteSessionIntentV2,
) -> Result<CreateReadWriteSessionResultV2, TurnkeyClientError>
pub async fn create_read_write_session( &self, organization_id: String, timestamp_ms: u128, params: CreateReadWriteSessionIntentV2, ) -> Result<CreateReadWriteSessionResultV2, TurnkeyClientError>
Create read write session
Create a read write session for a user.
Sourcepub async fn oauth_login(
&self,
organization_id: String,
timestamp_ms: u128,
params: OauthLoginIntent,
) -> Result<OauthLoginResult, TurnkeyClientError>
pub async fn oauth_login( &self, organization_id: String, timestamp_ms: u128, params: OauthLoginIntent, ) -> Result<OauthLoginResult, TurnkeyClientError>
Login with Oauth
Create an Oauth session for a user.
Sourcepub async fn stamp_login(
&self,
organization_id: String,
timestamp_ms: u128,
params: StampLoginIntent,
) -> Result<StampLoginResult, TurnkeyClientError>
pub async fn stamp_login( &self, organization_id: String, timestamp_ms: u128, params: StampLoginIntent, ) -> Result<StampLoginResult, TurnkeyClientError>
Login with a stamp
Create a session for a user through stamping client side (API key, wallet client, or passkey client).
Sourcepub async fn otp_login(
&self,
organization_id: String,
timestamp_ms: u128,
params: OtpLoginIntent,
) -> Result<OtpLoginResult, TurnkeyClientError>
pub async fn otp_login( &self, organization_id: String, timestamp_ms: u128, params: OtpLoginIntent, ) -> Result<OtpLoginResult, TurnkeyClientError>
Login with OTP
Create an OTP session for a user.
Sourcepub async fn create_private_keys(
&self,
organization_id: String,
timestamp_ms: u128,
params: CreatePrivateKeysIntentV2,
) -> Result<CreatePrivateKeysResultV2, TurnkeyClientError>
pub async fn create_private_keys( &self, organization_id: String, timestamp_ms: u128, params: CreatePrivateKeysIntentV2, ) -> Result<CreatePrivateKeysResultV2, TurnkeyClientError>
Create private keys
Create new private keys.
Sourcepub async fn get_private_key(
&self,
request: GetPrivateKeyRequest,
) -> Result<GetPrivateKeyResponse, TurnkeyClientError>
pub async fn get_private_key( &self, request: GetPrivateKeyRequest, ) -> Result<GetPrivateKeyResponse, TurnkeyClientError>
Get private key
Get details about a private key.
Sourcepub async fn get_private_keys(
&self,
request: GetPrivateKeysRequest,
) -> Result<GetPrivateKeysResponse, TurnkeyClientError>
pub async fn get_private_keys( &self, request: GetPrivateKeysRequest, ) -> Result<GetPrivateKeysResponse, TurnkeyClientError>
List private keys
List all private keys within an organization.
Sourcepub async fn create_api_keys(
&self,
organization_id: String,
timestamp_ms: u128,
params: CreateApiKeysIntentV2,
) -> Result<CreateApiKeysResult, TurnkeyClientError>
pub async fn create_api_keys( &self, organization_id: String, timestamp_ms: u128, params: CreateApiKeysIntentV2, ) -> Result<CreateApiKeysResult, TurnkeyClientError>
Create API keys
Add API keys to an existing user.
Sourcepub async fn delete_api_keys(
&self,
organization_id: String,
timestamp_ms: u128,
params: DeleteApiKeysIntent,
) -> Result<DeleteApiKeysResult, TurnkeyClientError>
pub async fn delete_api_keys( &self, organization_id: String, timestamp_ms: u128, params: DeleteApiKeysIntent, ) -> Result<DeleteApiKeysResult, TurnkeyClientError>
Delete API keys
Remove api keys from a user.
Sourcepub async fn get_oauth_providers(
&self,
request: GetOauthProvidersRequest,
) -> Result<GetOauthProvidersResponse, TurnkeyClientError>
pub async fn get_oauth_providers( &self, request: GetOauthProvidersRequest, ) -> Result<GetOauthProvidersResponse, TurnkeyClientError>
Get Oauth providers
Get details about Oauth providers for a user.
Sourcepub async fn get_api_keys(
&self,
request: GetApiKeysRequest,
) -> Result<GetApiKeysResponse, TurnkeyClientError>
pub async fn get_api_keys( &self, request: GetApiKeysRequest, ) -> Result<GetApiKeysResponse, TurnkeyClientError>
Get API keys
Get details about API keys for a user.
Sourcepub async fn get_api_key(
&self,
request: GetApiKeyRequest,
) -> Result<GetApiKeyResponse, TurnkeyClientError>
pub async fn get_api_key( &self, request: GetApiKeyRequest, ) -> Result<GetApiKeyResponse, TurnkeyClientError>
Get API key
Get details about an API key.
Sourcepub async fn create_authenticators(
&self,
organization_id: String,
timestamp_ms: u128,
params: CreateAuthenticatorsIntentV2,
) -> Result<CreateAuthenticatorsResult, TurnkeyClientError>
pub async fn create_authenticators( &self, organization_id: String, timestamp_ms: u128, params: CreateAuthenticatorsIntentV2, ) -> Result<CreateAuthenticatorsResult, TurnkeyClientError>
Create authenticators
Create authenticators to authenticate requests to Turnkey.
Sourcepub async fn delete_authenticators(
&self,
organization_id: String,
timestamp_ms: u128,
params: DeleteAuthenticatorsIntent,
) -> Result<DeleteAuthenticatorsResult, TurnkeyClientError>
pub async fn delete_authenticators( &self, organization_id: String, timestamp_ms: u128, params: DeleteAuthenticatorsIntent, ) -> Result<DeleteAuthenticatorsResult, TurnkeyClientError>
Delete authenticators
Remove authenticators from a user.
Sourcepub async fn get_authenticators(
&self,
request: GetAuthenticatorsRequest,
) -> Result<GetAuthenticatorsResponse, TurnkeyClientError>
pub async fn get_authenticators( &self, request: GetAuthenticatorsRequest, ) -> Result<GetAuthenticatorsResponse, TurnkeyClientError>
Get authenticators
Get details about authenticators for a user.
Sourcepub async fn get_authenticator(
&self,
request: GetAuthenticatorRequest,
) -> Result<GetAuthenticatorResponse, TurnkeyClientError>
pub async fn get_authenticator( &self, request: GetAuthenticatorRequest, ) -> Result<GetAuthenticatorResponse, TurnkeyClientError>
Get authenticator
Get details about an authenticator.
Sourcepub async fn create_invitations(
&self,
organization_id: String,
timestamp_ms: u128,
params: CreateInvitationsIntent,
) -> Result<CreateInvitationsResult, TurnkeyClientError>
pub async fn create_invitations( &self, organization_id: String, timestamp_ms: u128, params: CreateInvitationsIntent, ) -> Result<CreateInvitationsResult, TurnkeyClientError>
Create invitations
Create invitations to join an existing organization.
Sourcepub async fn delete_invitation(
&self,
organization_id: String,
timestamp_ms: u128,
params: DeleteInvitationIntent,
) -> Result<DeleteInvitationResult, TurnkeyClientError>
pub async fn delete_invitation( &self, organization_id: String, timestamp_ms: u128, params: DeleteInvitationIntent, ) -> Result<DeleteInvitationResult, TurnkeyClientError>
Delete invitation
Delete an existing invitation.
Sourcepub async fn create_users(
&self,
organization_id: String,
timestamp_ms: u128,
params: CreateUsersIntentV3,
) -> Result<CreateUsersResult, TurnkeyClientError>
pub async fn create_users( &self, organization_id: String, timestamp_ms: u128, params: CreateUsersIntentV3, ) -> Result<CreateUsersResult, TurnkeyClientError>
Create users
Create users in an existing organization.
Sourcepub async fn update_user(
&self,
organization_id: String,
timestamp_ms: u128,
params: UpdateUserIntent,
) -> Result<UpdateUserResult, TurnkeyClientError>
pub async fn update_user( &self, organization_id: String, timestamp_ms: u128, params: UpdateUserIntent, ) -> Result<UpdateUserResult, TurnkeyClientError>
Update user
Update a user in an existing organization.
Sourcepub async fn update_user_name(
&self,
organization_id: String,
timestamp_ms: u128,
params: UpdateUserNameIntent,
) -> Result<UpdateUserNameResult, TurnkeyClientError>
pub async fn update_user_name( &self, organization_id: String, timestamp_ms: u128, params: UpdateUserNameIntent, ) -> Result<UpdateUserNameResult, TurnkeyClientError>
Update user’s name
Update a user’s name in an existing organization.
Sourcepub async fn update_user_email(
&self,
organization_id: String,
timestamp_ms: u128,
params: UpdateUserEmailIntent,
) -> Result<UpdateUserEmailResult, TurnkeyClientError>
pub async fn update_user_email( &self, organization_id: String, timestamp_ms: u128, params: UpdateUserEmailIntent, ) -> Result<UpdateUserEmailResult, TurnkeyClientError>
Update user’s email
Update a user’s email in an existing organization.
Sourcepub async fn update_user_phone_number(
&self,
organization_id: String,
timestamp_ms: u128,
params: UpdateUserPhoneNumberIntent,
) -> Result<UpdateUserPhoneNumberResult, TurnkeyClientError>
pub async fn update_user_phone_number( &self, organization_id: String, timestamp_ms: u128, params: UpdateUserPhoneNumberIntent, ) -> Result<UpdateUserPhoneNumberResult, TurnkeyClientError>
Update user’s phone number
Update a user’s phone number in an existing organization.
Sourcepub async fn create_user_tag(
&self,
organization_id: String,
timestamp_ms: u128,
params: CreateUserTagIntent,
) -> Result<CreateUserTagResult, TurnkeyClientError>
pub async fn create_user_tag( &self, organization_id: String, timestamp_ms: u128, params: CreateUserTagIntent, ) -> Result<CreateUserTagResult, TurnkeyClientError>
Create user tag
Create a user tag and add it to users.
Sourcepub async fn create_private_key_tag(
&self,
organization_id: String,
timestamp_ms: u128,
params: CreatePrivateKeyTagIntent,
) -> Result<CreatePrivateKeyTagResult, TurnkeyClientError>
pub async fn create_private_key_tag( &self, organization_id: String, timestamp_ms: u128, params: CreatePrivateKeyTagIntent, ) -> Result<CreatePrivateKeyTagResult, TurnkeyClientError>
Create private key tag
Create a private key tag and add it to private keys.
Sourcepub async fn update_user_tag(
&self,
organization_id: String,
timestamp_ms: u128,
params: UpdateUserTagIntent,
) -> Result<UpdateUserTagResult, TurnkeyClientError>
pub async fn update_user_tag( &self, organization_id: String, timestamp_ms: u128, params: UpdateUserTagIntent, ) -> Result<UpdateUserTagResult, TurnkeyClientError>
Update user tag
Update human-readable name or associated users. Note that this activity is atomic: all of the updates will succeed at once, or all of them will fail.
List user tags
List all user tags within an organization.
Delete user tags
Delete user tags within an organization.
Sourcepub async fn update_private_key_tag(
&self,
organization_id: String,
timestamp_ms: u128,
params: UpdatePrivateKeyTagIntent,
) -> Result<UpdatePrivateKeyTagResult, TurnkeyClientError>
pub async fn update_private_key_tag( &self, organization_id: String, timestamp_ms: u128, params: UpdatePrivateKeyTagIntent, ) -> Result<UpdatePrivateKeyTagResult, TurnkeyClientError>
Update private key tag
Update human-readable name or associated private keys. Note that this activity is atomic: all of the updates will succeed at once, or all of them will fail.
List private key tags
List all private key tags within an organization.
Delete private key tags
Delete private key tags within an organization.
Sourcepub async fn sign_raw_payload(
&self,
organization_id: String,
timestamp_ms: u128,
params: SignRawPayloadIntentV2,
) -> Result<SignRawPayloadResult, TurnkeyClientError>
pub async fn sign_raw_payload( &self, organization_id: String, timestamp_ms: u128, params: SignRawPayloadIntentV2, ) -> Result<SignRawPayloadResult, TurnkeyClientError>
Sign raw payload
Sign a raw payload.
Sourcepub async fn sign_raw_payloads(
&self,
organization_id: String,
timestamp_ms: u128,
params: SignRawPayloadsIntent,
) -> Result<SignRawPayloadsResult, TurnkeyClientError>
pub async fn sign_raw_payloads( &self, organization_id: String, timestamp_ms: u128, params: SignRawPayloadsIntent, ) -> Result<SignRawPayloadsResult, TurnkeyClientError>
Sign raw payloads
Sign multiple raw payloads with the same signing parameters.
Sourcepub async fn sign_transaction(
&self,
organization_id: String,
timestamp_ms: u128,
params: SignTransactionIntentV2,
) -> Result<SignTransactionResult, TurnkeyClientError>
pub async fn sign_transaction( &self, organization_id: String, timestamp_ms: u128, params: SignTransactionIntentV2, ) -> Result<SignTransactionResult, TurnkeyClientError>
Sign transaction
Sign a transaction.
Sourcepub async fn create_smart_contract_interface(
&self,
organization_id: String,
timestamp_ms: u128,
params: CreateSmartContractInterfaceIntent,
) -> Result<CreateSmartContractInterfaceResult, TurnkeyClientError>
pub async fn create_smart_contract_interface( &self, organization_id: String, timestamp_ms: u128, params: CreateSmartContractInterfaceIntent, ) -> Result<CreateSmartContractInterfaceResult, TurnkeyClientError>
Create smart contract interface
Create an ABI/IDL in JSON.
Sourcepub async fn delete_smart_contract_interface(
&self,
organization_id: String,
timestamp_ms: u128,
params: DeleteSmartContractInterfaceIntent,
) -> Result<DeleteSmartContractInterfaceResult, TurnkeyClientError>
pub async fn delete_smart_contract_interface( &self, organization_id: String, timestamp_ms: u128, params: DeleteSmartContractInterfaceIntent, ) -> Result<DeleteSmartContractInterfaceResult, TurnkeyClientError>
Delete smart contract interface
Delete a smart contract interface.
Sourcepub async fn get_smart_contract_interfaces(
&self,
request: GetSmartContractInterfacesRequest,
) -> Result<GetSmartContractInterfacesResponse, TurnkeyClientError>
pub async fn get_smart_contract_interfaces( &self, request: GetSmartContractInterfacesRequest, ) -> Result<GetSmartContractInterfacesResponse, TurnkeyClientError>
List smart contract interfaces
List all smart contract interfaces within an organization.
Sourcepub async fn get_smart_contract_interface(
&self,
request: GetSmartContractInterfaceRequest,
) -> Result<GetSmartContractInterfaceResponse, TurnkeyClientError>
pub async fn get_smart_contract_interface( &self, request: GetSmartContractInterfaceRequest, ) -> Result<GetSmartContractInterfaceResponse, TurnkeyClientError>
Get smart contract interface
Get details about a smart contract interface.
Sourcepub async fn update_root_quorum(
&self,
organization_id: String,
timestamp_ms: u128,
params: UpdateRootQuorumIntent,
) -> Result<UpdateRootQuorumResult, TurnkeyClientError>
pub async fn update_root_quorum( &self, organization_id: String, timestamp_ms: u128, params: UpdateRootQuorumIntent, ) -> Result<UpdateRootQuorumResult, TurnkeyClientError>
Update root quorum
Set the threshold and members of the root quorum. This activity must be approved by the current root quorum.
Sourcepub async fn create_wallet(
&self,
organization_id: String,
timestamp_ms: u128,
params: CreateWalletIntent,
) -> Result<CreateWalletResult, TurnkeyClientError>
pub async fn create_wallet( &self, organization_id: String, timestamp_ms: u128, params: CreateWalletIntent, ) -> Result<CreateWalletResult, TurnkeyClientError>
Create wallet
Create a wallet and derive addresses.
Sourcepub async fn get_wallets(
&self,
request: GetWalletsRequest,
) -> Result<GetWalletsResponse, TurnkeyClientError>
pub async fn get_wallets( &self, request: GetWalletsRequest, ) -> Result<GetWalletsResponse, TurnkeyClientError>
List wallets
List all wallets within an organization.
Sourcepub async fn get_wallet(
&self,
request: GetWalletRequest,
) -> Result<GetWalletResponse, TurnkeyClientError>
pub async fn get_wallet( &self, request: GetWalletRequest, ) -> Result<GetWalletResponse, TurnkeyClientError>
Get wallet
Get details about a wallet.
Sourcepub async fn create_wallet_accounts(
&self,
organization_id: String,
timestamp_ms: u128,
params: CreateWalletAccountsIntent,
) -> Result<CreateWalletAccountsResult, TurnkeyClientError>
pub async fn create_wallet_accounts( &self, organization_id: String, timestamp_ms: u128, params: CreateWalletAccountsIntent, ) -> Result<CreateWalletAccountsResult, TurnkeyClientError>
Create wallet accounts
Derive additional addresses using an existing wallet.
Sourcepub async fn get_wallet_accounts(
&self,
request: GetWalletAccountsRequest,
) -> Result<GetWalletAccountsResponse, TurnkeyClientError>
pub async fn get_wallet_accounts( &self, request: GetWalletAccountsRequest, ) -> Result<GetWalletAccountsResponse, TurnkeyClientError>
List wallets accounts
List all accounts within a wallet.
Sourcepub async fn get_wallet_account(
&self,
request: GetWalletAccountRequest,
) -> Result<GetWalletAccountResponse, TurnkeyClientError>
pub async fn get_wallet_account( &self, request: GetWalletAccountRequest, ) -> Result<GetWalletAccountResponse, TurnkeyClientError>
Get wallet account
Get a single wallet account.
Sourcepub async fn create_sub_organization(
&self,
organization_id: String,
timestamp_ms: u128,
params: CreateSubOrganizationIntentV7,
) -> Result<CreateSubOrganizationResultV7, TurnkeyClientError>
pub async fn create_sub_organization( &self, organization_id: String, timestamp_ms: u128, params: CreateSubOrganizationIntentV7, ) -> Result<CreateSubOrganizationResultV7, TurnkeyClientError>
Create sub-organization
Create a new sub-organization.
Sourcepub async fn init_user_email_recovery(
&self,
organization_id: String,
timestamp_ms: u128,
params: InitUserEmailRecoveryIntent,
) -> Result<InitUserEmailRecoveryResult, TurnkeyClientError>
pub async fn init_user_email_recovery( &self, organization_id: String, timestamp_ms: u128, params: InitUserEmailRecoveryIntent, ) -> Result<InitUserEmailRecoveryResult, TurnkeyClientError>
Init email recovery
Initialize a new email recovery.
Sourcepub async fn recover_user(
&self,
organization_id: String,
timestamp_ms: u128,
params: RecoverUserIntent,
) -> Result<RecoverUserResult, TurnkeyClientError>
pub async fn recover_user( &self, organization_id: String, timestamp_ms: u128, params: RecoverUserIntent, ) -> Result<RecoverUserResult, TurnkeyClientError>
Recover a user
Complete the process of recovering a user by adding an authenticator.
Sourcepub async fn set_organization_feature(
&self,
organization_id: String,
timestamp_ms: u128,
params: SetOrganizationFeatureIntent,
) -> Result<SetOrganizationFeatureResult, TurnkeyClientError>
pub async fn set_organization_feature( &self, organization_id: String, timestamp_ms: u128, params: SetOrganizationFeatureIntent, ) -> Result<SetOrganizationFeatureResult, TurnkeyClientError>
Set organization feature
Set an organization feature. This activity must be approved by the current root quorum.
Sourcepub async fn remove_organization_feature(
&self,
organization_id: String,
timestamp_ms: u128,
params: RemoveOrganizationFeatureIntent,
) -> Result<RemoveOrganizationFeatureResult, TurnkeyClientError>
pub async fn remove_organization_feature( &self, organization_id: String, timestamp_ms: u128, params: RemoveOrganizationFeatureIntent, ) -> Result<RemoveOrganizationFeatureResult, TurnkeyClientError>
Remove organization feature
Remove an organization feature. This activity must be approved by the current root quorum.
Sourcepub async fn export_private_key(
&self,
organization_id: String,
timestamp_ms: u128,
params: ExportPrivateKeyIntent,
) -> Result<ExportPrivateKeyResult, TurnkeyClientError>
pub async fn export_private_key( &self, organization_id: String, timestamp_ms: u128, params: ExportPrivateKeyIntent, ) -> Result<ExportPrivateKeyResult, TurnkeyClientError>
Export private key
Export a private key.
Sourcepub async fn export_wallet(
&self,
organization_id: String,
timestamp_ms: u128,
params: ExportWalletIntent,
) -> Result<ExportWalletResult, TurnkeyClientError>
pub async fn export_wallet( &self, organization_id: String, timestamp_ms: u128, params: ExportWalletIntent, ) -> Result<ExportWalletResult, TurnkeyClientError>
Export wallet
Export a wallet.
Sourcepub async fn email_auth(
&self,
organization_id: String,
timestamp_ms: u128,
params: EmailAuthIntentV2,
) -> Result<EmailAuthResult, TurnkeyClientError>
pub async fn email_auth( &self, organization_id: String, timestamp_ms: u128, params: EmailAuthIntentV2, ) -> Result<EmailAuthResult, TurnkeyClientError>
Perform email auth
Authenticate a user via email.
Sourcepub async fn export_wallet_account(
&self,
organization_id: String,
timestamp_ms: u128,
params: ExportWalletAccountIntent,
) -> Result<ExportWalletAccountResult, TurnkeyClientError>
pub async fn export_wallet_account( &self, organization_id: String, timestamp_ms: u128, params: ExportWalletAccountIntent, ) -> Result<ExportWalletAccountResult, TurnkeyClientError>
Export wallet account
Export a wallet account.
Sourcepub async fn init_fiat_on_ramp(
&self,
organization_id: String,
timestamp_ms: u128,
params: InitFiatOnRampIntent,
) -> Result<InitFiatOnRampResult, TurnkeyClientError>
pub async fn init_fiat_on_ramp( &self, organization_id: String, timestamp_ms: u128, params: InitFiatOnRampIntent, ) -> Result<InitFiatOnRampResult, TurnkeyClientError>
Init fiat on ramp
Initiate a fiat on ramp flow.
Sourcepub async fn init_import_wallet(
&self,
organization_id: String,
timestamp_ms: u128,
params: InitImportWalletIntent,
) -> Result<InitImportWalletResult, TurnkeyClientError>
pub async fn init_import_wallet( &self, organization_id: String, timestamp_ms: u128, params: InitImportWalletIntent, ) -> Result<InitImportWalletResult, TurnkeyClientError>
Init import wallet
Initialize a new wallet import.
Sourcepub async fn import_wallet(
&self,
organization_id: String,
timestamp_ms: u128,
params: ImportWalletIntent,
) -> Result<ImportWalletResult, TurnkeyClientError>
pub async fn import_wallet( &self, organization_id: String, timestamp_ms: u128, params: ImportWalletIntent, ) -> Result<ImportWalletResult, TurnkeyClientError>
Import wallet
Import a wallet.
Sourcepub async fn init_import_private_key(
&self,
organization_id: String,
timestamp_ms: u128,
params: InitImportPrivateKeyIntent,
) -> Result<InitImportPrivateKeyResult, TurnkeyClientError>
pub async fn init_import_private_key( &self, organization_id: String, timestamp_ms: u128, params: InitImportPrivateKeyIntent, ) -> Result<InitImportPrivateKeyResult, TurnkeyClientError>
Init import private key
Initialize a new private key import.
Sourcepub async fn import_private_key(
&self,
organization_id: String,
timestamp_ms: u128,
params: ImportPrivateKeyIntent,
) -> Result<ImportPrivateKeyResult, TurnkeyClientError>
pub async fn import_private_key( &self, organization_id: String, timestamp_ms: u128, params: ImportPrivateKeyIntent, ) -> Result<ImportPrivateKeyResult, TurnkeyClientError>
Import private key
Import a private key.
Sourcepub async fn oauth(
&self,
organization_id: String,
timestamp_ms: u128,
params: OauthIntent,
) -> Result<OauthResult, TurnkeyClientError>
pub async fn oauth( &self, organization_id: String, timestamp_ms: u128, params: OauthIntent, ) -> Result<OauthResult, TurnkeyClientError>
Oauth
Authenticate a user with an OIDC token (Oauth).
Sourcepub async fn init_otp(
&self,
organization_id: String,
timestamp_ms: u128,
params: InitOtpIntent,
) -> Result<InitOtpResult, TurnkeyClientError>
pub async fn init_otp( &self, organization_id: String, timestamp_ms: u128, params: InitOtpIntent, ) -> Result<InitOtpResult, TurnkeyClientError>
Init generic OTP
Initiate a generic OTP activity.
Sourcepub async fn verify_otp(
&self,
organization_id: String,
timestamp_ms: u128,
params: VerifyOtpIntent,
) -> Result<VerifyOtpResult, TurnkeyClientError>
pub async fn verify_otp( &self, organization_id: String, timestamp_ms: u128, params: VerifyOtpIntent, ) -> Result<VerifyOtpResult, TurnkeyClientError>
Verify generic OTP
Verify a generic OTP.
Sourcepub async fn init_otp_auth(
&self,
organization_id: String,
timestamp_ms: u128,
params: InitOtpAuthIntentV2,
) -> Result<InitOtpAuthResultV2, TurnkeyClientError>
pub async fn init_otp_auth( &self, organization_id: String, timestamp_ms: u128, params: InitOtpAuthIntentV2, ) -> Result<InitOtpAuthResultV2, TurnkeyClientError>
Init OTP auth
Initiate an OTP auth activity.
Sourcepub async fn otp_auth(
&self,
organization_id: String,
timestamp_ms: u128,
params: OtpAuthIntent,
) -> Result<OtpAuthResult, TurnkeyClientError>
pub async fn otp_auth( &self, organization_id: String, timestamp_ms: u128, params: OtpAuthIntent, ) -> Result<OtpAuthResult, TurnkeyClientError>
OTP auth
Authenticate a user with an OTP code sent via email or SMS.
Sourcepub async fn create_oauth_providers(
&self,
organization_id: String,
timestamp_ms: u128,
params: CreateOauthProvidersIntent,
) -> Result<CreateOauthProvidersResult, TurnkeyClientError>
pub async fn create_oauth_providers( &self, organization_id: String, timestamp_ms: u128, params: CreateOauthProvidersIntent, ) -> Result<CreateOauthProvidersResult, TurnkeyClientError>
Create Oauth providers
Create Oauth providers for a specified user.
Sourcepub async fn delete_oauth_providers(
&self,
organization_id: String,
timestamp_ms: u128,
params: DeleteOauthProvidersIntent,
) -> Result<DeleteOauthProvidersResult, TurnkeyClientError>
pub async fn delete_oauth_providers( &self, organization_id: String, timestamp_ms: u128, params: DeleteOauthProvidersIntent, ) -> Result<DeleteOauthProvidersResult, TurnkeyClientError>
Delete Oauth providers
Remove Oauth providers for a specified user.
Sourcepub async fn get_organization_configs(
&self,
request: GetOrganizationConfigsRequest,
) -> Result<GetOrganizationConfigsResponse, TurnkeyClientError>
pub async fn get_organization_configs( &self, request: GetOrganizationConfigsRequest, ) -> Result<GetOrganizationConfigsResponse, TurnkeyClientError>
Get configs
Get quorum settings and features for an organization.
Sourcepub async fn delete_private_keys(
&self,
organization_id: String,
timestamp_ms: u128,
params: DeletePrivateKeysIntent,
) -> Result<DeletePrivateKeysResult, TurnkeyClientError>
pub async fn delete_private_keys( &self, organization_id: String, timestamp_ms: u128, params: DeletePrivateKeysIntent, ) -> Result<DeletePrivateKeysResult, TurnkeyClientError>
Delete private keys
Delete private keys for an organization.
Sourcepub async fn update_wallet(
&self,
organization_id: String,
timestamp_ms: u128,
params: UpdateWalletIntent,
) -> Result<UpdateWalletResult, TurnkeyClientError>
pub async fn update_wallet( &self, organization_id: String, timestamp_ms: u128, params: UpdateWalletIntent, ) -> Result<UpdateWalletResult, TurnkeyClientError>
Update wallet
Update a wallet for an organization.
Sourcepub async fn delete_wallets(
&self,
organization_id: String,
timestamp_ms: u128,
params: DeleteWalletsIntent,
) -> Result<DeleteWalletsResult, TurnkeyClientError>
pub async fn delete_wallets( &self, organization_id: String, timestamp_ms: u128, params: DeleteWalletsIntent, ) -> Result<DeleteWalletsResult, TurnkeyClientError>
Delete wallets
Delete wallets for an organization.
Sourcepub async fn delete_sub_organization(
&self,
organization_id: String,
timestamp_ms: u128,
params: DeleteSubOrganizationIntent,
) -> Result<DeleteSubOrganizationResult, TurnkeyClientError>
pub async fn delete_sub_organization( &self, organization_id: String, timestamp_ms: u128, params: DeleteSubOrganizationIntent, ) -> Result<DeleteSubOrganizationResult, TurnkeyClientError>
Delete sub-organization
Delete a sub-organization.
Sourcepub async fn get_policy_evaluations(
&self,
request: GetPolicyEvaluationsRequest,
) -> Result<GetPolicyEvaluationsResponse, TurnkeyClientError>
pub async fn get_policy_evaluations( &self, request: GetPolicyEvaluationsRequest, ) -> Result<GetPolicyEvaluationsResponse, TurnkeyClientError>
Get policy evaluations
Get the policy evaluations for an activity.
Sourcepub async fn create_oauth2_credential(
&self,
organization_id: String,
timestamp_ms: u128,
params: CreateOauth2CredentialIntent,
) -> Result<CreateOauth2CredentialResult, TurnkeyClientError>
pub async fn create_oauth2_credential( &self, organization_id: String, timestamp_ms: u128, params: CreateOauth2CredentialIntent, ) -> Result<CreateOauth2CredentialResult, TurnkeyClientError>
Create an OAuth 2.0 Credential
Enable authentication for end users with an OAuth 2.0 provider
Sourcepub async fn update_oauth2_credential(
&self,
organization_id: String,
timestamp_ms: u128,
params: UpdateOauth2CredentialIntent,
) -> Result<UpdateOauth2CredentialResult, TurnkeyClientError>
pub async fn update_oauth2_credential( &self, organization_id: String, timestamp_ms: u128, params: UpdateOauth2CredentialIntent, ) -> Result<UpdateOauth2CredentialResult, TurnkeyClientError>
Update an OAuth 2.0 Credential
Update an OAuth 2.0 provider credential
Sourcepub async fn delete_oauth2_credential(
&self,
organization_id: String,
timestamp_ms: u128,
params: DeleteOauth2CredentialIntent,
) -> Result<DeleteOauth2CredentialResult, TurnkeyClientError>
pub async fn delete_oauth2_credential( &self, organization_id: String, timestamp_ms: u128, params: DeleteOauth2CredentialIntent, ) -> Result<DeleteOauth2CredentialResult, TurnkeyClientError>
Delete an OAuth 2.0 Credential
Disable authentication for end users with an OAuth 2.0 provider
Sourcepub async fn list_oauth2_credentials(
&self,
request: ListOauth2CredentialsRequest,
) -> Result<ListOauth2CredentialsResponse, TurnkeyClientError>
pub async fn list_oauth2_credentials( &self, request: ListOauth2CredentialsRequest, ) -> Result<ListOauth2CredentialsResponse, TurnkeyClientError>
List OAuth 2.0 Credentials
List all OAuth 2.0 credentials within an organization.
Sourcepub async fn get_oauth2_credential(
&self,
request: GetOauth2CredentialRequest,
) -> Result<GetOauth2CredentialResponse, TurnkeyClientError>
pub async fn get_oauth2_credential( &self, request: GetOauth2CredentialRequest, ) -> Result<GetOauth2CredentialResponse, TurnkeyClientError>
Get OAuth 2.0 credential
Get details about an OAuth 2.0 credential.
Sourcepub async fn oauth2_authenticate(
&self,
organization_id: String,
timestamp_ms: u128,
params: Oauth2AuthenticateIntent,
) -> Result<Oauth2AuthenticateResult, TurnkeyClientError>
pub async fn oauth2_authenticate( &self, organization_id: String, timestamp_ms: u128, params: Oauth2AuthenticateIntent, ) -> Result<Oauth2AuthenticateResult, TurnkeyClientError>
OAuth 2.0 authentication
Authenticate a user with an OAuth 2.0 provider and receive an OIDC token to use with the LoginWithOAuth or CreateSubOrganization activities
Source§impl<S: Stamp> TurnkeyClient<S>
impl<S: Stamp> TurnkeyClient<S>
Sourcepub fn builder() -> TurnkeyClientBuilder<S>
pub fn builder() -> TurnkeyClientBuilder<S>
Creates a new TurnkeyClientBuilder<S>
. Configure with .api_key(...)
and other options, then call .build()
.
The type parameter S
must implement the Stamp
trait.
Sourcepub async fn process_activity<Request: Serialize>(
&self,
request: Request,
path: String,
) -> Result<Activity, TurnkeyClientError>
pub async fn process_activity<Request: Serialize>( &self, request: Request, path: String, ) -> Result<Activity, TurnkeyClientError>
POSTs an activity and polls until the status is “COMPLETE”
process_activity
accepts a arbitrary Request
and path
to POST to the Turnkey API.
It encapsulates the polling logic and is generally meant to be called by other
activity-specific client functions (e.g. create_sub_organization
).
Given the Turnkey API is backwards-compatible, this function can be used to submit old versions of activities.
For example, if the latest version for create_sub_organization is “ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V7”,
you may want to use process_activity
to process ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V6
. Note that this
requires manually setting the correct URL and activity request type.
The response is an generic Activity. If you’re invoking this function manually you’ll have to manually look at
the correct .activity.result
enum.
This function is used by our generated client methods and sets the right request type, URL, and deserializes into the proper result type as well.
Unless you have good reasons, prefer the type-safe client methods such as sign_raw_payload
.
§Returns
This function returns an Activity
object which contains the deserialized version of the response.
§Errors
If the server errors with a validation error, a server error, a deserialization error, the proper variant of TurnkeyClientError
is returned.
If the activity is pending and exceeds the maximum amount of retries allowed, TurnkeyClientError::ExceededRetries
is returned.
If the activity requires consensus, TurnkeyClientError::ActivityRequiresApproval
is returned.
Sourcepub fn current_timestamp(&self) -> u128
pub fn current_timestamp(&self) -> u128
Returns the current timestamp as a u128.
Sourcepub async fn process_request<Request, Response>(
&self,
request: &Request,
path: String,
) -> Result<Response, TurnkeyClientError>where
Request: Serialize,
Response: DeserializeOwned,
pub async fn process_request<Request, Response>(
&self,
request: &Request,
path: String,
) -> Result<Response, TurnkeyClientError>where
Request: Serialize,
Response: DeserializeOwned,
Processes a Request
(at path
) by:
- Serializing the request to JSON
- Signing the request with the client’s API key
- POSTing the POST body and the associated stamp to the Turnkey API
This function is generic and can handle POSTing queries or activities.