@xwiki/cristal-electron-authentication-github-main 0.20.0 → 0.21.0
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/CHANGELOG.md +11 -0
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/storage.d.ts +19 -0
- package/package.json +7 -7
- package/src/index.ts +1 -1
- package/src/storage.ts +1 -1
- package/vite.config.ts +1 -1
- package/vitest.config.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @xwiki/cristal-electron-authentication-github-main
|
|
2
2
|
|
|
3
|
+
## 0.21.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Cristal 0.21 Release
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- @xwiki/cristal-authentication-api@0.21.0
|
|
13
|
+
|
|
3
14
|
## 0.20.0
|
|
4
15
|
|
|
5
16
|
### Minor Changes
|
package/dist/index.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es.js","sources":["../src/storage.ts","../__vite-browser-external","../../../../../node_modules/.pnpm/electron@37.1.0/node_modules/electron/index.js","../src/index.ts"],"sourcesContent":["/*\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport Store from \"electron-store\";\n\nconst tokenTypeKey = \"tokenType\";\n\nconst accessTokenKey = \"accessToken\";\n\nconst schema = {\n tokenType: {\n type: \"string\",\n },\n\n accessToken: {\n type: \"string\",\n },\n};\n\nconst storeInstance: Store = new Store({\n name: \"authentication-github-main\",\n schema,\n // TODO: add encryption key\n});\n\nfunction set<T>(key: string, value: T) {\n // @ts-expect-error type resolution failing because of electron-store library bug\n storeInstance.set(key, value);\n}\n\nfunction get<T>(key: string): T {\n // @ts-expect-error type resolution failing because of electron-store library bug\n return storeInstance.get(key) as T;\n}\n\nfunction rm(key: string) {\n // @ts-expect-error type resolution failing because of electron-store library bug\n storeInstance.delete(key);\n}\n\nfunction setTokenType(value: string): void {\n set(tokenTypeKey, value);\n}\n\nfunction setAccessToken(value: string): void {\n set(accessTokenKey, value);\n}\n\nfunction getTokenType(): string {\n return get(tokenTypeKey);\n}\n\nfunction getAccessToken(): string {\n return get(accessTokenKey);\n}\n\nfunction deleteTokenType(): void {\n rm(tokenTypeKey);\n}\n\nfunction deleteAccessToken(): void {\n rm(accessTokenKey);\n}\n\nexport {\n deleteAccessToken,\n deleteTokenType,\n getAccessToken,\n getTokenType,\n setAccessToken,\n setTokenType,\n};\n","export default {}","const fs = require('fs');\nconst path = require('path');\n\nconst pathFile = path.join(__dirname, 'path.txt');\n\nfunction getElectronPath () {\n let executablePath;\n if (fs.existsSync(pathFile)) {\n executablePath = fs.readFileSync(pathFile, 'utf-8');\n }\n if (process.env.ELECTRON_OVERRIDE_DIST_PATH) {\n return path.join(process.env.ELECTRON_OVERRIDE_DIST_PATH, executablePath || 'electron');\n }\n if (executablePath) {\n return path.join(__dirname, 'dist', executablePath);\n } else {\n throw new Error('Electron failed to install correctly, please delete node_modules/electron and try installing again');\n }\n}\n\nmodule.exports = getElectronPath();\n","/*\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport {\n deleteAccessToken,\n deleteTokenType,\n getAccessToken,\n getTokenType,\n setAccessToken,\n setTokenType,\n} from \"./storage.js\";\nimport { UserDetails } from \"@xwiki/cristal-authentication-api\";\nimport axios from \"axios\";\nimport { BrowserWindow, ipcMain } from \"electron\";\n\nfunction getAuthorizationValue() {\n return `${getTokenType()} ${getAccessToken()}`;\n}\n\nexport function load(\n browserWindow: BrowserWindow,\n reload: (win: BrowserWindow) => void,\n): void {\n ipcMain.handle(\n \"authentication:github:login\",\n async (\n _event,\n {\n baseUrl,\n deviceCode,\n interval,\n expiresIn,\n }: {\n baseUrl: string;\n deviceCode: string;\n interval: string;\n expiresIn: string;\n },\n ) => {\n const verificationUrl = new URL(`${baseUrl}/device-verify`);\n verificationUrl.searchParams.set(\"device_code\", deviceCode);\n\n // This converts the interval polling time and expiration time provided by\n // GitHub to milliseconds.\n // We need to add a little more delay to the interval when polling, just to\n // be sure that we don't go to fast for GitHub (or we might get rate\n // limited).\n const intervalMs: number = parseInt(interval) * 1000 + 500;\n let expiresInMs: number = parseInt(expiresIn) * 1000;\n\n // This interval handles polling the backend for the access token, using\n // the interval time computed earlier.\n // The backend will return an error until the login process has succeeded.\n const intervalId = setInterval(async () => {\n const response = await fetch(verificationUrl);\n const jsonResponse: {\n error?: string;\n access_token?: string;\n token_type?: string;\n } = await response.json();\n if (!jsonResponse.error) {\n setAccessToken(jsonResponse.access_token!);\n setTokenType(jsonResponse.token_type!);\n clearInterval(intervalId);\n // We reload the content on successful login.\n reload(browserWindow);\n } else if (expiresInMs <= 0) {\n clearInterval(intervalId);\n }\n expiresInMs -= intervalMs;\n }, intervalMs);\n },\n );\n\n ipcMain.handle(\"authentication:github:isLoggedIn\", () => {\n const tokenType = getTokenType();\n const accessTokenKey = getAccessToken();\n return tokenType && accessTokenKey;\n });\n\n ipcMain.handle(\n \"authentication:github:userDetails\",\n async (): Promise<UserDetails> => {\n const userinfoUrl = \"https://api.github.com/user\";\n const data = {\n headers: {\n Authorization: getAuthorizationValue(),\n },\n };\n const {\n data: { login, html_url, name, avatar_url },\n } = await axios.get(userinfoUrl, data);\n\n return { profile: html_url, username: login, name, avatar: avatar_url };\n },\n );\n ipcMain.handle(\"authentication:github:authorizationValue\", () => {\n return {\n tokenType: getTokenType(),\n accessToken: getAccessToken(),\n };\n });\n ipcMain.handle(\"authentication:github:logout\", () => {\n deleteAccessToken();\n deleteTokenType();\n });\n}\n"],"names":["tokenTypeKey","accessTokenKey","schema","storeInstance","Store","set","key","value","get","rm","setTokenType","setAccessToken","getTokenType","getAccessToken","deleteTokenType","deleteAccessToken","__viteBrowserExternal","fs","require$$0","path","require$$1","pathFile","getElectronPath","executablePath","electron","getAuthorizationValue","load","browserWindow","reload","ipcMain","_event","baseUrl","deviceCode","interval","expiresIn","verificationUrl","intervalMs","expiresInMs","intervalId","jsonResponse","tokenType","userinfoUrl","data","login","html_url","name","avatar_url","axios"],"mappings":";;AAsBA,MAAMA,IAAe,aAEfC,IAAiB,eAEjBC,IAAS;AAAA,EACb,WAAW;AAAA,IACT,MAAM;AAAA,EACR;AAAA,EAEA,aAAa;AAAA,IACX,MAAM;AAAA,EAAA;AAEV,GAEMC,IAAuB,IAAIC,EAAM;AAAA,EACrC,MAAM;AAAA,EACN,QAAAF;AAAA;AAEF,CAAC;AAED,SAASG,EAAOC,GAAaC,GAAU;AAEvB,EAAAJ,EAAA,IAAIG,GAAKC,CAAK;AAC9B;AAEA,SAASC,EAAOF,G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AgB;AAC1C,MAAAI,EAAA,aAAa,IAAI,eAAeH,CAAU;AAO1D,YAAMI,IAAqB,SAASH,CAAQ,IAAI,MAAO;AACnD,UAAAI,IAAsB,SAASH,CAAS,IAAI;AAK1C,YAAAI,IAAa,YAAY,YAAY;AAEnC,cAAAC,IAIF,OALa,MAAM,MAAMJ,CAAe,GAKzB,KAAK;AACpB,QAACI,EAAa,QAMPF,KAAe,KACxB,cAAcC,CAAU,KANxB3B,EAAe4B,EAAa,YAAa,GACzC7B,EAAa6B,EAAa,UAAW,GACrC,cAAcD,CAAU,GAExBV,EAAOD,CAAa,IAIPU,KAAAD;AAAA,SACdA,CAAU;AAAA,IAAA;AAAA,EAEjB,GAEQP,UAAA,OAAO,oCAAoC,MAAM;AACvD,UAAMW,IAAY5B,EAAa,GACzBX,IAAiBY,EAAe;AACtC,WAAO2B,KAAavC;AAAA,EAAA,CACrB,GAEO4B,EAAAA,QAAA;AAAA,IACN;AAAA,IACA,YAAkC;AAChC,YAAMY,IAAc,+BACdC,IAAO;AAAA,QACX,SAAS;AAAA,UACP,eAAejB,EAAsB;AAAA,QAAA;AAAA,MAEzC,GACM;AAAA,QACJ,MAAM,EAAE,OAAAkB,GAAO,UAAAC,GAAU,MAAAC,GAAM,YAAAC,EAAW;AAAA,MACxC,IAAA,MAAMC,EAAM,IAAIN,GAAaC,CAAI;AAErC,aAAO,EAAE,SAASE,GAAU,UAAUD,GAAO,MAAAE,GAAM,QAAQC,EAAW;AAAA,IAAA;AAAA,EAE1E,GACQjB,UAAA,OAAO,4CAA4C,OAClD;AAAA,IACL,WAAWjB,EAAa;AAAA,IACxB,aAAaC,EAAe;AAAA,EAC9B,EACD,GACOgB,UAAA,OAAO,gCAAgC,MAAM;AACjC,IAAAd,EAAA,GACFD,EAAA;AAAA,EAAA,CACjB;AACH;","x_google_ignoreList":[2]}
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":["../src/storage.ts","../__vite-browser-external","../../../../../node_modules/.pnpm/electron@37.2.5/node_modules/electron/index.js","../src/index.ts"],"sourcesContent":["/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport Store from \"electron-store\";\n\nconst tokenTypeKey = \"tokenType\";\n\nconst accessTokenKey = \"accessToken\";\n\nconst schema = {\n tokenType: {\n type: \"string\",\n },\n\n accessToken: {\n type: \"string\",\n },\n};\n\nconst storeInstance: Store = new Store({\n name: \"authentication-github-main\",\n schema,\n // TODO: add encryption key\n});\n\nfunction set<T>(key: string, value: T) {\n // @ts-expect-error type resolution failing because of electron-store library bug\n storeInstance.set(key, value);\n}\n\nfunction get<T>(key: string): T {\n // @ts-expect-error type resolution failing because of electron-store library bug\n return storeInstance.get(key) as T;\n}\n\nfunction rm(key: string) {\n // @ts-expect-error type resolution failing because of electron-store library bug\n storeInstance.delete(key);\n}\n\nfunction setTokenType(value: string): void {\n set(tokenTypeKey, value);\n}\n\nfunction setAccessToken(value: string): void {\n set(accessTokenKey, value);\n}\n\nfunction getTokenType(): string {\n return get(tokenTypeKey);\n}\n\nfunction getAccessToken(): string {\n return get(accessTokenKey);\n}\n\nfunction deleteTokenType(): void {\n rm(tokenTypeKey);\n}\n\nfunction deleteAccessToken(): void {\n rm(accessTokenKey);\n}\n\nexport {\n deleteAccessToken,\n deleteTokenType,\n getAccessToken,\n getTokenType,\n setAccessToken,\n setTokenType,\n};\n","export default {}","const fs = require('fs');\nconst path = require('path');\n\nconst pathFile = path.join(__dirname, 'path.txt');\n\nfunction getElectronPath () {\n let executablePath;\n if (fs.existsSync(pathFile)) {\n executablePath = fs.readFileSync(pathFile, 'utf-8');\n }\n if (process.env.ELECTRON_OVERRIDE_DIST_PATH) {\n return path.join(process.env.ELECTRON_OVERRIDE_DIST_PATH, executablePath || 'electron');\n }\n if (executablePath) {\n return path.join(__dirname, 'dist', executablePath);\n } else {\n throw new Error('Electron failed to install correctly, please delete node_modules/electron and try installing again');\n }\n}\n\nmodule.exports = getElectronPath();\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport {\n deleteAccessToken,\n deleteTokenType,\n getAccessToken,\n getTokenType,\n setAccessToken,\n setTokenType,\n} from \"./storage.js\";\nimport { UserDetails } from \"@xwiki/cristal-authentication-api\";\nimport axios from \"axios\";\nimport { BrowserWindow, ipcMain } from \"electron\";\n\nfunction getAuthorizationValue() {\n return `${getTokenType()} ${getAccessToken()}`;\n}\n\nexport function load(\n browserWindow: BrowserWindow,\n reload: (win: BrowserWindow) => void,\n): void {\n ipcMain.handle(\n \"authentication:github:login\",\n async (\n _event,\n {\n baseUrl,\n deviceCode,\n interval,\n expiresIn,\n }: {\n baseUrl: string;\n deviceCode: string;\n interval: string;\n expiresIn: string;\n },\n ) => {\n const verificationUrl = new URL(`${baseUrl}/device-verify`);\n verificationUrl.searchParams.set(\"device_code\", deviceCode);\n\n // This converts the interval polling time and expiration time provided by\n // GitHub to milliseconds.\n // We need to add a little more delay to the interval when polling, just to\n // be sure that we don't go to fast for GitHub (or we might get rate\n // limited).\n const intervalMs: number = parseInt(interval) * 1000 + 500;\n let expiresInMs: number = parseInt(expiresIn) * 1000;\n\n // This interval handles polling the backend for the access token, using\n // the interval time computed earlier.\n // The backend will return an error until the login process has succeeded.\n const intervalId = setInterval(async () => {\n const response = await fetch(verificationUrl);\n const jsonResponse: {\n error?: string;\n access_token?: string;\n token_type?: string;\n } = await response.json();\n if (!jsonResponse.error) {\n setAccessToken(jsonResponse.access_token!);\n setTokenType(jsonResponse.token_type!);\n clearInterval(intervalId);\n // We reload the content on successful login.\n reload(browserWindow);\n } else if (expiresInMs <= 0) {\n clearInterval(intervalId);\n }\n expiresInMs -= intervalMs;\n }, intervalMs);\n },\n );\n\n ipcMain.handle(\"authentication:github:isLoggedIn\", () => {\n const tokenType = getTokenType();\n const accessTokenKey = getAccessToken();\n return tokenType && accessTokenKey;\n });\n\n ipcMain.handle(\n \"authentication:github:userDetails\",\n async (): Promise<UserDetails> => {\n const userinfoUrl = \"https://api.github.com/user\";\n const data = {\n headers: {\n Authorization: getAuthorizationValue(),\n },\n };\n const {\n data: { login, html_url, name, avatar_url },\n } = await axios.get(userinfoUrl, data);\n\n return { profile: html_url, username: login, name, avatar: avatar_url };\n },\n );\n ipcMain.handle(\"authentication:github:authorizationValue\", () => {\n return {\n tokenType: getTokenType(),\n accessToken: getAccessToken(),\n };\n });\n ipcMain.handle(\"authentication:github:logout\", () => {\n deleteAccessToken();\n deleteTokenType();\n });\n}\n"],"names":["tokenTypeKey","accessTokenKey","schema","storeInstance","Store","set","key","value","get","rm","setTokenType","setAccessToken","getTokenType","getAccessToken","deleteTokenType","deleteAccessToken","__viteBrowserExternal","fs","require$$0","path","require$$1","pathFile","getElectronPath","executablePath","electron","getAuthorizationValue","load","browserWindow","reload","ipcMain","_event","baseUrl","deviceCode","interval","expiresIn","verificationUrl","intervalMs","expiresInMs","intervalId","jsonResponse","tokenType","userinfoUrl","data","login","html_url","name","avatar_url","axios"],"mappings":";;AAsBA,MAAMA,IAAe,aAEfC,IAAiB,eAEjBC,IAAS;AAAA,EACb,WAAW;AAAA,IACT,MAAM;AAAA,EAAA;AAAA,EAGR,aAAa;AAAA,IACX,MAAM;AAAA,EAAA;AAEV,GAEMC,IAAuB,IAAIC,EAAM;AAAA,EACrC,MAAM;AAAA,EACN,QAAAF;AAAA;AAEF,CAAC;AAED,SAASG,EAAOC,GAAaC,GAAU;AAErC,EAAAJ,EAAc,IAAIG,GAAKC,CAAK;AAC9B;AAEA,SAASC,EAAOF,GAAgB;AAE9B,SAAOH,EAAc,IAAIG,CAAG;AAC9B;AAEA,SAASG,EAAGH,GAAa;AAEvB,EAAAH,EAAc,OAAOG,CAAG;AAC1B;AAEA,SAASI,EAAaH,GAAqB;AACzC,EAAAF,EAAIL,GAAcO,CAAK;AACzB;AAEA,SAASI,EAAeJ,GAAqB;AAC3C,EAAAF,EAAIJ,GAAgBM,CAAK;AAC3B;AAEA,SAASK,IAAuB;AAC9B,SAAOJ,EAAIR,CAAY;AACzB;AAEA,SAASa,IAAyB;AAChC,SAAOL,EAAIP,CAAc;AAC3B;AAEA,SAASa,IAAwB;AAC/B,EAAAL,EAAGT,CAAY;AACjB;AAEA,SAASe,IAA0B;AACjC,EAAAN,EAAGR,CAAc;AACnB;;;;;;;;;;;;;;;;;;;;;;;;;AC/EA,MAAAe,IAAe,CAAA;;;;;;;;ACAf,QAAMC,IAAKC,GACLC,IAAOC,GAEPC,IAAWF,EAAK,KAAK,WAAW,UAAU;AAEhD,WAASG,IAAmB;AAC1B,QAAIC;AAIJ,QAHIN,EAAG,WAAWI,CAAQ,MACxBE,IAAiBN,EAAG,aAAaI,GAAU,OAAO,IAEhD,QAAQ,IAAI;AACd,aAAOF,EAAK,KAAK,QAAQ,IAAI,6BAA6BI,KAAkB,UAAU;AAExF,QAAIA;AAC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,MAAMC,EAAM,IAAIN,GAAaC,CAAI;AAErC,aAAO,EAAE,SAASE,GAAU,UAAUD,GAAO,MAAAE,GAAM,QAAQC,EAAA;AAAA,IAC7D;AAAA,EAAA,GAEFjB,UAAQ,OAAO,4CAA4C,OAClD;AAAA,IACL,WAAWjB,EAAA;AAAA,IACX,aAAaC,EAAA;AAAA,EAAe,EAE/B,GACDgB,UAAQ,OAAO,gCAAgC,MAAM;AACnD,IAAAd,EAAA,GACAD,EAAA;AAAA,EACF,CAAC;AACH;","x_google_ignoreList":[2]}
|
package/dist/index.umd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.umd.js","sources":["../src/storage.ts","../__vite-browser-external","../../../../../node_modules/.pnpm/electron@37.1.0/node_modules/electron/index.js","../src/index.ts"],"sourcesContent":["/*\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport Store from \"electron-store\";\n\nconst tokenTypeKey = \"tokenType\";\n\nconst accessTokenKey = \"accessToken\";\n\nconst schema = {\n tokenType: {\n type: \"string\",\n },\n\n accessToken: {\n type: \"string\",\n },\n};\n\nconst storeInstance: Store = new Store({\n name: \"authentication-github-main\",\n schema,\n // TODO: add encryption key\n});\n\nfunction set<T>(key: string, value: T) {\n // @ts-expect-error type resolution failing because of electron-store library bug\n storeInstance.set(key, value);\n}\n\nfunction get<T>(key: string): T {\n // @ts-expect-error type resolution failing because of electron-store library bug\n return storeInstance.get(key) as T;\n}\n\nfunction rm(key: string) {\n // @ts-expect-error type resolution failing because of electron-store library bug\n storeInstance.delete(key);\n}\n\nfunction setTokenType(value: string): void {\n set(tokenTypeKey, value);\n}\n\nfunction setAccessToken(value: string): void {\n set(accessTokenKey, value);\n}\n\nfunction getTokenType(): string {\n return get(tokenTypeKey);\n}\n\nfunction getAccessToken(): string {\n return get(accessTokenKey);\n}\n\nfunction deleteTokenType(): void {\n rm(tokenTypeKey);\n}\n\nfunction deleteAccessToken(): void {\n rm(accessTokenKey);\n}\n\nexport {\n deleteAccessToken,\n deleteTokenType,\n getAccessToken,\n getTokenType,\n setAccessToken,\n setTokenType,\n};\n","export default {}","const fs = require('fs');\nconst path = require('path');\n\nconst pathFile = path.join(__dirname, 'path.txt');\n\nfunction getElectronPath () {\n let executablePath;\n if (fs.existsSync(pathFile)) {\n executablePath = fs.readFileSync(pathFile, 'utf-8');\n }\n if (process.env.ELECTRON_OVERRIDE_DIST_PATH) {\n return path.join(process.env.ELECTRON_OVERRIDE_DIST_PATH, executablePath || 'electron');\n }\n if (executablePath) {\n return path.join(__dirname, 'dist', executablePath);\n } else {\n throw new Error('Electron failed to install correctly, please delete node_modules/electron and try installing again');\n }\n}\n\nmodule.exports = getElectronPath();\n","/*\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport {\n deleteAccessToken,\n deleteTokenType,\n getAccessToken,\n getTokenType,\n setAccessToken,\n setTokenType,\n} from \"./storage.js\";\nimport { UserDetails } from \"@xwiki/cristal-authentication-api\";\nimport axios from \"axios\";\nimport { BrowserWindow, ipcMain } from \"electron\";\n\nfunction getAuthorizationValue() {\n return `${getTokenType()} ${getAccessToken()}`;\n}\n\nexport function load(\n browserWindow: BrowserWindow,\n reload: (win: BrowserWindow) => void,\n): void {\n ipcMain.handle(\n \"authentication:github:login\",\n async (\n _event,\n {\n baseUrl,\n deviceCode,\n interval,\n expiresIn,\n }: {\n baseUrl: string;\n deviceCode: string;\n interval: string;\n expiresIn: string;\n },\n ) => {\n const verificationUrl = new URL(`${baseUrl}/device-verify`);\n verificationUrl.searchParams.set(\"device_code\", deviceCode);\n\n // This converts the interval polling time and expiration time provided by\n // GitHub to milliseconds.\n // We need to add a little more delay to the interval when polling, just to\n // be sure that we don't go to fast for GitHub (or we might get rate\n // limited).\n const intervalMs: number = parseInt(interval) * 1000 + 500;\n let expiresInMs: number = parseInt(expiresIn) * 1000;\n\n // This interval handles polling the backend for the access token, using\n // the interval time computed earlier.\n // The backend will return an error until the login process has succeeded.\n const intervalId = setInterval(async () => {\n const response = await fetch(verificationUrl);\n const jsonResponse: {\n error?: string;\n access_token?: string;\n token_type?: string;\n } = await response.json();\n if (!jsonResponse.error) {\n setAccessToken(jsonResponse.access_token!);\n setTokenType(jsonResponse.token_type!);\n clearInterval(intervalId);\n // We reload the content on successful login.\n reload(browserWindow);\n } else if (expiresInMs <= 0) {\n clearInterval(intervalId);\n }\n expiresInMs -= intervalMs;\n }, intervalMs);\n },\n );\n\n ipcMain.handle(\"authentication:github:isLoggedIn\", () => {\n const tokenType = getTokenType();\n const accessTokenKey = getAccessToken();\n return tokenType && accessTokenKey;\n });\n\n ipcMain.handle(\n \"authentication:github:userDetails\",\n async (): Promise<UserDetails> => {\n const userinfoUrl = \"https://api.github.com/user\";\n const data = {\n headers: {\n Authorization: getAuthorizationValue(),\n },\n };\n const {\n data: { login, html_url, name, avatar_url },\n } = await axios.get(userinfoUrl, data);\n\n return { profile: html_url, username: login, name, avatar: avatar_url };\n },\n );\n ipcMain.handle(\"authentication:github:authorizationValue\", () => {\n return {\n tokenType: getTokenType(),\n accessToken: getAccessToken(),\n };\n });\n ipcMain.handle(\"authentication:github:logout\", () => {\n deleteAccessToken();\n deleteTokenType();\n });\n}\n"],"names":["tokenTypeKey","accessTokenKey","schema","storeInstance","Store","set","key","value","get","rm","setTokenType","setAccessToken","getTokenType","getAccessToken","deleteTokenType","deleteAccessToken","fs","require$$0","path","require$$1","pathFile","getElectronPath","executablePath","electron","getAuthorizationValue","load","browserWindow","reload","ipcMain","_event","baseUrl","deviceCode","interval","expiresIn","verificationUrl","intervalMs","expiresInMs","intervalId","jsonResponse","tokenType","userinfoUrl","data","login","html_url","name","avatar_url","axios"],"mappings":"qVAsBA,MAAMA,EAAe,YAEfC,EAAiB,cAEjBC,EAAS,CACb,UAAW,CACT,KAAM,QACR,EAEA,YAAa,CACX,KAAM,QAAA,CAEV,EAEMC,EAAuB,IAAIC,EAAM,CACrC,KAAM,6BACN,OAAAF,CAEF,CAAC,EAED,SAASG,EAAOC,EAAaC,EAAU,CAEvBJ,EAAA,IAAIG,EAAKC,CAAK,CAC9B,CAEA,SAASC,EAAOF,EAAgB,CAEvB,OAAAH,EAAc,IAAIG,CAAG,CAC9B,CAEA,SAASG,EAAGH,EAAa,CAEvBH,EAAc,OAAOG,CAAG,CAC1B,CAEA,SAASI,EAAaH,EAAqB,CACzCF,EAAIL,EAAcO,CAAK,CACzB,CAEA,SAASI,EAAeJ,EAAqB,CAC3CF,EAAIJ,EAAgBM,CAAK,CAC3B,CAEA,SAASK,GAAuB,CAC9B,OAAOJ,EAAIR,CAAY,CACzB,CAEA,SAASa,GAAyB,CAChC,OAAOL,EAAIP,CAAc,CAC3B,CAEA,SAASa,GAAwB,CAC/BL,EAAGT,CAAY,CACjB,CAEA,SAASe,GAA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AAA,QAAA,OACN,oCACA,SAAkC,CAChC,MAAMY,EAAc,8BACdC,EAAO,CACX,QAAS,CACP,cAAejB,EAAsB,CAAA,CAEzC,EACM,CACJ,KAAM,CAAE,MAAAkB,EAAO,SAAAC,EAAU,KAAAC,EAAM,WAAAC,CAAW,CACxC,EAAA,MAAMC,EAAM,IAAIN,EAAaC,CAAI,EAErC,MAAO,CAAE,QAASE,EAAU,SAAUD,EAAO,KAAAE,EAAM,OAAQC,CAAW,CAAA,CAE1E,EACQjB,UAAA,OAAO,2CAA4C,KAClD,CACL,UAAWhB,EAAa,EACxB,YAAaC,EAAe,CAC9B,EACD,EACOe,UAAA,OAAO,+BAAgC,IAAM,CACjCb,EAAA,EACFD,EAAA,CAAA,CACjB,CACH","x_google_ignoreList":[2]}
|
|
1
|
+
{"version":3,"file":"index.umd.js","sources":["../src/storage.ts","../__vite-browser-external","../../../../../node_modules/.pnpm/electron@37.2.5/node_modules/electron/index.js","../src/index.ts"],"sourcesContent":["/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport Store from \"electron-store\";\n\nconst tokenTypeKey = \"tokenType\";\n\nconst accessTokenKey = \"accessToken\";\n\nconst schema = {\n tokenType: {\n type: \"string\",\n },\n\n accessToken: {\n type: \"string\",\n },\n};\n\nconst storeInstance: Store = new Store({\n name: \"authentication-github-main\",\n schema,\n // TODO: add encryption key\n});\n\nfunction set<T>(key: string, value: T) {\n // @ts-expect-error type resolution failing because of electron-store library bug\n storeInstance.set(key, value);\n}\n\nfunction get<T>(key: string): T {\n // @ts-expect-error type resolution failing because of electron-store library bug\n return storeInstance.get(key) as T;\n}\n\nfunction rm(key: string) {\n // @ts-expect-error type resolution failing because of electron-store library bug\n storeInstance.delete(key);\n}\n\nfunction setTokenType(value: string): void {\n set(tokenTypeKey, value);\n}\n\nfunction setAccessToken(value: string): void {\n set(accessTokenKey, value);\n}\n\nfunction getTokenType(): string {\n return get(tokenTypeKey);\n}\n\nfunction getAccessToken(): string {\n return get(accessTokenKey);\n}\n\nfunction deleteTokenType(): void {\n rm(tokenTypeKey);\n}\n\nfunction deleteAccessToken(): void {\n rm(accessTokenKey);\n}\n\nexport {\n deleteAccessToken,\n deleteTokenType,\n getAccessToken,\n getTokenType,\n setAccessToken,\n setTokenType,\n};\n","export default {}","const fs = require('fs');\nconst path = require('path');\n\nconst pathFile = path.join(__dirname, 'path.txt');\n\nfunction getElectronPath () {\n let executablePath;\n if (fs.existsSync(pathFile)) {\n executablePath = fs.readFileSync(pathFile, 'utf-8');\n }\n if (process.env.ELECTRON_OVERRIDE_DIST_PATH) {\n return path.join(process.env.ELECTRON_OVERRIDE_DIST_PATH, executablePath || 'electron');\n }\n if (executablePath) {\n return path.join(__dirname, 'dist', executablePath);\n } else {\n throw new Error('Electron failed to install correctly, please delete node_modules/electron and try installing again');\n }\n}\n\nmodule.exports = getElectronPath();\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport {\n deleteAccessToken,\n deleteTokenType,\n getAccessToken,\n getTokenType,\n setAccessToken,\n setTokenType,\n} from \"./storage.js\";\nimport { UserDetails } from \"@xwiki/cristal-authentication-api\";\nimport axios from \"axios\";\nimport { BrowserWindow, ipcMain } from \"electron\";\n\nfunction getAuthorizationValue() {\n return `${getTokenType()} ${getAccessToken()}`;\n}\n\nexport function load(\n browserWindow: BrowserWindow,\n reload: (win: BrowserWindow) => void,\n): void {\n ipcMain.handle(\n \"authentication:github:login\",\n async (\n _event,\n {\n baseUrl,\n deviceCode,\n interval,\n expiresIn,\n }: {\n baseUrl: string;\n deviceCode: string;\n interval: string;\n expiresIn: string;\n },\n ) => {\n const verificationUrl = new URL(`${baseUrl}/device-verify`);\n verificationUrl.searchParams.set(\"device_code\", deviceCode);\n\n // This converts the interval polling time and expiration time provided by\n // GitHub to milliseconds.\n // We need to add a little more delay to the interval when polling, just to\n // be sure that we don't go to fast for GitHub (or we might get rate\n // limited).\n const intervalMs: number = parseInt(interval) * 1000 + 500;\n let expiresInMs: number = parseInt(expiresIn) * 1000;\n\n // This interval handles polling the backend for the access token, using\n // the interval time computed earlier.\n // The backend will return an error until the login process has succeeded.\n const intervalId = setInterval(async () => {\n const response = await fetch(verificationUrl);\n const jsonResponse: {\n error?: string;\n access_token?: string;\n token_type?: string;\n } = await response.json();\n if (!jsonResponse.error) {\n setAccessToken(jsonResponse.access_token!);\n setTokenType(jsonResponse.token_type!);\n clearInterval(intervalId);\n // We reload the content on successful login.\n reload(browserWindow);\n } else if (expiresInMs <= 0) {\n clearInterval(intervalId);\n }\n expiresInMs -= intervalMs;\n }, intervalMs);\n },\n );\n\n ipcMain.handle(\"authentication:github:isLoggedIn\", () => {\n const tokenType = getTokenType();\n const accessTokenKey = getAccessToken();\n return tokenType && accessTokenKey;\n });\n\n ipcMain.handle(\n \"authentication:github:userDetails\",\n async (): Promise<UserDetails> => {\n const userinfoUrl = \"https://api.github.com/user\";\n const data = {\n headers: {\n Authorization: getAuthorizationValue(),\n },\n };\n const {\n data: { login, html_url, name, avatar_url },\n } = await axios.get(userinfoUrl, data);\n\n return { profile: html_url, username: login, name, avatar: avatar_url };\n },\n );\n ipcMain.handle(\"authentication:github:authorizationValue\", () => {\n return {\n tokenType: getTokenType(),\n accessToken: getAccessToken(),\n };\n });\n ipcMain.handle(\"authentication:github:logout\", () => {\n deleteAccessToken();\n deleteTokenType();\n });\n}\n"],"names":["tokenTypeKey","accessTokenKey","schema","storeInstance","Store","set","key","value","get","rm","setTokenType","setAccessToken","getTokenType","getAccessToken","deleteTokenType","deleteAccessToken","fs","require$$0","path","require$$1","pathFile","getElectronPath","executablePath","electron","getAuthorizationValue","load","browserWindow","reload","ipcMain","_event","baseUrl","deviceCode","interval","expiresIn","verificationUrl","intervalMs","expiresInMs","intervalId","jsonResponse","tokenType","userinfoUrl","data","login","html_url","name","avatar_url","axios"],"mappings":"qVAsBA,MAAMA,EAAe,YAEfC,EAAiB,cAEjBC,EAAS,CACb,UAAW,CACT,KAAM,QAAA,EAGR,YAAa,CACX,KAAM,QAAA,CAEV,EAEMC,EAAuB,IAAIC,EAAM,CACrC,KAAM,6BACN,OAAAF,CAEF,CAAC,EAED,SAASG,EAAOC,EAAaC,EAAU,CAErCJ,EAAc,IAAIG,EAAKC,CAAK,CAC9B,CAEA,SAASC,EAAOF,EAAgB,CAE9B,OAAOH,EAAc,IAAIG,CAAG,CAC9B,CAEA,SAASG,EAAGH,EAAa,CAEvBH,EAAc,OAAOG,CAAG,CAC1B,CAEA,SAASI,EAAaH,EAAqB,CACzCF,EAAIL,EAAcO,CAAK,CACzB,CAEA,SAASI,EAAeJ,EAAqB,CAC3CF,EAAIJ,EAAgBM,CAAK,CAC3B,CAEA,SAASK,GAAuB,CAC9B,OAAOJ,EAAIR,CAAY,CACzB,CAEA,SAASa,GAA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AM,CACvD,MAAMW,EAAY3B,EAAA,EACZX,EAAiBY,EAAA,EACvB,OAAO0B,GAAatC,CACtB,CAAC,EAED2B,EAAAA,QAAQ,OACN,oCACA,SAAkC,CAChC,MAAMY,EAAc,8BACdC,EAAO,CACX,QAAS,CACP,cAAejB,EAAA,CAAsB,CACvC,EAEI,CACJ,KAAM,CAAE,MAAAkB,EAAO,SAAAC,EAAU,KAAAC,EAAM,WAAAC,CAAA,CAAW,EACxC,MAAMC,EAAM,IAAIN,EAAaC,CAAI,EAErC,MAAO,CAAE,QAASE,EAAU,SAAUD,EAAO,KAAAE,EAAM,OAAQC,CAAA,CAC7D,CAAA,EAEFjB,UAAQ,OAAO,2CAA4C,KAClD,CACL,UAAWhB,EAAA,EACX,YAAaC,EAAA,CAAe,EAE/B,EACDe,UAAQ,OAAO,+BAAgC,IAAM,CACnDb,EAAA,EACAD,EAAA,CACF,CAAC,CACH","x_google_ignoreList":[2]}
|
package/dist/storage.d.ts
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* See the LICENSE file distributed with this work for additional
|
|
3
|
+
* information regarding copyright ownership.
|
|
4
|
+
*
|
|
5
|
+
* This is free software; you can redistribute it and/or modify it
|
|
6
|
+
* under the terms of the GNU Lesser General Public License as
|
|
7
|
+
* published by the Free Software Foundation; either version 2.1 of
|
|
8
|
+
* the License, or (at your option) any later version.
|
|
9
|
+
*
|
|
10
|
+
* This software is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
13
|
+
* Lesser General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Lesser General Public
|
|
16
|
+
* License along with this software; if not, write to the Free
|
|
17
|
+
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
|
18
|
+
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
|
19
|
+
*/
|
|
1
20
|
declare function setTokenType(value: string): void;
|
|
2
21
|
declare function setAccessToken(value: string): void;
|
|
3
22
|
declare function getTokenType(): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xwiki/cristal-electron-authentication-github-main",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"license": "LGPL 2.1",
|
|
5
5
|
"author": "XWiki Org Community <contact@xwiki.org>",
|
|
6
6
|
"homepage": "https://cristal.xwiki.org/",
|
|
@@ -27,17 +27,17 @@
|
|
|
27
27
|
},
|
|
28
28
|
"main": "./dist/index.es.js",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"axios": "1.
|
|
30
|
+
"axios": "1.11.0",
|
|
31
31
|
"electron-store": "10.1.0",
|
|
32
|
-
"@xwiki/cristal-authentication-api": "0.
|
|
32
|
+
"@xwiki/cristal-authentication-api": "0.21.0"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"electron": "37.
|
|
35
|
+
"electron": "37.2.5"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"typescript": "5.
|
|
39
|
-
"vite": "7.0.
|
|
40
|
-
"@xwiki/cristal-dev-config": "0.
|
|
38
|
+
"typescript": "5.9.2",
|
|
39
|
+
"vite": "7.0.6",
|
|
40
|
+
"@xwiki/cristal-dev-config": "0.21.0"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
43
|
"build": "tsc --project tsconfig.json && vite build",
|
package/src/index.ts
CHANGED
package/src/storage.ts
CHANGED
package/vite.config.ts
CHANGED
package/vitest.config.ts
CHANGED