js-Sha256 node library giving error after use of sha256 function

When I am trying to Import the Sha256 node library my scene gets corrupted

[Scene] Script “21a4byeAjhMqp+Eyz+0qht2” attached to “Bg” is missing or invalid. Detailed information:

Script UUID: “21a4bc9e-0238-4caa-9f84-cb3fb4aa1b76”

Class ID: “21a4byeAjhMqp+Eyz+0qht2”

Script UUID: “21a4bc9e-0238-4caa-9f84-cb3fb4aa1b76”

Class ID: “21a4byeAjhMqp+Eyz+0qht2”

at report (/Users/chandankrishnani/Documents/project/CocosCreator 2.app/Contents/Resources/app.asar/builtin/engine/dist/editor-extends/missing-reporter/missing-class-reporter.ccc:1:1113)

at reportByWalker (/Users/chandankrishnani/Documents/project/CocosCreator 2.app/Contents/Resources/app.asar/builtin/engine/dist/editor-extends/missing-reporter/missing-class-reporter.ccc:1:1209)

at /Users/chandankrishnani/Documents/project/CocosCreator 2.app/Contents/Resources/app.asar/builtin/engine/dist/editor-extends/missing-reporter/missing-class-reporter.ccc:1:1783

at ObjectWalkerBehavior.walk (/Users/chandankrishnani/Documents/project/CocosCreator 2.app/Contents/Resources/app.asar/builtin/engine/dist/editor-extends/missing-reporter/object-walker.ccc:1:2348)

at ObjectWalkerBehavior.forEach (/Users/chandankrishnani/Documents/project/CocosCreator 2.app/Contents/Resources/app.asar/builtin/engine/dist/editor-extends/missing-reporter/object-walker.ccc:1:812)

at ObjectWalkerBehavior.parseObject (/Users/chandankrishnani/Documents/project/CocosCreator 2.app/Contents/Resources/app.asar/builtin/engine/dist/editor-extends/missing-reporter/object-walker.ccc:1:306)

at doWalkProperties (/Users/chandankrishnani/Documents/project/CocosCreator 2.app/Contents/Resources/app.asar/builtin/engine/dist/editor-extends/missing-reporter/object-walker.ccc:1:2143)

import { sha256, sha224 } from ‘js-sha256’;

//It is making my scene corrupt i have used npm init and then install npm install js-sha256 and package is successfully installed

I can ask engineering to take a look at this topic.

hi you can use jwt for encode
you install it with npm and use like this

import * as jwt from "jsonwebtoken"

for encode :

jwt.sign( " your data ", "your key " , { algorithm: 'HS256' })

for decode :

jwt.decode(" your sha256 data " , {complete : true}).payload


An error has occur after use sha256, it is not support to use js-sha256.

I was getting the same error. Then I used jshashes here is a link for reference: jshashes - npm
It worked for me :

  1. Add jshashes node package
  2. Make a file like sha256.d.ts and declare package eg: declare module ‘jshashes’;
    3 . In your main file import the package eg: import hashes from “jshashes”
  3. Then use it anywhere in your file
    var SHA256 = new hashes.SHA256
    let generated_signature = SHA256.hex(“hello”);

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.