Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

validate-github-token

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

validate-github-token - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

1

index.d.ts

@@ -6,2 +6,3 @@ /// <reference types="node" />

excluded?: string[];
exact?: string[];
}

@@ -8,0 +9,0 @@ export interface ValidateOptions {

@@ -79,2 +79,10 @@ "use strict";

}
if (validation.exact) {
const want = validation.exact;
if (want.some(s => !scopes.includes(s)) || scopes.some(s => !want.includes(s))) {
const got = JSON.stringify(scopes);
const expected = JSON.stringify(want);
throw new ValidationError(`The token's scopes ${got} don't exactly match to the expected scopes ${expected}`);
}
}
}

@@ -81,0 +89,0 @@ return scopes;

3

package.json
{
"name": "validate-github-token",
"version": "1.0.1",
"version": "1.1.0",
"description": "Validation for GitHub API token",

@@ -19,2 +19,3 @@ "main": "index.js",

"lint": "eslint '**/*.ts'",
"prepublishOnly": "npm-run-all -p lint test",
"test": "npm-run-all build mocha"

@@ -21,0 +22,0 @@ },

@@ -21,4 +21,7 @@ GitHub API Token Validation for Node.js

This package was created to make a human-friendly error before actually calling GitHub APIs mainly
for [GitHub Action][gh-action].
## Installation

@@ -43,3 +46,3 @@

// Checks 'public_repo' scope is added to the token
included: 'public_repo'
included: ['public_repo']
}

@@ -80,2 +83,3 @@ }

- `excluded: Array<string>`: Scope names which should NOT be added to the token **Optional**
- `exact: Array<string>`: Scope names should exactly match to scopes of the token **Optional**
- `agent: https.Agent`: Node.js HTTPS agent. For example please pass [https-proxy-agent][proxy] for proxy support **Optional**

@@ -153,1 +157,2 @@ - `endpointUrl: string`: Custom API endpoint URL. Deafult value is `"https://api.github.com"` **Optional**

[npm-badge]: https://badge.fury.io/js/validate-github-token.svg
[gh-action]: https://github.com/features/actions
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc