Comparing version 1.2.3 to 2.0.0
{ | ||
"name": "gtoken", | ||
"version": "1.2.3", | ||
"version": "2.0.0", | ||
"description": "Node.js Google Authentication Service Account Tokens", | ||
"main": "./lib/index.js", | ||
"main": "./build/src/index.js", | ||
"types": "./build/src/index.d.ts", | ||
"repository": { | ||
@@ -11,3 +12,11 @@ "type": "git", | ||
"scripts": { | ||
"test": "mocha --timeout 5000" | ||
"check": "gts check", | ||
"clean": "gts clean", | ||
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json", | ||
"fix": "gts fix", | ||
"compile": "tsc -p .", | ||
"test": "nyc mocha build/test --timeout 5000 --require source-map-support/register", | ||
"prepare": "npm run compile", | ||
"pretest": "npm run compile", | ||
"posttest": "npm run check" | ||
}, | ||
@@ -28,10 +37,29 @@ "keywords": [ | ||
"dependencies": { | ||
"google-p12-pem": "^0.1.0", | ||
"axios": "^0.17.0", | ||
"google-p12-pem": "^1.0.0", | ||
"jws": "^3.0.0", | ||
"mime": "^1.4.1", | ||
"request": "^2.72.0" | ||
"mime": "^2.0.3", | ||
"pify": "^3.0.0" | ||
}, | ||
"devDependencies": { | ||
"mocha": "^3.4.2" | ||
} | ||
"@types/jws": "^3.1.0", | ||
"@types/mime": "^2.0.0", | ||
"@types/mocha": "^2.2.43", | ||
"@types/nock": "^8.2.1", | ||
"@types/node": "^8.0.47", | ||
"@types/pify": "^3.0.0", | ||
"codecov": "^3.0.0", | ||
"gts": "^0.5.1", | ||
"mocha": "^4.0.1", | ||
"nock": "^9.0.27", | ||
"nyc": "^11.2.1", | ||
"source-map-support": "^0.5.0", | ||
"typescript": "~2.6.0" | ||
}, | ||
"files": [ | ||
"build/src", | ||
"LICENSE", | ||
"packge.json", | ||
"README.md" | ||
] | ||
} |
# node-gtoken | ||
[![NPM Version][npm-image]][npm-url] | ||
[![Build Status][travis-image]][travis-url] | ||
[![Dependency Status][david-image]][david-url] | ||
[![devDependency Status][david-dev-image]][david-dev-url] | ||
[![Known Vulnerabilities][snyk-image]][snyk-url] | ||
[![codecov][codecov-image]][codecov-url] | ||
[![Greenkeeper badge][greenkeeper-image]][greenkeeper-url] | ||
Node.js Google Authentication Service Account Tokens | ||
[![Build Status](https://travis-ci.org/google/node-gtoken.svg?branch=master)](https://travis-ci.org/google/node-gtoken) | ||
[![dependencies Status](https://david-dm.org/google/node-gtoken/status.svg)](https://david-dm.org/google/node-gtoken) | ||
[![Known Vulnerabilities](https://snyk.io/test/npm/google-p12-pem/badge.svg)](https://snyk.io/test/npm/google-p12-pem) | ||
## Installation | ||
@@ -20,4 +24,4 @@ | ||
``` js | ||
var GoogleToken = require('gtoken'); | ||
var gtoken = GoogleToken({ | ||
const GoogleToken = require('gtoken'); | ||
const gtoken = new GoogleToken({ | ||
keyFile: 'path/to/key.pem', // or path to .p12 key file | ||
@@ -37,7 +41,24 @@ email: 'my_service_account_email@developer.gserviceaccount.com', | ||
You can also use the async/await style API: | ||
``` js | ||
const token = await gtoken.getToken() | ||
console.log(token); | ||
``` | ||
Or use promises: | ||
```js | ||
gtoken.getToken() | ||
.then(token => { | ||
console.log(`Token: ${token}`) | ||
}) | ||
.catch(e => console.error); | ||
``` | ||
### Use with a service account `.json` key file: | ||
``` js | ||
var GoogleToken = require('gtoken'); | ||
var gtoken = GoogleToken({ | ||
const GoogleToken = require('gtoken'); | ||
const gtoken = new GoogleToken({ | ||
keyFile: 'path/to/key.json', | ||
@@ -59,5 +80,5 @@ scope: ['https://scope1', 'https://scope2'] // or space-delimited string of scopes | ||
``` js | ||
var key = '-----BEGIN RSA PRIVATE KEY-----\nXXXXXXXXXXX...'; | ||
var GoogleToken = require('gtoken'); | ||
var gtoken = GoogleToken({ | ||
const key = '-----BEGIN RSA PRIVATE KEY-----\nXXXXXXXXXXX...'; | ||
const GoogleToken = require('gtoken'); | ||
const gtoken = new GoogleToken({ | ||
email: 'my_service_account_email@developer.gserviceaccount.com', | ||
@@ -95,5 +116,5 @@ scope: ['https://scope1', 'https://scope2'], // or space-delimited string of scopes | ||
- `gtoken.token`: The access token. | ||
- `gtoken.expires_at`: The expiry date as milliseconds since 1970/01/01 | ||
- `gtoken.expiresAt`: The expiry date as milliseconds since 1970/01/01 | ||
- `gtoken.key`: The raw key value. | ||
- `gtoken.raw_token`: Most recent raw token data received from Google. | ||
- `gtoken.rawToken`: Most recent raw token data received from Google. | ||
@@ -142,6 +163,32 @@ ### .hasExpired() | ||
## Changelog | ||
### 1.2.2 -> 2.0.0 | ||
New features: | ||
- API now supports callback and promise based workflows | ||
Breaking changes: | ||
- `GoogleToken` is now a class type, and must be instantiated. | ||
- `GoogleToken.expires_at` renamed to `GoogleToken.expiresAt` | ||
- `GoogleToken.raw_token` renamed to `GoogleToken.rawToken` | ||
- `GoogleToken.token_expires` renamed to `GoogleToken.tokenExpires` | ||
## License | ||
MIT | ||
[MIT](LICENSE) | ||
[gdevconsole]: https://console.developers.google.com | ||
[npm-image]: https://img.shields.io/npm/v/gtoken.svg | ||
[npm-url]: https://npmjs.org/package/gtoken | ||
[travis-image]: https://travis-ci.org/google/node-gtoken.svg?branch=master | ||
[travis-url]: https://travis-ci.org/google/node-gtoken | ||
[david-image]: https://david-dm.org/google/node-gtoken.svg | ||
[david-url]: https://david-dm.org/google/node-gtoken | ||
[david-dev-image]: https://david-dm.org/google/node-gtoken/dev-status.svg | ||
[david-dev-url]: https://david-dm.org/google/node-gtoken?type=dev | ||
[snyk-image]: https://snyk.io/test/github/google/node-gtoken/badge.svg | ||
[snyk-url]: https://snyk.io/test/github/google/node-gtoken | ||
[codecov-image]: https://codecov.io/gh/google/node-gtoken/branch/master/graph/badge.svg | ||
[codecov-url]: https://codecov.io/gh/google/node-gtoken | ||
[greenkeeper-image]: https://badges.greenkeeper.io/google/node-gtoken.svg | ||
[greenkeeper-url]: https://greenkeeper.io/ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
190
1
26436
5
13
6
319
+ Addedaxios@^0.17.0
+ Addedpify@^3.0.0
+ Addedaxios@0.17.1(transitive)
+ Addedfollow-redirects@1.15.9(transitive)
+ Addedgoogle-p12-pem@1.0.5(transitive)
+ Addedis-buffer@1.1.6(transitive)
+ Addedmime@2.6.0(transitive)
+ Addednode-forge@0.10.0(transitive)
+ Addedpify@3.0.04.0.1(transitive)
- Removedrequest@^2.72.0
- Removedajv@6.12.6(transitive)
- Removedasn1@0.2.6(transitive)
- Removedassert-plus@1.0.0(transitive)
- Removedasynckit@0.4.0(transitive)
- Removedaws-sign2@0.7.0(transitive)
- Removedaws4@1.13.2(transitive)
- Removedbcrypt-pbkdf@1.0.2(transitive)
- Removedcaseless@0.12.0(transitive)
- Removedcombined-stream@1.0.8(transitive)
- Removedcore-util-is@1.0.2(transitive)
- Removeddashdash@1.14.1(transitive)
- Removeddelayed-stream@1.0.0(transitive)
- Removedecc-jsbn@0.1.2(transitive)
- Removedextend@3.0.2(transitive)
- Removedextsprintf@1.3.0(transitive)
- Removedfast-deep-equal@3.1.3(transitive)
- Removedfast-json-stable-stringify@2.1.0(transitive)
- Removedforever-agent@0.6.1(transitive)
- Removedform-data@2.3.3(transitive)
- Removedgetpass@0.1.7(transitive)
- Removedgoogle-p12-pem@0.1.2(transitive)
- Removedhar-schema@2.0.0(transitive)
- Removedhar-validator@5.1.5(transitive)
- Removedhttp-signature@1.2.0(transitive)
- Removedis-typedarray@1.0.0(transitive)
- Removedisstream@0.1.2(transitive)
- Removedjsbn@0.1.1(transitive)
- Removedjson-schema@0.4.0(transitive)
- Removedjson-schema-traverse@0.4.1(transitive)
- Removedjson-stringify-safe@5.0.1(transitive)
- Removedjsprim@1.4.2(transitive)
- Removedmime@1.6.0(transitive)
- Removedmime-db@1.52.0(transitive)
- Removedmime-types@2.1.35(transitive)
- Removednode-forge@0.7.6(transitive)
- Removedoauth-sign@0.9.0(transitive)
- Removedperformance-now@2.1.0(transitive)
- Removedpsl@1.10.0(transitive)
- Removedpunycode@2.3.1(transitive)
- Removedqs@6.5.3(transitive)
- Removedrequest@2.88.2(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsshpk@1.18.0(transitive)
- Removedtough-cookie@2.5.0(transitive)
- Removedtunnel-agent@0.6.0(transitive)
- Removedtweetnacl@0.14.5(transitive)
- Removeduri-js@4.4.1(transitive)
- Removeduuid@3.4.0(transitive)
- Removedverror@1.10.0(transitive)
Updatedgoogle-p12-pem@^1.0.0
Updatedmime@^2.0.3