Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: KeyUtils is not exported #145

Open
lemoustachiste opened this issue Jul 26, 2021 · 1 comment
Open

Error: KeyUtils is not exported #145

lemoustachiste opened this issue Jul 26, 2021 · 1 comment

Comments

@lemoustachiste
Copy link

Similarly to this error: transmute-industries/verifiable-data#73, I am also encountering a build issue with did-key-secp256k1:

[!] Error: 'keyUtils' is not exported by node_modules/@transmute/did-key-secp256k1/dist/did-key-secp256k1.esm.js, imported by src/inspectors/confirmDidSignature.ts
https://rollupjs.org/guide/en/#error-name-is-not-exported-by-module
src/inspectors/confirmDidSignature.ts (4:9)
2: import { IDidDocument } from '../models/DidDocument';
3: import { IDidDocumentPublicKey } from '@decentralized-identity/did-common-typescript';
4: import { keyUtils } from '@transmute/did-key-secp256k1';
            ^
@lemoustachiste
Copy link
Author

lemoustachiste commented Jul 26, 2021

Actually it looks like it's not available at all. In a former version of the package I was using keyUtils as follows:

function retrieveIssuingAddress (verificationMethodPublicKey: IDidDocumentPublicKey, chain: IBlockchainObject): string {
  const publicKey = keyUtils.publicKeyUInt8ArrayFromJwk(verificationMethodPublicKey.publicKeyJwk as keyUtils.ISecp256k1PublicKeyJwk);
  const address = bitcoin.payments.p2pkh({ pubkey: publicKey, network: bitcoin.networks[chain.code] }).address;
  return address;
}

And on my issuing side:

function jwkFrom (key: Buffer, isPrivate: boolean = false): any /* @trust/keyto */ {
  const keyToHexString = key.toString('hex');
  if (isPrivate) {
    return keyUtils.privateKeyJwkFromPrivateKeyHex(keyToHexString);
  }

  return keyUtils.publicKeyJwkFromPublicKeyHex(keyToHexString);
}

Are those still available for consumption?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant