graphlit-client 1.0.20240418011 → 1.0.20240418012

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.
Files changed (2) hide show
  1. package/dist/client.js +11 -1
  2. package/package.json +1 -1
package/dist/client.js CHANGED
@@ -96,9 +96,19 @@ class Graphlit {
96
96
  iss: "graphlit",
97
97
  aud: "https://portal.graphlit.io",
98
98
  };
99
+ function uint8ArrayToBase64(buffer) {
100
+ var binary = '';
101
+ var bytes = new Uint8Array(buffer);
102
+ var len = bytes.byteLength;
103
+ for (var i = 0; i < len; i++) {
104
+ binary += String.fromCharCode(bytes[i]);
105
+ }
106
+ return window.btoa(binary);
107
+ }
108
+ // NOTE: not using Buffer, so we don't require Node.js
99
109
  const secretKeyJWK = yield (0, jose_1.importJWK)({
100
110
  kty: 'oct',
101
- k: Buffer.from(this.jwtSecret).toString('base64'),
111
+ k: uint8ArrayToBase64(new TextEncoder().encode(this.jwtSecret)),
102
112
  alg: 'HS256'
103
113
  }, 'HS256');
104
114
  this.token = yield new jose_1.SignJWT(payload)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphlit-client",
3
- "version": "1.0.20240418011",
3
+ "version": "1.0.20240418012",
4
4
  "description": "Graphlit API TypeScript Client",
5
5
  "main": "dist/client.js",
6
6
  "types": "dist/client.d.ts",