@thirdweb-dev/service-utils 0.0.0-dev-c57d25b-20230714175527 → 0.0.0-dev-ae6f264-20230714181935

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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var index = require('../../dist/index-8a742d1f.cjs.dev.js');
5
+ var index = require('../../dist/index-ab78c807.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-154acd47.cjs.prod.js');
5
+ var index = require('../../dist/index-e567dd4f.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-7a0eaf1e.esm.js';
1
+ import { a as authorize } from '../../dist/index-a4e1d99c.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;
@@ -140,8 +140,13 @@ function authorizeService(apiKeyMetadata, serviceConfig, authorizationPayload) {
140
140
  // the service has to pass in the target address for this to be validated
141
141
  if (authorizationPayload?.targetAddress) {
142
142
  const targetAddresses = Array.isArray(authorizationPayload.targetAddress) ? authorizationPayload.targetAddress : [authorizationPayload.targetAddress];
143
- const allAllowed = service.targetAddresses.includes("*");
144
- if (!allAllowed && targetAddresses.some(ta => !service.targetAddresses.includes(ta))) {
143
+ if (service.targetAddresses.includes("*")) {
144
+ return {
145
+ authorized: true,
146
+ apiKeyMeta: apiKeyMetadata
147
+ };
148
+ }
149
+ if (targetAddresses.some(ta => !service.targetAddresses.includes(ta))) {
145
150
  return {
146
151
  authorized: false,
147
152
  errorMessage: `The service "${serviceConfig.serviceScope}" target address is not authorized for this key.`,
@@ -142,8 +142,13 @@ function authorizeService(apiKeyMetadata, serviceConfig, authorizationPayload) {
142
142
  // the service has to pass in the target address for this to be validated
143
143
  if (authorizationPayload?.targetAddress) {
144
144
  const targetAddresses = Array.isArray(authorizationPayload.targetAddress) ? authorizationPayload.targetAddress : [authorizationPayload.targetAddress];
145
- const allAllowed = service.targetAddresses.includes("*");
146
- if (!allAllowed && targetAddresses.some(ta => !service.targetAddresses.includes(ta))) {
145
+ if (service.targetAddresses.includes("*")) {
146
+ return {
147
+ authorized: true,
148
+ apiKeyMeta: apiKeyMetadata
149
+ };
150
+ }
151
+ if (targetAddresses.some(ta => !service.targetAddresses.includes(ta))) {
147
152
  return {
148
153
  authorized: false,
149
154
  errorMessage: `The service "${serviceConfig.serviceScope}" target address is not authorized for this key.`,
@@ -142,8 +142,13 @@ function authorizeService(apiKeyMetadata, serviceConfig, authorizationPayload) {
142
142
  // the service has to pass in the target address for this to be validated
143
143
  if (authorizationPayload?.targetAddress) {
144
144
  const targetAddresses = Array.isArray(authorizationPayload.targetAddress) ? authorizationPayload.targetAddress : [authorizationPayload.targetAddress];
145
- const allAllowed = service.targetAddresses.includes("*");
146
- if (!allAllowed && targetAddresses.some(ta => !service.targetAddresses.includes(ta))) {
145
+ if (service.targetAddresses.includes("*")) {
146
+ return {
147
+ authorized: true,
148
+ apiKeyMeta: apiKeyMetadata
149
+ };
150
+ }
151
+ if (targetAddresses.some(ta => !service.targetAddresses.includes(ta))) {
147
152
  return {
148
153
  authorized: false,
149
154
  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-8a742d1f.cjs.dev.js');
6
+ var index = require('../../dist/index-ab78c807.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-154acd47.cjs.prod.js');
6
+ var index = require('../../dist/index-e567dd4f.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-7a0eaf1e.esm.js';
2
+ import { a as authorize } from '../../dist/index-a4e1d99c.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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thirdweb-dev/service-utils",
3
- "version": "0.0.0-dev-c57d25b-20230714175527",
3
+ "version": "0.0.0-dev-ae6f264-20230714181935",
4
4
  "main": "dist/thirdweb-dev-service-utils.cjs.js",
5
5
  "module": "dist/thirdweb-dev-service-utils.esm.js",
6
6
  "exports": {