@thirdweb-dev/service-utils 0.0.0-dev-cdaa524-20230809213020 → 0.0.0-dev-dc0c448-20230821230253
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/cf-worker/dist/thirdweb-dev-service-utils-cf-worker.cjs.dev.js +1 -1
- package/cf-worker/dist/thirdweb-dev-service-utils-cf-worker.cjs.prod.js +1 -1
- package/cf-worker/dist/thirdweb-dev-service-utils-cf-worker.esm.js +1 -1
- package/dist/declarations/src/core/api.d.ts +2 -1
- package/dist/declarations/src/core/api.d.ts.map +1 -1
- package/dist/declarations/src/core/authorize/index.d.ts +1 -0
- package/dist/declarations/src/core/authorize/index.d.ts.map +1 -1
- package/dist/declarations/src/node/index.d.ts.map +1 -1
- package/dist/{index-2a87d4b6.cjs.dev.js → index-6e0ecc5f.cjs.prod.js} +17 -10
- package/dist/{index-3144e58f.cjs.prod.js → index-cd4f96ef.cjs.dev.js} +17 -10
- package/dist/{index-70ede577.esm.js → index-ffddf746.esm.js} +17 -10
- package/node/dist/thirdweb-dev-service-utils-node.cjs.dev.js +9 -2
- package/node/dist/thirdweb-dev-service-utils-node.cjs.prod.js +9 -2
- package/node/dist/thirdweb-dev-service-utils-node.esm.js +9 -2
- package/package.json +1 -1
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
-
var index = require('../../dist/index-
|
5
|
+
var index = require('../../dist/index-cd4f96ef.cjs.dev.js');
|
6
6
|
var services = require('../../dist/services-a3f36057.cjs.dev.js');
|
7
7
|
var aws4fetch = require('aws4fetch');
|
8
8
|
var zod = require('zod');
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
-
var index = require('../../dist/index-
|
5
|
+
var index = require('../../dist/index-6e0ecc5f.cjs.prod.js');
|
6
6
|
var services = require('../../dist/services-9e185105.cjs.prod.js');
|
7
7
|
var aws4fetch = require('aws4fetch');
|
8
8
|
var zod = require('zod');
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { a as authorize } from '../../dist/index-
|
1
|
+
import { a as authorize } from '../../dist/index-ffddf746.esm.js';
|
2
2
|
export { b as SERVICES, S as SERVICE_DEFINITIONS, a as SERVICE_NAMES, g as getServiceByName } from '../../dist/services-86283509.esm.js';
|
3
3
|
import { AwsClient } from 'aws4fetch';
|
4
4
|
import { z } from 'zod';
|
@@ -5,6 +5,7 @@ export type CoreServiceConfig = {
|
|
5
5
|
serviceScope: ServiceName;
|
6
6
|
serviceApiKey: string;
|
7
7
|
serviceAction?: string;
|
8
|
+
useWalletAuth?: boolean;
|
8
9
|
};
|
9
10
|
export type ApiKeyMetadata = {
|
10
11
|
id: string;
|
@@ -43,5 +44,5 @@ export type ApiAccountResponse = {
|
|
43
44
|
};
|
44
45
|
};
|
45
46
|
export declare function fetchKeyMetadataFromApi(clientId: string, config: CoreServiceConfig): Promise<ApiResponse>;
|
46
|
-
export declare function fetchAccountFromApi(jwt: string, config: CoreServiceConfig): Promise<ApiAccountResponse>;
|
47
|
+
export declare function fetchAccountFromApi(jwt: string, config: CoreServiceConfig, useWalletAuth: boolean): Promise<ApiAccountResponse>;
|
47
48
|
//# sourceMappingURL=api.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"../../../../src/core","sources":["api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,MAAM,MAAM,iBAAiB,GAAG;IAC9B,WAAW,EAAE,OAAO,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,WAAW,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"../../../../src/core","sources":["api.ts"],"names":[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C;QACnB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH,CAAC;AAEF,wBAAsB,uBAAuB,CAC3C,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,iBAAiB,GACxB,OAAO,CAAC,WAAW,CAAC,CAiBtB;AAED,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,iBAAiB,EACzB,aAAa,EAAE,OAAO,GACrB,OAAO,CAAC,kBAAkB,CAAC,CAkB7B"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"../../../../../src/core/authorize","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,cAAc,EACd,iBAAiB,EAGlB,MAAM,QAAQ,CAAC;AAGhB,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAE9C,MAAM,MAAM,kBAAkB,GAAG;IAC/B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"../../../../../src/core/authorize","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,cAAc,EACd,iBAAiB,EAGlB,MAAM,QAAQ,CAAC;AAGhB,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAE9C,MAAM,MAAM,kBAAkB,GAAG;IAC/B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,QAAQ,EAAE,MAAM,GA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ACH,GAAG,EACH,QAAQ,EACR,aAAa,GACd,EAAE,SAAS,GAAG;IACb,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,cAAc,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;CAChC,QAsBA"}
|
@@ -14,17 +14,20 @@ async function fetchKeyMetadataFromApi(clientId, config) {
|
|
14
14
|
"content-type": "application/json"
|
15
15
|
}
|
16
16
|
});
|
17
|
-
|
18
|
-
|
17
|
+
let json;
|
18
|
+
try {
|
19
|
+
json = await response.json();
|
20
|
+
} catch (e) {
|
21
|
+
throw new Error(`Error fetching key metadata from API: ${response.status} - ${response.statusText} - ${await response.text()}`);
|
19
22
|
}
|
20
|
-
return
|
23
|
+
return json;
|
21
24
|
}
|
22
|
-
async function fetchAccountFromApi(jwt, config) {
|
25
|
+
async function fetchAccountFromApi(jwt, config, useWalletAuth) {
|
23
26
|
const {
|
24
27
|
apiUrl,
|
25
28
|
serviceApiKey
|
26
29
|
} = config;
|
27
|
-
const url = `${apiUrl}/v1/account/me`;
|
30
|
+
const url = useWalletAuth ? `${apiUrl}/v1/wallet/me` : `${apiUrl}/v1/account/me`;
|
28
31
|
const response = await fetch(url, {
|
29
32
|
method: "GET",
|
30
33
|
headers: {
|
@@ -33,10 +36,13 @@ async function fetchAccountFromApi(jwt, config) {
|
|
33
36
|
authorization: `Bearer ${jwt}`
|
34
37
|
}
|
35
38
|
});
|
36
|
-
|
37
|
-
|
39
|
+
let json;
|
40
|
+
try {
|
41
|
+
json = await response.json();
|
42
|
+
} catch (e) {
|
43
|
+
throw new Error(`Error fetching account from API: ${response.status} - ${response.statusText} - ${await response.text()}`);
|
38
44
|
}
|
39
|
-
return
|
45
|
+
return json;
|
40
46
|
}
|
41
47
|
|
42
48
|
function authorizeClient(authOptions, apiKeyMeta) {
|
@@ -202,7 +208,8 @@ async function authorize(authData, serviceConfig, cacheOptions) {
|
|
202
208
|
targetAddress,
|
203
209
|
secretKeyHash,
|
204
210
|
jwt,
|
205
|
-
hashedJWT
|
211
|
+
hashedJWT,
|
212
|
+
useWalletAuth
|
206
213
|
} = authData;
|
207
214
|
const {
|
208
215
|
enforceAuth
|
@@ -247,7 +254,7 @@ async function authorize(authData, serviceConfig, cacheOptions) {
|
|
247
254
|
const {
|
248
255
|
data,
|
249
256
|
error
|
250
|
-
} = await fetchAccountFromApi(jwt, serviceConfig);
|
257
|
+
} = await fetchAccountFromApi(jwt, serviceConfig, useWalletAuth?.toLowerCase() === "true");
|
251
258
|
if (error) {
|
252
259
|
return {
|
253
260
|
authorized: false,
|
@@ -14,17 +14,20 @@ async function fetchKeyMetadataFromApi(clientId, config) {
|
|
14
14
|
"content-type": "application/json"
|
15
15
|
}
|
16
16
|
});
|
17
|
-
|
18
|
-
|
17
|
+
let json;
|
18
|
+
try {
|
19
|
+
json = await response.json();
|
20
|
+
} catch (e) {
|
21
|
+
throw new Error(`Error fetching key metadata from API: ${response.status} - ${response.statusText} - ${await response.text()}`);
|
19
22
|
}
|
20
|
-
return
|
23
|
+
return json;
|
21
24
|
}
|
22
|
-
async function fetchAccountFromApi(jwt, config) {
|
25
|
+
async function fetchAccountFromApi(jwt, config, useWalletAuth) {
|
23
26
|
const {
|
24
27
|
apiUrl,
|
25
28
|
serviceApiKey
|
26
29
|
} = config;
|
27
|
-
const url = `${apiUrl}/v1/account/me`;
|
30
|
+
const url = useWalletAuth ? `${apiUrl}/v1/wallet/me` : `${apiUrl}/v1/account/me`;
|
28
31
|
const response = await fetch(url, {
|
29
32
|
method: "GET",
|
30
33
|
headers: {
|
@@ -33,10 +36,13 @@ async function fetchAccountFromApi(jwt, config) {
|
|
33
36
|
authorization: `Bearer ${jwt}`
|
34
37
|
}
|
35
38
|
});
|
36
|
-
|
37
|
-
|
39
|
+
let json;
|
40
|
+
try {
|
41
|
+
json = await response.json();
|
42
|
+
} catch (e) {
|
43
|
+
throw new Error(`Error fetching account from API: ${response.status} - ${response.statusText} - ${await response.text()}`);
|
38
44
|
}
|
39
|
-
return
|
45
|
+
return json;
|
40
46
|
}
|
41
47
|
|
42
48
|
function authorizeClient(authOptions, apiKeyMeta) {
|
@@ -202,7 +208,8 @@ async function authorize(authData, serviceConfig, cacheOptions) {
|
|
202
208
|
targetAddress,
|
203
209
|
secretKeyHash,
|
204
210
|
jwt,
|
205
|
-
hashedJWT
|
211
|
+
hashedJWT,
|
212
|
+
useWalletAuth
|
206
213
|
} = authData;
|
207
214
|
const {
|
208
215
|
enforceAuth
|
@@ -247,7 +254,7 @@ async function authorize(authData, serviceConfig, cacheOptions) {
|
|
247
254
|
const {
|
248
255
|
data,
|
249
256
|
error
|
250
|
-
} = await fetchAccountFromApi(jwt, serviceConfig);
|
257
|
+
} = await fetchAccountFromApi(jwt, serviceConfig, useWalletAuth?.toLowerCase() === "true");
|
251
258
|
if (error) {
|
252
259
|
return {
|
253
260
|
authorized: false,
|
@@ -12,17 +12,20 @@ async function fetchKeyMetadataFromApi(clientId, config) {
|
|
12
12
|
"content-type": "application/json"
|
13
13
|
}
|
14
14
|
});
|
15
|
-
|
16
|
-
|
15
|
+
let json;
|
16
|
+
try {
|
17
|
+
json = await response.json();
|
18
|
+
} catch (e) {
|
19
|
+
throw new Error(`Error fetching key metadata from API: ${response.status} - ${response.statusText} - ${await response.text()}`);
|
17
20
|
}
|
18
|
-
return
|
21
|
+
return json;
|
19
22
|
}
|
20
|
-
async function fetchAccountFromApi(jwt, config) {
|
23
|
+
async function fetchAccountFromApi(jwt, config, useWalletAuth) {
|
21
24
|
const {
|
22
25
|
apiUrl,
|
23
26
|
serviceApiKey
|
24
27
|
} = config;
|
25
|
-
const url = `${apiUrl}/v1/account/me`;
|
28
|
+
const url = useWalletAuth ? `${apiUrl}/v1/wallet/me` : `${apiUrl}/v1/account/me`;
|
26
29
|
const response = await fetch(url, {
|
27
30
|
method: "GET",
|
28
31
|
headers: {
|
@@ -31,10 +34,13 @@ async function fetchAccountFromApi(jwt, config) {
|
|
31
34
|
authorization: `Bearer ${jwt}`
|
32
35
|
}
|
33
36
|
});
|
34
|
-
|
35
|
-
|
37
|
+
let json;
|
38
|
+
try {
|
39
|
+
json = await response.json();
|
40
|
+
} catch (e) {
|
41
|
+
throw new Error(`Error fetching account from API: ${response.status} - ${response.statusText} - ${await response.text()}`);
|
36
42
|
}
|
37
|
-
return
|
43
|
+
return json;
|
38
44
|
}
|
39
45
|
|
40
46
|
function authorizeClient(authOptions, apiKeyMeta) {
|
@@ -200,7 +206,8 @@ async function authorize(authData, serviceConfig, cacheOptions) {
|
|
200
206
|
targetAddress,
|
201
207
|
secretKeyHash,
|
202
208
|
jwt,
|
203
|
-
hashedJWT
|
209
|
+
hashedJWT,
|
210
|
+
useWalletAuth
|
204
211
|
} = authData;
|
205
212
|
const {
|
206
213
|
enforceAuth
|
@@ -245,7 +252,7 @@ async function authorize(authData, serviceConfig, cacheOptions) {
|
|
245
252
|
const {
|
246
253
|
data,
|
247
254
|
error
|
248
|
-
} = await fetchAccountFromApi(jwt, serviceConfig);
|
255
|
+
} = await fetchAccountFromApi(jwt, serviceConfig, useWalletAuth?.toLowerCase() === "true");
|
249
256
|
if (error) {
|
250
257
|
return {
|
251
258
|
authorized: false,
|
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
5
|
var node_crypto = require('node:crypto');
|
6
|
-
var index = require('../../dist/index-
|
6
|
+
var index = require('../../dist/index-cd4f96ef.cjs.dev.js');
|
7
7
|
var services = require('../../dist/services-a3f36057.cjs.dev.js');
|
8
8
|
|
9
9
|
async function authorizeNode(authInput, serviceConfig) {
|
@@ -92,12 +92,18 @@ function extractAuthorizationData(authInput) {
|
|
92
92
|
clientId = derivedClientId;
|
93
93
|
}
|
94
94
|
let jwt = null;
|
95
|
+
let useWalletAuth = null;
|
95
96
|
// check for authorization header on the request
|
96
97
|
const authorizationHeader = getHeader(headers, "authorization");
|
97
98
|
if (authorizationHeader) {
|
98
99
|
const [type, token] = authorizationHeader.split(" ");
|
99
100
|
if (type.toLowerCase() === "bearer" && !!token) {
|
100
101
|
jwt = token;
|
102
|
+
const walletAuthHeader = getHeader(headers, "x-authorize-wallet");
|
103
|
+
// IK a stringified boolean is not ideal, but it's required to pass it in the headers.
|
104
|
+
if (walletAuthHeader?.toLowerCase() === "true") {
|
105
|
+
useWalletAuth = walletAuthHeader;
|
106
|
+
}
|
101
107
|
}
|
102
108
|
}
|
103
109
|
return {
|
@@ -108,7 +114,8 @@ function extractAuthorizationData(authInput) {
|
|
108
114
|
clientId,
|
109
115
|
origin,
|
110
116
|
bundleId,
|
111
|
-
targetAddress: authInput.targetAddress
|
117
|
+
targetAddress: authInput.targetAddress,
|
118
|
+
useWalletAuth
|
112
119
|
};
|
113
120
|
}
|
114
121
|
function hashSecretKey(secretKey) {
|
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
5
|
var node_crypto = require('node:crypto');
|
6
|
-
var index = require('../../dist/index-
|
6
|
+
var index = require('../../dist/index-6e0ecc5f.cjs.prod.js');
|
7
7
|
var services = require('../../dist/services-9e185105.cjs.prod.js');
|
8
8
|
|
9
9
|
async function authorizeNode(authInput, serviceConfig) {
|
@@ -92,12 +92,18 @@ function extractAuthorizationData(authInput) {
|
|
92
92
|
clientId = derivedClientId;
|
93
93
|
}
|
94
94
|
let jwt = null;
|
95
|
+
let useWalletAuth = null;
|
95
96
|
// check for authorization header on the request
|
96
97
|
const authorizationHeader = getHeader(headers, "authorization");
|
97
98
|
if (authorizationHeader) {
|
98
99
|
const [type, token] = authorizationHeader.split(" ");
|
99
100
|
if (type.toLowerCase() === "bearer" && !!token) {
|
100
101
|
jwt = token;
|
102
|
+
const walletAuthHeader = getHeader(headers, "x-authorize-wallet");
|
103
|
+
// IK a stringified boolean is not ideal, but it's required to pass it in the headers.
|
104
|
+
if (walletAuthHeader?.toLowerCase() === "true") {
|
105
|
+
useWalletAuth = walletAuthHeader;
|
106
|
+
}
|
101
107
|
}
|
102
108
|
}
|
103
109
|
return {
|
@@ -108,7 +114,8 @@ function extractAuthorizationData(authInput) {
|
|
108
114
|
clientId,
|
109
115
|
origin,
|
110
116
|
bundleId,
|
111
|
-
targetAddress: authInput.targetAddress
|
117
|
+
targetAddress: authInput.targetAddress,
|
118
|
+
useWalletAuth
|
112
119
|
};
|
113
120
|
}
|
114
121
|
function hashSecretKey(secretKey) {
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { createHash } from 'node:crypto';
|
2
|
-
import { a as authorize } from '../../dist/index-
|
2
|
+
import { a as authorize } from '../../dist/index-ffddf746.esm.js';
|
3
3
|
export { b as SERVICES, S as SERVICE_DEFINITIONS, a as SERVICE_NAMES, g as getServiceByName } from '../../dist/services-86283509.esm.js';
|
4
4
|
|
5
5
|
async function authorizeNode(authInput, serviceConfig) {
|
@@ -88,12 +88,18 @@ function extractAuthorizationData(authInput) {
|
|
88
88
|
clientId = derivedClientId;
|
89
89
|
}
|
90
90
|
let jwt = null;
|
91
|
+
let useWalletAuth = null;
|
91
92
|
// check for authorization header on the request
|
92
93
|
const authorizationHeader = getHeader(headers, "authorization");
|
93
94
|
if (authorizationHeader) {
|
94
95
|
const [type, token] = authorizationHeader.split(" ");
|
95
96
|
if (type.toLowerCase() === "bearer" && !!token) {
|
96
97
|
jwt = token;
|
98
|
+
const walletAuthHeader = getHeader(headers, "x-authorize-wallet");
|
99
|
+
// IK a stringified boolean is not ideal, but it's required to pass it in the headers.
|
100
|
+
if (walletAuthHeader?.toLowerCase() === "true") {
|
101
|
+
useWalletAuth = walletAuthHeader;
|
102
|
+
}
|
97
103
|
}
|
98
104
|
}
|
99
105
|
return {
|
@@ -104,7 +110,8 @@ function extractAuthorizationData(authInput) {
|
|
104
110
|
clientId,
|
105
111
|
origin,
|
106
112
|
bundleId,
|
107
|
-
targetAddress: authInput.targetAddress
|
113
|
+
targetAddress: authInput.targetAddress,
|
114
|
+
useWalletAuth
|
108
115
|
};
|
109
116
|
}
|
110
117
|
function hashSecretKey(secretKey) {
|
package/package.json
CHANGED