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

onesignal-node

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

onesignal-node - npm Package Compare versions

Comparing version 3.2.1 to 3.3.0

18

lib/client.d.ts

@@ -165,3 +165,21 @@ import { ClientOptions, Options, ClientResponse, ViewNotificationsQuery, NotificationHistoryBody, CreateNotificationBody, LimitOffsetQuery, AddDeviceBody, EditDeviceBody, NewSessionBody, NewPurchaseBody, IncrementSessionLengthBody, ExportCSVBody, CreateSegmentBody, EditTagsBody } from './types';

deleteDevice(deviceId: string): Promise<ClientResponse>;
/**
* Sign user external id using client REST key to use on the client-side code
* Reference: https://documentation.onesignal.com/docs/identity-verification
*
* @param {string} id User id to be signed
*
* @return {string} Signed user external id
*/
signUserExternalId(id: string | number): string;
/**
* Sign user email using client REST key to use on the client-side code
* Reference: https://documentation.onesignal.com/docs/identity-verification
*
* @param {string} email Email to be signed
*
* @return {string} Signed email
*/
signUserEmail(email: string): string;
}
//# sourceMappingURL=client.d.ts.map

@@ -240,4 +240,26 @@ "use strict";

}
/**
* Sign user external id using client REST key to use on the client-side code
* Reference: https://documentation.onesignal.com/docs/identity-verification
*
* @param {string} id User id to be signed
*
* @return {string} Signed user external id
*/
signUserExternalId(id) {
return utils_1.signStringWithKey(id.toString(), this.apiKey);
}
/**
* Sign user email using client REST key to use on the client-side code
* Reference: https://documentation.onesignal.com/docs/identity-verification
*
* @param {string} email Email to be signed
*
* @return {string} Signed email
*/
signUserEmail(email) {
return utils_1.signStringWithKey(email, this.apiKey);
}
}
exports.Client = Client;
//# sourceMappingURL=client.js.map

@@ -39,2 +39,11 @@ import * as request from 'request';

export declare const basicAuthRequest: (uri: string, method: string, authKey: string, body?: {} | undefined) => Promise<request.ResponseAsJSON>;
/**
* Sign any string payload using specified private key
* Reference: https://documentation.onesignal.com/docs/identity-verification#auth-hash-generation
*
* @param {string} payload String to be signed
* @param {string} key Private REST key
* @return {string} Signed payload
*/
export declare const signStringWithKey: (payload: string, key: string) => string;
//# sourceMappingURL=utils.d.ts.map

16

lib/utils.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.basicAuthRequest = exports.jsonToQueryString = exports.stripTrailingSlash = void 0;
exports.signStringWithKey = exports.basicAuthRequest = exports.jsonToQueryString = exports.stripTrailingSlash = void 0;
const crypto_1 = require("crypto");
const request = require("request");

@@ -101,2 +102,15 @@ const errors_1 = require("./errors");

};
/**
* Sign any string payload using specified private key
* Reference: https://documentation.onesignal.com/docs/identity-verification#auth-hash-generation
*
* @param {string} payload String to be signed
* @param {string} key Private REST key
* @return {string} Signed payload
*/
exports.signStringWithKey = function signStringWithKey(payload, key) {
const hmac = crypto_1.createHmac('sha256', key);
hmac.update(payload);
return hmac.digest('hex');
};
//# sourceMappingURL=utils.js.map

2

package.json
{
"name": "onesignal-node",
"version": "3.2.1",
"version": "3.3.0",
"description": "A Node.js Library for OneSignal push notification service",

@@ -5,0 +5,0 @@ "engines": {

@@ -47,3 +47,4 @@ # onesignal-node

* [Increment Session Length](#increment-session-length)
* [CSV Export](#csv-export)
* [CSV Export](#csv-export)
* [Identity verification](#identity-verification)
* [Tests](#tests)

@@ -69,2 +70,6 @@ * [Contributing](#contributing)

```
OR
``` js
import * as OneSignal from 'onesignal-node';
```

@@ -412,2 +417,15 @@ ### Client Types:

```
### Identity Verification
https://documentation.onesignal.com/docs/identity-verification
You can use these simple helpers to sign user id or email to be used in client-side code.
```ts
.signUserExternalId(id: string | number): string
.signUserEmail(email: string): string
```
Each of these will return SHA-256 hash, that was generated using apiKey.

@@ -414,0 +432,0 @@ ## Tests

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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