From a323af881651ce89adbe0eb7b4d1de892d5afd2c Mon Sep 17 00:00:00 2001 From: samuel Date: Thu, 29 Aug 2024 11:17:22 +0200 Subject: [PATCH] Make only use of armory sdk inside entity manager --- .../_components/EntityManager.tsx | 6 +-- .../_components/cards/AccountCard.tsx | 2 +- .../_components/cards/CredentialCard.tsx | 2 +- .../_components/cards/UserCard.tsx | 2 +- .../dialogs/DeriveAccountDialog.tsx | 3 +- .../dialogs/GenerateWalletDialog.tsx | 11 ++++- .../_components/dialogs/ImportKeyDialog.tsx | 4 +- .../_components/forms/AccountForm.tsx | 2 +- .../_components/forms/AssignAccountForm.tsx | 2 +- .../_components/forms/CredentialForm.tsx | 12 +++++- .../_components/forms/UserForm.tsx | 13 +++++- packages/armory-sdk/src/index.ts | 42 ++++++++++++------- 12 files changed, 66 insertions(+), 35 deletions(-) diff --git a/apps/devtool/src/app/entity-manager/_components/EntityManager.tsx b/apps/devtool/src/app/entity-manager/_components/EntityManager.tsx index 413382db9..f8d72310b 100644 --- a/apps/devtool/src/app/entity-manager/_components/EntityManager.tsx +++ b/apps/devtool/src/app/entity-manager/_components/EntityManager.tsx @@ -21,9 +21,9 @@ import { Entities, EntityUtil, UserAccountEntity, - UserEntity -} from '@narval/policy-engine-shared' -import { hash } from '@narval/signature' + UserEntity, + hash +} from '@narval/armory-sdk' import { useEffect, useState } from 'react' import { z } from 'zod' import CodeEditor from '../../_components/CodeEditor' diff --git a/apps/devtool/src/app/entity-manager/_components/cards/AccountCard.tsx b/apps/devtool/src/app/entity-manager/_components/cards/AccountCard.tsx index b5883a9d4..c566b36ae 100644 --- a/apps/devtool/src/app/entity-manager/_components/cards/AccountCard.tsx +++ b/apps/devtool/src/app/entity-manager/_components/cards/AccountCard.tsx @@ -1,5 +1,5 @@ import { faTrash, faUnlink } from '@fortawesome/free-solid-svg-icons' -import { AccountEntity } from '@narval/policy-engine-shared' +import { AccountEntity } from '@narval/armory-sdk' import NarIconButtonWithTooltip from '../../../_design-system/NarIconButtonWithTooltip' interface AccountCardProps { diff --git a/apps/devtool/src/app/entity-manager/_components/cards/CredentialCard.tsx b/apps/devtool/src/app/entity-manager/_components/cards/CredentialCard.tsx index e630bba99..93c596a45 100644 --- a/apps/devtool/src/app/entity-manager/_components/cards/CredentialCard.tsx +++ b/apps/devtool/src/app/entity-manager/_components/cards/CredentialCard.tsx @@ -1,5 +1,5 @@ import { faTrash } from '@fortawesome/free-solid-svg-icons' -import { CredentialEntity } from '@narval/policy-engine-shared' +import { CredentialEntity } from '@narval/armory-sdk' import NarIconButtonWithTooltip from '../../../_design-system/NarIconButtonWithTooltip' interface CredentialCardProps { diff --git a/apps/devtool/src/app/entity-manager/_components/cards/UserCard.tsx b/apps/devtool/src/app/entity-manager/_components/cards/UserCard.tsx index efce25676..472ddc3c1 100644 --- a/apps/devtool/src/app/entity-manager/_components/cards/UserCard.tsx +++ b/apps/devtool/src/app/entity-manager/_components/cards/UserCard.tsx @@ -6,7 +6,7 @@ import { faTrash, faWallet } from '@fortawesome/free-solid-svg-icons' -import { UserEntity } from '@narval/policy-engine-shared' +import { UserEntity } from '@narval/armory-sdk' import * as Collapsible from '@radix-ui/react-collapsible' import { capitalize } from 'lodash/fp' import { useState } from 'react' diff --git a/apps/devtool/src/app/entity-manager/_components/dialogs/DeriveAccountDialog.tsx b/apps/devtool/src/app/entity-manager/_components/dialogs/DeriveAccountDialog.tsx index 6a3adefbd..7002588ae 100644 --- a/apps/devtool/src/app/entity-manager/_components/dialogs/DeriveAccountDialog.tsx +++ b/apps/devtool/src/app/entity-manager/_components/dialogs/DeriveAccountDialog.tsx @@ -1,8 +1,7 @@ 'use client' import { faXmarkCircle } from '@fortawesome/free-solid-svg-icons' -import { Permission } from '@narval/armory-sdk' -import { AccountType, Action, Entities, EntityUtil, hexSchema } from '@narval/policy-engine-shared' +import { AccountType, Action, Entities, EntityUtil, Permission, hexSchema } from '@narval/armory-sdk' import { parseInt } from 'lodash' import { Dispatch, FC, SetStateAction, useState } from 'react' import { v4 as uuid } from 'uuid' diff --git a/apps/devtool/src/app/entity-manager/_components/dialogs/GenerateWalletDialog.tsx b/apps/devtool/src/app/entity-manager/_components/dialogs/GenerateWalletDialog.tsx index fdb2ea693..5601bba92 100644 --- a/apps/devtool/src/app/entity-manager/_components/dialogs/GenerateWalletDialog.tsx +++ b/apps/devtool/src/app/entity-manager/_components/dialogs/GenerateWalletDialog.tsx @@ -2,8 +2,15 @@ import { faCheckCircle, faWallet, faXmarkCircle } from '@fortawesome/free-solid-svg-icons' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' -import { GenerateKeyResponse, Permission } from '@narval/armory-sdk' -import { AccountType, Action, Entities, EntityUtil, hexSchema } from '@narval/policy-engine-shared' +import { + AccountType, + Action, + Entities, + EntityUtil, + GenerateKeyResponse, + Permission, + hexSchema +} from '@narval/armory-sdk' import { Dispatch, FC, SetStateAction, useMemo, useState } from 'react' import { v4 as uuid } from 'uuid' import ValueWithCopy from '../../../_components/ValueWithCopy' diff --git a/apps/devtool/src/app/entity-manager/_components/dialogs/ImportKeyDialog.tsx b/apps/devtool/src/app/entity-manager/_components/dialogs/ImportKeyDialog.tsx index c09b94c1a..b569f4473 100644 --- a/apps/devtool/src/app/entity-manager/_components/dialogs/ImportKeyDialog.tsx +++ b/apps/devtool/src/app/entity-manager/_components/dialogs/ImportKeyDialog.tsx @@ -1,9 +1,7 @@ 'use client' import { faXmarkCircle } from '@fortawesome/free-solid-svg-icons' -import { Permission } from '@narval/armory-sdk' -import { AccountEntity, AccountType, Action, Entities, getAddress } from '@narval/policy-engine-shared' -import { Hex } from '@narval/signature' +import { AccountEntity, AccountType, Action, Entities, Hex, Permission, getAddress } from '@narval/armory-sdk' import { Dispatch, SetStateAction, useState } from 'react' import { v4 as uuid } from 'uuid' import NarButton from '../../../_design-system/NarButton' diff --git a/apps/devtool/src/app/entity-manager/_components/forms/AccountForm.tsx b/apps/devtool/src/app/entity-manager/_components/forms/AccountForm.tsx index 7558af71f..6a20ba161 100644 --- a/apps/devtool/src/app/entity-manager/_components/forms/AccountForm.tsx +++ b/apps/devtool/src/app/entity-manager/_components/forms/AccountForm.tsx @@ -1,6 +1,6 @@ 'use client' -import { AccountEntity, AccountType, getAddress, isAddress } from '@narval/policy-engine-shared' +import { AccountEntity, AccountType, getAddress, isAddress } from '@narval/armory-sdk' import { Dispatch, FC, SetStateAction, useEffect, useState } from 'react' import NarInput from '../../../_design-system/NarInput' diff --git a/apps/devtool/src/app/entity-manager/_components/forms/AssignAccountForm.tsx b/apps/devtool/src/app/entity-manager/_components/forms/AssignAccountForm.tsx index 77492eab1..afe02d07a 100644 --- a/apps/devtool/src/app/entity-manager/_components/forms/AssignAccountForm.tsx +++ b/apps/devtool/src/app/entity-manager/_components/forms/AssignAccountForm.tsx @@ -1,4 +1,4 @@ -import { AccountEntity, UserAccountEntity, UserEntity } from '@narval/policy-engine-shared' +import { AccountEntity, UserAccountEntity, UserEntity } from '@narval/armory-sdk' import { Dispatch, FC, SetStateAction, useCallback } from 'react' import MultiSelectList from '../MultiselectList' diff --git a/apps/devtool/src/app/entity-manager/_components/forms/CredentialForm.tsx b/apps/devtool/src/app/entity-manager/_components/forms/CredentialForm.tsx index 69a1f99dc..e21064475 100644 --- a/apps/devtool/src/app/entity-manager/_components/forms/CredentialForm.tsx +++ b/apps/devtool/src/app/entity-manager/_components/forms/CredentialForm.tsx @@ -1,5 +1,13 @@ -import { CredentialEntity, UserEntity, isAddress } from '@narval/policy-engine-shared' -import { Curves, KeyTypes, SigningAlg, jwkEoaSchema, publicKeySchema } from '@narval/signature' +import { + CredentialEntity, + Curves, + KeyTypes, + SigningAlg, + UserEntity, + isAddress, + jwkEoaSchema, + publicKeySchema +} from '@narval/armory-sdk' import { Dispatch, FC, SetStateAction, useEffect, useState } from 'react' import NarButton from '../../../_design-system/NarButton' import NarInput from '../../../_design-system/NarInput' diff --git a/apps/devtool/src/app/entity-manager/_components/forms/UserForm.tsx b/apps/devtool/src/app/entity-manager/_components/forms/UserForm.tsx index daf69dc81..216e30450 100644 --- a/apps/devtool/src/app/entity-manager/_components/forms/UserForm.tsx +++ b/apps/devtool/src/app/entity-manager/_components/forms/UserForm.tsx @@ -1,7 +1,16 @@ import { faChevronDown } from '@fortawesome/free-solid-svg-icons' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' -import { CredentialEntity, UserEntity, UserRole, isAddress } from '@narval/policy-engine-shared' -import { Curves, KeyTypes, SigningAlg, jwkEoaSchema, publicKeySchema } from '@narval/signature' +import { + CredentialEntity, + Curves, + KeyTypes, + SigningAlg, + UserEntity, + UserRole, + isAddress, + jwkEoaSchema, + publicKeySchema +} from '@narval/armory-sdk' import { capitalize } from 'lodash' import { Dispatch, FC, SetStateAction, useEffect, useState } from 'react' import { v4 as uuid } from 'uuid' diff --git a/packages/armory-sdk/src/index.ts b/packages/armory-sdk/src/index.ts index 1d336254e..b7b868fda 100644 --- a/packages/armory-sdk/src/index.ts +++ b/packages/armory-sdk/src/index.ts @@ -9,9 +9,12 @@ export * from './lib/vault' export { resourceId } from './lib/utils' -export type { Alg, PrivateKey, PublicKey, RsaPublicKey, SigningAlg } from '@narval/signature' +export type { Alg, PrivateKey, PublicKey, RsaPublicKey } from '@narval/signature' export { + Curves, + KeyTypes, + SigningAlg, base64UrlToHex, buildSignerEip191, buildSignerForAlg, @@ -19,37 +22,44 @@ export { getPublicKey, hash, hexToBase64Url, + jwkEoaSchema, jwkSchema, privateKeyToJwk, + publicKeySchema, publicKeyToJwk, signJwt } from '@narval/signature' -export { +export type { AccessToken, - AccountType, - Action, + AccountEntity, + Address, CreateAuthorizationRequest, + CredentialEntity, Criterion, Decision, Eip712TypedData, + Entities, EntityType, + Hex, JwtString, + Policy, + PolicyCriterion, Request, Then, TransactionRequest, - UserRole, - ValueOperators + UserAccountEntity, + UserEntity, + ValueOperators, } from '@narval/policy-engine-shared' -export type { - AccountEntity, - Address, - Entities, - Hex, - Policy, - PolicyCriterion, - UserEntity +export { + AccountType, + Action, + EntityUtil, + UserRole, + getAddress, + hexSchema, + isAddress, + toHex } from '@narval/policy-engine-shared' - -export { EntityUtil, getAddress, toHex } from '@narval/policy-engine-shared'