From 15cde3bf5645b0fb084a0fc385f46075c9b8feb1 Mon Sep 17 00:00:00 2001 From: erikatharp Date: Mon, 10 Apr 2023 17:58:11 -0700 Subject: [PATCH 1/6] chore; export AuthClient --- packages/client-sdk-web/src/index.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/client-sdk-web/src/index.ts b/packages/client-sdk-web/src/index.ts index 39dc878fa..0e0aaf1f1 100644 --- a/packages/client-sdk-web/src/index.ts +++ b/packages/client-sdk-web/src/index.ts @@ -1,4 +1,5 @@ import {CacheClient} from './cache-client'; +import {AuthClient} from './auth-client'; import { CacheGet, CacheListConcatenateBack, @@ -85,6 +86,7 @@ export { } from '@gomomento/common'; export { + AuthClient, CollectionTtl, SortedSetOrder, Configuration, From 719fc9573d3ca41b20cb831a9c3a03ce77ec95e4 Mon Sep 17 00:00:00 2001 From: erikatharp Date: Mon, 10 Apr 2023 18:01:10 -0700 Subject: [PATCH 2/6] Trigger Build From bf183cc0464b7df83522523cff8f2edee22298ab Mon Sep 17 00:00:00 2001 From: Matt Straathof <11823378+bruuuuuuuce@users.noreply.github.com> Date: Tue, 11 Apr 2023 09:20:16 -0700 Subject: [PATCH 3/6] fix: how we are encoding base64 strings --- packages/common/src/internal/utils/string.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/common/src/internal/utils/string.ts b/packages/common/src/internal/utils/string.ts index 944397ba3..2c766f0ff 100644 --- a/packages/common/src/internal/utils/string.ts +++ b/packages/common/src/internal/utils/string.ts @@ -1,5 +1,3 @@ -export const decodeFromBase64 = (base64: string) => - Buffer.from(base64, 'base64').toString(); +export const decodeFromBase64 = (base64: string) => atob(base64); -export const encodeToBase64 = (str: string) => - Buffer.from(str).toString('base64'); +export const encodeToBase64 = (str: string) => btoa(base64); From 9a451bea75ef6e47c968b8cb5e19b9817aedf190 Mon Sep 17 00:00:00 2001 From: Matt Straathof Date: Tue, 11 Apr 2023 09:29:12 -0700 Subject: [PATCH 4/6] fix: linting --- packages/common/src/internal/utils/string.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/common/src/internal/utils/string.ts b/packages/common/src/internal/utils/string.ts index 2c766f0ff..79631f5ff 100644 --- a/packages/common/src/internal/utils/string.ts +++ b/packages/common/src/internal/utils/string.ts @@ -1,3 +1,3 @@ export const decodeFromBase64 = (base64: string) => atob(base64); -export const encodeToBase64 = (str: string) => btoa(base64); +export const encodeToBase64 = (str: string) => btoa(str); From bea2f7cc6169bf886add59544a911600cd61212b Mon Sep 17 00:00:00 2001 From: erikatharp Date: Tue, 11 Apr 2023 09:51:07 -0700 Subject: [PATCH 5/6] chore: update endpoint --- packages/client-sdk-web/src/internal/auth-client.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/client-sdk-web/src/internal/auth-client.ts b/packages/client-sdk-web/src/internal/auth-client.ts index 18da2bdae..33f7e582a 100644 --- a/packages/client-sdk-web/src/internal/auth-client.ts +++ b/packages/client-sdk-web/src/internal/auth-client.ts @@ -37,9 +37,13 @@ export class InternalWebGrpcAuthClient< this.logger.debug( `Creating control client using endpoint: ${props.controlEndpoint}` ); - this.clientAuthWrapper = new auth.AuthClient(props.controlEndpoint, null, { - unaryInterceptors: this.interceptors, - }); + this.clientAuthWrapper = new auth.AuthClient( + `https://${props.controlEndpoint}`, + null, + { + unaryInterceptors: this.interceptors, + } + ); } public async generateApiToken( From c10ee71c4444d1e7ca118c222f5d6288c3557c14 Mon Sep 17 00:00:00 2001 From: erikatharp Date: Tue, 11 Apr 2023 10:10:57 -0700 Subject: [PATCH 6/6] chore: add comment to string.ts --- packages/client-sdk-web/package-lock.json | 24 ++++++++++---------- packages/common/src/internal/utils/string.ts | 10 ++++++++ 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/packages/client-sdk-web/package-lock.json b/packages/client-sdk-web/package-lock.json index aa182104b..c5d106fef 100644 --- a/packages/client-sdk-web/package-lock.json +++ b/packages/client-sdk-web/package-lock.json @@ -2493,9 +2493,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.4.356", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.356.tgz", - "integrity": "sha512-nEftV1dRX3omlxAj42FwqRZT0i4xd2dIg39sog/CnCJeCcL1TRd2Uh0i9Oebgv8Ou0vzTPw++xc+Z20jzS2B6A==", + "version": "1.4.357", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.357.tgz", + "integrity": "sha512-UTkCbNTAcGXABmEnQrGcW4m3cG6fcyBfD4KDF0iyEAlbrGZiY9dmslyDAGOD1Kr5biN2F743Y30aRCOtau35Vw==", "dev": true }, "node_modules/emittery": { @@ -6156,9 +6156,9 @@ } }, "node_modules/semver": { - "version": "7.3.8", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", - "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.4.0.tgz", + "integrity": "sha512-RgOxM8Mw+7Zus0+zcLEUn8+JfoLpj/huFTItQy2hsM4khuC1HYRDp0cU482Ewn/Fcy6bCjufD8vAj7voC66KQw==", "dev": true, "dependencies": { "lru-cache": "^6.0.0" @@ -9007,9 +9007,9 @@ } }, "electron-to-chromium": { - "version": "1.4.356", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.356.tgz", - "integrity": "sha512-nEftV1dRX3omlxAj42FwqRZT0i4xd2dIg39sog/CnCJeCcL1TRd2Uh0i9Oebgv8Ou0vzTPw++xc+Z20jzS2B6A==", + "version": "1.4.357", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.357.tgz", + "integrity": "sha512-UTkCbNTAcGXABmEnQrGcW4m3cG6fcyBfD4KDF0iyEAlbrGZiY9dmslyDAGOD1Kr5biN2F743Y30aRCOtau35Vw==", "dev": true }, "emittery": { @@ -11700,9 +11700,9 @@ } }, "semver": { - "version": "7.3.8", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", - "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.4.0.tgz", + "integrity": "sha512-RgOxM8Mw+7Zus0+zcLEUn8+JfoLpj/huFTItQy2hsM4khuC1HYRDp0cU482Ewn/Fcy6bCjufD8vAj7voC66KQw==", "dev": true, "requires": { "lru-cache": "^6.0.0" diff --git a/packages/common/src/internal/utils/string.ts b/packages/common/src/internal/utils/string.ts index 79631f5ff..6e9c791ed 100644 --- a/packages/common/src/internal/utils/string.ts +++ b/packages/common/src/internal/utils/string.ts @@ -1,3 +1,13 @@ +/* Attention: +before merging this console branch back into main, we need to +fix how we are encoding/decoding base64 strings. The functions atob and btoa +are deprecated in the node environment, but Buffer does not exist in a browser. There +are a few ways we can handle this. + +1. have some way to determine an isNode() boolean flag +2. pull these functions out into their respective sdks +3. maybe some 3rd party library can help? */ + export const decodeFromBase64 = (base64: string) => atob(base64); export const encodeToBase64 = (str: string) => btoa(str);