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

kscryp

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kscryp - npm Package Compare versions

Comparing version 1.0.14 to 1.0.15

2

package.json
{
"name": "kscryp",
"version": "1.0.14",
"version": "1.0.15",
"description": "Cryptography package with support for: JWT, RSA, MD5, SHA, Base64, HEX, JSON, Basic",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -11,4 +11,4 @@ const KsDp = require('ksdp');

/**
* @typedef {'json' | 'base64' | 'sha1' | 'sha256' | 'md5' | 'totp' | 'hash' | 'hex' | 'pkce' | 'hash' | 'basic' | 'token' | 'jwt' | 'checksum' } EnumAlgorithm
* @typedef {'json' | 'base64' | 'totp' | 'hash' | 'hex' | 'signature' | 'basic' | 'token' | 'jwt' | 'checksum' } EnumAlgorithmDecode
* @typedef {'json' | 'base64' | 'sha1' | 'sha256' | 'md5' | 'totp' | 'hash' | 'hex' | 'pkce' | 'hash' | 'basic' | 'token' | 'jwt' | 'rsa' | 'checksum' } EnumAlgorithm
* @typedef {'json' | 'base64' | 'totp' | 'hash' | 'hex' | 'signature' | 'basic' | 'token' | 'jwt' | 'checksum' | 'rsa' } EnumAlgorithmDecode
*/

@@ -29,3 +29,3 @@

* @description configure library
* @param {Object} opt
* @param {Object} [opt]
* @param {String} [opt.default=json]

@@ -43,5 +43,5 @@ * @param {Console} [opt.log]

* @description Encoded data from an algorithm
* @param {String|Number|Object} data
* @param {EnumAlgorithm} algorithm
* @param {Object} options config options based on selected algorithm.
* @param {EnumAlgorithm} [algorithm]
* @param {Object} [params]
* @param {String} [action=encode]
* @return {String} data

@@ -66,7 +66,7 @@ */

* @param {String|Number|Object} data
* @param {EnumAlgorithm} algorithm
* @param {Object} options Object config options based on selected algorithm.
* @param {EnumAlgorithm} [algorithm=json]
* @param {Object} [options] Object config options based on selected algorithm.
* @return {String|Buffer} data
*/
encode(data, algorithm, options) {
encode(data, algorithm = 'json', options = null) {
return this.run(algorithm, [data, options], "encode");

@@ -78,7 +78,7 @@ }

* @param {String|Number|Object} data String to decode
* @param {EnumAlgorithmDecode} algorithm
* @param {Object} options Object config options based on selected algorithm
* @param {EnumAlgorithmDecode} [algorithm=json]
* @param {Object} [options] Object config options based on selected algorithm
* @return {String|Object} data
*/
decode(data, algorithm, options) {
decode(data, algorithm = 'json', options = null) {
return this.run(algorithm, [data, options], "decode");

@@ -90,7 +90,7 @@ }

* @param {String|Number|Object} data String to decode
* @param {EnumAlgorithmDecode} algorithm
* @param {Object} options Object config options based on selected algorithm
* @param {EnumAlgorithmDecode} [algorithm=json]
* @param {Object} [options] Object config options based on selected algorithm
* @return {Boolean} data
*/
verify(data, algorithm, options) {
verify(data, algorithm = 'json', options = null) {
return this.run(algorithm, [data, options], "verify");

@@ -102,7 +102,7 @@ }

* @param {String|Number|Object} data String to decode
* @param {EnumAlgorithmDecode} algorithm
* @param {Object} options Object config options based on selected algorithm
* @param {EnumAlgorithmDecode} [algorithm=json]
* @param {Object} [options] Object config options based on selected algorithm
* @return {String|Buffer} data
*/
sign(data, algorithm, options) {
sign(data, algorithm = 'json', options = null) {
return this.run(algorithm, [data, options], "sign") ||

@@ -114,7 +114,7 @@ this.run(algorithm, [data, options], "encode");

* @description Encoded data from an algorithm
* @param {EnumAlgorithmDecode} algorithm
* @param {Object} options Object config options based on selected algorithm
* @param {EnumAlgorithmDecode} [algorithm=rsa]
* @param {Object} [options] Object config options based on selected algorithm
* @return {String|Buffer} data
*/
generate(algorithm, options) {
generate(algorithm = 'rsa', options = null) {
return this.run(algorithm, [options], "generate");

@@ -152,6 +152,6 @@ }

* @description get a certain algorithm implementation
* @param {String} algorithm
* @param {String} [algorithm=json]
* @returns {Object}
*/
get(algorithm) {
get(algorithm = 'json') {
return algorithm && this.drv.get({

@@ -158,0 +158,0 @@ name: algorithm || this.default,

@@ -10,6 +10,6 @@ class KsDriver {

* @param {String|Number|Object} data
* @param {Object} options Object config.
* @param {Object} [options] Object config.
* @return {String|Buffer} data
*/
encode(value, options) {
encode(data, options) {
return null;

@@ -21,6 +21,6 @@ }

* @param {String|Number|Object} data String to decode
* @param {Object} options Object config.
* @param {Object} [options] Object config.
* @return {String|Object} data
*/
decode(value, options) {
decode(data, options) {
return null;

@@ -32,6 +32,6 @@ }

* @param {String|Number|Object} data String to decode
* @param {Object} options Config options
* @param {Object} [options] Config options
* @return {Boolean} data
*/
verify(value, options) {
verify(data, options) {
return null;

@@ -43,6 +43,6 @@ }

* @param {String|Number|Object} data String to decode
* @param {Object} options Config options
* @param {Object} [options] Config options
* @return {String|Buffer} data
*/
sign(value, options) {
sign(data, options) {
return null;

@@ -49,0 +49,0 @@ }

@@ -9,8 +9,8 @@ export = KsCryp;

/**
* @typedef {'json' | 'base64' | 'sha1' | 'sha256' | 'md5' | 'totp' | 'hash' | 'hex' | 'pkce' | 'hash' | 'basic' | 'token' | 'jwt' | 'checksum' } EnumAlgorithm
* @typedef {'json' | 'base64' | 'totp' | 'hash' | 'hex' | 'signature' | 'basic' | 'token' | 'jwt' | 'checksum' } EnumAlgorithmDecode
* @typedef {'json' | 'base64' | 'sha1' | 'sha256' | 'md5' | 'totp' | 'hash' | 'hex' | 'pkce' | 'hash' | 'basic' | 'token' | 'jwt' | 'rsa' | 'checksum' } EnumAlgorithm
* @typedef {'json' | 'base64' | 'totp' | 'hash' | 'hex' | 'signature' | 'basic' | 'token' | 'jwt' | 'checksum' | 'rsa' } EnumAlgorithmDecode
*/
constructor(opt: any);
drv: any;
cmd: any;
drv: import("ksdp/types/src/behavioral/Strategy");
cmd: import("ksdp/types/src/behavioral/Command");
default: string;

@@ -20,3 +20,3 @@ logger: Console;

* @description configure library
* @param {Object} opt
* @param {Object} [opt]
* @param {String} [opt.default=json]

@@ -26,3 +26,3 @@ * @param {Console} [opt.log]

*/
configure(opt: {
configure(opt?: {
default?: string;

@@ -33,47 +33,47 @@ log?: Console;

* @description Encoded data from an algorithm
* @param {String|Number|Object} data
* @param {EnumAlgorithm} algorithm
* @param {Object} options config options based on selected algorithm.
* @param {EnumAlgorithm} [algorithm]
* @param {Object} [params]
* @param {String} [action=encode]
* @return {String} data
*/
run(algorithm: "basic" | "json" | "base64" | "sha1" | "sha256" | "md5" | "totp" | "hash" | "hex" | "pkce" | "token" | "jwt" | "checksum", params: any, action?: string): string;
run(algorithm?: "basic" | "json" | "base64" | "sha1" | "sha256" | "md5" | "totp" | "hash" | "hex" | "pkce" | "token" | "jwt" | "rsa" | "checksum", params?: any, action?: string): string;
/**
* @description Encoded data from an algorithm
* @param {String|Number|Object} data
* @param {EnumAlgorithm} algorithm
* @param {Object} options Object config options based on selected algorithm.
* @param {EnumAlgorithm} [algorithm=json]
* @param {Object} [options] Object config options based on selected algorithm.
* @return {String|Buffer} data
*/
encode(data: string | number | any, algorithm: "basic" | "json" | "base64" | "sha1" | "sha256" | "md5" | "totp" | "hash" | "hex" | "pkce" | "token" | "jwt" | "checksum", options: any): string | Buffer;
encode(data: string | number | any, algorithm?: "basic" | "json" | "base64" | "sha1" | "sha256" | "md5" | "totp" | "hash" | "hex" | "pkce" | "token" | "jwt" | "rsa" | "checksum", options?: any): string | Buffer;
/**
* @description Decoded data from an algorithm
* @param {String|Number|Object} data String to decode
* @param {EnumAlgorithmDecode} algorithm
* @param {Object} options Object config options based on selected algorithm
* @param {EnumAlgorithmDecode} [algorithm=json]
* @param {Object} [options] Object config options based on selected algorithm
* @return {String|Object} data
*/
decode(data: string | number | any, algorithm: "basic" | "json" | "base64" | "totp" | "hash" | "hex" | "token" | "jwt" | "checksum" | "signature", options: any): string | any;
decode(data: string | number | any, algorithm?: "basic" | "json" | "base64" | "totp" | "hash" | "hex" | "token" | "jwt" | "rsa" | "checksum" | "signature", options?: any): string | any;
/**
* @description Verify data from an algorithm
* @param {String|Number|Object} data String to decode
* @param {EnumAlgorithmDecode} algorithm
* @param {Object} options Object config options based on selected algorithm
* @param {EnumAlgorithmDecode} [algorithm=json]
* @param {Object} [options] Object config options based on selected algorithm
* @return {Boolean} data
*/
verify(data: string | number | any, algorithm: "basic" | "json" | "base64" | "totp" | "hash" | "hex" | "token" | "jwt" | "checksum" | "signature", options: any): boolean;
verify(data: string | number | any, algorithm?: "basic" | "json" | "base64" | "totp" | "hash" | "hex" | "token" | "jwt" | "rsa" | "checksum" | "signature", options?: any): boolean;
/**
* @description Encoded data from an algorithm
* @param {String|Number|Object} data String to decode
* @param {EnumAlgorithmDecode} algorithm
* @param {Object} options Object config options based on selected algorithm
* @param {EnumAlgorithmDecode} [algorithm=json]
* @param {Object} [options] Object config options based on selected algorithm
* @return {String|Buffer} data
*/
sign(data: string | number | any, algorithm: "basic" | "json" | "base64" | "totp" | "hash" | "hex" | "token" | "jwt" | "checksum" | "signature", options: any): string | Buffer;
sign(data: string | number | any, algorithm?: "basic" | "json" | "base64" | "totp" | "hash" | "hex" | "token" | "jwt" | "rsa" | "checksum" | "signature", options?: any): string | Buffer;
/**
* @description Encoded data from an algorithm
* @param {EnumAlgorithmDecode} algorithm
* @param {Object} options Object config options based on selected algorithm
* @param {EnumAlgorithmDecode} [algorithm=rsa]
* @param {Object} [options] Object config options based on selected algorithm
* @return {String|Buffer} data
*/
generate(algorithm: "basic" | "json" | "base64" | "totp" | "hash" | "hex" | "token" | "jwt" | "checksum" | "signature", options: any): string | Buffer;
generate(algorithm?: "basic" | "json" | "base64" | "totp" | "hash" | "hex" | "token" | "jwt" | "rsa" | "checksum" | "signature", options?: any): string | Buffer;
/**

@@ -95,6 +95,6 @@ * @description set an external driver format

* @description get a certain algorithm implementation
* @param {String} algorithm
* @param {String} [algorithm=json]
* @returns {Object}
*/
get(algorithm: string): any;
get(algorithm?: string): any;
/**

@@ -101,0 +101,0 @@ * @description internal log handler

@@ -8,27 +8,27 @@ export = KsDriver;

* @param {String|Number|Object} data
* @param {Object} options Object config.
* @param {Object} [options] Object config.
* @return {String|Buffer} data
*/
encode(value: any, options: any): string | Buffer;
encode(data: string | number | any, options?: any): string | Buffer;
/**
* @description Decoded data from an algorithm
* @param {String|Number|Object} data String to decode
* @param {Object} options Object config.
* @param {Object} [options] Object config.
* @return {String|Object} data
*/
decode(value: any, options: any): string | any;
decode(data: string | number | any, options?: any): string | any;
/**
* @description Verify data from an algorithm
* @param {String|Number|Object} data String to decode
* @param {Object} options Config options
* @param {Object} [options] Config options
* @return {Boolean} data
*/
verify(value: any, options: any): boolean;
verify(data: string | number | any, options?: any): boolean;
/**
* @description Encoded data from an algorithm
* @param {String|Number|Object} data String to decode
* @param {Object} options Config options
* @param {Object} [options] Config options
* @return {String|Buffer} data
*/
sign(value: any, options: any): string | Buffer;
sign(data: string | number | any, options?: any): string | Buffer;
/**

@@ -35,0 +35,0 @@ * @description Encoded data from an algorithm

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