@eclipse-che/che-e2e
Advanced tools
Comparing version 7.41.0-dev-0a9cb74 to 7.41.0-dev-fcb04b7
@@ -87,2 +87,22 @@ "use strict"; | ||
} | ||
async deletePublicSshKeyByName(authToken, keyName) { | ||
const gitHubApiSshURL = GitHubUtil_1.GITHUB_API_ENTRIPOINT_URL + 'user/keys'; | ||
const authHeader = { headers: { 'Authorization': 'token ' + authToken, 'Content-Type': 'application/json' } }; | ||
try { | ||
const response = await axios_1.default.get(gitHubApiSshURL, authHeader); | ||
const stringified = JSON.stringify(response.data); | ||
const arrayOfPublicKeys = JSON.parse(stringified); | ||
for (let entry of arrayOfPublicKeys) { | ||
if (entry.title === keyName) { | ||
this.removePublicSshKey(authToken, entry.id); | ||
break; | ||
} | ||
} | ||
} | ||
catch (error) { | ||
console.error('Cannot delete the ' + keyName + ' public key from the GitHub account'); | ||
console.error(error); | ||
throw error; | ||
} | ||
} | ||
async removeAllPublicSshKeys(authToken) { | ||
@@ -89,0 +109,0 @@ try { |
{ | ||
"name": "@eclipse-che/che-e2e", | ||
"version": "7.41.0-dev-0a9cb74", | ||
"version": "7.41.0-dev-fcb04b7", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -76,2 +76,21 @@ import { injectable } from 'inversify'; | ||
async deletePublicSshKeyByName(authToken: string, keyName: string) { | ||
const gitHubApiSshURL: string = GitHubUtil.GITHUB_API_ENTRIPOINT_URL + 'user/keys'; | ||
const authHeader = { headers: { 'Authorization': 'token ' + authToken, 'Content-Type': 'application/json' } }; | ||
try { | ||
const response = await axios.get(gitHubApiSshURL, authHeader); | ||
const stringified = JSON.stringify(response.data); | ||
const arrayOfPublicKeys = JSON.parse(stringified); | ||
for (let entry of arrayOfPublicKeys) { | ||
if (entry.title === keyName) { | ||
this.removePublicSshKey(authToken, entry.id); | ||
break; | ||
} | ||
} | ||
} catch (error) { | ||
console.error('Cannot delete the ' + keyName + ' public key from the GitHub account'); | ||
console.error(error); | ||
throw error; | ||
} | ||
} | ||
@@ -78,0 +97,0 @@ async removeAllPublicSshKeys(authToken: string) { |
Sorry, the diff of this file is not supported yet
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
1495101
20111
0