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

Export an explicitly public interface directly from 'jolocom-lib' #343

Open
3 tasks
mnzaki opened this issue Aug 15, 2019 · 1 comment
Open
3 tasks

Export an explicitly public interface directly from 'jolocom-lib' #343

mnzaki opened this issue Aug 15, 2019 · 1 comment
Labels
tech debt Issues we need to address to make improve code quality

Comments

@mnzaki
Copy link
Contributor

mnzaki commented Aug 15, 2019

Description

Library consumers need to import certain interfaces and classes, they should not be using the direct paths or else we might break things if we make internal changes.

A definite "public" interface should be declared, specifying which interfaces are expected to be used publicly. Whether everything should be exported from ts/index.ts is still an open question. Perhaps some categorization?

Here are the imports from inside jolocom/smartwallet-app except for tests:

import { IdentityWallet } from 'jolocom-lib/js/identityWallet/identityWallet'
import {
  createJolocomRegistry,
  JolocomRegistry,
} from 'jolocom-lib/js/registries/jolocomRegistry'
import { jolocomContractsAdapter } from 'jolocom-lib/js/contracts/contractsAdapter'
import { jolocomEthereumResolver } from 'jolocom-lib/js/ethereum/ethereum'
import { jolocomContractsGateway } from 'jolocom-lib/js/contracts/contractsGateway'
import { publicKeyToDID } from 'jolocom-lib/js/utils/crypto'
import { Identity } from 'jolocom-lib/js/identity/identity'
import { IIpfsConnector } from 'jolocom-lib/js/ipfs/types'
import { IDidDocumentAttrs } from 'jolocom-lib/js/identity/didDocument/types'
import {
  ILinkedDataSignature,
  ILinkedDataSignatureAttrs,
} from 'jolocom-lib/js/linkedDataSignature/types'
import { ISignedCredentialAttrs } from 'jolocom-lib/js/credentials/signedCredential/types'
import { IClaimSection } from 'jolocom-lib/js/credentials/credential/types'

import { InteractionType } from 'jolocom-lib/js/interactionTokens/types'
import { DidDocument } from 'jolocom-lib/js/identity/didDocument/didDocument'
import {
  CredentialOfferMetadata,
  CredentialOfferRenderInfo,
} from 'jolocom-lib/js/interactionTokens/interactionTokens.types'
import { SoftwareKeyProvider } from 'jolocom-lib/js/vaultedKeyProvider/softwareProvider'
import { Authentication } from 'jolocom-lib/js/interactionTokens/authentication'
import { CredentialRequest } from 'jolocom-lib/js/interactionTokens/credentialRequest'
import { PaymentRequest } from 'jolocom-lib/js/interactionTokens/paymentRequest'
import { SignedCredential } from 'jolocom-lib/js/credentials/signedCredential/signedCredential'
import { JSONWebToken } from 'jolocom-lib/js/interactionTokens/JSONWebToken'
import { CredentialOfferRequest } from 'jolocom-lib/js/interactionTokens/credentialOfferRequest'
import { JolocomLib } from 'jolocom-lib'
import { CredentialsReceive } from 'jolocom-lib/js/interactionTokens/credentialsReceive'
import { keyIdToDid } from 'jolocom-lib/js/utils/helper'

And here are imports from tests:

import { IRegistry } from 'jolocom-lib/js/registries/types'
import { SignedCredential } from 'jolocom-lib/js/credentials/signedCredential/signedCredential'
import { JSONWebToken } from 'jolocom-lib/js/interactionTokens/JSONWebToken'
import { InteractionType } from 'jolocom-lib/js/interactionTokens/types'
import { JolocomLib } from 'jolocom-lib'
import { ISignedCredentialAttrs } from 'jolocom-lib/js/credentials/signedCredential/types'

Part of #355

TODO

  • decide on which classes/functions should be exported under what path
  • re-export them from index file ([PR HERE])
  • create issue on jolocom/smartwallet-app about using the new exports
@mnzaki mnzaki changed the title Export some classes/functions publicly directly from jolocom-lib Export an explicitly public interface directly from 'jolocom-lib' Sep 6, 2019
@mnzaki mnzaki mentioned this issue Sep 6, 2019
6 tasks
@mnzaki mnzaki added the tech debt Issues we need to address to make improve code quality label Sep 6, 2019
@mnzaki
Copy link
Contributor Author

mnzaki commented Sep 6, 2019

Instead of having to do things like:

import { Identity } from 'jolocom-lib/js/identity/identity'
import { SoftwareKeyProvider } from 'jolocom-lib/js/vaultedKeyProvider/softwareProvider'

One option is exporting everything from index so users can do:

import { Identity, SoftwareKeyProvider } from 'jolocom-lib'

Another option is to consider the JolocomLib export our "public API" and just add whatever is missing to it. But types/interfaces will need to be exported, can't be added to the JolocomLib object

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tech debt Issues we need to address to make improve code quality
Projects
None yet
Development

No branches or pull requests

1 participant