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

Updating client libraries to add auth token authentication support #3219

Merged
merged 31 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
f29787b
adding type definitions and bump parachain-api version
silva-fj Dec 24, 2024
b2b7e26
fixing nx dependencies
silva-fj Dec 30, 2024
7072ffe
adding request_auth_token request
silva-fj Dec 30, 2024
44175e0
updating docs
silva-fj Dec 30, 2024
b7bc72d
bump version
silva-fj Dec 30, 2024
e9b076c
Merge branch 'dev' into p-1256-update-client-sdk-and-parachain-api-pa…
silva-fj Dec 30, 2024
f102ca3
updating TCAuthentication definition
silva-fj Dec 31, 2024
006092e
updating tc-authentication type creator
silva-fj Dec 31, 2024
947941e
refactoring request type creator
silva-fj Dec 31, 2024
41192fe
updating usage of request creator types
silva-fj Dec 31, 2024
453f1fe
updating parachain-api dependency
silva-fj Dec 31, 2024
0ae5a15
updating docs
silva-fj Dec 31, 2024
f2b9224
bump client-sdk version
silva-fj Dec 31, 2024
a3e2094
Merge branch 'dev' into p-1256-update-client-sdk-and-parachain-api-pa…
silva-fj Dec 31, 2024
fc3f463
updating trusted_operations definitions
silva-fj Dec 31, 2024
ce96e84
updating parachain-api dependency
silva-fj Dec 31, 2024
b9f1933
refactoring request_auth_token request
silva-fj Dec 31, 2024
99ddf3d
updating docs
silva-fj Dec 31, 2024
cb549d1
updating parachain-api
silva-fj Dec 31, 2024
4620dba
bump client-sdk version
silva-fj Dec 31, 2024
66e5c0f
Merge branch 'dev' into p-1256-update-client-sdk-and-parachain-api-pa…
silva-fj Dec 31, 2024
8f82d63
Merge branch 'dev' into p-1256-update-client-sdk-and-parachain-api-pa…
silva-fj Jan 7, 2025
9c3b257
updating parachain-api CHANGELOG
silva-fj Jan 7, 2025
0b348c0
improving tc-authentication type creating
silva-fj Jan 7, 2025
5c129ff
refactoring request_auth_token requestor
silva-fj Jan 7, 2025
36b5880
updating docs
silva-fj Jan 7, 2025
68803d6
bump version
silva-fj Jan 7, 2025
ddbfdf1
updating CHANGELOG
silva-fj Jan 7, 2025
dbfa767
updating isNativeRequest helper
silva-fj Jan 7, 2025
4df7f9f
fix AuthToken variant index
silva-fj Jan 7, 2025
a20f09d
Merge branch 'dev' into p-1256-update-client-sdk-and-parachain-api-pa…
0xverin Jan 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion tee-worker/identity/client-api/parachain-api/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.9.21-next.0] - 2024-12-17
## [0.9.21-next.3] - 2024-12-31

### Added

- Add `request_auth_token` trusted call.
- Add `AuthToken` variant to `TrustedCallOk` and `TCAuthentication`.
- Add `AuthOptions` type definition.

- Update for version [parachain-release v0.9.21-01](https://github.com/litentry/litentry-parachain/releases/tag/v0.9.21-01)

Expand Down
2 changes: 1 addition & 1 deletion tee-worker/identity/client-api/parachain-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "dist/src/index.js",
"module": "dist/src/index.js",
"sideEffects": false,
"version": "0.9.21-next.0",
"version": "0.9.21-next.3",
"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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,9 @@ export default {
Private: "(Bytes,H256)",
},
},

