@imtbl/generated-clients 2.3.3-alpha.0 → 2.3.4-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.js +2 -2
- package/dist/node/index.cjs +11 -10
- package/dist/node/index.js +3 -3
- package/dist/types/index.d.ts +1 -0
- package/dist/types/magic-tee/api.d.ts +13 -0
- package/dist/types/magic-tee/base.d.ts +54 -0
- package/dist/types/magic-tee/common.d.ts +65 -0
- package/dist/types/magic-tee/configuration.d.ts +83 -0
- package/dist/types/magic-tee/domain/transaction-api.d.ts +184 -0
- package/dist/types/magic-tee/domain/wallet-api.d.ts +183 -0
- package/dist/types/magic-tee/index.d.ts +14 -0
- package/dist/types/magic-tee/models/chain.d.ts +20 -0
- package/dist/types/magic-tee/models/create-wallet-request-model.d.ts +25 -0
- package/dist/types/magic-tee/models/httpvalidation-error.d.ts +25 -0
- package/dist/types/magic-tee/models/index.d.ts +10 -0
- package/dist/types/magic-tee/models/personal-sign-request.d.ts +31 -0
- package/dist/types/magic-tee/models/personal-sign-response.d.ts +42 -0
- package/dist/types/magic-tee/models/sign-data-request.d.ts +31 -0
- package/dist/types/magic-tee/models/sign-data-response.d.ts +48 -0
- package/dist/types/magic-tee/models/validation-error-loc-inner.d.ts +18 -0
- package/dist/types/magic-tee/models/validation-error.d.ts +37 -0
- package/dist/types/magic-tee/models/wallet-response-model.d.ts +24 -0
- package/dist/types/magic-tee-api-clients.d.ts +12 -0
- package/package.json +1 -1
package/dist/types/index.d.ts
CHANGED
|
@@ -3,5 +3,6 @@ export * as mr from './multi-rollup';
|
|
|
3
3
|
export * as BlockchainData from './blockchain-data/index';
|
|
4
4
|
export { ImxApiClients } from './imx-api-clients';
|
|
5
5
|
export { MultiRollupApiClients } from './mr-api-clients';
|
|
6
|
+
export { MagicTeeApiClients } from './magic-tee-api-clients';
|
|
6
7
|
export { imxApiConfig, multiRollupConfig, createConfig, } from './config';
|
|
7
8
|
export type { ImmutableAPIConfiguration, MultiRollupAPIConfiguration } from './config';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TEE Express
|
|
3
|
+
* TEE Express is a service that simplifies wallet management for developers. Unlike traditional wallet solutions that require complex key management, TEE Express handles all key management internally, providing a streamlined API for wallet operations. TEE Express leverages secure enclave technology to ensure that private keys never leave the secure environment. All wallet operations, including creation, signing, and key management, are performed within a trusted execution environment (TEE). This provides enterprise-grade security while maintaining the simplicity of a REST API. The service supports Ethereum wallets and provides endpoints for wallet creation, transaction signing, and message signing. All operations are authenticated using JWT tokens passed in the Authorization header, ensuring secure access to user wallets. **Migration Notice:** If you\'re an existing customer, your users\' wallets have been automatically migrated to TEE Express. There\'s no action required on your part - all existing wallets are now accessible through the TEE Express API using the same JWT tokens you currently use for authentication. Simply update your API calls to use the TEE Express endpoints, and pass your existing JWT token in the Authorization header for all requests. **Authentication:** - An API key via the `X-Magic-API-Key` header or a secret key via the `X-Magic-Secret-Key` header. - The OIDC provider ID via the `X-OIDC-Provider-ID` header. - Bearer token in the `Authorization` header. **Data Hashing for Signing:** For personal sign operations, encode your data as base64: ```typescript const message = Buffer.from(data, \'utf-8\').toString(\'base64\'); ``` For signing transaction data or other structured data, provide a keccak256 hash: ```typescript import { MessageTypes, SignTypedDataVersion, TypedDataUtils, TypedDataV1, TypedMessage, typedSignatureHash, } from \'@metamask/eth-sig-util\'; import { resolveProperties, Signature, Transaction, TransactionLike, TransactionRequest } from \'ethers\'; const computeEip712Hash = ( data: TypedMessage<MessageTypes>, version: SignTypedDataVersion.V3 | SignTypedDataVersion.V4, ): string => { const hashBuffer = TypedDataUtils.eip712Hash(data, version); return \'0x\' + hashBuffer.toString(\'hex\'); }; const personalSign = async (data: string) => { const message = Buffer.from(data, \'utf-8\').toString(\'base64\'); const body = { message_base64: message, chain: \'ETH\' }; return await fetch(\'/v1/wallet/personal-sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV1 = async (data: TypedDataV1) => { const rawDataHash = typedSignatureHash(data); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV3 = async (data: TypedMessage<MessageTypes>) => { const rawDataHash = computeEip712Hash(data, SignTypedDataVersion.V3); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV4 = async (data: TypedMessage<MessageTypes>) => { const rawDataHash = computeEip712Hash(data, SignTypedDataVersion.V4); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTransaction = async (tx: TransactionRequest) => { const resolvedTx = await resolveProperties(tx); const txForSigning = { ...resolvedTx }; delete txForSigning.from; const btx = Transaction.from(txForSigning as TransactionLike); const body = { raw_data_hash: btx.unsignedHash, chain: \'ETH\' }; const res = await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); const { r, s, v } = res.json(); btx.signature = Signature.from({ r, s, v }); return btx.serialized; }; ```
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 0.1.0
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
export * from './domain/transaction-api';
|
|
13
|
+
export * from './domain/wallet-api';
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TEE Express
|
|
3
|
+
* TEE Express is a service that simplifies wallet management for developers. Unlike traditional wallet solutions that require complex key management, TEE Express handles all key management internally, providing a streamlined API for wallet operations. TEE Express leverages secure enclave technology to ensure that private keys never leave the secure environment. All wallet operations, including creation, signing, and key management, are performed within a trusted execution environment (TEE). This provides enterprise-grade security while maintaining the simplicity of a REST API. The service supports Ethereum wallets and provides endpoints for wallet creation, transaction signing, and message signing. All operations are authenticated using JWT tokens passed in the Authorization header, ensuring secure access to user wallets. **Migration Notice:** If you\'re an existing customer, your users\' wallets have been automatically migrated to TEE Express. There\'s no action required on your part - all existing wallets are now accessible through the TEE Express API using the same JWT tokens you currently use for authentication. Simply update your API calls to use the TEE Express endpoints, and pass your existing JWT token in the Authorization header for all requests. **Authentication:** - An API key via the `X-Magic-API-Key` header or a secret key via the `X-Magic-Secret-Key` header. - The OIDC provider ID via the `X-OIDC-Provider-ID` header. - Bearer token in the `Authorization` header. **Data Hashing for Signing:** For personal sign operations, encode your data as base64: ```typescript const message = Buffer.from(data, \'utf-8\').toString(\'base64\'); ``` For signing transaction data or other structured data, provide a keccak256 hash: ```typescript import { MessageTypes, SignTypedDataVersion, TypedDataUtils, TypedDataV1, TypedMessage, typedSignatureHash, } from \'@metamask/eth-sig-util\'; import { resolveProperties, Signature, Transaction, TransactionLike, TransactionRequest } from \'ethers\'; const computeEip712Hash = ( data: TypedMessage<MessageTypes>, version: SignTypedDataVersion.V3 | SignTypedDataVersion.V4, ): string => { const hashBuffer = TypedDataUtils.eip712Hash(data, version); return \'0x\' + hashBuffer.toString(\'hex\'); }; const personalSign = async (data: string) => { const message = Buffer.from(data, \'utf-8\').toString(\'base64\'); const body = { message_base64: message, chain: \'ETH\' }; return await fetch(\'/v1/wallet/personal-sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV1 = async (data: TypedDataV1) => { const rawDataHash = typedSignatureHash(data); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV3 = async (data: TypedMessage<MessageTypes>) => { const rawDataHash = computeEip712Hash(data, SignTypedDataVersion.V3); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV4 = async (data: TypedMessage<MessageTypes>) => { const rawDataHash = computeEip712Hash(data, SignTypedDataVersion.V4); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTransaction = async (tx: TransactionRequest) => { const resolvedTx = await resolveProperties(tx); const txForSigning = { ...resolvedTx }; delete txForSigning.from; const btx = Transaction.from(txForSigning as TransactionLike); const body = { raw_data_hash: btx.unsignedHash, chain: \'ETH\' }; const res = await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); const { r, s, v } = res.json(); btx.signature = Signature.from({ r, s, v }); return btx.serialized; }; ```
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 0.1.0
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
import type { Configuration } from './configuration';
|
|
13
|
+
import type { AxiosInstance, AxiosRequestConfig } from 'axios';
|
|
14
|
+
export declare const BASE_PATH: string;
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
* @export
|
|
18
|
+
*/
|
|
19
|
+
export declare const COLLECTION_FORMATS: {
|
|
20
|
+
csv: string;
|
|
21
|
+
ssv: string;
|
|
22
|
+
tsv: string;
|
|
23
|
+
pipes: string;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
*
|
|
27
|
+
* @export
|
|
28
|
+
* @interface RequestArgs
|
|
29
|
+
*/
|
|
30
|
+
export interface RequestArgs {
|
|
31
|
+
url: string;
|
|
32
|
+
options: AxiosRequestConfig;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
*
|
|
36
|
+
* @export
|
|
37
|
+
* @class BaseAPI
|
|
38
|
+
*/
|
|
39
|
+
export declare class BaseAPI {
|
|
40
|
+
protected basePath: string;
|
|
41
|
+
protected axios: AxiosInstance;
|
|
42
|
+
protected configuration: Configuration | undefined;
|
|
43
|
+
constructor(configuration?: Configuration, basePath?: string, axios?: AxiosInstance);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
*
|
|
47
|
+
* @export
|
|
48
|
+
* @class RequiredError
|
|
49
|
+
* @extends {Error}
|
|
50
|
+
*/
|
|
51
|
+
export declare class RequiredError extends Error {
|
|
52
|
+
field: string;
|
|
53
|
+
constructor(field: string, msg?: string);
|
|
54
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TEE Express
|
|
3
|
+
* TEE Express is a service that simplifies wallet management for developers. Unlike traditional wallet solutions that require complex key management, TEE Express handles all key management internally, providing a streamlined API for wallet operations. TEE Express leverages secure enclave technology to ensure that private keys never leave the secure environment. All wallet operations, including creation, signing, and key management, are performed within a trusted execution environment (TEE). This provides enterprise-grade security while maintaining the simplicity of a REST API. The service supports Ethereum wallets and provides endpoints for wallet creation, transaction signing, and message signing. All operations are authenticated using JWT tokens passed in the Authorization header, ensuring secure access to user wallets. **Migration Notice:** If you\'re an existing customer, your users\' wallets have been automatically migrated to TEE Express. There\'s no action required on your part - all existing wallets are now accessible through the TEE Express API using the same JWT tokens you currently use for authentication. Simply update your API calls to use the TEE Express endpoints, and pass your existing JWT token in the Authorization header for all requests. **Authentication:** - An API key via the `X-Magic-API-Key` header or a secret key via the `X-Magic-Secret-Key` header. - The OIDC provider ID via the `X-OIDC-Provider-ID` header. - Bearer token in the `Authorization` header. **Data Hashing for Signing:** For personal sign operations, encode your data as base64: ```typescript const message = Buffer.from(data, \'utf-8\').toString(\'base64\'); ``` For signing transaction data or other structured data, provide a keccak256 hash: ```typescript import { MessageTypes, SignTypedDataVersion, TypedDataUtils, TypedDataV1, TypedMessage, typedSignatureHash, } from \'@metamask/eth-sig-util\'; import { resolveProperties, Signature, Transaction, TransactionLike, TransactionRequest } from \'ethers\'; const computeEip712Hash = ( data: TypedMessage<MessageTypes>, version: SignTypedDataVersion.V3 | SignTypedDataVersion.V4, ): string => { const hashBuffer = TypedDataUtils.eip712Hash(data, version); return \'0x\' + hashBuffer.toString(\'hex\'); }; const personalSign = async (data: string) => { const message = Buffer.from(data, \'utf-8\').toString(\'base64\'); const body = { message_base64: message, chain: \'ETH\' }; return await fetch(\'/v1/wallet/personal-sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV1 = async (data: TypedDataV1) => { const rawDataHash = typedSignatureHash(data); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV3 = async (data: TypedMessage<MessageTypes>) => { const rawDataHash = computeEip712Hash(data, SignTypedDataVersion.V3); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV4 = async (data: TypedMessage<MessageTypes>) => { const rawDataHash = computeEip712Hash(data, SignTypedDataVersion.V4); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTransaction = async (tx: TransactionRequest) => { const resolvedTx = await resolveProperties(tx); const txForSigning = { ...resolvedTx }; delete txForSigning.from; const btx = Transaction.from(txForSigning as TransactionLike); const body = { raw_data_hash: btx.unsignedHash, chain: \'ETH\' }; const res = await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); const { r, s, v } = res.json(); btx.signature = Signature.from({ r, s, v }); return btx.serialized; }; ```
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 0.1.0
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
import type { Configuration } from "./configuration";
|
|
13
|
+
import type { RequestArgs } from "./base";
|
|
14
|
+
import type { AxiosInstance, AxiosResponse } from 'axios';
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
* @export
|
|
18
|
+
*/
|
|
19
|
+
export declare const DUMMY_BASE_URL = "https://example.com";
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
* @throws {RequiredError}
|
|
23
|
+
* @export
|
|
24
|
+
*/
|
|
25
|
+
export declare const assertParamExists: (functionName: string, paramName: string, paramValue: unknown) => void;
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
* @export
|
|
29
|
+
*/
|
|
30
|
+
export declare const setApiKeyToObject: (object: any, keyParamName: string, configuration?: Configuration) => Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
*
|
|
33
|
+
* @export
|
|
34
|
+
*/
|
|
35
|
+
export declare const setBasicAuthToObject: (object: any, configuration?: Configuration) => void;
|
|
36
|
+
/**
|
|
37
|
+
*
|
|
38
|
+
* @export
|
|
39
|
+
*/
|
|
40
|
+
export declare const setBearerAuthToObject: (object: any, configuration?: Configuration) => Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
*
|
|
43
|
+
* @export
|
|
44
|
+
*/
|
|
45
|
+
export declare const setOAuthToObject: (object: any, name: string, scopes: string[], configuration?: Configuration) => Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
*
|
|
48
|
+
* @export
|
|
49
|
+
*/
|
|
50
|
+
export declare const setSearchParams: (url: URL, ...objects: any[]) => void;
|
|
51
|
+
/**
|
|
52
|
+
*
|
|
53
|
+
* @export
|
|
54
|
+
*/
|
|
55
|
+
export declare const serializeDataIfNeeded: (value: any, requestOptions: any, configuration?: Configuration) => any;
|
|
56
|
+
/**
|
|
57
|
+
*
|
|
58
|
+
* @export
|
|
59
|
+
*/
|
|
60
|
+
export declare const toPathString: (url: URL) => string;
|
|
61
|
+
/**
|
|
62
|
+
*
|
|
63
|
+
* @export
|
|
64
|
+
*/
|
|
65
|
+
export declare const createRequestFunction: (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) => <T = unknown, R = AxiosResponse<T, any>>(axios?: AxiosInstance, basePath?: string) => Promise<R>;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TEE Express
|
|
3
|
+
* TEE Express is a service that simplifies wallet management for developers. Unlike traditional wallet solutions that require complex key management, TEE Express handles all key management internally, providing a streamlined API for wallet operations. TEE Express leverages secure enclave technology to ensure that private keys never leave the secure environment. All wallet operations, including creation, signing, and key management, are performed within a trusted execution environment (TEE). This provides enterprise-grade security while maintaining the simplicity of a REST API. The service supports Ethereum wallets and provides endpoints for wallet creation, transaction signing, and message signing. All operations are authenticated using JWT tokens passed in the Authorization header, ensuring secure access to user wallets. **Migration Notice:** If you\'re an existing customer, your users\' wallets have been automatically migrated to TEE Express. There\'s no action required on your part - all existing wallets are now accessible through the TEE Express API using the same JWT tokens you currently use for authentication. Simply update your API calls to use the TEE Express endpoints, and pass your existing JWT token in the Authorization header for all requests. **Authentication:** - An API key via the `X-Magic-API-Key` header or a secret key via the `X-Magic-Secret-Key` header. - The OIDC provider ID via the `X-OIDC-Provider-ID` header. - Bearer token in the `Authorization` header. **Data Hashing for Signing:** For personal sign operations, encode your data as base64: ```typescript const message = Buffer.from(data, \'utf-8\').toString(\'base64\'); ``` For signing transaction data or other structured data, provide a keccak256 hash: ```typescript import { MessageTypes, SignTypedDataVersion, TypedDataUtils, TypedDataV1, TypedMessage, typedSignatureHash, } from \'@metamask/eth-sig-util\'; import { resolveProperties, Signature, Transaction, TransactionLike, TransactionRequest } from \'ethers\'; const computeEip712Hash = ( data: TypedMessage<MessageTypes>, version: SignTypedDataVersion.V3 | SignTypedDataVersion.V4, ): string => { const hashBuffer = TypedDataUtils.eip712Hash(data, version); return \'0x\' + hashBuffer.toString(\'hex\'); }; const personalSign = async (data: string) => { const message = Buffer.from(data, \'utf-8\').toString(\'base64\'); const body = { message_base64: message, chain: \'ETH\' }; return await fetch(\'/v1/wallet/personal-sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV1 = async (data: TypedDataV1) => { const rawDataHash = typedSignatureHash(data); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV3 = async (data: TypedMessage<MessageTypes>) => { const rawDataHash = computeEip712Hash(data, SignTypedDataVersion.V3); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV4 = async (data: TypedMessage<MessageTypes>) => { const rawDataHash = computeEip712Hash(data, SignTypedDataVersion.V4); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTransaction = async (tx: TransactionRequest) => { const resolvedTx = await resolveProperties(tx); const txForSigning = { ...resolvedTx }; delete txForSigning.from; const btx = Transaction.from(txForSigning as TransactionLike); const body = { raw_data_hash: btx.unsignedHash, chain: \'ETH\' }; const res = await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); const { r, s, v } = res.json(); btx.signature = Signature.from({ r, s, v }); return btx.serialized; }; ```
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 0.1.0
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
export interface ConfigurationParameters {
|
|
13
|
+
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
|
|
14
|
+
username?: string;
|
|
15
|
+
password?: string;
|
|
16
|
+
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
|
|
17
|
+
basePath?: string;
|
|
18
|
+
baseOptions?: any;
|
|
19
|
+
formDataCtor?: new () => any;
|
|
20
|
+
}
|
|
21
|
+
export declare class Configuration {
|
|
22
|
+
/**
|
|
23
|
+
* parameter for apiKey security
|
|
24
|
+
* @param name security name
|
|
25
|
+
* @memberof Configuration
|
|
26
|
+
*/
|
|
27
|
+
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
|
|
28
|
+
/**
|
|
29
|
+
* parameter for basic security
|
|
30
|
+
*
|
|
31
|
+
* @type {string}
|
|
32
|
+
* @memberof Configuration
|
|
33
|
+
*/
|
|
34
|
+
username?: string;
|
|
35
|
+
/**
|
|
36
|
+
* parameter for basic security
|
|
37
|
+
*
|
|
38
|
+
* @type {string}
|
|
39
|
+
* @memberof Configuration
|
|
40
|
+
*/
|
|
41
|
+
password?: string;
|
|
42
|
+
/**
|
|
43
|
+
* parameter for oauth2 security
|
|
44
|
+
* @param name security name
|
|
45
|
+
* @param scopes oauth2 scope
|
|
46
|
+
* @memberof Configuration
|
|
47
|
+
*/
|
|
48
|
+
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
|
|
49
|
+
/**
|
|
50
|
+
* override base path
|
|
51
|
+
*
|
|
52
|
+
* @type {string}
|
|
53
|
+
* @memberof Configuration
|
|
54
|
+
*/
|
|
55
|
+
basePath?: string;
|
|
56
|
+
/**
|
|
57
|
+
* base options for axios calls
|
|
58
|
+
*
|
|
59
|
+
* @type {any}
|
|
60
|
+
* @memberof Configuration
|
|
61
|
+
*/
|
|
62
|
+
baseOptions?: any;
|
|
63
|
+
/**
|
|
64
|
+
* The FormData constructor that will be used to create multipart form data
|
|
65
|
+
* requests. You can inject this here so that execution environments that
|
|
66
|
+
* do not support the FormData class can still run the generated client.
|
|
67
|
+
*
|
|
68
|
+
* @type {new () => FormData}
|
|
69
|
+
*/
|
|
70
|
+
formDataCtor?: new () => any;
|
|
71
|
+
constructor(param?: ConfigurationParameters);
|
|
72
|
+
/**
|
|
73
|
+
* Check if the given MIME is a JSON MIME.
|
|
74
|
+
* JSON MIME examples:
|
|
75
|
+
* application/json
|
|
76
|
+
* application/json; charset=UTF8
|
|
77
|
+
* APPLICATION/JSON
|
|
78
|
+
* application/vnd.company+json
|
|
79
|
+
* @param mime - MIME (Multipurpose Internet Mail Extensions)
|
|
80
|
+
* @return True if the given MIME is JSON, false otherwise.
|
|
81
|
+
*/
|
|
82
|
+
isJsonMime(mime: string): boolean;
|
|
83
|
+
}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TEE Express
|
|
3
|
+
* TEE Express is a service that simplifies wallet management for developers. Unlike traditional wallet solutions that require complex key management, TEE Express handles all key management internally, providing a streamlined API for wallet operations. TEE Express leverages secure enclave technology to ensure that private keys never leave the secure environment. All wallet operations, including creation, signing, and key management, are performed within a trusted execution environment (TEE). This provides enterprise-grade security while maintaining the simplicity of a REST API. The service supports Ethereum wallets and provides endpoints for wallet creation, transaction signing, and message signing. All operations are authenticated using JWT tokens passed in the Authorization header, ensuring secure access to user wallets. **Migration Notice:** If you\'re an existing customer, your users\' wallets have been automatically migrated to TEE Express. There\'s no action required on your part - all existing wallets are now accessible through the TEE Express API using the same JWT tokens you currently use for authentication. Simply update your API calls to use the TEE Express endpoints, and pass your existing JWT token in the Authorization header for all requests. **Authentication:** - An API key via the `X-Magic-API-Key` header or a secret key via the `X-Magic-Secret-Key` header. - The OIDC provider ID via the `X-OIDC-Provider-ID` header. - Bearer token in the `Authorization` header. **Data Hashing for Signing:** For personal sign operations, encode your data as base64: ```typescript const message = Buffer.from(data, \'utf-8\').toString(\'base64\'); ``` For signing transaction data or other structured data, provide a keccak256 hash: ```typescript import { MessageTypes, SignTypedDataVersion, TypedDataUtils, TypedDataV1, TypedMessage, typedSignatureHash, } from \'@metamask/eth-sig-util\'; import { resolveProperties, Signature, Transaction, TransactionLike, TransactionRequest } from \'ethers\'; const computeEip712Hash = ( data: TypedMessage<MessageTypes>, version: SignTypedDataVersion.V3 | SignTypedDataVersion.V4, ): string => { const hashBuffer = TypedDataUtils.eip712Hash(data, version); return \'0x\' + hashBuffer.toString(\'hex\'); }; const personalSign = async (data: string) => { const message = Buffer.from(data, \'utf-8\').toString(\'base64\'); const body = { message_base64: message, chain: \'ETH\' }; return await fetch(\'/v1/wallet/personal-sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV1 = async (data: TypedDataV1) => { const rawDataHash = typedSignatureHash(data); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV3 = async (data: TypedMessage<MessageTypes>) => { const rawDataHash = computeEip712Hash(data, SignTypedDataVersion.V3); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV4 = async (data: TypedMessage<MessageTypes>) => { const rawDataHash = computeEip712Hash(data, SignTypedDataVersion.V4); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTransaction = async (tx: TransactionRequest) => { const resolvedTx = await resolveProperties(tx); const txForSigning = { ...resolvedTx }; delete txForSigning.from; const btx = Transaction.from(txForSigning as TransactionLike); const body = { raw_data_hash: btx.unsignedHash, chain: \'ETH\' }; const res = await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); const { r, s, v } = res.json(); btx.signature = Signature.from({ r, s, v }); return btx.serialized; }; ```
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 0.1.0
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
import type { Configuration } from '../configuration';
|
|
13
|
+
import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
|
|
14
|
+
import { RequestArgs, BaseAPI } from '../base';
|
|
15
|
+
import { PersonalSignRequest } from '../models';
|
|
16
|
+
import { PersonalSignResponse } from '../models';
|
|
17
|
+
import { SignDataRequest } from '../models';
|
|
18
|
+
import { SignDataResponse } from '../models';
|
|
19
|
+
/**
|
|
20
|
+
* TransactionApi - axios parameter creator
|
|
21
|
+
* @export
|
|
22
|
+
*/
|
|
23
|
+
export declare const TransactionApiAxiosParamCreator: (configuration?: Configuration) => {
|
|
24
|
+
/**
|
|
25
|
+
* Signs a hash of arbitrary data using the wallet\'s private key. **Example cURL:** ```bash curl -X POST \'https://tee.express.magiclabs.com/v1/wallet/sign\' \\ -H \'Content-Type: application/json\' \\ -H \'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjNhYVl5dGR3d2UwMzJzMXIzVElyOSJ9...\' \\ -H \'X-Magic-API-Key: your-magic-api-key\' \\ -H \'X-OIDC-Provider-ID: your-oidc-provider-id\' \\ -d \'{ \"chain\": \"ETH\", \"raw_data_hash\": \"0xabc123def4567890abc123def4567890abc123def4567890abc123def4567890\" }\' ``` **Example Response:** ```json { \"message_hash\": \"0xabc123def4567890abc123def4567890abc123def4567890abc123def4567890\", \"signature\": \"0x8e7d6c5b4a3928172635445566778899aabbccddeeff00112233445566778899\", \"r\": \"0x3d4e5f678901234567890abcdef1234567890abcdef1234567890abcdef1234\", \"s\": \"0x4e5f678901234567890abcdef1234567890abcdef1234567890abcdef123456\", \"v\": \"27\" } ```
|
|
26
|
+
* @summary Sign arbitrary data with the wallet.
|
|
27
|
+
* @param {SignDataRequest} signDataRequest
|
|
28
|
+
* @param {string} [xMagicAPIKey]
|
|
29
|
+
* @param {string} [xMagicSecretKey]
|
|
30
|
+
* @param {string} [xOIDCProviderID]
|
|
31
|
+
* @param {*} [options] Override http request option.
|
|
32
|
+
* @throws {RequiredError}
|
|
33
|
+
*/
|
|
34
|
+
signDataV1WalletSignPost: (signDataRequest: SignDataRequest, xMagicAPIKey?: string, xMagicSecretKey?: string, xOIDCProviderID?: string, options?: AxiosRequestConfig) => Promise<RequestArgs>;
|
|
35
|
+
/**
|
|
36
|
+
* Signs an arbitrary message using the wallet\'s private key. Useful for authentication and off-chain verification. **Example cURL:** ```bash curl -X POST \'https://tee.express.magiclabs.com/v1/wallet/personal-sign\' \\ -H \'Content-Type: application/json\' \\ -H \'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjNhYVl5dGR3d2UwMzJzMXIzVElyOSJ9...\' \\ -H \'X-Magic-API-Key: your-magic-api-key\' \\ -H \'X-OIDC-Provider-ID: your-oidc-provider-id\' \\ -d \'{ \"chain\": \"ETH\", \"message_base64\": \"bm9uZQ==\" }\' ``` **Example Response:** ```json { \"signature\": \"0x0cebb670d8375ac74122b46c44def7e1ce593e80434a3e6557108ae124f8b44f3c5068fc104279fe7f51918cbe4c249d707bc1c0ce2ffb6d201d3cf4e2fdee8d1b\", \"r\": \"0x0cebb670d8375ac74122b46c44def7e1ce593e80434a3e6557108ae124f8b44f\", \"s\": \"0x3c5068fc104279fe7f51918cbe4c249d707bc1c0ce2ffb6d201d3cf4e2fdee8d\", \"v\": \"27\" } ```
|
|
37
|
+
* @summary Sign a message with the wallet.
|
|
38
|
+
* @param {PersonalSignRequest} personalSignRequest
|
|
39
|
+
* @param {string} [xMagicAPIKey]
|
|
40
|
+
* @param {string} [xMagicSecretKey]
|
|
41
|
+
* @param {string} [xOIDCProviderID]
|
|
42
|
+
* @param {*} [options] Override http request option.
|
|
43
|
+
* @throws {RequiredError}
|
|
44
|
+
*/
|
|
45
|
+
signMessageV1WalletPersonalSignPost: (personalSignRequest: PersonalSignRequest, xMagicAPIKey?: string, xMagicSecretKey?: string, xOIDCProviderID?: string, options?: AxiosRequestConfig) => Promise<RequestArgs>;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* TransactionApi - functional programming interface
|
|
49
|
+
* @export
|
|
50
|
+
*/
|
|
51
|
+
export declare const TransactionApiFp: (configuration?: Configuration) => {
|
|
52
|
+
/**
|
|
53
|
+
* Signs a hash of arbitrary data using the wallet\'s private key. **Example cURL:** ```bash curl -X POST \'https://tee.express.magiclabs.com/v1/wallet/sign\' \\ -H \'Content-Type: application/json\' \\ -H \'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjNhYVl5dGR3d2UwMzJzMXIzVElyOSJ9...\' \\ -H \'X-Magic-API-Key: your-magic-api-key\' \\ -H \'X-OIDC-Provider-ID: your-oidc-provider-id\' \\ -d \'{ \"chain\": \"ETH\", \"raw_data_hash\": \"0xabc123def4567890abc123def4567890abc123def4567890abc123def4567890\" }\' ``` **Example Response:** ```json { \"message_hash\": \"0xabc123def4567890abc123def4567890abc123def4567890abc123def4567890\", \"signature\": \"0x8e7d6c5b4a3928172635445566778899aabbccddeeff00112233445566778899\", \"r\": \"0x3d4e5f678901234567890abcdef1234567890abcdef1234567890abcdef1234\", \"s\": \"0x4e5f678901234567890abcdef1234567890abcdef1234567890abcdef123456\", \"v\": \"27\" } ```
|
|
54
|
+
* @summary Sign arbitrary data with the wallet.
|
|
55
|
+
* @param {SignDataRequest} signDataRequest
|
|
56
|
+
* @param {string} [xMagicAPIKey]
|
|
57
|
+
* @param {string} [xMagicSecretKey]
|
|
58
|
+
* @param {string} [xOIDCProviderID]
|
|
59
|
+
* @param {*} [options] Override http request option.
|
|
60
|
+
* @throws {RequiredError}
|
|
61
|
+
*/
|
|
62
|
+
signDataV1WalletSignPost(signDataRequest: SignDataRequest, xMagicAPIKey?: string, xMagicSecretKey?: string, xOIDCProviderID?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<SignDataResponse>>;
|
|
63
|
+
/**
|
|
64
|
+
* Signs an arbitrary message using the wallet\'s private key. Useful for authentication and off-chain verification. **Example cURL:** ```bash curl -X POST \'https://tee.express.magiclabs.com/v1/wallet/personal-sign\' \\ -H \'Content-Type: application/json\' \\ -H \'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjNhYVl5dGR3d2UwMzJzMXIzVElyOSJ9...\' \\ -H \'X-Magic-API-Key: your-magic-api-key\' \\ -H \'X-OIDC-Provider-ID: your-oidc-provider-id\' \\ -d \'{ \"chain\": \"ETH\", \"message_base64\": \"bm9uZQ==\" }\' ``` **Example Response:** ```json { \"signature\": \"0x0cebb670d8375ac74122b46c44def7e1ce593e80434a3e6557108ae124f8b44f3c5068fc104279fe7f51918cbe4c249d707bc1c0ce2ffb6d201d3cf4e2fdee8d1b\", \"r\": \"0x0cebb670d8375ac74122b46c44def7e1ce593e80434a3e6557108ae124f8b44f\", \"s\": \"0x3c5068fc104279fe7f51918cbe4c249d707bc1c0ce2ffb6d201d3cf4e2fdee8d\", \"v\": \"27\" } ```
|
|
65
|
+
* @summary Sign a message with the wallet.
|
|
66
|
+
* @param {PersonalSignRequest} personalSignRequest
|
|
67
|
+
* @param {string} [xMagicAPIKey]
|
|
68
|
+
* @param {string} [xMagicSecretKey]
|
|
69
|
+
* @param {string} [xOIDCProviderID]
|
|
70
|
+
* @param {*} [options] Override http request option.
|
|
71
|
+
* @throws {RequiredError}
|
|
72
|
+
*/
|
|
73
|
+
signMessageV1WalletPersonalSignPost(personalSignRequest: PersonalSignRequest, xMagicAPIKey?: string, xMagicSecretKey?: string, xOIDCProviderID?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<PersonalSignResponse>>;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* TransactionApi - factory interface
|
|
77
|
+
* @export
|
|
78
|
+
*/
|
|
79
|
+
export declare const TransactionApiFactory: (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) => {
|
|
80
|
+
/**
|
|
81
|
+
* Signs a hash of arbitrary data using the wallet\'s private key. **Example cURL:** ```bash curl -X POST \'https://tee.express.magiclabs.com/v1/wallet/sign\' \\ -H \'Content-Type: application/json\' \\ -H \'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjNhYVl5dGR3d2UwMzJzMXIzVElyOSJ9...\' \\ -H \'X-Magic-API-Key: your-magic-api-key\' \\ -H \'X-OIDC-Provider-ID: your-oidc-provider-id\' \\ -d \'{ \"chain\": \"ETH\", \"raw_data_hash\": \"0xabc123def4567890abc123def4567890abc123def4567890abc123def4567890\" }\' ``` **Example Response:** ```json { \"message_hash\": \"0xabc123def4567890abc123def4567890abc123def4567890abc123def4567890\", \"signature\": \"0x8e7d6c5b4a3928172635445566778899aabbccddeeff00112233445566778899\", \"r\": \"0x3d4e5f678901234567890abcdef1234567890abcdef1234567890abcdef1234\", \"s\": \"0x4e5f678901234567890abcdef1234567890abcdef1234567890abcdef123456\", \"v\": \"27\" } ```
|
|
82
|
+
* @summary Sign arbitrary data with the wallet.
|
|
83
|
+
* @param {TransactionApiSignDataV1WalletSignPostRequest} requestParameters Request parameters.
|
|
84
|
+
* @param {*} [options] Override http request option.
|
|
85
|
+
* @throws {RequiredError}
|
|
86
|
+
*/
|
|
87
|
+
signDataV1WalletSignPost(requestParameters: TransactionApiSignDataV1WalletSignPostRequest, options?: AxiosRequestConfig): AxiosPromise<SignDataResponse>;
|
|
88
|
+
/**
|
|
89
|
+
* Signs an arbitrary message using the wallet\'s private key. Useful for authentication and off-chain verification. **Example cURL:** ```bash curl -X POST \'https://tee.express.magiclabs.com/v1/wallet/personal-sign\' \\ -H \'Content-Type: application/json\' \\ -H \'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjNhYVl5dGR3d2UwMzJzMXIzVElyOSJ9...\' \\ -H \'X-Magic-API-Key: your-magic-api-key\' \\ -H \'X-OIDC-Provider-ID: your-oidc-provider-id\' \\ -d \'{ \"chain\": \"ETH\", \"message_base64\": \"bm9uZQ==\" }\' ``` **Example Response:** ```json { \"signature\": \"0x0cebb670d8375ac74122b46c44def7e1ce593e80434a3e6557108ae124f8b44f3c5068fc104279fe7f51918cbe4c249d707bc1c0ce2ffb6d201d3cf4e2fdee8d1b\", \"r\": \"0x0cebb670d8375ac74122b46c44def7e1ce593e80434a3e6557108ae124f8b44f\", \"s\": \"0x3c5068fc104279fe7f51918cbe4c249d707bc1c0ce2ffb6d201d3cf4e2fdee8d\", \"v\": \"27\" } ```
|
|
90
|
+
* @summary Sign a message with the wallet.
|
|
91
|
+
* @param {TransactionApiSignMessageV1WalletPersonalSignPostRequest} requestParameters Request parameters.
|
|
92
|
+
* @param {*} [options] Override http request option.
|
|
93
|
+
* @throws {RequiredError}
|
|
94
|
+
*/
|
|
95
|
+
signMessageV1WalletPersonalSignPost(requestParameters: TransactionApiSignMessageV1WalletPersonalSignPostRequest, options?: AxiosRequestConfig): AxiosPromise<PersonalSignResponse>;
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Request parameters for signDataV1WalletSignPost operation in TransactionApi.
|
|
99
|
+
* @export
|
|
100
|
+
* @interface TransactionApiSignDataV1WalletSignPostRequest
|
|
101
|
+
*/
|
|
102
|
+
export interface TransactionApiSignDataV1WalletSignPostRequest {
|
|
103
|
+
/**
|
|
104
|
+
*
|
|
105
|
+
* @type {SignDataRequest}
|
|
106
|
+
* @memberof TransactionApiSignDataV1WalletSignPost
|
|
107
|
+
*/
|
|
108
|
+
readonly signDataRequest: SignDataRequest;
|
|
109
|
+
/**
|
|
110
|
+
*
|
|
111
|
+
* @type {string}
|
|
112
|
+
* @memberof TransactionApiSignDataV1WalletSignPost
|
|
113
|
+
*/
|
|
114
|
+
readonly xMagicAPIKey?: string;
|
|
115
|
+
/**
|
|
116
|
+
*
|
|
117
|
+
* @type {string}
|
|
118
|
+
* @memberof TransactionApiSignDataV1WalletSignPost
|
|
119
|
+
*/
|
|
120
|
+
readonly xMagicSecretKey?: string;
|
|
121
|
+
/**
|
|
122
|
+
*
|
|
123
|
+
* @type {string}
|
|
124
|
+
* @memberof TransactionApiSignDataV1WalletSignPost
|
|
125
|
+
*/
|
|
126
|
+
readonly xOIDCProviderID?: string;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Request parameters for signMessageV1WalletPersonalSignPost operation in TransactionApi.
|
|
130
|
+
* @export
|
|
131
|
+
* @interface TransactionApiSignMessageV1WalletPersonalSignPostRequest
|
|
132
|
+
*/
|
|
133
|
+
export interface TransactionApiSignMessageV1WalletPersonalSignPostRequest {
|
|
134
|
+
/**
|
|
135
|
+
*
|
|
136
|
+
* @type {PersonalSignRequest}
|
|
137
|
+
* @memberof TransactionApiSignMessageV1WalletPersonalSignPost
|
|
138
|
+
*/
|
|
139
|
+
readonly personalSignRequest: PersonalSignRequest;
|
|
140
|
+
/**
|
|
141
|
+
*
|
|
142
|
+
* @type {string}
|
|
143
|
+
* @memberof TransactionApiSignMessageV1WalletPersonalSignPost
|
|
144
|
+
*/
|
|
145
|
+
readonly xMagicAPIKey?: string;
|
|
146
|
+
/**
|
|
147
|
+
*
|
|
148
|
+
* @type {string}
|
|
149
|
+
* @memberof TransactionApiSignMessageV1WalletPersonalSignPost
|
|
150
|
+
*/
|
|
151
|
+
readonly xMagicSecretKey?: string;
|
|
152
|
+
/**
|
|
153
|
+
*
|
|
154
|
+
* @type {string}
|
|
155
|
+
* @memberof TransactionApiSignMessageV1WalletPersonalSignPost
|
|
156
|
+
*/
|
|
157
|
+
readonly xOIDCProviderID?: string;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* TransactionApi - object-oriented interface
|
|
161
|
+
* @export
|
|
162
|
+
* @class TransactionApi
|
|
163
|
+
* @extends {BaseAPI}
|
|
164
|
+
*/
|
|
165
|
+
export declare class TransactionApi extends BaseAPI {
|
|
166
|
+
/**
|
|
167
|
+
* Signs a hash of arbitrary data using the wallet\'s private key. **Example cURL:** ```bash curl -X POST \'https://tee.express.magiclabs.com/v1/wallet/sign\' \\ -H \'Content-Type: application/json\' \\ -H \'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjNhYVl5dGR3d2UwMzJzMXIzVElyOSJ9...\' \\ -H \'X-Magic-API-Key: your-magic-api-key\' \\ -H \'X-OIDC-Provider-ID: your-oidc-provider-id\' \\ -d \'{ \"chain\": \"ETH\", \"raw_data_hash\": \"0xabc123def4567890abc123def4567890abc123def4567890abc123def4567890\" }\' ``` **Example Response:** ```json { \"message_hash\": \"0xabc123def4567890abc123def4567890abc123def4567890abc123def4567890\", \"signature\": \"0x8e7d6c5b4a3928172635445566778899aabbccddeeff00112233445566778899\", \"r\": \"0x3d4e5f678901234567890abcdef1234567890abcdef1234567890abcdef1234\", \"s\": \"0x4e5f678901234567890abcdef1234567890abcdef1234567890abcdef123456\", \"v\": \"27\" } ```
|
|
168
|
+
* @summary Sign arbitrary data with the wallet.
|
|
169
|
+
* @param {TransactionApiSignDataV1WalletSignPostRequest} requestParameters Request parameters.
|
|
170
|
+
* @param {*} [options] Override http request option.
|
|
171
|
+
* @throws {RequiredError}
|
|
172
|
+
* @memberof TransactionApi
|
|
173
|
+
*/
|
|
174
|
+
signDataV1WalletSignPost(requestParameters: TransactionApiSignDataV1WalletSignPostRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<SignDataResponse, any>>;
|
|
175
|
+
/**
|
|
176
|
+
* Signs an arbitrary message using the wallet\'s private key. Useful for authentication and off-chain verification. **Example cURL:** ```bash curl -X POST \'https://tee.express.magiclabs.com/v1/wallet/personal-sign\' \\ -H \'Content-Type: application/json\' \\ -H \'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjNhYVl5dGR3d2UwMzJzMXIzVElyOSJ9...\' \\ -H \'X-Magic-API-Key: your-magic-api-key\' \\ -H \'X-OIDC-Provider-ID: your-oidc-provider-id\' \\ -d \'{ \"chain\": \"ETH\", \"message_base64\": \"bm9uZQ==\" }\' ``` **Example Response:** ```json { \"signature\": \"0x0cebb670d8375ac74122b46c44def7e1ce593e80434a3e6557108ae124f8b44f3c5068fc104279fe7f51918cbe4c249d707bc1c0ce2ffb6d201d3cf4e2fdee8d1b\", \"r\": \"0x0cebb670d8375ac74122b46c44def7e1ce593e80434a3e6557108ae124f8b44f\", \"s\": \"0x3c5068fc104279fe7f51918cbe4c249d707bc1c0ce2ffb6d201d3cf4e2fdee8d\", \"v\": \"27\" } ```
|
|
177
|
+
* @summary Sign a message with the wallet.
|
|
178
|
+
* @param {TransactionApiSignMessageV1WalletPersonalSignPostRequest} requestParameters Request parameters.
|
|
179
|
+
* @param {*} [options] Override http request option.
|
|
180
|
+
* @throws {RequiredError}
|
|
181
|
+
* @memberof TransactionApi
|
|
182
|
+
*/
|
|
183
|
+
signMessageV1WalletPersonalSignPost(requestParameters: TransactionApiSignMessageV1WalletPersonalSignPostRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<PersonalSignResponse, any>>;
|
|
184
|
+
}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TEE Express
|
|
3
|
+
* TEE Express is a service that simplifies wallet management for developers. Unlike traditional wallet solutions that require complex key management, TEE Express handles all key management internally, providing a streamlined API for wallet operations. TEE Express leverages secure enclave technology to ensure that private keys never leave the secure environment. All wallet operations, including creation, signing, and key management, are performed within a trusted execution environment (TEE). This provides enterprise-grade security while maintaining the simplicity of a REST API. The service supports Ethereum wallets and provides endpoints for wallet creation, transaction signing, and message signing. All operations are authenticated using JWT tokens passed in the Authorization header, ensuring secure access to user wallets. **Migration Notice:** If you\'re an existing customer, your users\' wallets have been automatically migrated to TEE Express. There\'s no action required on your part - all existing wallets are now accessible through the TEE Express API using the same JWT tokens you currently use for authentication. Simply update your API calls to use the TEE Express endpoints, and pass your existing JWT token in the Authorization header for all requests. **Authentication:** - An API key via the `X-Magic-API-Key` header or a secret key via the `X-Magic-Secret-Key` header. - The OIDC provider ID via the `X-OIDC-Provider-ID` header. - Bearer token in the `Authorization` header. **Data Hashing for Signing:** For personal sign operations, encode your data as base64: ```typescript const message = Buffer.from(data, \'utf-8\').toString(\'base64\'); ``` For signing transaction data or other structured data, provide a keccak256 hash: ```typescript import { MessageTypes, SignTypedDataVersion, TypedDataUtils, TypedDataV1, TypedMessage, typedSignatureHash, } from \'@metamask/eth-sig-util\'; import { resolveProperties, Signature, Transaction, TransactionLike, TransactionRequest } from \'ethers\'; const computeEip712Hash = ( data: TypedMessage<MessageTypes>, version: SignTypedDataVersion.V3 | SignTypedDataVersion.V4, ): string => { const hashBuffer = TypedDataUtils.eip712Hash(data, version); return \'0x\' + hashBuffer.toString(\'hex\'); }; const personalSign = async (data: string) => { const message = Buffer.from(data, \'utf-8\').toString(\'base64\'); const body = { message_base64: message, chain: \'ETH\' }; return await fetch(\'/v1/wallet/personal-sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV1 = async (data: TypedDataV1) => { const rawDataHash = typedSignatureHash(data); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV3 = async (data: TypedMessage<MessageTypes>) => { const rawDataHash = computeEip712Hash(data, SignTypedDataVersion.V3); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTypedDataV4 = async (data: TypedMessage<MessageTypes>) => { const rawDataHash = computeEip712Hash(data, SignTypedDataVersion.V4); const body = { raw_data_hash: rawDataHash, chain: \'ETH\' }; return await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); }; const signTransaction = async (tx: TransactionRequest) => { const resolvedTx = await resolveProperties(tx); const txForSigning = { ...resolvedTx }; delete txForSigning.from; const btx = Transaction.from(txForSigning as TransactionLike); const body = { raw_data_hash: btx.unsignedHash, chain: \'ETH\' }; const res = await fetch(\'/v1/wallet/sign\', { method: \'POST\', body: JSON.stringify(body) }); const { r, s, v } = res.json(); btx.signature = Signature.from({ r, s, v }); return btx.serialized; }; ```
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 0.1.0
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
import type { Configuration } from '../configuration';
|
|
13
|
+
import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
|
|
14
|
+
import { RequestArgs, BaseAPI } from '../base';
|
|
15
|
+
import { Chain } from '../models';
|
|
16
|
+
import { CreateWalletRequestModel } from '../models';
|
|
17
|
+
import { WalletResponseModel } from '../models';
|
|
18
|
+
/**
|
|
19
|
+
* WalletApi - axios parameter creator
|
|
20
|
+
* @export
|
|
21
|
+
*/
|
|
22
|
+
export declare const WalletApiAxiosParamCreator: (configuration?: Configuration) => {
|
|
23
|
+
/**
|
|
24
|
+
* Creates a new wallet for the given chain and returns its public address. **Example cURL:** ```bash curl -X POST \'https://tee.express.magiclabs.com/v1/wallet\' \\ -H \'Content-Type: application/json\' \\ -H \'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjNhYVl5dGR3d2UwMzJzMXIzVElyOSJ9...\' \\ -H \'X-Magic-API-Key: your-magic-api-key\' \\ -H \'X-OIDC-Provider-ID: your-oidc-provider-id\' \\ -d \'{ \"chain\": \"ETH\" }\' ``` **Example Response:** ```json { \"public_address\": \"0x6b422EefBFBc47a6900A1fc5454Ef4b940B7e36e\" } ```
|
|
25
|
+
* @summary Create a new wallet.
|
|
26
|
+
* @param {CreateWalletRequestModel} createWalletRequestModel
|
|
27
|
+
* @param {string} [xMagicAPIKey]
|
|
28
|
+
* @param {string} [xMagicSecretKey]
|
|
29
|
+
* @param {string} [xOIDCProviderID]
|
|
30
|
+
* @param {*} [options] Override http request option.
|
|
31
|
+
* @throws {RequiredError}
|
|
32
|
+
*/
|
|
33
|
+
createWalletV1WalletPost: (createWalletRequestModel: CreateWalletRequestModel, xMagicAPIKey?: string, xMagicSecretKey?: string, xOIDCProviderID?: string, options?: AxiosRequestConfig) => Promise<RequestArgs>;
|
|
34
|
+
/**
|
|
35
|
+
* Returns the wallet\'s public address for the given chain. **Example cURL:** ```bash curl -X GET \'https://tee.express.magiclabs.com/v1/wallet?chain=ETH\' \\ -H \'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjNhYVl5dGR3d2UwMzJzMXIzVElyOSJ9...\' \\ -H \'X-Magic-API-Key: your-magic-api-key\' \\ -H \'X-OIDC-Provider-ID: your-oidc-provider-id\' ``` **Example Response:** ```json { \"public_address\": \"0x6b422EefBFBc47a6900A1fc5454Ef4b940B7e36e\" } ```
|
|
36
|
+
* @summary Get wallet details.
|
|
37
|
+
* @param {Chain} chain
|
|
38
|
+
* @param {string} [xMagicAPIKey]
|
|
39
|
+
* @param {string} [xMagicSecretKey]
|
|
40
|
+
* @param {string} [xOIDCProviderID]
|
|
41
|
+
* @param {*} [options] Override http request option.
|
|
42
|
+
* @throws {RequiredError}
|
|
43
|
+
*/
|
|
44
|
+
getWalletV1WalletGet: (chain: Chain, xMagicAPIKey?: string, xMagicSecretKey?: string, xOIDCProviderID?: string, options?: AxiosRequestConfig) => Promise<RequestArgs>;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* WalletApi - functional programming interface
|
|
48
|
+
* @export
|
|
49
|
+
*/
|
|
50
|
+
export declare const WalletApiFp: (configuration?: Configuration) => {
|
|
51
|
+
/**
|
|
52
|
+
* Creates a new wallet for the given chain and returns its public address. **Example cURL:** ```bash curl -X POST \'https://tee.express.magiclabs.com/v1/wallet\' \\ -H \'Content-Type: application/json\' \\ -H \'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjNhYVl5dGR3d2UwMzJzMXIzVElyOSJ9...\' \\ -H \'X-Magic-API-Key: your-magic-api-key\' \\ -H \'X-OIDC-Provider-ID: your-oidc-provider-id\' \\ -d \'{ \"chain\": \"ETH\" }\' ``` **Example Response:** ```json { \"public_address\": \"0x6b422EefBFBc47a6900A1fc5454Ef4b940B7e36e\" } ```
|
|
53
|
+
* @summary Create a new wallet.
|
|
54
|
+
* @param {CreateWalletRequestModel} createWalletRequestModel
|
|
55
|
+
* @param {string} [xMagicAPIKey]
|
|
56
|
+
* @param {string} [xMagicSecretKey]
|
|
57
|
+
* @param {string} [xOIDCProviderID]
|
|
58
|
+
* @param {*} [options] Override http request option.
|
|
59
|
+
* @throws {RequiredError}
|
|
60
|
+
*/
|
|
61
|
+
createWalletV1WalletPost(createWalletRequestModel: CreateWalletRequestModel, xMagicAPIKey?: string, xMagicSecretKey?: string, xOIDCProviderID?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<WalletResponseModel>>;
|
|
62
|
+
/**
|
|
63
|
+
* Returns the wallet\'s public address for the given chain. **Example cURL:** ```bash curl -X GET \'https://tee.express.magiclabs.com/v1/wallet?chain=ETH\' \\ -H \'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjNhYVl5dGR3d2UwMzJzMXIzVElyOSJ9...\' \\ -H \'X-Magic-API-Key: your-magic-api-key\' \\ -H \'X-OIDC-Provider-ID: your-oidc-provider-id\' ``` **Example Response:** ```json { \"public_address\": \"0x6b422EefBFBc47a6900A1fc5454Ef4b940B7e36e\" } ```
|
|
64
|
+
* @summary Get wallet details.
|
|
65
|
+
* @param {Chain} chain
|
|
66
|
+
* @param {string} [xMagicAPIKey]
|
|
67
|
+
* @param {string} [xMagicSecretKey]
|
|
68
|
+
* @param {string} [xOIDCProviderID]
|
|
69
|
+
* @param {*} [options] Override http request option.
|
|
70
|
+
* @throws {RequiredError}
|
|
71
|
+
*/
|
|
72
|
+
getWalletV1WalletGet(chain: Chain, xMagicAPIKey?: string, xMagicSecretKey?: string, xOIDCProviderID?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<WalletResponseModel>>;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* WalletApi - factory interface
|
|
76
|
+
* @export
|
|
77
|
+
*/
|
|
78
|
+
export declare const WalletApiFactory: (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) => {
|
|
79
|
+
/**
|
|
80
|
+
* Creates a new wallet for the given chain and returns its public address. **Example cURL:** ```bash curl -X POST \'https://tee.express.magiclabs.com/v1/wallet\' \\ -H \'Content-Type: application/json\' \\ -H \'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjNhYVl5dGR3d2UwMzJzMXIzVElyOSJ9...\' \\ -H \'X-Magic-API-Key: your-magic-api-key\' \\ -H \'X-OIDC-Provider-ID: your-oidc-provider-id\' \\ -d \'{ \"chain\": \"ETH\" }\' ``` **Example Response:** ```json { \"public_address\": \"0x6b422EefBFBc47a6900A1fc5454Ef4b940B7e36e\" } ```
|
|
81
|
+
* @summary Create a new wallet.
|
|
82
|
+
* @param {WalletApiCreateWalletV1WalletPostRequest} requestParameters Request parameters.
|
|
83
|
+
* @param {*} [options] Override http request option.
|
|
84
|
+
* @throws {RequiredError}
|
|
85
|
+
*/
|
|
86
|
+
createWalletV1WalletPost(requestParameters: WalletApiCreateWalletV1WalletPostRequest, options?: AxiosRequestConfig): AxiosPromise<WalletResponseModel>;
|
|
87
|
+
/**
|
|
88
|
+
* Returns the wallet\'s public address for the given chain. **Example cURL:** ```bash curl -X GET \'https://tee.express.magiclabs.com/v1/wallet?chain=ETH\' \\ -H \'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjNhYVl5dGR3d2UwMzJzMXIzVElyOSJ9...\' \\ -H \'X-Magic-API-Key: your-magic-api-key\' \\ -H \'X-OIDC-Provider-ID: your-oidc-provider-id\' ``` **Example Response:** ```json { \"public_address\": \"0x6b422EefBFBc47a6900A1fc5454Ef4b940B7e36e\" } ```
|
|
89
|
+
* @summary Get wallet details.
|
|
90
|
+
* @param {WalletApiGetWalletV1WalletGetRequest} requestParameters Request parameters.
|
|
91
|
+
* @param {*} [options] Override http request option.
|
|
92
|
+
* @throws {RequiredError}
|
|
93
|
+
*/
|
|
94
|
+
getWalletV1WalletGet(requestParameters: WalletApiGetWalletV1WalletGetRequest, options?: AxiosRequestConfig): AxiosPromise<WalletResponseModel>;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Request parameters for createWalletV1WalletPost operation in WalletApi.
|
|
98
|
+
* @export
|
|
99
|
+
* @interface WalletApiCreateWalletV1WalletPostRequest
|
|
100
|
+
*/
|
|
101
|
+
export interface WalletApiCreateWalletV1WalletPostRequest {
|
|
102
|
+
/**
|
|
103
|
+
*
|
|
104
|
+
* @type {CreateWalletRequestModel}
|
|
105
|
+
* @memberof WalletApiCreateWalletV1WalletPost
|
|
106
|
+
*/
|
|
107
|
+
readonly createWalletRequestModel: CreateWalletRequestModel;
|
|
108
|
+
/**
|
|
109
|
+
*
|
|
110
|
+
* @type {string}
|
|
111
|
+
* @memberof WalletApiCreateWalletV1WalletPost
|
|
112
|
+
*/
|
|
113
|
+
readonly xMagicAPIKey?: string;
|
|
114
|
+
/**
|
|
115
|
+
*
|
|
116
|
+
* @type {string}
|
|
117
|
+
* @memberof WalletApiCreateWalletV1WalletPost
|
|
118
|
+
*/
|
|
119
|
+
readonly xMagicSecretKey?: string;
|
|
120
|
+
/**
|
|
121
|
+
*
|
|
122
|
+
* @type {string}
|
|
123
|
+
* @memberof WalletApiCreateWalletV1WalletPost
|
|
124
|
+
*/
|
|
125
|
+
readonly xOIDCProviderID?: string;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Request parameters for getWalletV1WalletGet operation in WalletApi.
|
|
129
|
+
* @export
|
|
130
|
+
* @interface WalletApiGetWalletV1WalletGetRequest
|
|
131
|
+
*/
|
|
132
|
+
export interface WalletApiGetWalletV1WalletGetRequest {
|
|
133
|
+
/**
|
|
134
|
+
*
|
|
135
|
+
* @type {Chain}
|
|
136
|
+
* @memberof WalletApiGetWalletV1WalletGet
|
|
137
|
+
*/
|
|
138
|
+
readonly chain: Chain;
|
|
139
|
+
/**
|
|
140
|
+
*
|
|
141
|
+
* @type {string}
|
|
142
|
+
* @memberof WalletApiGetWalletV1WalletGet
|
|
143
|
+
*/
|
|
144
|
+
readonly xMagicAPIKey?: string;
|
|
145
|
+
/**
|
|
146
|
+
*
|
|
147
|
+
* @type {string}
|
|
148
|
+
* @memberof WalletApiGetWalletV1WalletGet
|
|
149
|
+
*/
|
|
150
|
+
readonly xMagicSecretKey?: string;
|
|
151
|
+
/**
|
|
152
|
+
*
|
|
153
|
+
* @type {string}
|
|
154
|
+
* @memberof WalletApiGetWalletV1WalletGet
|
|
155
|
+
*/
|
|
156
|
+
readonly xOIDCProviderID?: string;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* WalletApi - object-oriented interface
|
|
160
|
+
* @export
|
|
161
|
+
* @class WalletApi
|
|
162
|
+
* @extends {BaseAPI}
|
|
163
|
+
*/
|
|
164
|
+
export declare class WalletApi extends BaseAPI {
|
|
165
|
+
/**
|
|
166
|
+
* Creates a new wallet for the given chain and returns its public address. **Example cURL:** ```bash curl -X POST \'https://tee.express.magiclabs.com/v1/wallet\' \\ -H \'Content-Type: application/json\' \\ -H \'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjNhYVl5dGR3d2UwMzJzMXIzVElyOSJ9...\' \\ -H \'X-Magic-API-Key: your-magic-api-key\' \\ -H \'X-OIDC-Provider-ID: your-oidc-provider-id\' \\ -d \'{ \"chain\": \"ETH\" }\' ``` **Example Response:** ```json { \"public_address\": \"0x6b422EefBFBc47a6900A1fc5454Ef4b940B7e36e\" } ```
|
|
167
|
+
* @summary Create a new wallet.
|
|
168
|
+
* @param {WalletApiCreateWalletV1WalletPostRequest} requestParameters Request parameters.
|
|
169
|
+
* @param {*} [options] Override http request option.
|
|
170
|
+
* @throws {RequiredError}
|
|
171
|
+
* @memberof WalletApi
|
|
172
|
+
*/
|
|
173
|
+
createWalletV1WalletPost(requestParameters: WalletApiCreateWalletV1WalletPostRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<WalletResponseModel, any>>;
|
|
174
|
+
/**
|
|
175
|
+
* Returns the wallet\'s public address for the given chain. **Example cURL:** ```bash curl -X GET \'https://tee.express.magiclabs.com/v1/wallet?chain=ETH\' \\ -H \'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjNhYVl5dGR3d2UwMzJzMXIzVElyOSJ9...\' \\ -H \'X-Magic-API-Key: your-magic-api-key\' \\ -H \'X-OIDC-Provider-ID: your-oidc-provider-id\' ``` **Example Response:** ```json { \"public_address\": \"0x6b422EefBFBc47a6900A1fc5454Ef4b940B7e36e\" } ```
|
|
176
|
+
* @summary Get wallet details.
|
|
177
|
+
* @param {WalletApiGetWalletV1WalletGetRequest} requestParameters Request parameters.
|
|
178
|
+
* @param {*} [options] Override http request option.
|
|
179
|
+
* @throws {RequiredError}
|
|
180
|
+
* @memberof WalletApi
|
|
181
|
+
*/
|
|
182
|
+
getWalletV1WalletGet(requestParameters: WalletApiGetWalletV1WalletGetRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<WalletResponseModel, any>>;
|
|
183
|
+
}
|