From 2111a4a83b4756a997d7644b0290619a99760beb Mon Sep 17 00:00:00 2001 From: Joshua Houghton Date: Sat, 6 Jul 2019 02:29:01 +0000 Subject: [PATCH 01/18] initial commit --- binding.gyp | 9 ++++++ modulus.c | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 17 +++++++++++ test.js | 33 ++++++++++++++++++++++ 4 files changed, 139 insertions(+) create mode 100644 binding.gyp create mode 100644 modulus.c create mode 100644 package.json create mode 100644 test.js diff --git a/binding.gyp b/binding.gyp new file mode 100644 index 0000000..bd3dcd6 --- /dev/null +++ b/binding.gyp @@ -0,0 +1,9 @@ +{ + "targets": [ + { + "target_name": "modulus", + "sources": [ "./modulus.c" ] + } + ] +} + diff --git a/modulus.c b/modulus.c new file mode 100644 index 0000000..8f22898 --- /dev/null +++ b/modulus.c @@ -0,0 +1,80 @@ +#include +#include +#include +#include + +static napi_value +rsa_priv_modulus (napi_env env, napi_callback_info info) +{ + size_t argc = 1, size; + napi_value argv[argc]; + char buf[16 * 1024]; + + RSA* private_key; + BIO *bio; + const char *hex; + napi_value hex_value; + + if (napi_get_cb_info (env, info, &argc, argv, NULL, NULL) != napi_ok) + { + napi_throw_error (env, NULL, "Failed to parse arguments"); + return 0; + } + + if (argc < 1) + { + napi_throw_error (env, NULL, "This function requires one argument"); + return 0; + } + + if (napi_get_value_string_utf8 (env, argv[0], buf, + sizeof (buf), &size) != napi_ok) + { + napi_throw_error (env, NULL, "Failed to parse string"); + return 0; + } + + //fwrite (buf, 1, size, stdout); + + bio = BIO_new_mem_buf (buf, size); + private_key = PEM_read_bio_RSAPrivateKey (bio, 0, 0, 0); + //RSA_print_fp (stdout, private_key, 0); + + hex = BN_bn2hex (private_key->n); + + BIO_free (bio); + RSA_free (private_key); + + //printf ("modulus %s\n", hex); + + if (napi_create_string_utf8 (env, hex, strlen (hex), &hex_value) != napi_ok) + { + napi_throw_error (env, NULL, "Failed to create string from modulus"); + return 0; + } + + free (hex); + + return hex_value; +} + +napi_value Init(napi_env env, napi_value exports) { + napi_status status; + napi_value fn; + + status = napi_create_function(env, NULL, 0, rsa_priv_modulus, NULL, &fn); + if (status != napi_ok) { + napi_throw_error(env, NULL, "Unable to wrap native function"); + } + + status = napi_set_named_property(env, exports, "RSAPrivateKeyModulus", fn); + if (status != napi_ok) { + napi_throw_error(env, NULL, "Unable to populate exports"); + } + + return exports; +} + + + +NAPI_MODULE(NODE_GYP_MODULE_NAME, Init) diff --git a/package.json b/package.json new file mode 100644 index 0000000..949be70 --- /dev/null +++ b/package.json @@ -0,0 +1,17 @@ +{ + "name": "n-api-article", + "version": "0.1.0", + "description": "https://medium.com/@schahriar/n-api-and-getting-started-with-writing-c-addons-for-node-js-cf061b3eae75", + "main": "modulus.js", + "private": true, + "gypfile": true, + "scripts": { + "start": "node-gyp configure build && node module.js", + "test": "node test.js" + }, + "engines": { + "node" : ">=8.4.0" + }, + "author": "Joshua Houghton Date: Sat, 6 Jul 2019 03:38:26 +0000 Subject: [PATCH 02/18] returns all the things about an rsa key --- modulus.c | 83 +++++++++++++++++++++++++++++++++++++--------------- package.json | 5 ++-- test.js | 22 +++++++++++++- 3 files changed, 83 insertions(+), 27 deletions(-) diff --git a/modulus.c b/modulus.c index 8f22898..a14b383 100644 --- a/modulus.c +++ b/modulus.c @@ -3,71 +3,110 @@ #include #include +#include + static napi_value -rsa_priv_modulus (napi_env env, napi_callback_info info) +rsa_priv_key (napi_env env, napi_callback_info info) { size_t argc = 1, size; napi_value argv[argc]; char buf[16 * 1024]; + napi_status status = napi_ok; RSA* private_key; BIO *bio; - const char *hex; - napi_value hex_value; + char *n_hex, *e_hex, *d_hex, *p_hex, *q_hex, *dmp1_hex, *dmq1_hex, *iqmp_hex; + napi_value n_val, e_val, d_val, p_val, q_val, dmp1_val, dmq1_val, iqmp_val; + napi_value obj; if (napi_get_cb_info (env, info, &argc, argv, NULL, NULL) != napi_ok) { napi_throw_error (env, NULL, "Failed to parse arguments"); - return 0; + return NULL; } if (argc < 1) { napi_throw_error (env, NULL, "This function requires one argument"); - return 0; + return NULL; } if (napi_get_value_string_utf8 (env, argv[0], buf, sizeof (buf), &size) != napi_ok) { napi_throw_error (env, NULL, "Failed to parse string"); - return 0; + return NULL; } - //fwrite (buf, 1, size, stdout); - bio = BIO_new_mem_buf (buf, size); private_key = PEM_read_bio_RSAPrivateKey (bio, 0, 0, 0); - //RSA_print_fp (stdout, private_key, 0); - hex = BN_bn2hex (private_key->n); + n_hex = BN_bn2hex (private_key->n); + e_hex = BN_bn2hex (private_key->e); + d_hex = BN_bn2hex (private_key->d); + p_hex = BN_bn2hex (private_key->p); + q_hex = BN_bn2hex (private_key->q); + dmp1_hex = BN_bn2hex (private_key->dmp1); + dmq1_hex = BN_bn2hex (private_key->dmq1); + iqmp_hex = BN_bn2hex (private_key->iqmp); BIO_free (bio); RSA_free (private_key); - //printf ("modulus %s\n", hex); - - if (napi_create_string_utf8 (env, hex, strlen (hex), &hex_value) != napi_ok) + status |= napi_create_string_utf8 (env, n_hex, strlen (n_hex), &n_val); + status |= napi_create_string_utf8 (env, e_hex, strlen (e_hex), &e_val); + status |= napi_create_string_utf8 (env, d_hex, strlen (d_hex), &d_val); + status |= napi_create_string_utf8 (env, p_hex, strlen (p_hex), &p_val); + status |= napi_create_string_utf8 (env, q_hex, strlen (q_hex), &q_val); + status |= napi_create_string_utf8 (env, dmp1_hex, strlen (dmp1_hex), &dmp1_val); + status |= napi_create_string_utf8 (env, dmq1_hex, strlen (dmq1_hex), &dmq1_val); + status |= napi_create_string_utf8 (env, iqmp_hex, strlen (iqmp_hex), &iqmp_val); + status |= napi_create_object (env, &obj); + + free (n_hex); + free (e_hex); + free (d_hex); + free (p_hex); + free (q_hex); + free (dmp1_hex); + free (dmq1_hex); + free (iqmp_hex); + + if (status != napi_ok) { - napi_throw_error (env, NULL, "Failed to create string from modulus"); - return 0; + napi_throw_error (env, NULL, "Failed to create return object"); + return NULL; } - free (hex); + status |= napi_set_named_property (env, obj, "n", n_val); + status |= napi_set_named_property (env, obj, "e", e_val); + status |= napi_set_named_property (env, obj, "d", d_val); + status |= napi_set_named_property (env, obj, "p", p_val); + status |= napi_set_named_property (env, obj, "q", q_val); + status |= napi_set_named_property (env, obj, "dmp1", dmp1_val); + status |= napi_set_named_property (env, obj, "dmq1", dmq1_val); + status |= napi_set_named_property (env, obj, "iqmp", iqmp_val); - return hex_value; + if (status != napi_ok) + { + napi_throw_error (env, NULL, "Failed to assign properties to object"); + return NULL; + } + + return obj; } -napi_value Init(napi_env env, napi_value exports) { +static napi_value +init(napi_env env, napi_value exports) { napi_status status; napi_value fn; - status = napi_create_function(env, NULL, 0, rsa_priv_modulus, NULL, &fn); + status = napi_create_function(env, NULL, 0, rsa_priv_key, NULL, &fn); if (status != napi_ok) { napi_throw_error(env, NULL, "Unable to wrap native function"); } - status = napi_set_named_property(env, exports, "RSAPrivateKeyModulus", fn); + status = napi_set_named_property(env, exports, "RSAPrivateKey", fn); if (status != napi_ok) { napi_throw_error(env, NULL, "Unable to populate exports"); } @@ -75,6 +114,4 @@ napi_value Init(napi_env env, napi_value exports) { return exports; } - - -NAPI_MODULE(NODE_GYP_MODULE_NAME, Init) +NAPI_MODULE(NODE_GYP_MODULE_NAME, init) diff --git a/package.json b/package.json index 949be70..909bd13 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,6 @@ { - "name": "n-api-article", + "name": "rsa-modulus", "version": "0.1.0", - "description": "https://medium.com/@schahriar/n-api-and-getting-started-with-writing-c-addons-for-node-js-cf061b3eae75", "main": "modulus.js", "private": true, "gypfile": true, @@ -13,5 +12,5 @@ "node" : ">=8.4.0" }, "author": "Joshua Houghton Date: Sat, 6 Jul 2019 16:31:12 +0100 Subject: [PATCH 03/18] package.json: change package name --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 909bd13..1eb3f35 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "rsa-modulus", + "name": "node-openssl", "version": "0.1.0", "main": "modulus.js", "private": true, From e8f5235fa9496ab828e80866dc3cd7a98e7e451b Mon Sep 17 00:00:00 2001 From: Joshua Houghton Date: Sat, 6 Jul 2019 16:48:35 +0100 Subject: [PATCH 04/18] add lgpl license --- lgpl-2.1.txt | 502 +++++++++++++++++++++++++++++++++++++++++++++++++++ modulus.c | 17 ++ 2 files changed, 519 insertions(+) create mode 100644 lgpl-2.1.txt diff --git a/lgpl-2.1.txt b/lgpl-2.1.txt new file mode 100644 index 0000000..4362b49 --- /dev/null +++ b/lgpl-2.1.txt @@ -0,0 +1,502 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! diff --git a/modulus.c b/modulus.c index a14b383..2bb36b1 100644 --- a/modulus.c +++ b/modulus.c @@ -1,3 +1,20 @@ +/** + * Copyright (C) 2019, Joshua Houghton + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + #include #include #include From 3d60bb91b23af28c5ed3b7650c79a2a05d3b8d5b Mon Sep 17 00:00:00 2001 From: Joshua Houghton Date: Sat, 6 Jul 2019 17:03:35 +0000 Subject: [PATCH 05/18] add some x509 stuff --- modulus.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 52 insertions(+), 4 deletions(-) diff --git a/modulus.c b/modulus.c index 2bb36b1..cc34c93 100644 --- a/modulus.c +++ b/modulus.c @@ -19,9 +19,50 @@ #include #include #include +#include #include +static napi_value +x509_cert (napi_env env, napi_callback_info info) +{ + size_t argc = 1, size; + napi_value argv[argc]; + char buf[16 * 1024]; + napi_status status = napi_ok; + + if (napi_get_cb_info (env, info, &argc, argv, NULL, NULL) != napi_ok) + { + napi_throw_error (env, NULL, "Failed to parse arguments"); + return NULL; + } + if (argc < 1) + { + napi_throw_error (env, NULL, "This function requires one argument"); + return NULL; + } + if (napi_get_value_string_utf8 (env, argv[0], buf, + sizeof (buf), &size) != napi_ok) + { + napi_throw_error (env, NULL, "Failed to parse string"); + return NULL; + } + + if ((bio = BIO_new_mem_buf (buf, size)) == NULL) + { + napi_throw_error (env, NULL, "Failed to copy cert into buffer"); + return NULL; + } + if ((private_key = PEM_read_bio_x509 (bio, 0, 0, 0)) == NULL) + { + napi_throw_error (env, NULL, "Failed to read key from bio"); + BIO_free (bio); + return NULL; + } + + return 0; +} + static napi_value rsa_priv_key (napi_env env, napi_callback_info info) { @@ -41,13 +82,11 @@ rsa_priv_key (napi_env env, napi_callback_info info) napi_throw_error (env, NULL, "Failed to parse arguments"); return NULL; } - if (argc < 1) { napi_throw_error (env, NULL, "This function requires one argument"); return NULL; } - if (napi_get_value_string_utf8 (env, argv[0], buf, sizeof (buf), &size) != napi_ok) { @@ -55,8 +94,17 @@ rsa_priv_key (napi_env env, napi_callback_info info) return NULL; } - bio = BIO_new_mem_buf (buf, size); - private_key = PEM_read_bio_RSAPrivateKey (bio, 0, 0, 0); + if ((bio = BIO_new_mem_buf (buf, size)) == NULL) + { + napi_throw_error (env, NULL, "Failed to copy key into buffer"); + return NULL; + } + if ((private_key = PEM_read_bio_RSAPrivateKey (bio, 0, 0, 0)) == NULL) + { + napi_throw_error (env, NULL, "Failed to read key from bio"); + BIO_free (bio); + return NULL; + } n_hex = BN_bn2hex (private_key->n); e_hex = BN_bn2hex (private_key->e); From c30fa209d309dfec79f0e3db3b2ab05b67b181bb Mon Sep 17 00:00:00 2001 From: Joshua Houghton Date: Sat, 6 Jul 2019 18:56:08 +0100 Subject: [PATCH 06/18] get public key from x509 cert --- modulus.c | 90 ++++++++++++++++++++++++++++++++++++++++++++----------- test.js | 4 +-- 2 files changed, 75 insertions(+), 19 deletions(-) diff --git a/modulus.c b/modulus.c index cc34c93..313a499 100644 --- a/modulus.c +++ b/modulus.c @@ -24,13 +24,21 @@ #include static napi_value -x509_cert (napi_env env, napi_callback_info info) +x509_cert_pub_key (napi_env env, napi_callback_info info) { size_t argc = 1, size; napi_value argv[argc]; char buf[16 * 1024]; napi_status status = napi_ok; + BIO *bio; + X509 *x509; + EVP_PKEY *evp_pubkey; + RSA *public_key; + char *n_hex, *e_hex; + napi_value n_val, e_val; + napi_value obj; + if (napi_get_cb_info (env, info, &argc, argv, NULL, NULL) != napi_ok) { napi_throw_error (env, NULL, "Failed to parse arguments"); @@ -53,14 +61,59 @@ x509_cert (napi_env env, napi_callback_info info) napi_throw_error (env, NULL, "Failed to copy cert into buffer"); return NULL; } - if ((private_key = PEM_read_bio_x509 (bio, 0, 0, 0)) == NULL) + if ((x509 = PEM_read_bio_X509 (bio, 0, 0, 0)) == NULL) { - napi_throw_error (env, NULL, "Failed to read key from bio"); + napi_throw_error (env, NULL, "Failed to read x509 from bio"); + BIO_free (bio); + return NULL; + } + if ((evp_pubkey = X509_get_pubkey (x509)) == NULL) + { + napi_throw_error (env, NULL, "Failed to extract public key"); + X509_free (x509); BIO_free (bio); return NULL; } + if ((public_key = EVP_PKEY_get1_RSA (evp_pubkey)) == NULL) + { + napi_throw_error (env, NULL, "Faield to extract rsa key"); + EVP_PKEY_free (evp_pubkey); + X509_free (x509); + BIO_free (bio); + return NULL; + } + + n_hex = BN_bn2hex (public_key->n); + e_hex = BN_bn2hex (public_key->e); + + RSA_free (public_key); + EVP_PKEY_free (evp_pubkey); + X509_free (x509); + BIO_free (bio); + + status |= napi_create_string_utf8 (env, n_hex, strlen (n_hex), &n_val); + status |= napi_create_string_utf8 (env, e_hex, strlen (e_hex), &e_val); + status |= napi_create_object (env, &obj); + + free (n_hex); + free (e_hex); + + if (status != napi_ok) + { + napi_throw_error (env, NULL, "Failed to create return object"); + return NULL; + } - return 0; + status |= napi_set_named_property (env, obj, "n", n_val); + status |= napi_set_named_property (env, obj, "e", e_val); + + if (status != napi_ok) + { + napi_throw_error (env, NULL, "Failed to assign properties to object"); + return NULL; + } + + return obj; } static napi_value @@ -162,19 +215,22 @@ rsa_priv_key (napi_env env, napi_callback_info info) } static napi_value -init(napi_env env, napi_value exports) { - napi_status status; - napi_value fn; - - status = napi_create_function(env, NULL, 0, rsa_priv_key, NULL, &fn); - if (status != napi_ok) { - napi_throw_error(env, NULL, "Unable to wrap native function"); - } - - status = napi_set_named_property(env, exports, "RSAPrivateKey", fn); - if (status != napi_ok) { - napi_throw_error(env, NULL, "Unable to populate exports"); - } +init (napi_env env, napi_value exports) { + napi_value rsa_fn, x509_fn; + + if (napi_create_function (env, NULL, 0, rsa_priv_key, + NULL, &rsa_fn) != napi_ok) + napi_throw_error (env, NULL, "Unable to wrap native rsa function"); + if (napi_create_function (env, NULL, 0, x509_cert_pub_key, + NULL, &x509_fn) != napi_ok) + napi_throw_error (env, NULL, "Unable to wrap native x509 function"); + + if (napi_set_named_property (env, exports, "RSAPrivateKey", + rsa_fn) != napi_ok) + napi_throw_error (env, NULL, "Unable to populate exports with rsa"); + if (napi_set_named_property (env, exports, "X509PublicKey", + x509_fn) != napi_ok) + napi_throw_error (env, NULL, "Unable to populate exports with x509"); return exports; } diff --git a/test.js b/test.js index 84c29d0..ebc0923 100644 --- a/test.js +++ b/test.js @@ -49,5 +49,5 @@ bBBpXSx7kyjpejndt+ico3R5MctNgiX4OqqWl9CGCe5+/I+lc1qN -----END RSA PRIVATE KEY----- `; -const value = 8; -console.log("My modulus is", modulus.RSAPrivateKey(rsakey)); +console.log("My rsa private key is", modulus.RSAPrivateKey(rsakey)); +console.log("My cert public key is", modulus.X509PublicKey(cert)); From f9970b90673baa3873d6c6e1e32a660d3062dd36 Mon Sep 17 00:00:00 2001 From: Joshua Houghton Date: Sat, 6 Jul 2019 19:57:25 +0100 Subject: [PATCH 07/18] change the name of some files --- binding.gyp | 5 ++--- modulus.c => main.c | 0 package.json | 2 +- test.js | 10 +++++++--- 4 files changed, 10 insertions(+), 7 deletions(-) rename modulus.c => main.c (100%) diff --git a/binding.gyp b/binding.gyp index bd3dcd6..594bc0d 100644 --- a/binding.gyp +++ b/binding.gyp @@ -1,9 +1,8 @@ { "targets": [ { - "target_name": "modulus", - "sources": [ "./modulus.c" ] + "target_name": "node_openssl", + "sources": [ "./main.c" ] } ] } - diff --git a/modulus.c b/main.c similarity index 100% rename from modulus.c rename to main.c diff --git a/package.json b/package.json index 1eb3f35..3ed8bcb 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "node-openssl", "version": "0.1.0", - "main": "modulus.js", + "main": "main.js", "private": true, "gypfile": true, "scripts": { diff --git a/test.js b/test.js index ebc0923..7ca0068 100644 --- a/test.js +++ b/test.js @@ -1,4 +1,4 @@ -const modulus = require("./build/Release/modulus"); +const modulus = require("."); const cert = `-----BEGIN CERTIFICATE----- MIIC0TCCAbkCAQEwDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCR0IxEzARBgNV @@ -49,5 +49,9 @@ bBBpXSx7kyjpejndt+ico3R5MctNgiX4OqqWl9CGCe5+/I+lc1qN -----END RSA PRIVATE KEY----- `; -console.log("My rsa private key is", modulus.RSAPrivateKey(rsakey)); -console.log("My cert public key is", modulus.X509PublicKey(cert)); +try { + console.log("My rsa private key is", modulus.RSAPrivateKey(rsakey)); + console.log("My cert public key is", modulus.X509PublicKey(cert)); +} catch (e) { + console.error ("test failed", e); +} From 3a66b859f4a0fcd3a8a23b84ce74ee8d44863c4c Mon Sep 17 00:00:00 2001 From: Joshua Houghton Date: Sat, 6 Jul 2019 20:01:07 +0100 Subject: [PATCH 08/18] add some missing files --- .gitignore | 3 +++ main.js | 1 + 2 files changed, 4 insertions(+) create mode 100644 .gitignore create mode 100644 main.js diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f484e91 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +build/ +node_modules +*~ diff --git a/main.js b/main.js new file mode 100644 index 0000000..45bce13 --- /dev/null +++ b/main.js @@ -0,0 +1 @@ +module.exports = require("./build/Release/node_openssl"); From 8f448253304ce1d677983164dd877d1747ef54b3 Mon Sep 17 00:00:00 2001 From: Joshua Houghton Date: Sat, 6 Jul 2019 20:32:30 +0100 Subject: [PATCH 09/18] fix typo in error message --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 313a499..4a7ad85 100644 --- a/main.c +++ b/main.c @@ -76,7 +76,7 @@ x509_cert_pub_key (napi_env env, napi_callback_info info) } if ((public_key = EVP_PKEY_get1_RSA (evp_pubkey)) == NULL) { - napi_throw_error (env, NULL, "Faield to extract rsa key"); + napi_throw_error (env, NULL, "Faild to extract rsa key"); EVP_PKEY_free (evp_pubkey); X509_free (x509); BIO_free (bio); From ef764c371a3525660b8f73f84e934850ce593ae7 Mon Sep 17 00:00:00 2001 From: Joshua Houghton Date: Sat, 6 Jul 2019 20:50:43 +0100 Subject: [PATCH 10/18] add readme --- README.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..4a52cb5 --- /dev/null +++ b/README.md @@ -0,0 +1,32 @@ +# Node openssl + +This was created so that we could verify the modulus of a public and private key +match. At the moment it has two functions RSAPrivateKey and X509PublicKey. The +first reads an rsa private key and the second reads from an x509 cert. + +### The output of RSAPrivateKey is as follows: +``` +{ + n: (hex string) // public modulus + e: (hex string) // public exponent + d: (hex string) // private exponent + p: (hex string) // secret prime factor + q: (hex string) // secret prime factor + dmp1: (hex string) // d mod (p-1) + dmq1: (hex string) // d mod (q-1) + iqmp: (hex string) // q^-1 mod p +} +``` + +### The output of X509PublicKey is as follows: +``` +{ + n: (hex string) // public modulus + e: (hex string) // public exponent +} +``` + +## Licence + +This is licenced under the GNU Lesser General Public License version 2. See +lgpl-2.1.txt for more details. From 243fecdf4b14cb2b285e404753bd4a7807e18c16 Mon Sep 17 00:00:00 2001 From: Joshua Houghton Date: Sun, 7 Jul 2019 13:39:24 +0100 Subject: [PATCH 11/18] sign copyright over to ripjar --- main.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/main.c b/main.c index 4a7ad85..dd8594f 100644 --- a/main.c +++ b/main.c @@ -1,18 +1,20 @@ /** - * Copyright (C) 2019, Joshua Houghton + * Copyright (C) 2019 Ripjar Limited * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * or see see . */ #include From 9ed5dc537c5504455b952c1ede98f2fbeaeca32b Mon Sep 17 00:00:00 2001 From: Joshua Houghton Date: Sun, 7 Jul 2019 14:11:20 +0100 Subject: [PATCH 12/18] consider the size of the cert/key before allocating memory --- main.c | 39 ++++++++++++++++++++++++++++++++++----- test.js | 3 ++- 2 files changed, 36 insertions(+), 6 deletions(-) diff --git a/main.c b/main.c index dd8594f..0a823a9 100644 --- a/main.c +++ b/main.c @@ -30,7 +30,7 @@ x509_cert_pub_key (napi_env env, napi_callback_info info) { size_t argc = 1, size; napi_value argv[argc]; - char buf[16 * 1024]; + char *buf; napi_status status = napi_ok; BIO *bio; @@ -51,22 +51,35 @@ x509_cert_pub_key (napi_env env, napi_callback_info info) napi_throw_error (env, NULL, "This function requires one argument"); return NULL; } + if (napi_get_value_string_utf8 (env, argv[0], NULL, 0, &size) != napi_ok) + { + napi_throw_error (env, NULL, "Failed to parse string"); + return NULL; + } + if ((buf = malloc (++size)) == NULL) + { + napi_throw_error (env, NULL, "Failed to allocate memory"); + return NULL; + } if (napi_get_value_string_utf8 (env, argv[0], buf, - sizeof (buf), &size) != napi_ok) + size, &size) != napi_ok) { napi_throw_error (env, NULL, "Failed to parse string"); + free (buf); return NULL; } if ((bio = BIO_new_mem_buf (buf, size)) == NULL) { napi_throw_error (env, NULL, "Failed to copy cert into buffer"); + free (buf); return NULL; } if ((x509 = PEM_read_bio_X509 (bio, 0, 0, 0)) == NULL) { napi_throw_error (env, NULL, "Failed to read x509 from bio"); BIO_free (bio); + free (buf); return NULL; } if ((evp_pubkey = X509_get_pubkey (x509)) == NULL) @@ -74,6 +87,7 @@ x509_cert_pub_key (napi_env env, napi_callback_info info) napi_throw_error (env, NULL, "Failed to extract public key"); X509_free (x509); BIO_free (bio); + free (buf); return NULL; } if ((public_key = EVP_PKEY_get1_RSA (evp_pubkey)) == NULL) @@ -82,6 +96,7 @@ x509_cert_pub_key (napi_env env, napi_callback_info info) EVP_PKEY_free (evp_pubkey); X509_free (x509); BIO_free (bio); + free (buf); return NULL; } @@ -92,6 +107,7 @@ x509_cert_pub_key (napi_env env, napi_callback_info info) EVP_PKEY_free (evp_pubkey); X509_free (x509); BIO_free (bio); + free (buf); status |= napi_create_string_utf8 (env, n_hex, strlen (n_hex), &n_val); status |= napi_create_string_utf8 (env, e_hex, strlen (e_hex), &e_val); @@ -123,7 +139,7 @@ rsa_priv_key (napi_env env, napi_callback_info info) { size_t argc = 1, size; napi_value argv[argc]; - char buf[16 * 1024]; + char *buf; napi_status status = napi_ok; RSA* private_key; @@ -142,22 +158,34 @@ rsa_priv_key (napi_env env, napi_callback_info info) napi_throw_error (env, NULL, "This function requires one argument"); return NULL; } + if (napi_get_value_string_utf8 (env, argv[0], NULL, 0, &size) != napi_ok) + { + napi_throw_error (env, NULL, "Failed to parse string"); + return NULL; + } + if ((buf = malloc (++size)) == NULL) + { + napi_throw_error (env, NULL, "Failed to allocate memory"); + return NULL; + } if (napi_get_value_string_utf8 (env, argv[0], buf, - sizeof (buf), &size) != napi_ok) + size, &size) != napi_ok) { napi_throw_error (env, NULL, "Failed to parse string"); + free (buf); return NULL; } - if ((bio = BIO_new_mem_buf (buf, size)) == NULL) { napi_throw_error (env, NULL, "Failed to copy key into buffer"); + free (buf); return NULL; } if ((private_key = PEM_read_bio_RSAPrivateKey (bio, 0, 0, 0)) == NULL) { napi_throw_error (env, NULL, "Failed to read key from bio"); BIO_free (bio); + free (buf); return NULL; } @@ -172,6 +200,7 @@ rsa_priv_key (napi_env env, napi_callback_info info) BIO_free (bio); RSA_free (private_key); + free (buf); status |= napi_create_string_utf8 (env, n_hex, strlen (n_hex), &n_val); status |= napi_create_string_utf8 (env, e_hex, strlen (e_hex), &e_val); diff --git a/test.js b/test.js index 7ca0068..c3a3da9 100644 --- a/test.js +++ b/test.js @@ -53,5 +53,6 @@ try { console.log("My rsa private key is", modulus.RSAPrivateKey(rsakey)); console.log("My cert public key is", modulus.X509PublicKey(cert)); } catch (e) { - console.error ("test failed", e); + console.error ("test failed"); + throw e; } From ec99d7141bc11c3a094a7daaab4fc6558f374452 Mon Sep 17 00:00:00 2001 From: Joshua Houghton Date: Sun, 7 Jul 2019 14:25:11 +0100 Subject: [PATCH 13/18] do a bit more error checking --- main.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/main.c b/main.c index 0a823a9..c041d92 100644 --- a/main.c +++ b/main.c @@ -100,6 +100,18 @@ x509_cert_pub_key (napi_env env, napi_callback_info info) return NULL; } + if (public_key->n == NULL || public_key->e == NULL) + { + napi_throw_error (env, NULL, "One or more required values in the " + "public key is null"); + RSA_free (public_key); + EVP_PKEY_free (evp_pubkey); + X509_free (x509); + BIO_free (bio); + free (buf); + return NULL; + } + n_hex = BN_bn2hex (public_key->n); e_hex = BN_bn2hex (public_key->e); @@ -189,6 +201,19 @@ rsa_priv_key (napi_env env, napi_callback_info info) return NULL; } + if (private_key->n == NULL || private_key->e == NULL || + private_key->d == NULL || private_key->p == NULL || + private_key->q == NULL || private_key->dmp1 == NULL || + private_key->dmq1 == NULL || private_key->iqmp == NULL) + { + napi_throw_error (env, NULL, "One or more required values in the " + "private key is null"); + RSA_free (private_key); + BIO_free (bio); + free (buf); + return NULL; + } + n_hex = BN_bn2hex (private_key->n); e_hex = BN_bn2hex (private_key->e); d_hex = BN_bn2hex (private_key->d); From 7e4eddde3480d88f8bb33e3de5dffa17d9bfcbda Mon Sep 17 00:00:00 2001 From: Joshua Houghton Date: Tue, 26 Nov 2019 10:06:49 +0000 Subject: [PATCH 14/18] add the ability to specify a passphase for the private key (#2) Signed-off-by: James Moxon Signed-off-by: Joshua Houghton --- binding.gyp | 5 +- main.c | 107 +++++-- main.js | 2 +- package.json | 12 +- test.js | 58 ---- test/1cert | 18 ++ test/1key | 28 ++ test/1mod | 1 + test/2key | 27 ++ test/2mod | 1 + test/3cert | 18 ++ test/3key | 30 ++ test/3mod | 1 + test/3passphrase | 1 + test/README.md | 11 + test/test.js | 72 +++++ yarn.lock | 726 +++++++++++++++++++++++++++++++++++++++++++++++ 17 files changed, 1033 insertions(+), 85 deletions(-) delete mode 100644 test.js create mode 100644 test/1cert create mode 100644 test/1key create mode 100644 test/1mod create mode 100644 test/2key create mode 100644 test/2mod create mode 100644 test/3cert create mode 100644 test/3key create mode 100644 test/3mod create mode 100644 test/3passphrase create mode 100644 test/README.md create mode 100644 test/test.js create mode 100644 yarn.lock diff --git a/binding.gyp b/binding.gyp index 594bc0d..594d0e9 100644 --- a/binding.gyp +++ b/binding.gyp @@ -2,7 +2,10 @@ "targets": [ { "target_name": "node_openssl", - "sources": [ "./main.c" ] + "sources": [ "./main.c" ], + "cflags": [ + "-Wall" + ] } ] } diff --git a/main.c b/main.c index c041d92..a910bec 100644 --- a/main.c +++ b/main.c @@ -61,8 +61,7 @@ x509_cert_pub_key (napi_env env, napi_callback_info info) napi_throw_error (env, NULL, "Failed to allocate memory"); return NULL; } - if (napi_get_value_string_utf8 (env, argv[0], buf, - size, &size) != napi_ok) + if (napi_get_value_string_utf8 (env, argv[0], buf, size, &size) != napi_ok) { napi_throw_error (env, NULL, "Failed to parse string"); free (buf); @@ -77,7 +76,7 @@ x509_cert_pub_key (napi_env env, napi_callback_info info) } if ((x509 = PEM_read_bio_X509 (bio, 0, 0, 0)) == NULL) { - napi_throw_error (env, NULL, "Failed to read x509 from bio"); + napi_throw_error (env, NULL, "Failed to read x509 from BIO"); BIO_free (bio); free (buf); return NULL; @@ -103,7 +102,7 @@ x509_cert_pub_key (napi_env env, napi_callback_info info) if (public_key->n == NULL || public_key->e == NULL) { napi_throw_error (env, NULL, "One or more required values in the " - "public key is null"); + "public key is null"); RSA_free (public_key); EVP_PKEY_free (evp_pubkey); X509_free (x509); @@ -146,17 +145,30 @@ x509_cert_pub_key (napi_env env, napi_callback_info info) return obj; } +static int +pass_cb (char *buf, int size, int rwflag, void *u) +{ + if (u == NULL) + return -1; + + size_t len = strlen (u); + memcpy (buf, u, len > (size_t) size ? (size_t) size : len); + return len; +} + static napi_value rsa_priv_key (napi_env env, napi_callback_info info) { - size_t argc = 1, size; + size_t argc = 2, size, pass_size; napi_value argv[argc]; - char *buf; + char *buf, *passphrase = NULL; napi_status status = napi_ok; + napi_valuetype valuetype; - RSA* private_key; + RSA *private_key; BIO *bio; - char *n_hex, *e_hex, *d_hex, *p_hex, *q_hex, *dmp1_hex, *dmq1_hex, *iqmp_hex; + char *n_hex, *e_hex, *d_hex, *p_hex, *q_hex, *dmp1_hex, *dmq1_hex, + *iqmp_hex; napi_value n_val, e_val, d_val, p_val, q_val, dmp1_val, dmq1_val, iqmp_val; napi_value obj; @@ -180,24 +192,64 @@ rsa_priv_key (napi_env env, napi_callback_info info) napi_throw_error (env, NULL, "Failed to allocate memory"); return NULL; } - if (napi_get_value_string_utf8 (env, argv[0], buf, - size, &size) != napi_ok) + if (napi_get_value_string_utf8 (env, argv[0], buf, size, &size) != napi_ok) { napi_throw_error (env, NULL, "Failed to parse string"); free (buf); return NULL; } + if (argc > 1) + { + if (napi_typeof (env, argv[1], &valuetype) != napi_ok) + { + napi_throw_error (env, NULL, "cannot get type of second argument"); + free (buf); + return NULL; + } + } + if (argc > 1 && valuetype != napi_undefined && valuetype != napi_null) + { + if (napi_get_value_string_utf8 (env, argv[1], NULL, 0, &pass_size) != + napi_ok) + { + napi_throw_error (env, NULL, "Failed to read passphrase: " + "make sure passphrase is a string"); + free (buf); + return NULL; + } + if ((passphrase = malloc (++pass_size)) == NULL) + { + napi_throw_error (env, NULL, "Failed to allocate memory"); + free (buf); + return NULL; + } + if (napi_get_value_string_utf8 + (env, argv[1], passphrase, pass_size, &pass_size) != napi_ok) + { + napi_throw_error (env, NULL, "Failed to read passphrase: " + "make sure passphrase is a string"); + free (buf); + if (passphrase) + free (passphrase); + return NULL; + } + } if ((bio = BIO_new_mem_buf (buf, size)) == NULL) { napi_throw_error (env, NULL, "Failed to copy key into buffer"); free (buf); + if (passphrase) + free (passphrase); return NULL; } - if ((private_key = PEM_read_bio_RSAPrivateKey (bio, 0, 0, 0)) == NULL) + if ((private_key = + PEM_read_bio_RSAPrivateKey (bio, NULL, pass_cb, passphrase)) == NULL) { - napi_throw_error (env, NULL, "Failed to read key from bio"); + napi_throw_error (env, NULL, "Failed to read private key from BIO"); BIO_free (bio); free (buf); + if (passphrase) + free (passphrase); return NULL; } @@ -207,10 +259,12 @@ rsa_priv_key (napi_env env, napi_callback_info info) private_key->dmq1 == NULL || private_key->iqmp == NULL) { napi_throw_error (env, NULL, "One or more required values in the " - "private key is null"); + "private key is null"); RSA_free (private_key); BIO_free (bio); free (buf); + if (passphrase) + free (passphrase); return NULL; } @@ -226,15 +280,20 @@ rsa_priv_key (napi_env env, napi_callback_info info) BIO_free (bio); RSA_free (private_key); free (buf); + if (passphrase) + free (passphrase); status |= napi_create_string_utf8 (env, n_hex, strlen (n_hex), &n_val); status |= napi_create_string_utf8 (env, e_hex, strlen (e_hex), &e_val); status |= napi_create_string_utf8 (env, d_hex, strlen (d_hex), &d_val); status |= napi_create_string_utf8 (env, p_hex, strlen (p_hex), &p_val); status |= napi_create_string_utf8 (env, q_hex, strlen (q_hex), &q_val); - status |= napi_create_string_utf8 (env, dmp1_hex, strlen (dmp1_hex), &dmp1_val); - status |= napi_create_string_utf8 (env, dmq1_hex, strlen (dmq1_hex), &dmq1_val); - status |= napi_create_string_utf8 (env, iqmp_hex, strlen (iqmp_hex), &iqmp_val); + status |= + napi_create_string_utf8 (env, dmp1_hex, strlen (dmp1_hex), &dmp1_val); + status |= + napi_create_string_utf8 (env, dmq1_hex, strlen (dmq1_hex), &dmq1_val); + status |= + napi_create_string_utf8 (env, iqmp_hex, strlen (iqmp_hex), &iqmp_val); status |= napi_create_object (env, &obj); free (n_hex); @@ -271,24 +330,28 @@ rsa_priv_key (napi_env env, napi_callback_info info) } static napi_value -init (napi_env env, napi_value exports) { +init (napi_env env, napi_value exports) +{ napi_value rsa_fn, x509_fn; + OpenSSL_add_all_algorithms (); + OpenSSL_add_all_ciphers (); + if (napi_create_function (env, NULL, 0, rsa_priv_key, - NULL, &rsa_fn) != napi_ok) + NULL, &rsa_fn) != napi_ok) napi_throw_error (env, NULL, "Unable to wrap native rsa function"); if (napi_create_function (env, NULL, 0, x509_cert_pub_key, - NULL, &x509_fn) != napi_ok) + NULL, &x509_fn) != napi_ok) napi_throw_error (env, NULL, "Unable to wrap native x509 function"); if (napi_set_named_property (env, exports, "RSAPrivateKey", - rsa_fn) != napi_ok) + rsa_fn) != napi_ok) napi_throw_error (env, NULL, "Unable to populate exports with rsa"); if (napi_set_named_property (env, exports, "X509PublicKey", - x509_fn) != napi_ok) + x509_fn) != napi_ok) napi_throw_error (env, NULL, "Unable to populate exports with x509"); return exports; } -NAPI_MODULE(NODE_GYP_MODULE_NAME, init) +NAPI_MODULE (NODE_GYP_MODULE_NAME, init) diff --git a/main.js b/main.js index 45bce13..f2c775b 100644 --- a/main.js +++ b/main.js @@ -1 +1 @@ -module.exports = require("./build/Release/node_openssl"); +module.exports = require('bindings')('node_openssl'); diff --git a/package.json b/package.json index 3ed8bcb..5a05a00 100644 --- a/package.json +++ b/package.json @@ -5,11 +5,17 @@ "private": true, "gypfile": true, "scripts": { - "start": "node-gyp configure build && node module.js", - "test": "node test.js" + "configure": "node-gyp configure", + "build": "node-gyp --debug rebuild", + "indent": "indent *.c *.h", + "test": "cd test && node test.js" + }, + "dependencies": { + "bindings": "^1.2.1", + "node-gyp": "" }, "engines": { - "node" : ">=8.4.0" + "node": ">=8.4.0" }, "author": "Joshua Houghton Date: Sat, 16 May 2020 21:28:05 +0100 Subject: [PATCH 15/18] fix rsa_st not being defined in node12 --- main.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/main.c b/main.c index a910bec..ac19419 100644 --- a/main.c +++ b/main.c @@ -23,6 +23,33 @@ #include #include +#if OPENSSL_VERSION_NUMBER >= 0x10100000L + +struct rsa_st { + /* + * #legacy + * The first field is used to pickup errors where this is passed + * instead of an EVP_PKEY. It is always zero. + * THIS MUST REMAIN THE FIRST FIELD. + */ + int dummy_zero; + + int32_t version; + const RSA_METHOD *meth; + /* functional reference if 'meth' is ENGINE-provided */ + ENGINE *engine; + BIGNUM *n; + BIGNUM *e; + BIGNUM *d; + BIGNUM *p; + BIGNUM *q; + BIGNUM *dmp1; + BIGNUM *dmq1; + BIGNUM *iqmp; +}; + +#endif + #include static napi_value From 0e6d9efa67dbf1c9bde08e946f3e64deef140365 Mon Sep 17 00:00:00 2001 From: Joshua Houghton Date: Wed, 28 Jun 2023 05:56:51 +0000 Subject: [PATCH 16/18] Get working on openssl 3.0 --- main.c | 3 + package.json | 3 +- yarn.lock | 711 --------------------------------------------------- 3 files changed, 4 insertions(+), 713 deletions(-) diff --git a/main.c b/main.c index ac19419..2453a05 100644 --- a/main.c +++ b/main.c @@ -34,6 +34,9 @@ struct rsa_st { */ int dummy_zero; +#if OPENSSL_VERSION_NUMBER >= 0x30000000L + OSSL_LIB_CTX *libctx; +#endif int32_t version; const RSA_METHOD *meth; /* functional reference if 'meth' is ENGINE-provided */ diff --git a/package.json b/package.json index 5a05a00..598f217 100644 --- a/package.json +++ b/package.json @@ -11,8 +11,7 @@ "test": "cd test && node test.js" }, "dependencies": { - "bindings": "^1.2.1", - "node-gyp": "" + "bindings": "^1.2.1" }, "engines": { "node": ">=8.4.0" diff --git a/yarn.lock b/yarn.lock index 99ba731..bf7d1f3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,83 +2,6 @@ # yarn lockfile v1 -abbrev@1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" - integrity sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q== - -ajv@^6.5.5: - version "6.10.2" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.10.2.tgz#d3cea04d6b017b2894ad69040fec8b623eb4bd52" - integrity sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw== - dependencies: - fast-deep-equal "^2.0.1" - fast-json-stable-stringify "^2.0.0" - json-schema-traverse "^0.4.1" - uri-js "^4.2.2" - -ansi-regex@^2.0.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" - integrity sha1-w7M6te42DYbg5ijwRorn7yfWVN8= - -ansi-regex@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" - integrity sha1-7QMXwyIGT3lGbAKWa922Bas32Zg= - -aproba@^1.0.3: - version "1.2.0" - resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a" - integrity sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw== - -are-we-there-yet@~1.1.2: - version "1.1.5" - resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz#4b35c2944f062a8bfcda66410760350fe9ddfc21" - integrity sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w== - dependencies: - delegates "^1.0.0" - readable-stream "^2.0.6" - -asn1@~0.2.3: - version "0.2.4" - resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.4.tgz#8d2475dfab553bb33e77b54e59e880bb8ce23136" - integrity sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg== - dependencies: - safer-buffer "~2.1.0" - -assert-plus@1.0.0, assert-plus@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" - integrity sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU= - -asynckit@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" - integrity sha1-x57Zf380y48robyXkLzDZkdLS3k= - -aws-sign2@~0.7.0: - version "0.7.0" - resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" - integrity sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg= - -aws4@^1.8.0: - version "1.8.0" - resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.8.0.tgz#f0e003d9ca9e7f59c7a508945d7b2ef9a04a542f" - integrity sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ== - -balanced-match@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" - integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= - -bcrypt-pbkdf@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz#a4301d389b6a43f9b67ff3ca11a3f6637e360e9e" - integrity sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4= - dependencies: - tweetnacl "^0.14.3" - bindings@^1.2.1: version "1.5.0" resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.5.0.tgz#10353c9e945334bc0511a6d90b38fbc7c9c504df" @@ -86,641 +9,7 @@ bindings@^1.2.1: dependencies: file-uri-to-path "1.0.0" -brace-expansion@^1.1.7: - version "1.1.11" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" - integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== - dependencies: - balanced-match "^1.0.0" - concat-map "0.0.1" - -caseless@~0.12.0: - version "0.12.0" - resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" - integrity sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw= - -chownr@^1.1.1: - version "1.1.3" - resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.3.tgz#42d837d5239688d55f303003a508230fa6727142" - integrity sha512-i70fVHhmV3DtTl6nqvZOnIjbY0Pe4kAUjwHj8z0zAdgBtYrJyYwLKCCuRBQ5ppkyL0AkN7HKRnETdmdp1zqNXw== - -code-point-at@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" - integrity sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c= - -combined-stream@^1.0.6, combined-stream@~1.0.6: - version "1.0.8" - resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" - integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== - dependencies: - delayed-stream "~1.0.0" - -concat-map@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" - integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= - -console-control-strings@^1.0.0, console-control-strings@~1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" - integrity sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4= - -core-util-is@1.0.2, core-util-is@~1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" - integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= - -dashdash@^1.12.0: - version "1.14.1" - resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" - integrity sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA= - dependencies: - assert-plus "^1.0.0" - -delayed-stream@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" - integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk= - -delegates@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" - integrity sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o= - -ecc-jsbn@~0.1.1: - version "0.1.2" - resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9" - integrity sha1-OoOpBOVDUyh4dMVkt1SThoSamMk= - dependencies: - jsbn "~0.1.0" - safer-buffer "^2.1.0" - -env-paths@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/env-paths/-/env-paths-2.2.0.tgz#cdca557dc009152917d6166e2febe1f039685e43" - integrity sha512-6u0VYSCo/OW6IoD5WCLLy9JUGARbamfSavcNXry/eu8aHVFei6CD3Sw+VGX5alea1i9pgPHW0mbu6Xj0uBh7gA== - -extend@~3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" - integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g== - -extsprintf@1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" - integrity sha1-lpGEQOMEGnpBT4xS48V06zw+HgU= - -extsprintf@^1.2.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f" - integrity sha1-4mifjzVvrWLMplo6kcXfX5VRaS8= - -fast-deep-equal@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49" - integrity sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk= - -fast-json-stable-stringify@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" - integrity sha1-1RQsDK7msRifh9OnYREGT4bIu/I= - file-uri-to-path@1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz#553a7b8446ff6f684359c445f1e37a05dacc33dd" integrity sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw== - -forever-agent@~0.6.1: - version "0.6.1" - resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" - integrity sha1-+8cfDEGt6zf5bFd60e1C2P2sypE= - -form-data@~2.3.2: - version "2.3.3" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6" - integrity sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ== - dependencies: - asynckit "^0.4.0" - combined-stream "^1.0.6" - mime-types "^2.1.12" - -fs-minipass@^1.2.5: - version "1.2.7" - resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-1.2.7.tgz#ccff8570841e7fe4265693da88936c55aed7f7c7" - integrity sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA== - dependencies: - minipass "^2.6.0" - -fs.realpath@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" - integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= - -gauge@~2.7.3: - version "2.7.4" - resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7" - integrity sha1-LANAXHU4w51+s3sxcCLjJfsBi/c= - dependencies: - aproba "^1.0.3" - console-control-strings "^1.0.0" - has-unicode "^2.0.0" - object-assign "^4.1.0" - signal-exit "^3.0.0" - string-width "^1.0.1" - strip-ansi "^3.0.1" - wide-align "^1.1.0" - -getpass@^0.1.1: - version "0.1.7" - resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa" - integrity sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo= - dependencies: - assert-plus "^1.0.0" - -glob@^7.1.3, glob@^7.1.4: - version "7.1.6" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" - integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.0.4" - once "^1.3.0" - path-is-absolute "^1.0.0" - -graceful-fs@^4.2.2: - version "4.2.3" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.3.tgz#4a12ff1b60376ef09862c2093edd908328be8423" - integrity sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ== - -har-schema@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" - integrity sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI= - -har-validator@~5.1.0: - version "5.1.3" - resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-5.1.3.tgz#1ef89ebd3e4996557675eed9893110dc350fa080" - integrity sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g== - dependencies: - ajv "^6.5.5" - har-schema "^2.0.0" - -has-unicode@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" - integrity sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk= - -http-signature@~1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1" - integrity sha1-muzZJRFHcvPZW2WmCruPfBj7rOE= - dependencies: - assert-plus "^1.0.0" - jsprim "^1.2.2" - sshpk "^1.7.0" - -inflight@^1.0.4: - version "1.0.6" - resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" - integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= - dependencies: - once "^1.3.0" - wrappy "1" - -inherits@2, inherits@~2.0.3: - version "2.0.4" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" - integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== - -is-fullwidth-code-point@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" - integrity sha1-754xOG8DGn8NZDr4L95QxFfvAMs= - dependencies: - number-is-nan "^1.0.0" - -is-fullwidth-code-point@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" - integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= - -is-typedarray@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" - integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo= - -isarray@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" - integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= - -isexe@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" - integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= - -isstream@~0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" - integrity sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo= - -jsbn@~0.1.0: - version "0.1.1" - resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" - integrity sha1-peZUwuWi3rXyAdls77yoDA7y9RM= - -json-schema-traverse@^0.4.1: - version "0.4.1" - resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" - integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== - -json-schema@0.2.3: - version "0.2.3" - resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" - integrity sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM= - -json-stringify-safe@~5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" - integrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus= - -jsprim@^1.2.2: - version "1.4.1" - resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2" - integrity sha1-MT5mvB5cwG5Di8G3SZwuXFastqI= - dependencies: - assert-plus "1.0.0" - extsprintf "1.3.0" - json-schema "0.2.3" - verror "1.10.0" - -mime-db@1.42.0: - version "1.42.0" - resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.42.0.tgz#3e252907b4c7adb906597b4b65636272cf9e7bac" - integrity sha512-UbfJCR4UAVRNgMpfImz05smAXK7+c+ZntjaA26ANtkXLlOe947Aag5zdIcKQULAiF9Cq4WxBi9jUs5zkA84bYQ== - -mime-types@^2.1.12, mime-types@~2.1.19: - version "2.1.25" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.25.tgz#39772d46621f93e2a80a856c53b86a62156a6437" - integrity sha512-5KhStqB5xpTAeGqKBAMgwaYMnQik7teQN4IAzC7npDv6kzeU6prfkR67bc87J1kWMPGkoaZSq1npmexMgkmEVg== - dependencies: - mime-db "1.42.0" - -minimatch@^3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" - integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== - dependencies: - brace-expansion "^1.1.7" - -minimist@0.0.8: - version "0.0.8" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" - integrity sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0= - -minipass@^2.6.0, minipass@^2.8.6, minipass@^2.9.0: - version "2.9.0" - resolved "https://registry.yarnpkg.com/minipass/-/minipass-2.9.0.tgz#e713762e7d3e32fed803115cf93e04bca9fcc9a6" - integrity sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg== - dependencies: - safe-buffer "^5.1.2" - yallist "^3.0.0" - -minizlib@^1.2.1: - version "1.3.3" - resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-1.3.3.tgz#2290de96818a34c29551c8a8d301216bd65a861d" - integrity sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q== - dependencies: - minipass "^2.9.0" - -mkdirp@^0.5.0, mkdirp@^0.5.1: - version "0.5.1" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" - integrity sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM= - dependencies: - minimist "0.0.8" - -node-gyp@: - version "6.0.1" - resolved "https://registry.yarnpkg.com/node-gyp/-/node-gyp-6.0.1.tgz#d59c4247df61bb343f56e2c41d9c8dc2bc361470" - integrity sha512-udHG4hGe3Ji97AYJbJhaRwuSOuQO7KHnE4ZPH3Sox3tjRZ+bkBsDvfZ7eYA1qwD8eLWr//193x806ss3HFTPRw== - dependencies: - env-paths "^2.2.0" - glob "^7.1.4" - graceful-fs "^4.2.2" - mkdirp "^0.5.1" - nopt "^4.0.1" - npmlog "^4.1.2" - request "^2.88.0" - rimraf "^2.6.3" - semver "^5.7.1" - tar "^4.4.12" - which "^1.3.1" - -nopt@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/nopt/-/nopt-4.0.1.tgz#d0d4685afd5415193c8c7505602d0d17cd64474d" - integrity sha1-0NRoWv1UFRk8jHUFYC0NF81kR00= - dependencies: - abbrev "1" - osenv "^0.1.4" - -npmlog@^4.1.2: - version "4.1.2" - resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b" - integrity sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg== - dependencies: - are-we-there-yet "~1.1.2" - console-control-strings "~1.1.0" - gauge "~2.7.3" - set-blocking "~2.0.0" - -number-is-nan@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" - integrity sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0= - -oauth-sign@~0.9.0: - version "0.9.0" - resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455" - integrity sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ== - -object-assign@^4.1.0: - version "4.1.1" - resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" - integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= - -once@^1.3.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" - integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= - dependencies: - wrappy "1" - -os-homedir@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" - integrity sha1-/7xJiDNuDoM94MFox+8VISGqf7M= - -os-tmpdir@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" - integrity sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ= - -osenv@^0.1.4: - version "0.1.5" - resolved "https://registry.yarnpkg.com/osenv/-/osenv-0.1.5.tgz#85cdfafaeb28e8677f416e287592b5f3f49ea410" - integrity sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g== - dependencies: - os-homedir "^1.0.0" - os-tmpdir "^1.0.0" - -path-is-absolute@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" - integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= - -performance-now@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" - integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns= - -process-nextick-args@~2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" - integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== - -psl@^1.1.24: - version "1.4.0" - resolved "https://registry.yarnpkg.com/psl/-/psl-1.4.0.tgz#5dd26156cdb69fa1fdb8ab1991667d3f80ced7c2" - integrity sha512-HZzqCGPecFLyoRj5HLfuDSKYTJkAfB5thKBIkRHtGjWwY7p1dAyveIbXIq4tO0KYfDF2tHqPUgY9SDnGm00uFw== - -punycode@^1.4.1: - version "1.4.1" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" - integrity sha1-wNWmOycYgArY4esPpSachN1BhF4= - -punycode@^2.1.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" - integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== - -qs@~6.5.2: - version "6.5.2" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" - integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA== - -readable-stream@^2.0.6: - version "2.3.6" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf" - integrity sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw== - dependencies: - core-util-is "~1.0.0" - inherits "~2.0.3" - isarray "~1.0.0" - process-nextick-args "~2.0.0" - safe-buffer "~5.1.1" - string_decoder "~1.1.1" - util-deprecate "~1.0.1" - -request@^2.88.0: - version "2.88.0" - resolved "https://registry.yarnpkg.com/request/-/request-2.88.0.tgz#9c2fca4f7d35b592efe57c7f0a55e81052124fef" - integrity sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg== - dependencies: - aws-sign2 "~0.7.0" - aws4 "^1.8.0" - caseless "~0.12.0" - combined-stream "~1.0.6" - extend "~3.0.2" - forever-agent "~0.6.1" - form-data "~2.3.2" - har-validator "~5.1.0" - http-signature "~1.2.0" - is-typedarray "~1.0.0" - isstream "~0.1.2" - json-stringify-safe "~5.0.1" - mime-types "~2.1.19" - oauth-sign "~0.9.0" - performance-now "^2.1.0" - qs "~6.5.2" - safe-buffer "^5.1.2" - tough-cookie "~2.4.3" - tunnel-agent "^0.6.0" - uuid "^3.3.2" - -rimraf@^2.6.3: - version "2.7.1" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec" - integrity sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w== - dependencies: - glob "^7.1.3" - -safe-buffer@^5.0.1, safe-buffer@^5.1.2: - version "5.2.0" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.0.tgz#b74daec49b1148f88c64b68d49b1e815c1f2f519" - integrity sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg== - -safe-buffer@~5.1.0, safe-buffer@~5.1.1: - version "5.1.2" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" - integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== - -safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0: - version "2.1.2" - resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" - integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== - -semver@^5.7.1: - version "5.7.1" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" - integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== - -set-blocking@~2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" - integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc= - -signal-exit@^3.0.0: - version "3.0.2" - resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" - integrity sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0= - -sshpk@^1.7.0: - version "1.16.1" - resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.16.1.tgz#fb661c0bef29b39db40769ee39fa70093d6f6877" - integrity sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg== - dependencies: - asn1 "~0.2.3" - assert-plus "^1.0.0" - bcrypt-pbkdf "^1.0.0" - dashdash "^1.12.0" - ecc-jsbn "~0.1.1" - getpass "^0.1.1" - jsbn "~0.1.0" - safer-buffer "^2.0.2" - tweetnacl "~0.14.0" - -string-width@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" - integrity sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M= - dependencies: - code-point-at "^1.0.0" - is-fullwidth-code-point "^1.0.0" - strip-ansi "^3.0.0" - -"string-width@^1.0.2 || 2": - version "2.1.1" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" - integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw== - dependencies: - is-fullwidth-code-point "^2.0.0" - strip-ansi "^4.0.0" - -string_decoder@~1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" - integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== - dependencies: - safe-buffer "~5.1.0" - -strip-ansi@^3.0.0, strip-ansi@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" - integrity sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8= - dependencies: - ansi-regex "^2.0.0" - -strip-ansi@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" - integrity sha1-qEeQIusaw2iocTibY1JixQXuNo8= - dependencies: - ansi-regex "^3.0.0" - -tar@^4.4.12: - version "4.4.13" - resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.13.tgz#43b364bc52888d555298637b10d60790254ab525" - integrity sha512-w2VwSrBoHa5BsSyH+KxEqeQBAllHhccyMFVHtGtdMpF4W7IRWfZjFiQceJPChOeTsSDVUpER2T8FA93pr0L+QA== - dependencies: - chownr "^1.1.1" - fs-minipass "^1.2.5" - minipass "^2.8.6" - minizlib "^1.2.1" - mkdirp "^0.5.0" - safe-buffer "^5.1.2" - yallist "^3.0.3" - -tough-cookie@~2.4.3: - version "2.4.3" - resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.4.3.tgz#53f36da3f47783b0925afa06ff9f3b165280f781" - integrity sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ== - dependencies: - psl "^1.1.24" - punycode "^1.4.1" - -tunnel-agent@^0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" - integrity sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0= - dependencies: - safe-buffer "^5.0.1" - -tweetnacl@^0.14.3, tweetnacl@~0.14.0: - version "0.14.5" - resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" - integrity sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q= - -uri-js@^4.2.2: - version "4.2.2" - resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0" - integrity sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ== - dependencies: - punycode "^2.1.0" - -util-deprecate@~1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" - integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= - -uuid@^3.3.2: - version "3.3.3" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.3.tgz#4568f0216e78760ee1dbf3a4d2cf53e224112866" - integrity sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ== - -verror@1.10.0: - version "1.10.0" - resolved "https://registry.yarnpkg.com/verror/-/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400" - integrity sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA= - dependencies: - assert-plus "^1.0.0" - core-util-is "1.0.2" - extsprintf "^1.2.0" - -which@^1.3.1: - version "1.3.1" - resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" - integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ== - dependencies: - isexe "^2.0.0" - -wide-align@^1.1.0: - version "1.1.3" - resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.3.tgz#ae074e6bdc0c14a431e804e624549c633b000457" - integrity sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA== - dependencies: - string-width "^1.0.2 || 2" - -wrappy@1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" - integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= - -yallist@^3.0.0, yallist@^3.0.3: - version "3.1.1" - resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" - integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g== From cc8b71045f0b1ce2a648bda0f6cffb2f74ddf839 Mon Sep 17 00:00:00 2001 From: botjar Date: Sun, 10 Mar 2024 08:23:38 +0000 Subject: [PATCH 17/18] Automatically synchronising release.yml from develop to master --- .github/workflows/release.yml | 84 +++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..1c67d06 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,84 @@ +# **What it does:** Creates a release for the library, after checking there are changes that need releasing +# **Why we have it:** To automate the tagging the process +# **Who does it impact:** LI Engineering teams + +name: Release Library + +run-name: ${{ github.ref_name }}/${{ github.workflow }} + +on: + workflow_dispatch: + inputs: + release_type: + type: choice + default: "minor" + description: Semantic Version + options: + - "major" + - "minor" + source_branch: + description: Source Branch + type: string + default: develop + required: true + base_branch: + description: Base Branch + type: string + default: master + required: true + +jobs: + + check-component-for-changes: + uses: ripjar/component-workflows/.github/workflows/check-node-component-for-changes.yaml@v2 + with: + component_branch: ${{ inputs.source_branch }} + component_base_branch: ${{ inputs.base_branch }} + secrets: inherit + + release-component: + uses: ripjar/component-workflows/.github/workflows/release-node-component.yaml@v2 + needs: [ check-component-for-changes ] + if: needs.check-component-for-changes.outputs.is_release_required == '1' + with: + product: LI + node_version: 20 + component_branch: ${{ inputs.source_branch }} + component_base_branch: ${{ inputs.base_branch }} + release_type: ${{ inputs.release_type }} + secrets: inherit + + extract-version: + runs-on: arc + if: always() + needs: [ release-component ] + outputs: + version: ${{ steps.package_version.outputs.VERSION }} + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + with: + ref: ${{ inputs.base_branch }} + - name: Get version from package.json + id: package_version + run: echo "::set-output name=VERSION::$(jq -r '.version' package.json)" + shell: bash + + bump-component-version: + uses: ripjar/component-workflows/.github/workflows/bump-node-component-version.yaml@v2 + needs: [ release-component ] + secrets: inherit + with: + component_branch: ${{ inputs.source_branch }} + + notify: + needs: [check-component-for-changes, release-component, extract-version, bump-component-version] + if: always() + uses: ripjar/li-ci-cd/.github/workflows/li-release-notify.yaml@develop + secrets: inherit + with: + repository_name: ${{ github.repository }} + is_release_required: ${{ needs.check-component-for-changes.outputs.is_release_required }} + release_result: ${{ needs.release-component.result }} + version: ${{ needs.extract-version.outputs.version }} + channel_id: 'C019Q1F40SX' From c11f23620e5a384762eee654b9b21273de5446f0 Mon Sep 17 00:00:00 2001 From: adamjjeffery <112865524+adamjjeffery@users.noreply.github.com> Date: Tue, 30 Apr 2024 15:19:11 +0100 Subject: [PATCH 18/18] Updates .github/workflows/release.yml with new #li-releases channel id --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1c67d06..60e7f2e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -81,4 +81,4 @@ jobs: is_release_required: ${{ needs.check-component-for-changes.outputs.is_release_required }} release_result: ${{ needs.release-component.result }} version: ${{ needs.extract-version.outputs.version }} - channel_id: 'C019Q1F40SX' + channel_id: 'C06PLQQEZRA'