Neatly Punctuated Musings

    licensekey
    TypeScript icon, indicating that this package has built-in type declarations

    2.3.4 • Public • Published

    licenseKey

    This Angular Module allows you to generate a License Key and validate the license. This is typically used for software licensing (serial number).

    Installation

    npm install licensekey
    

    Scaffolding

    Import the module into your project under imports

    imports: [
        BrowserModule,
        AppRoutingModule,
        LicensekeyModule
      ],
    

    Use

    In your component file, import the module in the constructor

    private license: Licensekey
    

    Then call any of the functions, like the eample below

    this.licenseKey.createLicense(info)
    

    Here is a sample of a component setup

    export class AppComponent implements OnInit {
    
      constructor(
        private license: Licensekey
        ) {}
    
      ngOnInit() {
    
        const licenseInfo = new License({ info, prodCode:"LEN100120", appVersion:"1.5"})
        const serial = this.license.createLicense(licenseInfo)
    
        console.log('serial:', serial) 
    
      }
    
    }
    

    Data Structure

    To create a license key - Enter the users information that your are able to recieve

    This object can be any data you wish to tie the license to

    const info = {company:"wavecoders",street:"123 licenseKey ave", city:"Fargos", state:"Vancover", zip:"M4F102"}
    
    const licenseInfo = new License({ info, prodCode:"LEN100120", appVersion:"1.5", versionLock: true })
    

    Must include:

    1. productCode (string) - product abbr name, can be any size
    2. appVersion (string) - product version number based on major release version
    3. versionLock (true|false) - lock serial to major release version
    userLicense = {info:userInfo, prodCode:"LEN100120", appVersion:"1.5"} 
    

    Create a License Key

    Then run the following code to recieve the License for the client This function to be run ONLY for you to generate the license code for the client

    
    const licenseInfo = new License({ info, prodCode:"LEN100120", appVersion:"1.5", versionLock: true })
    
    const serial = this.license.createLicense(licenseInfo)
    
    console.log('serial:', serial) 
    
    

    if success returns

    YUYV1-06WT6-W2XX0-3F343-32652-746BA
    

    Validate a License Key

    On client side your application will pass the user information (Data Structure) and License Key:

    const licenseInfo = new License({ info, prodCode:"LEN100120", appVersion:"1.5", versionLock: true })
    const serial = "YUYV1-06WT6-W2XX0-3F343-32652-746BA"
    
    const isValid = this.license.validateLicense(licenseInfo, serial)
    
    console.log('isValid:', isValid) //true
    
    

    if success returns TRUE

    Install

    npm i licensekey

    DownloadsWeekly Downloads

    83

    Version

    2.3.4

    License

    ISC

    Unpacked Size

    156 kB

    Total Files

    26

    Last publish

    Collaborators

    • wavecoders