@thirdweb-dev/service-utils 0.1.0-nightly-8dd7540c-20230713220435 → 0.1.0-nightly-cfa7ecbc-20230713222838

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.
@@ -1,6 +1,4 @@
1
1
  import { AuthorizationResponse, AuthorizeCFWorkerOptions, AuthorizeNodeServiceOptions } from "./types";
2
2
  export declare function authorizeCFWorkerService(options: AuthorizeCFWorkerOptions): Promise<AuthorizationResponse>;
3
3
  export declare function authorizeNodeService(options: AuthorizeNodeServiceOptions): Promise<AuthorizationResponse>;
4
- export declare function hashSecret(secret: string): string;
5
- export declare function hashClientId(secret: string): string;
6
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"../../../../src/auth","sources":["index.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,qBAAqB,EAErB,wBAAwB,EACxB,2BAA2B,EAE5B,MAAM,SAAS,CAAC;AAGjB,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,wBAAwB,kCAkClC;AAED,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,2BAA2B,kCASrC;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,UAExC;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,UAG1C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"../../../../src/auth","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,qBAAqB,EAErB,wBAAwB,EACxB,2BAA2B,EAE5B,MAAM,SAAS,CAAC;AAEjB,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,wBAAwB,kCAkClC;AAED,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,2BAA2B,kCASrC"}
@@ -2,13 +2,6 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var fetch = require('isomorphic-unfetch');
6
- var crypto = require('crypto');
7
-
8
- function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
9
-
10
- var fetch__default = /*#__PURE__*/_interopDefault(fetch);
11
-
12
5
  const SERVICE_NAMES = ["bundler", "rpc", "storage"];
13
6
  const SERVICES = [{
14
7
  name: "storage",
@@ -88,13 +81,6 @@ async function authorizeNodeService(options) {
88
81
  validations
89
82
  });
90
83
  }
91
- function hashSecret(secret) {
92
- return crypto.createHash("sha256").update(secret).digest("hex");
93
- }
94
- function hashClientId(secret) {
95
- const hashed = crypto.createHash("sha256").update(secret).digest("hex");
96
- return hashed.slice(0, 32);
97
- }
98
84
 
99
85
  /**
100
86
  * Authorizes a request for a given client ID
@@ -122,7 +108,7 @@ async function authorize(options) {
122
108
 
123
109
  // no cached key, re-fetch from API
124
110
  if (!keyData) {
125
- const response = await fetch__default["default"](`${apiUrl}/v1/keys/use/?scope=${scope}&clientId=${clientId}`, {
111
+ const response = await fetch(`${apiUrl}/v1/keys/use/?scope=${scope}&clientId=${clientId}`, {
126
112
  method: "GET",
127
113
  headers: {
128
114
  "x-service-api-key": serviceKey,
@@ -291,5 +277,3 @@ exports.SERVICE_NAMES = SERVICE_NAMES;
291
277
  exports.authorizeCFWorkerService = authorizeCFWorkerService;
292
278
  exports.authorizeNodeService = authorizeNodeService;
293
279
  exports.getServiceByName = getServiceByName;
294
- exports.hashClientId = hashClientId;
295
- exports.hashSecret = hashSecret;
@@ -2,13 +2,6 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var fetch = require('isomorphic-unfetch');
6
- var crypto = require('crypto');
7
-
8
- function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
9
-
10
- var fetch__default = /*#__PURE__*/_interopDefault(fetch);
11
-
12
5
  const SERVICE_NAMES = ["bundler", "rpc", "storage"];
13
6
  const SERVICES = [{
14
7
  name: "storage",
@@ -88,13 +81,6 @@ async function authorizeNodeService(options) {
88
81
  validations
89
82
  });
90
83
  }
91
- function hashSecret(secret) {
92
- return crypto.createHash("sha256").update(secret).digest("hex");
93
- }
94
- function hashClientId(secret) {
95
- const hashed = crypto.createHash("sha256").update(secret).digest("hex");
96
- return hashed.slice(0, 32);
97
- }
98
84
 
99
85
  /**
100
86
  * Authorizes a request for a given client ID
@@ -122,7 +108,7 @@ async function authorize(options) {
122
108
 
123
109
  // no cached key, re-fetch from API
124
110
  if (!keyData) {
125
- const response = await fetch__default["default"](`${apiUrl}/v1/keys/use/?scope=${scope}&clientId=${clientId}`, {
111
+ const response = await fetch(`${apiUrl}/v1/keys/use/?scope=${scope}&clientId=${clientId}`, {
126
112
  method: "GET",
127
113
  headers: {
128
114
  "x-service-api-key": serviceKey,
@@ -291,5 +277,3 @@ exports.SERVICE_NAMES = SERVICE_NAMES;
291
277
  exports.authorizeCFWorkerService = authorizeCFWorkerService;
292
278
  exports.authorizeNodeService = authorizeNodeService;
293
279
  exports.getServiceByName = getServiceByName;
294
- exports.hashClientId = hashClientId;
295
- exports.hashSecret = hashSecret;
@@ -1,6 +1,3 @@
1
- import fetch from 'isomorphic-unfetch';
2
- import { createHash } from 'crypto';
3
-
4
1
  const SERVICE_NAMES = ["bundler", "rpc", "storage"];
5
2
  const SERVICES = [{
6
3
  name: "storage",
@@ -80,13 +77,6 @@ async function authorizeNodeService(options) {
80
77
  validations
81
78
  });
82
79
  }
83
- function hashSecret(secret) {
84
- return createHash("sha256").update(secret).digest("hex");
85
- }
86
- function hashClientId(secret) {
87
- const hashed = createHash("sha256").update(secret).digest("hex");
88
- return hashed.slice(0, 32);
89
- }
90
80
 
91
81
  /**
92
82
  * Authorizes a request for a given client ID
@@ -278,4 +268,4 @@ function getServiceByName(name) {
278
268
  return SERVICES.find(srv => srv.name === name);
279
269
  }
280
270
 
281
- export { SERVICES, SERVICE_NAMES, authorizeCFWorkerService, authorizeNodeService, getServiceByName, hashClientId, hashSecret };
271
+ export { SERVICES, SERVICE_NAMES, authorizeCFWorkerService, authorizeNodeService, getServiceByName };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thirdweb-dev/service-utils",
3
- "version": "0.1.0-nightly-8dd7540c-20230713220435",
3
+ "version": "0.1.0-nightly-cfa7ecbc-20230713222838",
4
4
  "main": "dist/thirdweb-dev-service-utils.cjs.js",
5
5
  "module": "dist/thirdweb-dev-service-utils.esm.js",
6
6
  "exports": {
@@ -42,9 +42,6 @@
42
42
  "eslint-config-thirdweb": "^0.1.5",
43
43
  "typescript": "^5.1.6"
44
44
  },
45
- "dependencies": {
46
- "isomorphic-unfetch": "^4.0.2"
47
- },
48
45
  "scripts": {
49
46
  "format": "prettier --write 'src/**/*'",
50
47
  "lint": "eslint src/",