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

gtoken

Package Overview
Dependencies
Maintainers
4
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gtoken - npm Package Compare versions

Comparing version 1.2.3 to 2.0.0

build/src/lib/index.d.ts

44

package.json
{
"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/
.travis.yml
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