How to create npm package with the security

Viewed 49

I need to create an npm package with security in form of api key an client id, I want to create something like is in a e.q. Stripe package that we import a main class and pass client_id and api_key into the class params :

import Stripe from 'stripe';

const stripe = new Stripe('api_key', 'client_id');

stripe.customers.create(); //if proper keys

And now i have a questions, for first, How to create a package with only one access point(like new Stripe(...) where we pass an auth data(any tutorial please)?, and second, How to properly secure all of the functions in the library when auth data is not properly?

thanks for any help!

ps. if you have a nice tutorial or article about create npm packages with secure(like providing api_keys) i will be greatefull!

0 Answers
Related