From 961389d1cf2bf9d6186e44ddcea676015038158e Mon Sep 17 00:00:00 2001 From: Jonathan Alvarez Date: Mon, 23 Sep 2024 21:33:14 +0000 Subject: [PATCH 1/6] client-api: update to include Email identity type --- tee-worker/identity/client-api/parachain-api/CHANGELOG.md | 7 +++++++ tee-worker/identity/client-api/parachain-api/package.json | 2 +- .../prepare-build/interfaces/identity/definitions.ts | 6 ++++++ tee-worker/identity/client-api/sidechain-api/CHANGELOG.md | 2 ++ tee-worker/identity/client-api/sidechain-api/package.json | 2 +- 5 files changed, 17 insertions(+), 2 deletions(-) diff --git a/tee-worker/identity/client-api/parachain-api/CHANGELOG.md b/tee-worker/identity/client-api/parachain-api/CHANGELOG.md index 44f51abd58..77dc217a58 100644 --- a/tee-worker/identity/client-api/parachain-api/CHANGELOG.md +++ b/tee-worker/identity/client-api/parachain-api/CHANGELOG.md @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +- Update for version [parachain-release v0.9.20-03](https://github.com/litentry/litentry-parachain/releases/tag/v0.9.20-03) + +### Added + +- `LinkedIdentities` entry in `Assertion` enum. +- New `Email` identity. Consequent updates on `LitentryIdentity` and `Web2ValidationData`. + ## [0.9.19-07] - 2024-08-26 Matching version for [parachain-release v0.9.19-07](https://github.com/litentry/litentry-parachain/releases/tag/v0.9.19-07) diff --git a/tee-worker/identity/client-api/parachain-api/package.json b/tee-worker/identity/client-api/parachain-api/package.json index 63fa19db28..a8d7fd25ce 100644 --- a/tee-worker/identity/client-api/parachain-api/package.json +++ b/tee-worker/identity/client-api/parachain-api/package.json @@ -5,7 +5,7 @@ "main": "dist/src/index.js", "module": "dist/src/index.js", "sideEffects": false, - "version": "0.9.19-07", + "version": "0.9.20-03-next.0", "scripts": { "clean": "rm -rf dist build node_modules", "update-metadata": "curl -s -H \"Content-Type: application/json\" -d '{\"id\":\"1\", \"jsonrpc\":\"2.0\", \"method\": \"state_getMetadata\", \"params\":[]}' http://localhost:9944 > prepare-build/litentry-parachain-metadata.json", diff --git a/tee-worker/identity/client-api/parachain-api/prepare-build/interfaces/identity/definitions.ts b/tee-worker/identity/client-api/parachain-api/prepare-build/interfaces/identity/definitions.ts index 767dfe265a..835a6fdeed 100644 --- a/tee-worker/identity/client-api/parachain-api/prepare-build/interfaces/identity/definitions.ts +++ b/tee-worker/identity/client-api/parachain-api/prepare-build/interfaces/identity/definitions.ts @@ -28,6 +28,7 @@ export default { Evm: "Address20", Bitcoin: "Address33", Solana: "Address32", + Email: "IdentityString", }, }, Address32: "[u8;32]", @@ -66,6 +67,7 @@ export default { _enum: { Twitter: "TwitterValidationData", Discord: "DiscordValidationData", + Email: "EmailValidationData", }, }, TwitterValidationData: { @@ -97,6 +99,10 @@ export default { code: "Vec", redirect_uri: "Vec", }, + EmailValidationData: { + email: "Text", + verification_code: "Text", + }, Web3ValidationData: { _enum: { Substrate: "Web3CommonValidationData", diff --git a/tee-worker/identity/client-api/sidechain-api/CHANGELOG.md b/tee-worker/identity/client-api/sidechain-api/CHANGELOG.md index 604739c082..fea079f79d 100644 --- a/tee-worker/identity/client-api/sidechain-api/CHANGELOG.md +++ b/tee-worker/identity/client-api/sidechain-api/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +- Update for version [parachain-release v0.9.20-03](https://github.com/litentry/litentry-parachain/releases/tag/v0.9.20-03) + ## [0.9.19-07] - 2024-08-26 Matching version for [parachain-release v0.9.19-07](https://github.com/litentry/litentry-parachain/releases/tag/v0.9.19-07) diff --git a/tee-worker/identity/client-api/sidechain-api/package.json b/tee-worker/identity/client-api/sidechain-api/package.json index 28e25f58cf..abd246f979 100644 --- a/tee-worker/identity/client-api/sidechain-api/package.json +++ b/tee-worker/identity/client-api/sidechain-api/package.json @@ -5,7 +5,7 @@ "main": "dist/src/index.js", "module": "dist/src/index.js", "sideEffects": false, - "version": "0.9.19-07", + "version": "0.9.20-03-next.0", "scripts": { "clean": "rm -rf dist build node_modules", "update-metadata": "../../bin/litentry-cli print-sgx-metadata-raw > prepare-build/litentry-sidechain-metadata.json", From 03346ecd4a0b948b5f24ced0c5f8101545a02c08 Mon Sep 17 00:00:00 2001 From: Jonathan Alvarez Date: Mon, 23 Sep 2024 21:47:23 +0000 Subject: [PATCH 2/6] client-sdk: use client-api@0.9.20-03.next.0 --- .../client-sdk/packages/enclave/package.json | 4 ++-- .../client-sdk/packages/vc-sdk/package.json | 4 ++-- tee-worker/identity/client-sdk/pnpm-lock.yaml | 24 +++++++++---------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/tee-worker/identity/client-sdk/packages/enclave/package.json b/tee-worker/identity/client-sdk/packages/enclave/package.json index 098517daef..5bc40b5b3f 100644 --- a/tee-worker/identity/client-sdk/packages/enclave/package.json +++ b/tee-worker/identity/client-sdk/packages/enclave/package.json @@ -8,8 +8,8 @@ "@polkadot/rpc-provider": "^10.9.1" }, "peerDependencies": { - "@litentry/parachain-api": "0.9.19-7", - "@litentry/sidechain-api": "0.9.19-7", + "@litentry/parachain-api": "0.9.20-03-next.0", + "@litentry/sidechain-api": "0.9.20-03-next.0", "@litentry/chaindata": "*", "@polkadot/api": "^10.9.1", "@polkadot/types": "^10.9.1", diff --git a/tee-worker/identity/client-sdk/packages/vc-sdk/package.json b/tee-worker/identity/client-sdk/packages/vc-sdk/package.json index 7fdbf0dacc..7bc1266cb5 100644 --- a/tee-worker/identity/client-sdk/packages/vc-sdk/package.json +++ b/tee-worker/identity/client-sdk/packages/vc-sdk/package.json @@ -8,8 +8,8 @@ "fast-glob": "^3.3.2" }, "peerDependencies": { - "@litentry/parachain-api": "0.9.19-7", - "@litentry/sidechain-api": "0.9.19-7", + "@litentry/parachain-api": "0.9.20-03-next.0", + "@litentry/sidechain-api": "0.9.20-03-next.0", "@polkadot/api": "^10.9.1", "@polkadot/util": "^12.5.1", "@polkadot/util-crypto": "^12.5.1", diff --git a/tee-worker/identity/client-sdk/pnpm-lock.yaml b/tee-worker/identity/client-sdk/pnpm-lock.yaml index 034241de5a..0ba4aa5372 100644 --- a/tee-worker/identity/client-sdk/pnpm-lock.yaml +++ b/tee-worker/identity/client-sdk/pnpm-lock.yaml @@ -90,8 +90,8 @@ importers: packages/enclave: specifiers: '@litentry/chaindata': '*' - '@litentry/parachain-api': 0.9.19-7 - '@litentry/sidechain-api': 0.9.19-7 + '@litentry/parachain-api': 0.9.20-03-next.0 + '@litentry/sidechain-api': 0.9.20-03-next.0 '@polkadot/api': ^10.9.1 '@polkadot/rpc-provider': ^10.9.1 '@polkadot/types': ^10.9.1 @@ -101,8 +101,8 @@ importers: tslib: ^2.3.0 dependencies: '@litentry/chaindata': link:../chaindata - '@litentry/parachain-api': 0.9.19-7 - '@litentry/sidechain-api': 0.9.19-7 + '@litentry/parachain-api': 0.9.20-03-next.0 + '@litentry/sidechain-api': 0.9.20-03-next.0 '@polkadot/api': 10.13.1 '@polkadot/types': 10.13.1 '@polkadot/types-codec': 10.13.1 @@ -114,16 +114,16 @@ importers: packages/vc-sdk: specifiers: - '@litentry/parachain-api': 0.9.19-7 - '@litentry/sidechain-api': 0.9.19-7 + '@litentry/parachain-api': 0.9.20-03-next.0 + '@litentry/sidechain-api': 0.9.20-03-next.0 '@polkadot/api': ^10.9.1 '@polkadot/util': ^12.5.1 '@polkadot/util-crypto': ^12.5.1 fast-glob: ^3.3.2 tslib: ^2.3.0 dependencies: - '@litentry/parachain-api': 0.9.19-7 - '@litentry/sidechain-api': 0.9.19-7 + '@litentry/parachain-api': 0.9.20-03-next.0 + '@litentry/sidechain-api': 0.9.20-03-next.0 '@polkadot/api': 10.13.1 '@polkadot/util': 12.6.2 '@polkadot/util-crypto': 12.6.2_@polkadot+util@12.6.2 @@ -1760,8 +1760,8 @@ packages: '@jridgewell/resolve-uri': 3.1.1 '@jridgewell/sourcemap-codec': 1.4.15 - /@litentry/parachain-api/0.9.19-7: - resolution: {integrity: sha512-+Fe89cfPN+0zmCZdSK9ZnUVTOdOMH4qjL798RPrK7GdS8yMiUbLvPHMgBU9joiVTppZgK5WOaDpJcVmP6lP6qA==} + /@litentry/parachain-api/0.9.20-03-next.0: + resolution: {integrity: sha512-Rx80mZI5A1dQKSYEvYACUetPykFuo6PCLQfbDTpHj5UgWcw8Egf+oqOmc50HTFo9blsQQk0MkhsyA7TqLZRqWA==} dependencies: '@polkadot/api': 10.13.1 '@polkadot/api-augment': 10.13.1 @@ -1783,8 +1783,8 @@ packages: - utf-8-validate dev: false - /@litentry/sidechain-api/0.9.19-7: - resolution: {integrity: sha512-1Z9cnC7N6UEqkvV2ExYmAfdJvJ1FDbau6SGDODM61kqxWAyX1MZGr61Z41VTjbw2k5kDGjUoFmkLuQVYXwS3OQ==} + /@litentry/sidechain-api/0.9.20-03-next.0: + resolution: {integrity: sha512-cC1BQCGmJnigGxX8THw19ZUgoNurpDnJY9wRyr9i5oEvy35jB6vPaDT7WCf5jfw28GSeKKfdgCYDLDW5Z/+DJQ==} dependencies: '@polkadot/api': 10.13.1 '@polkadot/api-augment': 10.13.1 From c8acd20056110bde6c521c40c1b4d0b5e6b1a7a0 Mon Sep 17 00:00:00 2001 From: Jonathan Alvarez Date: Mon, 23 Sep 2024 21:47:43 +0000 Subject: [PATCH 3/6] enclave tests: fix outdated hash Signed-off-by: Jonathan Alvarez --- .../enclave/src/lib/util/calculate-id-graph-hash.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tee-worker/identity/client-sdk/packages/enclave/src/lib/util/calculate-id-graph-hash.test.ts b/tee-worker/identity/client-sdk/packages/enclave/src/lib/util/calculate-id-graph-hash.test.ts index 158d4c7518..749000318d 100644 --- a/tee-worker/identity/client-sdk/packages/enclave/src/lib/util/calculate-id-graph-hash.test.ts +++ b/tee-worker/identity/client-sdk/packages/enclave/src/lib/util/calculate-id-graph-hash.test.ts @@ -72,7 +72,7 @@ test('it deterministically hashes a graph', () => { const hash = calculateIdGraphHash(idGraph); - const expected = `0xc069ba36419050464d4495ee3f221e70b244c7e1d236210732d510001a3024a4`; + const expected = `0x47fb588c1aa067c32087d8ad0c57f8abe6d68d23e6013ad83b10740a1751c697`; expect(hash).toEqual(expected); }); From 38435ce80b30a679153eb7fbee7e39f3975b99e0 Mon Sep 17 00:00:00 2001 From: Jonathan Alvarez Date: Mon, 23 Sep 2024 21:48:58 +0000 Subject: [PATCH 4/6] client-sdk: run all validation data tests Signed-off-by: Jonathan Alvarez --- .../enclave/src/lib/type-creators/validation-data.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tee-worker/identity/client-sdk/packages/enclave/src/lib/type-creators/validation-data.test.ts b/tee-worker/identity/client-sdk/packages/enclave/src/lib/type-creators/validation-data.test.ts index c1ff78702e..11af22565e 100644 --- a/tee-worker/identity/client-sdk/packages/enclave/src/lib/type-creators/validation-data.test.ts +++ b/tee-worker/identity/client-sdk/packages/enclave/src/lib/type-creators/validation-data.test.ts @@ -24,7 +24,7 @@ beforeAll(async () => { registry.register(types); }); -describe.only('Bitcoin', () => { +describe('Bitcoin', () => { test('0x prefix is restored for hex encoded challenge code', () => { const validationData = createLitentryValidationDataType( registry, From 465d518d8a35e58ceb02566a5e07f25f7881eb9b Mon Sep 17 00:00:00 2001 From: Jonathan Alvarez Date: Mon, 23 Sep 2024 23:24:08 +0000 Subject: [PATCH 5/6] client-sdk: support email identity --- .../src/lib/requests/link-identity.request.ts | 6 ++- .../type-creators/litentry-identity.test.ts | 13 +++++ .../lib/type-creators/validation-data.test.ts | 25 ++++++++++ .../src/lib/type-creators/validation-data.ts | 48 +++++++++++++++++++ 4 files changed, 91 insertions(+), 1 deletion(-) diff --git a/tee-worker/identity/client-sdk/packages/enclave/src/lib/requests/link-identity.request.ts b/tee-worker/identity/client-sdk/packages/enclave/src/lib/requests/link-identity.request.ts index 64e05b2827..b91cd3601a 100644 --- a/tee-worker/identity/client-sdk/packages/enclave/src/lib/requests/link-identity.request.ts +++ b/tee-worker/identity/client-sdk/packages/enclave/src/lib/requests/link-identity.request.ts @@ -54,7 +54,11 @@ export async function createChallengeCode( const message = u8aConcat(nonce.toU8a(), who.toU8a(), identity.toU8a()); const challengeCode = blake2AsHex(message, 256); - const isWeb2 = identity.isTwitter || identity.isDiscord || identity.isGithub; + const isWeb2 = + identity.isTwitter || + identity.isDiscord || + identity.isGithub || + identity.isEmail; // support prettify for web3 identities only if (!isWeb2 && options?.prettify) { diff --git a/tee-worker/identity/client-sdk/packages/enclave/src/lib/type-creators/litentry-identity.test.ts b/tee-worker/identity/client-sdk/packages/enclave/src/lib/type-creators/litentry-identity.test.ts index 2e5d4c4261..7144a2f197 100644 --- a/tee-worker/identity/client-sdk/packages/enclave/src/lib/type-creators/litentry-identity.test.ts +++ b/tee-worker/identity/client-sdk/packages/enclave/src/lib/type-creators/litentry-identity.test.ts @@ -122,3 +122,16 @@ test('it creates Discord identity', () => { expect(identity.isDiscord).toBeTruthy(); expect(identity.asDiscord.toHuman()).toEqual(handle); }); + +test('it creates Email identity', () => { + const handle = 'test@test.com.not.valid'; + + const identity = createLitentryIdentityType(registry, { + type: 'Email', + addressOrHandle: handle, + }); + + expect(identity).toBeDefined(); + expect(identity.isEmail).toBeTruthy(); + expect(identity.asEmail.toHuman()).toEqual(handle); +}); diff --git a/tee-worker/identity/client-sdk/packages/enclave/src/lib/type-creators/validation-data.test.ts b/tee-worker/identity/client-sdk/packages/enclave/src/lib/type-creators/validation-data.test.ts index 11af22565e..7c382bd2d2 100644 --- a/tee-worker/identity/client-sdk/packages/enclave/src/lib/type-creators/validation-data.test.ts +++ b/tee-worker/identity/client-sdk/packages/enclave/src/lib/type-creators/validation-data.test.ts @@ -280,3 +280,28 @@ describe('Discord', () => { expect(data.redirect_uri.toHuman()).toEqual('http://test-redirect-uri'); }); }); + +describe('Email', () => { + test('it works', () => { + const validationData = createLitentryValidationDataType( + registry, + { + addressOrHandle: 'test@my.wrong.email', // not validated + type: 'Email', + }, + { + email: 'test@my.wrong.email', + verificationCode: '123', + } + ); + + expect(validationData).toBeDefined(); + expect(validationData.isWeb2Validation).toBeTruthy(); + expect(validationData.asWeb2Validation.isEmail).toBeTruthy(); + + const data = validationData.asWeb2Validation.asEmail; + + expect(data.email.toHuman()).toEqual('test@my.wrong.email'); + expect(data.verification_code.toHuman()).toEqual('123'); + }); +}); diff --git a/tee-worker/identity/client-sdk/packages/enclave/src/lib/type-creators/validation-data.ts b/tee-worker/identity/client-sdk/packages/enclave/src/lib/type-creators/validation-data.ts index dad53db8d7..8c00c0698e 100644 --- a/tee-worker/identity/client-sdk/packages/enclave/src/lib/type-creators/validation-data.ts +++ b/tee-worker/identity/client-sdk/packages/enclave/src/lib/type-creators/validation-data.ts @@ -60,6 +60,16 @@ export type DiscordOAuth2Proof = { redirectUri: string; }; +/** + * Ownership proof for Email + * + * @see createLitentryValidationDataType + */ +export type EmailProof = { + email: string; + verificationCode: string; +}; + /** * Creates the LitentryValidationData given the identity network and its type. * @@ -129,6 +139,8 @@ export function createLitentryValidationDataType< ? DiscordProof | DiscordOAuth2Proof : IIdentityType extends 'Twitter' ? TwitterProof | TwitterOAuth2Proof + : IIdentityType extends 'Email' + ? EmailProof : Web3Proof ): LitentryValidationData { const identity = createLitentryIdentityType(registry, identityDescriptor); @@ -191,6 +203,17 @@ export function createLitentryValidationDataType< }) as LitentryValidationData; } + if (isProofEmail(identity, proof)) { + return registry.createType('LitentryValidationData', { + Web2Validation: { + Email: { + email: stringToHex(proof.email), + verification_code: stringToHex(proof.verificationCode), + }, + }, + }); + } + if (isProofTwitter(identity, proof)) { assert(proof.tweetId, '[vault::link_identity] Missing tweetId'); @@ -261,6 +284,7 @@ function isProofWeb3( | TwitterOAuth2Proof | DiscordProof | DiscordOAuth2Proof + | EmailProof ): proof is Web3Proof { const isWeb3 = identity.isEvm || @@ -329,6 +353,30 @@ function isProofTwitterOAuth2( return true; } +function isProofEmail( + identity: LitentryIdentity, + proof: + | Web3Proof + | TwitterProof + | DiscordProof + | DiscordOAuth2Proof + | EmailProof +): proof is EmailProof { + const isEmail = identity.isEmail; + + if (!isEmail) { + return false; + } + + const maybeEmailProof = proof as EmailProof; + + if (!maybeEmailProof.email || !maybeEmailProof.verificationCode) { + return false; + } + + return true; +} + function isProofDiscord( identity: LitentryIdentity, proof: Web3Proof | TwitterProof | DiscordProof | DiscordOAuth2Proof From d06ae528fda6cd75453d2d94e48586cc4e5c7408 Mon Sep 17 00:00:00 2001 From: Jonathan Alvarez Date: Mon, 23 Sep 2024 23:35:25 +0000 Subject: [PATCH 6/6] client-sdk: bump packages Signed-off-by: Jonathan Alvarez --- .../client-sdk/packages/enclave/CHANGELOG.md | 220 +++++++++--------- .../client-sdk/packages/enclave/package.json | 2 +- .../client-sdk/packages/vc-sdk/CHANGELOG.md | 4 + .../client-sdk/packages/vc-sdk/package.json | 2 +- 4 files changed, 120 insertions(+), 108 deletions(-) diff --git a/tee-worker/identity/client-sdk/packages/enclave/CHANGELOG.md b/tee-worker/identity/client-sdk/packages/enclave/CHANGELOG.md index f8bffdb55a..a6a530e570 100644 --- a/tee-worker/identity/client-sdk/packages/enclave/CHANGELOG.md +++ b/tee-worker/identity/client-sdk/packages/enclave/CHANGELOG.md @@ -7,157 +7,165 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed + +- Use `@litentry/parachain-api@0.9.20-03.next.0` and `@litentry/sidechain-api@0.9.20-03.next.0` + +### Added + +- Support for `Email` Identity + ## [4.2.0] - 2024-08-26 ### Changed -- Use `@litentry/parachain-api@0.9.19-7` +- Use `@litentry/parachain-api@0.9.19-7` ## [4.1.0] - 2024-08-06 ### Added -- Trusted call requests: add the `request.linkIdentityCallback` method. +- Trusted call requests: add the `request.linkIdentityCallback` method. ### Changed -- Use `@litentry/parachain-api@0.9.18-11.2` -- `createLitentryIdentityType`: type can now be created by passing a raw value in hex or `Uint8Array` -- `request.requestBatchVc` now support and optional `signer`. +- Use `@litentry/parachain-api@0.9.18-11.2` +- `createLitentryIdentityType`: type can now be created by passing a raw value in hex or `Uint8Array` +- `request.requestBatchVc` now support and optional `signer`. ## [4.0.1] - 2024-07-19 -- Use `@litentry/parachain-api@0.9.18-11` and `@litentry/sidechain-api@0.9.18-11` stable versions. +- Use `@litentry/parachain-api@0.9.18-11` and `@litentry/sidechain-api@0.9.18-11` stable versions. ## [4.0.0] - 2024-07-15 -- Migrate to `@litentry/parachain-api` and `@litentry/sidechain-api`. -- Distribute as ES Module -- Targets [parachain-release v0.9.18-10](https://github.com/litentry/litentry-parachain/releases/tag/v0.9.18-10) +- Migrate to `@litentry/parachain-api` and `@litentry/sidechain-api`. +- Distribute as ES Module +- Targets [parachain-release v0.9.18-10](https://github.com/litentry/litentry-parachain/releases/tag/v0.9.18-10) ## Added -- Export the type `IdGraph` and its type's struct name under `ID_GRAPH_STRUCT`. -- Challenge code now produces a prettified string for utf-8 signing for web3 identities when `options.prettify` is set to `true`. +- Export the type `IdGraph` and its type's struct name under `ID_GRAPH_STRUCT`. +- Challenge code now produces a prettified string for utf-8 signing for web3 identities when `options.prettify` is set to `true`. ## Changed -- Migrate to `@litentry/parachain-api` and `@litentry/sidechain-api` por chain types. Deprecates `@litentry/chain-types`. -- Support the new `RequestVcResultOrError` type definition. -- `KeyAesOutput` was renamed to `AesOutput`. -- renamed `global` to `globalThis` -- This library is now distributed as an ESModule +- Migrate to `@litentry/parachain-api` and `@litentry/sidechain-api` por chain types. Deprecates `@litentry/chain-types`. +- Support the new `RequestVcResultOrError` type definition. +- `KeyAesOutput` was renamed to `AesOutput`. +- renamed `global` to `globalThis` +- This library is now distributed as an ESModule ## Removed -- Drop `@litentry/chain-types` from dependencies. +- Drop `@litentry/chain-types` from dependencies. ### Fixed -- `request.getIdGraphHash` no longer throws when the user's id_graph is empty. +- `request.getIdGraphHash` no longer throws when the user's id_graph is empty. ## [3.2.1] - 2024-06-10 ### Added -- Adds a new dependency: `@litentry/chaindata`. +- Adds a new dependency: `@litentry/chaindata`. ## [3.1.2] - 2024-06-08 ### Fixed -- Skip `StfError` validation for verifiable credentials requests. Rely on `RequestVcResultOrError` codec. +- Skip `StfError` validation for verifiable credentials requests. Rely on `RequestVcResultOrError` codec. ## [3.1.1] - 2024-06-07 ### Fixed -- Fix error decoding for single assertions request in `request.requestBatchVc`. +- Fix error decoding for single assertions request in `request.requestBatchVc`. ## [3.1.0] - 2024-06-03 ### Changed -- Upgrade `@polkadot/api*`, `@polkadot/rpc*`, `@polkadot/types*` to 10.9.1, and `@polkadot/util*` to `12.5.1` +- Upgrade `@polkadot/api*`, `@polkadot/rpc*`, `@polkadot/types*` to 10.9.1, and `@polkadot/util*` to `12.5.1` ### Removed -- Drop unused `@polkadot/keyring` dependency. +- Drop unused `@polkadot/keyring` dependency. ## [3.0.0] - 2024-06-03 -- Introduce oAuth2 proofs support for Web2 identity validation +- Introduce oAuth2 proofs support for Web2 identity validation ### Added -- Config: support `litentry-staging` for the env var `[NX_]PARACHAIN_NETWORK`. -- Config: support the new env var `[NX_]LITENTRY_NETWORK` for setting the network same as `[NX_]PARACHAIN_NETWORK` but higher precedence. -- Config: accept custom WS endpoints on `[NX_]LITENTRY_NETWORK` / `[NX_]PARACHAIN_NETWORK`. +- Config: support `litentry-staging` for the env var `[NX_]PARACHAIN_NETWORK`. +- Config: support the new env var `[NX_]LITENTRY_NETWORK` for setting the network same as `[NX_]PARACHAIN_NETWORK` but higher precedence. +- Config: accept custom WS endpoints on `[NX_]LITENTRY_NETWORK` / `[NX_]PARACHAIN_NETWORK`. ### Changed -- Use `@litentry/chain-types@2.0.0` -- The type creator `createLitentryValidationDataType` now accepts building oAuth2 proofs for Discord and Twitter. - - ```ts - // twitter - const twitterOAuth2Proof = createLitentryValidationDataType( - registry, - { - addressOrHandle: 'my_twitter_handle', - type: 'Twitter', - }, - { - code: 'my_twitter_code', - state: 'my_twitter_state', - redirectUri: 'http://test-redirect-uri', - } - ); - - // Discord - const validationData = createLitentryValidationDataType( - registry, - { - addressOrHandle: 'my_discord_handle', - type: 'Discord', - }, - { - code: 'my_discord_code', - redirectUri: 'http://test-redirect-uri', - } - ); - ``` - - The legacy public message proofs are still supported. +- Use `@litentry/chain-types@2.0.0` +- The type creator `createLitentryValidationDataType` now accepts building oAuth2 proofs for Discord and Twitter. + + ```ts + // twitter + const twitterOAuth2Proof = createLitentryValidationDataType( + registry, + { + addressOrHandle: 'my_twitter_handle', + type: 'Twitter', + }, + { + code: 'my_twitter_code', + state: 'my_twitter_state', + redirectUri: 'http://test-redirect-uri', + } + ); + + // Discord + const validationData = createLitentryValidationDataType( + registry, + { + addressOrHandle: 'my_discord_handle', + type: 'Discord', + }, + { + code: 'my_discord_code', + redirectUri: 'http://test-redirect-uri', + } + ); + ``` + + The legacy public message proofs are still supported. ## [2.0.1] - 2024-05-21 ### Changed -- When no `PARACHAIN_NETWORK` or `NX_PARACHAIN_NETWORK` is specified, the library will default to the production (`tee-prod`) endpoint rather than to development (`tee-dev`). +- When no `PARACHAIN_NETWORK` or `NX_PARACHAIN_NETWORK` is specified, the library will default to the production (`tee-prod`) endpoint rather than to development (`tee-dev`). ## [2.0.0] - 2024-05-17 ### Removed -- `createLitentryIdentityType` dropped the support deriving the identity type from the provided address. Now both `addressOrHandle` and `type` are required. +- `createLitentryIdentityType` dropped the support deriving the identity type from the provided address. Now both `addressOrHandle` and `type` are required. - ```ts - import { createLitentryIdentityType } from '@litentry/enclave'; + ```ts + import { createLitentryIdentityType } from '@litentry/enclave'; - // from - createLitentryIdentityType(registry, { - address: '5DNx1Kgis2u2SQq7EJrBdnV49PoZCxV3NqER4vV5VqjqZcat', - }); + // from + createLitentryIdentityType(registry, { + address: '5DNx1Kgis2u2SQq7EJrBdnV49PoZCxV3NqER4vV5VqjqZcat', + }); - // To - createLitentryIdentityType(registry, { - addressOrHandle: '5DNx1Kgis2u2SQq7EJrBdnV49PoZCxV3NqER4vV5VqjqZcat', - type: 'Substrate', - }); - ``` + // To + createLitentryIdentityType(registry, { + addressOrHandle: '5DNx1Kgis2u2SQq7EJrBdnV49PoZCxV3NqER4vV5VqjqZcat', + type: 'Substrate', + }); + ``` - consequently, the following methods require a `LitentryIdentity` for the `who` parameter instead of a plain address string: `request.getIdGraph`, `request.linkIdentity`, `request.requestBatchVc`, `request.setIdentityNetworks`, and `request.createChallengeCode`. + consequently, the following methods require a `LitentryIdentity` for the `who` parameter instead of a plain address string: `request.getIdGraph`, `request.linkIdentity`, `request.requestBatchVc`, `request.setIdentityNetworks`, and `request.createChallengeCode`. ## [1.0.4] - 2024-05-16 @@ -167,13 +175,13 @@ Routinely update ### Changed -- `@litentry/enclave` add support for Solana hex-encoded signatures. It hex string is not provided, it will default to base58 decoding. +- `@litentry/enclave` add support for Solana hex-encoded signatures. It hex string is not provided, it will default to base58 decoding. ## [1.0.2] - 2024-05-14 ### Changed -- `@litentry/chain-types` is now marked as a peerDependency +- `@litentry/chain-types` is now marked as a peerDependency ## [1.0.1] - 2024-05-08 @@ -181,29 +189,29 @@ Routinely update ## [1.0.0] - 2024-04-24 -- Initial public version +- Initial public version ### Added -- Request methods that mutate the idGraph information will have a common response. The entire idGraph will no longer be returned but the information about the updated identity only. -- `request.getIdGraphHash` Request getter to get idGraph hash with no signature. -- `calculateIdGraphHash`: Helper method to calculate the hash of a given local idGraph. -- `request.requestBatchVC`: Request trusted call to request a batch of VCs. -- `Enclave.send` now supports a third argument to subscribe to the WS streamed responses. -- Payload signature is now beautify by default to look more human. -- Use a different key for encrypting the transmitted package to the Enclave. +- Request methods that mutate the idGraph information will have a common response. The entire idGraph will no longer be returned but the information about the updated identity only. +- `request.getIdGraphHash` Request getter to get idGraph hash with no signature. +- `calculateIdGraphHash`: Helper method to calculate the hash of a given local idGraph. +- `request.requestBatchVC`: Request trusted call to request a batch of VCs. +- `Enclave.send` now supports a third argument to subscribe to the WS streamed responses. +- Payload signature is now beautify by default to look more human. +- Use a different key for encrypting the transmitted package to the Enclave. ### Removed -- `request.requestVc`. Superseded by `request.requestBatchVc`. -- `createEnclaveHttpProxyHandler`. The connection to the Enclave is now done directly via WebSockets. +- `request.requestVc`. Superseded by `request.requestBatchVc`. +- `createEnclaveHttpProxyHandler`. The connection to the Enclave is now done directly via WebSockets. ### Changed -- Migrate from `teerex` to `teebag`. -- Enclave's nonce is now retrieved through the `author_getNextNonce` getter call. -- The connection to the Enclave is now done directly via WebSockets. Setting up an HTTP proxy is no longer necessary nor suggested. -- The payload size of all operations was reduced and fixed to a 32-bytes length. +- Migrate from `teerex` to `teebag`. +- Enclave's nonce is now retrieved through the `author_getNextNonce` getter call. +- The connection to the Enclave is now done directly via WebSockets. Setting up an HTTP proxy is no longer necessary nor suggested. +- The payload size of all operations was reduced and fixed to a 32-bytes length. ## 2023-12-05 @@ -211,27 +219,27 @@ Update to `Litentry-parachain p0.9.17-9170-w0.0.1-100`. ### Added -- `request.getIdGraph`: fetch the user's idGraph from the Enclave Sidechain. It requires user signature. +- `request.getIdGraph`: fetch the user's idGraph from the Enclave Sidechain. It requires user signature. ### Changed -- **Shielding key**: Users no longer need to set a shielding key on-chain. The data for network transportation is now protected by ephemeral shielding keys generated on the fly. Ephemeral shielding keys increase security and enhance the user experience. -- **Direct responses**: Operation responses are no longer gathered from the Parachain but from the Enclave itself. -- `request.linkIdentity`: The method now has a two level encryption: the information is encrypted with a different key that the one used for transportation. -- `request.linkIdentity`: The call argument `data.encryptionNonce` was removed. -- `request.linkIdentity`: The returned `send` callback now returns both the idGraph and the parsed sidechain response in a `WorkerRpcReturnValue` type. -- `request.createChallengeCode`: The call argument `args.shield` was removed. The Challenge code no longer needs encrypted information. -- `request.setIdentityNetworks`: The returned `send` callback now returns the transaction hash `txHash` and the parsed sidechain response in a `WorkerRpcReturnValue` type. -- `request.requestVc`: The returned `send` callback now returns the `vcIndex`, `vcHash` and the VC's contents on `vcPayload`. As well as the parsed sidechain response in a `WorkerRpcReturnValue` type. -- `enclave.getNonce` was moved as a requestor: `request.getEnclaveNonce`. -- `KeyAesOutput` type is no longer part of the Parachain-runtime metadata and thus it can't be found on `@polkadot/types/lookup`. Use `KeyAesOutput` instead from `@litentry/chain-types` -- `enclave.send`: Error thrown during Enclave operations include more information now. -- `createEnclaveHttpProxyHandler`: HTTP errors responses are now only returned if reaching the Enclave or processing the request fails. However, `enclave.send` could still throw an execution error if the intrinsic operation contains errors. For instance, linking an already linked identity will result on a 200 HTTP response from the Enclave's proxy but `enclave.send` will throw an error about `IdentityAlreadyLinked`. +- **Shielding key**: Users no longer need to set a shielding key on-chain. The data for network transportation is now protected by ephemeral shielding keys generated on the fly. Ephemeral shielding keys increase security and enhance the user experience. +- **Direct responses**: Operation responses are no longer gathered from the Parachain but from the Enclave itself. +- `request.linkIdentity`: The method now has a two level encryption: the information is encrypted with a different key that the one used for transportation. +- `request.linkIdentity`: The call argument `data.encryptionNonce` was removed. +- `request.linkIdentity`: The returned `send` callback now returns both the idGraph and the parsed sidechain response in a `WorkerRpcReturnValue` type. +- `request.createChallengeCode`: The call argument `args.shield` was removed. The Challenge code no longer needs encrypted information. +- `request.setIdentityNetworks`: The returned `send` callback now returns the transaction hash `txHash` and the parsed sidechain response in a `WorkerRpcReturnValue` type. +- `request.requestVc`: The returned `send` callback now returns the `vcIndex`, `vcHash` and the VC's contents on `vcPayload`. As well as the parsed sidechain response in a `WorkerRpcReturnValue` type. +- `enclave.getNonce` was moved as a requestor: `request.getEnclaveNonce`. +- `KeyAesOutput` type is no longer part of the Parachain-runtime metadata and thus it can't be found on `@polkadot/types/lookup`. Use `KeyAesOutput` instead from `@litentry/chain-types` +- `enclave.send`: Error thrown during Enclave operations include more information now. +- `createEnclaveHttpProxyHandler`: HTTP errors responses are now only returned if reaching the Enclave or processing the request fails. However, `enclave.send` could still throw an execution error if the intrinsic operation contains errors. For instance, linking an already linked identity will result on a 200 HTTP response from the Enclave's proxy but `enclave.send` will throw an error about `IdentityAlreadyLinked`. ### Removed -- `request.setUserShieldingKey`: It is no longer needed to set the user's shielding key on-chain. See the Shielding Key point on the Changed section for more information. -- `ky-universal` dependency was dropped. +- `request.setUserShieldingKey`: It is no longer needed to set the user's shielding key on-chain. See the Shielding Key point on the Changed section for more information. +- `ky-universal` dependency was dropped. ## 2023-11-01 diff --git a/tee-worker/identity/client-sdk/packages/enclave/package.json b/tee-worker/identity/client-sdk/packages/enclave/package.json index 5bc40b5b3f..ce31c65318 100644 --- a/tee-worker/identity/client-sdk/packages/enclave/package.json +++ b/tee-worker/identity/client-sdk/packages/enclave/package.json @@ -1,7 +1,7 @@ { "name": "@litentry/enclave", "description": "This package provides helpers for dApps to interact with the Litentry Protocol Enclave.", - "version": "4.2.0", + "version": "4.2.0-next.0", "license": "GPL-3.0-or-later", "dependencies": {}, "devDependencies": { diff --git a/tee-worker/identity/client-sdk/packages/vc-sdk/CHANGELOG.md b/tee-worker/identity/client-sdk/packages/vc-sdk/CHANGELOG.md index 919d8564c0..e7952ea984 100644 --- a/tee-worker/identity/client-sdk/packages/vc-sdk/CHANGELOG.md +++ b/tee-worker/identity/client-sdk/packages/vc-sdk/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed + +- Use `@litentry/parachain-api@0.9.20-03.next.0` and `@litentry/sidechain-api@0.9.20-03.next.0` + ## [3.3.0] - 2024-08-26 ### Changed diff --git a/tee-worker/identity/client-sdk/packages/vc-sdk/package.json b/tee-worker/identity/client-sdk/packages/vc-sdk/package.json index 7bc1266cb5..52ed150cb7 100644 --- a/tee-worker/identity/client-sdk/packages/vc-sdk/package.json +++ b/tee-worker/identity/client-sdk/packages/vc-sdk/package.json @@ -1,6 +1,6 @@ { "name": "@litentry/vc-sdk", - "version": "3.3.0", + "version": "3.3.0-next.0", "description": "This library the common functionality to help dApps parse and validate Litentry issued Verifiable Credentials", "license": "GPL-3.0-or-later", "dependencies": {},