decentralized-identity / did-jwt

Create and verify DID verifiable JWT's in Javascript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] using this lib with expo web fails during bundling

mirceanis opened this issue ยท comments

./node_modules/did-jwt/lib/index.module.js 1635:17
Module parse failed: Unexpected token (1635:17)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|               // TODO: should be able to use non base58 keys too
|               return key.type === 'X25519KeyAgreementKey2019' && Boolean(key.publicKeyBase58);
>             })) ?? [];
|             if (!pks.length && !controllerEncrypters.length) throw new Error(`no_suitable_keys: Could not find x25519 key for ${did}`);
|             return pks.map(pk => x25519Encrypter(base58ToBytes(pk.publicKeyBase58), pk.id)).concat(...controllerEncrypters);

using @babel/plugin-proposal-nullish-coalescing-operator doesn't solve it.

I also have this issue when using key-did-provider-ed25519

I was able to work around this issue by forcing this lib through the transpiler again:

npm i -D @expo/webpack-config
// filename: webpack.config.js
const createExpoWebpackConfigAsync = require('@expo/webpack-config');

module.exports = async function(env, argv) {
    const config = await createExpoWebpackConfigAsync({
        ...env,
        babel: {
            dangerouslyAddModulePathsToTranspile: ['did-jwt', 'ethr-did-resolver']
        }
    }, argv);
    return config;
};

๐ŸŽ‰ This issue has been resolved in version 6.2.1 ๐ŸŽ‰

The release is available on:

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€