From 4cc120f1bd65af96c459c7ca0f4e5777800d823b Mon Sep 17 00:00:00 2001 From: Raphael Flechtner Date: Wed, 9 Aug 2023 16:55:59 -0400 Subject: [PATCH 1/2] refactor: move non-credential stuff out of core --- jest.config.js | 2 +- packages/core/src/credential/Credential.spec.ts | 3 +-- packages/core/src/index.ts | 2 -- packages/sdk-js/package.json | 6 +++++- .../{core => sdk-js}/src/balance/Balance.utils.spec.ts | 0 packages/{core => sdk-js}/src/balance/Balance.utils.ts | 0 packages/{core => sdk-js}/src/balance/index.ts | 0 packages/sdk-js/src/index.ts | 2 ++ packages/{core => sdk-js}/src/kilt/Kilt.ts | 0 packages/{core => sdk-js}/src/kilt/index.ts | 0 packages/vc-export/src/DidJwt.spec.ts | 7 +------ packages/vc-export/src/Presentation.spec.ts | 4 ++-- .../src/vc-js/suites/Sr25519Signature2020.spec.ts | 10 ++++------ tests/integration/AccountLinking.spec.ts | 3 +-- tests/integration/Attestation.spec.ts | 4 ++-- tests/integration/Balance.spec.ts | 2 +- tests/integration/Blockchain.spec.ts | 3 +-- tests/integration/Ctypes.spec.ts | 3 +-- tests/integration/Delegation.spec.ts | 9 +++++---- tests/integration/Deposit.spec.ts | 5 +++-- tests/integration/Did.spec.ts | 3 +-- tests/integration/ErrorHandler.spec.ts | 3 +-- tests/integration/PublicCredentials.spec.ts | 3 +-- tests/integration/Web3Names.spec.ts | 3 +-- tests/integration/utils.ts | 10 +++++++--- yarn.lock | 4 ++++ 26 files changed, 45 insertions(+), 46 deletions(-) rename packages/{core => sdk-js}/src/balance/Balance.utils.spec.ts (100%) rename packages/{core => sdk-js}/src/balance/Balance.utils.ts (100%) rename packages/{core => sdk-js}/src/balance/index.ts (100%) rename packages/{core => sdk-js}/src/kilt/Kilt.ts (100%) rename packages/{core => sdk-js}/src/kilt/index.ts (100%) diff --git a/jest.config.js b/jest.config.js index 6eaca784e..381c38bea 100644 --- a/jest.config.js +++ b/jest.config.js @@ -33,7 +33,7 @@ const common = { 'packages/types/', 'packages/augment-api/', 'packages/type-definitions/', - 'packages/core/src/kilt/', + 'packages/sdk-js/src/kilt/', 'index.ts', 'types.ts', '.chain.ts', diff --git a/packages/core/src/credential/Credential.spec.ts b/packages/core/src/credential/Credential.spec.ts index ffa25284f..ec1f61686 100644 --- a/packages/core/src/credential/Credential.spec.ts +++ b/packages/core/src/credential/Credential.spec.ts @@ -36,7 +36,6 @@ import { import * as Attestation from '../attestation' import * as Claim from '../claim' import * as CType from '../ctype' -import { init } from '../kilt' import * as Credential from './Credential' const testCType = CType.fromProperties('Credential', { @@ -75,7 +74,7 @@ beforeAll(async () => { } as any) ), } as any - await init({ api }) + ConfigService.set({ api }) }) describe('Credential', () => { diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 8eec5151d..f9e91d7d0 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -11,10 +11,8 @@ export * as Attestation from './attestation/index.js' export * as Credential from './credential/index.js' -export { BalanceUtils } from './balance/index.js' export * as Claim from './claim/index.js' export * as CType from './ctype/index.js' export { DelegationNode, DelegationNodeUtils } from './delegation/index.js' -export { connect, disconnect, init } from './kilt/index.js' export { SDKErrors } from '@kiltprotocol/utils' diff --git a/packages/sdk-js/package.json b/packages/sdk-js/package.json index 3e6bcbf88..d2abfacb7 100644 --- a/packages/sdk-js/package.json +++ b/packages/sdk-js/package.json @@ -43,7 +43,11 @@ "@kiltprotocol/config": "workspace:*", "@kiltprotocol/core": "workspace:*", "@kiltprotocol/did": "workspace:*", + "@kiltprotocol/type-definitions": "workspace:*", "@kiltprotocol/types": "workspace:*", - "@kiltprotocol/utils": "workspace:*" + "@kiltprotocol/utils": "workspace:*", + "@polkadot/api": "^10.4.0", + "@polkadot/util": "^12.0.0", + "@polkadot/util-crypto": "^12.0.0" } } diff --git a/packages/core/src/balance/Balance.utils.spec.ts b/packages/sdk-js/src/balance/Balance.utils.spec.ts similarity index 100% rename from packages/core/src/balance/Balance.utils.spec.ts rename to packages/sdk-js/src/balance/Balance.utils.spec.ts diff --git a/packages/core/src/balance/Balance.utils.ts b/packages/sdk-js/src/balance/Balance.utils.ts similarity index 100% rename from packages/core/src/balance/Balance.utils.ts rename to packages/sdk-js/src/balance/Balance.utils.ts diff --git a/packages/core/src/balance/index.ts b/packages/sdk-js/src/balance/index.ts similarity index 100% rename from packages/core/src/balance/index.ts rename to packages/sdk-js/src/balance/index.ts diff --git a/packages/sdk-js/src/index.ts b/packages/sdk-js/src/index.ts index d4266c502..966963ce5 100644 --- a/packages/sdk-js/src/index.ts +++ b/packages/sdk-js/src/index.ts @@ -12,6 +12,8 @@ export * from '@kiltprotocol/core' export { ConfigService } from '@kiltprotocol/config' export { Blockchain } from '@kiltprotocol/chain-helpers' +export * from './balance/index.js' +export * from './kilt/index.js' export * as ChainHelpers from '@kiltprotocol/chain-helpers' export * as Did from '@kiltprotocol/did' export * as Utils from '@kiltprotocol/utils' diff --git a/packages/core/src/kilt/Kilt.ts b/packages/sdk-js/src/kilt/Kilt.ts similarity index 100% rename from packages/core/src/kilt/Kilt.ts rename to packages/sdk-js/src/kilt/Kilt.ts diff --git a/packages/core/src/kilt/index.ts b/packages/sdk-js/src/kilt/index.ts similarity index 100% rename from packages/core/src/kilt/index.ts rename to packages/sdk-js/src/kilt/index.ts diff --git a/packages/vc-export/src/DidJwt.spec.ts b/packages/vc-export/src/DidJwt.spec.ts index 9bae27a3f..45f224437 100644 --- a/packages/vc-export/src/DidJwt.spec.ts +++ b/packages/vc-export/src/DidJwt.spec.ts @@ -9,7 +9,6 @@ import { hexToU8a } from '@polkadot/util' import { ed25519PairFromSeed } from '@polkadot/util-crypto' import type { Keypair } from '@polkadot/util-crypto/types' -import { init } from '@kiltprotocol/core' import { exportToDidDocument, getFullDidUriFromKey, @@ -22,8 +21,8 @@ import type { } from '@kiltprotocol/types' import * as JWT from './DidJwt' -import * as Presentation from './Presentation' import { credentialSchema } from './KiltCredentialV1' +import * as Presentation from './Presentation' import type { KiltCredentialV1 } from './types' jest.mock('@kiltprotocol/did', () => ({ @@ -73,10 +72,6 @@ jest.mocked(resolveCompliant).mockImplementation(async (d) => { } }) -beforeAll(async () => { - await init({}) -}) - it('produces and reverses JWT payload representations of a credential and presentation', () => { const credential = { '@context': [ diff --git a/packages/vc-export/src/Presentation.spec.ts b/packages/vc-export/src/Presentation.spec.ts index 02560beb0..a1b1b2065 100644 --- a/packages/vc-export/src/Presentation.spec.ts +++ b/packages/vc-export/src/Presentation.spec.ts @@ -16,7 +16,7 @@ import { } from '@polkadot/util-crypto' import type { Keypair } from '@polkadot/util-crypto/types' -import { init } from '@kiltprotocol/core' +import { ConfigService } from '@kiltprotocol/config' import { getFullDidUri, getFullDidUriFromKey } from '@kiltprotocol/did' import type { DidDocument, @@ -114,7 +114,7 @@ beforeAll(async () => { api.query.did = { didBlacklist: jest.fn().mockResolvedValue(api.createType('Option')), } as any - await init({ api }) + ConfigService.set({ api }) }) it('verifies a presentation signed by an ecdsa key', async () => { diff --git a/packages/vc-export/src/vc-js/suites/Sr25519Signature2020.spec.ts b/packages/vc-export/src/vc-js/suites/Sr25519Signature2020.spec.ts index b7b94f442..0b32c320a 100644 --- a/packages/vc-export/src/vc-js/suites/Sr25519Signature2020.spec.ts +++ b/packages/vc-export/src/vc-js/suites/Sr25519Signature2020.spec.ts @@ -8,25 +8,24 @@ // @ts-expect-error not a typescript module import * as vcjs from '@digitalbazaar/vc' -import { init } from '@kiltprotocol/core' import * as Did from '@kiltprotocol/did' -import { Crypto } from '@kiltprotocol/utils' import type { ConformingDidDocument, DidUri, KiltKeyringPair, } from '@kiltprotocol/types' +import { Crypto } from '@kiltprotocol/utils' +import { W3C_CREDENTIAL_CONTEXT_URL } from '../../constants.js' +import type { VerifiableCredential } from '../../types.js' import { combineDocumentLoaders, kiltContextsLoader, kiltDidLoader, } from '../documentLoader.js' -import { W3C_CREDENTIAL_CONTEXT_URL } from '../../constants.js' +import ingosCredential from '../examples/ICredentialExample.json' import { Sr25519Signature2020 } from './Sr25519Signature2020.js' import { Sr25519VerificationKey2020 } from './Sr25519VerificationKey.js' -import ingosCredential from '../examples/ICredentialExample.json' -import type { VerifiableCredential } from '../../types.js' // is not needed and imports a dependency that does not work in node 18 jest.mock('@digitalbazaar/http-client', () => ({})) @@ -43,7 +42,6 @@ const documentLoader = combineDocumentLoaders([ ]) export async function makeFakeDid() { - await init() const keypair = Crypto.makeKeypairFromUri('//Ingo', 'sr25519') const didDocument = Did.exportToDidDocument( { diff --git a/tests/integration/AccountLinking.spec.ts b/tests/integration/AccountLinking.spec.ts index 51b9da0ae..290bafc99 100644 --- a/tests/integration/AccountLinking.spec.ts +++ b/tests/integration/AccountLinking.spec.ts @@ -10,8 +10,7 @@ import { Keyring } from '@polkadot/keyring' import { BN } from '@polkadot/util' import { mnemonicGenerate } from '@polkadot/util-crypto' -import { BalanceUtils, disconnect } from '@kiltprotocol/core' -import * as Did from '@kiltprotocol/did' +import { BalanceUtils, Did, disconnect } from '@kiltprotocol/sdk-js' import type { DidDocument, KeyringPair, diff --git a/tests/integration/Attestation.spec.ts b/tests/integration/Attestation.spec.ts index 09f205af0..cbdf332f2 100644 --- a/tests/integration/Attestation.spec.ts +++ b/tests/integration/Attestation.spec.ts @@ -12,9 +12,9 @@ import { Claim, Credential, CType, + Did, disconnect, -} from '@kiltprotocol/core' -import * as Did from '@kiltprotocol/did' +} from '@kiltprotocol/sdk-js' import type { DidDocument, IAttestation, diff --git a/tests/integration/Balance.spec.ts b/tests/integration/Balance.spec.ts index c05d58cc0..ebbd38c9d 100644 --- a/tests/integration/Balance.spec.ts +++ b/tests/integration/Balance.spec.ts @@ -10,7 +10,7 @@ import { jest } from '@jest/globals' import { ApiPromise } from '@polkadot/api' import { BN } from '@polkadot/util' -import { disconnect } from '@kiltprotocol/core' +import { disconnect } from '@kiltprotocol/sdk-js' import type { KeyringPair } from '@kiltprotocol/types' import { makeSigningKeyTool } from '../testUtils/index.js' diff --git a/tests/integration/Blockchain.spec.ts b/tests/integration/Blockchain.spec.ts index d54729eb0..746118c04 100644 --- a/tests/integration/Blockchain.spec.ts +++ b/tests/integration/Blockchain.spec.ts @@ -8,8 +8,7 @@ import type { ApiPromise } from '@polkadot/api' import { BN } from '@polkadot/util' -import { Blockchain } from '@kiltprotocol/chain-helpers' -import { BalanceUtils, disconnect } from '@kiltprotocol/core' +import { Blockchain, BalanceUtils, disconnect } from '@kiltprotocol/sdk-js' import type { KeyringPair } from '@kiltprotocol/types' import { makeSigningKeyTool } from '../testUtils/index.js' diff --git a/tests/integration/Ctypes.spec.ts b/tests/integration/Ctypes.spec.ts index 8db6ebf37..b3121fdd0 100644 --- a/tests/integration/Ctypes.spec.ts +++ b/tests/integration/Ctypes.spec.ts @@ -7,8 +7,7 @@ import type { ApiPromise } from '@polkadot/api' -import { CType, disconnect } from '@kiltprotocol/core' -import * as Did from '@kiltprotocol/did' +import { CType, Did, disconnect } from '@kiltprotocol/sdk-js' import type { DidDocument, ICType, KiltKeyringPair } from '@kiltprotocol/types' import { Crypto, UUID } from '@kiltprotocol/utils' diff --git a/tests/integration/Delegation.spec.ts b/tests/integration/Delegation.spec.ts index 325ab53e0..455156267 100644 --- a/tests/integration/Delegation.spec.ts +++ b/tests/integration/Delegation.spec.ts @@ -14,17 +14,18 @@ import { Claim, Credential, DelegationNode, + Did, disconnect, -} from '@kiltprotocol/core' -import * as Did from '@kiltprotocol/did' -import type { +} from '@kiltprotocol/sdk-js' +import { DidDocument, ICType, IDelegationNode, KiltKeyringPair, + Permission, + PermissionType, SignCallback, } from '@kiltprotocol/types' -import { Permission, PermissionType } from '@kiltprotocol/types' import { KeyTool, diff --git a/tests/integration/Deposit.spec.ts b/tests/integration/Deposit.spec.ts index 92f4f2da1..69017d857 100644 --- a/tests/integration/Deposit.spec.ts +++ b/tests/integration/Deposit.spec.ts @@ -13,9 +13,9 @@ import { Claim, Credential, CType, + Did, disconnect, -} from '@kiltprotocol/core' -import * as Did from '@kiltprotocol/did' +} from '@kiltprotocol/sdk-js' import type { DidDocument, IAttestation, @@ -25,6 +25,7 @@ import type { SignCallback, SubmittableExtrinsic, } from '@kiltprotocol/types' + import { createFullDidFromLightDid, createFullDidFromSeed, diff --git a/tests/integration/Did.spec.ts b/tests/integration/Did.spec.ts index be357b3c1..f569cf477 100644 --- a/tests/integration/Did.spec.ts +++ b/tests/integration/Did.spec.ts @@ -8,8 +8,7 @@ import type { ApiPromise } from '@polkadot/api' import { BN } from '@polkadot/util' -import { CType, DelegationNode, disconnect } from '@kiltprotocol/core' -import * as Did from '@kiltprotocol/did' +import { CType, DelegationNode, Did, disconnect } from '@kiltprotocol/sdk-js' import { DidDocument, DidResolutionResult, diff --git a/tests/integration/ErrorHandler.spec.ts b/tests/integration/ErrorHandler.spec.ts index 611179e15..a2834d001 100644 --- a/tests/integration/ErrorHandler.spec.ts +++ b/tests/integration/ErrorHandler.spec.ts @@ -7,8 +7,7 @@ import { ApiPromise } from '@polkadot/api' -import { disconnect } from '@kiltprotocol/core' -import * as Did from '@kiltprotocol/did' +import { disconnect, Did } from '@kiltprotocol/sdk-js' import type { DidDocument, IAttestation, diff --git a/tests/integration/PublicCredentials.spec.ts b/tests/integration/PublicCredentials.spec.ts index b6c93c949..f2275f54e 100644 --- a/tests/integration/PublicCredentials.spec.ts +++ b/tests/integration/PublicCredentials.spec.ts @@ -18,8 +18,7 @@ import { BN } from '@polkadot/util' import { randomAsHex } from '@polkadot/util-crypto' import { PublicCredentials } from '@kiltprotocol/asset-credentials' -import { CType, disconnect } from '@kiltprotocol/core' -import * as Did from '@kiltprotocol/did' +import { CType, Did, disconnect } from '@kiltprotocol/sdk-js' import { UUID } from '@kiltprotocol/utils' import { diff --git a/tests/integration/Web3Names.spec.ts b/tests/integration/Web3Names.spec.ts index 1c00908e5..a87050c36 100644 --- a/tests/integration/Web3Names.spec.ts +++ b/tests/integration/Web3Names.spec.ts @@ -8,8 +8,7 @@ import type { ApiPromise } from '@polkadot/api' import { randomAsHex } from '@polkadot/util-crypto' -import { disconnect } from '@kiltprotocol/core' -import * as Did from '@kiltprotocol/did' +import { Did, disconnect } from '@kiltprotocol/sdk-js' import type { DidDocument, KeyringPair, diff --git a/tests/integration/utils.ts b/tests/integration/utils.ts index 3fa379a89..3496abbfe 100644 --- a/tests/integration/utils.ts +++ b/tests/integration/utils.ts @@ -13,9 +13,13 @@ import { BN } from '@polkadot/util' import { GenericContainer, StartedTestContainer, Wait } from 'testcontainers' -import { Blockchain } from '@kiltprotocol/chain-helpers' -import { ConfigService } from '@kiltprotocol/config' -import { CType, connect, init } from '@kiltprotocol/core' +import { + Blockchain, + CType, + ConfigService, + connect, + init, +} from '@kiltprotocol/sdk-js' import type { ICType, KeyringPair, diff --git a/yarn.lock b/yarn.lock index 6f538c0ec..f315b0725 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2033,8 +2033,12 @@ __metadata: "@kiltprotocol/config": "workspace:*" "@kiltprotocol/core": "workspace:*" "@kiltprotocol/did": "workspace:*" + "@kiltprotocol/type-definitions": "workspace:*" "@kiltprotocol/types": "workspace:*" "@kiltprotocol/utils": "workspace:*" + "@polkadot/api": ^10.4.0 + "@polkadot/util": ^12.0.0 + "@polkadot/util-crypto": ^12.0.0 rimraf: ^3.0.2 terser-webpack-plugin: ^5.1.1 typescript: ^4.8.3 From 94d4e6cda51769221844779957f90807c7ea522e Mon Sep 17 00:00:00 2001 From: Raphael Flechtner Date: Thu, 10 Aug 2023 18:37:41 -0400 Subject: [PATCH 2/2] refactor!: rename core to credentials --- packages/asset-credentials/package.json | 2 +- .../src/credentials/PublicCredential.spec.ts | 2 +- .../src/credentials/PublicCredential.ts | 2 +- packages/{core => credentials}/README.md | 8 ++++---- packages/{core => credentials}/package.json | 2 +- .../src/attestation/Attestation.chain.ts | 0 .../src/attestation/Attestation.spec.ts | 0 .../src/attestation/Attestation.ts | 0 .../{core => credentials}/src/attestation/index.ts | 0 packages/{core => credentials}/src/claim/Claim.spec.ts | 0 packages/{core => credentials}/src/claim/Claim.ts | 0 packages/{core => credentials}/src/claim/index.ts | 0 .../src/credential/Credential.spec.ts | 0 .../{core => credentials}/src/credential/Credential.ts | 0 packages/{core => credentials}/src/credential/index.ts | 0 .../{core => credentials}/src/ctype/CType.chain.ts | 0 .../src/ctype/CType.metadata.spec.ts | 0 .../{core => credentials}/src/ctype/CType.schemas.ts | 0 packages/{core => credentials}/src/ctype/CType.spec.ts | 0 packages/{core => credentials}/src/ctype/CType.ts | 0 .../src/ctype/Ctype.nested.spec.ts | 0 packages/{core => credentials}/src/ctype/index.ts | 0 .../src/delegation/DelegationDecoder.ts | 0 .../src/delegation/DelegationHierarchyDetails.chain.ts | 0 .../src/delegation/DelegationNode.chain.ts | 0 .../src/delegation/DelegationNode.spec.ts | 0 .../src/delegation/DelegationNode.ts | 0 .../src/delegation/DelegationNode.utils.ts | 0 packages/{core => credentials}/src/delegation/index.ts | 0 packages/{core => credentials}/src/index.ts | 2 +- packages/{core => credentials}/tsconfig.build.json | 0 packages/{core => credentials}/tsconfig.esm.json | 0 packages/sdk-js/package.json | 2 +- packages/sdk-js/src/index.ts | 2 +- packages/vc-export/package.json | 2 +- packages/vc-export/src/CTypeVerification.spec.ts | 2 +- packages/vc-export/src/KiltAttestationProofV1.spec.ts | 2 +- packages/vc-export/src/KiltAttestationProofV1.ts | 2 +- packages/vc-export/src/KiltCredentialV1.ts | 2 +- packages/vc-export/src/KiltRevocationStatusV1.ts | 2 +- .../vc-export/src/exportToVerifiableCredential.spec.ts | 2 +- .../src/vc-js/suites/KiltAttestationProofV1.spec.ts | 2 +- .../src/vc-js/suites/KiltAttestationProofV1.ts | 2 +- tsconfig.json | 2 +- yarn.lock | 10 +++++----- 45 files changed, 26 insertions(+), 26 deletions(-) rename packages/{core => credentials}/README.md (78%) rename packages/{core => credentials}/package.json (97%) rename packages/{core => credentials}/src/attestation/Attestation.chain.ts (100%) rename packages/{core => credentials}/src/attestation/Attestation.spec.ts (100%) rename packages/{core => credentials}/src/attestation/Attestation.ts (100%) rename packages/{core => credentials}/src/attestation/index.ts (100%) rename packages/{core => credentials}/src/claim/Claim.spec.ts (100%) rename packages/{core => credentials}/src/claim/Claim.ts (100%) rename packages/{core => credentials}/src/claim/index.ts (100%) rename packages/{core => credentials}/src/credential/Credential.spec.ts (100%) rename packages/{core => credentials}/src/credential/Credential.ts (100%) rename packages/{core => credentials}/src/credential/index.ts (100%) rename packages/{core => credentials}/src/ctype/CType.chain.ts (100%) rename packages/{core => credentials}/src/ctype/CType.metadata.spec.ts (100%) rename packages/{core => credentials}/src/ctype/CType.schemas.ts (100%) rename packages/{core => credentials}/src/ctype/CType.spec.ts (100%) rename packages/{core => credentials}/src/ctype/CType.ts (100%) rename packages/{core => credentials}/src/ctype/Ctype.nested.spec.ts (100%) rename packages/{core => credentials}/src/ctype/index.ts (100%) rename packages/{core => credentials}/src/delegation/DelegationDecoder.ts (100%) rename packages/{core => credentials}/src/delegation/DelegationHierarchyDetails.chain.ts (100%) rename packages/{core => credentials}/src/delegation/DelegationNode.chain.ts (100%) rename packages/{core => credentials}/src/delegation/DelegationNode.spec.ts (100%) rename packages/{core => credentials}/src/delegation/DelegationNode.ts (100%) rename packages/{core => credentials}/src/delegation/DelegationNode.utils.ts (100%) rename packages/{core => credentials}/src/delegation/index.ts (100%) rename packages/{core => credentials}/src/index.ts (93%) rename packages/{core => credentials}/tsconfig.build.json (100%) rename packages/{core => credentials}/tsconfig.esm.json (100%) diff --git a/packages/asset-credentials/package.json b/packages/asset-credentials/package.json index c363ed750..0ab0c85e2 100644 --- a/packages/asset-credentials/package.json +++ b/packages/asset-credentials/package.json @@ -31,7 +31,7 @@ "homepage": "https://github.com/KILTprotocol/sdk-js#readme", "dependencies": { "@kiltprotocol/config": "workspace:*", - "@kiltprotocol/core": "workspace:*", + "@kiltprotocol/credentials": "workspace:*", "@kiltprotocol/did": "workspace:*", "@kiltprotocol/types": "workspace:*", "@kiltprotocol/utils": "workspace:*", diff --git a/packages/asset-credentials/src/credentials/PublicCredential.spec.ts b/packages/asset-credentials/src/credentials/PublicCredential.spec.ts index 29f3d53e9..25c770c8b 100644 --- a/packages/asset-credentials/src/credentials/PublicCredential.spec.ts +++ b/packages/asset-credentials/src/credentials/PublicCredential.spec.ts @@ -8,7 +8,7 @@ import { BN } from '@polkadot/util' import { ConfigService } from '@kiltprotocol/config' -import { CType } from '@kiltprotocol/core' +import { CType } from '@kiltprotocol/credentials' import * as Did from '@kiltprotocol/did' import type { AssetDidUri, diff --git a/packages/asset-credentials/src/credentials/PublicCredential.ts b/packages/asset-credentials/src/credentials/PublicCredential.ts index 9972b5aaa..47a1223eb 100644 --- a/packages/asset-credentials/src/credentials/PublicCredential.ts +++ b/packages/asset-credentials/src/credentials/PublicCredential.ts @@ -18,7 +18,7 @@ import type { PartialAssetClaim, } from '@kiltprotocol/types' -import { CType } from '@kiltprotocol/core' +import { CType } from '@kiltprotocol/credentials' import { blake2AsHex } from '@polkadot/util-crypto' import { ConfigService } from '@kiltprotocol/config' import * as Did from '@kiltprotocol/did' diff --git a/packages/core/README.md b/packages/credentials/README.md similarity index 78% rename from packages/core/README.md rename to packages/credentials/README.md index f6ec306fd..ff2b6dab6 100644 --- a/packages/core/README.md +++ b/packages/credentials/README.md @@ -3,10 +3,10 @@ ![Lint and Test](https://github.com/KILTprotocol/sdk-js/workflows/Lint%20and%20Test/badge.svg) -# KILT Core +# KILT Credentials This package provides the KILT credential core features and objects to make claims, build credentials and make attestations. -It also includes ctypes, quotes, delegations and balance utilities. +It also includes ctypes and delegations utilities. For more information, please visit our [official SDK documentation](https://docs.kilt.io/docs/sdk/introduction). @@ -15,11 +15,11 @@ For more information, please visit our [official SDK documentation](https://docs NPM: ``` -npm install @kiltprotocol/core +npm install @kiltprotocol/credentials ``` YARN: ``` -yarn add @kiltprotocol/core +yarn add @kiltprotocol/credentials ``` diff --git a/packages/core/package.json b/packages/credentials/package.json similarity index 97% rename from packages/core/package.json rename to packages/credentials/package.json index 24f4c0b16..1cdc2b406 100644 --- a/packages/core/package.json +++ b/packages/credentials/package.json @@ -1,5 +1,5 @@ { - "name": "@kiltprotocol/core", + "name": "@kiltprotocol/credentials", "version": "0.33.2-6", "description": "", "main": "./lib/cjs/index.js", diff --git a/packages/core/src/attestation/Attestation.chain.ts b/packages/credentials/src/attestation/Attestation.chain.ts similarity index 100% rename from packages/core/src/attestation/Attestation.chain.ts rename to packages/credentials/src/attestation/Attestation.chain.ts diff --git a/packages/core/src/attestation/Attestation.spec.ts b/packages/credentials/src/attestation/Attestation.spec.ts similarity index 100% rename from packages/core/src/attestation/Attestation.spec.ts rename to packages/credentials/src/attestation/Attestation.spec.ts diff --git a/packages/core/src/attestation/Attestation.ts b/packages/credentials/src/attestation/Attestation.ts similarity index 100% rename from packages/core/src/attestation/Attestation.ts rename to packages/credentials/src/attestation/Attestation.ts diff --git a/packages/core/src/attestation/index.ts b/packages/credentials/src/attestation/index.ts similarity index 100% rename from packages/core/src/attestation/index.ts rename to packages/credentials/src/attestation/index.ts diff --git a/packages/core/src/claim/Claim.spec.ts b/packages/credentials/src/claim/Claim.spec.ts similarity index 100% rename from packages/core/src/claim/Claim.spec.ts rename to packages/credentials/src/claim/Claim.spec.ts diff --git a/packages/core/src/claim/Claim.ts b/packages/credentials/src/claim/Claim.ts similarity index 100% rename from packages/core/src/claim/Claim.ts rename to packages/credentials/src/claim/Claim.ts diff --git a/packages/core/src/claim/index.ts b/packages/credentials/src/claim/index.ts similarity index 100% rename from packages/core/src/claim/index.ts rename to packages/credentials/src/claim/index.ts diff --git a/packages/core/src/credential/Credential.spec.ts b/packages/credentials/src/credential/Credential.spec.ts similarity index 100% rename from packages/core/src/credential/Credential.spec.ts rename to packages/credentials/src/credential/Credential.spec.ts diff --git a/packages/core/src/credential/Credential.ts b/packages/credentials/src/credential/Credential.ts similarity index 100% rename from packages/core/src/credential/Credential.ts rename to packages/credentials/src/credential/Credential.ts diff --git a/packages/core/src/credential/index.ts b/packages/credentials/src/credential/index.ts similarity index 100% rename from packages/core/src/credential/index.ts rename to packages/credentials/src/credential/index.ts diff --git a/packages/core/src/ctype/CType.chain.ts b/packages/credentials/src/ctype/CType.chain.ts similarity index 100% rename from packages/core/src/ctype/CType.chain.ts rename to packages/credentials/src/ctype/CType.chain.ts diff --git a/packages/core/src/ctype/CType.metadata.spec.ts b/packages/credentials/src/ctype/CType.metadata.spec.ts similarity index 100% rename from packages/core/src/ctype/CType.metadata.spec.ts rename to packages/credentials/src/ctype/CType.metadata.spec.ts diff --git a/packages/core/src/ctype/CType.schemas.ts b/packages/credentials/src/ctype/CType.schemas.ts similarity index 100% rename from packages/core/src/ctype/CType.schemas.ts rename to packages/credentials/src/ctype/CType.schemas.ts diff --git a/packages/core/src/ctype/CType.spec.ts b/packages/credentials/src/ctype/CType.spec.ts similarity index 100% rename from packages/core/src/ctype/CType.spec.ts rename to packages/credentials/src/ctype/CType.spec.ts diff --git a/packages/core/src/ctype/CType.ts b/packages/credentials/src/ctype/CType.ts similarity index 100% rename from packages/core/src/ctype/CType.ts rename to packages/credentials/src/ctype/CType.ts diff --git a/packages/core/src/ctype/Ctype.nested.spec.ts b/packages/credentials/src/ctype/Ctype.nested.spec.ts similarity index 100% rename from packages/core/src/ctype/Ctype.nested.spec.ts rename to packages/credentials/src/ctype/Ctype.nested.spec.ts diff --git a/packages/core/src/ctype/index.ts b/packages/credentials/src/ctype/index.ts similarity index 100% rename from packages/core/src/ctype/index.ts rename to packages/credentials/src/ctype/index.ts diff --git a/packages/core/src/delegation/DelegationDecoder.ts b/packages/credentials/src/delegation/DelegationDecoder.ts similarity index 100% rename from packages/core/src/delegation/DelegationDecoder.ts rename to packages/credentials/src/delegation/DelegationDecoder.ts diff --git a/packages/core/src/delegation/DelegationHierarchyDetails.chain.ts b/packages/credentials/src/delegation/DelegationHierarchyDetails.chain.ts similarity index 100% rename from packages/core/src/delegation/DelegationHierarchyDetails.chain.ts rename to packages/credentials/src/delegation/DelegationHierarchyDetails.chain.ts diff --git a/packages/core/src/delegation/DelegationNode.chain.ts b/packages/credentials/src/delegation/DelegationNode.chain.ts similarity index 100% rename from packages/core/src/delegation/DelegationNode.chain.ts rename to packages/credentials/src/delegation/DelegationNode.chain.ts diff --git a/packages/core/src/delegation/DelegationNode.spec.ts b/packages/credentials/src/delegation/DelegationNode.spec.ts similarity index 100% rename from packages/core/src/delegation/DelegationNode.spec.ts rename to packages/credentials/src/delegation/DelegationNode.spec.ts diff --git a/packages/core/src/delegation/DelegationNode.ts b/packages/credentials/src/delegation/DelegationNode.ts similarity index 100% rename from packages/core/src/delegation/DelegationNode.ts rename to packages/credentials/src/delegation/DelegationNode.ts diff --git a/packages/core/src/delegation/DelegationNode.utils.ts b/packages/credentials/src/delegation/DelegationNode.utils.ts similarity index 100% rename from packages/core/src/delegation/DelegationNode.utils.ts rename to packages/credentials/src/delegation/DelegationNode.utils.ts diff --git a/packages/core/src/delegation/index.ts b/packages/credentials/src/delegation/index.ts similarity index 100% rename from packages/core/src/delegation/index.ts rename to packages/credentials/src/delegation/index.ts diff --git a/packages/core/src/index.ts b/packages/credentials/src/index.ts similarity index 93% rename from packages/core/src/index.ts rename to packages/credentials/src/index.ts index f9e91d7d0..62f3c5994 100644 --- a/packages/core/src/index.ts +++ b/packages/credentials/src/index.ts @@ -6,7 +6,7 @@ */ /** - * @module @kiltprotocol/core + * @module @kiltprotocol/credentials */ export * as Attestation from './attestation/index.js' diff --git a/packages/core/tsconfig.build.json b/packages/credentials/tsconfig.build.json similarity index 100% rename from packages/core/tsconfig.build.json rename to packages/credentials/tsconfig.build.json diff --git a/packages/core/tsconfig.esm.json b/packages/credentials/tsconfig.esm.json similarity index 100% rename from packages/core/tsconfig.esm.json rename to packages/credentials/tsconfig.esm.json diff --git a/packages/sdk-js/package.json b/packages/sdk-js/package.json index d2abfacb7..bef1b84ae 100644 --- a/packages/sdk-js/package.json +++ b/packages/sdk-js/package.json @@ -41,7 +41,7 @@ "dependencies": { "@kiltprotocol/chain-helpers": "workspace:*", "@kiltprotocol/config": "workspace:*", - "@kiltprotocol/core": "workspace:*", + "@kiltprotocol/credentials": "workspace:*", "@kiltprotocol/did": "workspace:*", "@kiltprotocol/type-definitions": "workspace:*", "@kiltprotocol/types": "workspace:*", diff --git a/packages/sdk-js/src/index.ts b/packages/sdk-js/src/index.ts index 966963ce5..c64b0e234 100644 --- a/packages/sdk-js/src/index.ts +++ b/packages/sdk-js/src/index.ts @@ -9,7 +9,7 @@ * @module @kiltprotocol/sdk-js */ -export * from '@kiltprotocol/core' +export * from '@kiltprotocol/credentials' export { ConfigService } from '@kiltprotocol/config' export { Blockchain } from '@kiltprotocol/chain-helpers' export * from './balance/index.js' diff --git a/packages/vc-export/package.json b/packages/vc-export/package.json index 94ae61d73..c2b4a60c2 100644 --- a/packages/vc-export/package.json +++ b/packages/vc-export/package.json @@ -38,7 +38,7 @@ "dependencies": { "@kiltprotocol/chain-helpers": "workspace:*", "@kiltprotocol/config": "workspace:*", - "@kiltprotocol/core": "workspace:*", + "@kiltprotocol/credentials": "workspace:*", "@kiltprotocol/did": "workspace:*", "@kiltprotocol/types": "workspace:*", "@kiltprotocol/utils": "workspace:*", diff --git a/packages/vc-export/src/CTypeVerification.spec.ts b/packages/vc-export/src/CTypeVerification.spec.ts index 22530a98d..7a9fd106c 100644 --- a/packages/vc-export/src/CTypeVerification.spec.ts +++ b/packages/vc-export/src/CTypeVerification.spec.ts @@ -5,7 +5,7 @@ * found in the LICENSE file in the root directory of this source tree. */ -import { CType } from '@kiltprotocol/core' +import { CType } from '@kiltprotocol/credentials' import { randomAsHex, randomAsU8a } from '@polkadot/util-crypto' import { attestation, diff --git a/packages/vc-export/src/KiltAttestationProofV1.spec.ts b/packages/vc-export/src/KiltAttestationProofV1.spec.ts index a82c431e6..abd0d5bda 100644 --- a/packages/vc-export/src/KiltAttestationProofV1.spec.ts +++ b/packages/vc-export/src/KiltAttestationProofV1.spec.ts @@ -8,7 +8,7 @@ import { encodeAddress, randomAsHex, randomAsU8a } from '@polkadot/util-crypto' import { u8aToHex, u8aToU8a } from '@polkadot/util' -import { Credential } from '@kiltprotocol/core' +import { Credential } from '@kiltprotocol/credentials' import { parse } from '@kiltprotocol/did' import type { DidUri } from '@kiltprotocol/types' diff --git a/packages/vc-export/src/KiltAttestationProofV1.ts b/packages/vc-export/src/KiltAttestationProofV1.ts index 55c25ef56..656938d89 100644 --- a/packages/vc-export/src/KiltAttestationProofV1.ts +++ b/packages/vc-export/src/KiltAttestationProofV1.ts @@ -30,7 +30,7 @@ import type { } from '@polkadot/types/interfaces/types.js' import type { IEventData, Signer } from '@polkadot/types/types' -import { CType } from '@kiltprotocol/core' +import { CType } from '@kiltprotocol/credentials' import { authorizeTx, getFullDidUri, diff --git a/packages/vc-export/src/KiltCredentialV1.ts b/packages/vc-export/src/KiltCredentialV1.ts index 8e363e737..56578759f 100644 --- a/packages/vc-export/src/KiltCredentialV1.ts +++ b/packages/vc-export/src/KiltCredentialV1.ts @@ -9,7 +9,7 @@ import { hexToU8a } from '@polkadot/util' import { base58Encode } from '@polkadot/util-crypto' import { JsonSchema } from '@kiltprotocol/utils' -import { CType } from '@kiltprotocol/core' +import { CType } from '@kiltprotocol/credentials' import type { ICType, ICredential, diff --git a/packages/vc-export/src/KiltRevocationStatusV1.ts b/packages/vc-export/src/KiltRevocationStatusV1.ts index b5a518699..d58ae97ed 100644 --- a/packages/vc-export/src/KiltRevocationStatusV1.ts +++ b/packages/vc-export/src/KiltRevocationStatusV1.ts @@ -11,7 +11,7 @@ import type { ApiPromise } from '@polkadot/api' import type { U8aLike } from '@polkadot/util/types' import { ConfigService } from '@kiltprotocol/config' -import { Attestation, CType, SDKErrors } from '@kiltprotocol/core' +import { Attestation, CType, SDKErrors } from '@kiltprotocol/credentials' import type { Caip2ChainId } from '@kiltprotocol/types' import { Caip2 } from './CAIP/index.js' diff --git a/packages/vc-export/src/exportToVerifiableCredential.spec.ts b/packages/vc-export/src/exportToVerifiableCredential.spec.ts index e5eb3862b..8e682d2a3 100644 --- a/packages/vc-export/src/exportToVerifiableCredential.spec.ts +++ b/packages/vc-export/src/exportToVerifiableCredential.spec.ts @@ -8,7 +8,7 @@ import { hexToU8a, u8aConcat, u8aToU8a } from '@polkadot/util' import { randomAsU8a } from '@polkadot/util-crypto' -import { Credential } from '@kiltprotocol/core' +import { Credential } from '@kiltprotocol/credentials' import type { IAttestation, ICType, ICredential } from '@kiltprotocol/types' import { ApiMocks } from '../../../tests/testUtils' diff --git a/packages/vc-export/src/vc-js/suites/KiltAttestationProofV1.spec.ts b/packages/vc-export/src/vc-js/suites/KiltAttestationProofV1.spec.ts index 03272e689..fc71effe9 100644 --- a/packages/vc-export/src/vc-js/suites/KiltAttestationProofV1.spec.ts +++ b/packages/vc-export/src/vc-js/suites/KiltAttestationProofV1.spec.ts @@ -18,7 +18,7 @@ import jsigs from 'jsonld-signatures' // cjs module // @ts-expect-error not a typescript module import jsonld from 'jsonld' // cjs module -import { Credential } from '@kiltprotocol/core' +import { Credential } from '@kiltprotocol/credentials' import { ConfigService } from '@kiltprotocol/config' import * as Did from '@kiltprotocol/did' import { Crypto } from '@kiltprotocol/utils' diff --git a/packages/vc-export/src/vc-js/suites/KiltAttestationProofV1.ts b/packages/vc-export/src/vc-js/suites/KiltAttestationProofV1.ts index 1df276f6f..39d13463a 100644 --- a/packages/vc-export/src/vc-js/suites/KiltAttestationProofV1.ts +++ b/packages/vc-export/src/vc-js/suites/KiltAttestationProofV1.ts @@ -12,7 +12,7 @@ import jsigs from 'jsonld-signatures' // cjs module import { ConfigService } from '@kiltprotocol/config' -import { CType } from '@kiltprotocol/core' +import { CType } from '@kiltprotocol/credentials' import type { ICType } from '@kiltprotocol/types' import { chainIdFromGenesis } from '../../CAIP/caip2.js' diff --git a/tsconfig.json b/tsconfig.json index 186eb2f1b..ae9e69a87 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,7 +8,7 @@ "@kiltprotocol/asset-credentials": ["asset-credentials/src"], "@kiltprotocol/chain-helpers": ["chain-helpers/src"], "@kiltprotocol/config": ["config/src"], - "@kiltprotocol/core": ["core/src"], + "@kiltprotocol/credentials": ["credentials/src"], "@kiltprotocol/sdk-js": ["sdk-js/src"], "@kiltprotocol/types": ["types/src"], "@kiltprotocol/utils": ["utils/src"], diff --git a/yarn.lock b/yarn.lock index f315b0725..62e4f746d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1928,7 +1928,7 @@ __metadata: resolution: "@kiltprotocol/asset-credentials@workspace:packages/asset-credentials" dependencies: "@kiltprotocol/config": "workspace:*" - "@kiltprotocol/core": "workspace:*" + "@kiltprotocol/credentials": "workspace:*" "@kiltprotocol/did": "workspace:*" "@kiltprotocol/types": "workspace:*" "@kiltprotocol/utils": "workspace:*" @@ -1982,9 +1982,9 @@ __metadata: languageName: unknown linkType: soft -"@kiltprotocol/core@workspace:*, @kiltprotocol/core@workspace:packages/core": +"@kiltprotocol/credentials@workspace:*, @kiltprotocol/credentials@workspace:packages/credentials": version: 0.0.0-use.local - resolution: "@kiltprotocol/core@workspace:packages/core" + resolution: "@kiltprotocol/credentials@workspace:packages/credentials" dependencies: "@kiltprotocol/augment-api": "workspace:*" "@kiltprotocol/chain-helpers": "workspace:*" @@ -2031,7 +2031,7 @@ __metadata: dependencies: "@kiltprotocol/chain-helpers": "workspace:*" "@kiltprotocol/config": "workspace:*" - "@kiltprotocol/core": "workspace:*" + "@kiltprotocol/credentials": "workspace:*" "@kiltprotocol/did": "workspace:*" "@kiltprotocol/type-definitions": "workspace:*" "@kiltprotocol/types": "workspace:*" @@ -2096,7 +2096,7 @@ __metadata: "@digitalbazaar/vc": ^6.0.1 "@kiltprotocol/chain-helpers": "workspace:*" "@kiltprotocol/config": "workspace:*" - "@kiltprotocol/core": "workspace:*" + "@kiltprotocol/credentials": "workspace:*" "@kiltprotocol/did": "workspace:*" "@kiltprotocol/types": "workspace:*" "@kiltprotocol/utils": "workspace:*"