npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

aksa-encryptory

v0.0.1

Published

This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 13.0.0. The core purpose of this library is to make encryption easier to use in any angular application.

Readme

AksaEncryptory

This library was generated with Angular CLI version 13.0.0. The core purpose of this library is to make encryption easier to use in any angular application.

Code scaffolding

Run npm install aksa-encryptory to install library.

Methodolgy

We are using Crypto Js, Node-Forge and Uuid as of third party libraries. For understanding of code please go through our github repository.

How to Use

In interceptor.ts file apply the following code snippet.

in constructor:

constructor(private _authService: AuthService,
                private _catchError:ErrorHandling,
                private EncryptoryService: AksaEncryptoryService
    )
    {
        this.EncryptoryService.publicKey = environment.RSA_PUBLIC_KEY
    }

In the code above, you have to declare a service object of Aksa Encryptory Service, later in constructor set value of public key basically RSA key. In our case we have declared it in Environment file you can use object of any file in which you have stored key.

this.setUser(this._authService.accessToken);
        if(environment.IsEncryption){
            if (!this._authService.accessToken) {
                var key = this.EncryptoryService.RandomKeyGenerator()
            } else {
                var key = this._authService.key;
            }
            newBody = this.EncryptoryService.AESRSAEncryption(newReq.body, key)
        }
        newReq = newReq.clone({
            body: {...newBody?newBody:newReq.body},
            headers: req.headers.set('Authorization', 'Bearer ' + this._authService.accessToken)
        });

At first, before login, it will assign a random key to our request body, when there is no token. Then in AESRSA method, will send request body and that randomly generated key. Once it will pass the login phase, then it will always use key which is returned from response we got from login request. like this:

return next.handle(newReq).pipe(
            map((data:any)=> this._catchError.transformData(data,key)),
            catchError((error) => this._catchError.onCatch(error))
        );

While Decrypting the request this will how you use AES Dcrypt method:

transformData(data:any,key:any=null){
        debugger
        if(environment.IsEncryption) {
            if (data && data.body && data.body.data) {
                if (this._authService.key) {
                    data.body = this.EncryptoryService.AESDcrypt(data.body.data, this._authService.key);
                } else {
                    data.body = this.EncryptoryService.AESDcrypt(data.body.data, key);
                }
                return data;
            }
            return data;
        }
        else{
            return data;
        }

How It will work

In Aksa Encryptory Service it will first target this method:

AESRSAEncryption(data:any,aesKey:any){
    try{
      let aesData = this.AESEncrpyt(data,aesKey);
      let publicKey = forge.pki.publicKeyFromPem(this.publicKey);
      let rsaEncrpyted = publicKey.encrypt(aesKey);
      rsaEncrpyted = btoa(rsaEncrpyted);
      return {
        key : rsaEncrpyted,
        data : aesData
      }
    }
    catch (e) {
      console.log(e)
    }
  }

When a request body enters the service, it will first target AESEncrypt Function, this function will encrypt the request. Note: RandomKeyGenerator() method will be called once only. The public key which we have defined in interceptor.ts file, will be forged through Node Forge pkg, then this key will be encrypted. later it will return in interceptor two things:

  1. An Encrypted Request
  2. An Encrypted Key

When a key is returned in response after first call, make sure that you will set that key in the value of object you assigned to public key. That key will be AES key and will be used in most cases through Crypto Js.

Further help

To get more help on this library or suggestion go check out the Github page or contact us at [email protected].