@ray-js/wechat-rsa 0.1.6 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/wechat-rsa",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -4,51 +4,14 @@ export interface IJSEncryptOptions {
4
4
  default_public_exponent?: string;
5
5
  log?: boolean;
6
6
  }
7
- /**
8
- *
9
- * @param {Object} [options = {}] - An object to customize JSEncrypt behaviour
10
- * possible parameters are:
11
- * - default_key_size {number} default: 1024 the key size in bit
12
- * - default_public_exponent {string} default: '010001' the hexadecimal representation of the public exponent
13
- * - log {boolean} default: false whether log warn/error or not
14
- * @constructor
15
- */
16
7
  export declare class JSEncrypt {
17
8
  constructor(options?: IJSEncryptOptions);
18
9
  private default_key_size;
19
10
  private default_public_exponent;
20
11
  private log;
21
12
  private key;
22
- /**
23
- * Method to set the rsa key parameter (one method is enough to set both the public
24
- * and the private key, since the private key contains the public key paramenters)
25
- * Log a warning if logs are enabled
26
- * @param {Object|string} key the pem encoded string or an object (with or without header/footer)
27
- * @public
28
- */
29
13
  setKey(key: string): void;
30
- /**
31
- * Proxy method for setKey, for api compatibility
32
- * @see setKey
33
- * @public
34
- */
35
14
  setPublicKey(pubkey: string): void;
36
- /**
37
- * Proxy method for RSAKey object's encrypt, encrypt the string using the public
38
- * components of the rsa key object. Note that if the object was not set will be created
39
- * on the fly (by the getKey method) using the parameters passed in the JSEncrypt constructor
40
- * @param {string} str the string to encrypt
41
- * @return {string} the encrypted string encoded in base64
42
- * @public
43
- */
44
15
  encrypt(str: string): string;
45
- /**
46
- * Getter for the current JSEncryptRSAKey object. If it doesn't exists a new object
47
- * will be created and returned
48
- * @param {callback} [cb] the callback to be called if we want the key to be generated
49
- * in an async fashion
50
- * @returns {JSEncryptRSAKey} the JSEncryptRSAKey object
51
- * @public
52
- */
53
16
  getKey(cb?: () => void): JSEncryptRSAKey;
54
17
  }
@@ -1,59 +1,7 @@
1
1
  import { RSAKey } from './lib/jsbn/rsa';
2
- /**
3
- * Create a new JSEncryptRSAKey that extends Tom Wu's RSA key object.
4
- * This object is just a decorator for parsing the key parameter
5
- * @param {string|Object} key - The key in string format, or an object containing
6
- * the parameters needed to build a RSAKey object.
7
- * @constructor
8
- */
9
2
  export declare class JSEncryptRSAKey extends RSAKey {
10
3
  constructor(key?: string | JSEncryptRSAKey);
11
- /**
12
- * Method to parse a pem encoded string containing both a public or private key.
13
- * The method will translate the pem encoded string in a der encoded string and
14
- * will parse private key and public key parameters. This method accepts public key
15
- * in the rsaencryption pkcs #1 format (oid: 1.2.840.113549.1.1.1).
16
- *
17
- * @todo Check how many rsa formats use the same format of pkcs #1.
18
- *
19
- * The format is defined as:
20
- * PublicKeyInfo ::= SEQUENCE {
21
- * algorithm AlgorithmIdentifier,
22
- * PublicKey BIT STRING
23
- * }
24
- * Where AlgorithmIdentifier is:
25
- * AlgorithmIdentifier ::= SEQUENCE {
26
- * algorithm OBJECT IDENTIFIER, the OID of the enc algorithm
27
- * parameters ANY DEFINED BY algorithm OPTIONAL (NULL for PKCS #1)
28
- * }
29
- * and PublicKey is a SEQUENCE encapsulated in a BIT STRING
30
- * RSAPublicKey ::= SEQUENCE {
31
- * modulus INTEGER, -- n
32
- * publicExponent INTEGER -- e
33
- * }
34
- * it's possible to examine the structure of the keys obtained from openssl using
35
- * an asn.1 dumper as the one used here to parse the components: http://lapo.it/asn1js/
36
- * @argument {string} pem the pem encoded string, can include the BEGIN/END header/footer
37
- * @private
38
- */
39
4
  parseKey(pem: string): boolean;
40
- /**
41
- * Check if the object contains the necessary parameters to populate the rsa modulus
42
- * and public exponent parameters.
43
- * @param {Object} [obj={}] - An object that may contain the two public key
44
- * parameters
45
- * @returns {boolean} true if the object contains both the modulus and the public exponent
46
- * properties (n and e)
47
- * @todo check for types of n and e. N should be a parseable bigInt object, E should
48
- * be a parseable integer number
49
- * @private
50
- */
51
5
  static hasPublicKeyProperty(obj: object): boolean;
52
- /**
53
- * Parse the properties of obj in the current rsa object. Obj should AT LEAST
54
- * include the modulus and public exponent (n, e) parameters.
55
- * @param {Object} obj - the object containing rsa parameters
56
- * @private
57
- */
58
6
  parsePropertiesFrom(obj: any): void;
59
7
  }
@@ -33,11 +33,6 @@ export declare class ASN1 {
33
33
  posEnd(): number;
34
34
  toHexString(): string;
35
35
  static decodeLength(stream: Stream): number | null;
36
- /**
37
- * Retrieve the hexadecimal value (as a string) of the current ASN.1 element
38
- * @returns {string}
39
- * @public
40
- */
41
36
  getHexStringValue(): string;
42
37
  static decode(str: Stream | number[]): ASN1;
43
38
  }