@thirdweb-dev/service-utils 0.2.1 → 0.2.2-nightly-385895ca-20230725001247

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-6e980870.cjs.dev.js');
5
+ var index = require('../../dist/index-4496b57e.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-96491db6.cjs.prod.js');
5
+ var index = require('../../dist/index-7c6b47cd.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-c332ae71.esm.js';
1
+ import { a as authorize } from '../../dist/index-d752cff8.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;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"../../../../../src/core/authorize","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,iBAAiB,EAElB,kBAAe;AAGhB,OAAO,EAAE,mBAAmB,EAAE,mBAAgB;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,MA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eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AASF,wBAAsB,SAAS,CAC7B,QAAQ,EAAE,kBAAkB,EAC5B,aAAa,EAAE,iBAAiB,EAChC,YAAY,CAAC,EAAE,YAAY,GAC1B,OAAO,CAAC,mBAAmB,CAAC,CAiI9B"}
@@ -35,7 +35,7 @@ function authorizeClient(authOptions, apiKeyMeta) {
35
35
  if (secretHash !== providedSecretHash) {
36
36
  return {
37
37
  authorized: false,
38
- errorMessage: "The secret is invalid.",
38
+ errorMessage: "The secret is invalid. Please check you secret-key",
39
39
  errorCode: "SECRET_INVALID",
40
40
  status: 401
41
41
  };
@@ -72,7 +72,7 @@ function authorizeClient(authOptions, apiKeyMeta) {
72
72
  }
73
73
  return {
74
74
  authorized: false,
75
- errorMessage: "The origin is not authorized for this key.",
75
+ errorMessage: `The domain: ${origin}, is not authorized for this key. Please update your key permissions on the thirdweb dashboard`,
76
76
  errorCode: "ORIGIN_UNAUTHORIZED",
77
77
  status: 401
78
78
  };
@@ -95,14 +95,14 @@ function authorizeClient(authOptions, apiKeyMeta) {
95
95
  }
96
96
  return {
97
97
  authorized: false,
98
- errorMessage: "The bundle is not authorized for this key.",
98
+ errorMessage: `The bundleId: ${bundleId}, is not authorized for this key. Please update your key permissions on the thirdweb dashboard`,
99
99
  errorCode: "BUNDLE_UNAUTHORIZED",
100
100
  status: 401
101
101
  };
102
102
  }
103
103
  return {
104
104
  authorized: false,
105
- errorMessage: "The keys are invalid.",
105
+ errorMessage: "The keys are invalid. Please check the secret-key/clientId and try again.",
106
106
  errorCode: "UNAUTHORIZED",
107
107
  status: 401
108
108
  };
@@ -117,7 +117,7 @@ function authorizeService(apiKeyMetadata, serviceConfig, authorizationPayload) {
117
117
  if (!service) {
118
118
  return {
119
119
  authorized: false,
120
- errorMessage: `The service "${serviceConfig.serviceScope}" is not authorized for this key.`,
120
+ errorMessage: `The service "${serviceConfig.serviceScope}" is not authorized for this key. Please update your key permissions on the thirdweb dashboard.`,
121
121
  errorCode: "SERVICE_UNAUTHORIZED",
122
122
  status: 403
123
123
  };
@@ -129,7 +129,7 @@ function authorizeService(apiKeyMetadata, serviceConfig, authorizationPayload) {
129
129
  if (!isActionAllowed) {
130
130
  return {
131
131
  authorized: false,
132
- errorMessage: `The service "${serviceConfig.serviceScope}" action "${serviceConfig.serviceAction}" is not authorized for this key.`,
132
+ errorMessage: `The service "${serviceConfig.serviceScope}" action "${serviceConfig.serviceAction}" is not authorized for this key. Please update your key permissions on the thirdweb dashboard.`,
133
133
  errorCode: "SERVICE_ACTION_UNAUTHORIZED",
134
134
  status: 403
135
135
  };
@@ -144,7 +144,7 @@ function authorizeService(apiKeyMetadata, serviceConfig, authorizationPayload) {
144
144
  if (!allAllowed && checkedAddresses.some(ta => !service.targetAddresses.includes(ta))) {
145
145
  return {
146
146
  authorized: false,
147
- errorMessage: `The service "${serviceConfig.serviceScope}" target address is not authorized for this key.`,
147
+ errorMessage: `The target address: ${checkedAddresses}, for service "${serviceConfig.serviceScope}" is not authorized for this key. Please update your key permissions on the thirdweb dashboard.`,
148
148
  errorCode: "SERVICE_TARGET_ADDRESS_UNAUTHORIZED",
149
149
  status: 403
150
150
  };
@@ -245,7 +245,7 @@ async function authorize(authData, serviceConfig, cacheOptions) {
245
245
  return {
246
246
  authorized: false,
247
247
  status: 500,
248
- errorMessage: "Failed to fetch key metadata.",
248
+ errorMessage: "Failed to fetch key metadata. Please check your secret-key/clientId.",
249
249
  errorCode: "FAILED_TO_FETCH_KEY"
250
250
  };
251
251
  }
@@ -254,7 +254,7 @@ async function authorize(authData, serviceConfig, cacheOptions) {
254
254
  return {
255
255
  authorized: false,
256
256
  status: 401,
257
- errorMessage: "Key is invalid.",
257
+ errorMessage: "Key is invalid. Please check your secret-key/clientId.",
258
258
  errorCode: "INVALID_KEY"
259
259
  };
260
260
  }
@@ -35,7 +35,7 @@ function authorizeClient(authOptions, apiKeyMeta) {
35
35
  if (secretHash !== providedSecretHash) {
36
36
  return {
37
37
  authorized: false,
38
- errorMessage: "The secret is invalid.",
38
+ errorMessage: "The secret is invalid. Please check you secret-key",
39
39
  errorCode: "SECRET_INVALID",
40
40
  status: 401
41
41
  };
@@ -72,7 +72,7 @@ function authorizeClient(authOptions, apiKeyMeta) {
72
72
  }
73
73
  return {
74
74
  authorized: false,
75
- errorMessage: "The origin is not authorized for this key.",
75
+ errorMessage: `The domain: ${origin}, is not authorized for this key. Please update your key permissions on the thirdweb dashboard`,
76
76
  errorCode: "ORIGIN_UNAUTHORIZED",
77
77
  status: 401
78
78
  };
@@ -95,14 +95,14 @@ function authorizeClient(authOptions, apiKeyMeta) {
95
95
  }
96
96
  return {
97
97
  authorized: false,
98
- errorMessage: "The bundle is not authorized for this key.",
98
+ errorMessage: `The bundleId: ${bundleId}, is not authorized for this key. Please update your key permissions on the thirdweb dashboard`,
99
99
  errorCode: "BUNDLE_UNAUTHORIZED",
100
100
  status: 401
101
101
  };
102
102
  }
103
103
  return {
104
104
  authorized: false,
105
- errorMessage: "The keys are invalid.",
105
+ errorMessage: "The keys are invalid. Please check the secret-key/clientId and try again.",
106
106
  errorCode: "UNAUTHORIZED",
107
107
  status: 401
108
108
  };
@@ -117,7 +117,7 @@ function authorizeService(apiKeyMetadata, serviceConfig, authorizationPayload) {
117
117
  if (!service) {
118
118
  return {
119
119
  authorized: false,
120
- errorMessage: `The service "${serviceConfig.serviceScope}" is not authorized for this key.`,
120
+ errorMessage: `The service "${serviceConfig.serviceScope}" is not authorized for this key. Please update your key permissions on the thirdweb dashboard.`,
121
121
  errorCode: "SERVICE_UNAUTHORIZED",
122
122
  status: 403
123
123
  };
@@ -129,7 +129,7 @@ function authorizeService(apiKeyMetadata, serviceConfig, authorizationPayload) {
129
129
  if (!isActionAllowed) {
130
130
  return {
131
131
  authorized: false,
132
- errorMessage: `The service "${serviceConfig.serviceScope}" action "${serviceConfig.serviceAction}" is not authorized for this key.`,
132
+ errorMessage: `The service "${serviceConfig.serviceScope}" action "${serviceConfig.serviceAction}" is not authorized for this key. Please update your key permissions on the thirdweb dashboard.`,
133
133
  errorCode: "SERVICE_ACTION_UNAUTHORIZED",
134
134
  status: 403
135
135
  };
@@ -144,7 +144,7 @@ function authorizeService(apiKeyMetadata, serviceConfig, authorizationPayload) {
144
144
  if (!allAllowed && checkedAddresses.some(ta => !service.targetAddresses.includes(ta))) {
145
145
  return {
146
146
  authorized: false,
147
- errorMessage: `The service "${serviceConfig.serviceScope}" target address is not authorized for this key.`,
147
+ errorMessage: `The target address: ${checkedAddresses}, for service "${serviceConfig.serviceScope}" is not authorized for this key. Please update your key permissions on the thirdweb dashboard.`,
148
148
  errorCode: "SERVICE_TARGET_ADDRESS_UNAUTHORIZED",
149
149
  status: 403
150
150
  };
@@ -245,7 +245,7 @@ async function authorize(authData, serviceConfig, cacheOptions) {
245
245
  return {
246
246
  authorized: false,
247
247
  status: 500,
248
- errorMessage: "Failed to fetch key metadata.",
248
+ errorMessage: "Failed to fetch key metadata. Please check your secret-key/clientId.",
249
249
  errorCode: "FAILED_TO_FETCH_KEY"
250
250
  };
251
251
  }
@@ -254,7 +254,7 @@ async function authorize(authData, serviceConfig, cacheOptions) {
254
254
  return {
255
255
  authorized: false,
256
256
  status: 401,
257
- errorMessage: "Key is invalid.",
257
+ errorMessage: "Key is invalid. Please check your secret-key/clientId.",
258
258
  errorCode: "INVALID_KEY"
259
259
  };
260
260
  }
@@ -33,7 +33,7 @@ function authorizeClient(authOptions, apiKeyMeta) {
33
33
  if (secretHash !== providedSecretHash) {
34
34
  return {
35
35
  authorized: false,
36
- errorMessage: "The secret is invalid.",
36
+ errorMessage: "The secret is invalid. Please check you secret-key",
37
37
  errorCode: "SECRET_INVALID",
38
38
  status: 401
39
39
  };
@@ -70,7 +70,7 @@ function authorizeClient(authOptions, apiKeyMeta) {
70
70
  }
71
71
  return {
72
72
  authorized: false,
73
- errorMessage: "The origin is not authorized for this key.",
73
+ errorMessage: `The domain: ${origin}, is not authorized for this key. Please update your key permissions on the thirdweb dashboard`,
74
74
  errorCode: "ORIGIN_UNAUTHORIZED",
75
75
  status: 401
76
76
  };
@@ -93,14 +93,14 @@ function authorizeClient(authOptions, apiKeyMeta) {
93
93
  }
94
94
  return {
95
95
  authorized: false,
96
- errorMessage: "The bundle is not authorized for this key.",
96
+ errorMessage: `The bundleId: ${bundleId}, is not authorized for this key. Please update your key permissions on the thirdweb dashboard`,
97
97
  errorCode: "BUNDLE_UNAUTHORIZED",
98
98
  status: 401
99
99
  };
100
100
  }
101
101
  return {
102
102
  authorized: false,
103
- errorMessage: "The keys are invalid.",
103
+ errorMessage: "The keys are invalid. Please check the secret-key/clientId and try again.",
104
104
  errorCode: "UNAUTHORIZED",
105
105
  status: 401
106
106
  };
@@ -115,7 +115,7 @@ function authorizeService(apiKeyMetadata, serviceConfig, authorizationPayload) {
115
115
  if (!service) {
116
116
  return {
117
117
  authorized: false,
118
- errorMessage: `The service "${serviceConfig.serviceScope}" is not authorized for this key.`,
118
+ errorMessage: `The service "${serviceConfig.serviceScope}" is not authorized for this key. Please update your key permissions on the thirdweb dashboard.`,
119
119
  errorCode: "SERVICE_UNAUTHORIZED",
120
120
  status: 403
121
121
  };
@@ -127,7 +127,7 @@ function authorizeService(apiKeyMetadata, serviceConfig, authorizationPayload) {
127
127
  if (!isActionAllowed) {
128
128
  return {
129
129
  authorized: false,
130
- errorMessage: `The service "${serviceConfig.serviceScope}" action "${serviceConfig.serviceAction}" is not authorized for this key.`,
130
+ errorMessage: `The service "${serviceConfig.serviceScope}" action "${serviceConfig.serviceAction}" is not authorized for this key. Please update your key permissions on the thirdweb dashboard.`,
131
131
  errorCode: "SERVICE_ACTION_UNAUTHORIZED",
132
132
  status: 403
133
133
  };
@@ -142,7 +142,7 @@ function authorizeService(apiKeyMetadata, serviceConfig, authorizationPayload) {
142
142
  if (!allAllowed && checkedAddresses.some(ta => !service.targetAddresses.includes(ta))) {
143
143
  return {
144
144
  authorized: false,
145
- errorMessage: `The service "${serviceConfig.serviceScope}" target address is not authorized for this key.`,
145
+ errorMessage: `The target address: ${checkedAddresses}, for service "${serviceConfig.serviceScope}" is not authorized for this key. Please update your key permissions on the thirdweb dashboard.`,
146
146
  errorCode: "SERVICE_TARGET_ADDRESS_UNAUTHORIZED",
147
147
  status: 403
148
148
  };
@@ -243,7 +243,7 @@ async function authorize(authData, serviceConfig, cacheOptions) {
243
243
  return {
244
244
  authorized: false,
245
245
  status: 500,
246
- errorMessage: "Failed to fetch key metadata.",
246
+ errorMessage: "Failed to fetch key metadata. Please check your secret-key/clientId.",
247
247
  errorCode: "FAILED_TO_FETCH_KEY"
248
248
  };
249
249
  }
@@ -252,7 +252,7 @@ async function authorize(authData, serviceConfig, cacheOptions) {
252
252
  return {
253
253
  authorized: false,
254
254
  status: 401,
255
- errorMessage: "Key is invalid.",
255
+ errorMessage: "Key is invalid. Please check your secret-key/clientId.",
256
256
  errorCode: "INVALID_KEY"
257
257
  };
258
258
  }
@@ -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-6e980870.cjs.dev.js');
6
+ var index = require('../../dist/index-4496b57e.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-96491db6.cjs.prod.js');
6
+ var index = require('../../dist/index-7c6b47cd.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-c332ae71.esm.js';
2
+ import { a as authorize } from '../../dist/index-d752cff8.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.2.1",
3
+ "version": "0.2.2-nightly-385895ca-20230725001247",
4
4
  "main": "dist/thirdweb-dev-service-utils.cjs.js",
5
5
  "module": "dist/thirdweb-dev-service-utils.esm.js",
6
6
  "exports": {