@thirdweb-dev/service-utils 0.4.2 → 0.4.3-nightly-a91776e1-20230829001530
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-344fbb77.cjs.dev.js → index-6e0ecc5f.cjs.prod.js} +5 -4
- package/dist/{index-a9977faf.cjs.prod.js → index-cd4f96ef.cjs.dev.js} +5 -4
- package/dist/{index-8ed31e63.esm.js → index-ffddf746.esm.js} +5 -4
- 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":[],"mappings":"AAAA,OA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AE,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,GAAG,IAAI,CAAC;I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AQ,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"}
|
@@ -22,12 +22,12 @@ async function fetchKeyMetadataFromApi(clientId, config) {
|
|
22
22
|
}
|
23
23
|
return json;
|
24
24
|
}
|
25
|
-
async function fetchAccountFromApi(jwt, config) {
|
25
|
+
async function fetchAccountFromApi(jwt, config, useWalletAuth) {
|
26
26
|
const {
|
27
27
|
apiUrl,
|
28
28
|
serviceApiKey
|
29
29
|
} = config;
|
30
|
-
const url = `${apiUrl}/v1/account/me`;
|
30
|
+
const url = useWalletAuth ? `${apiUrl}/v1/wallet/me` : `${apiUrl}/v1/account/me`;
|
31
31
|
const response = await fetch(url, {
|
32
32
|
method: "GET",
|
33
33
|
headers: {
|
@@ -208,7 +208,8 @@ async function authorize(authData, serviceConfig, cacheOptions) {
|
|
208
208
|
targetAddress,
|
209
209
|
secretKeyHash,
|
210
210
|
jwt,
|
211
|
-
hashedJWT
|
211
|
+
hashedJWT,
|
212
|
+
useWalletAuth
|
212
213
|
} = authData;
|
213
214
|
const {
|
214
215
|
enforceAuth
|
@@ -253,7 +254,7 @@ async function authorize(authData, serviceConfig, cacheOptions) {
|
|
253
254
|
const {
|
254
255
|
data,
|
255
256
|
error
|
256
|
-
} = await fetchAccountFromApi(jwt, serviceConfig);
|
257
|
+
} = await fetchAccountFromApi(jwt, serviceConfig, useWalletAuth?.toLowerCase() === "true");
|
257
258
|
if (error) {
|
258
259
|
return {
|
259
260
|
authorized: false,
|
@@ -22,12 +22,12 @@ async function fetchKeyMetadataFromApi(clientId, config) {
|
|
22
22
|
}
|
23
23
|
return json;
|
24
24
|
}
|
25
|
-
async function fetchAccountFromApi(jwt, config) {
|
25
|
+
async function fetchAccountFromApi(jwt, config, useWalletAuth) {
|
26
26
|
const {
|
27
27
|
apiUrl,
|
28
28
|
serviceApiKey
|
29
29
|
} = config;
|
30
|
-
const url = `${apiUrl}/v1/account/me`;
|
30
|
+
const url = useWalletAuth ? `${apiUrl}/v1/wallet/me` : `${apiUrl}/v1/account/me`;
|
31
31
|
const response = await fetch(url, {
|
32
32
|
method: "GET",
|
33
33
|
headers: {
|
@@ -208,7 +208,8 @@ async function authorize(authData, serviceConfig, cacheOptions) {
|
|
208
208
|
targetAddress,
|
209
209
|
secretKeyHash,
|
210
210
|
jwt,
|
211
|
-
hashedJWT
|
211
|
+
hashedJWT,
|
212
|
+
useWalletAuth
|
212
213
|
} = authData;
|
213
214
|
const {
|
214
215
|
enforceAuth
|
@@ -253,7 +254,7 @@ async function authorize(authData, serviceConfig, cacheOptions) {
|
|
253
254
|
const {
|
254
255
|
data,
|
255
256
|
error
|
256
|
-
} = await fetchAccountFromApi(jwt, serviceConfig);
|
257
|
+
} = await fetchAccountFromApi(jwt, serviceConfig, useWalletAuth?.toLowerCase() === "true");
|
257
258
|
if (error) {
|
258
259
|
return {
|
259
260
|
authorized: false,
|
@@ -20,12 +20,12 @@ async function fetchKeyMetadataFromApi(clientId, config) {
|
|
20
20
|
}
|
21
21
|
return json;
|
22
22
|
}
|
23
|
-
async function fetchAccountFromApi(jwt, config) {
|
23
|
+
async function fetchAccountFromApi(jwt, config, useWalletAuth) {
|
24
24
|
const {
|
25
25
|
apiUrl,
|
26
26
|
serviceApiKey
|
27
27
|
} = config;
|
28
|
-
const url = `${apiUrl}/v1/account/me`;
|
28
|
+
const url = useWalletAuth ? `${apiUrl}/v1/wallet/me` : `${apiUrl}/v1/account/me`;
|
29
29
|
const response = await fetch(url, {
|
30
30
|
method: "GET",
|
31
31
|
headers: {
|
@@ -206,7 +206,8 @@ async function authorize(authData, serviceConfig, cacheOptions) {
|
|
206
206
|
targetAddress,
|
207
207
|
secretKeyHash,
|
208
208
|
jwt,
|
209
|
-
hashedJWT
|
209
|
+
hashedJWT,
|
210
|
+
useWalletAuth
|
210
211
|
} = authData;
|
211
212
|
const {
|
212
213
|
enforceAuth
|
@@ -251,7 +252,7 @@ async function authorize(authData, serviceConfig, cacheOptions) {
|
|
251
252
|
const {
|
252
253
|
data,
|
253
254
|
error
|
254
|
-
} = await fetchAccountFromApi(jwt, serviceConfig);
|
255
|
+
} = await fetchAccountFromApi(jwt, serviceConfig, useWalletAuth?.toLowerCase() === "true");
|
255
256
|
if (error) {
|
256
257
|
return {
|
257
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