@thirdweb-dev/service-utils 0.0.0-dev-ae6f264-20230714181935 → 0.0.0-dev-5a2d8b2-20230714182930
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/{index-ab78c807.cjs.dev.js → index-175beb0e.cjs.prod.js} +3 -8
- package/dist/{index-a4e1d99c.esm.js → index-5476722b.esm.js} +3 -8
- package/dist/{index-e567dd4f.cjs.prod.js → index-c32e136a.cjs.dev.js} +3 -8
- package/node/dist/thirdweb-dev-service-utils-node.cjs.dev.js +1 -1
- package/node/dist/thirdweb-dev-service-utils-node.cjs.prod.js +1 -1
- package/node/dist/thirdweb-dev-service-utils-node.esm.js +1 -1
- 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-c32e136a.cjs.dev.js');
|
6
6
|
var services = require('../../dist/services-a3f36057.cjs.dev.js');
|
7
7
|
|
8
8
|
const DEFAULT_CACHE_TTL_SECONDS = 60;
|
@@ -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-175beb0e.cjs.prod.js');
|
6
6
|
var services = require('../../dist/services-9e185105.cjs.prod.js');
|
7
7
|
|
8
8
|
const DEFAULT_CACHE_TTL_SECONDS = 60;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { a as authorize } from '../../dist/index-
|
1
|
+
import { a as authorize } from '../../dist/index-5476722b.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
|
|
4
4
|
const DEFAULT_CACHE_TTL_SECONDS = 60;
|
@@ -141,14 +141,9 @@ function authorizeService(apiKeyMetadata, serviceConfig, authorizationPayload) {
|
|
141
141
|
// validate service target addresses
|
142
142
|
// the service has to pass in the target address for this to be validated
|
143
143
|
if (authorizationPayload?.targetAddress) {
|
144
|
-
const
|
145
|
-
|
146
|
-
|
147
|
-
authorized: true,
|
148
|
-
apiKeyMeta: apiKeyMetadata
|
149
|
-
};
|
150
|
-
}
|
151
|
-
if (targetAddresses.some(ta => !service.targetAddresses.includes(ta))) {
|
144
|
+
const checkedAddresses = Array.isArray(authorizationPayload.targetAddress) ? authorizationPayload.targetAddress : [authorizationPayload.targetAddress];
|
145
|
+
const allAllowed = service.targetAddresses.includes("*");
|
146
|
+
if (!allAllowed && checkedAddresses.some(ta => !service.targetAddresses.includes(ta))) {
|
152
147
|
return {
|
153
148
|
authorized: false,
|
154
149
|
errorMessage: `The service "${serviceConfig.serviceScope}" target address is not authorized for this key.`,
|
@@ -139,14 +139,9 @@ function authorizeService(apiKeyMetadata, serviceConfig, authorizationPayload) {
|
|
139
139
|
// validate service target addresses
|
140
140
|
// the service has to pass in the target address for this to be validated
|
141
141
|
if (authorizationPayload?.targetAddress) {
|
142
|
-
const
|
143
|
-
|
144
|
-
|
145
|
-
authorized: true,
|
146
|
-
apiKeyMeta: apiKeyMetadata
|
147
|
-
};
|
148
|
-
}
|
149
|
-
if (targetAddresses.some(ta => !service.targetAddresses.includes(ta))) {
|
142
|
+
const checkedAddresses = Array.isArray(authorizationPayload.targetAddress) ? authorizationPayload.targetAddress : [authorizationPayload.targetAddress];
|
143
|
+
const allAllowed = service.targetAddresses.includes("*");
|
144
|
+
if (!allAllowed && checkedAddresses.some(ta => !service.targetAddresses.includes(ta))) {
|
150
145
|
return {
|
151
146
|
authorized: false,
|
152
147
|
errorMessage: `The service "${serviceConfig.serviceScope}" target address is not authorized for this key.`,
|
@@ -141,14 +141,9 @@ function authorizeService(apiKeyMetadata, serviceConfig, authorizationPayload) {
|
|
141
141
|
// validate service target addresses
|
142
142
|
// the service has to pass in the target address for this to be validated
|
143
143
|
if (authorizationPayload?.targetAddress) {
|
144
|
-
const
|
145
|
-
|
146
|
-
|
147
|
-
authorized: true,
|
148
|
-
apiKeyMeta: apiKeyMetadata
|
149
|
-
};
|
150
|
-
}
|
151
|
-
if (targetAddresses.some(ta => !service.targetAddresses.includes(ta))) {
|
144
|
+
const checkedAddresses = Array.isArray(authorizationPayload.targetAddress) ? authorizationPayload.targetAddress : [authorizationPayload.targetAddress];
|
145
|
+
const allAllowed = service.targetAddresses.includes("*");
|
146
|
+
if (!allAllowed && checkedAddresses.some(ta => !service.targetAddresses.includes(ta))) {
|
152
147
|
return {
|
153
148
|
authorized: false,
|
154
149
|
errorMessage: `The service "${serviceConfig.serviceScope}" target address is not authorized for this key.`,
|
@@ -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-c32e136a.cjs.dev.js');
|
7
7
|
var services = require('../../dist/services-a3f36057.cjs.dev.js');
|
8
8
|
|
9
9
|
async function authorizeNode(authInput, serviceConfig) {
|
@@ -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-175beb0e.cjs.prod.js');
|
7
7
|
var services = require('../../dist/services-9e185105.cjs.prod.js');
|
8
8
|
|
9
9
|
async function authorizeNode(authInput, serviceConfig) {
|
@@ -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-5476722b.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) {
|
package/package.json
CHANGED