@imtbl/generated-clients 2.9.0-alpha.1 → 2.9.0-alpha.3
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 +1 -1
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.js +1 -1
- package/dist/types/magic-tee/domain/transaction-api.d.ts +184 -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/personal-sign-request.d.ts +31 -0
- package/dist/types/magic-tee/models/personal-sign-response.d.ts +42 -0
- package/package.json +1 -1
|
@@ -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,20 @@
|
|
|
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
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @export
|
|
15
|
+
* @enum {string}
|
|
16
|
+
*/
|
|
17
|
+
export declare const Chain: {
|
|
18
|
+
readonly Eth: "ETH";
|
|
19
|
+
};
|
|
20
|
+
export type Chain = typeof Chain[keyof typeof Chain];
|
|
@@ -0,0 +1,25 @@
|
|
|
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 { Chain } from './chain';
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @export
|
|
16
|
+
* @interface CreateWalletRequestModel
|
|
17
|
+
*/
|
|
18
|
+
export interface CreateWalletRequestModel {
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
* @type {Chain}
|
|
22
|
+
* @memberof CreateWalletRequestModel
|
|
23
|
+
*/
|
|
24
|
+
'chain': Chain;
|
|
25
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
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 { Chain } from './chain';
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @export
|
|
16
|
+
* @interface PersonalSignRequest
|
|
17
|
+
*/
|
|
18
|
+
export interface PersonalSignRequest {
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
* @type {Chain}
|
|
22
|
+
* @memberof PersonalSignRequest
|
|
23
|
+
*/
|
|
24
|
+
'chain': Chain;
|
|
25
|
+
/**
|
|
26
|
+
*
|
|
27
|
+
* @type {string}
|
|
28
|
+
* @memberof PersonalSignRequest
|
|
29
|
+
*/
|
|
30
|
+
'message_base64': string;
|
|
31
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
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
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @export
|
|
15
|
+
* @interface PersonalSignResponse
|
|
16
|
+
*/
|
|
17
|
+
export interface PersonalSignResponse {
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @type {string}
|
|
21
|
+
* @memberof PersonalSignResponse
|
|
22
|
+
*/
|
|
23
|
+
'signature': string;
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
* @type {string}
|
|
27
|
+
* @memberof PersonalSignResponse
|
|
28
|
+
*/
|
|
29
|
+
'r': string;
|
|
30
|
+
/**
|
|
31
|
+
*
|
|
32
|
+
* @type {string}
|
|
33
|
+
* @memberof PersonalSignResponse
|
|
34
|
+
*/
|
|
35
|
+
's': string;
|
|
36
|
+
/**
|
|
37
|
+
*
|
|
38
|
+
* @type {string}
|
|
39
|
+
* @memberof PersonalSignResponse
|
|
40
|
+
*/
|
|
41
|
+
'v': string;
|
|
42
|
+
}
|
package/package.json
CHANGED