tinacms 0.0.0-df15996-20250420014759 → 0.0.0-e5c0e91-20250421003142

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.
package/dist/index.js CHANGED
@@ -30337,12 +30337,27 @@ flowchart TD
30337
30337
  }
30338
30338
  const TINA_LOGIN_EVENT = "tinaCloudLogin";
30339
30339
  const AUTH_TOKEN_KEY = "tinacms-auth";
30340
+ const generateRandomString = (length) => {
30341
+ const array = new Uint32Array(length);
30342
+ window.crypto.getRandomValues(array);
30343
+ return Array.from(array, (dec) => ("0" + dec.toString(16)).slice(-2)).join(
30344
+ ""
30345
+ );
30346
+ };
30347
+ const generateCodeChallenge = async (codeVerifier) => {
30348
+ const encoder = new TextEncoder();
30349
+ const data = encoder.encode(codeVerifier);
30350
+ const digest = await window.crypto.subtle.digest("SHA-256", data);
30351
+ return btoa(String.fromCharCode(...new Uint8Array(digest))).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
30352
+ };
30340
30353
  const authenticate = (clientId, frontendUrl, oauth2) => {
30341
- return new Promise((resolve) => {
30354
+ return new Promise(async (resolve) => {
30342
30355
  const origin = `${window.location.protocol}//${window.location.host}`;
30343
30356
  if (oauth2) {
30357
+ const codeVerifier = generateRandomString(32);
30358
+ const codeChallenge = await generateCodeChallenge(codeVerifier);
30359
+ localStorage.setItem("code_verifier", codeVerifier);
30344
30360
  const redirectUri = encodeURIComponent(`${origin}/admin/auth/callback`);
30345
- const codeChallenge = "jksdfjdsklf";
30346
30361
  window.location.href = `${frontendUrl}/oauth-signin?redirect_uri=${redirectUri}&code_challenge=${codeChallenge}&client_id=${clientId}`;
30347
30362
  return;
30348
30363
  }
package/dist/index.mjs CHANGED
@@ -30364,12 +30364,27 @@ function popupWindow(url, title, window2, w, h) {
30364
30364
  }
30365
30365
  const TINA_LOGIN_EVENT = "tinaCloudLogin";
30366
30366
  const AUTH_TOKEN_KEY = "tinacms-auth";
30367
+ const generateRandomString = (length) => {
30368
+ const array = new Uint32Array(length);
30369
+ window.crypto.getRandomValues(array);
30370
+ return Array.from(array, (dec) => ("0" + dec.toString(16)).slice(-2)).join(
30371
+ ""
30372
+ );
30373
+ };
30374
+ const generateCodeChallenge = async (codeVerifier) => {
30375
+ const encoder = new TextEncoder();
30376
+ const data = encoder.encode(codeVerifier);
30377
+ const digest = await window.crypto.subtle.digest("SHA-256", data);
30378
+ return btoa(String.fromCharCode(...new Uint8Array(digest))).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
30379
+ };
30367
30380
  const authenticate = (clientId, frontendUrl, oauth2) => {
30368
- return new Promise((resolve) => {
30381
+ return new Promise(async (resolve) => {
30369
30382
  const origin = `${window.location.protocol}//${window.location.host}`;
30370
30383
  if (oauth2) {
30384
+ const codeVerifier = generateRandomString(32);
30385
+ const codeChallenge = await generateCodeChallenge(codeVerifier);
30386
+ localStorage.setItem("code_verifier", codeVerifier);
30371
30387
  const redirectUri = encodeURIComponent(`${origin}/admin/auth/callback`);
30372
- const codeChallenge = "jksdfjdsklf";
30373
30388
  window.location.href = `${frontendUrl}/oauth-signin?redirect_uri=${redirectUri}&code_challenge=${codeChallenge}&client_id=${clientId}`;
30374
30389
  return;
30375
30390
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tinacms",
3
- "version": "0.0.0-df15996-20250420014759",
3
+ "version": "0.0.0-e5c0e91-20250421003142",
4
4
  "main": "dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "exports": {
@@ -129,9 +129,9 @@
129
129
  "webfontloader": "1.6.28",
130
130
  "yup": "^1.6.1",
131
131
  "zod": "^3.24.2",
132
- "@tinacms/mdx": "0.0.0-df15996-20250420014759",
133
- "@tinacms/search": "0.0.0-df15996-20250420014759",
134
- "@tinacms/schema-tools": "0.0.0-df15996-20250420014759"
132
+ "@tinacms/mdx": "0.0.0-e5c0e91-20250421003142",
133
+ "@tinacms/schema-tools": "0.0.0-e5c0e91-20250421003142",
134
+ "@tinacms/search": "0.0.0-e5c0e91-20250421003142"
135
135
  },
136
136
  "devDependencies": {
137
137
  "@graphql-tools/utils": "^10.8.1",