diff --git a/docs.json b/docs.json index 6103dcf0..49776ce3 100644 --- a/docs.json +++ b/docs.json @@ -199,6 +199,2080 @@ { "group": "SDK Reference", "pages": [ + { + "group": "sdks", + "pages": [ + { + "group": "api-key-stamper", + "pages": [ + { + "group": "ApiKeyStamper", + "pages": ["sdks/api-key-stamper/ApiKeyStamper/readme"] + }, + { + "group": "index", + "pages": [ + { + "group": "ApiKeyStamper", + "pages": [ + "sdks/api-key-stamper/index/ApiKeyStamper/readme" + ] + }, + { + "group": "TApiKeyStamperConfig", + "pages": [ + "sdks/api-key-stamper/index/TApiKeyStamperConfig/readme" + ] + }, + { + "group": "pointDecode", + "pages": [ + "sdks/api-key-stamper/index/pointDecode/readme" + ] + }, + "sdks/api-key-stamper/index/readme", + { + "group": "signWithApiKey", + "pages": [ + "sdks/api-key-stamper/index/signWithApiKey/readme" + ] + } + ] + }, + "sdks/api-key-stamper/readme" + ] + }, + { + "group": "cosmjs", + "pages": [ + { + "group": "documents", + "pages": [ + { + "group": "docs", + "pages": ["sdks/cosmjs/documents/docs/readme"] + } + ] + }, + { + "group": "index", + "pages": [ + { + "group": "TurnkeyActivityError", + "pages": [ + "sdks/cosmjs/index/TurnkeyActivityError/readme" + ] + }, + { + "group": "TurnkeyDirectWallet", + "pages": [ + "sdks/cosmjs/index/TurnkeyDirectWallet/readme" + ] + }, + { + "group": "TurnkeyRequestError", + "pages": [ + "sdks/cosmjs/index/TurnkeyRequestError/readme" + ] + }, + { + "group": "fetchCompressedPublicKey", + "pages": [ + "sdks/cosmjs/index/fetchCompressedPublicKey/readme" + ] + }, + "sdks/cosmjs/index/readme" + ] + }, + "sdks/cosmjs/readme" + ] + }, + { + "group": "crypto", + "pages": [ + { + "group": "index", + "pages": [ + { + "group": "buildAdditionalAssociatedData", + "pages": [ + "sdks/crypto/index/buildAdditionalAssociatedData/readme" + ] + }, + { + "group": "compressRawPublicKey", + "pages": [ + "sdks/crypto/index/compressRawPublicKey/readme" + ] + }, + { + "group": "decryptCredentialBundle", + "pages": [ + "sdks/crypto/index/decryptCredentialBundle/readme" + ] + }, + { + "group": "decryptExportBundle", + "pages": [ + "sdks/crypto/index/decryptExportBundle/readme" + ] + }, + { + "group": "encryptPrivateKeyToBundle", + "pages": [ + "sdks/crypto/index/encryptPrivateKeyToBundle/readme" + ] + }, + { + "group": "encryptWalletToBundle", + "pages": [ + "sdks/crypto/index/encryptWalletToBundle/readme" + ] + }, + { + "group": "extractPrivateKeyFromPKCS8Bytes", + "pages": [ + "sdks/crypto/index/extractPrivateKeyFromPKCS8Bytes/readme" + ] + }, + { + "group": "formatHpkeBuf", + "pages": ["sdks/crypto/index/formatHpkeBuf/readme"] + }, + { + "group": "fromDerSignature", + "pages": [ + "sdks/crypto/index/fromDerSignature/readme" + ] + }, + { + "group": "generateP256KeyPair", + "pages": [ + "sdks/crypto/index/generateP256KeyPair/readme" + ] + }, + { + "group": "getPublicKey", + "pages": ["sdks/crypto/index/getPublicKey/readme"] + }, + { + "group": "hpkeAuthEncrypt", + "pages": [ + "sdks/crypto/index/hpkeAuthEncrypt/readme" + ] + }, + { + "group": "hpkeDecrypt", + "pages": ["sdks/crypto/index/hpkeDecrypt/readme"] + }, + { + "group": "hpkeEncrypt", + "pages": ["sdks/crypto/index/hpkeEncrypt/readme"] + }, + "sdks/crypto/index/readme", + { + "group": "toDerSignature", + "pages": ["sdks/crypto/index/toDerSignature/readme"] + }, + { + "group": "uncompressRawPublicKey", + "pages": [ + "sdks/crypto/index/uncompressRawPublicKey/readme" + ] + }, + { + "group": "verifyStampSignature", + "pages": [ + "sdks/crypto/index/verifyStampSignature/readme" + ] + } + ] + }, + "sdks/crypto/readme" + ] + }, + { + "group": "eip-1193-provider", + "pages": [ + { + "group": "documents", + "pages": [ + { + "group": "docs", + "pages": [ + "sdks/eip-1193-provider/documents/docs/readme" + ] + } + ] + }, + { + "group": "index", + "pages": [ + { + "group": "TurnkeyEIP1193Provider", + "pages": [ + "sdks/eip-1193-provider/index/TurnkeyEIP1193Provider/readme" + ] + }, + { + "group": "createEIP1193Provider", + "pages": [ + "sdks/eip-1193-provider/index/createEIP1193Provider/readme" + ] + }, + "sdks/eip-1193-provider/index/readme" + ] + }, + "sdks/eip-1193-provider/readme" + ] + }, + { + "group": "encoding", + "pages": [ + { + "group": "index", + "pages": [ + { + "group": "DEFAULT_JWK_MEMBER_BYTE_LENGTH", + "pages": [ + "sdks/encoding/index/DEFAULT_JWK_MEMBER_BYTE_LENGTH/readme" + ] + }, + { + "group": "base64StringToBase64UrlEncodedString", + "pages": [ + "sdks/encoding/index/base64StringToBase64UrlEncodedString/readme" + ] + }, + { + "group": "hexStringToBase64url", + "pages": [ + "sdks/encoding/index/hexStringToBase64url/readme" + ] + }, + { + "group": "hexToAscii", + "pages": ["sdks/encoding/index/hexToAscii/readme"] + }, + { + "group": "normalizePadding", + "pages": [ + "sdks/encoding/index/normalizePadding/readme" + ] + }, + "sdks/encoding/index/readme", + { + "group": "stringToBase64urlString", + "pages": [ + "sdks/encoding/index/stringToBase64urlString/readme" + ] + }, + { + "group": "uint8ArrayFromHexString", + "pages": [ + "sdks/encoding/index/uint8ArrayFromHexString/readme" + ] + }, + { + "group": "uint8ArrayToHexString", + "pages": [ + "sdks/encoding/index/uint8ArrayToHexString/readme" + ] + } + ] + }, + "sdks/encoding/readme" + ] + }, + { + "group": "ethers", + "pages": [ + { + "group": "documents", + "pages": [ + { + "group": "docs", + "pages": ["sdks/ethers/documents/docs/readme"] + } + ] + }, + { + "group": "index", + "pages": [ + { + "group": "TurnkeyActivityError", + "pages": [ + "sdks/ethers/index/TurnkeyActivityError/readme" + ] + }, + { + "group": "TurnkeyRequestError", + "pages": [ + "sdks/ethers/index/TurnkeyRequestError/readme" + ] + }, + { + "group": "TurnkeySigner", + "pages": ["sdks/ethers/index/TurnkeySigner/readme"] + }, + "sdks/ethers/index/readme", + { + "group": "serializeSignature", + "pages": [ + "sdks/ethers/index/serializeSignature/readme" + ] + } + ] + }, + "sdks/ethers/readme" + ] + }, + { + "group": "http", + "pages": [ + { + "group": "TurnkeyClient", + "pages": ["sdks/http/TurnkeyClient/readme"] + }, + { + "group": "index", + "pages": [ + { + "group": "InvalidArgumentError", + "pages": [ + "sdks/http/index/InvalidArgumentError/readme" + ] + }, + { + "group": "SignedRequest", + "pages": ["sdks/http/index/SignedRequest/readme"] + }, + { + "group": "TActivity", + "pages": ["sdks/http/index/TActivity/readme"] + }, + { + "group": "TActivityId", + "pages": ["sdks/http/index/TActivityId/readme"] + }, + { + "group": "TActivityResponse", + "pages": [ + "sdks/http/index/TActivityResponse/readme" + ] + }, + { + "group": "TActivityStatus", + "pages": ["sdks/http/index/TActivityStatus/readme"] + }, + { + "group": "TActivityType", + "pages": ["sdks/http/index/TActivityType/readme"] + }, + { + "group": "TERMINAL_ACTIVITY_STATUSES", + "pages": [ + "sdks/http/index/TERMINAL_ACTIVITY_STATUSES/readme" + ] + }, + { + "group": "TSignature", + "pages": ["sdks/http/index/TSignature/readme"] + }, + { + "group": "TSignedRequest", + "pages": ["sdks/http/index/TSignedRequest/readme"] + }, + { + "group": "TurnkeyActivityConsensusNeededError", + "pages": [ + "sdks/http/index/TurnkeyActivityConsensusNeededError/readme" + ] + }, + { + "group": "TurnkeyActivityError", + "pages": [ + "sdks/http/index/TurnkeyActivityError/readme" + ] + }, + { + "group": "TurnkeyRequestError", + "pages": [ + "sdks/http/index/TurnkeyRequestError/readme" + ] + }, + { + "group": "VERSION", + "pages": ["sdks/http/index/VERSION/readme"] + }, + { + "group": "assertActivityCompleted", + "pages": [ + "sdks/http/index/assertActivityCompleted/readme" + ] + }, + { + "group": "assertNonNull", + "pages": ["sdks/http/index/assertNonNull/readme"] + }, + { + "group": "browserInit", + "pages": ["sdks/http/index/browserInit/readme"] + }, + { + "group": "createActivityPoller", + "pages": [ + "sdks/http/index/createActivityPoller/readme" + ] + }, + { + "group": "getSignatureFromActivity", + "pages": [ + "sdks/http/index/getSignatureFromActivity/readme" + ] + }, + { + "group": "getSignaturesFromActivity", + "pages": [ + "sdks/http/index/getSignaturesFromActivity/readme" + ] + }, + { + "group": "getSignedTransactionFromActivity", + "pages": [ + "sdks/http/index/getSignedTransactionFromActivity/readme" + ] + }, + { + "group": "getWebAuthnAttestation", + "pages": [ + "sdks/http/index/getWebAuthnAttestation/readme" + ] + }, + { + "group": "init", + "pages": ["sdks/http/index/init/readme"] + }, + "sdks/http/index/readme", + { + "group": "sealAndStampRequestBody", + "pages": [ + "sdks/http/index/sealAndStampRequestBody/readme" + ] + }, + { + "group": "withAsyncPolling", + "pages": ["sdks/http/index/withAsyncPolling/readme"] + } + ] + }, + "sdks/http/readme" + ] + }, + { + "group": "iframe-stamper", + "pages": [ + { + "group": "IframeStamper", + "pages": ["sdks/iframe-stamper/IframeStamper/readme"] + }, + { + "group": "index", + "pages": [ + { + "group": "IframeEventType", + "pages": [ + "sdks/iframe-stamper/index/IframeEventType/readme" + ] + }, + { + "group": "IframeStamper", + "pages": [ + "sdks/iframe-stamper/index/IframeStamper/readme" + ] + }, + { + "group": "KeyFormat", + "pages": [ + "sdks/iframe-stamper/index/KeyFormat/readme" + ] + }, + { + "group": "TIframeSettings", + "pages": [ + "sdks/iframe-stamper/index/TIframeSettings/readme" + ] + }, + { + "group": "TIframeStamperConfig", + "pages": [ + "sdks/iframe-stamper/index/TIframeStamperConfig/readme" + ] + }, + { + "group": "TIframeStyles", + "pages": [ + "sdks/iframe-stamper/index/TIframeStyles/readme" + ] + }, + "sdks/iframe-stamper/index/readme" + ] + }, + "sdks/iframe-stamper/readme" + ] + }, + "sdks/modules", + { + "group": "react-native-passkey-stamper", + "pages": [ + { + "group": "index", + "pages": [ + { + "group": "AuthenticatorTransport", + "pages": [ + "sdks/react-native-passkey-stamper/index/AuthenticatorTransport/readme" + ] + }, + { + "group": "PasskeyStamper", + "pages": [ + "sdks/react-native-passkey-stamper/index/PasskeyStamper/readme" + ] + }, + { + "group": "PublicKeyCredentialDescriptor", + "pages": [ + "sdks/react-native-passkey-stamper/index/PublicKeyCredentialDescriptor/readme" + ] + }, + { + "group": "TPasskeyRegistrationConfig", + "pages": [ + "sdks/react-native-passkey-stamper/index/TPasskeyRegistrationConfig/readme" + ] + }, + { + "group": "TPasskeyStamperConfig", + "pages": [ + "sdks/react-native-passkey-stamper/index/TPasskeyStamperConfig/readme" + ] + }, + { + "group": "TurnkeyAuthenticatorParams", + "pages": [ + "sdks/react-native-passkey-stamper/index/TurnkeyAuthenticatorParams/readme" + ] + }, + { + "group": "createPasskey", + "pages": [ + "sdks/react-native-passkey-stamper/index/createPasskey/readme" + ] + }, + { + "group": "isSupported", + "pages": [ + "sdks/react-native-passkey-stamper/index/isSupported/readme" + ] + }, + "sdks/react-native-passkey-stamper/index/readme" + ] + }, + "sdks/react-native-passkey-stamper/readme" + ] + }, + "sdks/readme", + { + "group": "sdk-browser", + "pages": [ + { + "group": "JavaScript_Browser", + "pages": ["sdks/sdk-browser/JavaScript_Browser/readme"] + }, + { + "group": "index", + "pages": [ + { + "group": "ApiKeyStamper", + "pages": [ + "sdks/sdk-browser/index/ApiKeyStamper/readme" + ] + }, + { + "group": "DEFAULT_APTOS_ACCOUNTS", + "pages": [ + "sdks/sdk-browser/index/DEFAULT_APTOS_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_BITCOIN_MAINNET_P2PKH_ACCOUNTS", + "pages": [ + "sdks/sdk-browser/index/DEFAULT_BITCOIN_MAINNET_P2PKH_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_BITCOIN_MAINNET_P2SH_ACCOUNTS", + "pages": [ + "sdks/sdk-browser/index/DEFAULT_BITCOIN_MAINNET_P2SH_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_BITCOIN_MAINNET_P2TR_ACCOUNTS", + "pages": [ + "sdks/sdk-browser/index/DEFAULT_BITCOIN_MAINNET_P2TR_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_BITCOIN_MAINNET_P2WPKH_ACCOUNTS", + "pages": [ + "sdks/sdk-browser/index/DEFAULT_BITCOIN_MAINNET_P2WPKH_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_BITCOIN_MAINNET_P2WSH_ACCOUNTS", + "pages": [ + "sdks/sdk-browser/index/DEFAULT_BITCOIN_MAINNET_P2WSH_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_BITCOIN_REGTEST_P2PKH_ACCOUNTS", + "pages": [ + "sdks/sdk-browser/index/DEFAULT_BITCOIN_REGTEST_P2PKH_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_BITCOIN_REGTEST_P2SH_ACCOUNTS", + "pages": [ + "sdks/sdk-browser/index/DEFAULT_BITCOIN_REGTEST_P2SH_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_BITCOIN_REGTEST_P2TR_ACCOUNTS", + "pages": [ + "sdks/sdk-browser/index/DEFAULT_BITCOIN_REGTEST_P2TR_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_BITCOIN_REGTEST_P2WPKH_ACCOUNTS", + "pages": [ + "sdks/sdk-browser/index/DEFAULT_BITCOIN_REGTEST_P2WPKH_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_BITCOIN_REGTEST_P2WSH_ACCOUNTS", + "pages": [ + "sdks/sdk-browser/index/DEFAULT_BITCOIN_REGTEST_P2WSH_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_BITCOIN_SIGNET_P2PKH_ACCOUNTS", + "pages": [ + "sdks/sdk-browser/index/DEFAULT_BITCOIN_SIGNET_P2PKH_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_BITCOIN_SIGNET_P2SH_ACCOUNTS", + "pages": [ + "sdks/sdk-browser/index/DEFAULT_BITCOIN_SIGNET_P2SH_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_BITCOIN_SIGNET_P2TR_ACCOUNTS", + "pages": [ + "sdks/sdk-browser/index/DEFAULT_BITCOIN_SIGNET_P2TR_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_BITCOIN_SIGNET_P2WPKH_ACCOUNTS", + "pages": [ + "sdks/sdk-browser/index/DEFAULT_BITCOIN_SIGNET_P2WPKH_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_BITCOIN_SIGNET_P2WSH_ACCOUNTS", + "pages": [ + "sdks/sdk-browser/index/DEFAULT_BITCOIN_SIGNET_P2WSH_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_BITCOIN_TESTNET_P2PKH_ACCOUNTS", + "pages": [ + "sdks/sdk-browser/index/DEFAULT_BITCOIN_TESTNET_P2PKH_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_BITCOIN_TESTNET_P2SH_ACCOUNTS", + "pages": [ + "sdks/sdk-browser/index/DEFAULT_BITCOIN_TESTNET_P2SH_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_BITCOIN_TESTNET_P2TR_ACCOUNTS", + "pages": [ + "sdks/sdk-browser/index/DEFAULT_BITCOIN_TESTNET_P2TR_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_BITCOIN_TESTNET_P2WPKH_ACCOUNTS", + "pages": [ + "sdks/sdk-browser/index/DEFAULT_BITCOIN_TESTNET_P2WPKH_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_BITCOIN_TESTNET_P2WSH_ACCOUNTS", + "pages": [ + "sdks/sdk-browser/index/DEFAULT_BITCOIN_TESTNET_P2WSH_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_COSMOS_ACCOUNTS", + "pages": [ + "sdks/sdk-browser/index/DEFAULT_COSMOS_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_DOGE_MAINNET_ACCOUNTS", + "pages": [ + "sdks/sdk-browser/index/DEFAULT_DOGE_MAINNET_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_DOGE_TESTNET_ACCOUNTS", + "pages": [ + "sdks/sdk-browser/index/DEFAULT_DOGE_TESTNET_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_ETHEREUM_ACCOUNTS", + "pages": [ + "sdks/sdk-browser/index/DEFAULT_ETHEREUM_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_SEI_ACCOUNTS", + "pages": [ + "sdks/sdk-browser/index/DEFAULT_SEI_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_SOLANA_ACCOUNTS", + "pages": [ + "sdks/sdk-browser/index/DEFAULT_SOLANA_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_SUI_ACCOUNTS", + "pages": [ + "sdks/sdk-browser/index/DEFAULT_SUI_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_TON_V3R2_ACCOUNTS", + "pages": [ + "sdks/sdk-browser/index/DEFAULT_TON_V3R2_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_TON_V4R2_ACCOUNTS", + "pages": [ + "sdks/sdk-browser/index/DEFAULT_TON_V4R2_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_TRON_ACCOUNTS", + "pages": [ + "sdks/sdk-browser/index/DEFAULT_TRON_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_XLM_ACCOUNTS", + "pages": [ + "sdks/sdk-browser/index/DEFAULT_XLM_ACCOUNTS/readme" + ] + }, + { + "group": "IframeEventType", + "pages": [ + "sdks/sdk-browser/index/IframeEventType/readme" + ] + }, + { + "group": "IframeStamper", + "pages": [ + "sdks/sdk-browser/index/IframeStamper/readme" + ] + }, + { + "group": "StorageKeys", + "pages": [ + "sdks/sdk-browser/index/StorageKeys/readme" + ] + }, + { + "group": "TActivity", + "pages": ["sdks/sdk-browser/index/TActivity/readme"] + }, + { + "group": "TApiKeyStamperConfig", + "pages": [ + "sdks/sdk-browser/index/TApiKeyStamperConfig/readme" + ] + }, + { + "group": "TIframeStamperConfig", + "pages": [ + "sdks/sdk-browser/index/TIframeStamperConfig/readme" + ] + }, + { + "group": "TSignedRequest", + "pages": [ + "sdks/sdk-browser/index/TSignedRequest/readme" + ] + }, + { + "group": "TWebauthnStamperConfig", + "pages": [ + "sdks/sdk-browser/index/TWebauthnStamperConfig/readme" + ] + }, + { + "group": "Turnkey", + "pages": ["sdks/sdk-browser/index/Turnkey/readme"] + }, + { + "group": "TurnkeyActivityError", + "pages": [ + "sdks/sdk-browser/index/TurnkeyActivityError/readme" + ] + }, + { + "group": "TurnkeyBrowserClient", + "pages": [ + "sdks/sdk-browser/index/TurnkeyBrowserClient/readme" + ] + }, + { + "group": "TurnkeyIframeClient", + "pages": [ + "sdks/sdk-browser/index/TurnkeyIframeClient/readme" + ] + }, + { + "group": "TurnkeyPasskeyClient", + "pages": [ + "sdks/sdk-browser/index/TurnkeyPasskeyClient/readme" + ] + }, + { + "group": "TurnkeyRequestError", + "pages": [ + "sdks/sdk-browser/index/TurnkeyRequestError/readme" + ] + }, + { + "group": "TurnkeyWalletClient", + "pages": [ + "sdks/sdk-browser/index/TurnkeyWalletClient/readme" + ] + }, + { + "group": "WalletAccount", + "pages": [ + "sdks/sdk-browser/index/WalletAccount/readme" + ] + }, + { + "group": "WebauthnStamper", + "pages": [ + "sdks/sdk-browser/index/WebauthnStamper/readme" + ] + }, + { + "group": "createActivityPoller", + "pages": [ + "sdks/sdk-browser/index/createActivityPoller/readme" + ] + }, + { + "group": "defaultAptosAccountAtIndex", + "pages": [ + "sdks/sdk-browser/index/defaultAptosAccountAtIndex/readme" + ] + }, + { + "group": "defaultBitcoinMainnetP2PKHAccountAtIndex", + "pages": [ + "sdks/sdk-browser/index/defaultBitcoinMainnetP2PKHAccountAtIndex/readme" + ] + }, + { + "group": "defaultBitcoinMainnetP2SHAccountAtIndex", + "pages": [ + "sdks/sdk-browser/index/defaultBitcoinMainnetP2SHAccountAtIndex/readme" + ] + }, + { + "group": "defaultBitcoinMainnetP2TRAccountAtIndex", + "pages": [ + "sdks/sdk-browser/index/defaultBitcoinMainnetP2TRAccountAtIndex/readme" + ] + }, + { + "group": "defaultBitcoinMainnetP2WPKHAccountAtIndex", + "pages": [ + "sdks/sdk-browser/index/defaultBitcoinMainnetP2WPKHAccountAtIndex/readme" + ] + }, + { + "group": "defaultBitcoinMainnetP2WSHAccountAtIndex", + "pages": [ + "sdks/sdk-browser/index/defaultBitcoinMainnetP2WSHAccountAtIndex/readme" + ] + }, + { + "group": "defaultBitcoinRegtestP2PKHAccountAtIndex", + "pages": [ + "sdks/sdk-browser/index/defaultBitcoinRegtestP2PKHAccountAtIndex/readme" + ] + }, + { + "group": "defaultBitcoinRegtestP2SHAccountAtIndex", + "pages": [ + "sdks/sdk-browser/index/defaultBitcoinRegtestP2SHAccountAtIndex/readme" + ] + }, + { + "group": "defaultBitcoinRegtestP2TRAccountAtIndex", + "pages": [ + "sdks/sdk-browser/index/defaultBitcoinRegtestP2TRAccountAtIndex/readme" + ] + }, + { + "group": "defaultBitcoinRegtestP2WPKHAccountAtIndex", + "pages": [ + "sdks/sdk-browser/index/defaultBitcoinRegtestP2WPKHAccountAtIndex/readme" + ] + }, + { + "group": "defaultBitcoinRegtestP2WSHAccountAtIndex", + "pages": [ + "sdks/sdk-browser/index/defaultBitcoinRegtestP2WSHAccountAtIndex/readme" + ] + }, + { + "group": "defaultBitcoinSignetP2PKHAccountAtIndex", + "pages": [ + "sdks/sdk-browser/index/defaultBitcoinSignetP2PKHAccountAtIndex/readme" + ] + }, + { + "group": "defaultBitcoinSignetP2SHAccountAtIndex", + "pages": [ + "sdks/sdk-browser/index/defaultBitcoinSignetP2SHAccountAtIndex/readme" + ] + }, + { + "group": "defaultBitcoinSignetP2TRAccountAtIndex", + "pages": [ + "sdks/sdk-browser/index/defaultBitcoinSignetP2TRAccountAtIndex/readme" + ] + }, + { + "group": "defaultBitcoinSignetP2WPKHAccountAtIndex", + "pages": [ + "sdks/sdk-browser/index/defaultBitcoinSignetP2WPKHAccountAtIndex/readme" + ] + }, + { + "group": "defaultBitcoinSignetP2WSHAccountAtIndex", + "pages": [ + "sdks/sdk-browser/index/defaultBitcoinSignetP2WSHAccountAtIndex/readme" + ] + }, + { + "group": "defaultBitcoinTestnetP2PKHAccountAtIndex", + "pages": [ + "sdks/sdk-browser/index/defaultBitcoinTestnetP2PKHAccountAtIndex/readme" + ] + }, + { + "group": "defaultBitcoinTestnetP2SHAccountAtIndex", + "pages": [ + "sdks/sdk-browser/index/defaultBitcoinTestnetP2SHAccountAtIndex/readme" + ] + }, + { + "group": "defaultBitcoinTestnetP2TRAccountAtIndex", + "pages": [ + "sdks/sdk-browser/index/defaultBitcoinTestnetP2TRAccountAtIndex/readme" + ] + }, + { + "group": "defaultBitcoinTestnetP2WPKHAccountAtIndex", + "pages": [ + "sdks/sdk-browser/index/defaultBitcoinTestnetP2WPKHAccountAtIndex/readme" + ] + }, + { + "group": "defaultBitcoinTestnetP2WSHAccountAtIndex", + "pages": [ + "sdks/sdk-browser/index/defaultBitcoinTestnetP2WSHAccountAtIndex/readme" + ] + }, + { + "group": "defaultCosmosAccountAtIndex", + "pages": [ + "sdks/sdk-browser/index/defaultCosmosAccountAtIndex/readme" + ] + }, + { + "group": "defaultDogeMainnetAccountAtIndex", + "pages": [ + "sdks/sdk-browser/index/defaultDogeMainnetAccountAtIndex/readme" + ] + }, + { + "group": "defaultDogeTestnetAccountAtIndex", + "pages": [ + "sdks/sdk-browser/index/defaultDogeTestnetAccountAtIndex/readme" + ] + }, + { + "group": "defaultEthereumAccountAtIndex", + "pages": [ + "sdks/sdk-browser/index/defaultEthereumAccountAtIndex/readme" + ] + }, + { + "group": "defaultSeiAccountAtIndex", + "pages": [ + "sdks/sdk-browser/index/defaultSeiAccountAtIndex/readme" + ] + }, + { + "group": "defaultSolanaAccountAtIndex", + "pages": [ + "sdks/sdk-browser/index/defaultSolanaAccountAtIndex/readme" + ] + }, + { + "group": "defaultSuiAccountAtIndex", + "pages": [ + "sdks/sdk-browser/index/defaultSuiAccountAtIndex/readme" + ] + }, + { + "group": "defaultTonV3r2AccountAtIndex", + "pages": [ + "sdks/sdk-browser/index/defaultTonV3r2AccountAtIndex/readme" + ] + }, + { + "group": "defaultTonV4r2AccountAtIndex", + "pages": [ + "sdks/sdk-browser/index/defaultTonV4r2AccountAtIndex/readme" + ] + }, + { + "group": "defaultTronAccountAtIndex", + "pages": [ + "sdks/sdk-browser/index/defaultTronAccountAtIndex/readme" + ] + }, + { + "group": "defaultXlmAccountAtIndex", + "pages": [ + "sdks/sdk-browser/index/defaultXlmAccountAtIndex/readme" + ] + }, + { + "group": "defaultXrpAccountAtIndex", + "pages": [ + "sdks/sdk-browser/index/defaultXrpAccountAtIndex/readme" + ] + }, + { + "group": "getStorageValue", + "pages": [ + "sdks/sdk-browser/index/getStorageValue/readme" + ] + }, + { + "group": "getWebAuthnAttestation", + "pages": [ + "sdks/sdk-browser/index/getWebAuthnAttestation/readme" + ] + }, + "sdks/sdk-browser/index/readme", + { + "group": "sealAndStampRequestBody", + "pages": [ + "sdks/sdk-browser/index/sealAndStampRequestBody/readme" + ] + }, + { + "group": "setStorageValue", + "pages": [ + "sdks/sdk-browser/index/setStorageValue/readme" + ] + }, + { + "group": "signWithApiKey", + "pages": [ + "sdks/sdk-browser/index/signWithApiKey/readme" + ] + } + ] + }, + "sdks/sdk-browser/readme" + ] + }, + { + "group": "sdk-react", + "pages": [ + { + "group": "React", + "pages": ["sdks/sdk-react/React/readme"] + }, + { + "group": "index", + "pages": [ + { + "group": "Auth", + "pages": ["sdks/sdk-react/index/Auth/readme"] + }, + { + "group": "Export", + "pages": ["sdks/sdk-react/index/Export/readme"] + }, + { + "group": "FilterType", + "pages": ["sdks/sdk-react/index/FilterType/readme"] + }, + { + "group": "Import", + "pages": ["sdks/sdk-react/index/Import/readme"] + }, + { + "group": "OtpType", + "pages": ["sdks/sdk-react/index/OtpType/readme"] + }, + { + "group": "OtpVerification", + "pages": [ + "sdks/sdk-react/index/OtpVerification/readme" + ] + }, + { + "group": "TurnkeyContext", + "pages": [ + "sdks/sdk-react/index/TurnkeyContext/readme" + ] + }, + { + "group": "TurnkeyProvider", + "pages": [ + "sdks/sdk-react/index/TurnkeyProvider/readme" + ] + }, + { + "group": "TurnkeyThemeProvider", + "pages": [ + "sdks/sdk-react/index/TurnkeyThemeProvider/readme" + ] + }, + "sdks/sdk-react/index/readme", + { + "group": "useTurnkey", + "pages": ["sdks/sdk-react/index/useTurnkey/readme"] + } + ] + }, + "sdks/sdk-react/readme" + ] + }, + { + "group": "sdk-react-native", + "pages": [ + { + "group": "React_Native", + "pages": ["sdks/sdk-react-native/React_Native/readme"] + }, + { + "group": "index", + "pages": [ + { + "group": "AddressFormat", + "pages": [ + "sdks/sdk-react-native/index/AddressFormat/readme" + ] + }, + { + "group": "Curve", + "pages": [ + "sdks/sdk-react-native/index/Curve/readme" + ] + }, + { + "group": "OTP_AUTH_DEFAULT_EXPIRATION_SECONDS", + "pages": [ + "sdks/sdk-react-native/index/OTP_AUTH_DEFAULT_EXPIRATION_SECONDS/readme" + ] + }, + { + "group": "PathFormat", + "pages": [ + "sdks/sdk-react-native/index/PathFormat/readme" + ] + }, + { + "group": "Session", + "pages": [ + "sdks/sdk-react-native/index/Session/readme" + ] + }, + { + "group": "StorageKeys", + "pages": [ + "sdks/sdk-react-native/index/StorageKeys/readme" + ] + }, + { + "group": "Timestamp", + "pages": [ + "sdks/sdk-react-native/index/Timestamp/readme" + ] + }, + { + "group": "TurnkeyConfig", + "pages": [ + "sdks/sdk-react-native/index/TurnkeyConfig/readme" + ] + }, + { + "group": "TurnkeyContext", + "pages": [ + "sdks/sdk-react-native/index/TurnkeyContext/readme" + ] + }, + { + "group": "TurnkeyProvider", + "pages": [ + "sdks/sdk-react-native/index/TurnkeyProvider/readme" + ] + }, + { + "group": "User", + "pages": ["sdks/sdk-react-native/index/User/readme"] + }, + { + "group": "Wallet", + "pages": [ + "sdks/sdk-react-native/index/Wallet/readme" + ] + }, + { + "group": "WalletAccount", + "pages": [ + "sdks/sdk-react-native/index/WalletAccount/readme" + ] + }, + "sdks/sdk-react-native/index/readme", + { + "group": "useTurnkey", + "pages": [ + "sdks/sdk-react-native/index/useTurnkey/readme" + ] + } + ] + }, + "sdks/sdk-react-native/readme" + ] + }, + { + "group": "sdk-server", + "pages": [ + { + "group": "documents", + "pages": [ + { + "group": "docs", + "pages": ["sdks/sdk-server/documents/docs/readme"] + } + ] + }, + { + "group": "index", + "pages": [ + { + "group": "ApiKeyStamper", + "pages": [ + "sdks/sdk-server/index/ApiKeyStamper/readme" + ] + }, + { + "group": "DEFAULT_APTOS_ACCOUNTS", + "pages": [ + "sdks/sdk-server/index/DEFAULT_APTOS_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_BITCOIN_MAINNET_P2PKH_ACCOUNTS", + "pages": [ + "sdks/sdk-server/index/DEFAULT_BITCOIN_MAINNET_P2PKH_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_BITCOIN_MAINNET_P2SH_ACCOUNTS", + "pages": [ + "sdks/sdk-server/index/DEFAULT_BITCOIN_MAINNET_P2SH_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_BITCOIN_MAINNET_P2TR_ACCOUNTS", + "pages": [ + "sdks/sdk-server/index/DEFAULT_BITCOIN_MAINNET_P2TR_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_BITCOIN_MAINNET_P2WPKH_ACCOUNTS", + "pages": [ + "sdks/sdk-server/index/DEFAULT_BITCOIN_MAINNET_P2WPKH_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_BITCOIN_MAINNET_P2WSH_ACCOUNTS", + "pages": [ + "sdks/sdk-server/index/DEFAULT_BITCOIN_MAINNET_P2WSH_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_BITCOIN_REGTEST_P2PKH_ACCOUNTS", + "pages": [ + "sdks/sdk-server/index/DEFAULT_BITCOIN_REGTEST_P2PKH_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_BITCOIN_REGTEST_P2SH_ACCOUNTS", + "pages": [ + "sdks/sdk-server/index/DEFAULT_BITCOIN_REGTEST_P2SH_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_BITCOIN_REGTEST_P2TR_ACCOUNTS", + "pages": [ + "sdks/sdk-server/index/DEFAULT_BITCOIN_REGTEST_P2TR_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_BITCOIN_REGTEST_P2WPKH_ACCOUNTS", + "pages": [ + "sdks/sdk-server/index/DEFAULT_BITCOIN_REGTEST_P2WPKH_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_BITCOIN_REGTEST_P2WSH_ACCOUNTS", + "pages": [ + "sdks/sdk-server/index/DEFAULT_BITCOIN_REGTEST_P2WSH_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_BITCOIN_SIGNET_P2PKH_ACCOUNTS", + "pages": [ + "sdks/sdk-server/index/DEFAULT_BITCOIN_SIGNET_P2PKH_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_BITCOIN_SIGNET_P2SH_ACCOUNTS", + "pages": [ + "sdks/sdk-server/index/DEFAULT_BITCOIN_SIGNET_P2SH_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_BITCOIN_SIGNET_P2TR_ACCOUNTS", + "pages": [ + "sdks/sdk-server/index/DEFAULT_BITCOIN_SIGNET_P2TR_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_BITCOIN_SIGNET_P2WPKH_ACCOUNTS", + "pages": [ + "sdks/sdk-server/index/DEFAULT_BITCOIN_SIGNET_P2WPKH_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_BITCOIN_SIGNET_P2WSH_ACCOUNTS", + "pages": [ + "sdks/sdk-server/index/DEFAULT_BITCOIN_SIGNET_P2WSH_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_BITCOIN_TESTNET_P2PKH_ACCOUNTS", + "pages": [ + "sdks/sdk-server/index/DEFAULT_BITCOIN_TESTNET_P2PKH_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_BITCOIN_TESTNET_P2SH_ACCOUNTS", + "pages": [ + "sdks/sdk-server/index/DEFAULT_BITCOIN_TESTNET_P2SH_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_BITCOIN_TESTNET_P2TR_ACCOUNTS", + "pages": [ + "sdks/sdk-server/index/DEFAULT_BITCOIN_TESTNET_P2TR_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_BITCOIN_TESTNET_P2WPKH_ACCOUNTS", + "pages": [ + "sdks/sdk-server/index/DEFAULT_BITCOIN_TESTNET_P2WPKH_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_BITCOIN_TESTNET_P2WSH_ACCOUNTS", + "pages": [ + "sdks/sdk-server/index/DEFAULT_BITCOIN_TESTNET_P2WSH_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_COSMOS_ACCOUNTS", + "pages": [ + "sdks/sdk-server/index/DEFAULT_COSMOS_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_DOGE_MAINNET_ACCOUNTS", + "pages": [ + "sdks/sdk-server/index/DEFAULT_DOGE_MAINNET_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_DOGE_TESTNET_ACCOUNTS", + "pages": [ + "sdks/sdk-server/index/DEFAULT_DOGE_TESTNET_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_ETHEREUM_ACCOUNTS", + "pages": [ + "sdks/sdk-server/index/DEFAULT_ETHEREUM_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_SEI_ACCOUNTS", + "pages": [ + "sdks/sdk-server/index/DEFAULT_SEI_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_SOLANA_ACCOUNTS", + "pages": [ + "sdks/sdk-server/index/DEFAULT_SOLANA_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_SUI_ACCOUNTS", + "pages": [ + "sdks/sdk-server/index/DEFAULT_SUI_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_TON_V3R2_ACCOUNTS", + "pages": [ + "sdks/sdk-server/index/DEFAULT_TON_V3R2_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_TON_V4R2_ACCOUNTS", + "pages": [ + "sdks/sdk-server/index/DEFAULT_TON_V4R2_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_TRON_ACCOUNTS", + "pages": [ + "sdks/sdk-server/index/DEFAULT_TRON_ACCOUNTS/readme" + ] + }, + { + "group": "DEFAULT_XLM_ACCOUNTS", + "pages": [ + "sdks/sdk-server/index/DEFAULT_XLM_ACCOUNTS/readme" + ] + }, + { + "group": "TActivity", + "pages": ["sdks/sdk-server/index/TActivity/readme"] + }, + { + "group": "TApiKeyStamperConfig", + "pages": [ + "sdks/sdk-server/index/TApiKeyStamperConfig/readme" + ] + }, + { + "group": "TSignedRequest", + "pages": [ + "sdks/sdk-server/index/TSignedRequest/readme" + ] + }, + { + "group": "Turnkey", + "pages": ["sdks/sdk-server/index/Turnkey/readme"] + }, + { + "group": "TurnkeyActivityError", + "pages": [ + "sdks/sdk-server/index/TurnkeyActivityError/readme" + ] + }, + { + "group": "TurnkeyApiClient", + "pages": [ + "sdks/sdk-server/index/TurnkeyApiClient/readme" + ] + }, + { + "group": "TurnkeyRequestError", + "pages": [ + "sdks/sdk-server/index/TurnkeyRequestError/readme" + ] + }, + { + "group": "TurnkeyServerClient", + "pages": [ + "sdks/sdk-server/index/TurnkeyServerClient/readme" + ] + }, + { + "group": "createActivityPoller", + "pages": [ + "sdks/sdk-server/index/createActivityPoller/readme" + ] + }, + { + "group": "defaultAptosAccountAtIndex", + "pages": [ + "sdks/sdk-server/index/defaultAptosAccountAtIndex/readme" + ] + }, + { + "group": "defaultBitcoinMainnetP2PKHAccountAtIndex", + "pages": [ + "sdks/sdk-server/index/defaultBitcoinMainnetP2PKHAccountAtIndex/readme" + ] + }, + { + "group": "defaultBitcoinMainnetP2SHAccountAtIndex", + "pages": [ + "sdks/sdk-server/index/defaultBitcoinMainnetP2SHAccountAtIndex/readme" + ] + }, + { + "group": "defaultBitcoinMainnetP2TRAccountAtIndex", + "pages": [ + "sdks/sdk-server/index/defaultBitcoinMainnetP2TRAccountAtIndex/readme" + ] + }, + { + "group": "defaultBitcoinMainnetP2WPKHAccountAtIndex", + "pages": [ + "sdks/sdk-server/index/defaultBitcoinMainnetP2WPKHAccountAtIndex/readme" + ] + }, + { + "group": "defaultBitcoinMainnetP2WSHAccountAtIndex", + "pages": [ + "sdks/sdk-server/index/defaultBitcoinMainnetP2WSHAccountAtIndex/readme" + ] + }, + { + "group": "defaultBitcoinRegtestP2PKHAccountAtIndex", + "pages": [ + "sdks/sdk-server/index/defaultBitcoinRegtestP2PKHAccountAtIndex/readme" + ] + }, + { + "group": "defaultBitcoinRegtestP2SHAccountAtIndex", + "pages": [ + "sdks/sdk-server/index/defaultBitcoinRegtestP2SHAccountAtIndex/readme" + ] + }, + { + "group": "defaultBitcoinRegtestP2TRAccountAtIndex", + "pages": [ + "sdks/sdk-server/index/defaultBitcoinRegtestP2TRAccountAtIndex/readme" + ] + }, + { + "group": "defaultBitcoinRegtestP2WPKHAccountAtIndex", + "pages": [ + "sdks/sdk-server/index/defaultBitcoinRegtestP2WPKHAccountAtIndex/readme" + ] + }, + { + "group": "defaultBitcoinRegtestP2WSHAccountAtIndex", + "pages": [ + "sdks/sdk-server/index/defaultBitcoinRegtestP2WSHAccountAtIndex/readme" + ] + }, + { + "group": "defaultBitcoinSignetP2PKHAccountAtIndex", + "pages": [ + "sdks/sdk-server/index/defaultBitcoinSignetP2PKHAccountAtIndex/readme" + ] + }, + { + "group": "defaultBitcoinSignetP2SHAccountAtIndex", + "pages": [ + "sdks/sdk-server/index/defaultBitcoinSignetP2SHAccountAtIndex/readme" + ] + }, + { + "group": "defaultBitcoinSignetP2TRAccountAtIndex", + "pages": [ + "sdks/sdk-server/index/defaultBitcoinSignetP2TRAccountAtIndex/readme" + ] + }, + { + "group": "defaultBitcoinSignetP2WPKHAccountAtIndex", + "pages": [ + "sdks/sdk-server/index/defaultBitcoinSignetP2WPKHAccountAtIndex/readme" + ] + }, + { + "group": "defaultBitcoinSignetP2WSHAccountAtIndex", + "pages": [ + "sdks/sdk-server/index/defaultBitcoinSignetP2WSHAccountAtIndex/readme" + ] + }, + { + "group": "defaultBitcoinTestnetP2PKHAccountAtIndex", + "pages": [ + "sdks/sdk-server/index/defaultBitcoinTestnetP2PKHAccountAtIndex/readme" + ] + }, + { + "group": "defaultBitcoinTestnetP2SHAccountAtIndex", + "pages": [ + "sdks/sdk-server/index/defaultBitcoinTestnetP2SHAccountAtIndex/readme" + ] + }, + { + "group": "defaultBitcoinTestnetP2TRAccountAtIndex", + "pages": [ + "sdks/sdk-server/index/defaultBitcoinTestnetP2TRAccountAtIndex/readme" + ] + }, + { + "group": "defaultBitcoinTestnetP2WPKHAccountAtIndex", + "pages": [ + "sdks/sdk-server/index/defaultBitcoinTestnetP2WPKHAccountAtIndex/readme" + ] + }, + { + "group": "defaultBitcoinTestnetP2WSHAccountAtIndex", + "pages": [ + "sdks/sdk-server/index/defaultBitcoinTestnetP2WSHAccountAtIndex/readme" + ] + }, + { + "group": "defaultCosmosAccountAtIndex", + "pages": [ + "sdks/sdk-server/index/defaultCosmosAccountAtIndex/readme" + ] + }, + { + "group": "defaultDogeMainnetAccountAtIndex", + "pages": [ + "sdks/sdk-server/index/defaultDogeMainnetAccountAtIndex/readme" + ] + }, + { + "group": "defaultDogeTestnetAccountAtIndex", + "pages": [ + "sdks/sdk-server/index/defaultDogeTestnetAccountAtIndex/readme" + ] + }, + { + "group": "defaultEthereumAccountAtIndex", + "pages": [ + "sdks/sdk-server/index/defaultEthereumAccountAtIndex/readme" + ] + }, + { + "group": "defaultSeiAccountAtIndex", + "pages": [ + "sdks/sdk-server/index/defaultSeiAccountAtIndex/readme" + ] + }, + { + "group": "defaultSolanaAccountAtIndex", + "pages": [ + "sdks/sdk-server/index/defaultSolanaAccountAtIndex/readme" + ] + }, + { + "group": "defaultSuiAccountAtIndex", + "pages": [ + "sdks/sdk-server/index/defaultSuiAccountAtIndex/readme" + ] + }, + { + "group": "defaultTonV3r2AccountAtIndex", + "pages": [ + "sdks/sdk-server/index/defaultTonV3r2AccountAtIndex/readme" + ] + }, + { + "group": "defaultTonV4r2AccountAtIndex", + "pages": [ + "sdks/sdk-server/index/defaultTonV4r2AccountAtIndex/readme" + ] + }, + { + "group": "defaultTronAccountAtIndex", + "pages": [ + "sdks/sdk-server/index/defaultTronAccountAtIndex/readme" + ] + }, + { + "group": "defaultXlmAccountAtIndex", + "pages": [ + "sdks/sdk-server/index/defaultXlmAccountAtIndex/readme" + ] + }, + { + "group": "defaultXrpAccountAtIndex", + "pages": [ + "sdks/sdk-server/index/defaultXrpAccountAtIndex/readme" + ] + }, + { + "group": "fetch", + "pages": ["sdks/sdk-server/index/fetch/readme"] + }, + { + "group": "getWebAuthnAttestation", + "pages": [ + "sdks/sdk-server/index/getWebAuthnAttestation/readme" + ] + }, + "sdks/sdk-server/index/readme", + { + "group": "sealAndStampRequestBody", + "pages": [ + "sdks/sdk-server/index/sealAndStampRequestBody/readme" + ] + }, + { + "group": "server", + "pages": ["sdks/sdk-server/index/server/readme"] + }, + { + "group": "signWithApiKey", + "pages": [ + "sdks/sdk-server/index/signWithApiKey/readme" + ] + } + ] + }, + "sdks/sdk-server/readme" + ] + }, + { + "group": "solana", + "pages": [ + { + "group": "documents", + "pages": [ + { + "group": "docs", + "pages": ["sdks/solana/documents/docs/readme"] + } + ] + }, + { + "group": "index", + "pages": [ + { + "group": "TurnkeySigner", + "pages": ["sdks/solana/index/TurnkeySigner/readme"] + }, + "sdks/solana/index/readme" + ] + }, + "sdks/solana/readme" + ] + }, + { + "group": "telegram-cloud-storage-stamper", + "pages": [ + { + "group": "index", + "pages": [ + { + "group": "CloudStorageAPIKey", + "pages": [ + "sdks/telegram-cloud-storage-stamper/index/CloudStorageAPIKey/readme" + ] + }, + { + "group": "DEFAULT_TURNKEY_CLOUD_STORAGE_KEY", + "pages": [ + "sdks/telegram-cloud-storage-stamper/index/DEFAULT_TURNKEY_CLOUD_STORAGE_KEY/readme" + ] + }, + { + "group": "TTelegramCloudStorageStamperConfig", + "pages": [ + "sdks/telegram-cloud-storage-stamper/index/TTelegramCloudStorageStamperConfig/readme" + ] + }, + { + "group": "TelegramCloudStorageStamper", + "pages": [ + "sdks/telegram-cloud-storage-stamper/index/TelegramCloudStorageStamper/readme" + ] + }, + "sdks/telegram-cloud-storage-stamper/index/readme" + ] + }, + "sdks/telegram-cloud-storage-stamper/readme" + ] + }, + { + "group": "viem", + "pages": [ + { + "group": "documents", + "pages": [ + { + "group": "docs", + "pages": ["sdks/viem/documents/docs/readme"] + } + ] + }, + { + "group": "index", + "pages": [ + { + "group": "TTurnkeyActivityErrorType", + "pages": [ + "sdks/viem/index/TTurnkeyActivityErrorType/readme" + ] + }, + { + "group": "TTurnkeyConsensusNeededErrorType", + "pages": [ + "sdks/viem/index/TTurnkeyConsensusNeededErrorType/readme" + ] + }, + { + "group": "TurnkeyActivityError", + "pages": [ + "sdks/viem/index/TurnkeyActivityError/readme" + ] + }, + { + "group": "TurnkeyConsensusNeededError", + "pages": [ + "sdks/viem/index/TurnkeyConsensusNeededError/readme" + ] + }, + { + "group": "createAccount", + "pages": ["sdks/viem/index/createAccount/readme"] + }, + { + "group": "createAccountWithAddress", + "pages": [ + "sdks/viem/index/createAccountWithAddress/readme" + ] + }, + { + "group": "createApiKeyAccount", + "pages": [ + "sdks/viem/index/createApiKeyAccount/readme" + ] + }, + { + "group": "isTurnkeyActivityConsensusNeededError", + "pages": [ + "sdks/viem/index/isTurnkeyActivityConsensusNeededError/readme" + ] + }, + { + "group": "isTurnkeyActivityError", + "pages": [ + "sdks/viem/index/isTurnkeyActivityError/readme" + ] + }, + "sdks/viem/index/readme", + { + "group": "serializeSignature", + "pages": [ + "sdks/viem/index/serializeSignature/readme" + ] + }, + { + "group": "signMessage", + "pages": ["sdks/viem/index/signMessage/readme"] + }, + { + "group": "signTransaction", + "pages": ["sdks/viem/index/signTransaction/readme"] + }, + { + "group": "signTypedData", + "pages": ["sdks/viem/index/signTypedData/readme"] + } + ] + }, + "sdks/viem/readme" + ] + }, + { + "group": "wallet-stamper", + "pages": [ + { + "group": "WalletStamper", + "pages": ["sdks/wallet-stamper/WalletStamper/readme"] + }, + { + "group": "index", + "pages": [ + { + "group": "BaseEthereumWallet", + "pages": [ + "sdks/wallet-stamper/index/BaseEthereumWallet/readme" + ] + }, + { + "group": "BaseWalletInterface", + "pages": [ + "sdks/wallet-stamper/index/BaseWalletInterface/readme" + ] + }, + { + "group": "EthereumWallet", + "pages": [ + "sdks/wallet-stamper/index/EthereumWallet/readme" + ] + }, + { + "group": "EthereumWalletInterface", + "pages": [ + "sdks/wallet-stamper/index/EthereumWalletInterface/readme" + ] + }, + { + "group": "SIGNATURE_SCHEME_TK_API_ED25519", + "pages": [ + "sdks/wallet-stamper/index/SIGNATURE_SCHEME_TK_API_ED25519/readme" + ] + }, + { + "group": "SIGNATURE_SCHEME_TK_API_SECP256K1_EIP191", + "pages": [ + "sdks/wallet-stamper/index/SIGNATURE_SCHEME_TK_API_SECP256K1_EIP191/readme" + ] + }, + { + "group": "STAMP_HEADER_NAME", + "pages": [ + "sdks/wallet-stamper/index/STAMP_HEADER_NAME/readme" + ] + }, + { + "group": "SolanaWalletInterface", + "pages": [ + "sdks/wallet-stamper/index/SolanaWalletInterface/readme" + ] + }, + { + "group": "TStamp", + "pages": ["sdks/wallet-stamper/index/TStamp/readme"] + }, + { + "group": "TStamper", + "pages": [ + "sdks/wallet-stamper/index/TStamper/readme" + ] + }, + { + "group": "WalletInterface", + "pages": [ + "sdks/wallet-stamper/index/WalletInterface/readme" + ] + }, + { + "group": "WalletStamper", + "pages": [ + "sdks/wallet-stamper/index/WalletStamper/readme" + ] + }, + { + "group": "WalletStamperError", + "pages": [ + "sdks/wallet-stamper/index/WalletStamperError/readme" + ] + }, + { + "group": "WalletType", + "pages": [ + "sdks/wallet-stamper/index/WalletType/readme" + ] + }, + { + "group": "getCompressedPublicKey", + "pages": [ + "sdks/wallet-stamper/index/getCompressedPublicKey/readme" + ] + }, + "sdks/wallet-stamper/index/readme" + ] + }, + "sdks/wallet-stamper/readme" + ] + }, + { + "group": "webauthn-stamper", + "pages": [ + { + "group": "WebauthnStamper", + "pages": [ + "sdks/webauthn-stamper/WebauthnStamper/readme" + ] + }, + { + "group": "index", + "pages": [ + { + "group": "TWebauthnStamperConfig", + "pages": [ + "sdks/webauthn-stamper/index/TWebauthnStamperConfig/readme" + ] + }, + { + "group": "WebauthnStamper", + "pages": [ + "sdks/webauthn-stamper/index/WebauthnStamper/readme" + ] + }, + "sdks/webauthn-stamper/index/readme" + ] + }, + "sdks/webauthn-stamper/readme" + ] + } + ] + }, + "sdks/readme", "sdks/introduction", "sdks/javascript-browser", "sdks/javascript-server", @@ -206,7 +2280,7 @@ "sdks/react-native", "sdks/golang", "sdks/rust", - "sdks/Ruby", + "sdks/ruby", "sdks/cli", "sdks/flutter", { diff --git a/sdks/_media/LICENSE b/sdks/_media/LICENSE new file mode 100644 index 00000000..dc831362 --- /dev/null +++ b/sdks/_media/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright 2024 Turnkey + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/sdks/_media/LICENSE-1 b/sdks/_media/LICENSE-1 new file mode 100644 index 00000000..dc831362 --- /dev/null +++ b/sdks/_media/LICENSE-1 @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright 2024 Turnkey + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/sdks/_media/demo-passkey-wallet.png b/sdks/_media/demo-passkey-wallet.png new file mode 100644 index 00000000..fd29cca7 Binary files /dev/null and b/sdks/_media/demo-passkey-wallet.png differ diff --git a/sdks/_media/ethers-ui-screenshot.png b/sdks/_media/ethers-ui-screenshot.png new file mode 100644 index 00000000..eca09be8 Binary files /dev/null and b/sdks/_media/ethers-ui-screenshot.png differ diff --git a/sdks/_media/sdk-map.png b/sdks/_media/sdk-map.png new file mode 100644 index 00000000..4097c9bc Binary files /dev/null and b/sdks/_media/sdk-map.png differ diff --git a/sdks/_media/sdk-web-diagram.png b/sdks/_media/sdk-web-diagram.png new file mode 100644 index 00000000..ec9a002e Binary files /dev/null and b/sdks/_media/sdk-web-diagram.png differ diff --git a/sdks/_media/viem-ui-screenshot.png b/sdks/_media/viem-ui-screenshot.png new file mode 100644 index 00000000..4c54d5ee Binary files /dev/null and b/sdks/_media/viem-ui-screenshot.png differ diff --git a/sdks/api-key-stamper/ApiKeyStamper/readme.mdx b/sdks/api-key-stamper/ApiKeyStamper/readme.mdx new file mode 100644 index 00000000..35301ee5 --- /dev/null +++ b/sdks/api-key-stamper/ApiKeyStamper/readme.mdx @@ -0,0 +1,137 @@ +--- +title: "ApiKeyStamper" +mode: wide +--- + +## Introduction + +The [`@turnkey/api-key-stamper`](https://www.npmjs.com/package/@turnkey/api-key-stamper) package simplifies the process of using your public/private API keys and passkeys to stamp and approve activity requests for Turnkey's API. This stamping mechanism is central to the API's security, ensuring that each request is authenticated and authorized. For an in-depth understanding of API keys see [this section](/faq#why-do-you-require-a-public--private-key-pair-to-access-turnkey-api). + +## Installing + +To get started install the [`@turnkey/api-key-stamper`](https://www.npmjs.com/package/@turnkey/api-key-stamper) client. + + + +```bash npm +pnpm i @turnkey/api-key-stamper +``` + +```bash pnpm +pnpm i @turnkey/api-key-stamper +``` + +```bash yarn +yarn add @turnkey/api-key-stamper +``` + + + +## Initializing + +The `ApiKeyStamper` class implements the `TStamper` interface used by the [TurnkeyClient](/sdks/advanced/turnkey-client) in the `@turnkey/http` module. It encapsulates the logic necessary to sign activity requests and generates the appropriate HTTP headers for authentication. To get started with an `ApiKeyStamper`, you can initialize it using its constructor: + +### `constructor(config: TApiKeyStamperConfig): TStamper` + + + +An object containing configuration settings for the stamper. + + + + +Your Turnkey API private key. + + + + +Your Turnkey API public key. + + +### Types + +#### `TApiKeyStamperConfig` + +```js +type TApiKeyStamperConfig = { + apiPublicKey: string; + apiPrivateKey: string; +}; +``` + +#### `TStamper` + +```js +interface TStamper { + stamp: (input: string) => Promise; +}; +``` + +#### Example + +The example below shows how to initialize and use the `ApiKeyStamper` with the `TurnkeyClient` to make a request to Turnkey's [`/public/v1/query/whoami`](/api-reference/sessions/who-am-i) endpoint: + +```js +import { TurnkeyClient } from "@turnkey/http"; +import { ApiKeyStamper } from "@turnkey/api-key-stamper"; + +// Following best practices, define parameters in your .env file +const baseUrl = process.env.TURNKEY_BASE_URL || "https://api.turnkey.com"; +const apiPublicKey = process.env.TURNKEY_API_PUBLIC_KEY; +const apiPrivateKey = process.env.TURNKEY_API_PRIVATE_KEY; + +// Initialize the API key stamper +const stamper = new ApiKeyStamper({ apiPublicKey, apiPrivateKey }); + +// Initialize the Turnkey client +const tk = new TurnkeyClient({ baseUrl }, stamper); + +// Now you can make authenticated requests using the APIKeyStamper +const whoami = await tk.getWhoami({ + organizationId: "", +}); +``` + +## Methods + +### `stamp: (input: string) => Promise` + +Creates a digital stamp which includes the public key, signature scheme, and a signature. + +#### Parameters + + + +The payload that needs to be stamped. + + +#### Types + +##### `TStamp` + +```js +type TStamp = { + stampHeaderName: string; + stampHeaderValue: string; +}; +``` diff --git a/sdks/api-key-stamper/index/ApiKeyStamper/readme.mdx b/sdks/api-key-stamper/index/ApiKeyStamper/readme.mdx new file mode 100644 index 00000000..04c813cc --- /dev/null +++ b/sdks/api-key-stamper/index/ApiKeyStamper/readme.mdx @@ -0,0 +1,62 @@ +--- +title: "ApiKeyStamper" +mode: wide +--- + +# Class: ApiKeyStamper + +Defined in: [index.ts:53](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/api-key-stamper/src/index.ts#L53) + +Stamper to use with `@turnkey/http`'s `TurnkeyClient` + +## Constructors + +### Constructor + +> **new ApiKeyStamper**(`config`): `ApiKeyStamper` + +Defined in: [index.ts:57](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/api-key-stamper/src/index.ts#L57) + +#### Parameters + +##### config + +[`TApiKeyStamperConfig`](../TApiKeyStamperConfig/readme) + +#### Returns + +`ApiKeyStamper` + +## Properties + +### apiPrivateKey + +> **apiPrivateKey**: `string` + +Defined in: [index.ts:55](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/api-key-stamper/src/index.ts#L55) + +*** + +### apiPublicKey + +> **apiPublicKey**: `string` + +Defined in: [index.ts:54](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/api-key-stamper/src/index.ts#L54) + +## Methods + +### stamp() + +> **stamp**(`payload`): `Promise`\<\{ `stampHeaderName`: `string`; `stampHeaderValue`: `string`; \}\> + +Defined in: [index.ts:62](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/api-key-stamper/src/index.ts#L62) + +#### Parameters + +##### payload + +`string` + +#### Returns + +`Promise`\<\{ `stampHeaderName`: `string`; `stampHeaderValue`: `string`; \}\> diff --git a/sdks/api-key-stamper/index/TApiKeyStamperConfig/readme.mdx b/sdks/api-key-stamper/index/TApiKeyStamperConfig/readme.mdx new file mode 100644 index 00000000..6c8d4c46 --- /dev/null +++ b/sdks/api-key-stamper/index/TApiKeyStamperConfig/readme.mdx @@ -0,0 +1,26 @@ +--- +title: "TApiKeyStamperConfig" +mode: wide +--- + +# Type Alias: TApiKeyStamperConfig + +> **TApiKeyStamperConfig** = `object` + +Defined in: [index.ts:7](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/api-key-stamper/src/index.ts#L7) + +## Properties + +### apiPrivateKey + +> **apiPrivateKey**: `string` + +Defined in: [index.ts:9](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/api-key-stamper/src/index.ts#L9) + +*** + +### apiPublicKey + +> **apiPublicKey**: `string` + +Defined in: [index.ts:8](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/api-key-stamper/src/index.ts#L8) diff --git a/sdks/api-key-stamper/index/pointDecode/readme.mdx b/sdks/api-key-stamper/index/pointDecode/readme.mdx new file mode 100644 index 00000000..53a90550 --- /dev/null +++ b/sdks/api-key-stamper/index/pointDecode/readme.mdx @@ -0,0 +1,25 @@ +--- +title: "PointDecode" +mode: wide +--- + +# Function: pointDecode() + +> **pointDecode**(`point`): `JsonWebKey` + +Defined in: [tink/elliptic\_curves.ts:166](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/api-key-stamper/src/tink/elliptic_curves.ts#L166) + +Decodes a public key in _compressed_ OR _uncompressed_ format. +Augmented to ensure that the x and y components are padded to fit 32 bytes. + +P-256 only + +## Parameters + +### point + +`Uint8Array` + +## Returns + +`JsonWebKey` diff --git a/sdks/api-key-stamper/index/readme.mdx b/sdks/api-key-stamper/index/readme.mdx new file mode 100644 index 00000000..996051f8 --- /dev/null +++ b/sdks/api-key-stamper/index/readme.mdx @@ -0,0 +1,19 @@ +--- +title: "Index" +mode: wide +--- + +# index + +## Classes + +- [ApiKeyStamper](ApiKeyStamper/readme) + +## Type Aliases + +- [TApiKeyStamperConfig](TApiKeyStamperConfig/readme) + +## Functions + +- [pointDecode](pointDecode/readme) +- [signWithApiKey](signWithApiKey/readme) diff --git a/sdks/api-key-stamper/index/signWithApiKey/readme.mdx b/sdks/api-key-stamper/index/signWithApiKey/readme.mdx new file mode 100644 index 00000000..0060616e --- /dev/null +++ b/sdks/api-key-stamper/index/signWithApiKey/readme.mdx @@ -0,0 +1,32 @@ +--- +title: "SignWithApiKey" +mode: wide +--- + +# Function: signWithApiKey() + +> **signWithApiKey**(`input`): `Promise`\<`string`\> + +Defined in: [index.ts:31](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/api-key-stamper/src/index.ts#L31) + +Signature function abstracting the differences between NodeJS and web environments for signing with API keys. + +## Parameters + +### input + +#### content + +`string` + +#### privateKey + +`string` + +#### publicKey + +`string` + +## Returns + +`Promise`\<`string`\> diff --git a/sdks/api-key-stamper/readme.mdx b/sdks/api-key-stamper/readme.mdx new file mode 100644 index 00000000..bd9fc356 --- /dev/null +++ b/sdks/api-key-stamper/readme.mdx @@ -0,0 +1,36 @@ +--- +title: "API Key Stamper" +mode: wide +--- + +# @turnkey/api-key-stamper + +[![npm](https://img.shields.io/npm/v/@turnkey/api-key-stamper?color=%234C48FF)](https://www.npmjs.com/package/@turnkey/api-key-stamper) + +This package contains functions to stamp a Turnkey request. It is meant to be used with [`@turnkey/http`](https://www.npmjs.com/package/@turnkey/http) + +Usage: + +```ts +import { ApiKeyStamper } from "@turnkey/api-key-stamper"; +import { TurnkeyClient } from "@turnkey/http"; + +const stamper = new ApiKeyStamper({ + apiPublicKey: "...", + apiPrivateKey: "...", +}); + +const httpClient = new TurnkeyClient( + { baseUrl: "https://api.turnkey.com" }, + stamper +); +``` + +## Documents + +- [ApiKeyStamper](ApiKeyStamper/readme) + + +## Modules + +- [index](index/readme) diff --git a/sdks/cosmjs/documents/docs/readme.mdx b/sdks/cosmjs/documents/docs/readme.mdx new file mode 100644 index 00000000..a29d90ea --- /dev/null +++ b/sdks/cosmjs/documents/docs/readme.mdx @@ -0,0 +1,30 @@ +--- +title: "Docs" +mode: wide +--- + +[**Documentation**](../../../readme) + +*** + +[Documentation](../../../modules) / [cosmjs](../../readme) / documents/docs + +--- +title: "CosmJS" +description: "[`@turnkey/cosmjs`](https://www.npmjs.com/package/@turnkey/cosmjs) exports a `TurnkeyDirectWallet` that serves as a drop-in replacement for a CosmJS direct wallet. It includes support for `signDirect`. See full implementation [here](https://github.com/tkhq/sdk/tree/main/packages/cosmjs) for more details and examples." +mode: wide +--- + +```js +// Initialize a Turnkey Signer +const turnkeySigner = await TurnkeyDirectWallet.init({ + config: { + ... + }, + prefix: "celestia", // can be replaced with other Cosmos chains +}); + +const account = refineNonNull((await turnkeySigner.getAccounts())[0]); +const compressedPublicKey = toHex(account.pubkey); +const selfAddress = account.address; +``` diff --git a/sdks/cosmjs/index/TurnkeyActivityError/readme.mdx b/sdks/cosmjs/index/TurnkeyActivityError/readme.mdx new file mode 100644 index 00000000..b10135ab --- /dev/null +++ b/sdks/cosmjs/index/TurnkeyActivityError/readme.mdx @@ -0,0 +1,84 @@ +--- +title: "TurnkeyActivityError" +mode: wide +--- + +# Class: TurnkeyActivityError + +Defined in: http/dist/shared.d.ts:9 + +## Extends + +- `Error` + +## Constructors + +### Constructor + +> **new TurnkeyActivityError**(`input`): `TurnkeyActivityError` + +Defined in: http/dist/shared.d.ts:14 + +#### Parameters + +##### input + +###### activityId? + +`string` + +###### activityStatus? + +`"ACTIVITY_STATUS_CREATED"` \| `"ACTIVITY_STATUS_PENDING"` \| `"ACTIVITY_STATUS_COMPLETED"` \| `"ACTIVITY_STATUS_FAILED"` \| `"ACTIVITY_STATUS_CONSENSUS_NEEDED"` \| `"ACTIVITY_STATUS_REJECTED"` + +###### activityType? + +`"ACTIVITY_TYPE_SIGN_RAW_PAYLOAD_V2"` \| `"ACTIVITY_TYPE_CREATE_API_KEYS"` \| `"ACTIVITY_TYPE_CREATE_USERS"` \| `"ACTIVITY_TYPE_CREATE_PRIVATE_KEYS"` \| `"ACTIVITY_TYPE_SIGN_RAW_PAYLOAD"` \| `"ACTIVITY_TYPE_CREATE_INVITATIONS"` \| `"ACTIVITY_TYPE_ACCEPT_INVITATION"` \| `"ACTIVITY_TYPE_CREATE_POLICY"` \| `"ACTIVITY_TYPE_DISABLE_PRIVATE_KEY"` \| `"ACTIVITY_TYPE_DELETE_USERS"` \| `"ACTIVITY_TYPE_DELETE_API_KEYS"` \| `"ACTIVITY_TYPE_DELETE_INVITATION"` \| `"ACTIVITY_TYPE_DELETE_ORGANIZATION"` \| `"ACTIVITY_TYPE_DELETE_POLICY"` \| `"ACTIVITY_TYPE_CREATE_USER_TAG"` \| `"ACTIVITY_TYPE_DELETE_USER_TAGS"` \| `"ACTIVITY_TYPE_CREATE_ORGANIZATION"` \| `"ACTIVITY_TYPE_SIGN_TRANSACTION"` \| `"ACTIVITY_TYPE_APPROVE_ACTIVITY"` \| `"ACTIVITY_TYPE_REJECT_ACTIVITY"` \| `"ACTIVITY_TYPE_DELETE_AUTHENTICATORS"` \| `"ACTIVITY_TYPE_CREATE_AUTHENTICATORS"` \| `"ACTIVITY_TYPE_CREATE_PRIVATE_KEY_TAG"` \| `"ACTIVITY_TYPE_DELETE_PRIVATE_KEY_TAGS"` \| `"ACTIVITY_TYPE_SET_PAYMENT_METHOD"` \| `"ACTIVITY_TYPE_ACTIVATE_BILLING_TIER"` \| `"ACTIVITY_TYPE_DELETE_PAYMENT_METHOD"` \| `"ACTIVITY_TYPE_CREATE_POLICY_V2"` \| `"ACTIVITY_TYPE_CREATE_POLICY_V3"` \| `"ACTIVITY_TYPE_CREATE_API_ONLY_USERS"` \| `"ACTIVITY_TYPE_UPDATE_ROOT_QUORUM"` \| `"ACTIVITY_TYPE_UPDATE_USER_TAG"` \| `"ACTIVITY_TYPE_UPDATE_PRIVATE_KEY_TAG"` \| `"ACTIVITY_TYPE_CREATE_AUTHENTICATORS_V2"` \| `"ACTIVITY_TYPE_CREATE_ORGANIZATION_V2"` \| `"ACTIVITY_TYPE_CREATE_USERS_V2"` \| `"ACTIVITY_TYPE_ACCEPT_INVITATION_V2"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V2"` \| `"ACTIVITY_TYPE_UPDATE_ALLOWED_ORIGINS"` \| `"ACTIVITY_TYPE_CREATE_PRIVATE_KEYS_V2"` \| `"ACTIVITY_TYPE_UPDATE_USER"` \| `"ACTIVITY_TYPE_UPDATE_POLICY"` \| `"ACTIVITY_TYPE_SET_PAYMENT_METHOD_V2"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V3"` \| `"ACTIVITY_TYPE_CREATE_WALLET"` \| `"ACTIVITY_TYPE_CREATE_WALLET_ACCOUNTS"` \| `"ACTIVITY_TYPE_INIT_USER_EMAIL_RECOVERY"` \| `"ACTIVITY_TYPE_RECOVER_USER"` \| `"ACTIVITY_TYPE_SET_ORGANIZATION_FEATURE"` \| `"ACTIVITY_TYPE_REMOVE_ORGANIZATION_FEATURE"` \| `"ACTIVITY_TYPE_SIGN_TRANSACTION_V2"` \| `"ACTIVITY_TYPE_EXPORT_PRIVATE_KEY"` \| `"ACTIVITY_TYPE_EXPORT_WALLET"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V4"` \| `"ACTIVITY_TYPE_EMAIL_AUTH"` \| `"ACTIVITY_TYPE_EXPORT_WALLET_ACCOUNT"` \| `"ACTIVITY_TYPE_INIT_IMPORT_WALLET"` \| `"ACTIVITY_TYPE_IMPORT_WALLET"` \| `"ACTIVITY_TYPE_INIT_IMPORT_PRIVATE_KEY"` \| `"ACTIVITY_TYPE_IMPORT_PRIVATE_KEY"` \| `"ACTIVITY_TYPE_CREATE_POLICIES"` \| `"ACTIVITY_TYPE_SIGN_RAW_PAYLOADS"` \| `"ACTIVITY_TYPE_CREATE_READ_ONLY_SESSION"` \| `"ACTIVITY_TYPE_CREATE_OAUTH_PROVIDERS"` \| `"ACTIVITY_TYPE_DELETE_OAUTH_PROVIDERS"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V5"` \| `"ACTIVITY_TYPE_OAUTH"` \| `"ACTIVITY_TYPE_CREATE_API_KEYS_V2"` \| `"ACTIVITY_TYPE_CREATE_READ_WRITE_SESSION"` \| `"ACTIVITY_TYPE_EMAIL_AUTH_V2"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V6"` \| `"ACTIVITY_TYPE_DELETE_PRIVATE_KEYS"` \| `"ACTIVITY_TYPE_DELETE_WALLETS"` \| `"ACTIVITY_TYPE_CREATE_READ_WRITE_SESSION_V2"` \| `"ACTIVITY_TYPE_DELETE_SUB_ORGANIZATION"` \| `"ACTIVITY_TYPE_INIT_OTP_AUTH"` \| `"ACTIVITY_TYPE_OTP_AUTH"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V7"` \| `"ACTIVITY_TYPE_UPDATE_WALLET"` \| `"ACTIVITY_TYPE_UPDATE_POLICY_V2"` \| `"ACTIVITY_TYPE_CREATE_USERS_V3"` \| `"ACTIVITY_TYPE_INIT_OTP_AUTH_V2"` + +###### cause? + +`Error` + +###### message + +`string` + +#### Returns + +`TurnkeyActivityError` + +#### Overrides + +`Error.constructor` + +## Properties + +### activityId + +> **activityId**: `undefined` \| `string` + +Defined in: http/dist/shared.d.ts:10 + +*** + +### activityStatus + +> **activityStatus**: `undefined` \| `"ACTIVITY_STATUS_CREATED"` \| `"ACTIVITY_STATUS_PENDING"` \| `"ACTIVITY_STATUS_COMPLETED"` \| `"ACTIVITY_STATUS_FAILED"` \| `"ACTIVITY_STATUS_CONSENSUS_NEEDED"` \| `"ACTIVITY_STATUS_REJECTED"` + +Defined in: http/dist/shared.d.ts:11 + +*** + +### activityType + +> **activityType**: `undefined` \| `"ACTIVITY_TYPE_SIGN_RAW_PAYLOAD_V2"` \| `"ACTIVITY_TYPE_CREATE_API_KEYS"` \| `"ACTIVITY_TYPE_CREATE_USERS"` \| `"ACTIVITY_TYPE_CREATE_PRIVATE_KEYS"` \| `"ACTIVITY_TYPE_SIGN_RAW_PAYLOAD"` \| `"ACTIVITY_TYPE_CREATE_INVITATIONS"` \| `"ACTIVITY_TYPE_ACCEPT_INVITATION"` \| `"ACTIVITY_TYPE_CREATE_POLICY"` \| `"ACTIVITY_TYPE_DISABLE_PRIVATE_KEY"` \| `"ACTIVITY_TYPE_DELETE_USERS"` \| `"ACTIVITY_TYPE_DELETE_API_KEYS"` \| `"ACTIVITY_TYPE_DELETE_INVITATION"` \| `"ACTIVITY_TYPE_DELETE_ORGANIZATION"` \| `"ACTIVITY_TYPE_DELETE_POLICY"` \| `"ACTIVITY_TYPE_CREATE_USER_TAG"` \| `"ACTIVITY_TYPE_DELETE_USER_TAGS"` \| `"ACTIVITY_TYPE_CREATE_ORGANIZATION"` \| `"ACTIVITY_TYPE_SIGN_TRANSACTION"` \| `"ACTIVITY_TYPE_APPROVE_ACTIVITY"` \| `"ACTIVITY_TYPE_REJECT_ACTIVITY"` \| `"ACTIVITY_TYPE_DELETE_AUTHENTICATORS"` \| `"ACTIVITY_TYPE_CREATE_AUTHENTICATORS"` \| `"ACTIVITY_TYPE_CREATE_PRIVATE_KEY_TAG"` \| `"ACTIVITY_TYPE_DELETE_PRIVATE_KEY_TAGS"` \| `"ACTIVITY_TYPE_SET_PAYMENT_METHOD"` \| `"ACTIVITY_TYPE_ACTIVATE_BILLING_TIER"` \| `"ACTIVITY_TYPE_DELETE_PAYMENT_METHOD"` \| `"ACTIVITY_TYPE_CREATE_POLICY_V2"` \| `"ACTIVITY_TYPE_CREATE_POLICY_V3"` \| `"ACTIVITY_TYPE_CREATE_API_ONLY_USERS"` \| `"ACTIVITY_TYPE_UPDATE_ROOT_QUORUM"` \| `"ACTIVITY_TYPE_UPDATE_USER_TAG"` \| `"ACTIVITY_TYPE_UPDATE_PRIVATE_KEY_TAG"` \| `"ACTIVITY_TYPE_CREATE_AUTHENTICATORS_V2"` \| `"ACTIVITY_TYPE_CREATE_ORGANIZATION_V2"` \| `"ACTIVITY_TYPE_CREATE_USERS_V2"` \| `"ACTIVITY_TYPE_ACCEPT_INVITATION_V2"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V2"` \| `"ACTIVITY_TYPE_UPDATE_ALLOWED_ORIGINS"` \| `"ACTIVITY_TYPE_CREATE_PRIVATE_KEYS_V2"` \| `"ACTIVITY_TYPE_UPDATE_USER"` \| `"ACTIVITY_TYPE_UPDATE_POLICY"` \| `"ACTIVITY_TYPE_SET_PAYMENT_METHOD_V2"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V3"` \| `"ACTIVITY_TYPE_CREATE_WALLET"` \| `"ACTIVITY_TYPE_CREATE_WALLET_ACCOUNTS"` \| `"ACTIVITY_TYPE_INIT_USER_EMAIL_RECOVERY"` \| `"ACTIVITY_TYPE_RECOVER_USER"` \| `"ACTIVITY_TYPE_SET_ORGANIZATION_FEATURE"` \| `"ACTIVITY_TYPE_REMOVE_ORGANIZATION_FEATURE"` \| `"ACTIVITY_TYPE_SIGN_TRANSACTION_V2"` \| `"ACTIVITY_TYPE_EXPORT_PRIVATE_KEY"` \| `"ACTIVITY_TYPE_EXPORT_WALLET"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V4"` \| `"ACTIVITY_TYPE_EMAIL_AUTH"` \| `"ACTIVITY_TYPE_EXPORT_WALLET_ACCOUNT"` \| `"ACTIVITY_TYPE_INIT_IMPORT_WALLET"` \| `"ACTIVITY_TYPE_IMPORT_WALLET"` \| `"ACTIVITY_TYPE_INIT_IMPORT_PRIVATE_KEY"` \| `"ACTIVITY_TYPE_IMPORT_PRIVATE_KEY"` \| `"ACTIVITY_TYPE_CREATE_POLICIES"` \| `"ACTIVITY_TYPE_SIGN_RAW_PAYLOADS"` \| `"ACTIVITY_TYPE_CREATE_READ_ONLY_SESSION"` \| `"ACTIVITY_TYPE_CREATE_OAUTH_PROVIDERS"` \| `"ACTIVITY_TYPE_DELETE_OAUTH_PROVIDERS"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V5"` \| `"ACTIVITY_TYPE_OAUTH"` \| `"ACTIVITY_TYPE_CREATE_API_KEYS_V2"` \| `"ACTIVITY_TYPE_CREATE_READ_WRITE_SESSION"` \| `"ACTIVITY_TYPE_EMAIL_AUTH_V2"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V6"` \| `"ACTIVITY_TYPE_DELETE_PRIVATE_KEYS"` \| `"ACTIVITY_TYPE_DELETE_WALLETS"` \| `"ACTIVITY_TYPE_CREATE_READ_WRITE_SESSION_V2"` \| `"ACTIVITY_TYPE_DELETE_SUB_ORGANIZATION"` \| `"ACTIVITY_TYPE_INIT_OTP_AUTH"` \| `"ACTIVITY_TYPE_OTP_AUTH"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V7"` \| `"ACTIVITY_TYPE_UPDATE_WALLET"` \| `"ACTIVITY_TYPE_UPDATE_POLICY_V2"` \| `"ACTIVITY_TYPE_CREATE_USERS_V3"` \| `"ACTIVITY_TYPE_INIT_OTP_AUTH_V2"` + +Defined in: http/dist/shared.d.ts:12 + +*** + +### cause + +> **cause**: `undefined` \| `Error` + +Defined in: http/dist/shared.d.ts:13 diff --git a/sdks/cosmjs/index/TurnkeyDirectWallet/readme.mdx b/sdks/cosmjs/index/TurnkeyDirectWallet/readme.mdx new file mode 100644 index 00000000..1b642965 --- /dev/null +++ b/sdks/cosmjs/index/TurnkeyDirectWallet/readme.mdx @@ -0,0 +1,126 @@ +--- +title: "TurnkeyDirectWallet" +mode: wide +--- + +# Class: TurnkeyDirectWallet + +Defined in: [cosmjs/src/index.ts:41](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/cosmjs/src/index.ts#L41) + +## Implements + +- `OfflineDirectSigner` + +## Properties + +### organizationId + +> `readonly` **organizationId**: `string` + +Defined in: [cosmjs/src/index.ts:90](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/cosmjs/src/index.ts#L90) + +*** + +### prefix + +> `readonly` **prefix**: `string` + +Defined in: [cosmjs/src/index.ts:89](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/cosmjs/src/index.ts#L89) + +*** + +### signWith + +> `readonly` **signWith**: `string` + +Defined in: [cosmjs/src/index.ts:91](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/cosmjs/src/index.ts#L91) + +## Methods + +### getAccounts() + +> **getAccounts**(): `Promise`\ + +Defined in: [cosmjs/src/index.ts:122](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/cosmjs/src/index.ts#L122) + +#### Returns + +`Promise`\ + +#### Implementation of + +`OfflineDirectSigner.getAccounts` + +*** + +### signDirect() + +> **signDirect**(`address`, `signDoc`): `Promise`\<`DirectSignResponse`\> + +Defined in: [cosmjs/src/index.ts:132](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/cosmjs/src/index.ts#L132) + +#### Parameters + +##### address + +`string` + +##### signDoc + +`SignDoc` + +#### Returns + +`Promise`\<`DirectSignResponse`\> + +#### Implementation of + +`OfflineDirectSigner.signDirect` + +*** + +### init() + +> `static` **init**(`input`): `Promise`\<`TurnkeyDirectWallet`\> + +Defined in: [cosmjs/src/index.ts:42](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/cosmjs/src/index.ts#L42) + +#### Parameters + +##### input + +###### config + +`TConfig` + +###### prefix? + +`string` + +#### Returns + +`Promise`\<`TurnkeyDirectWallet`\> + +*** + +### initWithPublicKey() + +> `static` **initWithPublicKey**(`input`): `TurnkeyDirectWallet` + +Defined in: [cosmjs/src/index.ts:73](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/cosmjs/src/index.ts#L73) + +#### Parameters + +##### input + +###### config + +`TConfig` + +###### prefix? + +`string` + +#### Returns + +`TurnkeyDirectWallet` diff --git a/sdks/cosmjs/index/TurnkeyRequestError/readme.mdx b/sdks/cosmjs/index/TurnkeyRequestError/readme.mdx new file mode 100644 index 00000000..0e296410 --- /dev/null +++ b/sdks/cosmjs/index/TurnkeyRequestError/readme.mdx @@ -0,0 +1,50 @@ +--- +title: "TurnkeyRequestError" +mode: wide +--- + +# Class: TurnkeyRequestError + +Defined in: http/dist/base.d.ts:84 + +## Extends + +- `Error` + +## Constructors + +### Constructor + +> **new TurnkeyRequestError**(`input`): `TurnkeyRequestError` + +Defined in: http/dist/base.d.ts:87 + +#### Parameters + +##### input + +`GrpcStatus` + +#### Returns + +`TurnkeyRequestError` + +#### Overrides + +`Error.constructor` + +## Properties + +### code + +> **code**: `number` + +Defined in: http/dist/base.d.ts:86 + +*** + +### details + +> **details**: `null` \| `any`[] + +Defined in: http/dist/base.d.ts:85 diff --git a/sdks/cosmjs/index/fetchCompressedPublicKey/readme.mdx b/sdks/cosmjs/index/fetchCompressedPublicKey/readme.mdx new file mode 100644 index 00000000..a9406361 --- /dev/null +++ b/sdks/cosmjs/index/fetchCompressedPublicKey/readme.mdx @@ -0,0 +1,30 @@ +--- +title: "FetchCompressedPublicKey" +mode: wide +--- + +# Function: fetchCompressedPublicKey() + +> **fetchCompressedPublicKey**(`input`): `Promise`\<\{ `compressedPublicKey`: `Uint8Array`; \}\> + +Defined in: [cosmjs/src/index.ts:210](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/cosmjs/src/index.ts#L210) + +## Parameters + +### input + +#### client + +`TurnkeyClient` \| [`TurnkeyBrowserClient`](../../../sdk-browser/index/TurnkeyBrowserClient/readme) \| [`TurnkeyServerClient`](../../../sdk-server/index/TurnkeyServerClient/readme) + +#### organizationId + +`string` + +#### privateKeyId + +`string` + +## Returns + +`Promise`\<\{ `compressedPublicKey`: `Uint8Array`; \}\> diff --git a/sdks/cosmjs/index/readme.mdx b/sdks/cosmjs/index/readme.mdx new file mode 100644 index 00000000..d4804518 --- /dev/null +++ b/sdks/cosmjs/index/readme.mdx @@ -0,0 +1,16 @@ +--- +title: "Index" +mode: wide +--- + +# index + +## Classes + +- [TurnkeyActivityError](TurnkeyActivityError/readme) +- [TurnkeyDirectWallet](TurnkeyDirectWallet/readme) +- [TurnkeyRequestError](TurnkeyRequestError/readme) + +## Functions + +- [fetchCompressedPublicKey](fetchCompressedPublicKey/readme) diff --git a/sdks/cosmjs/readme.mdx b/sdks/cosmjs/readme.mdx new file mode 100644 index 00000000..67edf369 --- /dev/null +++ b/sdks/cosmjs/readme.mdx @@ -0,0 +1,41 @@ +--- +title: "Cosmjs" +mode: wide +--- + +# @turnkey/cosmjs + +[![npm](https://img.shields.io/npm/v/@turnkey/cosmjs?color=%234C48FF)](https://www.npmjs.com/package/@turnkey/cosmjs) + +Experimental [Turnkey](https://turnkey.com) Cosmos Signer for [`CosmJS`](https://github.com/cosmos/cosmjs): + +- `TurnkeyDirectWallet` is a drop-in replacement for [`DirectSecp256k1Wallet`](https://github.com/cosmos/cosmjs/blob/e8e65aa0c145616ccb58625c32bffe08b46ff574/packages/proto-signing/src/directsecp256k1wallet.ts#LL14C14-L14C35) that conforms to the `OfflineDirectSigner` interface. + +If you need a lower-level, fully typed HTTP client for interacting with Turnkey API, check out [`@turnkey/http`](https://www.npmjs.com/package/@turnkey/http). + +API Docs: https://docs.turnkey.com/ + +## Getting started + +```bash +$ npm install @turnkey/cosmjs +``` + +## Examples + +| Example | Description | +| --------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | +| [`with-cosmjs`](https://github.com/tkhq/sdk/tree/main/examples/with-cosmjs) | Create a new Cosmos address, then sign and broadcast a transaction on Celestia testnet via CosmJS | + +## See also + +- [`@turnkey/http`](https://www.npmjs.com/package/@turnkey/http): lower-level fully typed HTTP client for interacting with Turnkey API + +## Documents + +- [documents/docs](documents/docs/readme) + + +## Modules + +- [index](index/readme) diff --git a/sdks/crypto/index/buildAdditionalAssociatedData/readme.mdx b/sdks/crypto/index/buildAdditionalAssociatedData/readme.mdx new file mode 100644 index 00000000..2cfd2d36 --- /dev/null +++ b/sdks/crypto/index/buildAdditionalAssociatedData/readme.mdx @@ -0,0 +1,28 @@ +--- +title: "BuildAdditionalAssociatedData" +mode: wide +--- + +# Function: buildAdditionalAssociatedData() + +> **buildAdditionalAssociatedData**(`senderPubBuf`, `receiverPubBuf`): `Uint8Array` + +Defined in: [crypto.ts:294](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/crypto/src/crypto.ts#L294) + +Create additional associated data (AAD) for AES-GCM decryption. + +## Parameters + +### senderPubBuf + +`Uint8Array` + +### receiverPubBuf + +`Uint8Array` + +## Returns + +`Uint8Array` + +- The resulting concatenation of sender and receiver pubkeys. diff --git a/sdks/crypto/index/compressRawPublicKey/readme.mdx b/sdks/crypto/index/compressRawPublicKey/readme.mdx new file mode 100644 index 00000000..6f0b9eaa --- /dev/null +++ b/sdks/crypto/index/compressRawPublicKey/readme.mdx @@ -0,0 +1,26 @@ +--- +title: "CompressRawPublicKey" +mode: wide +--- + +# Function: compressRawPublicKey() + +> **compressRawPublicKey**(`rawPublicKey`): `Uint8Array` + +Defined in: [crypto.ts:322](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/crypto/src/crypto.ts#L322) + +Accepts a public key Uint8Array, and returns a Uint8Array with the compressed version of the public key. + +## Parameters + +### rawPublicKey + +`Uint8Array` + +The raw public key. + +## Returns + +`Uint8Array` + +– The compressed public key. diff --git a/sdks/crypto/index/decryptCredentialBundle/readme.mdx b/sdks/crypto/index/decryptCredentialBundle/readme.mdx new file mode 100644 index 00000000..a83bfa36 --- /dev/null +++ b/sdks/crypto/index/decryptCredentialBundle/readme.mdx @@ -0,0 +1,36 @@ +--- +title: "DecryptCredentialBundle" +mode: wide +--- + +# Function: decryptCredentialBundle() + +> **decryptCredentialBundle**(`credentialBundle`, `embeddedKey`): `string` + +Defined in: [turnkey.ts:59](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/crypto/src/turnkey.ts#L59) + +Decrypt an encrypted email auth/recovery or oauth credential bundle. + +## Parameters + +### credentialBundle + +`string` + +The encrypted credential bundle. + +### embeddedKey + +`string` + +The private key for decryption. + +## Returns + +`string` + +- The decrypted data or null if decryption fails. + +## Throws + +- If unable to decrypt the credential bundle diff --git a/sdks/crypto/index/decryptExportBundle/readme.mdx b/sdks/crypto/index/decryptExportBundle/readme.mdx new file mode 100644 index 00000000..5859c9e6 --- /dev/null +++ b/sdks/crypto/index/decryptExportBundle/readme.mdx @@ -0,0 +1,40 @@ +--- +title: "DecryptExportBundle" +mode: wide +--- + +# Function: decryptExportBundle() + +> **decryptExportBundle**(`params`): `Promise`\<`string`\> + +Defined in: [turnkey.ts:103](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/crypto/src/turnkey.ts#L103) + +Decrypt an encrypted export bundle (such as a private key or wallet account bundle). + +This function verifies the enclave signature to ensure the authenticity of the encrypted data. +It uses HPKE (Hybrid Public Key Encryption) to decrypt the contents of the bundle and returns +either the decrypted mnemonic or the decrypted data in hexadecimal format, based on the +`returnMnemonic` flag. + +## Parameters + +### params + +`DecryptExportBundleParams` + +An object containing the following properties: + - exportBundle {string}: The encrypted export bundle in JSON format. + - organizationId {string}: The expected organization ID to verify against the signed data. + - embeddedKey {string}: The private key used for decrypting the data. + - dangerouslyOverrideSignerPublicKey {string} [Optional]: Optionally override the default signer public key used for verifying the signature. This should only be done for testing + - returnMnemonic {boolean}: If true, returns the decrypted data as a mnemonic string; otherwise, returns it in hexadecimal format. + +## Returns + +`Promise`\<`string`\> + +- A promise that resolves to the decrypted mnemonic or decrypted hexadecimal data. + +## Throws + +- If decryption or signature verification fails, throws an error with details. diff --git a/sdks/crypto/index/encryptPrivateKeyToBundle/readme.mdx b/sdks/crypto/index/encryptPrivateKeyToBundle/readme.mdx new file mode 100644 index 00000000..df15c0a3 --- /dev/null +++ b/sdks/crypto/index/encryptPrivateKeyToBundle/readme.mdx @@ -0,0 +1,30 @@ +--- +title: "EncryptPrivateKeyToBundle" +mode: wide +--- + +# Function: encryptPrivateKeyToBundle() + +> **encryptPrivateKeyToBundle**(`params`): `Promise`\<`string`\> + +Defined in: [turnkey.ts:304](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/crypto/src/turnkey.ts#L304) + +Encrypts a private key bundle using HPKE and verifies the enclave signature. + +## Parameters + +### params + +`EncryptPrivateKeyToBundleParams` + +An object containing the private key, key format, bundle, user, and organization details. Optionally, you can override the default signer key (for testing purposes) + +## Returns + +`Promise`\<`string`\> + +- A promise that resolves to a JSON string representing the encrypted bundle. + +## Throws + +- If enclave signature verification or any other validation fails. diff --git a/sdks/crypto/index/encryptWalletToBundle/readme.mdx b/sdks/crypto/index/encryptWalletToBundle/readme.mdx new file mode 100644 index 00000000..0f9aeb23 --- /dev/null +++ b/sdks/crypto/index/encryptWalletToBundle/readme.mdx @@ -0,0 +1,35 @@ +--- +title: "EncryptWalletToBundle" +mode: wide +--- + +# Function: encryptWalletToBundle() + +> **encryptWalletToBundle**(`params`): `Promise`\<`string`\> + +Defined in: [turnkey.ts:360](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/crypto/src/turnkey.ts#L360) + +/** + * Encrypts a mnemonic wallet bundle using HPKE and verifies the enclave signature. + * + * + +## Parameters + +### params + +`EncryptWalletToBundleParams` + +An object containing the mnemonic, bundle, user, and organization details. Optionally, you can override the default signer key (for testing purposes). + * + +## Returns + +`Promise`\<`string`\> + +- A promise that resolves to a JSON string representing the encrypted wallet bundle. + * + +## Throws + +- If enclave signature verification or any other validation fails. diff --git a/sdks/crypto/index/extractPrivateKeyFromPKCS8Bytes/readme.mdx b/sdks/crypto/index/extractPrivateKeyFromPKCS8Bytes/readme.mdx new file mode 100644 index 00000000..3d7a932d --- /dev/null +++ b/sdks/crypto/index/extractPrivateKeyFromPKCS8Bytes/readme.mdx @@ -0,0 +1,26 @@ +--- +title: "ExtractPrivateKeyFromPKCS8Bytes" +mode: wide +--- + +# Function: extractPrivateKeyFromPKCS8Bytes() + +> **extractPrivateKeyFromPKCS8Bytes**(`privateKey`): `Uint8Array` + +Defined in: [crypto.ts:310](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/crypto/src/crypto.ts#L310) + +Accepts a private key Uint8Array in the PKCS8 format, and returns the encapsulated private key. + +## Parameters + +### privateKey + +`Uint8Array` + +A PKCS#8 private key structured with the key data at a specific position. The actual key starts at byte 36 and is 32 bytes long. + +## Returns + +`Uint8Array` + +- The private key. diff --git a/sdks/crypto/index/formatHpkeBuf/readme.mdx b/sdks/crypto/index/formatHpkeBuf/readme.mdx new file mode 100644 index 00000000..a517b307 --- /dev/null +++ b/sdks/crypto/index/formatHpkeBuf/readme.mdx @@ -0,0 +1,27 @@ +--- +title: "FormatHpkeBuf" +mode: wide +--- + +# Function: formatHpkeBuf() + +> **formatHpkeBuf**(`encryptedBuf`): `string` + +Defined in: [crypto.ts:202](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/crypto/src/crypto.ts#L202) + +Format HPKE Buffer Function +Returns a JSON string of an encrypted bundle, separating out the cipher text and the sender public key + +## Parameters + +### encryptedBuf + +`Uint8Array` + +The result of hpkeAuthEncrypt or hpkeEncrypt + +## Returns + +`string` + +- A JSON string with "encappedPublic" and "ciphertext" diff --git a/sdks/crypto/index/fromDerSignature/readme.mdx b/sdks/crypto/index/fromDerSignature/readme.mdx new file mode 100644 index 00000000..5a8295e8 --- /dev/null +++ b/sdks/crypto/index/fromDerSignature/readme.mdx @@ -0,0 +1,26 @@ +--- +title: "FromDerSignature" +mode: wide +--- + +# Function: fromDerSignature() + +> **fromDerSignature**(`derSignature`): `Uint8Array` + +Defined in: [crypto.ts:528](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/crypto/src/crypto.ts#L528) + +Converts an ASN.1 DER-encoded ECDSA signature to the raw format used for verification. + +## Parameters + +### derSignature + +`string` + +The DER-encoded signature. + +## Returns + +`Uint8Array` + +- The raw signature. diff --git a/sdks/crypto/index/generateP256KeyPair/readme.mdx b/sdks/crypto/index/generateP256KeyPair/readme.mdx new file mode 100644 index 00000000..8f1a0bbe --- /dev/null +++ b/sdks/crypto/index/generateP256KeyPair/readme.mdx @@ -0,0 +1,18 @@ +--- +title: "GenerateP256KeyPair" +mode: wide +--- + +# Function: generateP256KeyPair() + +> **generateP256KeyPair**(): `KeyPair` + +Defined in: [crypto.ts:274](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/crypto/src/crypto.ts#L274) + +Generate a P-256 key pair. Contains the hexed privateKey, publicKey, and Uncompressed publicKey + +## Returns + +`KeyPair` + +- The generated key pair. diff --git a/sdks/crypto/index/getPublicKey/readme.mdx b/sdks/crypto/index/getPublicKey/readme.mdx new file mode 100644 index 00000000..f463765c --- /dev/null +++ b/sdks/crypto/index/getPublicKey/readme.mdx @@ -0,0 +1,33 @@ +--- +title: "GetPublicKey" +mode: wide +--- + +# Function: getPublicKey() + +> **getPublicKey**(`privateKey`, `isCompressed`): `Uint8Array` + +Defined in: [crypto.ts:56](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/crypto/src/crypto.ts#L56) + +Get PublicKey function +Derives public key from Uint8Array or hexstring private key + +## Parameters + +### privateKey + +The Uint8Array or hexstring representation of a compressed private key. + +`string` | `Uint8Array` + +### isCompressed + +`boolean` = `true` + +Specifies whether to return a compressed or uncompressed public key. Defaults to true. + +## Returns + +`Uint8Array` + +- The public key in Uin8Array representation. diff --git a/sdks/crypto/index/hpkeAuthEncrypt/readme.mdx b/sdks/crypto/index/hpkeAuthEncrypt/readme.mdx new file mode 100644 index 00000000..bcddec36 --- /dev/null +++ b/sdks/crypto/index/hpkeAuthEncrypt/readme.mdx @@ -0,0 +1,27 @@ +--- +title: "HpkeAuthEncrypt" +mode: wide +--- + +# Function: hpkeAuthEncrypt() + +> **hpkeAuthEncrypt**(`params`): `Uint8Array` + +Defined in: [crypto.ts:138](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/crypto/src/crypto.ts#L138) + +HPKE Encrypt Function +Encrypts data using Authenticated ,Hybrid Public Key Encryption (HPKE) standard https://datatracker.ietf.org/doc/rfc9180/. + +## Parameters + +### params + +`HpkeAuthEncryptParams` + +The encryption parameters including plain text, encapsulated key, and sender private key. + +## Returns + +`Uint8Array` + +- The encrypted data. diff --git a/sdks/crypto/index/hpkeDecrypt/readme.mdx b/sdks/crypto/index/hpkeDecrypt/readme.mdx new file mode 100644 index 00000000..8bdf9de3 --- /dev/null +++ b/sdks/crypto/index/hpkeDecrypt/readme.mdx @@ -0,0 +1,27 @@ +--- +title: "HpkeDecrypt" +mode: wide +--- + +# Function: hpkeDecrypt() + +> **hpkeDecrypt**(`params`): `Uint8Array` + +Defined in: [crypto.ts:224](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/crypto/src/crypto.ts#L224) + +HPKE Decrypt Function +Decrypts data using Hybrid Public Key Encryption (HPKE) standard https://datatracker.ietf.org/doc/rfc9180/. + +## Parameters + +### params + +`HpkeDecryptParams` + +The decryption parameters including ciphertext, encapsulated key, and receiver private key. + +## Returns + +`Uint8Array` + +- The decrypted data. diff --git a/sdks/crypto/index/hpkeEncrypt/readme.mdx b/sdks/crypto/index/hpkeEncrypt/readme.mdx new file mode 100644 index 00000000..2510a2a1 --- /dev/null +++ b/sdks/crypto/index/hpkeEncrypt/readme.mdx @@ -0,0 +1,27 @@ +--- +title: "HpkeEncrypt" +mode: wide +--- + +# Function: hpkeEncrypt() + +> **hpkeEncrypt**(`params`): `Uint8Array` + +Defined in: [crypto.ts:71](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/crypto/src/crypto.ts#L71) + +HPKE Encrypt Function +Encrypts data using Hybrid Public Key Encryption (HPKE) standard https://datatracker.ietf.org/doc/rfc9180/. + +## Parameters + +### params + +`HpkeEncryptParams` + +The encryption parameters including plain text, encapsulated key, and sender private key. + +## Returns + +`Uint8Array` + +- The encrypted data. diff --git a/sdks/crypto/index/readme.mdx b/sdks/crypto/index/readme.mdx new file mode 100644 index 00000000..02469ccc --- /dev/null +++ b/sdks/crypto/index/readme.mdx @@ -0,0 +1,26 @@ +--- +title: "Index" +mode: wide +--- + +# index + +## Functions + +- [buildAdditionalAssociatedData](buildAdditionalAssociatedData/readme) +- [compressRawPublicKey](compressRawPublicKey/readme) +- [decryptCredentialBundle](decryptCredentialBundle/readme) +- [decryptExportBundle](decryptExportBundle/readme) +- [encryptPrivateKeyToBundle](encryptPrivateKeyToBundle/readme) +- [encryptWalletToBundle](encryptWalletToBundle/readme) +- [extractPrivateKeyFromPKCS8Bytes](extractPrivateKeyFromPKCS8Bytes/readme) +- [formatHpkeBuf](formatHpkeBuf/readme) +- [fromDerSignature](fromDerSignature/readme) +- [generateP256KeyPair](generateP256KeyPair/readme) +- [getPublicKey](getPublicKey/readme) +- [hpkeAuthEncrypt](hpkeAuthEncrypt/readme) +- [hpkeDecrypt](hpkeDecrypt/readme) +- [hpkeEncrypt](hpkeEncrypt/readme) +- [toDerSignature](toDerSignature/readme) +- [uncompressRawPublicKey](uncompressRawPublicKey/readme) +- [verifyStampSignature](verifyStampSignature/readme) diff --git a/sdks/crypto/index/toDerSignature/readme.mdx b/sdks/crypto/index/toDerSignature/readme.mdx new file mode 100644 index 00000000..c9bca899 --- /dev/null +++ b/sdks/crypto/index/toDerSignature/readme.mdx @@ -0,0 +1,44 @@ +--- +title: "ToDerSignature" +mode: wide +--- + +# Function: toDerSignature() + +> **toDerSignature**(`rawSignature`): `string` + +Defined in: [crypto.ts:584](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/crypto/src/crypto.ts#L584) + +Converts a raw ECDSA signature to DER-encoded format. + +This function takes a raw ECDSA signature, which is a concatenation of two 32-byte integers (r and s), +and converts it into the DER-encoded format. DER (Distinguished Encoding Rules) is a binary encoding +for data structures described by ASN.1. + +## Parameters + +### rawSignature + +`string` + +The raw signature in hexadecimal string format. + +## Returns + +`string` + +- The DER-encoded signature in hexadecimal string format. + +## Throws + +- Throws an error if the input signature is invalid or if the encoding process fails. + +## Example + +```ts +// Example usage: +const rawSignature = "0x487cdb8a88f2f4044b701cbb116075c4cabe5fe4657a6358b395c0aab70694db3453a8057e442bd1aff0ecabe8a82c831f0edd7f2158b7c1feb3de9b1f20309b1c"; +const derSignature = toDerSignature(rawSignature); +console.log(derSignature); // Outputs the DER-encoded signature as a hex string +// "30440220487cdb8a88f2f4044b701cbb116075c4cabe5fe4657a6358b395c0aab70694db02203453a8057e442bd1aff0ecabe8a82c831f0edd7f2158b7c1feb3de9b1f20309b" +``` diff --git a/sdks/crypto/index/uncompressRawPublicKey/readme.mdx b/sdks/crypto/index/uncompressRawPublicKey/readme.mdx new file mode 100644 index 00000000..eb399061 --- /dev/null +++ b/sdks/crypto/index/uncompressRawPublicKey/readme.mdx @@ -0,0 +1,26 @@ +--- +title: "UncompressRawPublicKey" +mode: wide +--- + +# Function: uncompressRawPublicKey() + +> **uncompressRawPublicKey**(`rawPublicKey`): `Uint8Array` + +Defined in: [crypto.ts:342](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/crypto/src/crypto.ts#L342) + +Accepts a public key array buffer, and returns a buffer with the uncompressed version of the public key + +## Parameters + +### rawPublicKey + +`Uint8Array` + +The public key. + +## Returns + +`Uint8Array` + +- The uncompressed public key. diff --git a/sdks/crypto/index/verifyStampSignature/readme.mdx b/sdks/crypto/index/verifyStampSignature/readme.mdx new file mode 100644 index 00000000..92b5f0df --- /dev/null +++ b/sdks/crypto/index/verifyStampSignature/readme.mdx @@ -0,0 +1,49 @@ +--- +title: "VerifyStampSignature" +mode: wide +--- + +# Function: verifyStampSignature() + +> **verifyStampSignature**(`publicKey`, `signature`, `signedData`): `Promise`\<`boolean`\> + +Defined in: [turnkey.ts:193](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/crypto/src/turnkey.ts#L193) + +Verifies a signature from a Turnkey stamp using ECDSA and SHA-256. + +## Parameters + +### publicKey + +`string` + +The public key of the authenticator (e.g. WebAuthn or P256 API key). + +### signature + +`string` + +The ECDSA signature in DER format. + +### signedData + +`string` + +The data that was signed (e.g. JSON-stringified Turnkey request body). + +## Returns + +`Promise`\<`boolean`\> + +- Returns true if the signature is valid, otherwise throws an error. + +## Example + +```ts +const stampedRequest = await turnkeyClient.stampGetWhoami(...); +const decodedStampContents = atob(stampedRequest.stamp.stampHeaderValue); +const parsedStampContents = JSON.parse(decodedStampContents); +const signature = parsedStampContents.signature; + +await verifyStampSignature(publicKey, signature, stampedRequest.body) +``` diff --git a/sdks/crypto/readme.mdx b/sdks/crypto/readme.mdx new file mode 100644 index 00000000..7ffa14a3 --- /dev/null +++ b/sdks/crypto/readme.mdx @@ -0,0 +1,48 @@ +--- +title: "Crypto" +mode: wide +--- + +# @turnkey/crypto + +This package consolidates some common cryptographic utilities used across our applications, particularly primitives related to keys, encryption, and decryption in a pure JS implementation. For react-native you will need to polyfill our random byte generation by importing [react-native-get-random-values](https://www.npmjs.com/package/react-native-get-random-values) + +Example usage (Hpke E2E): + +``` +const senderKeyPair = generateP256KeyPair(); +const receiverKeyPair = generateP256KeyPair(); + +const receiverPublicKeyUncompressed = uncompressRawPublicKey( + uint8ArrayFromHexString(receiverKeyPair.publicKey), +); + +const plainText = "Hello, this is a secure message!"; +const plainTextBuf = textEncoder.encode(plainText); +const encryptedData = hpkeEncrypt({ + plainTextBuf: plainTextBuf, + encappedKeyBuf: receiverPublicKeyUncompressed, + senderPriv: senderKeyPair.privateKey, +}); + +// Extract the encapsulated key buffer and the ciphertext +const encappedKeyBuf = encryptedData.slice(0, 33); +const ciphertextBuf = encryptedData.slice(33); + +const decryptedData = hpkeDecrypt({ + ciphertextBuf, + encappedKeyBuf: uncompressRawPublicKey(encappedKeyBuf), + receiverPriv: receiverKeyPair.privateKey, +}); + +// Convert decrypted data back to string +const decryptedText = new TextDecoder().decode(decryptedData); +``` + +## Documents + + + +## Modules + +- [index](index/readme) diff --git a/sdks/eip-1193-provider/documents/docs/readme.mdx b/sdks/eip-1193-provider/documents/docs/readme.mdx new file mode 100644 index 00000000..ae139397 --- /dev/null +++ b/sdks/eip-1193-provider/documents/docs/readme.mdx @@ -0,0 +1,18 @@ +--- +title: "Docs" +mode: wide +--- + +[**Documentation**](../../../readme) + +*** + +[Documentation](../../../modules) / [eip-1193-provider](../../readme) / documents/docs + +--- +title: "EIP 1193" +description: "[`@turnkey/eip-1193-provider`](https://www.npmjs.com/package/@turnkey/eip-1193-provider) is a Turnkey-compatible Ethereum provider that conforms to the [EIP-1193](https://eips.ethereum.org/EIPS/eip-1193) standard. It's built to seamlessly integrate with a broad spectrum of EVM-compatible chains, offering capabilities like account management, transaction signing, and blockchain interaction." +mode: wide +--- + +See [`with-eip-1193-provider`](https://github.com/tkhq/sdk/tree/main/examples/with-eip-1193-provider) for an example. diff --git a/sdks/eip-1193-provider/index/TurnkeyEIP1193Provider/readme.mdx b/sdks/eip-1193-provider/index/TurnkeyEIP1193Provider/readme.mdx new file mode 100644 index 00000000..fd82c3f9 --- /dev/null +++ b/sdks/eip-1193-provider/index/TurnkeyEIP1193Provider/readme.mdx @@ -0,0 +1,16 @@ +--- +title: "TurnkeyEIP1193Provider" +mode: wide +--- + +# Type Alias: TurnkeyEIP1193Provider + +> **TurnkeyEIP1193Provider** = `Omit`\<`EIP1193Provider`, `"request"`\> & `object` + +Defined in: [packages/eip-1193-provider/src/types.ts:22](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/eip-1193-provider/src/types.ts#L22) + +## Type declaration + +### request + +> **request**: `EIP1193RequestFn`\<\[`...EIP1474Methods`, \{ `Method`: `"eth_signTypedData_v4"`; `Parameters`: \[`Address`, `TypedDataDefinition`\]; `ReturnType`: `Promise`\<`Hash`\>; \}\]\> diff --git a/sdks/eip-1193-provider/index/createEIP1193Provider/readme.mdx b/sdks/eip-1193-provider/index/createEIP1193Provider/readme.mdx new file mode 100644 index 00000000..7fe3afe1 --- /dev/null +++ b/sdks/eip-1193-provider/index/createEIP1193Provider/readme.mdx @@ -0,0 +1,20 @@ +--- +title: "CreateEIP1193Provider" +mode: wide +--- + +# Function: createEIP1193Provider() + +> **createEIP1193Provider**(`options`): `Promise`\<\{ `on`: (`eventName`, `listener`) => `this`; `removeListener`: (`eventName`, `listener`) => `this`; `request`: `EIP1193RequestFn`\<\[\{\}, \{\}, \{\}, \{\}, \{\}\]\>; \}\> + +Defined in: [packages/eip-1193-provider/src/index.ts:31](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/eip-1193-provider/src/index.ts#L31) + +## Parameters + +### options + +`TurnkeyEIP1193ProviderOptions` + +## Returns + +`Promise`\<\{ `on`: (`eventName`, `listener`) => `this`; `removeListener`: (`eventName`, `listener`) => `this`; `request`: `EIP1193RequestFn`\<\[\{\}, \{\}, \{\}, \{\}, \{\}\]\>; \}\> diff --git a/sdks/eip-1193-provider/index/readme.mdx b/sdks/eip-1193-provider/index/readme.mdx new file mode 100644 index 00000000..89b9321d --- /dev/null +++ b/sdks/eip-1193-provider/index/readme.mdx @@ -0,0 +1,14 @@ +--- +title: "Index" +mode: wide +--- + +# index + +## Type Aliases + +- [TurnkeyEIP1193Provider](TurnkeyEIP1193Provider/readme) + +## Functions + +- [createEIP1193Provider](createEIP1193Provider/readme) diff --git a/sdks/eip-1193-provider/readme.mdx b/sdks/eip-1193-provider/readme.mdx new file mode 100644 index 00000000..6a5c9a3d --- /dev/null +++ b/sdks/eip-1193-provider/readme.mdx @@ -0,0 +1,148 @@ +--- +title: "Eip 1193 Provider" +mode: wide +--- + +# Turnkey EIP-1193 Provider + +The `@turnkey/eip-1193-provider` package delivers a Turnkey-compatible Ethereum provider that adheres to the EIP-1193 standards. It's built to integrate seamlessly with a broad spectrum of EVM-compatible chains, offering capabilities like account management, transaction signing, and blockchain interaction. This initial setup is intended for use in conjunction with the [`@turnkey/http`](https://www.npmjs.com/package/@turnkey/http) and [`@turnkey/webauthn-stamper`](https://www.npmjs.com/package/@turnkey/webauthn-stamper) package, for initial authentication. + +## Installation + +Before you start using the Turnkey EIP-1193 Provider, make sure to install the necessary packages in your project. This guide assumes you have a Node.js environment ready for development. + +Install the required packages using NPM or Yarn: + +```bash +npm install @turnkey/eip-1193-provider @turnkey/http @turnkey/webauthn-stamper +``` + +```bash +pnpm add @turnkey/eip-1193-provider @turnkey/http @turnkey/webauthn-stamper +``` + +```bash +yarn add @turnkey/eip-1193-provider @turnkey/http @turnkey/webauthn-stamper +``` + +## Initialization + +To set up the Turnkey EIP-1193 Provider, you need to initialize it with your configuration, which includes setting up the Turnkey client with your base URL and stamper. + +```ts +import { WebauthnStamper } from "@turnkey/webauthn-stamper"; +import { TurnkeyClient } from "@turnkey/http"; + +const stamper = new WebauthnStamper({ + rpId: "example.com", +}); + +// Initialize the Turnkey HTTP client +const turnkeyClient = new TurnkeyClient( + { baseUrl: "https://api.turnkey.com" }, + stamper, +); + +// Get the organizationId of the sub-organization connected to the users account +const { organizationId } = await turnkeyClient.getWhoami({ + organizationId: process.env.ORGANIZATION_ID, +}); + +// Get the user wallets associated with their sub-organization +const { wallets } = await turnkeyClient.getWallets({ + organizationId, +}); + +// Get the walletId to connect to the provider +const walletId = wallets[0].walletId; + +const chain = { + chainName: "Ethereum Mainnet", + chainId: "0x1", + rpcUrls: ["https://mainnet.infura.io/v3/your-infura-project-id"], +}; + +// Initialize the EIP-1193 Provider with your configuration +const provider = await createEIP1193Provider({ + walletId, + organizationId, + turnkeyClient, + chains: [ + chain, + // Add more chains as needed + ], +}); +``` + +## Usage + +### `eth_requestAccounts` + +Requests the user to provide an Ethereum address for identification, as specified by [EIP-1102](https://eips.ethereum.org/EIPS/eip-1102). This method initiates connectivity with the client and will prompt for passkey authentication. + +```javascript +const accounts = await provider.request({ method: "eth_requestAccounts" }); +// Logs the array accounts associated with the provided walletId & organization +console.log(accounts); +``` + +### Authentication Prompt Methods + +The following methods also prompt for passkey authentication: + +- `personal_sign`: Signs a message with the specified account. +- `eth_sign`: Signs data with the specified account. +- `eth_signTransaction`: Signs a transaction with the specified account. +- `eth_signTypedData_v4`: Signs typed data according to EIP-712 with the specified account. +- `eth_sendTransaction`: Submits a transaction to the network for execution. + +## Testing (Local) + +1. Copy `.env.example` to `.env` + + ```bash + $ cp .env.example .env + ``` + +2. Start the Anvil node in one shell: + + - Install [Foundry](https://book.getfoundry.sh/getting-started/installation) & Anvil if you haven't done so already + - Add Foundry to your `$PATH` + ```bash + $ export PATH="$PATH:$HOME/.foundry/bin" + ``` + - Source your env e.g. + ```bash + $ source ~/.zshrc + ``` + - Run `foundryup` to install `Anvil` + ```bash + $ foundryup + ``` + - Start Anvil + ``` + $ pnpm anvil + ``` + +3. Run the tests in a new shell: + + ``` + $ pnpm test + ``` + +## Contributing + +We welcome contributions to improve the `Turnkey EIP-1193 Provider`. Please follow the project's [contribution guidelines](https://github.com/tkhq/sdk/blob/ad9071716919d062ba67fd623a01cbd4523ed444/CONTRIBUTING.md). + +## License + +This project is licensed under [LICENSE](../_media/LICENSE), with detailed information available in the repository. + +## Documents + +- [documents/docs](documents/docs/readme) + + +## Modules + +- [index](index/readme) diff --git a/sdks/encoding/index/DEFAULT_JWK_MEMBER_BYTE_LENGTH/readme.mdx b/sdks/encoding/index/DEFAULT_JWK_MEMBER_BYTE_LENGTH/readme.mdx new file mode 100644 index 00000000..49110ae9 --- /dev/null +++ b/sdks/encoding/index/DEFAULT_JWK_MEMBER_BYTE_LENGTH/readme.mdx @@ -0,0 +1,12 @@ +--- +title: "DEFAULT_JWK_MEMBER_BYTE_LENGTH" +mode: wide +--- + +# Variable: DEFAULT\_JWK\_MEMBER\_BYTE\_LENGTH + +> `const` **DEFAULT\_JWK\_MEMBER\_BYTE\_LENGTH**: `32` = `32` + +Defined in: [index.ts:4](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/encoding/src/index.ts#L4) + +Code modified from https://github.com/github/webauthn-json/blob/e932b3585fa70b0bd5b5a4012ba7dbad7b0a0d0f/src/webauthn-json/base64url.ts#L23 diff --git a/sdks/encoding/index/base64StringToBase64UrlEncodedString/readme.mdx b/sdks/encoding/index/base64StringToBase64UrlEncodedString/readme.mdx new file mode 100644 index 00000000..ef74c5ac --- /dev/null +++ b/sdks/encoding/index/base64StringToBase64UrlEncodedString/readme.mdx @@ -0,0 +1,20 @@ +--- +title: "Base64StringToBase64UrlEncodedString" +mode: wide +--- + +# Function: base64StringToBase64UrlEncodedString() + +> **base64StringToBase64UrlEncodedString**(`input`): `string` + +Defined in: [index.ts:23](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/encoding/src/index.ts#L23) + +## Parameters + +### input + +`string` + +## Returns + +`string` diff --git a/sdks/encoding/index/hexStringToBase64url/readme.mdx b/sdks/encoding/index/hexStringToBase64url/readme.mdx new file mode 100644 index 00000000..c277f6b5 --- /dev/null +++ b/sdks/encoding/index/hexStringToBase64url/readme.mdx @@ -0,0 +1,24 @@ +--- +title: "HexStringToBase64url" +mode: wide +--- + +# Function: hexStringToBase64url() + +> **hexStringToBase64url**(`input`, `length`?): `string` + +Defined in: [index.ts:12](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/encoding/src/index.ts#L12) + +## Parameters + +### input + +`string` + +### length? + +`number` + +## Returns + +`string` diff --git a/sdks/encoding/index/hexToAscii/readme.mdx b/sdks/encoding/index/hexToAscii/readme.mdx new file mode 100644 index 00000000..307333b9 --- /dev/null +++ b/sdks/encoding/index/hexToAscii/readme.mdx @@ -0,0 +1,26 @@ +--- +title: "HexToAscii" +mode: wide +--- + +# Function: hexToAscii() + +> **hexToAscii**(`hexString`): `string` + +Defined in: [index.ts:69](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/encoding/src/index.ts#L69) + +Converts a hex string to an ASCII string. + +## Parameters + +### hexString + +`string` + +The input hex string to convert. + +## Returns + +`string` + +- The converted ASCII string. diff --git a/sdks/encoding/index/normalizePadding/readme.mdx b/sdks/encoding/index/normalizePadding/readme.mdx new file mode 100644 index 00000000..46685e2b --- /dev/null +++ b/sdks/encoding/index/normalizePadding/readme.mdx @@ -0,0 +1,32 @@ +--- +title: "NormalizePadding" +mode: wide +--- + +# Function: normalizePadding() + +> **normalizePadding**(`byteArray`, `targetLength`): `Uint8Array` + +Defined in: [index.ts:84](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/encoding/src/index.ts#L84) + +Function to normalize padding of byte array with 0's to a target length. + +## Parameters + +### byteArray + +`Uint8Array` + +The byte array to pad or trim. + +### targetLength + +`number` + +The target length after padding or trimming. + +## Returns + +`Uint8Array` + +- The normalized byte array. diff --git a/sdks/encoding/index/readme.mdx b/sdks/encoding/index/readme.mdx new file mode 100644 index 00000000..961cad5c --- /dev/null +++ b/sdks/encoding/index/readme.mdx @@ -0,0 +1,20 @@ +--- +title: "Index" +mode: wide +--- + +# index + +## Variables + +- [DEFAULT\_JWK\_MEMBER\_BYTE\_LENGTH](DEFAULT_JWK_MEMBER_BYTE_LENGTH/readme) + +## Functions + +- [base64StringToBase64UrlEncodedString](base64StringToBase64UrlEncodedString/readme) +- [hexStringToBase64url](hexStringToBase64url/readme) +- [hexToAscii](hexToAscii/readme) +- [normalizePadding](normalizePadding/readme) +- [stringToBase64urlString](stringToBase64urlString/readme) +- [uint8ArrayFromHexString](uint8ArrayFromHexString/readme) +- [uint8ArrayToHexString](uint8ArrayToHexString/readme) diff --git a/sdks/encoding/index/stringToBase64urlString/readme.mdx b/sdks/encoding/index/stringToBase64urlString/readme.mdx new file mode 100644 index 00000000..d2cd41cf --- /dev/null +++ b/sdks/encoding/index/stringToBase64urlString/readme.mdx @@ -0,0 +1,20 @@ +--- +title: "StringToBase64urlString" +mode: wide +--- + +# Function: stringToBase64urlString() + +> **stringToBase64urlString**(`input`): `string` + +Defined in: [index.ts:6](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/encoding/src/index.ts#L6) + +## Parameters + +### input + +`string` + +## Returns + +`string` diff --git a/sdks/encoding/index/uint8ArrayFromHexString/readme.mdx b/sdks/encoding/index/uint8ArrayFromHexString/readme.mdx new file mode 100644 index 00000000..742d08cf --- /dev/null +++ b/sdks/encoding/index/uint8ArrayFromHexString/readme.mdx @@ -0,0 +1,24 @@ +--- +title: "Uint8ArrayFromHexString" +mode: wide +--- + +# Function: uint8ArrayFromHexString() + +> **uint8ArrayFromHexString**(`hexString`, `length`?): `Uint8Array` + +Defined in: [index.ts:34](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/encoding/src/index.ts#L34) + +## Parameters + +### hexString + +`string` + +### length? + +`number` + +## Returns + +`Uint8Array` diff --git a/sdks/encoding/index/uint8ArrayToHexString/readme.mdx b/sdks/encoding/index/uint8ArrayToHexString/readme.mdx new file mode 100644 index 00000000..497bd00a --- /dev/null +++ b/sdks/encoding/index/uint8ArrayToHexString/readme.mdx @@ -0,0 +1,20 @@ +--- +title: "Uint8ArrayToHexString" +mode: wide +--- + +# Function: uint8ArrayToHexString() + +> **uint8ArrayToHexString**(`input`): `string` + +Defined in: [index.ts:27](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/encoding/src/index.ts#L27) + +## Parameters + +### input + +`Uint8Array` + +## Returns + +`string` diff --git a/sdks/encoding/readme.mdx b/sdks/encoding/readme.mdx new file mode 100644 index 00000000..16f76926 --- /dev/null +++ b/sdks/encoding/readme.mdx @@ -0,0 +1,16 @@ +--- +title: "Encoding" +mode: wide +--- + +# @turnkey/encoding + +This is a package containing decoding and encoding functions. This is used by other Turnkey packages. Feel free to import exported functions into your own apps, but be aware that there may be significant interface changes in the future. + +## Documents + + + +## Modules + +- [index](index/readme) diff --git a/sdks/ethers/documents/docs/readme.mdx b/sdks/ethers/documents/docs/readme.mdx new file mode 100644 index 00000000..d66b439d --- /dev/null +++ b/sdks/ethers/documents/docs/readme.mdx @@ -0,0 +1,30 @@ +--- +title: "Docs" +mode: wide +--- + +[**Documentation**](../../../readme) + +*** + +[Documentation](../../../modules) / [ethers](../../readme) / documents/docs + +--- +title: "Ethers" +description: "[`@turnkey/ethers`](https://www.npmjs.com/package/@turnkey/ethers) exports a `TurnkeySigner` that serves as a drop-in replacement for an Ethers signer." +mode: wide +--- + +Out of the box, it supports `{ signTransaction | signMessage | signTypedData }`. See full implementation [here](https://github.com/tkhq/sdk/tree/main/packages/ethers) for more details and examples. Note that you must **bring your own provider and connect it** to the TurnkeySigner. + +```js +// Initialize a Turnkey Signer +const turnkeySigner = new TurnkeySigner({ + ... +}); + +// Bring your own provider (such as Alchemy or Infura: https://docs.ethers.org/v6/api/providers/) +const network = "goerli"; +const provider = new ethers.providers.InfuraProvider(network); +const connectedSigner = turnkeySigner.connect(provider); +``` diff --git a/sdks/ethers/index/TurnkeyActivityError/readme.mdx b/sdks/ethers/index/TurnkeyActivityError/readme.mdx new file mode 100644 index 00000000..8a69180c --- /dev/null +++ b/sdks/ethers/index/TurnkeyActivityError/readme.mdx @@ -0,0 +1,84 @@ +--- +title: "TurnkeyActivityError" +mode: wide +--- + +# Class: TurnkeyActivityError + +Defined in: http/dist/shared.d.ts:9 + +## Extends + +- `Error` + +## Constructors + +### Constructor + +> **new TurnkeyActivityError**(`input`): `TurnkeyActivityError` + +Defined in: http/dist/shared.d.ts:14 + +#### Parameters + +##### input + +###### activityId? + +`string` + +###### activityStatus? + +`"ACTIVITY_STATUS_CREATED"` \| `"ACTIVITY_STATUS_PENDING"` \| `"ACTIVITY_STATUS_COMPLETED"` \| `"ACTIVITY_STATUS_FAILED"` \| `"ACTIVITY_STATUS_CONSENSUS_NEEDED"` \| `"ACTIVITY_STATUS_REJECTED"` + +###### activityType? + +`"ACTIVITY_TYPE_SIGN_TRANSACTION_V2"` \| `"ACTIVITY_TYPE_CREATE_API_KEYS"` \| `"ACTIVITY_TYPE_CREATE_USERS"` \| `"ACTIVITY_TYPE_CREATE_PRIVATE_KEYS"` \| `"ACTIVITY_TYPE_SIGN_RAW_PAYLOAD"` \| `"ACTIVITY_TYPE_CREATE_INVITATIONS"` \| `"ACTIVITY_TYPE_ACCEPT_INVITATION"` \| `"ACTIVITY_TYPE_CREATE_POLICY"` \| `"ACTIVITY_TYPE_DISABLE_PRIVATE_KEY"` \| `"ACTIVITY_TYPE_DELETE_USERS"` \| `"ACTIVITY_TYPE_DELETE_API_KEYS"` \| `"ACTIVITY_TYPE_DELETE_INVITATION"` \| `"ACTIVITY_TYPE_DELETE_ORGANIZATION"` \| `"ACTIVITY_TYPE_DELETE_POLICY"` \| `"ACTIVITY_TYPE_CREATE_USER_TAG"` \| `"ACTIVITY_TYPE_DELETE_USER_TAGS"` \| `"ACTIVITY_TYPE_CREATE_ORGANIZATION"` \| `"ACTIVITY_TYPE_SIGN_TRANSACTION"` \| `"ACTIVITY_TYPE_APPROVE_ACTIVITY"` \| `"ACTIVITY_TYPE_REJECT_ACTIVITY"` \| `"ACTIVITY_TYPE_DELETE_AUTHENTICATORS"` \| `"ACTIVITY_TYPE_CREATE_AUTHENTICATORS"` \| `"ACTIVITY_TYPE_CREATE_PRIVATE_KEY_TAG"` \| `"ACTIVITY_TYPE_DELETE_PRIVATE_KEY_TAGS"` \| `"ACTIVITY_TYPE_SET_PAYMENT_METHOD"` \| `"ACTIVITY_TYPE_ACTIVATE_BILLING_TIER"` \| `"ACTIVITY_TYPE_DELETE_PAYMENT_METHOD"` \| `"ACTIVITY_TYPE_CREATE_POLICY_V2"` \| `"ACTIVITY_TYPE_CREATE_POLICY_V3"` \| `"ACTIVITY_TYPE_CREATE_API_ONLY_USERS"` \| `"ACTIVITY_TYPE_UPDATE_ROOT_QUORUM"` \| `"ACTIVITY_TYPE_UPDATE_USER_TAG"` \| `"ACTIVITY_TYPE_UPDATE_PRIVATE_KEY_TAG"` \| `"ACTIVITY_TYPE_CREATE_AUTHENTICATORS_V2"` \| `"ACTIVITY_TYPE_CREATE_ORGANIZATION_V2"` \| `"ACTIVITY_TYPE_CREATE_USERS_V2"` \| `"ACTIVITY_TYPE_ACCEPT_INVITATION_V2"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V2"` \| `"ACTIVITY_TYPE_UPDATE_ALLOWED_ORIGINS"` \| `"ACTIVITY_TYPE_CREATE_PRIVATE_KEYS_V2"` \| `"ACTIVITY_TYPE_UPDATE_USER"` \| `"ACTIVITY_TYPE_UPDATE_POLICY"` \| `"ACTIVITY_TYPE_SET_PAYMENT_METHOD_V2"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V3"` \| `"ACTIVITY_TYPE_CREATE_WALLET"` \| `"ACTIVITY_TYPE_CREATE_WALLET_ACCOUNTS"` \| `"ACTIVITY_TYPE_INIT_USER_EMAIL_RECOVERY"` \| `"ACTIVITY_TYPE_RECOVER_USER"` \| `"ACTIVITY_TYPE_SET_ORGANIZATION_FEATURE"` \| `"ACTIVITY_TYPE_REMOVE_ORGANIZATION_FEATURE"` \| `"ACTIVITY_TYPE_SIGN_RAW_PAYLOAD_V2"` \| `"ACTIVITY_TYPE_EXPORT_PRIVATE_KEY"` \| `"ACTIVITY_TYPE_EXPORT_WALLET"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V4"` \| `"ACTIVITY_TYPE_EMAIL_AUTH"` \| `"ACTIVITY_TYPE_EXPORT_WALLET_ACCOUNT"` \| `"ACTIVITY_TYPE_INIT_IMPORT_WALLET"` \| `"ACTIVITY_TYPE_IMPORT_WALLET"` \| `"ACTIVITY_TYPE_INIT_IMPORT_PRIVATE_KEY"` \| `"ACTIVITY_TYPE_IMPORT_PRIVATE_KEY"` \| `"ACTIVITY_TYPE_CREATE_POLICIES"` \| `"ACTIVITY_TYPE_SIGN_RAW_PAYLOADS"` \| `"ACTIVITY_TYPE_CREATE_READ_ONLY_SESSION"` \| `"ACTIVITY_TYPE_CREATE_OAUTH_PROVIDERS"` \| `"ACTIVITY_TYPE_DELETE_OAUTH_PROVIDERS"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V5"` \| `"ACTIVITY_TYPE_OAUTH"` \| `"ACTIVITY_TYPE_CREATE_API_KEYS_V2"` \| `"ACTIVITY_TYPE_CREATE_READ_WRITE_SESSION"` \| `"ACTIVITY_TYPE_EMAIL_AUTH_V2"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V6"` \| `"ACTIVITY_TYPE_DELETE_PRIVATE_KEYS"` \| `"ACTIVITY_TYPE_DELETE_WALLETS"` \| `"ACTIVITY_TYPE_CREATE_READ_WRITE_SESSION_V2"` \| `"ACTIVITY_TYPE_DELETE_SUB_ORGANIZATION"` \| `"ACTIVITY_TYPE_INIT_OTP_AUTH"` \| `"ACTIVITY_TYPE_OTP_AUTH"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V7"` \| `"ACTIVITY_TYPE_UPDATE_WALLET"` \| `"ACTIVITY_TYPE_UPDATE_POLICY_V2"` \| `"ACTIVITY_TYPE_CREATE_USERS_V3"` \| `"ACTIVITY_TYPE_INIT_OTP_AUTH_V2"` + +###### cause? + +`Error` + +###### message + +`string` + +#### Returns + +`TurnkeyActivityError` + +#### Overrides + +`Error.constructor` + +## Properties + +### activityId + +> **activityId**: `undefined` \| `string` + +Defined in: http/dist/shared.d.ts:10 + +*** + +### activityStatus + +> **activityStatus**: `undefined` \| `"ACTIVITY_STATUS_CREATED"` \| `"ACTIVITY_STATUS_PENDING"` \| `"ACTIVITY_STATUS_COMPLETED"` \| `"ACTIVITY_STATUS_FAILED"` \| `"ACTIVITY_STATUS_CONSENSUS_NEEDED"` \| `"ACTIVITY_STATUS_REJECTED"` + +Defined in: http/dist/shared.d.ts:11 + +*** + +### activityType + +> **activityType**: `undefined` \| `"ACTIVITY_TYPE_SIGN_TRANSACTION_V2"` \| `"ACTIVITY_TYPE_CREATE_API_KEYS"` \| `"ACTIVITY_TYPE_CREATE_USERS"` \| `"ACTIVITY_TYPE_CREATE_PRIVATE_KEYS"` \| `"ACTIVITY_TYPE_SIGN_RAW_PAYLOAD"` \| `"ACTIVITY_TYPE_CREATE_INVITATIONS"` \| `"ACTIVITY_TYPE_ACCEPT_INVITATION"` \| `"ACTIVITY_TYPE_CREATE_POLICY"` \| `"ACTIVITY_TYPE_DISABLE_PRIVATE_KEY"` \| `"ACTIVITY_TYPE_DELETE_USERS"` \| `"ACTIVITY_TYPE_DELETE_API_KEYS"` \| `"ACTIVITY_TYPE_DELETE_INVITATION"` \| `"ACTIVITY_TYPE_DELETE_ORGANIZATION"` \| `"ACTIVITY_TYPE_DELETE_POLICY"` \| `"ACTIVITY_TYPE_CREATE_USER_TAG"` \| `"ACTIVITY_TYPE_DELETE_USER_TAGS"` \| `"ACTIVITY_TYPE_CREATE_ORGANIZATION"` \| `"ACTIVITY_TYPE_SIGN_TRANSACTION"` \| `"ACTIVITY_TYPE_APPROVE_ACTIVITY"` \| `"ACTIVITY_TYPE_REJECT_ACTIVITY"` \| `"ACTIVITY_TYPE_DELETE_AUTHENTICATORS"` \| `"ACTIVITY_TYPE_CREATE_AUTHENTICATORS"` \| `"ACTIVITY_TYPE_CREATE_PRIVATE_KEY_TAG"` \| `"ACTIVITY_TYPE_DELETE_PRIVATE_KEY_TAGS"` \| `"ACTIVITY_TYPE_SET_PAYMENT_METHOD"` \| `"ACTIVITY_TYPE_ACTIVATE_BILLING_TIER"` \| `"ACTIVITY_TYPE_DELETE_PAYMENT_METHOD"` \| `"ACTIVITY_TYPE_CREATE_POLICY_V2"` \| `"ACTIVITY_TYPE_CREATE_POLICY_V3"` \| `"ACTIVITY_TYPE_CREATE_API_ONLY_USERS"` \| `"ACTIVITY_TYPE_UPDATE_ROOT_QUORUM"` \| `"ACTIVITY_TYPE_UPDATE_USER_TAG"` \| `"ACTIVITY_TYPE_UPDATE_PRIVATE_KEY_TAG"` \| `"ACTIVITY_TYPE_CREATE_AUTHENTICATORS_V2"` \| `"ACTIVITY_TYPE_CREATE_ORGANIZATION_V2"` \| `"ACTIVITY_TYPE_CREATE_USERS_V2"` \| `"ACTIVITY_TYPE_ACCEPT_INVITATION_V2"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V2"` \| `"ACTIVITY_TYPE_UPDATE_ALLOWED_ORIGINS"` \| `"ACTIVITY_TYPE_CREATE_PRIVATE_KEYS_V2"` \| `"ACTIVITY_TYPE_UPDATE_USER"` \| `"ACTIVITY_TYPE_UPDATE_POLICY"` \| `"ACTIVITY_TYPE_SET_PAYMENT_METHOD_V2"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V3"` \| `"ACTIVITY_TYPE_CREATE_WALLET"` \| `"ACTIVITY_TYPE_CREATE_WALLET_ACCOUNTS"` \| `"ACTIVITY_TYPE_INIT_USER_EMAIL_RECOVERY"` \| `"ACTIVITY_TYPE_RECOVER_USER"` \| `"ACTIVITY_TYPE_SET_ORGANIZATION_FEATURE"` \| `"ACTIVITY_TYPE_REMOVE_ORGANIZATION_FEATURE"` \| `"ACTIVITY_TYPE_SIGN_RAW_PAYLOAD_V2"` \| `"ACTIVITY_TYPE_EXPORT_PRIVATE_KEY"` \| `"ACTIVITY_TYPE_EXPORT_WALLET"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V4"` \| `"ACTIVITY_TYPE_EMAIL_AUTH"` \| `"ACTIVITY_TYPE_EXPORT_WALLET_ACCOUNT"` \| `"ACTIVITY_TYPE_INIT_IMPORT_WALLET"` \| `"ACTIVITY_TYPE_IMPORT_WALLET"` \| `"ACTIVITY_TYPE_INIT_IMPORT_PRIVATE_KEY"` \| `"ACTIVITY_TYPE_IMPORT_PRIVATE_KEY"` \| `"ACTIVITY_TYPE_CREATE_POLICIES"` \| `"ACTIVITY_TYPE_SIGN_RAW_PAYLOADS"` \| `"ACTIVITY_TYPE_CREATE_READ_ONLY_SESSION"` \| `"ACTIVITY_TYPE_CREATE_OAUTH_PROVIDERS"` \| `"ACTIVITY_TYPE_DELETE_OAUTH_PROVIDERS"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V5"` \| `"ACTIVITY_TYPE_OAUTH"` \| `"ACTIVITY_TYPE_CREATE_API_KEYS_V2"` \| `"ACTIVITY_TYPE_CREATE_READ_WRITE_SESSION"` \| `"ACTIVITY_TYPE_EMAIL_AUTH_V2"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V6"` \| `"ACTIVITY_TYPE_DELETE_PRIVATE_KEYS"` \| `"ACTIVITY_TYPE_DELETE_WALLETS"` \| `"ACTIVITY_TYPE_CREATE_READ_WRITE_SESSION_V2"` \| `"ACTIVITY_TYPE_DELETE_SUB_ORGANIZATION"` \| `"ACTIVITY_TYPE_INIT_OTP_AUTH"` \| `"ACTIVITY_TYPE_OTP_AUTH"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V7"` \| `"ACTIVITY_TYPE_UPDATE_WALLET"` \| `"ACTIVITY_TYPE_UPDATE_POLICY_V2"` \| `"ACTIVITY_TYPE_CREATE_USERS_V3"` \| `"ACTIVITY_TYPE_INIT_OTP_AUTH_V2"` + +Defined in: http/dist/shared.d.ts:12 + +*** + +### cause + +> **cause**: `undefined` \| `Error` + +Defined in: http/dist/shared.d.ts:13 diff --git a/sdks/ethers/index/TurnkeyRequestError/readme.mdx b/sdks/ethers/index/TurnkeyRequestError/readme.mdx new file mode 100644 index 00000000..0e296410 --- /dev/null +++ b/sdks/ethers/index/TurnkeyRequestError/readme.mdx @@ -0,0 +1,50 @@ +--- +title: "TurnkeyRequestError" +mode: wide +--- + +# Class: TurnkeyRequestError + +Defined in: http/dist/base.d.ts:84 + +## Extends + +- `Error` + +## Constructors + +### Constructor + +> **new TurnkeyRequestError**(`input`): `TurnkeyRequestError` + +Defined in: http/dist/base.d.ts:87 + +#### Parameters + +##### input + +`GrpcStatus` + +#### Returns + +`TurnkeyRequestError` + +#### Overrides + +`Error.constructor` + +## Properties + +### code + +> **code**: `number` + +Defined in: http/dist/base.d.ts:86 + +*** + +### details + +> **details**: `null` \| `any`[] + +Defined in: http/dist/base.d.ts:85 diff --git a/sdks/ethers/index/TurnkeySigner/readme.mdx b/sdks/ethers/index/TurnkeySigner/readme.mdx new file mode 100644 index 00000000..a312a633 --- /dev/null +++ b/sdks/ethers/index/TurnkeySigner/readme.mdx @@ -0,0 +1,259 @@ +--- +title: "TurnkeySigner" +mode: wide +--- + +# Class: TurnkeySigner + +Defined in: [ethers/src/index.ts:46](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/ethers/src/index.ts#L46) + +## Extends + +- `AbstractSigner` + +## Implements + +- `Signer` + +## Constructors + +### Constructor + +> **new TurnkeySigner**(`config`, `provider`?): `TurnkeySigner` + +Defined in: [ethers/src/index.ts:55](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/ethers/src/index.ts#L55) + +#### Parameters + +##### config + +`TConfig` + +##### provider? + +`Provider` + +#### Returns + +`TurnkeySigner` + +#### Overrides + +`AbstractSigner.constructor` + +## Properties + +### \_signTypedData() + +> **\_signTypedData**: (`domain`, `types`, `value`) => `Promise`\<`string`\> + +Defined in: [ethers/src/index.ts:297](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/ethers/src/index.ts#L297) + +#### Parameters + +##### domain + +`TypedDataDomain` + +##### types + +`Record`\<`string`, `TypedDataField`[]\> + +##### value + +`Record`\<`string`, `any`\> + +#### Returns + +`Promise`\<`string`\> + +*** + +### organizationId + +> `readonly` **organizationId**: `string` + +Defined in: [ethers/src/index.ts:52](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/ethers/src/index.ts#L52) + +*** + +### signWith + +> `readonly` **signWith**: `string` + +Defined in: [ethers/src/index.ts:53](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/ethers/src/index.ts#L53) + +## Methods + +### \_signMessageImpl() + +> **\_signMessageImpl**(`message`): `Promise`\<`string`\> + +Defined in: [ethers/src/index.ts:234](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/ethers/src/index.ts#L234) + +#### Parameters + +##### message + +`string` + +#### Returns + +`Promise`\<`string`\> + +*** + +### \_signMessageWithErrorWrapping() + +> **\_signMessageWithErrorWrapping**(`message`): `Promise`\<`string`\> + +Defined in: [ethers/src/index.ts:213](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/ethers/src/index.ts#L213) + +#### Parameters + +##### message + +`string` + +#### Returns + +`Promise`\<`string`\> + +*** + +### connect() + +> **connect**(`provider`): `TurnkeySigner` + +Defined in: [ethers/src/index.ts:63](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/ethers/src/index.ts#L63) + +Returns the signer connected to %%provider%%. + + This may throw, for example, a Signer connected over a Socket or + to a specific instance of a node may not be transferrable. + +#### Parameters + +##### provider + +`Provider` + +#### Returns + +`TurnkeySigner` + +#### Implementation of + +`ethers.Signer.connect` + +#### Overrides + +`AbstractSigner.connect` + +*** + +### getAddress() + +> **getAddress**(): `Promise`\<`string`\> + +Defined in: [ethers/src/index.ts:77](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/ethers/src/index.ts#L77) + +Resolves to the Signer address. + +#### Returns + +`Promise`\<`string`\> + +#### Implementation of + +`ethers.Signer.getAddress` + +#### Overrides + +`AbstractSigner.getAddress` + +*** + +### signMessage() + +> **signMessage**(`message`): `Promise`\<`string`\> + +Defined in: [ethers/src/index.ts:206](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/ethers/src/index.ts#L206) + +#### Parameters + +##### message + +`string` | `Uint8Array` + +#### Returns + +`Promise`\<`string`\> + +#### Implementation of + +`ethers.Signer.signMessage` + +#### Overrides + +`AbstractSigner.signMessage` + +*** + +### signTransaction() + +> **signTransaction**(`transaction`): `Promise`\<`string`\> + +Defined in: [ethers/src/index.ts:166](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/ethers/src/index.ts#L166) + +#### Parameters + +##### transaction + +`TransactionRequest` + +#### Returns + +`Promise`\<`string`\> + +#### Implementation of + +`ethers.Signer.signTransaction` + +#### Overrides + +`AbstractSigner.signTransaction` + +*** + +### signTypedData() + +> **signTypedData**(`domain`, `types`, `value`): `Promise`\<`string`\> + +Defined in: [ethers/src/index.ts:273](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/ethers/src/index.ts#L273) + +#### Parameters + +##### domain + +`TypedDataDomain` + +##### types + +`Record`\<`string`, `TypedDataField`[]\> + +##### value + +`Record`\<`string`, `any`\> + +#### Returns + +`Promise`\<`string`\> + +#### Implementation of + +`ethers.Signer.signTypedData` + +#### Overrides + +`AbstractSigner.signTypedData` diff --git a/sdks/ethers/index/readme.mdx b/sdks/ethers/index/readme.mdx new file mode 100644 index 00000000..a7baa979 --- /dev/null +++ b/sdks/ethers/index/readme.mdx @@ -0,0 +1,16 @@ +--- +title: "Index" +mode: wide +--- + +# index + +## Classes + +- [TurnkeyActivityError](TurnkeyActivityError/readme) +- [TurnkeyRequestError](TurnkeyRequestError/readme) +- [TurnkeySigner](TurnkeySigner/readme) + +## Functions + +- [serializeSignature](serializeSignature/readme) diff --git a/sdks/ethers/index/serializeSignature/readme.mdx b/sdks/ethers/index/serializeSignature/readme.mdx new file mode 100644 index 00000000..99a47979 --- /dev/null +++ b/sdks/ethers/index/serializeSignature/readme.mdx @@ -0,0 +1,18 @@ +--- +title: "SerializeSignature" +mode: wide +--- + +# Function: serializeSignature() + +> **serializeSignature**(`signature`): `string` + +Defined in: [ethers/src/index.ts:300](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/ethers/src/index.ts#L300) + +## Parameters + +### signature + +## Returns + +`string` diff --git a/sdks/ethers/readme.mdx b/sdks/ethers/readme.mdx new file mode 100644 index 00000000..ae008639 --- /dev/null +++ b/sdks/ethers/readme.mdx @@ -0,0 +1,126 @@ +--- +title: "Ethers" +mode: wide +--- + +# @turnkey/ethers + +[![npm](https://img.shields.io/npm/v/@turnkey/ethers?color=%234C48FF)](https://www.npmjs.com/package/@turnkey/ethers) + +[Turnkey](https://turnkey.com) Signer for [`Ethers`](https://docs.ethers.org/v6/api/providers/#Signer). + +If you need a lower-level, fully typed HTTP client for interacting with Turnkey API, check out [`@turnkey/http`](/packages/http/). + +API Docs: https://docs.turnkey.com/ + +## Getting started + +```bash +$ npm install ethers @turnkey/ethers +``` + +```typescript +import { ethers } from "ethers"; +import { TurnkeySigner } from "@turnkey/ethers"; +import { TurnkeyClient } from "@turnkey/http"; +import { ApiKeyStamper } from "@turnkey/api-key-stamper"; + +async function main() { + const network = "goerli"; + const provider = new ethers.providers.InfuraProvider(network); + + const turnkeyClient = new TurnkeyClient( + { + baseUrl: "https://api.turnkey.com", + }, + // This uses API key credentials. + // If you're using passkeys, use `@turnkey/webauthn-stamper` to collect webauthn signatures: + // new WebauthnStamper({...options...}) + new ApiKeyStamper({ + apiPublicKey: "...", + apiPrivateKey: "...", + }), + ); + + // Initialize a Turnkey Signer + const turnkeySigner = new TurnkeySigner({ + client: turnkeyClient, + organizationId: "...", + signWith: "...", + }); + + // Connect it with a Provider (https://docs.ethers.org/v6/api/providers/) + const connectedSigner = turnkeySigner.connect(provider); + + const chainId = await connectedSigner.getChainId(); + const address = await connectedSigner.getAddress(); + const balance = await connectedSigner.getBalance(); + const transactionCount = await connectedSigner.getTransactionCount(); + + console.log(`Network\n\t${network} (chain ID ${chainId})`); + console.log(`Address\n\t${address}`); + console.log(`Balance\n\t${String(balance)}`); + console.log(`Transaction count\n\t${transactionCount}`); + + const transactionRequest = { + to: "0x2Ad9eA1E677949a536A270CEC812D6e868C88108", + value: ethers.utils.parseEther("0.0001"), + type: 2, + }; + + const signedTx = await connectedSigner.signTransaction(transactionRequest); + + console.log(`Signed transaction\n\t${signedTx}`); + + if (balance.isZero()) { + let warningMessage = + "\nWarning: the transaction won't be broadcasted because your account balance is zero.\n"; + if (network === "goerli") { + warningMessage += + "Use https://goerlifaucet.com/ to request funds on Goerli, then run the script again.\n"; + } + + console.warn(warningMessage); + return; + } + + const sentTx = await connectedSigner.sendTransaction(transactionRequest); + + console.log( + `Transaction sent!\n\thttps://${network}.etherscan.io/tx/${sentTx.hash}`, + ); +} + +main().catch((error) => { + console.error(error); + process.exit(1); +}); +``` + +## Testing (Local) + +See `.env.example` to get your local testing environment right. Run `pnpm jest` to run the tests. + +## More examples + +| Example | Description | +| ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ | +| [`with-ethers`](/examples/with-ethers/) | Create a new Ethereum address, then sign and broadcast a transaction using the Ethers signer with Infura | +| [`with-gnosis`](/examples/with-gnosis/) | Create new Ethereum addresses, configure a 3/3 Gnosis safe, and create + execute a transaction from it | +| [`with-uniswap`](/examples/with-uniswap/) | Sign and broadcast a Uniswap v3 trade using the Ethers signer with Infura | +| [`with-nonce-manager`](/examples/with-nonce-manager/) | Create a new Ethereum address, then sign and broadcast multiple transactions in a sequential or optimistic manner. | +| [`sweeper`](/examples/sweeper/) | Sweep funds from one address to a different address | +| [`deployer`](/examples/deployer/) | Compile and deploy a smart contract | + +## See also + +- [`@turnkey/http`](/packages/http/): lower-level fully typed HTTP client for interacting with Turnkey API + +## Documents + +- [documents/docs](documents/docs/readme) + + +## Modules + +- [index](index/readme) diff --git a/sdks/http/TurnkeyClient/readme.mdx b/sdks/http/TurnkeyClient/readme.mdx new file mode 100644 index 00000000..ed81e711 --- /dev/null +++ b/sdks/http/TurnkeyClient/readme.mdx @@ -0,0 +1,111 @@ +--- +title: "TurnkeyClient" +mode: wide +--- + +## Introduction + +The [`@turnkey/http`](https://www.npmjs.com/package/@turnkey/http) package is a fully-typed lower-level HTTP client for developers integrating with Turnkey. + +## Installing + +To get started install the [`@turnkey/http`](https://www.npmjs.com/package/@turnkey/http) client. + + + +```bash npm +npm i @turnkey/http +``` + +```bash pnpm +pnpm i @turnkey/http +``` + +```bash yarn +yarn add @turnkey/http +``` + + + +## Initializing + +Create a new client for use in your JavaScript/Typescript applications. + +You can initialize a new **`TurnkeyClient`** using the **`TurnkeyClient`** constructor. The **`TurnkeyClient`** serves as your entry point to interact with the Turnkey API. + +### Parameters + + + +An object containing configuration settings for the client. + + + + + +The base URL for the Turnkey API. Note: An error `Missing base URL. Please verify env vars.` will be thrown if a value is not provided. + + + + + +An instance of a stamper class (e.g. [**`ApiKeyStamper`**](/sdks/advanced/api-key-stamper)) used to create signatures for authenticating API requests. + +Currently Turnkey provides 3 stampers: + +- applications signing requests with Passkeys or webauthn devices should use [`@turnkey/webauthn-stamper`](/sdks/advanced/webauthn-stamper) +- applications signing requests with API keys should use [`@turnkey/api-key-stamper`](/sdks/advanced/api-key-stamper) +- applications that need to sign requests within an iframe, particularly when handling sensitive operations like Auth, or Key or Wallet Export, should use the [`@turnkey/iframe-stamper`](/sdks/advanced/iframe-stamper). + +You can also implement the TStamper interface yourself. For more information on implementing a custom stamper checkout the [API Design](/developer-reference/api-overview/intro) docs. + +### Types + +#### `THttpConfig` + +```bash +type THttpConfig = { + baseUrl: string; +}; +``` + +#### `TStamper` + +```bash +interface TStamper { + stamp: (input: string) => Promise; +} +``` + +### Example + +```js +import { TurnkeyClient } from "@turnkey/http"; +import { ApiKeyStamper } from "@turnkey/api-key-stamper"; + +// Following best practices, define parameters in your .env file +const baseUrl = process.env.TURNKEY_BASE_URL || "https://api.turnkey.com"; +const apiPublicKey = process.env.TURNKEY_API_PUBLIC_KEY; +const apiPrivateKey = process.env.TURNKEY_API_PRIVATE_KEY; + +// Initialize the API key stamper +const stamper = new ApiKeyStamper({ apiPublicKey, apiPrivateKey }); + +// Initialize the Turnkey client and then you're ready to use the Turnkey client! 🎉 +const client = new TurnkeyClient({ baseUrl }, stamper); +``` diff --git a/sdks/http/index/InvalidArgumentError/readme.mdx b/sdks/http/index/InvalidArgumentError/readme.mdx new file mode 100644 index 00000000..d0df6898 --- /dev/null +++ b/sdks/http/index/InvalidArgumentError/readme.mdx @@ -0,0 +1,84 @@ +--- +title: "InvalidArgumentError" +mode: wide +--- + +# Class: InvalidArgumentError + +Defined in: [shared.ts:60](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/http/src/shared.ts#L60) + +## Extends + +- `Error` + +## Constructors + +### Constructor + +> **new InvalidArgumentError**(`input`): `InvalidArgumentError` + +Defined in: [shared.ts:66](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/http/src/shared.ts#L66) + +#### Parameters + +##### input + +###### activityId? + +`string` + +###### activityStatus? + +`"ACTIVITY_STATUS_CREATED"` \| `"ACTIVITY_STATUS_PENDING"` \| `"ACTIVITY_STATUS_COMPLETED"` \| `"ACTIVITY_STATUS_FAILED"` \| `"ACTIVITY_STATUS_CONSENSUS_NEEDED"` \| `"ACTIVITY_STATUS_REJECTED"` + +###### activityType? + +`"ACTIVITY_TYPE_CREATE_API_KEYS"` \| `"ACTIVITY_TYPE_CREATE_USERS"` \| `"ACTIVITY_TYPE_CREATE_PRIVATE_KEYS"` \| `"ACTIVITY_TYPE_SIGN_RAW_PAYLOAD"` \| `"ACTIVITY_TYPE_CREATE_INVITATIONS"` \| `"ACTIVITY_TYPE_ACCEPT_INVITATION"` \| `"ACTIVITY_TYPE_CREATE_POLICY"` \| `"ACTIVITY_TYPE_DISABLE_PRIVATE_KEY"` \| `"ACTIVITY_TYPE_DELETE_USERS"` \| `"ACTIVITY_TYPE_DELETE_API_KEYS"` \| `"ACTIVITY_TYPE_DELETE_INVITATION"` \| `"ACTIVITY_TYPE_DELETE_ORGANIZATION"` \| `"ACTIVITY_TYPE_DELETE_POLICY"` \| `"ACTIVITY_TYPE_CREATE_USER_TAG"` \| `"ACTIVITY_TYPE_DELETE_USER_TAGS"` \| `"ACTIVITY_TYPE_CREATE_ORGANIZATION"` \| `"ACTIVITY_TYPE_SIGN_TRANSACTION"` \| `"ACTIVITY_TYPE_APPROVE_ACTIVITY"` \| `"ACTIVITY_TYPE_REJECT_ACTIVITY"` \| `"ACTIVITY_TYPE_DELETE_AUTHENTICATORS"` \| `"ACTIVITY_TYPE_CREATE_AUTHENTICATORS"` \| `"ACTIVITY_TYPE_CREATE_PRIVATE_KEY_TAG"` \| `"ACTIVITY_TYPE_DELETE_PRIVATE_KEY_TAGS"` \| `"ACTIVITY_TYPE_SET_PAYMENT_METHOD"` \| `"ACTIVITY_TYPE_ACTIVATE_BILLING_TIER"` \| `"ACTIVITY_TYPE_DELETE_PAYMENT_METHOD"` \| `"ACTIVITY_TYPE_CREATE_POLICY_V2"` \| `"ACTIVITY_TYPE_CREATE_POLICY_V3"` \| `"ACTIVITY_TYPE_CREATE_API_ONLY_USERS"` \| `"ACTIVITY_TYPE_UPDATE_ROOT_QUORUM"` \| `"ACTIVITY_TYPE_UPDATE_USER_TAG"` \| `"ACTIVITY_TYPE_UPDATE_PRIVATE_KEY_TAG"` \| `"ACTIVITY_TYPE_CREATE_AUTHENTICATORS_V2"` \| `"ACTIVITY_TYPE_CREATE_ORGANIZATION_V2"` \| `"ACTIVITY_TYPE_CREATE_USERS_V2"` \| `"ACTIVITY_TYPE_ACCEPT_INVITATION_V2"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V2"` \| `"ACTIVITY_TYPE_UPDATE_ALLOWED_ORIGINS"` \| `"ACTIVITY_TYPE_CREATE_PRIVATE_KEYS_V2"` \| `"ACTIVITY_TYPE_UPDATE_USER"` \| `"ACTIVITY_TYPE_UPDATE_POLICY"` \| `"ACTIVITY_TYPE_SET_PAYMENT_METHOD_V2"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V3"` \| `"ACTIVITY_TYPE_CREATE_WALLET"` \| `"ACTIVITY_TYPE_CREATE_WALLET_ACCOUNTS"` \| `"ACTIVITY_TYPE_INIT_USER_EMAIL_RECOVERY"` \| `"ACTIVITY_TYPE_RECOVER_USER"` \| `"ACTIVITY_TYPE_SET_ORGANIZATION_FEATURE"` \| `"ACTIVITY_TYPE_REMOVE_ORGANIZATION_FEATURE"` \| `"ACTIVITY_TYPE_SIGN_RAW_PAYLOAD_V2"` \| `"ACTIVITY_TYPE_SIGN_TRANSACTION_V2"` \| `"ACTIVITY_TYPE_EXPORT_PRIVATE_KEY"` \| `"ACTIVITY_TYPE_EXPORT_WALLET"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V4"` \| `"ACTIVITY_TYPE_EMAIL_AUTH"` \| `"ACTIVITY_TYPE_EXPORT_WALLET_ACCOUNT"` \| `"ACTIVITY_TYPE_INIT_IMPORT_WALLET"` \| `"ACTIVITY_TYPE_IMPORT_WALLET"` \| `"ACTIVITY_TYPE_INIT_IMPORT_PRIVATE_KEY"` \| `"ACTIVITY_TYPE_IMPORT_PRIVATE_KEY"` \| `"ACTIVITY_TYPE_CREATE_POLICIES"` \| `"ACTIVITY_TYPE_SIGN_RAW_PAYLOADS"` \| `"ACTIVITY_TYPE_CREATE_READ_ONLY_SESSION"` \| `"ACTIVITY_TYPE_CREATE_OAUTH_PROVIDERS"` \| `"ACTIVITY_TYPE_DELETE_OAUTH_PROVIDERS"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V5"` \| `"ACTIVITY_TYPE_OAUTH"` \| `"ACTIVITY_TYPE_CREATE_API_KEYS_V2"` \| `"ACTIVITY_TYPE_CREATE_READ_WRITE_SESSION"` \| `"ACTIVITY_TYPE_EMAIL_AUTH_V2"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V6"` \| `"ACTIVITY_TYPE_DELETE_PRIVATE_KEYS"` \| `"ACTIVITY_TYPE_DELETE_WALLETS"` \| `"ACTIVITY_TYPE_CREATE_READ_WRITE_SESSION_V2"` \| `"ACTIVITY_TYPE_DELETE_SUB_ORGANIZATION"` \| `"ACTIVITY_TYPE_INIT_OTP_AUTH"` \| `"ACTIVITY_TYPE_OTP_AUTH"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V7"` \| `"ACTIVITY_TYPE_UPDATE_WALLET"` \| `"ACTIVITY_TYPE_UPDATE_POLICY_V2"` \| `"ACTIVITY_TYPE_CREATE_USERS_V3"` \| `"ACTIVITY_TYPE_INIT_OTP_AUTH_V2"` + +###### cause? + +`Error` + +###### message + +`string` + +#### Returns + +`InvalidArgumentError` + +#### Overrides + +`Error.constructor` + +## Properties + +### activityId + +> **activityId**: `undefined` \| `string` + +Defined in: [shared.ts:61](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/http/src/shared.ts#L61) + +*** + +### activityStatus + +> **activityStatus**: `undefined` \| `"ACTIVITY_STATUS_CREATED"` \| `"ACTIVITY_STATUS_PENDING"` \| `"ACTIVITY_STATUS_COMPLETED"` \| `"ACTIVITY_STATUS_FAILED"` \| `"ACTIVITY_STATUS_CONSENSUS_NEEDED"` \| `"ACTIVITY_STATUS_REJECTED"` + +Defined in: [shared.ts:62](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/http/src/shared.ts#L62) + +*** + +### activityType + +> **activityType**: `undefined` \| `"ACTIVITY_TYPE_CREATE_API_KEYS"` \| `"ACTIVITY_TYPE_CREATE_USERS"` \| `"ACTIVITY_TYPE_CREATE_PRIVATE_KEYS"` \| `"ACTIVITY_TYPE_SIGN_RAW_PAYLOAD"` \| `"ACTIVITY_TYPE_CREATE_INVITATIONS"` \| `"ACTIVITY_TYPE_ACCEPT_INVITATION"` \| `"ACTIVITY_TYPE_CREATE_POLICY"` \| `"ACTIVITY_TYPE_DISABLE_PRIVATE_KEY"` \| `"ACTIVITY_TYPE_DELETE_USERS"` \| `"ACTIVITY_TYPE_DELETE_API_KEYS"` \| `"ACTIVITY_TYPE_DELETE_INVITATION"` \| `"ACTIVITY_TYPE_DELETE_ORGANIZATION"` \| `"ACTIVITY_TYPE_DELETE_POLICY"` \| `"ACTIVITY_TYPE_CREATE_USER_TAG"` \| `"ACTIVITY_TYPE_DELETE_USER_TAGS"` \| `"ACTIVITY_TYPE_CREATE_ORGANIZATION"` \| `"ACTIVITY_TYPE_SIGN_TRANSACTION"` \| `"ACTIVITY_TYPE_APPROVE_ACTIVITY"` \| `"ACTIVITY_TYPE_REJECT_ACTIVITY"` \| `"ACTIVITY_TYPE_DELETE_AUTHENTICATORS"` \| `"ACTIVITY_TYPE_CREATE_AUTHENTICATORS"` \| `"ACTIVITY_TYPE_CREATE_PRIVATE_KEY_TAG"` \| `"ACTIVITY_TYPE_DELETE_PRIVATE_KEY_TAGS"` \| `"ACTIVITY_TYPE_SET_PAYMENT_METHOD"` \| `"ACTIVITY_TYPE_ACTIVATE_BILLING_TIER"` \| `"ACTIVITY_TYPE_DELETE_PAYMENT_METHOD"` \| `"ACTIVITY_TYPE_CREATE_POLICY_V2"` \| `"ACTIVITY_TYPE_CREATE_POLICY_V3"` \| `"ACTIVITY_TYPE_CREATE_API_ONLY_USERS"` \| `"ACTIVITY_TYPE_UPDATE_ROOT_QUORUM"` \| `"ACTIVITY_TYPE_UPDATE_USER_TAG"` \| `"ACTIVITY_TYPE_UPDATE_PRIVATE_KEY_TAG"` \| `"ACTIVITY_TYPE_CREATE_AUTHENTICATORS_V2"` \| `"ACTIVITY_TYPE_CREATE_ORGANIZATION_V2"` \| `"ACTIVITY_TYPE_CREATE_USERS_V2"` \| `"ACTIVITY_TYPE_ACCEPT_INVITATION_V2"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V2"` \| `"ACTIVITY_TYPE_UPDATE_ALLOWED_ORIGINS"` \| `"ACTIVITY_TYPE_CREATE_PRIVATE_KEYS_V2"` \| `"ACTIVITY_TYPE_UPDATE_USER"` \| `"ACTIVITY_TYPE_UPDATE_POLICY"` \| `"ACTIVITY_TYPE_SET_PAYMENT_METHOD_V2"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V3"` \| `"ACTIVITY_TYPE_CREATE_WALLET"` \| `"ACTIVITY_TYPE_CREATE_WALLET_ACCOUNTS"` \| `"ACTIVITY_TYPE_INIT_USER_EMAIL_RECOVERY"` \| `"ACTIVITY_TYPE_RECOVER_USER"` \| `"ACTIVITY_TYPE_SET_ORGANIZATION_FEATURE"` \| `"ACTIVITY_TYPE_REMOVE_ORGANIZATION_FEATURE"` \| `"ACTIVITY_TYPE_SIGN_RAW_PAYLOAD_V2"` \| `"ACTIVITY_TYPE_SIGN_TRANSACTION_V2"` \| `"ACTIVITY_TYPE_EXPORT_PRIVATE_KEY"` \| `"ACTIVITY_TYPE_EXPORT_WALLET"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V4"` \| `"ACTIVITY_TYPE_EMAIL_AUTH"` \| `"ACTIVITY_TYPE_EXPORT_WALLET_ACCOUNT"` \| `"ACTIVITY_TYPE_INIT_IMPORT_WALLET"` \| `"ACTIVITY_TYPE_IMPORT_WALLET"` \| `"ACTIVITY_TYPE_INIT_IMPORT_PRIVATE_KEY"` \| `"ACTIVITY_TYPE_IMPORT_PRIVATE_KEY"` \| `"ACTIVITY_TYPE_CREATE_POLICIES"` \| `"ACTIVITY_TYPE_SIGN_RAW_PAYLOADS"` \| `"ACTIVITY_TYPE_CREATE_READ_ONLY_SESSION"` \| `"ACTIVITY_TYPE_CREATE_OAUTH_PROVIDERS"` \| `"ACTIVITY_TYPE_DELETE_OAUTH_PROVIDERS"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V5"` \| `"ACTIVITY_TYPE_OAUTH"` \| `"ACTIVITY_TYPE_CREATE_API_KEYS_V2"` \| `"ACTIVITY_TYPE_CREATE_READ_WRITE_SESSION"` \| `"ACTIVITY_TYPE_EMAIL_AUTH_V2"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V6"` \| `"ACTIVITY_TYPE_DELETE_PRIVATE_KEYS"` \| `"ACTIVITY_TYPE_DELETE_WALLETS"` \| `"ACTIVITY_TYPE_CREATE_READ_WRITE_SESSION_V2"` \| `"ACTIVITY_TYPE_DELETE_SUB_ORGANIZATION"` \| `"ACTIVITY_TYPE_INIT_OTP_AUTH"` \| `"ACTIVITY_TYPE_OTP_AUTH"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V7"` \| `"ACTIVITY_TYPE_UPDATE_WALLET"` \| `"ACTIVITY_TYPE_UPDATE_POLICY_V2"` \| `"ACTIVITY_TYPE_CREATE_USERS_V3"` \| `"ACTIVITY_TYPE_INIT_OTP_AUTH_V2"` + +Defined in: [shared.ts:63](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/http/src/shared.ts#L63) + +*** + +### cause + +> **cause**: `undefined` \| `Error` + +Defined in: [shared.ts:64](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/http/src/shared.ts#L64) diff --git a/sdks/http/index/SignedRequest/readme.mdx b/sdks/http/index/SignedRequest/readme.mdx new file mode 100644 index 00000000..40f5e294 --- /dev/null +++ b/sdks/http/index/SignedRequest/readme.mdx @@ -0,0 +1,40 @@ +--- +title: "SignedRequest" +mode: wide +--- + +# Type Alias: ~~SignedRequest~~ + +> **SignedRequest** = `object` + +Defined in: [base.ts:29](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/http/src/base.ts#L29) + +Represents a signed request ready to be POSTed to Turnkey + +## Deprecated + +use [TSignedRequest](../TSignedRequest/readme) instead + +## Properties + +### ~~body~~ + +> **body**: `string` + +Defined in: [base.ts:30](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/http/src/base.ts#L30) + +*** + +### ~~stamp~~ + +> **stamp**: `string` + +Defined in: [base.ts:31](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/http/src/base.ts#L31) + +*** + +### ~~url~~ + +> **url**: `string` + +Defined in: [base.ts:32](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/http/src/base.ts#L32) diff --git a/sdks/http/index/TActivity/readme.mdx b/sdks/http/index/TActivity/readme.mdx new file mode 100644 index 00000000..80b8627f --- /dev/null +++ b/sdks/http/index/TActivity/readme.mdx @@ -0,0 +1,10 @@ +--- +title: "TActivity" +mode: wide +--- + +# Type Alias: TActivity + +> **TActivity** = `definitions`\[`"v1Activity"`\] + +Defined in: [shared.ts:3](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/http/src/shared.ts#L3) diff --git a/sdks/http/index/TActivityId/readme.mdx b/sdks/http/index/TActivityId/readme.mdx new file mode 100644 index 00000000..c1762e97 --- /dev/null +++ b/sdks/http/index/TActivityId/readme.mdx @@ -0,0 +1,10 @@ +--- +title: "TActivityId" +mode: wide +--- + +# Type Alias: TActivityId + +> **TActivityId** = [`TActivity`](../TActivity/readme)\[`"id"`\] + +Defined in: [shared.ts:5](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/http/src/shared.ts#L5) diff --git a/sdks/http/index/TActivityResponse/readme.mdx b/sdks/http/index/TActivityResponse/readme.mdx new file mode 100644 index 00000000..2bea870e --- /dev/null +++ b/sdks/http/index/TActivityResponse/readme.mdx @@ -0,0 +1,10 @@ +--- +title: "TActivityResponse" +mode: wide +--- + +# Type Alias: TActivityResponse + +> **TActivityResponse** = `definitions`\[`"v1ActivityResponse"`\] + +Defined in: [shared.ts:4](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/http/src/shared.ts#L4) diff --git a/sdks/http/index/TActivityStatus/readme.mdx b/sdks/http/index/TActivityStatus/readme.mdx new file mode 100644 index 00000000..1ae99a87 --- /dev/null +++ b/sdks/http/index/TActivityStatus/readme.mdx @@ -0,0 +1,10 @@ +--- +title: "TActivityStatus" +mode: wide +--- + +# Type Alias: TActivityStatus + +> **TActivityStatus** = [`TActivity`](../TActivity/readme)\[`"status"`\] + +Defined in: [shared.ts:6](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/http/src/shared.ts#L6) diff --git a/sdks/http/index/TActivityType/readme.mdx b/sdks/http/index/TActivityType/readme.mdx new file mode 100644 index 00000000..a93b0190 --- /dev/null +++ b/sdks/http/index/TActivityType/readme.mdx @@ -0,0 +1,10 @@ +--- +title: "TActivityType" +mode: wide +--- + +# Type Alias: TActivityType + +> **TActivityType** = [`TActivity`](../TActivity/readme)\[`"type"`\] + +Defined in: [shared.ts:7](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/http/src/shared.ts#L7) diff --git a/sdks/http/index/TERMINAL_ACTIVITY_STATUSES/readme.mdx b/sdks/http/index/TERMINAL_ACTIVITY_STATUSES/readme.mdx new file mode 100644 index 00000000..57d3a5b1 --- /dev/null +++ b/sdks/http/index/TERMINAL_ACTIVITY_STATUSES/readme.mdx @@ -0,0 +1,10 @@ +--- +title: "TERMINAL_ACTIVITY_STATUSES" +mode: wide +--- + +# Variable: TERMINAL\_ACTIVITY\_STATUSES + +> `const` **TERMINAL\_ACTIVITY\_STATUSES**: `definitions`\[`"v1ActivityStatus"`\][] + +Defined in: [shared.ts:118](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/http/src/shared.ts#L118) diff --git a/sdks/http/index/TSignature/readme.mdx b/sdks/http/index/TSignature/readme.mdx new file mode 100644 index 00000000..cf493307 --- /dev/null +++ b/sdks/http/index/TSignature/readme.mdx @@ -0,0 +1,10 @@ +--- +title: "TSignature" +mode: wide +--- + +# Type Alias: TSignature + +> **TSignature** = `definitions`\[`"v1SignRawPayloadResult"`\] + +Defined in: [shared.ts:8](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/http/src/shared.ts#L8) diff --git a/sdks/http/index/TSignedRequest/readme.mdx b/sdks/http/index/TSignedRequest/readme.mdx new file mode 100644 index 00000000..48a2331a --- /dev/null +++ b/sdks/http/index/TSignedRequest/readme.mdx @@ -0,0 +1,36 @@ +--- +title: "TSignedRequest" +mode: wide +--- + +# Type Alias: TSignedRequest + +> **TSignedRequest** = `object` + +Defined in: [base.ts:264](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/http/src/base.ts#L264) + +Represents a signed request ready to be POSTed to Turnkey + +## Properties + +### body + +> **body**: `string` + +Defined in: [base.ts:265](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/http/src/base.ts#L265) + +*** + +### stamp + +> **stamp**: `TStamp` + +Defined in: [base.ts:266](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/http/src/base.ts#L266) + +*** + +### url + +> **url**: `string` + +Defined in: [base.ts:267](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/http/src/base.ts#L267) diff --git a/sdks/http/index/TurnkeyActivityConsensusNeededError/readme.mdx b/sdks/http/index/TurnkeyActivityConsensusNeededError/readme.mdx new file mode 100644 index 00000000..6a4ff1a2 --- /dev/null +++ b/sdks/http/index/TurnkeyActivityConsensusNeededError/readme.mdx @@ -0,0 +1,84 @@ +--- +title: "TurnkeyActivityConsensusNeededError" +mode: wide +--- + +# Class: TurnkeyActivityConsensusNeededError + +Defined in: [shared.ts:36](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/http/src/shared.ts#L36) + +## Extends + +- `Error` + +## Constructors + +### Constructor + +> **new TurnkeyActivityConsensusNeededError**(`input`): `TurnkeyActivityConsensusNeededError` + +Defined in: [shared.ts:42](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/http/src/shared.ts#L42) + +#### Parameters + +##### input + +###### activityId? + +`string` + +###### activityStatus? + +`"ACTIVITY_STATUS_CREATED"` \| `"ACTIVITY_STATUS_PENDING"` \| `"ACTIVITY_STATUS_COMPLETED"` \| `"ACTIVITY_STATUS_FAILED"` \| `"ACTIVITY_STATUS_CONSENSUS_NEEDED"` \| `"ACTIVITY_STATUS_REJECTED"` + +###### activityType? + +`"ACTIVITY_TYPE_CREATE_API_KEYS"` \| `"ACTIVITY_TYPE_CREATE_USERS"` \| `"ACTIVITY_TYPE_CREATE_PRIVATE_KEYS"` \| `"ACTIVITY_TYPE_SIGN_RAW_PAYLOAD"` \| `"ACTIVITY_TYPE_CREATE_INVITATIONS"` \| `"ACTIVITY_TYPE_ACCEPT_INVITATION"` \| `"ACTIVITY_TYPE_CREATE_POLICY"` \| `"ACTIVITY_TYPE_DISABLE_PRIVATE_KEY"` \| `"ACTIVITY_TYPE_DELETE_USERS"` \| `"ACTIVITY_TYPE_DELETE_API_KEYS"` \| `"ACTIVITY_TYPE_DELETE_INVITATION"` \| `"ACTIVITY_TYPE_DELETE_ORGANIZATION"` \| `"ACTIVITY_TYPE_DELETE_POLICY"` \| `"ACTIVITY_TYPE_CREATE_USER_TAG"` \| `"ACTIVITY_TYPE_DELETE_USER_TAGS"` \| `"ACTIVITY_TYPE_CREATE_ORGANIZATION"` \| `"ACTIVITY_TYPE_SIGN_TRANSACTION"` \| `"ACTIVITY_TYPE_APPROVE_ACTIVITY"` \| `"ACTIVITY_TYPE_REJECT_ACTIVITY"` \| `"ACTIVITY_TYPE_DELETE_AUTHENTICATORS"` \| `"ACTIVITY_TYPE_CREATE_AUTHENTICATORS"` \| `"ACTIVITY_TYPE_CREATE_PRIVATE_KEY_TAG"` \| `"ACTIVITY_TYPE_DELETE_PRIVATE_KEY_TAGS"` \| `"ACTIVITY_TYPE_SET_PAYMENT_METHOD"` \| `"ACTIVITY_TYPE_ACTIVATE_BILLING_TIER"` \| `"ACTIVITY_TYPE_DELETE_PAYMENT_METHOD"` \| `"ACTIVITY_TYPE_CREATE_POLICY_V2"` \| `"ACTIVITY_TYPE_CREATE_POLICY_V3"` \| `"ACTIVITY_TYPE_CREATE_API_ONLY_USERS"` \| `"ACTIVITY_TYPE_UPDATE_ROOT_QUORUM"` \| `"ACTIVITY_TYPE_UPDATE_USER_TAG"` \| `"ACTIVITY_TYPE_UPDATE_PRIVATE_KEY_TAG"` \| `"ACTIVITY_TYPE_CREATE_AUTHENTICATORS_V2"` \| `"ACTIVITY_TYPE_CREATE_ORGANIZATION_V2"` \| `"ACTIVITY_TYPE_CREATE_USERS_V2"` \| `"ACTIVITY_TYPE_ACCEPT_INVITATION_V2"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V2"` \| `"ACTIVITY_TYPE_UPDATE_ALLOWED_ORIGINS"` \| `"ACTIVITY_TYPE_CREATE_PRIVATE_KEYS_V2"` \| `"ACTIVITY_TYPE_UPDATE_USER"` \| `"ACTIVITY_TYPE_UPDATE_POLICY"` \| `"ACTIVITY_TYPE_SET_PAYMENT_METHOD_V2"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V3"` \| `"ACTIVITY_TYPE_CREATE_WALLET"` \| `"ACTIVITY_TYPE_CREATE_WALLET_ACCOUNTS"` \| `"ACTIVITY_TYPE_INIT_USER_EMAIL_RECOVERY"` \| `"ACTIVITY_TYPE_RECOVER_USER"` \| `"ACTIVITY_TYPE_SET_ORGANIZATION_FEATURE"` \| `"ACTIVITY_TYPE_REMOVE_ORGANIZATION_FEATURE"` \| `"ACTIVITY_TYPE_SIGN_RAW_PAYLOAD_V2"` \| `"ACTIVITY_TYPE_SIGN_TRANSACTION_V2"` \| `"ACTIVITY_TYPE_EXPORT_PRIVATE_KEY"` \| `"ACTIVITY_TYPE_EXPORT_WALLET"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V4"` \| `"ACTIVITY_TYPE_EMAIL_AUTH"` \| `"ACTIVITY_TYPE_EXPORT_WALLET_ACCOUNT"` \| `"ACTIVITY_TYPE_INIT_IMPORT_WALLET"` \| `"ACTIVITY_TYPE_IMPORT_WALLET"` \| `"ACTIVITY_TYPE_INIT_IMPORT_PRIVATE_KEY"` \| `"ACTIVITY_TYPE_IMPORT_PRIVATE_KEY"` \| `"ACTIVITY_TYPE_CREATE_POLICIES"` \| `"ACTIVITY_TYPE_SIGN_RAW_PAYLOADS"` \| `"ACTIVITY_TYPE_CREATE_READ_ONLY_SESSION"` \| `"ACTIVITY_TYPE_CREATE_OAUTH_PROVIDERS"` \| `"ACTIVITY_TYPE_DELETE_OAUTH_PROVIDERS"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V5"` \| `"ACTIVITY_TYPE_OAUTH"` \| `"ACTIVITY_TYPE_CREATE_API_KEYS_V2"` \| `"ACTIVITY_TYPE_CREATE_READ_WRITE_SESSION"` \| `"ACTIVITY_TYPE_EMAIL_AUTH_V2"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V6"` \| `"ACTIVITY_TYPE_DELETE_PRIVATE_KEYS"` \| `"ACTIVITY_TYPE_DELETE_WALLETS"` \| `"ACTIVITY_TYPE_CREATE_READ_WRITE_SESSION_V2"` \| `"ACTIVITY_TYPE_DELETE_SUB_ORGANIZATION"` \| `"ACTIVITY_TYPE_INIT_OTP_AUTH"` \| `"ACTIVITY_TYPE_OTP_AUTH"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V7"` \| `"ACTIVITY_TYPE_UPDATE_WALLET"` \| `"ACTIVITY_TYPE_UPDATE_POLICY_V2"` \| `"ACTIVITY_TYPE_CREATE_USERS_V3"` \| `"ACTIVITY_TYPE_INIT_OTP_AUTH_V2"` + +###### cause? + +`Error` + +###### message + +`string` + +#### Returns + +`TurnkeyActivityConsensusNeededError` + +#### Overrides + +`Error.constructor` + +## Properties + +### activityId + +> **activityId**: `undefined` \| `string` + +Defined in: [shared.ts:37](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/http/src/shared.ts#L37) + +*** + +### activityStatus + +> **activityStatus**: `undefined` \| `"ACTIVITY_STATUS_CREATED"` \| `"ACTIVITY_STATUS_PENDING"` \| `"ACTIVITY_STATUS_COMPLETED"` \| `"ACTIVITY_STATUS_FAILED"` \| `"ACTIVITY_STATUS_CONSENSUS_NEEDED"` \| `"ACTIVITY_STATUS_REJECTED"` + +Defined in: [shared.ts:38](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/http/src/shared.ts#L38) + +*** + +### activityType + +> **activityType**: `undefined` \| `"ACTIVITY_TYPE_CREATE_API_KEYS"` \| `"ACTIVITY_TYPE_CREATE_USERS"` \| `"ACTIVITY_TYPE_CREATE_PRIVATE_KEYS"` \| `"ACTIVITY_TYPE_SIGN_RAW_PAYLOAD"` \| `"ACTIVITY_TYPE_CREATE_INVITATIONS"` \| `"ACTIVITY_TYPE_ACCEPT_INVITATION"` \| `"ACTIVITY_TYPE_CREATE_POLICY"` \| `"ACTIVITY_TYPE_DISABLE_PRIVATE_KEY"` \| `"ACTIVITY_TYPE_DELETE_USERS"` \| `"ACTIVITY_TYPE_DELETE_API_KEYS"` \| `"ACTIVITY_TYPE_DELETE_INVITATION"` \| `"ACTIVITY_TYPE_DELETE_ORGANIZATION"` \| `"ACTIVITY_TYPE_DELETE_POLICY"` \| `"ACTIVITY_TYPE_CREATE_USER_TAG"` \| `"ACTIVITY_TYPE_DELETE_USER_TAGS"` \| `"ACTIVITY_TYPE_CREATE_ORGANIZATION"` \| `"ACTIVITY_TYPE_SIGN_TRANSACTION"` \| `"ACTIVITY_TYPE_APPROVE_ACTIVITY"` \| `"ACTIVITY_TYPE_REJECT_ACTIVITY"` \| `"ACTIVITY_TYPE_DELETE_AUTHENTICATORS"` \| `"ACTIVITY_TYPE_CREATE_AUTHENTICATORS"` \| `"ACTIVITY_TYPE_CREATE_PRIVATE_KEY_TAG"` \| `"ACTIVITY_TYPE_DELETE_PRIVATE_KEY_TAGS"` \| `"ACTIVITY_TYPE_SET_PAYMENT_METHOD"` \| `"ACTIVITY_TYPE_ACTIVATE_BILLING_TIER"` \| `"ACTIVITY_TYPE_DELETE_PAYMENT_METHOD"` \| `"ACTIVITY_TYPE_CREATE_POLICY_V2"` \| `"ACTIVITY_TYPE_CREATE_POLICY_V3"` \| `"ACTIVITY_TYPE_CREATE_API_ONLY_USERS"` \| `"ACTIVITY_TYPE_UPDATE_ROOT_QUORUM"` \| `"ACTIVITY_TYPE_UPDATE_USER_TAG"` \| `"ACTIVITY_TYPE_UPDATE_PRIVATE_KEY_TAG"` \| `"ACTIVITY_TYPE_CREATE_AUTHENTICATORS_V2"` \| `"ACTIVITY_TYPE_CREATE_ORGANIZATION_V2"` \| `"ACTIVITY_TYPE_CREATE_USERS_V2"` \| `"ACTIVITY_TYPE_ACCEPT_INVITATION_V2"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V2"` \| `"ACTIVITY_TYPE_UPDATE_ALLOWED_ORIGINS"` \| `"ACTIVITY_TYPE_CREATE_PRIVATE_KEYS_V2"` \| `"ACTIVITY_TYPE_UPDATE_USER"` \| `"ACTIVITY_TYPE_UPDATE_POLICY"` \| `"ACTIVITY_TYPE_SET_PAYMENT_METHOD_V2"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V3"` \| `"ACTIVITY_TYPE_CREATE_WALLET"` \| `"ACTIVITY_TYPE_CREATE_WALLET_ACCOUNTS"` \| `"ACTIVITY_TYPE_INIT_USER_EMAIL_RECOVERY"` \| `"ACTIVITY_TYPE_RECOVER_USER"` \| `"ACTIVITY_TYPE_SET_ORGANIZATION_FEATURE"` \| `"ACTIVITY_TYPE_REMOVE_ORGANIZATION_FEATURE"` \| `"ACTIVITY_TYPE_SIGN_RAW_PAYLOAD_V2"` \| `"ACTIVITY_TYPE_SIGN_TRANSACTION_V2"` \| `"ACTIVITY_TYPE_EXPORT_PRIVATE_KEY"` \| `"ACTIVITY_TYPE_EXPORT_WALLET"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V4"` \| `"ACTIVITY_TYPE_EMAIL_AUTH"` \| `"ACTIVITY_TYPE_EXPORT_WALLET_ACCOUNT"` \| `"ACTIVITY_TYPE_INIT_IMPORT_WALLET"` \| `"ACTIVITY_TYPE_IMPORT_WALLET"` \| `"ACTIVITY_TYPE_INIT_IMPORT_PRIVATE_KEY"` \| `"ACTIVITY_TYPE_IMPORT_PRIVATE_KEY"` \| `"ACTIVITY_TYPE_CREATE_POLICIES"` \| `"ACTIVITY_TYPE_SIGN_RAW_PAYLOADS"` \| `"ACTIVITY_TYPE_CREATE_READ_ONLY_SESSION"` \| `"ACTIVITY_TYPE_CREATE_OAUTH_PROVIDERS"` \| `"ACTIVITY_TYPE_DELETE_OAUTH_PROVIDERS"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V5"` \| `"ACTIVITY_TYPE_OAUTH"` \| `"ACTIVITY_TYPE_CREATE_API_KEYS_V2"` \| `"ACTIVITY_TYPE_CREATE_READ_WRITE_SESSION"` \| `"ACTIVITY_TYPE_EMAIL_AUTH_V2"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V6"` \| `"ACTIVITY_TYPE_DELETE_PRIVATE_KEYS"` \| `"ACTIVITY_TYPE_DELETE_WALLETS"` \| `"ACTIVITY_TYPE_CREATE_READ_WRITE_SESSION_V2"` \| `"ACTIVITY_TYPE_DELETE_SUB_ORGANIZATION"` \| `"ACTIVITY_TYPE_INIT_OTP_AUTH"` \| `"ACTIVITY_TYPE_OTP_AUTH"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V7"` \| `"ACTIVITY_TYPE_UPDATE_WALLET"` \| `"ACTIVITY_TYPE_UPDATE_POLICY_V2"` \| `"ACTIVITY_TYPE_CREATE_USERS_V3"` \| `"ACTIVITY_TYPE_INIT_OTP_AUTH_V2"` + +Defined in: [shared.ts:39](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/http/src/shared.ts#L39) + +*** + +### cause + +> **cause**: `undefined` \| `Error` + +Defined in: [shared.ts:40](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/http/src/shared.ts#L40) diff --git a/sdks/http/index/TurnkeyActivityError/readme.mdx b/sdks/http/index/TurnkeyActivityError/readme.mdx new file mode 100644 index 00000000..a2117cdf --- /dev/null +++ b/sdks/http/index/TurnkeyActivityError/readme.mdx @@ -0,0 +1,84 @@ +--- +title: "TurnkeyActivityError" +mode: wide +--- + +# Class: TurnkeyActivityError + +Defined in: [shared.ts:12](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/http/src/shared.ts#L12) + +## Extends + +- `Error` + +## Constructors + +### Constructor + +> **new TurnkeyActivityError**(`input`): `TurnkeyActivityError` + +Defined in: [shared.ts:18](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/http/src/shared.ts#L18) + +#### Parameters + +##### input + +###### activityId? + +`string` + +###### activityStatus? + +`"ACTIVITY_STATUS_CREATED"` \| `"ACTIVITY_STATUS_PENDING"` \| `"ACTIVITY_STATUS_COMPLETED"` \| `"ACTIVITY_STATUS_FAILED"` \| `"ACTIVITY_STATUS_CONSENSUS_NEEDED"` \| `"ACTIVITY_STATUS_REJECTED"` + +###### activityType? + +`"ACTIVITY_TYPE_CREATE_API_KEYS"` \| `"ACTIVITY_TYPE_CREATE_USERS"` \| `"ACTIVITY_TYPE_CREATE_PRIVATE_KEYS"` \| `"ACTIVITY_TYPE_SIGN_RAW_PAYLOAD"` \| `"ACTIVITY_TYPE_CREATE_INVITATIONS"` \| `"ACTIVITY_TYPE_ACCEPT_INVITATION"` \| `"ACTIVITY_TYPE_CREATE_POLICY"` \| `"ACTIVITY_TYPE_DISABLE_PRIVATE_KEY"` \| `"ACTIVITY_TYPE_DELETE_USERS"` \| `"ACTIVITY_TYPE_DELETE_API_KEYS"` \| `"ACTIVITY_TYPE_DELETE_INVITATION"` \| `"ACTIVITY_TYPE_DELETE_ORGANIZATION"` \| `"ACTIVITY_TYPE_DELETE_POLICY"` \| `"ACTIVITY_TYPE_CREATE_USER_TAG"` \| `"ACTIVITY_TYPE_DELETE_USER_TAGS"` \| `"ACTIVITY_TYPE_CREATE_ORGANIZATION"` \| `"ACTIVITY_TYPE_SIGN_TRANSACTION"` \| `"ACTIVITY_TYPE_APPROVE_ACTIVITY"` \| `"ACTIVITY_TYPE_REJECT_ACTIVITY"` \| `"ACTIVITY_TYPE_DELETE_AUTHENTICATORS"` \| `"ACTIVITY_TYPE_CREATE_AUTHENTICATORS"` \| `"ACTIVITY_TYPE_CREATE_PRIVATE_KEY_TAG"` \| `"ACTIVITY_TYPE_DELETE_PRIVATE_KEY_TAGS"` \| `"ACTIVITY_TYPE_SET_PAYMENT_METHOD"` \| `"ACTIVITY_TYPE_ACTIVATE_BILLING_TIER"` \| `"ACTIVITY_TYPE_DELETE_PAYMENT_METHOD"` \| `"ACTIVITY_TYPE_CREATE_POLICY_V2"` \| `"ACTIVITY_TYPE_CREATE_POLICY_V3"` \| `"ACTIVITY_TYPE_CREATE_API_ONLY_USERS"` \| `"ACTIVITY_TYPE_UPDATE_ROOT_QUORUM"` \| `"ACTIVITY_TYPE_UPDATE_USER_TAG"` \| `"ACTIVITY_TYPE_UPDATE_PRIVATE_KEY_TAG"` \| `"ACTIVITY_TYPE_CREATE_AUTHENTICATORS_V2"` \| `"ACTIVITY_TYPE_CREATE_ORGANIZATION_V2"` \| `"ACTIVITY_TYPE_CREATE_USERS_V2"` \| `"ACTIVITY_TYPE_ACCEPT_INVITATION_V2"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V2"` \| `"ACTIVITY_TYPE_UPDATE_ALLOWED_ORIGINS"` \| `"ACTIVITY_TYPE_CREATE_PRIVATE_KEYS_V2"` \| `"ACTIVITY_TYPE_UPDATE_USER"` \| `"ACTIVITY_TYPE_UPDATE_POLICY"` \| `"ACTIVITY_TYPE_SET_PAYMENT_METHOD_V2"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V3"` \| `"ACTIVITY_TYPE_CREATE_WALLET"` \| `"ACTIVITY_TYPE_CREATE_WALLET_ACCOUNTS"` \| `"ACTIVITY_TYPE_INIT_USER_EMAIL_RECOVERY"` \| `"ACTIVITY_TYPE_RECOVER_USER"` \| `"ACTIVITY_TYPE_SET_ORGANIZATION_FEATURE"` \| `"ACTIVITY_TYPE_REMOVE_ORGANIZATION_FEATURE"` \| `"ACTIVITY_TYPE_SIGN_RAW_PAYLOAD_V2"` \| `"ACTIVITY_TYPE_SIGN_TRANSACTION_V2"` \| `"ACTIVITY_TYPE_EXPORT_PRIVATE_KEY"` \| `"ACTIVITY_TYPE_EXPORT_WALLET"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V4"` \| `"ACTIVITY_TYPE_EMAIL_AUTH"` \| `"ACTIVITY_TYPE_EXPORT_WALLET_ACCOUNT"` \| `"ACTIVITY_TYPE_INIT_IMPORT_WALLET"` \| `"ACTIVITY_TYPE_IMPORT_WALLET"` \| `"ACTIVITY_TYPE_INIT_IMPORT_PRIVATE_KEY"` \| `"ACTIVITY_TYPE_IMPORT_PRIVATE_KEY"` \| `"ACTIVITY_TYPE_CREATE_POLICIES"` \| `"ACTIVITY_TYPE_SIGN_RAW_PAYLOADS"` \| `"ACTIVITY_TYPE_CREATE_READ_ONLY_SESSION"` \| `"ACTIVITY_TYPE_CREATE_OAUTH_PROVIDERS"` \| `"ACTIVITY_TYPE_DELETE_OAUTH_PROVIDERS"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V5"` \| `"ACTIVITY_TYPE_OAUTH"` \| `"ACTIVITY_TYPE_CREATE_API_KEYS_V2"` \| `"ACTIVITY_TYPE_CREATE_READ_WRITE_SESSION"` \| `"ACTIVITY_TYPE_EMAIL_AUTH_V2"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V6"` \| `"ACTIVITY_TYPE_DELETE_PRIVATE_KEYS"` \| `"ACTIVITY_TYPE_DELETE_WALLETS"` \| `"ACTIVITY_TYPE_CREATE_READ_WRITE_SESSION_V2"` \| `"ACTIVITY_TYPE_DELETE_SUB_ORGANIZATION"` \| `"ACTIVITY_TYPE_INIT_OTP_AUTH"` \| `"ACTIVITY_TYPE_OTP_AUTH"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V7"` \| `"ACTIVITY_TYPE_UPDATE_WALLET"` \| `"ACTIVITY_TYPE_UPDATE_POLICY_V2"` \| `"ACTIVITY_TYPE_CREATE_USERS_V3"` \| `"ACTIVITY_TYPE_INIT_OTP_AUTH_V2"` + +###### cause? + +`Error` + +###### message + +`string` + +#### Returns + +`TurnkeyActivityError` + +#### Overrides + +`Error.constructor` + +## Properties + +### activityId + +> **activityId**: `undefined` \| `string` + +Defined in: [shared.ts:13](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/http/src/shared.ts#L13) + +*** + +### activityStatus + +> **activityStatus**: `undefined` \| `"ACTIVITY_STATUS_CREATED"` \| `"ACTIVITY_STATUS_PENDING"` \| `"ACTIVITY_STATUS_COMPLETED"` \| `"ACTIVITY_STATUS_FAILED"` \| `"ACTIVITY_STATUS_CONSENSUS_NEEDED"` \| `"ACTIVITY_STATUS_REJECTED"` + +Defined in: [shared.ts:14](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/http/src/shared.ts#L14) + +*** + +### activityType + +> **activityType**: `undefined` \| `"ACTIVITY_TYPE_CREATE_API_KEYS"` \| `"ACTIVITY_TYPE_CREATE_USERS"` \| `"ACTIVITY_TYPE_CREATE_PRIVATE_KEYS"` \| `"ACTIVITY_TYPE_SIGN_RAW_PAYLOAD"` \| `"ACTIVITY_TYPE_CREATE_INVITATIONS"` \| `"ACTIVITY_TYPE_ACCEPT_INVITATION"` \| `"ACTIVITY_TYPE_CREATE_POLICY"` \| `"ACTIVITY_TYPE_DISABLE_PRIVATE_KEY"` \| `"ACTIVITY_TYPE_DELETE_USERS"` \| `"ACTIVITY_TYPE_DELETE_API_KEYS"` \| `"ACTIVITY_TYPE_DELETE_INVITATION"` \| `"ACTIVITY_TYPE_DELETE_ORGANIZATION"` \| `"ACTIVITY_TYPE_DELETE_POLICY"` \| `"ACTIVITY_TYPE_CREATE_USER_TAG"` \| `"ACTIVITY_TYPE_DELETE_USER_TAGS"` \| `"ACTIVITY_TYPE_CREATE_ORGANIZATION"` \| `"ACTIVITY_TYPE_SIGN_TRANSACTION"` \| `"ACTIVITY_TYPE_APPROVE_ACTIVITY"` \| `"ACTIVITY_TYPE_REJECT_ACTIVITY"` \| `"ACTIVITY_TYPE_DELETE_AUTHENTICATORS"` \| `"ACTIVITY_TYPE_CREATE_AUTHENTICATORS"` \| `"ACTIVITY_TYPE_CREATE_PRIVATE_KEY_TAG"` \| `"ACTIVITY_TYPE_DELETE_PRIVATE_KEY_TAGS"` \| `"ACTIVITY_TYPE_SET_PAYMENT_METHOD"` \| `"ACTIVITY_TYPE_ACTIVATE_BILLING_TIER"` \| `"ACTIVITY_TYPE_DELETE_PAYMENT_METHOD"` \| `"ACTIVITY_TYPE_CREATE_POLICY_V2"` \| `"ACTIVITY_TYPE_CREATE_POLICY_V3"` \| `"ACTIVITY_TYPE_CREATE_API_ONLY_USERS"` \| `"ACTIVITY_TYPE_UPDATE_ROOT_QUORUM"` \| `"ACTIVITY_TYPE_UPDATE_USER_TAG"` \| `"ACTIVITY_TYPE_UPDATE_PRIVATE_KEY_TAG"` \| `"ACTIVITY_TYPE_CREATE_AUTHENTICATORS_V2"` \| `"ACTIVITY_TYPE_CREATE_ORGANIZATION_V2"` \| `"ACTIVITY_TYPE_CREATE_USERS_V2"` \| `"ACTIVITY_TYPE_ACCEPT_INVITATION_V2"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V2"` \| `"ACTIVITY_TYPE_UPDATE_ALLOWED_ORIGINS"` \| `"ACTIVITY_TYPE_CREATE_PRIVATE_KEYS_V2"` \| `"ACTIVITY_TYPE_UPDATE_USER"` \| `"ACTIVITY_TYPE_UPDATE_POLICY"` \| `"ACTIVITY_TYPE_SET_PAYMENT_METHOD_V2"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V3"` \| `"ACTIVITY_TYPE_CREATE_WALLET"` \| `"ACTIVITY_TYPE_CREATE_WALLET_ACCOUNTS"` \| `"ACTIVITY_TYPE_INIT_USER_EMAIL_RECOVERY"` \| `"ACTIVITY_TYPE_RECOVER_USER"` \| `"ACTIVITY_TYPE_SET_ORGANIZATION_FEATURE"` \| `"ACTIVITY_TYPE_REMOVE_ORGANIZATION_FEATURE"` \| `"ACTIVITY_TYPE_SIGN_RAW_PAYLOAD_V2"` \| `"ACTIVITY_TYPE_SIGN_TRANSACTION_V2"` \| `"ACTIVITY_TYPE_EXPORT_PRIVATE_KEY"` \| `"ACTIVITY_TYPE_EXPORT_WALLET"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V4"` \| `"ACTIVITY_TYPE_EMAIL_AUTH"` \| `"ACTIVITY_TYPE_EXPORT_WALLET_ACCOUNT"` \| `"ACTIVITY_TYPE_INIT_IMPORT_WALLET"` \| `"ACTIVITY_TYPE_IMPORT_WALLET"` \| `"ACTIVITY_TYPE_INIT_IMPORT_PRIVATE_KEY"` \| `"ACTIVITY_TYPE_IMPORT_PRIVATE_KEY"` \| `"ACTIVITY_TYPE_CREATE_POLICIES"` \| `"ACTIVITY_TYPE_SIGN_RAW_PAYLOADS"` \| `"ACTIVITY_TYPE_CREATE_READ_ONLY_SESSION"` \| `"ACTIVITY_TYPE_CREATE_OAUTH_PROVIDERS"` \| `"ACTIVITY_TYPE_DELETE_OAUTH_PROVIDERS"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V5"` \| `"ACTIVITY_TYPE_OAUTH"` \| `"ACTIVITY_TYPE_CREATE_API_KEYS_V2"` \| `"ACTIVITY_TYPE_CREATE_READ_WRITE_SESSION"` \| `"ACTIVITY_TYPE_EMAIL_AUTH_V2"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V6"` \| `"ACTIVITY_TYPE_DELETE_PRIVATE_KEYS"` \| `"ACTIVITY_TYPE_DELETE_WALLETS"` \| `"ACTIVITY_TYPE_CREATE_READ_WRITE_SESSION_V2"` \| `"ACTIVITY_TYPE_DELETE_SUB_ORGANIZATION"` \| `"ACTIVITY_TYPE_INIT_OTP_AUTH"` \| `"ACTIVITY_TYPE_OTP_AUTH"` \| `"ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V7"` \| `"ACTIVITY_TYPE_UPDATE_WALLET"` \| `"ACTIVITY_TYPE_UPDATE_POLICY_V2"` \| `"ACTIVITY_TYPE_CREATE_USERS_V3"` \| `"ACTIVITY_TYPE_INIT_OTP_AUTH_V2"` + +Defined in: [shared.ts:15](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/http/src/shared.ts#L15) + +*** + +### cause + +> **cause**: `undefined` \| `Error` + +Defined in: [shared.ts:16](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/http/src/shared.ts#L16) diff --git a/sdks/http/index/TurnkeyRequestError/readme.mdx b/sdks/http/index/TurnkeyRequestError/readme.mdx new file mode 100644 index 00000000..6196d8d4 --- /dev/null +++ b/sdks/http/index/TurnkeyRequestError/readme.mdx @@ -0,0 +1,50 @@ +--- +title: "TurnkeyRequestError" +mode: wide +--- + +# Class: TurnkeyRequestError + +Defined in: [base.ts:294](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/http/src/base.ts#L294) + +## Extends + +- `Error` + +## Constructors + +### Constructor + +> **new TurnkeyRequestError**(`input`): `TurnkeyRequestError` + +Defined in: [base.ts:298](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/http/src/base.ts#L298) + +#### Parameters + +##### input + +`GrpcStatus` + +#### Returns + +`TurnkeyRequestError` + +#### Overrides + +`Error.constructor` + +## Properties + +### code + +> **code**: `number` + +Defined in: [base.ts:296](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/http/src/base.ts#L296) + +*** + +### details + +> **details**: `null` \| `any`[] + +Defined in: [base.ts:295](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/http/src/base.ts#L295) diff --git a/sdks/http/index/VERSION/readme.mdx b/sdks/http/index/VERSION/readme.mdx new file mode 100644 index 00000000..2f4f26f1 --- /dev/null +++ b/sdks/http/index/VERSION/readme.mdx @@ -0,0 +1,10 @@ +--- +title: "VERSION" +mode: wide +--- + +# Variable: VERSION + +> `const` **VERSION**: `"@turnkey/http@3.0.0"` = `"@turnkey/http@3.0.0"` + +Defined in: [version.ts:1](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/http/src/version.ts#L1) diff --git a/sdks/http/index/assertActivityCompleted/readme.mdx b/sdks/http/index/assertActivityCompleted/readme.mdx new file mode 100644 index 00000000..338e8913 --- /dev/null +++ b/sdks/http/index/assertActivityCompleted/readme.mdx @@ -0,0 +1,18 @@ +--- +title: "AssertActivityCompleted" +mode: wide +--- + +# Function: assertActivityCompleted() + +> **assertActivityCompleted**(`activity`): `boolean` + +Defined in: [shared.ts:84](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/http/src/shared.ts#L84) + +## Parameters + +### activity + +## Returns + +`boolean` diff --git a/sdks/http/index/assertNonNull/readme.mdx b/sdks/http/index/assertNonNull/readme.mdx new file mode 100644 index 00000000..66e4ad82 --- /dev/null +++ b/sdks/http/index/assertNonNull/readme.mdx @@ -0,0 +1,26 @@ +--- +title: "AssertNonNull" +mode: wide +--- + +# Function: assertNonNull() + +> **assertNonNull**\<`T`\>(`input`): `T` + +Defined in: [shared.ts:110](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/http/src/shared.ts#L110) + +## Type Parameters + +### T + +`T` + +## Parameters + +### input + +`undefined` | `null` | `T` + +## Returns + +`T` diff --git a/sdks/http/index/browserInit/readme.mdx b/sdks/http/index/browserInit/readme.mdx new file mode 100644 index 00000000..0f5a55c0 --- /dev/null +++ b/sdks/http/index/browserInit/readme.mdx @@ -0,0 +1,24 @@ +--- +title: "BrowserInit" +mode: wide +--- + +# Function: ~~browserInit()~~ + +> **browserInit**(`value`): `void` + +Defined in: [config.ts:38](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/http/src/config.ts#L38) + +## Parameters + +### value + +`TBrowserConfig` + +## Returns + +`void` + +## Deprecated + +use [TurnkeyClient](../../TurnkeyClient/readme) instead, which doesn't rely on global initialization logic. diff --git a/sdks/http/index/createActivityPoller/readme.mdx b/sdks/http/index/createActivityPoller/readme.mdx new file mode 100644 index 00000000..b78b5727 --- /dev/null +++ b/sdks/http/index/createActivityPoller/readme.mdx @@ -0,0 +1,64 @@ +--- +title: "CreateActivityPoller" +mode: wide +--- + +# Function: createActivityPoller() + +> **createActivityPoller**\<`O`, `I`\>(`params`): (`input`) => `Promise`\<`O`\[`"activity"`\]\> + +Defined in: [async.ts:101](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/http/src/async.ts#L101) + +Wraps a client request function (e.g. `client.createPrivateKeys`) in a poller. +The default refresh interval is 500ms. + +The returned poller will poll until the activity becomes `COMPLETED`. +If the activity becomes `FAILED` or `REJECTED` or is flagged as `NEEDS_CONSENSUS`, an error is thrown. + +## Type Parameters + +### O + +`O` *extends* `object` + +### I + +`I` *extends* `object` + +## Parameters + +### params + +#### client + +`TurnkeyClient` + +#### refreshIntervalMs? + +`number` + +#### requestFn + +(`input`) => `Promise`\<`O`\> + +## Returns + +`Function` + +### Parameters + +#### input + +`I` + +### Returns + +`Promise`\<`O`\[`"activity"`\]\> + +## Example + +```ts +const activityPoller = createActivityPoller(client, client.createPrivateKeys); +const activity = await activityPoller(input); +console.log(activity.result); // activity is completed +``` diff --git a/sdks/http/index/getSignatureFromActivity/readme.mdx b/sdks/http/index/getSignatureFromActivity/readme.mdx new file mode 100644 index 00000000..dd2aa0a5 --- /dev/null +++ b/sdks/http/index/getSignatureFromActivity/readme.mdx @@ -0,0 +1,25 @@ +--- +title: "GetSignatureFromActivity" +mode: wide +--- + +# Function: getSignatureFromActivity() + +> **getSignatureFromActivity**(`activity`): `object` + +Defined in: [shared.ts:131](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/http/src/shared.ts#L131) + +This function is a helper method to easily extract a signature string from a completed signing activity. +Particularly useful for scenarios where a signature requires consensus + +## Parameters + +### activity + +the signing activity + +## Returns + +`object` + +signature {r, s, v} diff --git a/sdks/http/index/getSignaturesFromActivity/readme.mdx b/sdks/http/index/getSignaturesFromActivity/readme.mdx new file mode 100644 index 00000000..3da8f6e6 --- /dev/null +++ b/sdks/http/index/getSignaturesFromActivity/readme.mdx @@ -0,0 +1,25 @@ +--- +title: "GetSignaturesFromActivity" +mode: wide +--- + +# Function: getSignaturesFromActivity() + +> **getSignaturesFromActivity**(`activity`): `object`[] + +Defined in: [shared.ts:159](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/http/src/shared.ts#L159) + +This function is a helper method to easily extract signature strings from a completed signing activity. +Particularly useful for scenarios where a signature requires consensus + +## Parameters + +### activity + +the signing activity + +## Returns + +`object`[] + +signatures {r, s, v}[] diff --git a/sdks/http/index/getSignedTransactionFromActivity/readme.mdx b/sdks/http/index/getSignedTransactionFromActivity/readme.mdx new file mode 100644 index 00000000..31f9efc7 --- /dev/null +++ b/sdks/http/index/getSignedTransactionFromActivity/readme.mdx @@ -0,0 +1,25 @@ +--- +title: "GetSignedTransactionFromActivity" +mode: wide +--- + +# Function: getSignedTransactionFromActivity() + +> **getSignedTransactionFromActivity**(`activity`): `string` + +Defined in: [shared.ts:182](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/http/src/shared.ts#L182) + +This function is a helper method to easily extract a signed transaction from a completed signing activity. +Particularly useful for scenarios where a signature requires consensus + +## Parameters + +### activity + +the signing activity + +## Returns + +`string` + +signed transaction string diff --git a/sdks/http/index/getWebAuthnAttestation/readme.mdx b/sdks/http/index/getWebAuthnAttestation/readme.mdx new file mode 100644 index 00000000..fef563a5 --- /dev/null +++ b/sdks/http/index/getWebAuthnAttestation/readme.mdx @@ -0,0 +1,20 @@ +--- +title: "GetWebAuthnAttestation" +mode: wide +--- + +# Function: getWebAuthnAttestation() + +> **getWebAuthnAttestation**(`options`): `Promise`\<\{\}\> + +Defined in: [webauthn.ts:135](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/http/src/webauthn.ts#L135) + +## Parameters + +### options + +`CredentialCreationOptions` + +## Returns + +`Promise`\<\{\}\> diff --git a/sdks/http/index/init/readme.mdx b/sdks/http/index/init/readme.mdx new file mode 100644 index 00000000..84373e6f --- /dev/null +++ b/sdks/http/index/init/readme.mdx @@ -0,0 +1,24 @@ +--- +title: "Init" +mode: wide +--- + +# Function: ~~init()~~ + +> **init**(`value`): `void` + +Defined in: [config.ts:45](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/http/src/config.ts#L45) + +## Parameters + +### value + +`TConfig` + +## Returns + +`void` + +## Deprecated + +use [TurnkeyClient](../../TurnkeyClient/readme) instead, which doesn't rely on global initialization logic. diff --git a/sdks/http/index/readme.mdx b/sdks/http/index/readme.mdx new file mode 100644 index 00000000..55d825f1 --- /dev/null +++ b/sdks/http/index/readme.mdx @@ -0,0 +1,43 @@ +--- +title: "Index" +mode: wide +--- + +# index + +## Classes + +- [InvalidArgumentError](InvalidArgumentError/readme) +- [TurnkeyActivityConsensusNeededError](TurnkeyActivityConsensusNeededError/readme) +- [TurnkeyActivityError](TurnkeyActivityError/readme) +- [TurnkeyRequestError](TurnkeyRequestError/readme) + +## Type Aliases + +- [~~SignedRequest~~](SignedRequest/readme) +- [TActivity](TActivity/readme) +- [TActivityId](TActivityId/readme) +- [TActivityResponse](TActivityResponse/readme) +- [TActivityStatus](TActivityStatus/readme) +- [TActivityType](TActivityType/readme) +- [TSignature](TSignature/readme) +- [TSignedRequest](TSignedRequest/readme) + +## Variables + +- [TERMINAL\_ACTIVITY\_STATUSES](TERMINAL_ACTIVITY_STATUSES/readme) +- [VERSION](VERSION/readme) + +## Functions + +- [assertActivityCompleted](assertActivityCompleted/readme) +- [assertNonNull](assertNonNull/readme) +- [~~browserInit~~](browserInit/readme) +- [createActivityPoller](createActivityPoller/readme) +- [getSignatureFromActivity](getSignatureFromActivity/readme) +- [getSignaturesFromActivity](getSignaturesFromActivity/readme) +- [getSignedTransactionFromActivity](getSignedTransactionFromActivity/readme) +- [getWebAuthnAttestation](getWebAuthnAttestation/readme) +- [~~init~~](init/readme) +- [sealAndStampRequestBody](sealAndStampRequestBody/readme) +- [~~withAsyncPolling~~](withAsyncPolling/readme) diff --git a/sdks/http/index/sealAndStampRequestBody/readme.mdx b/sdks/http/index/sealAndStampRequestBody/readme.mdx new file mode 100644 index 00000000..89e35cff --- /dev/null +++ b/sdks/http/index/sealAndStampRequestBody/readme.mdx @@ -0,0 +1,36 @@ +--- +title: "SealAndStampRequestBody" +mode: wide +--- + +# Function: sealAndStampRequestBody() + +> **sealAndStampRequestBody**(`input`): `Promise`\<\{ `sealedBody`: `string`; `xStamp`: `string`; \}\> + +Defined in: [base.ts:216](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/http/src/base.ts#L216) + +Seals and stamps the request body with your Turnkey API credentials. + +You can either: +- Before calling `sealAndStampRequestBody(...)`, initialize with your Turnkey API credentials via `init(...)` +- Or, provide `apiPublicKey` and `apiPrivateKey` here as arguments + +## Parameters + +### input + +#### apiPrivateKey? + +`string` + +#### apiPublicKey? + +`string` + +#### body + +`Record`\<`string`, `any`\> + +## Returns + +`Promise`\<\{ `sealedBody`: `string`; `xStamp`: `string`; \}\> diff --git a/sdks/http/index/withAsyncPolling/readme.mdx b/sdks/http/index/withAsyncPolling/readme.mdx new file mode 100644 index 00000000..4f26490f --- /dev/null +++ b/sdks/http/index/withAsyncPolling/readme.mdx @@ -0,0 +1,53 @@ +--- +title: "WithAsyncPolling" +mode: wide +--- + +# Function: ~~withAsyncPolling()~~ + +> **withAsyncPolling**\<`O`, `I`\>(`params`): (`input`) => `Promise`\<`O`\[`"activity"`\]\> + +Defined in: [async.ts:13](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/http/src/async.ts#L13) + +Wraps a request to create a fetcher with built-in async polling support. + +## Type Parameters + +### O + +`O` *extends* `object` + +### I + +`I` *extends* `object` + +## Parameters + +### params + +#### refreshIntervalMs? + +`number` + +#### request + +(`input`) => `Promise`\<`O`\> + +## Returns + +`Function` + +### Parameters + +#### input + +`I` + +### Returns + +`Promise`\<`O`\[`"activity"`\]\> + +## Deprecated + +this function only works with TurnkeyApi. +Use [TurnkeyClient](../../TurnkeyClient/readme) and [createActivityPoller](../createActivityPoller/readme) instead. diff --git a/sdks/http/readme.mdx b/sdks/http/readme.mdx new file mode 100644 index 00000000..ab09a13e --- /dev/null +++ b/sdks/http/readme.mdx @@ -0,0 +1,108 @@ +--- +title: "Http" +mode: wide +--- + +# @turnkey/http + +[![npm](https://img.shields.io/npm/v/@turnkey/http?color=%234C48FF)](https://www.npmjs.com/package/@turnkey/http) + +A lower-level, fully typed HTTP client for interacting with [Turnkey](https://turnkey.com) API. + +For signing transactions and messages, check out the higher-level [`@turnkey/ethers`](https://www.npmjs.com/package/@turnkey/ethers) or [`@turnkey/viem`](https://www.npmjs.com/package/@turnkey/viem) signers. + +Turnkey API documentation lives here: https://docs.turnkey.com. + +## Getting started + +```bash +$ npm install @turnkey/http +``` + +```typescript +import { ApiKeyStamper } from "@turnkey/api-key-stamper"; +import { TurnkeyClient } from "@turnkey/http"; + +// This stamper produces signatures using the API key pair passed in. +const stamper = new ApiKeyStamper({ + apiPublicKey: "...", + apiPrivateKey: "...", +}); + +// The Turnkey client uses the passed in stamper to produce signed requests +// and sends them to Turnkey +const client = new TurnkeyClient( + { + baseUrl: "https://api.turnkey.com", + }, + stamper, +); + +// Now you can make authenticated requests! +const data = await client.getWhoami({ + organizationId: "", +}); +``` + +## HTTP fetchers + +`@turnkey/http` provides fully typed http fetchers for interacting with the Turnkey API. You can find all available methods [here](/packages/http/src/__generated__/services/coordinator/public/v1/public_api.fetcher.ts). The types of input parameters and output responses are also exported for convenience. + +The OpenAPI spec that generates all fetchers is also [included](/packages/http/src/__generated__/services/coordinator/public/v1/public_api.swagger.json) in the package. + +## `withAsyncPolling(...)` helper + +All Turnkey mutation endpoints are asynchronous (with the exception of private key-related signing endpoints, e.g. `/submit/sign_transaction`, `/submit/sign_raw_payload`). To help you simplify async mutations, `@turnkey/http` provides a `withAsyncPolling(...)` wrapper. Here's a quick example: + +```typescript +import { withAsyncPolling, TurnkeyActivityError } from "@turnkey/http"; + +// Use `withAsyncPolling(...)` to wrap & create a fetcher with built-in async polling support +const fetcher = withAsyncPolling({ + request: client.createPrivateKeys, +}); + +// The fetcher remains fully typed. After submitting the request, +// it'll poll until the activity reaches a terminal state. +try { + const activity = await fetcher({ + body: { + /* ... */ + }, + }); + + // Success! + console.log( + activity.result.createPrivateKeysResultV2?.privateKeys?.[0]?.privateKeyId, + ); +} catch (error) { + if (error instanceof TurnkeyActivityError) { + // In case the activity is rejected, failed, or requires consensus, + // a rich `TurnkeyActivityError` will be thrown. You can read from + // `TurnkeyActivityError` to find out why the activity didn't succeed. + // + // For instance, if your activity requires consensus and doesn't have + // enough approvals, you can get the `activityId` from `TurnkeyActivityError`, + // store it somewhere, then re-fetch the activity via `.postGetActivity(...)` + // when the required approvals/rejections are in place. + } +} +``` + +## More examples + +See [`createNewEthereumPrivateKey.ts`](/examples/with-ethers/src/createNewEthereumPrivateKey.ts) in the [`with-ethers`](/examples/with-ethers/) example. + +## See also + +- [`@turnkey/ethers`](https://www.npmjs.com/package/@turnkey/ethers): Turnkey Signer for [`Ethers`](https://docs.ethers.org/v6/api/providers/#Signer) +- [`@turnkey/viem`](https://www.npmjs.com/package/@turnkey/viem): Turnkey Custom Account for [`Viem`](https://viem.sh/docs/accounts/custom.html) + +## Documents + +- [TurnkeyClient](TurnkeyClient/readme) + + +## Modules + +- [index](index/readme) diff --git a/sdks/iframe-stamper/IframeStamper/readme.mdx b/sdks/iframe-stamper/IframeStamper/readme.mdx new file mode 100644 index 00000000..481e27f0 --- /dev/null +++ b/sdks/iframe-stamper/IframeStamper/readme.mdx @@ -0,0 +1,226 @@ +--- +title: "IframeStamper" +mode: wide +--- + +## Introduction + +The [`@turnkey/iframe-stamper`](https://www.npmjs.com/package/@turnkey/iframe-stamper) package, while sharing a similar purpose with the `@turnkey/api-key-stamper`, caters specifically to the unique context of iframes. This package is designed for stamping requests within an iframe, using credentials for Turnkey's API, but operates distinctly from the API key stamper. Unlike the API key stamper, which has direct access to the API private key to compute signatures or stamps directly, the iframe stamper interacts with credentials in a more indirect manner. + +It leverages the `postMessage` communication mechanism to send and receive messages within the iframe, ensuring the credential does not leave its secure environment. This approach is particularly crucial in sensitive flows such as [Email Auth](/authentication/email), and [Key or Wallet Export](/wallets/export-wallets), where heightened security is required. The `@turnkey/iframe-stamper` works in tandem with `@turnkey/http`, facilitating secure and efficient communication in these specific use cases. + +By bridging the gap between the iframe's isolated environment and Turnkey's API, the iframe stamper plays a pivotal role in maintaining the integrity and security of the credential while ensuring seamless operation within the iframe context. + +## Installing + +To start using the `@turnkey/iframe-stamper` client, install it as follows: + + + +```bash npm +npm i @turnkey/iframe-stamper +``` + +```bash pnpm +pnpm i @turnkey/iframe-stamper +``` + +```bash yarn +yarn add @turnkey/iframe-stamper +``` + + + +## Initializing + +The IframeStamper class, part of the @turnkey/iframe-stamper package, is designed for stamping Turnkey requests through credentials in an iframe. It's used with @turnkey/http for constructing various flows. The class can manage iframe interactions for credential insertion, wallet exports, and request stamping. Here's how you can initialize an IframeStamper: + +### `constructor(config: TIframeStamperConfig): IframeStamper` + +#### Parameters + + + +An object containing configuration settings for the iframe stamper. + + + +The URL of the iframe to be used. + + + +The ID to assign to the iframe element. + + + +The container element in which the iframe will be inserted. + + +#### Types + +##### `TIframeStamperConfig` + +```js +type TIframeStamperConfig = { + iframeUrl: string; + iframeElementId: string; + iframeContainer: HTMLElement | null | undefined; +}; +``` + +#### Example + +For full example check out the [email-auth](https://github.com/tkhq/sdk/tree/main/examples/email-auth) example in our SDK repo. You should also read up [Email Auth](/authentication/email) for more information on the technical details of how it works. + +## Methods + +### `init: () => Promise` + +Initializes the iframe stamper by inserting the iframe into the DOM and establishing communication with it. This method returns a promise that resolves to the iframe's public key, which is used for subsequent operations like credential injection or request stamping. + +#### Example + +```js +import { IframeStamper } from "@turnkey/iframe-stamper"; +import { TurnkeyClient } from "@turnkey/http"; + +const TurnkeyIframeContainerId = "turnkey-iframe-container"; +const TurnkeyIframeElementId = "turnkey-iframe"; + +const iframeStamper = new IframeStamper({ + iframeUrl: process.env.IFRAME_URL!, + iframeContainer: document.getElementById(TurnkeyIframeContainerId), + iframeElementId: TurnkeyIframeElementId, +}); + +// This inserts the iframe in the DOM and returns the public key +const publicKey = await iframeStamper.init(); +``` + +### `injectCredentialBundle: (bundle: string) => Promise` + +Injects a new credential bundle into the iframe, a process used in email authentication flows. The method requires an encrypted credential bundle, which should be encrypted to the iframe's initial public key using HPKE ([RFC 9180](https://www.rfc-editor.org/rfc/rfc9180.html)). Upon successful execution, it returns a `Promise` that resolves to `true` if the bundle was successfully injected into the iframe, or `false` otherwise. + +#### Parameters + + + +The encrypted credential bundle that needs to be injected into the iframe. This bundle should be encrypted with the iframe's initial public key using HPKE ([RFC 9180](https://www.rfc-editor.org/rfc/rfc9180.html)). + + +#### Example + +``` +// .. Add imports and init iframeStamper + +// Pasted into the iFrame by the user +const credentialBundle = ""; + +// Injects a new credential in the iframe +const injected = await iframeStamper.injectCredentialBundle(credentialBundle); +``` + +### `injectKeyExportBundle: (bundle: string) => Promise` + +Injects an export bundle into the iframe. This method is used during key export flows. The bundle should be encrypted to the iframe's initial public key using HPKE ([RFC 9180](https://www.rfc-editor.org/rfc/rfc9180.html)). This method returns a `Promise` which resolves to `true` if the bundle was successfully injected into the iframe, or `false` otherwise. + +#### Parameters + + + +The encrypted export bundle that needs to be injected into the iframe. This bundle should be encrypted with the iframe's initial public key using HPKE ([RFC 9180](https://www.rfc-editor.org/rfc/rfc9180.html)). + + +#### Example + +```js +// .. Add imports and init the IframeStamper + +// Pasted into the iFrame by the user +const walletExportBundle = ""; + +const injected = + await iframeStamper.injectWalletExportBundle(walletExportBundle); +``` + +### `injectWalletExportBundle: (bundle: string) => Promise` + +Injects a wallet export bundle into the iframe. This method is typically used during wallet export flows. The bundle should be encrypted to the iframe's initial public key using HPKE (RFC 9180). It returns a `Promise` which resolves to `true` if the bundle is successfully injected into the iframe, or `false` otherwise. + +#### Parameters + + + +The encrypted wallet export bundle to be injected into the iframe. This bundle must be encrypted using the iframe's initial public key according to HPKE (RFC 9180) standards. + + +#### Example + +```js +// .. Add imports and init the IframeStamper + +// Pasted into the iFrame by the user +const walletExportBundle = ""; + +const injected = + await iframeStamper.injectWalletExportBundle(walletExportBundle); +``` + +### `publicKey: () => string | null` + +Returns the public key of the iframe, or `null` if the underlying iframe isn't properly initialized. This method is useful for retrieving the public key which is necessary for various operations like credential injection or request stamping. + +#### Example + +```js +// .. Add imports and init the IframeStamper + +const iframePublicKey = iframeStamper.publicKey(); +``` + +### `clear: () => void` + +Removes the iframe from the DOM. This method is useful for cleaning up the iframe when it is no longer needed. It ensures that the iframe is properly disposed of, preventing potential memory leaks or other unintended side effects. + +#### Example + +```js +// .. Add imports and init the IframeStamper + +iframeStamper.clear(); +``` diff --git a/sdks/iframe-stamper/index/IframeEventType/readme.mdx b/sdks/iframe-stamper/index/IframeEventType/readme.mdx new file mode 100644 index 00000000..d286482f --- /dev/null +++ b/sdks/iframe-stamper/index/IframeEventType/readme.mdx @@ -0,0 +1,152 @@ +--- +title: "IframeEventType" +mode: wide +--- + +# Enumeration: IframeEventType + +Defined in: [index.ts:7](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L7) + +## Enumeration Members + +### ApplySettings + +> **ApplySettings**: `"APPLY_SETTINGS"` + +Defined in: [index.ts:34](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L34) + +*** + +### BundleInjected + +> **BundleInjected**: `"BUNDLE_INJECTED"` + +Defined in: [index.ts:37](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L37) + +*** + +### ClearEmbeddedKey + +> **ClearEmbeddedKey**: `"RESET_EMBEDDED_KEY"` + +Defined in: [index.ts:58](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L58) + +*** + +### EncryptedBundleExtracted + +> **EncryptedBundleExtracted**: `"ENCRYPTED_BUNDLE_EXTRACTED"` + +Defined in: [index.ts:40](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L40) + +*** + +### Error + +> **Error**: `"ERROR"` + +Defined in: [index.ts:64](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L64) + +*** + +### ExtractKeyEncryptedBundle + +> **ExtractKeyEncryptedBundle**: `"EXTRACT_KEY_ENCRYPTED_BUNDLE"` + +Defined in: [index.ts:31](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L31) + +*** + +### ExtractWalletEncryptedBundle + +> **ExtractWalletEncryptedBundle**: `"EXTRACT_WALLET_ENCRYPTED_BUNDLE"` + +Defined in: [index.ts:27](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L27) + +*** + +### GetEmbeddedPublicKey + +> **GetEmbeddedPublicKey**: `"GET_EMBEDDED_PUBLIC_KEY"` + +Defined in: [index.ts:55](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L55) + +*** + +### InitEmbeddedKey + +> **InitEmbeddedKey**: `"INIT_EMBEDDED_KEY"` + +Defined in: [index.ts:61](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L61) + +*** + +### InjectCredentialBundle + +> **InjectCredentialBundle**: `"INJECT_CREDENTIAL_BUNDLE"` + +Defined in: [index.ts:13](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L13) + +*** + +### InjectImportBundle + +> **InjectImportBundle**: `"INJECT_IMPORT_BUNDLE"` + +Defined in: [index.ts:24](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L24) + +*** + +### InjectKeyExportBundle + +> **InjectKeyExportBundle**: `"INJECT_KEY_EXPORT_BUNDLE"` + +Defined in: [index.ts:18](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L18) + +*** + +### InjectWalletExportBundle + +> **InjectWalletExportBundle**: `"INJECT_WALLET_EXPORT_BUNDLE"` + +Defined in: [index.ts:21](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L21) + +*** + +### PublicKeyReady + +> **PublicKeyReady**: `"PUBLIC_KEY_READY"` + +Defined in: [index.ts:10](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L10) + +*** + +### SettingsApplied + +> **SettingsApplied**: `"SETTINGS_APPLIED"` + +Defined in: [index.ts:43](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L43) + +*** + +### Stamp + +> **Stamp**: `"STAMP"` + +Defined in: [index.ts:49](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L49) + +*** + +### StampRequest + +> **StampRequest**: `"STAMP_REQUEST"` + +Defined in: [index.ts:46](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L46) + +*** + +### TurnkeyInitMessageChannel + +> **TurnkeyInitMessageChannel**: `"TURNKEY_INIT_MESSAGE_CHANNEL"` + +Defined in: [index.ts:52](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L52) diff --git a/sdks/iframe-stamper/index/IframeStamper/readme.mdx b/sdks/iframe-stamper/index/IframeStamper/readme.mdx new file mode 100644 index 00000000..9fe11075 --- /dev/null +++ b/sdks/iframe-stamper/index/IframeStamper/readme.mdx @@ -0,0 +1,380 @@ +--- +title: "IframeStamper" +mode: wide +--- + +# Class: IframeStamper + +Defined in: [index.ts:129](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L129) + +Stamper to use with `@turnkey/http`'s `TurnkeyClient` +Creating a stamper inserts an iframe in the current page. + +## Constructors + +### Constructor + +> **new IframeStamper**(`config`): `IframeStamper` + +Defined in: [index.ts:142](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L142) + +Creates a new iframe stamper. This function _does not_ insert the iframe in the DOM. +Call `.init()` to insert the iframe element in the DOM. + +#### Parameters + +##### config + +[`TIframeStamperConfig`](../TIframeStamperConfig/readme) + +#### Returns + +`IframeStamper` + +## Properties + +### container + +> **container**: `HTMLElement` + +Defined in: [index.ts:130](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L130) + +*** + +### iframe + +> **iframe**: `HTMLIFrameElement` + +Defined in: [index.ts:131](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L131) + +*** + +### iframeOrigin + +> **iframeOrigin**: `string` + +Defined in: [index.ts:132](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L132) + +*** + +### iframePublicKey + +> **iframePublicKey**: `null` \| `string` + +Defined in: [index.ts:133](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L133) + +*** + +### messageChannel + +> **messageChannel**: `MessageChannel` + +Defined in: [index.ts:134](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L134) + +## Methods + +### applySettings() + +> **applySettings**(`settings`): `Promise`\<`boolean`\> + +Defined in: [index.ts:451](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L451) + +Function to apply settings on allowed parameters in the iframe +This is used to style the HTML element used for plaintext in wallet and private key import. + +#### Parameters + +##### settings + +[`TIframeSettings`](../TIframeSettings/readme) + +#### Returns + +`Promise`\<`boolean`\> + +*** + +### clear() + +> **clear**(): `void` + +Defined in: [index.ts:276](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L276) + +Removes the iframe from the DOM + +#### Returns + +`void` + +*** + +### clearEmbeddedKey() + +> **clearEmbeddedKey**(): `Promise`\<`null`\> + +Defined in: [index.ts:306](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L306) + +Clears the embedded key within an iframe. + +#### Returns + +`Promise`\<`null`\> + +*** + +### extractKeyEncryptedBundle() + +> **extractKeyEncryptedBundle**(`keyFormat`?): `Promise`\<`string`\> + +Defined in: [index.ts:440](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L440) + +Function to extract an encrypted bundle from the iframe +The bundle should be encrypted to Turnkey's Signer enclave's initial public key +Encryption should be performed with HPKE (RFC 9180). +The key format to encode the private key in before it's encrypted and imported: HEXADECIMAL or SOLANA. Defaults to HEXADECIMAL. +This is used during the private key import flow. + +#### Parameters + +##### keyFormat? + +[`KeyFormat`](../KeyFormat/readme) + +#### Returns + +`Promise`\<`string`\> + +*** + +### extractWalletEncryptedBundle() + +> **extractWalletEncryptedBundle**(): `Promise`\<`string`\> + +Defined in: [index.ts:427](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L427) + +Function to extract an encrypted bundle from the iframe +The bundle should be encrypted to Turnkey's Signer enclave's initial public key +Encryption should be performed with HPKE (RFC 9180). +This is used during the wallet import flow. + +#### Returns + +`Promise`\<`string`\> + +*** + +### getEmbeddedPublicKey() + +> **getEmbeddedPublicKey**(): `Promise`\<`null` \| `string`\> + +Defined in: [index.ts:294](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L294) + +Returns the public key, or `null` if the underlying iframe isn't properly initialized. +This differs from the above in that it reaches out to the live iframe to see if an embedded key exists. + +#### Returns + +`Promise`\<`null` \| `string`\> + +*** + +### init() + +> **init**(`dangerouslyOverrideIframeKeyTtl`?): `Promise`\<`string`\> + +Defined in: [index.ts:234](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L234) + +Inserts the iframe on the page and returns a promise resolving to the iframe's public key + +#### Parameters + +##### dangerouslyOverrideIframeKeyTtl? + +`number` + +Optional TTL override for the iframe's embedded key (default 48 hours). Only use this if you are intentional about the security implications. + +#### Returns + +`Promise`\<`string`\> + +*** + +### initEmbeddedKey() + +> **initEmbeddedKey**(): `Promise`\<`null` \| `string`\> + +Defined in: [index.ts:319](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L319) + +Creates a new embedded key within an iframe. If an embedded key already exists, this will return it. +This is primarily to be used in conjunction with `clearEmbeddedKey()`: after an embedded key is cleared, +this can be used to create a new one. + +#### Returns + +`Promise`\<`null` \| `string`\> + +the newly created embedded public key. + +*** + +### injectCredentialBundle() + +> **injectCredentialBundle**(`bundle`): `Promise`\<`boolean`\> + +Defined in: [index.ts:361](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L361) + +Function to inject a new credential into the iframe +The bundle should be encrypted to the iframe's initial public key +Encryption should be performed with HPKE (RFC 9180). +This is used during recovery and auth flows. + +#### Parameters + +##### bundle + +`string` + +#### Returns + +`Promise`\<`boolean`\> + +*** + +### injectImportBundle() + +> **injectImportBundle**(`bundle`, `organizationId`, `userId`): `Promise`\<`boolean`\> + +Defined in: [index.ts:409](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L409) + +Function to inject an import bundle into the iframe +This is used to initiate either the wallet import flow or the private key import flow. + +#### Parameters + +##### bundle + +`string` + +##### organizationId + +`string` + +##### userId + +`string` + +#### Returns + +`Promise`\<`boolean`\> + +*** + +### injectKeyExportBundle() + +> **injectKeyExportBundle**(`bundle`, `organizationId`, `keyFormat`?): `Promise`\<`boolean`\> + +Defined in: [index.ts:374](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L374) + +Function to inject an export bundle into the iframe +The bundle should be encrypted to the iframe's initial public key +Encryption should be performed with HPKE (RFC 9180). +The key format to encode the private key in after it's exported and decrypted: HEXADECIMAL or SOLANA. Defaults to HEXADECIMAL. +This is used during the private key export flow. + +#### Parameters + +##### bundle + +`string` + +##### organizationId + +`string` + +##### keyFormat? + +[`KeyFormat`](../KeyFormat/readme) + +#### Returns + +`Promise`\<`boolean`\> + +*** + +### injectWalletExportBundle() + +> **injectWalletExportBundle**(`bundle`, `organizationId`): `Promise`\<`boolean`\> + +Defined in: [index.ts:392](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L392) + +Function to inject an export bundle into the iframe +The bundle should be encrypted to the iframe's initial public key +Encryption should be performed with HPKE (RFC 9180). +This is used during the wallet export flow. + +#### Parameters + +##### bundle + +`string` + +##### organizationId + +`string` + +#### Returns + +`Promise`\<`boolean`\> + +*** + +### onMessageHandler() + +> **onMessageHandler**(`event`): `void` + +Defined in: [index.ts:191](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L191) + +#### Parameters + +##### event + +`MessageEvent` + +#### Returns + +`void` + +*** + +### publicKey() + +> **publicKey**(): `null` \| `string` + +Defined in: [index.ts:286](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L286) + +Returns the public key, or `null` if the underlying iframe isn't properly initialized. + +#### Returns + +`null` \| `string` + +*** + +### stamp() + +> **stamp**(`payload`): `Promise`\<`TStamp`\> + +Defined in: [index.ts:460](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L460) + +Function to sign a payload with the underlying iframe + +#### Parameters + +##### payload + +`string` + +#### Returns + +`Promise`\<`TStamp`\> diff --git a/sdks/iframe-stamper/index/KeyFormat/readme.mdx b/sdks/iframe-stamper/index/KeyFormat/readme.mdx new file mode 100644 index 00000000..d54f181b --- /dev/null +++ b/sdks/iframe-stamper/index/KeyFormat/readme.mdx @@ -0,0 +1,24 @@ +--- +title: "KeyFormat" +mode: wide +--- + +# Enumeration: KeyFormat + +Defined in: [index.ts:69](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L69) + +## Enumeration Members + +### Hexadecimal + +> **Hexadecimal**: `"HEXADECIMAL"` + +Defined in: [index.ts:71](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L71) + +*** + +### Solana + +> **Solana**: `"SOLANA"` + +Defined in: [index.ts:73](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L73) diff --git a/sdks/iframe-stamper/index/TIframeSettings/readme.mdx b/sdks/iframe-stamper/index/TIframeSettings/readme.mdx new file mode 100644 index 00000000..21676a28 --- /dev/null +++ b/sdks/iframe-stamper/index/TIframeSettings/readme.mdx @@ -0,0 +1,18 @@ +--- +title: "TIframeSettings" +mode: wide +--- + +# Type Alias: TIframeSettings + +> **TIframeSettings** = `object` + +Defined in: [index.ts:111](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L111) + +## Properties + +### styles? + +> `optional` **styles**: [`TIframeStyles`](../TIframeStyles/readme) + +Defined in: [index.ts:112](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L112) diff --git a/sdks/iframe-stamper/index/TIframeStamperConfig/readme.mdx b/sdks/iframe-stamper/index/TIframeStamperConfig/readme.mdx new file mode 100644 index 00000000..8d97a9fa --- /dev/null +++ b/sdks/iframe-stamper/index/TIframeStamperConfig/readme.mdx @@ -0,0 +1,34 @@ +--- +title: "TIframeStamperConfig" +mode: wide +--- + +# Type Alias: TIframeStamperConfig + +> **TIframeStamperConfig** = `object` + +Defined in: [index.ts:81](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L81) + +## Properties + +### iframeContainer + +> **iframeContainer**: `HTMLElement` \| `null` \| `undefined` + +Defined in: [index.ts:84](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L84) + +*** + +### iframeElementId + +> **iframeElementId**: `string` + +Defined in: [index.ts:83](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L83) + +*** + +### iframeUrl + +> **iframeUrl**: `string` + +Defined in: [index.ts:82](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L82) diff --git a/sdks/iframe-stamper/index/TIframeStyles/readme.mdx b/sdks/iframe-stamper/index/TIframeStyles/readme.mdx new file mode 100644 index 00000000..4e3217fc --- /dev/null +++ b/sdks/iframe-stamper/index/TIframeStyles/readme.mdx @@ -0,0 +1,178 @@ +--- +title: "TIframeStyles" +mode: wide +--- + +# Type Alias: TIframeStyles + +> **TIframeStyles** = `object` + +Defined in: [index.ts:87](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L87) + +## Properties + +### backgroundColor? + +> `optional` **backgroundColor**: `string` + +Defined in: [index.ts:98](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L98) + +*** + +### borderColor? + +> `optional` **borderColor**: `string` + +Defined in: [index.ts:92](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L92) + +*** + +### borderRadius? + +> `optional` **borderRadius**: `string` + +Defined in: [index.ts:93](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L93) + +*** + +### borderStyle? + +> `optional` **borderStyle**: `string` + +Defined in: [index.ts:91](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L91) + +*** + +### borderWidth? + +> `optional` **borderWidth**: `string` + +Defined in: [index.ts:90](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L90) + +*** + +### boxShadow? + +> `optional` **boxShadow**: `string` + +Defined in: [index.ts:104](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L104) + +*** + +### color? + +> `optional` **color**: `string` + +Defined in: [index.ts:97](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L97) + +*** + +### fontFamily? + +> `optional` **fontFamily**: `string` + +Defined in: [index.ts:96](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L96) + +*** + +### fontSize? + +> `optional` **fontSize**: `string` + +Defined in: [index.ts:94](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L94) + +*** + +### fontWeight? + +> `optional` **fontWeight**: `string` + +Defined in: [index.ts:95](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L95) + +*** + +### height? + +> `optional` **height**: `string` + +Defined in: [index.ts:100](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L100) + +*** + +### lineHeight? + +> `optional` **lineHeight**: `string` + +Defined in: [index.ts:103](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L103) + +*** + +### margin? + +> `optional` **margin**: `string` + +Defined in: [index.ts:89](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L89) + +*** + +### maxHeight? + +> `optional` **maxHeight**: `string` + +Defined in: [index.ts:102](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L102) + +*** + +### maxWidth? + +> `optional` **maxWidth**: `string` + +Defined in: [index.ts:101](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L101) + +*** + +### overflowWrap? + +> `optional` **overflowWrap**: `string` + +Defined in: [index.ts:106](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L106) + +*** + +### padding? + +> `optional` **padding**: `string` + +Defined in: [index.ts:88](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L88) + +*** + +### resize? + +> `optional` **resize**: `string` + +Defined in: [index.ts:108](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L108) + +*** + +### textAlign? + +> `optional` **textAlign**: `string` + +Defined in: [index.ts:105](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L105) + +*** + +### width? + +> `optional` **width**: `string` + +Defined in: [index.ts:99](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L99) + +*** + +### wordWrap? + +> `optional` **wordWrap**: `string` + +Defined in: [index.ts:107](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/iframe-stamper/src/index.ts#L107) diff --git a/sdks/iframe-stamper/index/readme.mdx b/sdks/iframe-stamper/index/readme.mdx new file mode 100644 index 00000000..f870074a --- /dev/null +++ b/sdks/iframe-stamper/index/readme.mdx @@ -0,0 +1,21 @@ +--- +title: "Index" +mode: wide +--- + +# index + +## Enumerations + +- [IframeEventType](IframeEventType/readme) +- [KeyFormat](KeyFormat/readme) + +## Classes + +- [IframeStamper](IframeStamper/readme) + +## Type Aliases + +- [TIframeSettings](TIframeSettings/readme) +- [TIframeStamperConfig](TIframeStamperConfig/readme) +- [TIframeStyles](TIframeStyles/readme) diff --git a/sdks/iframe-stamper/readme.mdx b/sdks/iframe-stamper/readme.mdx new file mode 100644 index 00000000..96feea99 --- /dev/null +++ b/sdks/iframe-stamper/readme.mdx @@ -0,0 +1,118 @@ +--- +title: "Iframe Stamper" +mode: wide +--- + +# @turnkey/iframe-stamper + +[![npm](https://img.shields.io/npm/v/@turnkey/iframe-stamper?color=%234C48FF)](https://www.npmjs.com/package/@turnkey/iframe-stamper) + +This package contains functions to stamp a Turnkey request through credentials contained in an iframe. It is meant to be used with [`@turnkey/http`](https://www.npmjs.com/package/@turnkey/http) to build flows. To stamp the request, use the Recovery and Auth flows to request and inject a credential bundle. + +Usage: + +Recovery and Auth + +```ts +import { IframeStamper } from "@turnkey/iframe-stamper"; +import { TurnkeyClient } from "@turnkey/http"; + +const TurnkeyIframeContainerId = "turnkey-iframe-container"; +const TurnkeyIframeElementId = "turnkey-iframe"; + +const iframeStamper = new IframeStamper({ + iframeUrl: process.env.AUTH_IFRAME_URL!, + iframeContainer: document.getElementById(TurnkeyIframeContainerId), + iframeElementId: TurnkeyIframeElementId, +}); + +// This inserts the iframe in the DOM and returns the public key +const publicKey = await iframeStamper.init(); + +// Injects a new credential in the iframe +const injected = await iframeStamper.injectCredentialBundle(credentialBundle); + +// New HTTP client able to sign with the credentials inside of the iframe +const httpClient = new TurnkeyClient( + { baseUrl: "https://api.turnkey.com" }, + iframeStamper, +); +``` + +Key or Wallet Export + +```ts +import { IframeStamper } from "@turnkey/iframe-stamper"; +import { TurnkeyClient } from "@turnkey/http"; + +const TurnkeyIframeContainerId = "turnkey-iframe-container"; +const TurnkeyIframeElementId = "turnkey-iframe"; + +const iframeStamper = new IframeStamper({ + iframeUrl: process.env.EXPORT_IFRAME_URL!, + iframeContainer: document.getElementById(TurnkeyIframeContainerId), + iframeElementId: TurnkeyIframeElementId, +}); + +// This inserts the iframe in the DOM and returns the public key +const publicKey = await iframeStamper.init(); + +// Injects a bundle containing the encrypted wallet seedphrase into the iframe +// `exportBundle` is the response from requesting ACTIVITY_TYPE_EXPORT_WALLET +const injected = await iframeStamper.injectWalletExportBundle(exportBundle); + +// If the bundle is successfully injected, the iframe is now displaying the +// wallet seedphrase to the user +if (injected !== true) { + throw new Error("unexpected error while injecting export bundle"); +} + +// Display the iframe to the user with their seedphrase. +setIframeDisplay("block"); +``` + +Key or Wallet Import + +```ts +import { IframeStamper } from "@turnkey/iframe-stamper"; +import { TurnkeyClient } from "@turnkey/http"; + +const TurnkeyIframeContainerId = "turnkey-iframe-container"; +const TurnkeyIframeElementId = "turnkey-iframe"; + +const iframeStamper = new IframeStamper({ + iframeUrl: process.env.IMPORT_IFRAME_URL!, + iframeContainer: document.getElementById(TurnkeyIframeContainerId), + iframeElementId: TurnkeyIframeElementId, +}); + +// This inserts the iframe in the DOM +await iframeStamper.init(); + +// Injects a bundle containing the secure enclave's public key into the iframe's local storage +// `importBundle` is the response from requesting ACTIVITY_TYPE_INIT_IMPORT_WALLET +const injected = await iframeStamper.injectImportBundle(importBundle); + +if (injected !== true) { + throw new Error("unexpected error while injecting import bundle"); +} + +// Display the text input that the user can enter their seedphrase into +setIframeDisplay("block"); + +// Once the user has entered their seedphrase, trigger this call to the iframe that +// 1) encrypts their seedphrase using the secure enclave's public key from the previous step +// 2) sends this ciphertext and a public key generated by the client to your page +const encryptedBundle = await iframeStamper.extractWalletEncryptedBundle(); + +// Now you can pass this encryptedBundle as a request to ACTIVITY_TYPE_IMPORT_WALLET. +``` + +## Documents + +- [IframeStamper](IframeStamper/readme) + + +## Modules + +- [index](index/readme) diff --git a/sdks/modules.mdx b/sdks/modules.mdx new file mode 100644 index 00000000..f6fcd91d --- /dev/null +++ b/sdks/modules.mdx @@ -0,0 +1,27 @@ +--- +title: "Sdks" +mode: wide +--- + +# Documentation + +## Packages + +- [api-key-stamper - v0.4.4](api-key-stamper/readme) +- [cosmjs - v0.7.5](cosmjs/readme) +- [crypto - v2.3.1](crypto/readme) +- [eip-1193-provider - v3.3.5](eip-1193-provider/readme) +- [encoding - v0.4.0](encoding/readme) +- [ethers - v1.1.22](ethers/readme) +- [http - v3.0.0](http/readme) +- [iframe-stamper - v2.5.0](iframe-stamper/readme) +- [react-native-passkey-stamper - v1.0.10](react-native-passkey-stamper/readme) +- [sdk-browser - v4.0.0](sdk-browser/readme) +- [sdk-react - v4.2.2](sdk-react/readme) +- [sdk-react-native - v1.0.4](sdk-react-native/readme) +- [sdk-server - v3.0.1](sdk-server/readme) +- [solana - v1.0.21](solana/readme) +- [telegram-cloud-storage-stamper - v2.0.0](telegram-cloud-storage-stamper/readme) +- [viem - v0.7.2](viem/readme) +- [wallet-stamper - v1.0.3](wallet-stamper/readme) +- [webauthn-stamper - v0.5.0](webauthn-stamper/readme) diff --git a/sdks/react-native-passkey-stamper/index/AuthenticatorTransport/readme.mdx b/sdks/react-native-passkey-stamper/index/AuthenticatorTransport/readme.mdx new file mode 100644 index 00000000..b04a9cf6 --- /dev/null +++ b/sdks/react-native-passkey-stamper/index/AuthenticatorTransport/readme.mdx @@ -0,0 +1,56 @@ +--- +title: "AuthenticatorTransport" +mode: wide +--- + +# Enumeration: AuthenticatorTransport + +Defined in: [react-native-passkey-stamper/src/index.ts:21](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/react-native-passkey-stamper/src/index.ts#L21) + +## Enumeration Members + +### ble + +> **ble**: `"ble"` + +Defined in: [react-native-passkey-stamper/src/index.ts:24](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/react-native-passkey-stamper/src/index.ts#L24) + +*** + +### hybrid + +> **hybrid**: `"hybrid"` + +Defined in: [react-native-passkey-stamper/src/index.ts:26](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/react-native-passkey-stamper/src/index.ts#L26) + +*** + +### internal + +> **internal**: `"internal"` + +Defined in: [react-native-passkey-stamper/src/index.ts:27](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/react-native-passkey-stamper/src/index.ts#L27) + +*** + +### nfc + +> **nfc**: `"nfc"` + +Defined in: [react-native-passkey-stamper/src/index.ts:23](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/react-native-passkey-stamper/src/index.ts#L23) + +*** + +### smartCard + +> **smartCard**: `"smart-card"` + +Defined in: [react-native-passkey-stamper/src/index.ts:25](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/react-native-passkey-stamper/src/index.ts#L25) + +*** + +### usb + +> **usb**: `"usb"` + +Defined in: [react-native-passkey-stamper/src/index.ts:22](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/react-native-passkey-stamper/src/index.ts#L22) diff --git a/sdks/react-native-passkey-stamper/index/PasskeyStamper/readme.mdx b/sdks/react-native-passkey-stamper/index/PasskeyStamper/readme.mdx new file mode 100644 index 00000000..f07b2fd6 --- /dev/null +++ b/sdks/react-native-passkey-stamper/index/PasskeyStamper/readme.mdx @@ -0,0 +1,102 @@ +--- +title: "PasskeyStamper" +mode: wide +--- + +# Class: PasskeyStamper + +Defined in: [react-native-passkey-stamper/src/index.ts:205](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/react-native-passkey-stamper/src/index.ts#L205) + +Stamper to use with `@turnkey/http`'s `TurnkeyClient` + +## Constructors + +### Constructor + +> **new PasskeyStamper**(`config`): `PasskeyStamper` + +Defined in: [react-native-passkey-stamper/src/index.ts:214](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/react-native-passkey-stamper/src/index.ts#L214) + +#### Parameters + +##### config + +[`TPasskeyStamperConfig`](../TPasskeyStamperConfig/readme) + +#### Returns + +`PasskeyStamper` + +## Properties + +### allowCredentials + +> **allowCredentials**: [`PublicKeyCredentialDescriptor`](../PublicKeyCredentialDescriptor/readme)[] + +Defined in: [react-native-passkey-stamper/src/index.ts:209](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/react-native-passkey-stamper/src/index.ts#L209) + +*** + +### extensions + +> **extensions**: `Record`\<`string`, `unknown`\> + +Defined in: [react-native-passkey-stamper/src/index.ts:210](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/react-native-passkey-stamper/src/index.ts#L210) + +*** + +### forcePlatformKey + +> **forcePlatformKey**: `boolean` + +Defined in: [react-native-passkey-stamper/src/index.ts:211](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/react-native-passkey-stamper/src/index.ts#L211) + +*** + +### forceSecurityKey + +> **forceSecurityKey**: `boolean` + +Defined in: [react-native-passkey-stamper/src/index.ts:212](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/react-native-passkey-stamper/src/index.ts#L212) + +*** + +### rpId + +> **rpId**: `string` + +Defined in: [react-native-passkey-stamper/src/index.ts:206](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/react-native-passkey-stamper/src/index.ts#L206) + +*** + +### timeout + +> **timeout**: `number` + +Defined in: [react-native-passkey-stamper/src/index.ts:207](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/react-native-passkey-stamper/src/index.ts#L207) + +*** + +### userVerification + +> **userVerification**: `UserVerificationRequirement` + +Defined in: [react-native-passkey-stamper/src/index.ts:208](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/react-native-passkey-stamper/src/index.ts#L208) + +## Methods + +### stamp() + +> **stamp**(`payload`): `Promise`\<\{ `stampHeaderName`: `string`; `stampHeaderValue`: `string`; \}\> + +Defined in: [react-native-passkey-stamper/src/index.ts:224](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/react-native-passkey-stamper/src/index.ts#L224) + +#### Parameters + +##### payload + +`string` + +#### Returns + +`Promise`\<\{ `stampHeaderName`: `string`; `stampHeaderValue`: `string`; \}\> diff --git a/sdks/react-native-passkey-stamper/index/PublicKeyCredentialDescriptor/readme.mdx b/sdks/react-native-passkey-stamper/index/PublicKeyCredentialDescriptor/readme.mdx new file mode 100644 index 00000000..07dcd818 --- /dev/null +++ b/sdks/react-native-passkey-stamper/index/PublicKeyCredentialDescriptor/readme.mdx @@ -0,0 +1,36 @@ +--- +title: "PublicKeyCredentialDescriptor" +mode: wide +--- + +# Interface: PublicKeyCredentialDescriptor + +Defined in: [react-native-passkey-stamper/src/index.ts:15](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/react-native-passkey-stamper/src/index.ts#L15) + +https://www.w3.org/TR/webauthn-2/#dictionary-credential-descriptor +Copied from https://github.com/f-23/react-native-passkey/blob/17184a1b1f6f3ac61e07aa784c9b64efb28b570e/src/Passkey.tsx#L80C1-L85C2 +TODO: can we import this type instead? + +## Properties + +### id + +> **id**: `string` + +Defined in: [react-native-passkey-stamper/src/index.ts:17](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/react-native-passkey-stamper/src/index.ts#L17) + +*** + +### transports? + +> `optional` **transports**: [`AuthenticatorTransport`](../AuthenticatorTransport/readme)[] + +Defined in: [react-native-passkey-stamper/src/index.ts:18](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/react-native-passkey-stamper/src/index.ts#L18) + +*** + +### type + +> **type**: `string` + +Defined in: [react-native-passkey-stamper/src/index.ts:16](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/react-native-passkey-stamper/src/index.ts#L16) diff --git a/sdks/react-native-passkey-stamper/index/TPasskeyRegistrationConfig/readme.mdx b/sdks/react-native-passkey-stamper/index/TPasskeyRegistrationConfig/readme.mdx new file mode 100644 index 00000000..9ca57dfb --- /dev/null +++ b/sdks/react-native-passkey-stamper/index/TPasskeyRegistrationConfig/readme.mdx @@ -0,0 +1,126 @@ +--- +title: "TPasskeyRegistrationConfig" +mode: wide +--- + +# Type Alias: TPasskeyRegistrationConfig + +> **TPasskeyRegistrationConfig** = `object` + +Defined in: [react-native-passkey-stamper/src/index.ts:41](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/react-native-passkey-stamper/src/index.ts#L41) + +## Properties + +### attestation? + +> `optional` **attestation**: `string` + +Defined in: [react-native-passkey-stamper/src/index.ts:87](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/react-native-passkey-stamper/src/index.ts#L87) + +*** + +### authenticatorName + +> **authenticatorName**: `string` + +Defined in: [react-native-passkey-stamper/src/index.ts:58](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/react-native-passkey-stamper/src/index.ts#L58) + +*** + +### authenticatorSelection? + +> `optional` **authenticatorSelection**: `object` + +Defined in: [react-native-passkey-stamper/src/index.ts:79](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/react-native-passkey-stamper/src/index.ts#L79) + +#### authenticatorAttachment? + +> `optional` **authenticatorAttachment**: `string` + +#### requireResidentKey? + +> `optional` **requireResidentKey**: `boolean` + +#### residentKey? + +> `optional` **residentKey**: `string` + +#### userVerification? + +> `optional` **userVerification**: `string` + +*** + +### challenge? + +> `optional` **challenge**: `string` + +Defined in: [react-native-passkey-stamper/src/index.ts:61](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/react-native-passkey-stamper/src/index.ts#L61) + +*** + +### excludeCredentials? + +> `optional` **excludeCredentials**: [`PublicKeyCredentialDescriptor`](../PublicKeyCredentialDescriptor/readme)[] + +Defined in: [react-native-passkey-stamper/src/index.ts:70](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/react-native-passkey-stamper/src/index.ts#L70) + +*** + +### extensions? + +> `optional` **extensions**: `Record`\<`string`, `unknown`\> + +Defined in: [react-native-passkey-stamper/src/index.ts:90](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/react-native-passkey-stamper/src/index.ts#L90) + +*** + +### rp + +> **rp**: `object` + +Defined in: [react-native-passkey-stamper/src/index.ts:44](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/react-native-passkey-stamper/src/index.ts#L44) + +#### id + +> **id**: `string` + +#### name + +> **name**: `string` + +*** + +### timeout? + +> `optional` **timeout**: `number` + +Defined in: [react-native-passkey-stamper/src/index.ts:64](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/react-native-passkey-stamper/src/index.ts#L64) + +*** + +### user + +> **user**: `object` + +Defined in: [react-native-passkey-stamper/src/index.ts:50](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/react-native-passkey-stamper/src/index.ts#L50) + +#### displayName + +> **displayName**: `string` + +#### id + +> **id**: `string` + +#### name + +> **name**: `string` + +*** + +### userVerification? + +> `optional` **userVerification**: `UserVerificationRequirement` + +Defined in: [react-native-passkey-stamper/src/index.ts:67](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/react-native-passkey-stamper/src/index.ts#L67) diff --git a/sdks/react-native-passkey-stamper/index/TPasskeyStamperConfig/readme.mdx b/sdks/react-native-passkey-stamper/index/TPasskeyStamperConfig/readme.mdx new file mode 100644 index 00000000..67238bd2 --- /dev/null +++ b/sdks/react-native-passkey-stamper/index/TPasskeyStamperConfig/readme.mdx @@ -0,0 +1,66 @@ +--- +title: "TPasskeyStamperConfig" +mode: wide +--- + +# Type Alias: TPasskeyStamperConfig + +> **TPasskeyStamperConfig** = `object` + +Defined in: [react-native-passkey-stamper/src/index.ts:93](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/react-native-passkey-stamper/src/index.ts#L93) + +## Properties + +### allowCredentials? + +> `optional` **allowCredentials**: [`PublicKeyCredentialDescriptor`](../PublicKeyCredentialDescriptor/readme)[] + +Defined in: [react-native-passkey-stamper/src/index.ts:105](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/react-native-passkey-stamper/src/index.ts#L105) + +*** + +### extensions? + +> `optional` **extensions**: `Record`\<`string`, `unknown`\> + +Defined in: [react-native-passkey-stamper/src/index.ts:114](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/react-native-passkey-stamper/src/index.ts#L114) + +*** + +### rpId + +> **rpId**: `string` + +Defined in: [react-native-passkey-stamper/src/index.ts:96](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/react-native-passkey-stamper/src/index.ts#L96) + +*** + +### timeout? + +> `optional` **timeout**: `number` + +Defined in: [react-native-passkey-stamper/src/index.ts:99](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/react-native-passkey-stamper/src/index.ts#L99) + +*** + +### userVerification? + +> `optional` **userVerification**: `UserVerificationRequirement` + +Defined in: [react-native-passkey-stamper/src/index.ts:102](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/react-native-passkey-stamper/src/index.ts#L102) + +*** + +### withPlatformKey? + +> `optional` **withPlatformKey**: `boolean` + +Defined in: [react-native-passkey-stamper/src/index.ts:111](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/react-native-passkey-stamper/src/index.ts#L111) + +*** + +### withSecurityKey? + +> `optional` **withSecurityKey**: `boolean` + +Defined in: [react-native-passkey-stamper/src/index.ts:108](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/react-native-passkey-stamper/src/index.ts#L108) diff --git a/sdks/react-native-passkey-stamper/index/TurnkeyAuthenticatorParams/readme.mdx b/sdks/react-native-passkey-stamper/index/TurnkeyAuthenticatorParams/readme.mdx new file mode 100644 index 00000000..9abe34d7 --- /dev/null +++ b/sdks/react-native-passkey-stamper/index/TurnkeyAuthenticatorParams/readme.mdx @@ -0,0 +1,12 @@ +--- +title: "TurnkeyAuthenticatorParams" +mode: wide +--- + +# Type Alias: TurnkeyAuthenticatorParams + +> **TurnkeyAuthenticatorParams** = `TurnkeyApiTypes`\[`"v1AuthenticatorParamsV2"`\] + +Defined in: [react-native-passkey-stamper/src/index.ts:33](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/react-native-passkey-stamper/src/index.ts#L33) + +Authenticator params expected by the Turnkey API (for authenticator, user, or sub-organization creation) diff --git a/sdks/react-native-passkey-stamper/index/createPasskey/readme.mdx b/sdks/react-native-passkey-stamper/index/createPasskey/readme.mdx new file mode 100644 index 00000000..185b9176 --- /dev/null +++ b/sdks/react-native-passkey-stamper/index/createPasskey/readme.mdx @@ -0,0 +1,32 @@ +--- +title: "CreatePasskey" +mode: wide +--- + +# Function: createPasskey() + +> **createPasskey**(`config`, `options`?): `Promise`\<\{\}\> + +Defined in: [react-native-passkey-stamper/src/index.ts:134](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/react-native-passkey-stamper/src/index.ts#L134) + +Creates a passkey and returns authenticator params + +## Parameters + +### config + +[`TPasskeyRegistrationConfig`](../TPasskeyRegistrationConfig/readme) + +### options? + +#### withPlatformKey + +`boolean` + +#### withSecurityKey + +`boolean` + +## Returns + +`Promise`\<\{\}\> diff --git a/sdks/react-native-passkey-stamper/index/isSupported/readme.mdx b/sdks/react-native-passkey-stamper/index/isSupported/readme.mdx new file mode 100644 index 00000000..727ba89c --- /dev/null +++ b/sdks/react-native-passkey-stamper/index/isSupported/readme.mdx @@ -0,0 +1,16 @@ +--- +title: "IsSupported" +mode: wide +--- + +# Function: isSupported() + +> **isSupported**(): `boolean` + +Defined in: [react-native-passkey-stamper/src/index.ts:123](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/react-native-passkey-stamper/src/index.ts#L123) + +Re-export of the underlying library's `isSupported` method + +## Returns + +`boolean` diff --git a/sdks/react-native-passkey-stamper/index/readme.mdx b/sdks/react-native-passkey-stamper/index/readme.mdx new file mode 100644 index 00000000..e811328c --- /dev/null +++ b/sdks/react-native-passkey-stamper/index/readme.mdx @@ -0,0 +1,29 @@ +--- +title: "Index" +mode: wide +--- + +# index + +## Enumerations + +- [AuthenticatorTransport](AuthenticatorTransport/readme) + +## Classes + +- [PasskeyStamper](PasskeyStamper/readme) + +## Interfaces + +- [PublicKeyCredentialDescriptor](PublicKeyCredentialDescriptor/readme) + +## Type Aliases + +- [TPasskeyRegistrationConfig](TPasskeyRegistrationConfig/readme) +- [TPasskeyStamperConfig](TPasskeyStamperConfig/readme) +- [TurnkeyAuthenticatorParams](TurnkeyAuthenticatorParams/readme) + +## Functions + +- [createPasskey](createPasskey/readme) +- [isSupported](isSupported/readme) diff --git a/sdks/react-native-passkey-stamper/readme.mdx b/sdks/react-native-passkey-stamper/readme.mdx new file mode 100644 index 00000000..3ebc7306 --- /dev/null +++ b/sdks/react-native-passkey-stamper/readme.mdx @@ -0,0 +1,75 @@ +--- +title: "React Native Passkey Stamper" +mode: wide +--- + +# @turnkey/react-native-passkey-stamper + +[![npm](https://img.shields.io/npm/v/@turnkey/react-native-passkey-stamper?color=%234C48FF)](https://www.npmjs.com/package/@turnkey/react-native-passkey-stamper) + +This package contains a React Native passkey stamper. It uses [`react-native-passkey`](https://github.com/f-23/react-native-passkey) to do the heavy lifting. This stamper is meant to be used with [`@turnkey/http`](https://www.npmjs.com/package/@turnkey/http) + +## Installation + +- Install both [`react-native-passkey`](https://www.npmjs.com/package/react-native-passkey) and `@turnkey/react-native-passkey-stamper` (this package) in your React Native project. +- Set up provisioning correctly to make sure your app is signed (needed for passkey functionality) +- Serve an `apple-app-site-association` file from your domain to reference your application. See [more details here](https://github.com/f-23/react-native-passkey?tab=readme-ov-file#configuration) +- Add a new "Associated Domains" capability for web credentials (`webcredentials:your.site.com`) + +## Usage + +### Create a new passkey + +```ts +import { createPasskey } from "@turnkey/react-native-passkey-stamper"; + +// Returns authenticator params that can be used with sub-org creation, user creation, etc. +const authenticatorParams = await createPasskey({ + // Won't be visible to users, this is the name of the Turnkey resource + authenticatorName: "End-User Passkey", + rp: { + id: "your.site.com", + name: "Your App", + }, + user: { + // This ID isn't visible to users + id: String(Date.now()), + // ...but name and display names are. This is what's shown in the passkey prompt + name: "Some Name", + // displayName should be the same as "name" + displayName: "Some Name", + }, +}); +``` + +### Use an existing passkey + +```ts +import { PasskeyStamper } from "@turnkey/react-native-passkey-stamper"; +import { TurnkeyClient } from "@turnkey/http"; + +const stamper = new PasskeyStamper({ + rpId: "your.site.com", +}); + +// New HTTP client able to sign with passkeys! +const httpClient = new TurnkeyClient( + { baseUrl: "https://api.turnkey.com" }, + stamper +); + +// Now, send authenticated requests +httpClient.signTransaction(...) +``` + +## Demo app + +Head over to [this repository](https://github.com/r-n-o/passkeyapp/tree/main) for a fully functional React Native app built with Expo. + +## Documents + + + +## Modules + +- [index](index/readme) diff --git a/sdks/readme.mdx b/sdks/readme.mdx new file mode 100644 index 00000000..1fcedeff --- /dev/null +++ b/sdks/readme.mdx @@ -0,0 +1,168 @@ +--- +title: "Sdks" +mode: wide +--- + +# Turnkey SDK + +[![js-build](https://github.com/tkhq/sdk/actions/workflows/js-build.yml/badge.svg)](https://github.com/tkhq/sdk/actions/workflows/js-build.yml) + +## Overview + +The Turnkey SDK includes functionality to interact with Turnkey in various contexts and ecosystems. It consists of three main NPM package groups. + +- the [Primary Turnkey Web SDK Packages](#primary-turnkey-web-sdk-packages) which expose the main functionality required to build Turnkey-powered applications in different web environments +- the [Chain/Ecosystem-Specific Signing Packages](#chainecosystem-specific-signing-sdk-packages) which expose signers with support for specific ecosystems, built on top of our Web SDK packages +- the [Advanced Functionality SDK Packages](#advanced-functionality-sdk-packages) which exposes lower level functionality that is leveraged by our Primary Web SDK Packages for those with highly-specific implementations looking to use them. + +The diagram below helps visualize the packages in our SDK organized by the functionality they expose. + +homepage screenshot + +## Primary Turnkey Web SDK Packages + +The following packages expose the main functionality required to build Turnkey-powered applications. Each package exposes functions, and/or client classes with methods that manage the process of authenticating requests to the Turnkey API in the contexts of a generic browser environment or react client environment, or a server environment. + +While these higher level packages are the main points of reference to be used while designing and building Turnkey applications, they wrap other packages with lower level functionality which we also expose separately for those who would like to explore them for more specialized use cases. These packages are listed and described below in the [Advanced Functionality SDK Packages](#advanced-functionality-sdk-packages) section. + +Our main web SDK packages are as follows: + +| Package | Description | NPM | Changelog | Docs | +| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------- | -------------------------------------------------------- | +| [@turnkey/sdk-browser](/packages/sdk-browser) | The `@turnkey/sdk-browser` package exposes functionality that lets developers build browser based applications that interact with the Turnkey API with different types of authentication. It consists of different clients that enable requests to the API to be authenticated via different auth methods like user sessions, passkeys and iFrames. It also contains methods to manage information and state related to authentication like auth bundles and sessions, retrieving user information and server signing API requests. | [![npm](https://img.shields.io/npm/v/@turnkey/http?color=%234C48FF)](https://www.npmjs.com/package/@turnkey/sdk-browser) | [changelog](/packages/sdk-browser/changelog.md) | [Docs](https://docs.turnkey.com/sdks/javascript-browser) | +| [@turnkey/sdk-server](https://github.com/tkhq/sdk/tree/main/packages/sdk-server) | The `@turnkey/sdk-server` package exposes functionality that lets developers build server-side functionality for applications that interact with the Turnkey API with different types of authentication – allowing applications to authenticate users, manage sessions, and perform organizational operations securely and efficiently. It consists of an API Client and API Proxies that enable requests to the Turnkey API to be authenticated with the appropriate credentials. Specifically, the API Client manages requests signed by the user's authentication details, and the API proxies handle requests signed by the parent organization's authentication details. Use this package to handle server-side interactions for applications that interact with the Turnkey API. | [![npm](https://img.shields.io/npm/v/@turnkey/sdk-server?color=%234C48FF)](https://www.npmjs.com/package/@turnkey/sdk-server) | [changelog](/packages/sdk-server/changelog.md) | [Docs](https://docs.turnkey.com/sdks/javascript-server) | +| [@turnkey/sdk-react](https://github.com/tkhq/sdk/tree/main/packages/sdk-react) | The `@turnkey/sdk-react` package wraps the functionality from the `@turnkey/sdk-browser` package to allow developers to build react based applications that interact with the Turnkey API with different types of authentication. It allows developers to use the same clients exposed in `@turnkey/sdk-browser` that enable requests to the API to be authenticated via different auth methods like user sessions, passkey and iFrames. It also contains the same methods to manage information and state related to authentication like auth bundles and sessions, retrieving user information and server signing API requests. Use this package when you're building React-based frontend applications that interact with the Turnkey API. | [![npm](https://img.shields.io/npm/v/@turnkey/sdk-react?color=%234C48FF)](https://www.npmjs.com/package/@turnkey/sdk-react) | [changelog](/packages/sdk-react/changelog.md) | [Docs](https://docs.turnkey.com/sdks/react) | + +The diagram below helps visualize how each package can be used to devlop the appropriate service in your Turnkey Powered Application, and how Turnkey requests would flow between those services. + +homepage screenshot + +## Chain/Ecosystem-Specific Signing SDK Packages + +The following packages contain chain or ecosystem specific signers that take some of our [Primary Turnkey Web SDK Packages](#primary-turnkey-web-sdk-packages) (usually @turnkey/sdk-browser or @turnkey/sdk-server) and add additional support based on the signing process or transaction structure relevant to that specific chain or ecosystem. + +| Package | NPM | Description | Changelog | +| ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------ | ----------------------------------------------------- | +| [`@turnkey/ethers`](/packages/ethers) | [![npm](https://img.shields.io/npm/v/@turnkey/ethers?color=%234C48FF)](https://www.npmjs.com/package/@turnkey/ethers) | Turnkey Signer for Ethers | [changelog](/packages/ethers/changelog.md) | +| [`@turnkey/viem`](/packages/viem) | [![npm](https://img.shields.io/npm/v/@turnkey/viem?color=%234C48FF)](https://www.npmjs.com/package/@turnkey/viem) | Turnkey Signer for Viem | [changelog](/packages/viem/changelog.md) | +| [`@turnkey/cosmjs`](/packages/cosmjs) | [![npm](https://img.shields.io/npm/v/@turnkey/cosmjs?color=%234C48FF)](https://www.npmjs.com/package/@turnkey/cosmjs) | Turnkey Signer for CosmJS | [changelog](/packages/cosmjs/changelog.md) | +| [`@turnkey/solana`](/packages/solana) | [![npm](https://img.shields.io/npm/v/@turnkey/solana?color=%234C48FF)](https://www.npmjs.com/package/@turnkey/solana) | Turnkey Signer for Solana | [changelog](/packages/solana/changelog.md) | +| [`@turnkey/eip-1193-provider`](/packages/eip-1193-provider) | [![npm](https://img.shields.io/npm/v/@turnkey/eip-1193-provider?color=%234C48FF)](https://www.npmjs.com/package/@turnkey/eip-1193-provider) | Turnkey-compatible EIP-1193 Provider | [changelog](/packages/eip-1193-provider/changelog.md) | + +## Advanced Functionality SDK Packages + +For those with more specialized use cases, Turnkey exposes it's lower level-libraries stamping and encryption libraries to be used directly. Note: for most use-cases, these libraries are not meant to be used directly and we encourage working on designing your application mainlyusing our [Primary Turnkey Web SDK Packages](#primary-turnkey-web-sdk-packages) along with our [Chain and Ecosystem Specific SDK Packages](#chainecosystem-specific-signing-sdk-packages) as per your use case! + +### Request Stamping + +| Package | NPM | Description | Changelog | Docs | +| -------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- | ---------------------------------------------------------------- | --------------------------------------------------------------- | +| [`@turnkey/http`](/packages/http) | [![npm](https://img.shields.io/npm/v/@turnkey/http?color=%234C48FF)](https://www.npmjs.com/package/@turnkey/http) | Lower-level, fully typed HTTP client for interacting with Turnkey API | [changelog](/packages/http/changelog.md) | [Docs](https://docs.turnkey.com/sdks/advanced/turnkey-client) | +| [`@turnkey/api-key-stamper`](/packages/api-key-stamper) | [![npm](https://img.shields.io/npm/v/@turnkey/api-key-stamper?color=%234C48FF)](https://www.npmjs.com/package/@turnkey/api-key-stamper) | Provide API key signatures over Turnkey requests | [changelog](/packages/api-key-stamper/changelog.md) | [Docs](https://docs.turnkey.com/sdks/advanced/api-key-stamper) | +| [`@turnkey/iframe-stamper`](/packages/iframe-stamper) | [![npm](https://img.shields.io/npm/v/@turnkey/iframe-stamper?color=%234C48FF)](https://www.npmjs.com/package/@turnkey/iframe-stamper) | Provide API key signatures over Turnkey requests within iframe contexts | [changelog](/packages/iframe-stamper/changelog.md) | [Docs](https://docs.turnkey.com/sdks/advanced/iframe-stamper) | +| [`@turnkey/webauthn-stamper`](/packages/webauthn-stamper) | [![npm](https://img.shields.io/npm/v/@turnkey/webauthn-stamper?color=%234C48FF)](https://www.npmjs.com/package/@turnkey/webauthn-stamper) | Provide Webauthn signatures over Turnkey requests | [changelog](/packages/webauthn-stamper/changelog.md) | [Docs](https://docs.turnkey.com/sdks/advanced/webauthn-stamper) | +| [`@turnkey/wallet-stamper`](/packages/wallet-stamper) | [![npm](https://img.shields.io/npm/v/@turnkey/wallet-stamper?color=%234C48FF)](https://www.npmjs.com/package/@turnkey/wallet-stamper) | Provide wallet signatures over Turnkey requests | [changelog](/packages/wallet-stamper/changelog.md) | [Docs](https://docs.turnkey.com/sdks/advanced/wallet-stamper) | +| [`@turnkey/sdk-react-native-passkey-stamper`](/packages/react-native-passkey-stamper/) | [![npm](https://img.shields.io/npm/v/@turnkey/react-native-passkey-stamper?color=%234C48FF)](https://www.npmjs.com/package/@turnkey/react-native-passkey-stamper) | Provide Passkey signatures over Turnkey requests in a React Native context | [changelog](/packages/react-native-passkey-stamper/changelog.md) | [Docs](https://docs.turnkey.com/sdks/react-native) | + +### Utilities + +| Package | NPM | Description | Changelog | +| ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- | -------------------------------------------- | +| [`@turnkey/encoding`](/packages/encoding) | [![npm](https://img.shields.io/npm/v/@turnkey/encoding?color=%234C48FF)](https://www.npmjs.com/package/@turnkey/encoding) | Encoding and decoding utilities, primarily for internal usage | [changelog](/packages/encoding/changelog.md) | +| [`@turnkey/crypto`](/packages/crypto) | [![npm](https://img.shields.io/npm/v/@turnkey/crypto?color=%234C48FF)](https://www.npmjs.com/package/@turnkey/crypto) | Cryptographic utilities for P256 keys, encryption, and decryption | [changelog](/packages/crypto/changelog.md) | + +## Code Examples + +### Instant examples (powered by Stackblitz) + +The following code examples have been loaded into Stackblitz web environments so you can test them out immediately + +| Example | Description | Stackblitz Link | +| ----------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------ | +| [`email-auth-local-storage`](/examples/email-auth-local-storage/) | A NextJS app demonstrating a complete email auth flow using a locally stored target embedded key | [Test it out on Stackblitz!](https://stackblitz.com/edit/stackblitz-starters-pyyw59) | +| [`with-eth-passkey-signers`](/examples/with-eth-passkey-signers/) | A NextJS app powering users to create suborgs and sign messages via Viem or Ethers | [Test it out on Stackblitz!](https://stackblitz.com/edit/stackblitz-starters-2psu3g) | +| [`with-solana`](/examples/with-solana/) | Create a new Solana address, then sign and broadcast a transaction on Solana's devnet | [Test it out on Stackblitz!](https://stackblitz.com/edit/stackblitz-starters-xeb93i) | +| [`with-solana-passkeys`](/examples/with-solana-passkeys/) | A NextJS app powering users to create suborgs, sign messages, and create transactions sponsored by the parent org using @turnkey/solana | [Test it out on Stackblitz!](https://stackblitz.com/edit/stackblitz-starters-h5pmnu) | + +### Other Code Examples + +The below examples will require a local installation of `node.js`. Follow the specific instructions in the respective readme's of each examples to run them! + +| Example | Description | +| ------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [`demo-consumer-wallet`](https://github.com/tkhq/demo-consumer-wallet) | A minimal consumer wallet app powered by Turnkey and WalletConnect | +| [`demo-passkey-wallet`](https://github.com/tkhq/demo-passkey-wallet) | A minimal consumer wallet app powered by Turnkey and passkeys | +| [`demo-ethers-passkeys`](https://github.com/tkhq/demo-ethers-passkeys) | A NextJS app that demonstrates how to use `@turnkey/ethers` to build a passkey-powered application | +| [`demo-viem-passkeys`](https://github.com/tkhq/demo-viem-passkeys) | A NextJS app that demonstrates how to use `@turnkey/viem` to build a passkey-powered application | +| [`react-native-demo-wallet`](https://github.com/tkhq/react-native-demo-wallet) | A React Native app that demonstrates how to use the Turnkey's JavaScript packages in a mobile environment to authenticate users, create wallets, export wallets, sign messages, and more | +| [`flutter-demo-app`](https://github.com/tkhq/dart-sdk/tree/main/examples/flutter-demo-app) | A Flutter app that demonstrates how to use the Turnkey's Flutter packages to authenticate users, create wallets, export wallets, sign messages, and more | +| [`deployer`](/examples/deployer/) | Compile and deploy a smart contract | +| [`email-auth`](/examples/email-auth/) | A NextJS app demonstrating a complete email auth flow using Turnkey iframes | +| [`wallet-import-export`](/examples/wallet-import-export/) | A NextJS app demonstrating complete wallet import and export flows | +| [`rebalancer`](/examples/rebalancer/) | A demo application which showcases an example of how to use Turnkey for managing multiple types of keys & users | +| [`sweeper`](/examples/sweeper/) | Sweep funds from one address to a different address | +| [`trading-runner`](/examples/trading-runner/) | A sample application demonstrating a trading operation, using various private keys, users, and policies, powered by Uniswap | +| [`with-ethers`](/examples/with-ethers/) | Create a new Ethereum address, then sign and broadcast a transaction using the Ethers signer with Infura | +| [`with-viem`](/examples/with-viem/) | Sign and broadcast a transaction using the Turnkey Custom Account and Infura | +| [`with-cosmjs`](/examples/with-cosmjs/) | Create a new Cosmos address, then sign and broadcast a transaction on Celestia testnet using the CosmJS signer | +| [`with-bitcoin`](/examples/with-bitcoin/) | Create a new wallet, derive a BTC address, create, sign, and broadcast a transaction using BitcoinJS and other external APIs | +| [`with-biconomy-aa`](/examples/with-biconomy-aa/) | Create a new wallet, connect a Turnkey wallet client to Biconomy Nexus, and create, sign, and broadcast an EIP-1559 transaction | +| [`with-zerodev-aa`](/examples/with-zerodev-aa/) | Create a new wallet, instantiate a Turnkey signer, create a ZeroDev kernel account and client, and broadcast a UserOp | +| [`with-gnosis`](/examples/with-gnosis/) | Create new Ethereum addresses, configure a 3/3 Gnosis safe, and create + execute a transaction from it | +| [`with-uniswap`](/examples/with-uniswap/) | Sign and broadcast a Uniswap v3 trade using the Ethers signer with Infura | +| [`with-nonce-manager`](/examples/with-nonce-manager/) | Create a new Ethereum address, then sign and broadcast multiple transactions in a sequential or optimistic manner | +| [`with-offline`](/examples/with-offline/) | Sign a Turnkey request in offline context | +| [`with-federated-passkeys`](/examples/with-federated-passkeys/) | A NextJS app that demonstrates how to use Turnkey to build a federated, webauthn powered authentication flow | +| [`with-eip-1193-provider`](/examples/with-eip-1193-provider/) | A NextJS app that demonstrates how to use Turnkey the `@turnkey/eip-1193-provider` in your app | +| [`with-wallet-stamper`](/examples/with-wallet-stamper/) | A NextJS app that demonstrates how to use Turnkey the `@turnkey/wallet-stamper` in your app | + +## Demos built with Turnkey + +### Demo Consumer Wallet ([code](https://github.com/tkhq/demo-consumer-wallet)) + +A minimal consumer wallet app powered by Turnkey. Behind the scenes, it uses [`@turnkey/ethers`](https://www.npmjs.com/package/@turnkey/ethers) for signing and WalletConnect (v1) for accessing dapps. + +https://github.com/tkhq/demo-consumer-wallet/assets/127255904/2c3409df-2d7c-4ec3-9aa8-e2944a0b0e0a + +See https://github.com/tkhq/demo-consumer-wallet for the code. + +### Demo Passkey Wallet ([code](https://github.com/tkhq/demo-passkey-wallet), [live link](https://wallet.tx.xyz)) + +A wallet application showing how users can register and authenticate using passkeys. +This demo uses the Turnkey API to create a new [Turnkey Sub-Organization](https://docs.turnkey.com/concepts/sub-organizations) for each user, create a testnet Ethereum address and send a transaction on Sepolia (ETH testnet). + +homepage screenshot + +See https://wallet.tx.xyz (and https://github.com/tkhq/demo-passkey-wallet for the code). + +### Demo Ethers Passkeys ([code](https://github.com/tkhq/demo-ethers-passkeys)) + +A simple application demonstrating how to create sub-organizations, create private keys, and sign with the [`@turnkey/ethers`](https://github.com/tkhq/sdk/tree/main/packages/ethers) signer, using passkeys. + +homepage screenshot + +See https://github.com/tkhq/demo-ethers-passkeys for the code. + +### Demo Viem Passkeys ([code](https://github.com/tkhq/demo-viem-passkeys)) + +A similar, simple application demonstrating how to create sub-organizations, create private keys, and sign with the [`@turnkey/viem`](https://github.com/tkhq/sdk/tree/main/packages/viem) signer, using passkeys. + +homepage screenshot + +See https://github.com/tkhq/demo-viem-passkeys for the code. + +### React Native Demo App ([code](https://github.com/tkhq/react-native-demo-wallet)) + +A React Native app that demonstrates how to use the Turnkey's JavaScript packages in a mobile environment to authenticate users, create wallets, export wallets, sign messages, and more + +https://github.com/user-attachments/assets/e4cff012-11e9-4636-b67a-5dbf75355832 + +See https://github.com/tkhq/react-native-demo-wallet for the code. + +### Flutter Demo App ([code](https://github.com/tkhq/dart-sdk/tree/main/examples/flutter-demo-app)) + +A Flutter app that demonstrates how to use the Turnkey's Flutter packages to authenticate users, create wallets, export wallets, sign messages, and more + +https://github.com/user-attachments/assets/3d583ed8-1eff-4101-ae43-3c76c655e635 + +See https://github.com/tkhq/dart-sdk/tree/main/examples/flutter-demo-app for the code diff --git a/sdks/sdk-browser/JavaScript_Browser/readme.mdx b/sdks/sdk-browser/JavaScript_Browser/readme.mdx new file mode 100644 index 00000000..18c0db29 --- /dev/null +++ b/sdks/sdk-browser/JavaScript_Browser/readme.mdx @@ -0,0 +1,784 @@ +--- +title: "JavaScript_Browser" +mode: wide +--- + +## Overview + +The [`@turnkey/sdk-browser`](https://www.npmjs.com/package/@turnkey/sdk-browser) package exposes functionality that lets developers build browser based applications that interact with the Turnkey API with different types of authentication. + +It consists of the `passkeyClient`, `iframeClient` and `walletClient` that enable requests to the API to be authenticated via different auth methods. It also contains methods to manage information and state related to authentication like auth bundles and sessions, retrieving user information and server signing API requests. + +If you are working with React - check out our [`@turnkey/sdk-react`](https://www.npmjs.com/package/@turnkey/sdk-react) package. + +## Installation + + + +```bash npm +npm install @turnkey/sdk-browser +``` + +```bash Yarn +yarn add @turnkey/sdk-browser +``` + + + +## Initializing + +```js +import { Turnkey } from "@turnkey/sdk-browser"; +const turnkey = new Turnkey({ + apiBaseUrl: "https://api.turnkey.com", + defaultOrganizationId: process.env.TURNKEY_ORGANIZATION_ID, +}); +``` + +#### Parameters + + + +An object containing configuration settings for the Browser Client. + + + + + +The root organization that requests will be made from unless otherwise specified + + + + + +The base URL that API requests will be sent to (use [https://api.turnkey.com](https://api.turnkey.com) when making requests to Turnkey's API) + + + + + +The Relying Party ID used for WebAuthn flows (will default to the value returned from `window.location.hostname` unless otherwise specified) + + + + + +The URL to send requests that need to be signed from a backend codebase by the root organization's API key if using the `serverSign` flow. + + +Calls to Turnkey's API must be signed with a valid credential from the appropriate user and, from a browser client, can either be sent directly to Turnkey or proxied through a server. Turnkey's Browser SDK contains the following different clients that manage the process of validating these requests depending on the kind of authentication credential that is being used. + +## TurnkeyBrowserClient + +The `TurnkeyBrowserClient` wraps Turnkey's basic SDK client with browser session management functionality. This client allows you to create a read only session that only authenticates read requests, or a read write session. It uses local storage for session management. The constructor for `TurnkeyBrowserClient` optionally takes in `AuthClient` which tracks which client was used for the initial authentication, to be used for retrieval purposes. Each subclass of `TurnkeyBrowserClient` (including `TurnkeyPasskeyClient`, `TurnkeyIframeClient` and `TurnkeyWalletClient`) will also set this to the respective value when used. + +Below are all of the methods exposed by `TurnkeyBrowserClient` + +### `login()` + +Creates a read-only session for the current user, storing session details like userId, organizationId, sessionExpiry and which authentication client was used in local storage. This session allows for read-only actions within the Turnkey API. If you would like to instantiate a read only `TurnkeyBrowserClient` after logging in, you can use the [`currentUserSession()`](#currentusersession) method. + +```js +import { TurnkeyBrowserClient } from "@turnkey/sdk-browser"; + +const config = { + apiBaseUrl: "https://api.turnkey.com", + defaultOrganizationId: process.env.TURNKEY_ORGANIZATION_ID, +}; + +// Create a client instance +const browserClient = new TurnkeyBrowserClient(config); + +// Logs in to create a read-only session, storing the session in local storage +const readOnlySession = await browserClient.login({ organizationId: "org-id" }); +``` + +### `loginWithBundle()` + +Authenticate a user via the credential bundle emailed to them and creates a read-write session. + +```js +import { TurnkeyBrowserClient } from "@turnkey/sdk-browser"; + +const config = { + apiBaseUrl: "https://api.turnkey.com", + defaultOrganizationId: process.env.TURNKEY_ORGANIZATION_ID, +}; + +// Create a client instance +const browserClient = new TurnkeyBrowserClient(config); + +// Authenticate with a credential bundle from email +const session = await browserClient.loginWithBundle({ + bundle: "credential-bundle-from-email", + expirationSeconds: "900", // 15 minutes +}); +``` + +#### Parameters + + + An object containing the parameters to authenticate via a credential bundle. + + + + The credential bundle string emailed to the user. + + + + Specify the length of the session in seconds. Defaults to 900 seconds or 15 + minutes. + + + + The public key of the target user. This will be inferred from the + `TurnkeyIframeClient` if `targetPublicKey` is not provided. + + +### `loginWithPasskey()` + +Authenticate a user via Passkey and create a read-only or read-write session. + +```js +import { TurnkeyBrowserClient } from "@turnkey/sdk-browser"; + +const config = { + apiBaseUrl: "https://api.turnkey.com", + defaultOrganizationId: process.env.TURNKEY_ORGANIZATION_ID, +}; + +// Create a client instance +const browserClient = new TurnkeyBrowserClient(config); +const iframeClient = await turnkeySDK.iframeClient(); + +// Authenticate with a passkey to create a read-write session +const session = await browserClient.loginWithPasskey({ + sessionType: "READ_WRITE", + iframeClient: iframeClient, + expirationSeconds: "900", // 15 minutes +}); +``` + +#### Parameters + + + An object containing the parameters to authenticate via a Passkey. + + + + The type of session to be created. Either read-only or read-write. + + + + An instance of a `TurnkeyIframeClient`. + + + + Specify the length of the session in seconds. Defaults to 900 seconds or 15 + minutes. + + + + The public key of the target user. This will be inferred from the + `TurnkeyIframeClient` if `targetPublicKey` is not provided. + + +### `loginWithSession()` + +Log in with a session object created via a server action. The session can be either read-only or read-write. + +```js +import { TurnkeyBrowserClient } from "@turnkey/sdk-browser"; + +const config = { + apiBaseUrl: "https://api.turnkey.com", + defaultOrganizationId: process.env.TURNKEY_ORGANIZATION_ID, +}; + +// Create a client instance +const browserClient = new TurnkeyBrowserClient(config); + +// Login with a session created by a server +const loggedIn = await browserClient.loginWithSession(serverCreatedSession); +``` + +#### Parameters + + + An existing session to authenticate the user with. + + +### `loginWithWallet()` + +Login with an existing wallet e.g. Metamask. + +```js +import { TurnkeyBrowserClient } from "@turnkey/sdk-browser"; + +const config = { + apiBaseUrl: "https://api.turnkey.com", + defaultOrganizationId: process.env.TURNKEY_ORGANIZATION_ID, +}; + +// Create a client instance +const browserClient = new TurnkeyBrowserClient(config); +const iframeClient = await turnkeySDK.iframeClient(); + +// Login with a wallet to create a read-write session +const session = await browserClient.loginWithWallet({ + sessionType: "READ_WRITE", + iframeClient: iframeClient, + expirationSeconds: "900", // 15 minutes +}); +``` + +#### Parameters + + + An object containing the parameters to authenticate via a browser wallet. + + + + The type of session to be created. Either read-only or read-write. + + + + An instance of a `TurnkeyIframeClient`. + + + + Specify the length of the session in seconds. Defaults to 900 seconds or 15 + minutes. + + + + The public key of the target user. This will be inferred from the + `TurnkeyIframeClient` if `targetPublicKey` is not provided. + + +### `refreshSession()` + +Attempts to refresh an existing, active session and will extend the session expiry using the `expirationSeconds` parameter. + +```js +import { TurnkeyBrowserClient } from "@turnkey/sdk-browser"; + +const config = { + apiBaseUrl: "https://api.turnkey.com", + defaultOrganizationId: process.env.TURNKEY_ORGANIZATION_ID, +}; + +// Create a client instance +const browserClient = new TurnkeyBrowserClient(config); + +// Refresh the current session +const refreshedSession = await browserClient.refreshSession({ + sessionType: "READ_WRITE", + expirationSeconds: "900", // 15 minutes +}); +``` + +#### Parameters + + + An object containing the `RefreshSessionParams`. + + + + The type of `Session` that is being refreshed. + + + + Specify how long to extend the session. Defaults to 900 seconds or 15 minutes. + + + + The public key of the target user. This will be inferred from the + `TurnkeyIframeClient` if `targetPublicKey` is not provided. + + +### `loginWithReadWriteSession()` + +Creates a read-write session. This method infers the current user's organization ID and target userId. To be used in conjunction with an `iframeStamper`: the resulting session's credential bundle can be injected into an iframeStamper to create a session that enables both read and write requests. + +```js +import { TurnkeyBrowserClient } from "@turnkey/sdk-browser"; + +const config = { + apiBaseUrl: "https://api.turnkey.com", + defaultOrganizationId: process.env.TURNKEY_ORGANIZATION_ID, +}; + +// Create a client instance +const browserClient = new TurnkeyBrowserClient(config); + +// Logs in to create a read-write session, using a target embedded key and session expiration +const readWriteSession = await browserClient.loginWithReadWriteSession( + "target-embedded-key", + "900", // Session expires in 15 minutes + "user-id", +); +``` + +## TurnkeyPasskeyClient + +The `TurnkeyPasskeyClient` class extends `TurnkeyBrowserClient` and specializes it for user authentication through Passkeys, which leverage the WebAuthn standard for passwordless authentication. This class enables the implementation of strong, user-friendly authentication experiences in a web-based application without relying on passwords. TurnkeyPasskeyClient handles Passkey creation, session management with Passkeys and integrates with WebAuthn and Embedded API Keys. + +To see how to instantiate the `TurnkeyPasskeyClient`, [look here](#passkeyclient) + +Below are the methods exposed by the `TurnkeyPasskeyClient` + +### `createUserPasskey()` + +Creates a passkey for an end-user, handling lower-level configurations for the WebAuthn protocol, including challenges and user details. For more detailed examples using this method [look here](/embedded-wallets/code-examples/add-credential). + +```js +import { Turnkey } from "@turnkey/sdk-browser"; + +const config = { + apiBaseUrl: "https://api.turnkey.com", + defaultOrganizationId: process.env.TURNKEY_ORGANIZATION_ID, +}; + +// Create a client instance +const turnkeySDK = new Turnkey(config); + +// Create a Passkey client instance +const passkeyClient = turnkeySDK.passkeyClient(); + +// Creates a new user passkey with WebAuthn protocol details +const passkey = await passkeyClient.createUserPasskey({ + publicKey: { + rp: { name: "Example Relying Party" }, + user: { name: "testUser", displayName: "Test User" }, + }, +}); +``` + +### `createPasskeySession()` + +Uses Passkey authentication to create a read-write session, via an embedded API key, and stores + returns the resulting auth bundle that contains the encrypted API key. This auth bundle (also referred to as a credential bundle) can be injected into an iframeStamper, resulting in a touch-free authenticator. Unlike `loginWithReadWriteSession`, this method assumes the end-user's organization ID (i.e. the sub-organization ID) is already known. + +```js +import { Turnkey } from "@turnkey/sdk-browser"; + +const config = { + apiBaseUrl: "https://api.turnkey.com", + defaultOrganizationId: process.env.TURNKEY_ORGANIZATION_ID, +}; + +// Create a client instance +const turnkeySDK = new Turnkey(config); + +// Create a Passkey client instance +const passkeyClient = turnkeySDK.passkeyClient(); + +// Creates a read-write session using a passkey with a specific expiration and organization ID +const session = await passkeyClient.createPasskeySession( + "user-id", + "target-embedded-key", + "1800", // Expire in 30 minutes + "org-id", +); +``` + +## TurnkeyIframeClient + +The `TurnkeyIframeClient` class extends `TurnkeyBrowserClient` such that it is specialized for use with an iframe-based session. Our iFrame stamping implementation leverages the postMessage communication mechanism to send and receive messages within the iframe, ensuring the credential does not leave its secure environment. This approach is particularly crucial in sensitive flows such as Email Auth, and Key or Wallet Export, where heightened security is required. For further information on our iframe stamping process, checkout our [iframeStamper package documentation](/sdks/advanced/iframe-stamper). + +To see how to instantiate the `TurnkeyIframeClient`, [look here](#iframeclient). + +Here are all of the methods exposed by `TurnkeyIframeClient` + +### `injectCredentialBundle()` + +Injects an encrypted credential bundle (API key or session token) directly into the iframe for session-based authentication and authorization. + +```js +import { Turnkey } from "@turnkey/sdk-browser"; + +const config = { + apiBaseUrl: "https://api.turnkey.com", + defaultOrganizationId: process.env.TURNKEY_ORGANIZATION_ID, +}; + +// Create a client instance +const turnkeySDK = new Turnkey(config); + +// Create a Passkey client instance +const iframeClient = turnkeySDK.iframeClient(); + +// Injects a credential bundle into the iframe for session management +const success = await iframeClient.injectCredentialBundle( + "your-credential-bundle", +); +``` + +### `injectWalletExportBundle()` + +Injects a wallet export bundle into the iframe, associating it with a specified organization. This allows secure transfer of wallet credentials. + +```js +import { Turnkey } from "@turnkey/sdk-browser"; + +const config = { + apiBaseUrl: "https://api.turnkey.com", + defaultOrganizationId: process.env.TURNKEY_ORGANIZATION_ID, +}; + +// Create a client instance +const turnkeySDK = new Turnkey(config); + +// Create a Passkey client instance +const iframeClient = turnkeySDK.iframeClient(); + +// Injects a credential bundle into the iframe for session management +const success = await iframeClient.injectWalletExportBundle( + "wallet-bundle", + "org-id", +); +``` + +### `injectKeyExportBundle()` + +Injects a key export bundle into the iframe, supporting optional key formats. This is useful for transferring specific key credentials securely. + +```js +import { Turnkey } from "@turnkey/sdk-browser"; + +const config = { + apiBaseUrl: "https://api.turnkey.com", + defaultOrganizationId: process.env.TURNKEY_ORGANIZATION_ID, +}; + +// Create a client instance +const turnkeySDK = new Turnkey(config); + +// Create a Passkey client instance +const iframeClient = turnkeySDK.iframeClient(); + +// Injects a key export bundle with an optional key format +const success = await iframeClient.injectKeyExportBundle( + "key-bundle", + "org-id", + "PEM", +); +``` + +### `injectImportBundle()` + +Injects an import bundle into the iframe, associating it with a specific organization and user, enabling secure import of user credentials. + +```js +import { Turnkey } from "@turnkey/sdk-browser"; + +const config = { + apiBaseUrl: "https://api.turnkey.com", + defaultOrganizationId: process.env.TURNKEY_ORGANIZATION_ID, +}; + +// Create a client instance +const turnkeySDK = new Turnkey(config); + +// Create a Passkey client instance +const iframeClient = turnkeySDK.iframeClient(); + +// Injects an import bundle for a specific organization and user +const success = await iframeClient.injectImportBundle( + "import-bundle", + "org-id", + "user-id", +); +``` + +### `extractWalletEncryptedBundle()` + +Extracts an encrypted wallet bundle from the iframe. Useful for securely retrieving wallet credentials from the iframe to the main application. + +```js +import { Turnkey } from "@turnkey/sdk-browser"; + +const config = { + apiBaseUrl: "https://api.turnkey.com", + defaultOrganizationId: process.env.TURNKEY_ORGANIZATION_ID, +}; + +// Create a client instance +const turnkeySDK = new Turnkey(config); + +// Create a Passkey client instance +const iframeClient = turnkeySDK.iframeClient(); + +// Extracts the encrypted wallet bundle from the iframe +const walletBundle = await iframeClient.extractWalletEncryptedBundle(); +``` + +### `extractKeyEncryptedBundle()` + +Extracts an encrypted key bundle from the iframe, providing secure retrieval of key credentials. + +```js +import { Turnkey } from "@turnkey/sdk-browser"; + +const config = { + apiBaseUrl: "https://api.turnkey.com", + defaultOrganizationId: process.env.TURNKEY_ORGANIZATION_ID, +}; + +// Create a client instance +const turnkeySDK = new Turnkey(config); + +// Create a Passkey client instance +const iframeClient = turnkeySDK.iframeClient(); + +// Extracts the encrypted key bundle from the iframe +const keyBundle = await iframeClient.extractKeyEncryptedBundle(); +``` + +## TurnkeyWalletClient + +The `TurnkeyWalletClient` extends `TurnkeyBrowserClient` such that it is specialized for using a wallet to stamp and authenticate requests to the Turnkey API. This stamping process leverages your wallet's signature key to authenticate requests securely. + +### `getPublicKey()` + +This method enables easy access to the wallet public key from the `TurnkeyWalletClient` to be used in authentication flows. + +```js +import { Turnkey } from "@turnkey/sdk-browser"; +import { EthereumWallet } from "@turnkey/wallet-stamper"; + +const config = { + apiBaseUrl: "https://api.turnkey.com", + defaultOrganizationId: process.env.TURNKEY_ORGANIZATION_ID, +}; + +// Create a client instance +const turnkeySDK = new Turnkey(config); + +const walletClient = turnkeySDK.walletClient(new EthereumWallet()); +const publicKey = await walletsClient.getPublicKey(); +``` + +### `getWalletInterface()` + +This method provides easy access to the full object that represents the wallet being used to stamp requests for this client. + +```js +import { Turnkey } from "@turnkey/sdk-browser"; +import { EthereumWallet } from "@turnkey/wallet-stamper"; + +const config = { + apiBaseUrl: "https://api.turnkey.com", + defaultOrganizationId: process.env.TURNKEY_ORGANIZATION_ID, +}; + +// Create a client instance +const turnkeySDK = new Turnkey(config); + +const walletClient = turnkeySDK.walletClient(new EthereumWallet()); +const wallet = await walletsClient.getWalletInterface(); +``` + +## Top Level SDK Functions in `TurnkeyBrowserSDK` + +The `TurnkeyBrowserSDK` serves as the main entry point for interacting with Turnkey's services in a web browser environment. It contains methods to instantiate clients like the `TurnkeyPasskeyClient` and the `TurnkeyIframeClient`. manage information and state related to authentication like auth bundles and sessions, retrieving user information and server signing API requests.The client enables easy access to the wallet public key to be used for authentication flows. + +### `passkeyClient()` + +Creates an instance of TurnkeyPasskeyClient with a specified or default rpId (relying party ID). This client can prompt users to sign with a Passkey credential for authentication. If you'd like to use your Passkey client to proxy requests to your server, to be signed with parent organization credentials, include the server URL in the `serverSignUrl` parameter. + +```js +import { Turnkey } from "@turnkey/sdk-browser"; + +const config = { + apiBaseUrl: "https://api.turnkey.com", + defaultOrganizationId: process.env.TURNKEY_ORGANIZATION_ID, + serverSignUrl: "https://your-server-sign-url.com", +}; + +// Create a client instance +const turnkeySDK = new Turnkey(config); + +const passkeyClient = turnkeySDK.passkeyClient(); +const walletsResponse = await passkeyClient.getWallets(); +``` + +### `iframeClient()` + +Creates an instance of `TurnkeyIframeClient` by initializing an iframe stamper with the specified iframeUrl and optional element ID. The iframe client is used to interact with a series of iframes hosted by Turnkey, designed for sensitive operations such as storing an expiring credential within the [Email Recovery](/authentication/email#recovery-flow) and [Email Auth](/authentication/email) flows, and facilitating Wallet [Import](/wallets/import-wallets) and [Export](/wallets/export-wallets). The code powering these iframes can be found at [https://github.com/tkhq/frames](https://github.com/tkhq/frames). If you'd like to use your iframe client to proxy requests to your server, to be signed with parent organization credentials, include the server URL in the `serverSignUrl` parameter. + +```js +import { Turnkey } from "@turnkey/sdk-browser"; + +const config = { + apiBaseUrl: "https://api.turnkey.com", + defaultOrganizationId: process.env.TURNKEY_ORGANIZATION_ID, + serverSignUrl: "https://your-server-sign-url.com", +}; + +// Create a client instance +const turnkeySDK = new Turnkey(config); + +const iframeClient = await turnkeySDK.iframeClient({ + iframeContainer: document.getElementById("