javascriptnode.jsnpmhapi.js

Iron.seal does not work when user log in


Iron.seal does not work on updating npm module Iron ,that's why I faced this issue on log in the user

var obj = {
    a: 1,
    b: 2,
    c: [3, 4, 5],
    d: {
        e: 'f'
    }
};

var password = 'some_not_random_password_that_is_at_least_32_characters';

Iron.seal(obj, password, Iron.defaults, function (err, sealed) {`

    console.log(sealed);
});

Can anyone guide me why I faced this issue


Solution

  • I also faced the similar issue when I updated the iron npm package.

    The docs on github are updated. instead of callback they are now using async await.

    What you can do is:

    try {
     const sealed = await Iron.seal(obj, password, Iron.defaults);
     console.log(sealed);
      } 
    catch (err) {
     console.log(err.message);
    }