AuthOptions: {
expires_at: "u32",
},
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export default {
_enum: {
Web3: "LitentryMultiSignature",
Email: "Text",
AuthToken: "Text",
},
},
TrustedCallAuthenticated: {
Expand Down Expand Up @@ -89,6 +90,7 @@ export default {
add_account: "(LitentryIdentity, LitentryIdentity, LitentryValidationData, bool)",
remove_accounts: "(LitentryIdentity, Vec<LitentryIdentity>)",
publicize_account: "(LitentryIdentity, LitentryIdentity)",
request_auth_token: "(LitentryIdentity, AuthOptions)",
},
},
TrustedOperationStatus: {
Expand Down Expand Up @@ -117,6 +119,7 @@ export default {
_enum: {
ExtrinsicReport: "ExtrinsicReport",
RequestVcResult: "RequestVcResultOrError",
AuthToken: "Text",
},
},
ExtrinsicReport: {
Expand Down
112 changes: 56 additions & 56 deletions tee-worker/identity/client-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,58 +1,58 @@
{
"name": "@litentry-client-sdk/source",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"test": "nx affected --base=dev --target=test --plain",
"lint": "nx affected --base=dev --target=lint --plain",
"clean": "pnpm clean:dist; pnpm clean:packages",
"clean:dist": "rm -rf dist",
"clean:packages": "rm -rf node_modules && pnpm -r exec rm -rf node_modules && pnpm i"
},
"private": true,
"dependencies": {
"@polkadot/api": "^15.0.1",
"@polkadot/types": "^15.0.1",
"@polkadot/types-codec": "^15.0.1",
"@polkadot/util": "^13.2.3",
"@polkadot/util-crypto": "^13.2.3",
"ts-node": "10.9.1",
"tslib": "^2.5.3",
"ws": "^8.17.1"
},
"devDependencies": {
"@altack/nx-bundlefy": "0.16.0",
"@nx/devkit": "16.10.0",
"@nx/eslint-plugin": "16.10.0",
"@nx/jest": "16.10.0",
"@nx/js": "16.10.0",
"@nx/linter": "16.10.0",
"@nx/workspace": "16.10.0",
"@polkadot/api-base": "^10.9.1",
"@polkadot/rpc-core": "^10.9.1",
"@polkadot/rpc-provider": "^10.9.1",
"@swc-node/register": "^1.8.0",
"@swc/core": "^1.4.17",
"@types/jest": "^29.4.0",
"@types/node": "18.7.1",
"@types/ws": "^8.5.9",
"@typescript-eslint/eslint-plugin": "5.x",
"@typescript-eslint/parser": "5.x",
"eslint": "~8.46.0",
"eslint-config-prettier": "^8.1.0",
"jest": "^29.4.1",
"jest-environment-node": "^29.4.1",
"nx": "^17.3.2",
"prettier": "^2.8.3",
"ts-jest": "^29.1.0",
"typedoc": "^0.25.3",
"typedoc-plugin-markdown": "^3.17.1",
"typescript": "5.4.5",
"validate-npm-package-name": "^5.0.0",
"verdaccio": "^5.0.4"
},
"nx": {
"includedScripts": []
},
"packageManager": "[email protected]"
"name": "@litentry-client-sdk/source",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"test": "nx affected --base=dev --target=test --plain",
"lint": "nx affected --base=dev --target=lint --plain",
"clean": "pnpm clean:dist; pnpm clean:packages",
"clean:dist": "rm -rf dist",
"clean:packages": "rm -rf node_modules && pnpm -r exec rm -rf node_modules && pnpm i"
},
"private": true,
"dependencies": {
"@polkadot/api": "^15.0.1",
"@polkadot/types": "^15.0.1",
"@polkadot/types-codec": "^15.0.1",
"@polkadot/util": "^13.2.3",
"@polkadot/util-crypto": "^13.2.3",
"ts-node": "10.9.1",
"tslib": "^2.5.3",
"ws": "^8.17.1"
},
"devDependencies": {
"@altack/nx-bundlefy": "0.16.0",
"@nx/devkit": "^17.3.2",
"@nx/eslint-plugin": "^17.3.2",
"@nx/jest": "^17.3.2",
"@nx/js": "^17.3.2",
"@nx/linter": "^17.3.2",
"@nx/workspace": "^17.3.2",
"@polkadot/api-base": "^10.9.1",
"@polkadot/rpc-core": "^10.9.1",
"@polkadot/rpc-provider": "^10.9.1",
"@swc-node/register": "^1.8.0",
"@swc/core": "^1.4.17",
"@types/jest": "^29.4.0",
"@types/node": "18.7.1",
"@types/ws": "^8.5.9",
"@typescript-eslint/eslint-plugin": "5.x",
"@typescript-eslint/parser": "5.x",
"eslint": "~8.46.0",
"eslint-config-prettier": "^8.1.0",
"jest": "^29.4.1",
"jest-environment-node": "^29.4.1",
"nx": "^17.3.2",
"prettier": "^2.8.3",
"ts-jest": "^29.1.0",
"typedoc": "^0.25.3",
"typedoc-plugin-markdown": "^3.17.1",
"typescript": "5.4.5",
"validate-npm-package-name": "^5.0.0",
"verdaccio": "^5.0.4"
},
"nx": {
"includedScripts": []
},
"packageManager": "[email protected]"
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Add OmniAccount requestors for `createAccountStore`, `remark`, `transferNative`, `transferEthereum`, and `callEthereum`.
- Add `requestVerificationCode` requestor.
- Add `requestAuthToken` requestor.

## 2024-10-14

Expand Down
77 changes: 53 additions & 24 deletions tee-worker/identity/client-sdk/packages/client-sdk/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

### Type Aliases

- [AuthenticationData](README.md#authenticationdata)
- [DiscordOAuth2Proof](README.md#discordoauth2proof)
- [DiscordProof](README.md#discordproof)
- [EmailProof](README.md#emailproof)
Expand Down Expand Up @@ -54,6 +55,16 @@ Re-exports [getIdGraphHash](modules/request.md#getidgraphhash)

## Type Aliases

### AuthenticationData

Ƭ **AuthenticationData**: \{ `type`: ``"Email"`` ; `verificationCode`: `string` } \| \{ `signature`: `string` ; `signer`: `LitentryIdentity` ; `type`: ``"Web3"`` } \| \{ `token`: `string` ; `type`: ``"AuthToken"`` }

#### Defined in

[lib/type-creators/tc-authentication.ts:5](https://github.com/litentry/client-sdk/blob/develop/lib/type-creators/tc-authentication.ts#L5)

___

### DiscordOAuth2Proof

Ƭ **DiscordOAuth2Proof**: `Object`
Expand Down Expand Up @@ -335,7 +346,7 @@ Heads-up: ensure data.ciphertext is in hex format. Using Uint may cause a bytes
| Name | Type |
| :------ | :------ |
| `registry` | `Registry` |
| `data` | \`0x$\{string}\` \| \{ `aad`: \`0x$\{string}\` \| `Uint8Array`\<`ArrayBufferLike`\> ; `ciphertext`: \`0x$\{string}\` ; `nonce`: \`0x$\{string}\` \| `Uint8Array`\<`ArrayBufferLike`\> } |
| `data` | \`0x$\{string}\` \| \{ `aad`: \`0x$\{string}\` \| `Uint8Array` ; `ciphertext`: \`0x$\{string}\` ; `nonce`: \`0x$\{string}\` \| `Uint8Array` } |

#### Returns

Expand Down Expand Up @@ -382,7 +393,7 @@ For Substrate, the address is expected to be a SS58-encoded or hex-encoded addre
| Name | Type |
| :------ | :------ |
| `registry` | `Registry` |
| `data` | \`0x$\{string}\` \| `Uint8Array`\<`ArrayBufferLike`\> \| \{ `addressOrHandle`: `string` ; `type`: ``"Solana"`` \| ``"Twitter"`` \| ``"Discord"`` \| ``"Github"`` \| ``"Substrate"`` \| ``"Evm"`` \| ``"Bitcoin"`` \| ``"Email"`` } |
| `data` | \`0x$\{string}\` \| `Uint8Array` \| \{ `addressOrHandle`: `string` ; `type`: ``"Solana"`` \| ``"Twitter"`` \| ``"Discord"`` \| ``"Github"`` \| ``"Substrate"`` \| ``"Evm"`` \| ``"Bitcoin"`` \| ``"Email"`` } |

#### Returns

Expand Down Expand Up @@ -504,23 +515,22 @@ The shielding key is encrypted using the Enclave's shielding key and attached in

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `api` | `ApiPromise` | - |
| `data` | `Object` | - |
| `data.authentication` | `string` | signature or verification code based on the identity type |
| `data.call` | `TrustedCall` | - |
| `data.nonce` | `Index` | - |
| `data.sender` | `LitentryIdentity` | - |
| `data.shard` | `Uint8Array`\<`ArrayBufferLike`\> | - |
| Name | Type |
| :------ | :------ |
| `api` | `ApiPromise` |
| `data` | `Object` |
| `data.authentication` | [`AuthenticationData`](README.md#authenticationdata) |
| `data.call` | `TrustedCall` |
| `data.nonce` | `Index` |
| `data.shard` | `Uint8Array` |

#### Returns

`Promise`\<`AesRequest`\>

#### Defined in

[lib/type-creators/request.ts:32](https://github.com/litentry/client-sdk/blob/develop/lib/type-creators/request.ts#L32)
[lib/type-creators/request.ts:33](https://github.com/litentry/client-sdk/blob/develop/lib/type-creators/request.ts#L33)

___

Expand All @@ -533,15 +543,15 @@ ___
| Name | Type |
| :------ | :------ |
| `registry` | `Registry` |
| `data` | `AuthenticationData` |
| `data` | [`AuthenticationData`](README.md#authenticationdata) |

#### Returns

`TCAuthentication`

#### Defined in

[lib/type-creators/tc-authentication.ts:16](https://github.com/litentry/client-sdk/blob/develop/lib/type-creators/tc-authentication.ts#L16)
[lib/type-creators/tc-authentication.ts:20](https://github.com/litentry/client-sdk/blob/develop/lib/type-creators/tc-authentication.ts#L20)

___

Expand Down Expand Up @@ -576,7 +586,7 @@ Similarly, our types definitions must match also.

#### Defined in

[lib/type-creators/trusted-call.ts:110](https://github.com/litentry/client-sdk/blob/develop/lib/type-creators/trusted-call.ts#L110)
[lib/type-creators/trusted-call.ts:117](https://github.com/litentry/client-sdk/blob/develop/lib/type-creators/trusted-call.ts#L117)

▸ **createTrustedCallType**(`registry`, `data`): `Promise`\<\{ `call`: `TrustedCall` ; `key`: `CryptoKey` }\>

Expand All @@ -595,7 +605,7 @@ Similarly, our types definitions must match also.

#### Defined in

[lib/type-creators/trusted-call.ts:117](https://github.com/litentry/client-sdk/blob/develop/lib/type-creators/trusted-call.ts#L117)
[lib/type-creators/trusted-call.ts:124](https://github.com/litentry/client-sdk/blob/develop/lib/type-creators/trusted-call.ts#L124)

▸ **createTrustedCallType**(`registry`, `data`): `Promise`\<\{ `call`: `TrustedCall` ; `key`: `CryptoKey` }\>

Expand All @@ -614,7 +624,7 @@ Similarly, our types definitions must match also.

#### Defined in

[lib/type-creators/trusted-call.ts:124](https://github.com/litentry/client-sdk/blob/develop/lib/type-creators/trusted-call.ts#L124)
[lib/type-creators/trusted-call.ts:131](https://github.com/litentry/client-sdk/blob/develop/lib/type-creators/trusted-call.ts#L131)

▸ **createTrustedCallType**(`registry`, `data`): `Promise`\<\{ `call`: `TrustedCall` ; `key`: `CryptoKey` }\>

Expand All @@ -633,7 +643,7 @@ Similarly, our types definitions must match also.

#### Defined in

[lib/type-creators/trusted-call.ts:131](https://github.com/litentry/client-sdk/blob/develop/lib/type-creators/trusted-call.ts#L131)
[lib/type-creators/trusted-call.ts:138](https://github.com/litentry/client-sdk/blob/develop/lib/type-creators/trusted-call.ts#L138)

▸ **createTrustedCallType**(`registry`, `data`): `Promise`\<\{ `call`: `TrustedCall` ; `key`: `CryptoKey` }\>

Expand All @@ -652,7 +662,7 @@ Similarly, our types definitions must match also.

#### Defined in

[lib/type-creators/trusted-call.ts:138](https://github.com/litentry/client-sdk/blob/develop/lib/type-creators/trusted-call.ts#L138)
[lib/type-creators/trusted-call.ts:145](https://github.com/litentry/client-sdk/blob/develop/lib/type-creators/trusted-call.ts#L145)

▸ **createTrustedCallType**(`registry`, `data`): `Promise`\<\{ `call`: `TrustedCall` ; `key`: `CryptoKey` }\>

Expand All @@ -671,7 +681,7 @@ Similarly, our types definitions must match also.

#### Defined in

[lib/type-creators/trusted-call.ts:145](https://github.com/litentry/client-sdk/blob/develop/lib/type-creators/trusted-call.ts#L145)
[lib/type-creators/trusted-call.ts:152](https://github.com/litentry/client-sdk/blob/develop/lib/type-creators/trusted-call.ts#L152)

▸ **createTrustedCallType**(`registry`, `data`): `Promise`\<\{ `call`: `TrustedCall` ; `key`: `CryptoKey` }\>

Expand All @@ -690,7 +700,7 @@ Similarly, our types definitions must match also.

#### Defined in

[lib/type-creators/trusted-call.ts:152](https://github.com/litentry/client-sdk/blob/develop/lib/type-creators/trusted-call.ts#L152)
[lib/type-creators/trusted-call.ts:159](https://github.com/litentry/client-sdk/blob/develop/lib/type-creators/trusted-call.ts#L159)

▸ **createTrustedCallType**(`registry`, `data`): `Promise`\<\{ `call`: `TrustedCall` ; `key`: `CryptoKey` }\>

Expand All @@ -709,7 +719,7 @@ Similarly, our types definitions must match also.

#### Defined in

[lib/type-creators/trusted-call.ts:159](https://github.com/litentry/client-sdk/blob/develop/lib/type-creators/trusted-call.ts#L159)
[lib/type-creators/trusted-call.ts:166](https://github.com/litentry/client-sdk/blob/develop/lib/type-creators/trusted-call.ts#L166)

▸ **createTrustedCallType**(`registry`, `data`): `Promise`\<\{ `call`: `TrustedCall` ; `key`: `CryptoKey` }\>

Expand All @@ -728,7 +738,26 @@ Similarly, our types definitions must match also.

#### Defined in

[lib/type-creators/trusted-call.ts:166](https://github.com/litentry/client-sdk/blob/develop/lib/type-creators/trusted-call.ts#L166)
[lib/type-creators/trusted-call.ts:173](https://github.com/litentry/client-sdk/blob/develop/lib/type-creators/trusted-call.ts#L173)

▸ **createTrustedCallType**(`registry`, `data`): `Promise`\<\{ `call`: `TrustedCall` ; `key`: `CryptoKey` }\>

#### Parameters

| Name | Type |
| :------ | :------ |
| `registry` | `Registry` |
| `data` | `Object` |
| `data.method` | ``"request_auth_token"`` |
| `data.params` | `RequestAuthTokenParams` |

#### Returns

`Promise`\<\{ `call`: `TrustedCall` ; `key`: `CryptoKey` }\>

#### Defined in

[lib/type-creators/trusted-call.ts:180](https://github.com/litentry/client-sdk/blob/develop/lib/type-creators/trusted-call.ts#L180)

▸ **createTrustedCallType**(`registry`, `data`): `Promise`\<\{ `call`: `TrustedCall` ; `key`: `CryptoKey` }\>

Expand All @@ -747,7 +776,7 @@ Similarly, our types definitions must match also.

#### Defined in

[lib/type-creators/trusted-call.ts:173](https://github.com/litentry/client-sdk/blob/develop/lib/type-creators/trusted-call.ts#L173)
[lib/type-creators/trusted-call.ts:187](https://github.com/litentry/client-sdk/blob/develop/lib/type-creators/trusted-call.ts#L187)

___

Expand Down
Loading
Loading