@@ -58,6 +58,7 @@ use runtime_common::{
5858 assets:: { AssetDid , PublicCredentialsFilter } ,
5959 authorization:: { AuthorizationId , PalletAuthorize } ,
6060 constants:: { self , UnvestedFundsAllowedWithdrawReasons , EXISTENTIAL_DEPOSIT , KILT } ,
61+ dip:: merkle:: { CompleteMerkleProof , DidMerkleProofOf , DidMerkleRootGenerator } ,
6162 errors:: PublicCredentialsApiError ,
6263 fees:: { ToAuthor , WeightToFee } ,
6364 pallet_id, AccountId , AuthorityId , Balance , BlockHashCount , BlockLength , BlockNumber , BlockWeights , DidIdentifier ,
@@ -75,6 +76,7 @@ pub use sp_runtime::BuildStorage;
7576#[ cfg( test) ]
7677mod tests;
7778
79+ mod dip;
7880mod weights;
7981pub mod xcm_config;
8082
@@ -743,8 +745,10 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
743745 | RuntimeCall :: Ctype ( ..)
744746 | RuntimeCall :: Delegation ( ..)
745747 | RuntimeCall :: Democracy ( ..)
748+ | RuntimeCall :: DepositStorage ( ..)
746749 | RuntimeCall :: Did ( ..)
747750 | RuntimeCall :: DidLookup ( ..)
751+ | RuntimeCall :: DipProvider ( ..)
748752 | RuntimeCall :: Indices (
749753 // Excludes `force_transfer`, and `transfer`
750754 pallet_indices:: Call :: claim { .. }
@@ -796,6 +800,7 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
796800 | delegation:: Call :: change_deposit_owner { .. }
797801 )
798802 | RuntimeCall :: Democracy ( ..)
803+ // Excludes `DepositStorage`
799804 | RuntimeCall :: Did (
800805 // Excludes `reclaim_deposit`
801806 did:: Call :: add_key_agreement_key { .. }
@@ -812,6 +817,8 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
812817 | did:: Call :: submit_did_call { .. }
813818 | did:: Call :: update_deposit { .. }
814819 | did:: Call :: change_deposit_owner { .. }
820+ | did:: Call :: create_from_account { .. }
821+ | did:: Call :: dispatch_as { .. }
815822 )
816823 | RuntimeCall :: DidLookup (
817824 // Excludes `reclaim_deposit`
@@ -822,6 +829,7 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
822829 | pallet_did_lookup:: Call :: update_deposit { .. }
823830 | pallet_did_lookup:: Call :: change_deposit_owner { .. }
824831 )
832+ | RuntimeCall :: DipProvider ( ..)
825833 | RuntimeCall :: Indices ( ..)
826834 | RuntimeCall :: Multisig ( ..)
827835 | RuntimeCall :: ParachainStaking ( ..)
@@ -972,6 +980,8 @@ construct_runtime! {
972980 Web3Names : pallet_web3_names = 68 ,
973981 PublicCredentials : public_credentials = 69 ,
974982 Migration : pallet_migration = 70 ,
983+ DipProvider : pallet_dip_provider = 71 ,
984+ DepositStorage : pallet_deposit_storage = 72 ,
975985
976986 // Parachains pallets. Start indices at 80 to leave room.
977987
@@ -1015,6 +1025,7 @@ impl did::DeriveDidCallAuthorizationVerificationKeyRelationship for RuntimeCall
10151025 RuntimeCall :: Attestation { .. } => Ok ( did:: DidVerificationKeyRelationship :: AssertionMethod ) ,
10161026 RuntimeCall :: Ctype { .. } => Ok ( did:: DidVerificationKeyRelationship :: AssertionMethod ) ,
10171027 RuntimeCall :: Delegation { .. } => Ok ( did:: DidVerificationKeyRelationship :: CapabilityDelegation ) ,
1028+ RuntimeCall :: DipProvider { .. } => Ok ( did:: DidVerificationKeyRelationship :: Authentication ) ,
10181029 // DID creation is not allowed through the DID proxy.
10191030 RuntimeCall :: Did ( did:: Call :: create { .. } ) => Err ( did:: RelationshipDeriveError :: NotCallableByDid ) ,
10201031 RuntimeCall :: Did { .. } => Ok ( did:: DidVerificationKeyRelationship :: Authentication ) ,
@@ -1105,6 +1116,8 @@ mod benches {
11051116 [ public_credentials, PublicCredentials ]
11061117 [ pallet_xcm, PolkadotXcm ]
11071118 [ pallet_migration, Migration ]
1119+ [ pallet_dip_provider, DipProvider ]
1120+ [ pallet_deposit_storage, DepositStorage ]
11081121 [ frame_benchmarking:: baseline, Baseline :: <Runtime >]
11091122 ) ;
11101123}
@@ -1371,6 +1384,16 @@ impl_runtime_apis! {
13711384 }
13721385 }
13731386
1387+ impl kilt_runtime_api_dip_provider:: DipProvider <Block , dip:: runtime_api:: DipProofRequest , CompleteMerkleProof <Hash , DidMerkleProofOf <Runtime >>, dip:: runtime_api:: DipProofError > for Runtime {
1388+ fn generate_proof( request: dip:: runtime_api:: DipProofRequest ) -> Result <CompleteMerkleProof <Hash , DidMerkleProofOf <Runtime >>, dip:: runtime_api:: DipProofError > {
1389+ use pallet_dip_provider:: traits:: IdentityProvider ;
1390+
1391+ let identity_details = pallet_dip_provider:: IdentityProviderOf :: <Runtime >:: retrieve( & request. identifier) . map_err( dip:: runtime_api:: DipProofError :: IdentityProvider ) ?;
1392+
1393+ DidMerkleRootGenerator :: <Runtime >:: generate_proof( & identity_details, request. version, request. keys. iter( ) , request. should_include_web3_name, request. accounts. iter( ) ) . map_err( dip:: runtime_api:: DipProofError :: MerkleProof )
1394+ }
1395+ }
1396+
13741397 #[ cfg( feature = "runtime-benchmarks" ) ]
13751398 impl frame_benchmarking:: Benchmark <Block > for Runtime {
13761399 fn benchmark_metadata( extra: bool ) -> (
0 commit comments