Code Monkey home page Code Monkey logo

serverless-software-license's People

Contributors

niksauer avatar trafalgaroutlaw avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

serverless-software-license's Issues

Realize ILicenseStorage interface for file system

  • Create a class called FileLicenseStorage that implements the ILicenseStorage interface (see interfaces/manager.ts) by writing and reading the License object to and from disk.

  • The class should accept a path at which the file is stored.

  • Please create a new folder for this class called storage in the src/lib directory.

  • Create a test case verifying that the getLicense method throws if the disk contents don't match a License.

  • Create a test case verifying that the setLicense method throws if the contents to be written don't match a License.

  • Create a test case verifying that the contents written to disk match those retrieved.

Implement two-step registration

  • Search for a cross-platform compatible webcrypto shim to generate random data in a new getRandomData utility function

  • Implement startRegister by:

  1. Checking it the address has a license according to the registry
  2. If above condition is true, continuing to generate a new address ownership challenge (leveraging new random data utility) and storing it in the private activeChallenge instance property
  • Implement completeRegister by:
  1. checking if the response fulfills the challenge (utilize verifyOwnership in util.ts)
  2. If above condition is true, continuing to write the license to storage, setting the private _isValid property to true, emitting a LicenseManagerEvent.LicenseValidityChanged event and resetting the activeChallenge property
  • Add a test case verifying that startRegister fails if the address has no license on the registry
  • Add a test case verifying that startRegister returns a random string if the address has a license
  • Add a test case verifying that completeRegister fails if the challenge response comes from a different address
  • Add a test case verifying that completeRegister emits a LicenseManagerEvent.LicenseValidityChanged event if the challenge response stems from the same address. Also, verify that the manager‘s public isValid property has been set to false

Implement license validity check

  • Implement the LicenseManager's checkValidity method by:
  1. checking if the license retrieved from storage passes the address ownership challenge (see verifyOwnership in src/lib/util.ts)
  2. checking if the address referenced in the license has a license according to the registry associated with the manager (see hasLicense in src/lib/LicenseRegistry.ts)
  3. setting the private _isValid property according to the conditions met
  4. emitting a LicenseManagerEvent.LicenseValidityChanged event if the _isValid property changed compared to before calling this method
  • Create a test case verifying that the isValid property returns a boolean in any case
  • Create a test case verifying that the isValid property returns true if the conditions above are met
  • Create a test case verifying that the isValid property returns false if any of the conditions above aren't met

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.