pusher-platform-node
Advanced tools
Comparing version 0.11.0 to 0.11.1
# Change Log | ||
This project adheres to [Semantic Versioning Scheme](http://semver.org) | ||
## Unreleased | ||
Nothing, yet. | ||
## [v0.11.1] 2018-01-26 | ||
### Changes | ||
- Tokens now use `instance` claim instead of `app` claim | ||
## [v0.11.0] 2018-01-26 | ||
@@ -5,0 +16,0 @@ |
{ | ||
"name": "pusher-platform-node", | ||
"version": "0.11.0", | ||
"version": "0.11.1", | ||
"main": "./target/index.js", | ||
@@ -5,0 +5,0 @@ "types": "./target/index.d.ts", |
@@ -29,5 +29,5 @@ import {IncomingMessage} from "http"; | ||
constructor( | ||
private appId: string, | ||
private appKeyId: string, | ||
private appKeySecret: string, | ||
private instanceId: string, | ||
private instanceKeyId: string, | ||
private instanceKeySecret: string, | ||
@@ -72,4 +72,4 @@ //Customise token expiry | ||
try { | ||
decoded = jwt.verify(oldRefreshToken, this.appKeySecret, { | ||
issuer: `keys/${this.appKeyId}`, | ||
decoded = jwt.verify(oldRefreshToken, this.instanceKeySecret, { | ||
issuer: `keys/${this.instanceKeyId}`, | ||
}); | ||
@@ -105,4 +105,4 @@ } catch (e) { | ||
let claims = { | ||
app: this.appId, | ||
iss: `api_keys/${this.appKeyId}`, | ||
instance: this.instanceId, | ||
iss: `api_keys/${this.instanceKeyId}`, | ||
iat: now, | ||
@@ -116,3 +116,3 @@ exp: now + tokenExpiry, | ||
return { | ||
token: jwt.sign(claims, this.appKeySecret), | ||
token: jwt.sign(claims, this.instanceKeySecret), | ||
expires_in: tokenExpiry, | ||
@@ -126,4 +126,4 @@ }; | ||
let claims = { | ||
app: this.appId, | ||
iss: `api_keys/${this.appKeyId}`, | ||
instance: this.instanceId, | ||
iss: `api_keys/${this.instanceKeyId}`, | ||
iat: now, | ||
@@ -135,5 +135,5 @@ refresh: true, | ||
return { | ||
token: jwt.sign(claims, this.appKeySecret), | ||
token: jwt.sign(claims, this.instanceKeySecret), | ||
}; | ||
} | ||
} |
@@ -16,7 +16,7 @@ import { AuthenticateOptions, AuthenticatePayload } from "./common"; | ||
export default class Authenticator { | ||
private appId; | ||
private appKeyId; | ||
private appKeySecret; | ||
private instanceId; | ||
private instanceKeyId; | ||
private instanceKeySecret; | ||
private tokenExpiry; | ||
constructor(appId: string, appKeyId: string, appKeySecret: string, tokenExpiry?: number); | ||
constructor(instanceId: string, instanceKeyId: string, instanceKeySecret: string, tokenExpiry?: number); | ||
authenticate(authenticatePayload: AuthenticatePayload, options: AuthenticateOptions): AuthenticationResponse; | ||
@@ -23,0 +23,0 @@ private authenticateWithClientCredentials(options); |
@@ -17,8 +17,8 @@ "use strict"; | ||
var Authenticator = (function () { | ||
function Authenticator(appId, appKeyId, appKeySecret, | ||
function Authenticator(instanceId, instanceKeyId, instanceKeySecret, | ||
//Customise token expiry | ||
tokenExpiry) { | ||
this.appId = appId; | ||
this.appKeyId = appKeyId; | ||
this.appKeySecret = appKeySecret; | ||
this.instanceId = instanceId; | ||
this.instanceKeyId = instanceKeyId; | ||
this.instanceKeySecret = instanceKeySecret; | ||
this.tokenExpiry = tokenExpiry; | ||
@@ -56,4 +56,4 @@ if (!this.tokenExpiry) { | ||
try { | ||
decoded = jwt.verify(oldRefreshToken, this.appKeySecret, { | ||
issuer: "keys/" + this.appKeyId, | ||
decoded = jwt.verify(oldRefreshToken, this.instanceKeySecret, { | ||
issuer: "keys/" + this.instanceKeyId, | ||
}); | ||
@@ -83,5 +83,5 @@ } | ||
var tokenExpiry = options.tokenExpiry || this.tokenExpiry; | ||
var claims = __assign({ app: this.appId, iss: "api_keys/" + this.appKeyId, iat: now, exp: now + tokenExpiry, sub: options.userId, su: options.su }, options.serviceClaims); | ||
var claims = __assign({ instance: this.instanceId, iss: "api_keys/" + this.instanceKeyId, iat: now, exp: now + tokenExpiry, sub: options.userId, su: options.su }, options.serviceClaims); | ||
return { | ||
token: jwt.sign(claims, this.appKeySecret), | ||
token: jwt.sign(claims, this.instanceKeySecret), | ||
expires_in: tokenExpiry, | ||
@@ -93,4 +93,4 @@ }; | ||
var claims = { | ||
app: this.appId, | ||
iss: "api_keys/" + this.appKeyId, | ||
instance: this.instanceId, | ||
iss: "api_keys/" + this.instanceKeyId, | ||
iat: now, | ||
@@ -101,3 +101,3 @@ refresh: true, | ||
return { | ||
token: jwt.sign(claims, this.appKeySecret), | ||
token: jwt.sign(claims, this.instanceKeySecret), | ||
}; | ||
@@ -104,0 +104,0 @@ }; |
Sorry, the diff of this file is not supported yet
61270
31