JSPM

scratch-certification

0.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q29476F
  • License MIT

A module to create and verify 3rd party Scratch connections.

Package Exports

  • scratch-certification

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (scratch-certification) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

scratch-certification (SCTF)

An NPM module to verify third-party Scratch extensions.

Installation

// Using NPM
npm install scratch-certification

// Using Yarn
yarn add scratch-certification

Requiring Module

// Using Node.js
const sctf = require('scratch-certification');

// Using React.js
import 'scratch-certification';

Concept

This module has a system of hashes and codes. Think of a hash as a random unique string to initialize the Scratch connection, and a code as a password to log into your Scratch connnection.

Pros and Cons

Pros:

  • It's a module, meaning it grants developers more flexability and customization for usage of their choice
  • The code system allows users to have a more memorable login method, and a partial account-based system
  • It solves the web exploit problem in existing modules, by having flexability to require a username to login via a login/sign in system.

Cons:

  • Only 3 functions (More coming soon)
  • No multi-language suport (Coming soon)

Example Code / Usage

Create Hash

Functionalities: Creates a random distinguishable crypto generated string.

Parameters:

  • length - The length of the hash (Leave blank for a default of 45) - Optional

Example Code:

const sctf = require('scratch-certification'); // Require SCTF

const myHash = sctf.createHash(50); // Create hash with a length of 50 

console.log(myHash); // -> 937edd69e10f253dd309a0e8b7d126f8f37cfd277577a494cd

Notes:

  • There are no notes for this function.

Check Hash

Functionalities: Checks the user's Scratch profile for the hash, returns HTTP status code depending on what it finds

Parameters:

  • Hash - The hash to check for (generated with createhash() or your own generated hash (not recommended)) - Mandatory
  • User - The Scratch profile username that the module checks for the hash on - Mandatory

Example Code:

const sctf = require('scratch-certification'); // Require SCTF

sctf.checkHash(hash, 'griffpatch').then((res) => {
  if (res === 302) { // Hash found
    console.log('Hash found!');
  } else if (res === 404) { // Hash not found
    console.log('Hash not found');
  } else if (res === 400) { // Error
    console.log('Error');
  }
});

Notes:

  • Returns a promise, requiring usage of .then or an asynchronous function expression
  • Returns HTTP status codes to indicate whether a hash was found. See a list of HTTP status codes here

Create Code

Functionalities: Takes a password (recommended user input), and adds characters at the end to secure it further, creating a code.

Parameters:

  • Password - The password to secure and return - Mandatory
  • Length - The amount of characters to add when securing the password. Leave blank for a default of 5 - Optional

Example Code:

const sctf = require('scratch-certification'); // Require SCTF

const code = sctf.createCode('unicorn', 10);

console.log(code); // -> unicorn`)0~$$6+|!

Notes:

  • There are no notes for this function.

Contac