@t-rex-network/onchainid 0.0.0-stage → 3.0.0-beta2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (237) hide show
  1. package/LICENSE.md +674 -0
  2. package/NOTICE.md +66 -0
  3. package/README.md +177 -2
  4. package/contracts/Identity.sol +235 -0
  5. package/contracts/IdentityUtilities.sol +269 -0
  6. package/contracts/KeyManager.sol +193 -0
  7. package/contracts/SmartAccount.sol +222 -0
  8. package/contracts/factory/IIdentityFactory.sol +325 -0
  9. package/contracts/factory/IdentityFactory.sol +818 -0
  10. package/contracts/interface/IClaimIssuer.sol +105 -0
  11. package/contracts/interface/IERC734.sol +69 -0
  12. package/contracts/interface/IERC735.sol +149 -0
  13. package/contracts/interface/IIdentity.sol +63 -0
  14. package/contracts/interface/IIdentityUtilities.sol +135 -0
  15. package/contracts/interface/IKeyExecutor.sol +84 -0
  16. package/contracts/libraries/Errors.sol +407 -0
  17. package/contracts/libraries/FormatResolver.sol +74 -0
  18. package/contracts/libraries/Hashing.sol +35 -0
  19. package/contracts/libraries/IdentityTypes.sol +53 -0
  20. package/contracts/libraries/KeyPurposes.sol +49 -0
  21. package/contracts/libraries/KeyTypes.sol +46 -0
  22. package/contracts/modules/claims/EASClaimIssuer.sol +348 -0
  23. package/contracts/modules/executors/KeyApprovalModule.sol +313 -0
  24. package/contracts/modules/executors/RecoveryModule.sol +88 -0
  25. package/contracts/modules/validators/ERC734Validator.sol +1000 -0
  26. package/contracts/modules/validators/ERC7579Validator.sol +74 -0
  27. package/contracts/proxy/IdentityUtilitiesProxy.sol +36 -0
  28. package/contracts/reputation/IReputationRegistry.sol +117 -0
  29. package/contracts/reputation/ReputationRegistry.sol +155 -0
  30. package/contracts/storage/Structs.sol +176 -0
  31. package/contracts/vendor/eas/IEAS.sol +36 -0
  32. package/contracts/vendor/utils/SafeCalldataBatch.sol +61 -0
  33. package/out/AbstractSigner.sol/AbstractSigner.json +1 -0
  34. package/out/AccessControlUpgradeable.sol/AccessControlUpgradeable.json +1 -0
  35. package/out/AccessManaged.sol/AccessManaged.json +1 -0
  36. package/out/AccessManager.sol/AccessManager.json +1 -0
  37. package/out/Account.sol/Account.json +1 -0
  38. package/out/AddClaimByTrustedIssuer.t.sol/AddClaimAsTrustedIssuerTest.json +1 -0
  39. package/out/Address.sol/Address.json +1 -0
  40. package/out/Arrays.sol/Arrays.json +1 -0
  41. package/out/AuthorityUtils.sol/AuthorityUtils.json +1 -0
  42. package/out/Base.sol/CommonBase.json +1 -0
  43. package/out/Base.sol/ScriptBase.json +1 -0
  44. package/out/Base.sol/TestBase.json +1 -0
  45. package/out/Base64.sol/Base64.json +1 -0
  46. package/out/BatchDecodeParity.t.sol/BatchDecodeParityTest.json +1 -0
  47. package/out/BeaconProxy.sol/BeaconProxy.json +1 -0
  48. package/out/Bytes.sol/Bytes.json +1 -0
  49. package/out/Calldata.sol/Calldata.json +1 -0
  50. package/out/ClaimSignatureDefinition.t.sol/ClaimSignatureDefinitionTest.json +1 -0
  51. package/out/ClaimSignatureDefinition.t.sol/NoERC1271Delegate.json +1 -0
  52. package/out/ClaimSignatureDefinition.t.sol/PickyERC1271Delegate.json +1 -0
  53. package/out/ClaimSignerHelper.sol/ClaimSignerHelper.json +1 -0
  54. package/out/ClaimTo.t.sol/ClaimToTest.json +1 -0
  55. package/out/Claims.t.sol/ClaimsTest.json +1 -0
  56. package/out/Claims.t.sol/ExternalIssuer.json +1 -0
  57. package/out/Comparators.sol/Comparators.json +1 -0
  58. package/out/Constants.sol/Constants.json +1 -0
  59. package/out/Context.sol/Context.json +1 -0
  60. package/out/ContextUpgradeable.sol/ContextUpgradeable.json +1 -0
  61. package/out/Create2.sol/Create2.json +1 -0
  62. package/out/Create3.sol/Create3.json +1 -0
  63. package/out/DeployOnchainID.s.sol/DeployOnchainID.json +1 -0
  64. package/out/EASClaimIssuer.sol/EASClaimIssuer.json +1 -0
  65. package/out/EASClaimIssuer.t.sol/EASClaimIssuerTest.json +1 -0
  66. package/out/EASClaimIssuer.t.sol/VmContractHelper29562166e1daff82a9ba4e08c324c14e885cfef135c42b5774ced18642e5fa19.json +1 -0
  67. package/out/EASTypes.sol/IEASTest.json +1 -0
  68. package/out/EASTypes.sol/ISchemaRegistryTest.json +1 -0
  69. package/out/ECDSA.sol/ECDSA.json +1 -0
  70. package/out/EIP712.sol/EIP712.json +1 -0
  71. package/out/ERC165.sol/ERC165.json +1 -0
  72. package/out/ERC165Upgradeable.sol/ERC165Upgradeable.json +1 -0
  73. package/out/ERC1967Proxy.sol/ERC1967Proxy.json +1 -0
  74. package/out/ERC1967Utils.sol/ERC1967Utils.json +1 -0
  75. package/out/ERC4337Utils.sol/ERC4337Utils.json +1 -0
  76. package/out/ERC4337Utils.sol/IEntryPointExtra.json +1 -0
  77. package/out/ERC734Validator.sol/ERC734Validator.json +1 -0
  78. package/out/ERC734Validator.t.sol/ERC734ValidatorTest.json +1 -0
  79. package/out/ERC734Validator.t.sol/PocCounter.json +1 -0
  80. package/out/ERC734Validator.t.sol/VmContractHelper7beb488c9b6c5f9f79178a8ce1e9ea8b7d447a9f1b366d4a3784214e9066b776.json +1 -0
  81. package/out/ERC7579DelayedExecutor.sol/ERC7579DelayedExecutor.json +1 -0
  82. package/out/ERC7579Executor.sol/ERC7579Executor.json +1 -0
  83. package/out/ERC7579Multisig.sol/ERC7579Multisig.json +1 -0
  84. package/out/ERC7579MultisigWeighted.sol/ERC7579MultisigWeighted.json +1 -0
  85. package/out/ERC7579SocialRecoveryExecutor.sol/ERC7579SocialRecoveryExecutor.json +1 -0
  86. package/out/ERC7579Validator.sol/ERC7579Validator.json +1 -0
  87. package/out/ERC7786Recipient.sol/ERC7786Recipient.json +1 -0
  88. package/out/ERC7913WebAuthnVerifier.sol/ERC7913WebAuthnVerifier.json +1 -0
  89. package/out/EnumerableSet.sol/EnumerableSet.json +1 -0
  90. package/out/Errors.sol/Errors.json +1 -0
  91. package/out/Executions.t.sol/ETHReceiver.json +1 -0
  92. package/out/Executions.t.sol/ExecutionsTest.json +1 -0
  93. package/out/Executions.t.sol/RevertingReceiver.json +1 -0
  94. package/out/FormatResolver.sol/FormatResolver.json +1 -0
  95. package/out/Hashes.sol/Hashes.json +1 -0
  96. package/out/IAccessControl.sol/IAccessControl.json +1 -0
  97. package/out/IAccessManaged.sol/IAccessManaged.json +1 -0
  98. package/out/IAccessManager.sol/IAccessManager.json +1 -0
  99. package/out/IAuthority.sol/IAuthority.json +1 -0
  100. package/out/IBeacon.sol/IBeacon.json +1 -0
  101. package/out/IClaimIssuer.sol/IClaimIssuer.json +1 -0
  102. package/out/IEAS.sol/IEAS.json +1 -0
  103. package/out/IERC1271.sol/IERC1271.json +1 -0
  104. package/out/IERC165.sol/IERC165.json +1 -0
  105. package/out/IERC1967.sol/IERC1967.json +1 -0
  106. package/out/IERC4337.sol/IAccount.json +1 -0
  107. package/out/IERC4337.sol/IAccountExecute.json +1 -0
  108. package/out/IERC4337.sol/IAggregator.json +1 -0
  109. package/out/IERC4337.sol/IEntryPoint.json +1 -0
  110. package/out/IERC4337.sol/IEntryPointNonces.json +1 -0
  111. package/out/IERC4337.sol/IEntryPointStake.json +1 -0
  112. package/out/IERC4337.sol/IPaymaster.json +1 -0
  113. package/out/IERC5267.sol/IERC5267.json +1 -0
  114. package/out/IERC734.sol/IERC734.json +1 -0
  115. package/out/IERC734Surface.t.sol/IERC734SurfaceTest.json +1 -0
  116. package/out/IERC735.sol/IERC735.json +1 -0
  117. package/out/IERC7913.sol/IERC7913SignatureVerifier.json +1 -0
  118. package/out/IIdentity.sol/IIdentity.json +1 -0
  119. package/out/IIdentityFactory.sol/IIdentityFactory.json +1 -0
  120. package/out/IIdentityUtilities.sol/IIdentityUtilities.json +1 -0
  121. package/out/IKeyExecutor.sol/IKeyExecutor.json +1 -0
  122. package/out/IMulticall3.sol/IMulticall3.json +1 -0
  123. package/out/IReputationRegistry.sol/IReputationRegistry.json +1 -0
  124. package/out/Identity.sol/Identity.json +1 -0
  125. package/out/IdentityFactory.sol/IdentityFactory.json +1 -0
  126. package/out/IdentityFactory.t.sol/IdentityFactoryTest.json +1 -0
  127. package/out/IdentityFactory.t.sol/VmContractHelper28a7b3ffc37fea8b5c41ecc8f253eb5ab470e21bb0401440d9a55fcb4f8afe5c.json +1 -0
  128. package/out/IdentityHelper.sol/IdentityHelper.json +1 -0
  129. package/out/IdentityHelper.sol/VmContractHelper78387a8fc41a64804f1f0fc2cbba310bbca11e4f057b06dfa169d4c103c08be5.json +1 -0
  130. package/out/IdentityTypes.sol/IdentityTypes.json +1 -0
  131. package/out/IdentityUtilities.sol/IdentityUtilities.json +1 -0
  132. package/out/IdentityUtilities.t.sol/IdentityUtilitiesTest.json +1 -0
  133. package/out/IdentityUtilities.t.sol/VmContractHelper7ed074704942d210565581d7e79e91a1d3425a5a7e758acb90866c42420e726c.json +1 -0
  134. package/out/IdentityUtilitiesProxy.sol/IdentityUtilitiesProxy.json +1 -0
  135. package/out/Init.t.sol/InitTest.json +1 -0
  136. package/out/Init.t.sol/VmContractHelper95bc81f417f4a3acb58eafba49b7834c5e65588c78654308ee428eb7d9276cce.json +1 -0
  137. package/out/Initializable.sol/Initializable.json +1 -0
  138. package/out/InteroperableAddressEncoding.t.sol/InteroperableAddressEncodingTest.json +1 -0
  139. package/out/KeyApprovalModule.sol/IIdentityAccount.json +1 -0
  140. package/out/KeyApprovalModule.sol/KeyApprovalModule.json +1 -0
  141. package/out/KeyApprovalModuleFactoryGuard.t.sol/KeyApprovalModuleFactoryGuardTest.json +1 -0
  142. package/out/KeyManager.sol/KeyManager.json +1 -0
  143. package/out/KeyPurposes.sol/KeyPurposes.json +1 -0
  144. package/out/KeyTypes.sol/KeyTypes.json +1 -0
  145. package/out/Keys.t.sol/KeysTest.json +1 -0
  146. package/out/LowLevelCall.sol/LowLevelCall.json +1 -0
  147. package/out/Math.sol/Math.json +1 -0
  148. package/out/MessageHashUtils.sol/MessageHashUtils.json +1 -0
  149. package/out/MockERC1271Signer.sol/MockERC1271Signer.json +1 -0
  150. package/out/MockERC1271Wallet.sol/MockERC1271Wallet.json +1 -0
  151. package/out/MockERC7786Gateway.sol/MockERC7786Gateway.json +1 -0
  152. package/out/MockERC7913PermissiveVerifier.sol/MockERC7913PermissiveVerifier.json +1 -0
  153. package/out/MockLyingERC734Getter.sol/MockLyingERC734Getter.json +1 -0
  154. package/out/MockStockECDSAValidator.sol/MockStockECDSAValidator.json +1 -0
  155. package/out/Multicall.sol/Multicall.json +1 -0
  156. package/out/Multisig.sol/Multisig.json +1 -0
  157. package/out/Nonces.sol/Nonces.json +1 -0
  158. package/out/OnchainIDSetup.sol/OnchainIDSetup.json +1 -0
  159. package/out/Ownable.sol/Ownable.json +1 -0
  160. package/out/P256.sol/P256.json +1 -0
  161. package/out/Packing.sol/Packing.json +1 -0
  162. package/out/Panic.sol/Panic.json +1 -0
  163. package/out/PrivilegedReentryGuard.t.sol/PocCounter.json +1 -0
  164. package/out/PrivilegedReentryGuard.t.sol/PrivilegedReentryGuardTest.json +1 -0
  165. package/out/Proxy.sol/Proxy.json +1 -0
  166. package/out/Proxy.t.sol/ProxyTest.json +1 -0
  167. package/out/Proxy.t.sol/VmContractHelper20ec29ce959b555228240226871c123d935ae49f617ce49540ee53c85f9f8cd4.json +1 -0
  168. package/out/ProxyPattern.t.sol/ProxyPatternTest.json +1 -0
  169. package/out/RecoveryModule.sol/RecoveryModule.json +1 -0
  170. package/out/RecoveryModule.t.sol/RecoveryModuleTest.json +1 -0
  171. package/out/RecoveryModule.t.sol/VmContractHelper84563bc19cefad0d2824def84f4cab79093d389b1866eff467a2908e14dd8421.json +1 -0
  172. package/out/ReputationRegistry.sol/ReputationRegistry.json +1 -0
  173. package/out/ReputationRegistry.t.sol/FakeIdentity.json +1 -0
  174. package/out/ReputationRegistry.t.sol/ReputationRegistryTest.json +1 -0
  175. package/out/ReputationRegistry.t.sol/VmContractHelper4353cedc5e63171396a0756138ec48ebba489252c7f4fef50b08f9e2c0989ec9.json +1 -0
  176. package/out/RevertingIdentity.sol/RevertingIdentity.json +1 -0
  177. package/out/SafeCalldataBatch.sol/SafeCalldataBatch.json +1 -0
  178. package/out/SafeCast.sol/SafeCast.json +1 -0
  179. package/out/Script.sol/Script.json +1 -0
  180. package/out/ShortStrings.sol/ShortStrings.json +1 -0
  181. package/out/SignatureChecker.sol/SignatureChecker.json +1 -0
  182. package/out/SignedMath.sol/SignedMath.json +1 -0
  183. package/out/SlotDerivation.sol/SlotDerivation.json +1 -0
  184. package/out/SmartAccount.sol/SmartAccount.json +1 -0
  185. package/out/SmartAccount.t.sol/AlwaysApprovePolicy.json +1 -0
  186. package/out/SmartAccount.t.sol/Counter.json +1 -0
  187. package/out/SmartAccount.t.sol/IAddKeyWithData.json +1 -0
  188. package/out/SmartAccount.t.sol/ReentrantUninstaller.json +1 -0
  189. package/out/SmartAccount.t.sol/SmartAccountTest.json +1 -0
  190. package/out/SmartAccount.t.sol/TestExecutor.json +1 -0
  191. package/out/StdAssertions.sol/StdAssertions.json +1 -0
  192. package/out/StdChains.sol/StdChains.json +1 -0
  193. package/out/StdCheats.sol/StdCheats.json +1 -0
  194. package/out/StdCheats.sol/StdCheatsSafe.json +1 -0
  195. package/out/StdConstants.sol/StdConstants.json +1 -0
  196. package/out/StdError.sol/stdError.json +1 -0
  197. package/out/StdInvariant.sol/StdInvariant.json +1 -0
  198. package/out/StdJson.sol/stdJson.json +1 -0
  199. package/out/StdMath.sol/stdMath.json +1 -0
  200. package/out/StdStorage.sol/stdStorage.json +1 -0
  201. package/out/StdStorage.sol/stdStorageSafe.json +1 -0
  202. package/out/StdStyle.sol/StdStyle.json +1 -0
  203. package/out/StdToml.sol/stdToml.json +1 -0
  204. package/out/StdUtils.sol/StdUtils.json +1 -0
  205. package/out/StorageSlot.sol/StorageSlot.json +1 -0
  206. package/out/Strings.sol/Strings.json +1 -0
  207. package/out/Structs.sol/Structs.json +1 -0
  208. package/out/Test.sol/Test.json +1 -0
  209. package/out/TestIdentityUtilities.sol/TestIdentityUtilities.json +1 -0
  210. package/out/Time.sol/Time.json +1 -0
  211. package/out/TokenOid.t.sol/TokenOidTest.json +1 -0
  212. package/out/UUPSUpgradeable.sol/UUPSUpgradeable.json +1 -0
  213. package/out/UnlockedIdentity.sol/UnlockedIdentity.json +1 -0
  214. package/out/UpgradeableBeacon.sol/UpgradeableBeacon.json +1 -0
  215. package/out/VersionUpgrade.t.sol/VersionUpgradeTest.json +1 -0
  216. package/out/Vm.sol/Vm.json +1 -0
  217. package/out/Vm.sol/VmSafe.json +1 -0
  218. package/out/WebAuthn.sol/WebAuthn.json +1 -0
  219. package/out/WebAuthn.t.sol/WebAuthnTest.json +1 -0
  220. package/out/build-info/1056f64abc9637ee.json +1 -0
  221. package/out/console.sol/console.json +1 -0
  222. package/out/draft-AccountERC7579Upgradeable.sol/AccountERC7579Upgradeable.json +1 -0
  223. package/out/draft-ERC7579Utils.sol/ERC7579Utils.json +1 -0
  224. package/out/draft-IERC1822.sol/IERC1822Proxiable.json +1 -0
  225. package/out/draft-IERC7579.sol/IERC7579AccountConfig.json +1 -0
  226. package/out/draft-IERC7579.sol/IERC7579Execution.json +1 -0
  227. package/out/draft-IERC7579.sol/IERC7579Hook.json +1 -0
  228. package/out/draft-IERC7579.sol/IERC7579Module.json +1 -0
  229. package/out/draft-IERC7579.sol/IERC7579ModuleConfig.json +1 -0
  230. package/out/draft-IERC7579.sol/IERC7579Validator.json +1 -0
  231. package/out/draft-IERC7786.sol/IERC7786GatewaySource.json +1 -0
  232. package/out/draft-IERC7786.sol/IERC7786Recipient.json +1 -0
  233. package/out/draft-InteroperableAddress.sol/InteroperableAddress.json +1 -0
  234. package/out/safeconsole.sol/safeconsole.json +1 -0
  235. package/out/src/Test.sol/Test.json +1 -0
  236. package/out/utils/Errors.sol/Errors.json +1 -0
  237. package/package.json +75 -4
@@ -0,0 +1,407 @@
1
+ // SPDX-License-Identifier: GPL-3.0
2
+ //
3
+ // ONCHAINID Smart Contracts
4
+ // Digital identities for the T-REX ecosystem.
5
+ //
6
+ // Copyright (C) 2026 Digital Asset Operational Services ISAC Ltd. ("T-REX Network")
7
+ //
8
+ // This file is part of the ONCHAINID smart contract suite.
9
+ //
10
+ // This program is free software: you can redistribute it and/or modify
11
+ // it under the terms of the GNU General Public License as published by
12
+ // the Free Software Foundation, either version 3 of the License, or
13
+ // (at your option) any later version.
14
+ //
15
+ // This program is distributed in the hope that it will be useful,
16
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
+ // GNU General Public License for more details.
19
+ //
20
+ // You should have received a copy of the GNU General Public License
21
+ // along with this program. If not, see <https://www.gnu.org/licenses/>.
22
+
23
+ pragma solidity ^0.8.27;
24
+
25
+ /// @title Errors
26
+ /// @notice Library containing all custom errors the protocol may revert with
27
+ library Errors {
28
+
29
+ /* ----- Generic ----- */
30
+
31
+ /// @notice Reverts if the address is zero
32
+ error ZeroAddress();
33
+
34
+ /* ----- IdentityFactory ----- */
35
+
36
+ /// @notice Reverts if the list of keys is empty
37
+ error EmptyListOfKeys();
38
+
39
+ /// @notice Reverts if the string is empty
40
+ error EmptyString();
41
+
42
+ /// @notice Reverts if the token is already linked
43
+ error TokenAlreadyLinked(address token);
44
+
45
+ /// @notice Reverts when a caller tries to deploy an identity of a type whose
46
+ /// configured AM role they do not hold.
47
+ /// @param caller the address that attempted the deployment.
48
+ /// @param identityType the identity type that was requested.
49
+ /// @param requiredRole the AM role id required for that type.
50
+ error NotAuthorizedForIdentityType(address caller, uint256 identityType, uint64 requiredRole);
51
+
52
+ /// @notice Reverts when the caller holds the type role but with a non-zero AM
53
+ /// execution delay. The factory has no scheduling flow, so instead of
54
+ /// silently ignoring the delay the call is rejected — grant per-type
55
+ /// roles with a zero execution delay.
56
+ /// @param caller the address that attempted the deployment.
57
+ /// @param requiredRole the AM role id required for that type.
58
+ /// @param executionDelay the delay the caller's membership carries.
59
+ error DelayedRoleNotSupported(address caller, uint64 requiredRole, uint32 executionDelay);
60
+
61
+ /// @notice Reverts when a deploy is attempted for a type the admin has not registered.
62
+ /// Admin enables a type by calling `setIdentityTypePolicy`. Use the AM's
63
+ /// `PUBLIC_ROLE` for open types.
64
+ error UnknownIdentityType(uint256 identityType);
65
+
66
+ /// @notice Reverts when {createIdentity} is called for a type whose policy has
67
+ /// `selfDeployable = false`. Self-deploy is gated per type because some
68
+ /// types (e.g. ASSET, SMART_CONTRACT) represent contracts, not EOAs, so
69
+ /// the `msg.sender = first wallet` binding does not apply to them. Admin
70
+ /// opts a type in via {setIdentityTypePolicy}.
71
+ error IdentityTypeNotSelfDeployable(uint256 identityType);
72
+
73
+ /// @notice Reverts if no key with MANAGEMENT purpose is provided
74
+ error NoManagementKeyInKeys();
75
+
76
+ /// @notice Reverts when {createIdentityFor} deploys for a signing type but `_account`
77
+ /// is not the only wallet with MANAGEMENT on the new identity. The wallet the
78
+ /// identity was created for has to manage it alone, or the caller could keep a
79
+ /// key and strip that wallet later. The type's registered modules may hold
80
+ /// MANAGEMENT alongside it.
81
+ error AccountNotSoleManagementKey(address account);
82
+
83
+ /// @notice Reverts when {createIdentityFor} deploys for a signing type and the caller
84
+ /// supplies a key that is not `_account`'s own key hash. The caller may only
85
+ /// grant purposes to the account the identity is created for; the account adds
86
+ /// any other keys itself once it is in control. `keyHash` is the hash derived
87
+ /// from the key's `signerData`, which is the value the registry stores under.
88
+ error KeyNotForAccount(bytes32 keyHash);
89
+
90
+ /// @notice Reverts when a deploy caller supplies a key typed MODULE. That type is
91
+ /// reserved for keys the module install registers: MODULE keys stay out of the
92
+ /// MANAGEMENT index, so a wallet key wearing it would escape the management
93
+ /// counts while keeping key authority.
94
+ error CallerKeyCannotBeModule(bytes32 keyHash);
95
+
96
+ /// @notice Reverts when {setIdentityTypePolicy} would open a single-binding type to the
97
+ /// AM's PUBLIC_ROLE. Single binding types skip the sole management check, so
98
+ /// their role gate must stay restricted.
99
+ error SingleBindingTypeCannotBePublic(uint256 identityType);
100
+
101
+ /// @notice Reverts when an identity is initialized with no validator and no executor
102
+ /// module. Without either, the account cannot verify signatures or dispatch
103
+ /// outbound calls.
104
+ error IdentityNoValidatorOrExecutor();
105
+
106
+ /// @notice Reverts when a wallet is already linked to a different identity than the one
107
+ /// currently trying to claim it. Sticky binding: a wallet can be re-linked only to
108
+ /// its original identity, never to another.
109
+ error WalletBoundToAnotherIdentity(bytes wallet, address boundIdentity);
110
+
111
+ /// @notice Reverts when a wallet that was previously revoked is presented to {linkAccount}.
112
+ /// Revocation is terminal. A wallet cannot be re-linked after being revoked.
113
+ error WalletAlreadyRevoked(bytes wallet);
114
+
115
+ /// @notice Reverts when an operation requires the wallet to be in the `Active` lifecycle
116
+ /// state (e.g. {revokeAccount}) but it is not.
117
+ error WalletNotActive(bytes wallet);
118
+
119
+ /// @notice Reverts when {linkAccount} is called by a contract that was not deployed by
120
+ /// this factory. Only factory-deployed identities can pull wallets in.
121
+ error NotFactoryIdentity(address caller);
122
+
123
+ /// @notice Reverts when an EIP-712 link signature is presented after its `expiry`, or
124
+ /// when `expiry == 0` (callers must set freshness explicitly).
125
+ error ExpiredSignature(uint256 expiry);
126
+
127
+ /// @notice Reverts when {linkAccount} is called on an asset identity. An asset
128
+ /// identity represents one specific token contract. Adding more wallets to
129
+ /// it would break the 1:1 token↔identity mapping.
130
+ error CannotLinkToAssetIdentity(address identity);
131
+
132
+ /// @notice Reverts when {revokeAccount} is called on a non-signing-entity identity
133
+ /// (ASSET or SMART_CONTRACT). The bound contract cannot sign a fresh
134
+ /// {linkAccount} digest, so revoking would orphan the factory's discovery
135
+ /// entry permanently with no recovery path.
136
+ error CannotRevokeFromNonSigningIdentity(address identity);
137
+
138
+ /// @notice Reverts when a wallet is already actively linked to the calling identity.
139
+ error WalletAlreadyLinkedToIdentity(bytes wallet);
140
+
141
+ /// @notice Reverts when an operation references a wallet that has never been linked, or
142
+ /// is not currently part of the calling identity's active set.
143
+ error WalletNotLinkedToIdentity(bytes wallet);
144
+
145
+ /// @notice Reverts when the caller of {settlePendingCrossChainLink} does not match the
146
+ /// identity recorded in the pending proposal. `recorded` is `address(0)`
147
+ /// if no proposal exists for the wallet.
148
+ error PendingCrossChainLinkIdentityMismatch(bytes wallet, address caller, address recorded);
149
+
150
+ /// @notice Reverts when an inbound cross-chain proposal targets a wallet that
151
+ /// already has a registry entry (active or revoked). Sticky binding
152
+ /// applies to the cross-chain path the same way it does to the EVM path.
153
+ error WalletAlreadyHasEntry(bytes wallet);
154
+
155
+ /// @notice Reverts when the ERC-7786 source-chain sender does not match the
156
+ /// wallet envelope carried in the payload. The wallet must originate
157
+ /// the bridge call itself, so `sender` and `wallet` must be the same
158
+ /// interoperable address.
159
+ error CrossChainSenderWalletMismatch(bytes sender, bytes wallet);
160
+
161
+ /// @notice Reverts when a cross-chain link proposal is delivered or confirmed
162
+ /// past its `expiry`.
163
+ error PendingCrossChainLinkExpired(uint256 expiry);
164
+
165
+ /// @notice Reverts when a cross-chain proposal names a wallet on this chain.
166
+ /// Local wallets link through {linkAccount} with a signature.
167
+ error CrossChainLinkForLocalWallet(bytes wallet);
168
+
169
+ /// @notice Reverts when {linkAccount} gets an envelope whose chain type is not
170
+ /// eip-155. The signature path can only verify EVM signers; foreign
171
+ /// wallets go through the ERC-7786 cross-chain path.
172
+ error NonEvmAccount(bytes account);
173
+
174
+ /// @notice Reverts when {linkAccount} gets an eip-155 envelope whose chain
175
+ /// reference is not this chain's id in minimal big-endian form. The
176
+ /// signature path can only prove control on the local chain; wallets on
177
+ /// other EVM chains go through the ERC-7786 cross-chain path.
178
+ error AccountNotOnLocalChain(bytes account);
179
+
180
+ /// @notice Reverts when an ERC-7913 signer names a verifier that admin has not
181
+ /// approved via {setTrustedVerifier}. Without the list, a caller could
182
+ /// ship a verifier that accepts anything and self-certify the link.
183
+ error UntrustedVerifier(address verifier);
184
+
185
+ /// @notice Reverts when a wallet envelope encodes its eip-155 chain reference
186
+ /// with leading zero padding. The same chainid has one minimal
187
+ /// encoding and the registry only accepts that one.
188
+ error NonCanonicalAccount(bytes account);
189
+
190
+ /* ----- Verifier ----- */
191
+
192
+ /// @notice The claim topic already exists.
193
+ error ClaimTopicAlreadyExists(uint256 claimTopic);
194
+
195
+ /// @notice The maximum number of claim topics is exceeded.
196
+ error MaxClaimTopicsExceeded();
197
+
198
+ /// @notice The maximum number of trusted issuers is exceeded.
199
+ error MaxTrustedIssuersExceeded();
200
+
201
+ /// @notice The trusted issuer already exists.
202
+ error TrustedIssuerAlreadyExists(address trustedIssuer);
203
+
204
+ /// @notice The trusted claim topics cannot be empty.
205
+ error TrustedClaimTopicsCannotBeEmpty();
206
+
207
+ /// @notice The trusted issuer does not exist.
208
+ error NotATrustedIssuer(address trustedIssuer);
209
+
210
+ /* ----- ClaimIssuer ----- */
211
+
212
+ /// @notice The claim already exists.
213
+ error ClaimAlreadyRevoked();
214
+
215
+ /* ----- ERC734Validator trusted-issuer path ----- */
216
+
217
+ /// @notice Reverts when {ERC734Validator.addClaimByTrustedIssuer} is called by a wallet
218
+ /// that the factory does not resolve to any identity. The trusted-issuer path
219
+ /// requires the caller wallet to be a linked account on a factory-deployed
220
+ /// identity.
221
+ error CallerNotLinkedToFactoryIdentity(address caller);
222
+
223
+ /// @notice Reverts when the claim's declared `issuer` field does not match the
224
+ /// identity the caller wallet resolves to. A trusted issuer cannot ship a
225
+ /// claim attributed to a different issuer.
226
+ error DeclaredIssuerMismatch(address declaredIssuer, address resolvedIdentity);
227
+
228
+ /// @notice Reverts when the resolved issuer identity is not of type
229
+ /// {IdentityTypes.CLAIM_ISSUER}. The trusted-issuer path is reserved for
230
+ /// identities deployed under the role-gated CLAIM_ISSUER type so a high
231
+ /// reputation score on another type cannot grant claim-write capability.
232
+ error IdentityNotClaimIssuerType(address identity);
233
+
234
+ /// @notice Reverts when the resolved CLAIM_ISSUER identity's reputation score is
235
+ /// below the consumer's claim-add threshold.
236
+ error ReputationBelowClaimAddThreshold(address identity, uint256 score, uint256 threshold);
237
+
238
+ /* ----- ERC734Validator field caps (see {Structs}) ----- */
239
+
240
+ /// @notice Reverts when a key's clientData exceeds {Structs.MAX_CLIENT_DATA_LENGTH}.
241
+ error ClientDataTooLong();
242
+
243
+ /// @notice Reverts when a claim's signature exceeds {Structs.MAX_CLAIM_SIGNATURE_LENGTH}.
244
+ error ClaimSignatureTooLong();
245
+
246
+ /// @notice Reverts when a claim's payload exceeds {Structs.MAX_CLAIM_PAYLOAD_LENGTH}.
247
+ error ClaimPayloadTooLong();
248
+
249
+ /// @notice Reverts when a claim's uri exceeds {Structs.MAX_CLAIM_URI_LENGTH}.
250
+ error ClaimUriTooLong();
251
+
252
+ /* ----- Identity ----- */
253
+
254
+ /// @notice {IdentityFactory.initializeBeacon} was called but the beacon is already deployed.
255
+ error BeaconAlreadyInitialized();
256
+
257
+ /// @notice Identity deployment was attempted before {IdentityFactory.initializeBeacon}
258
+ /// deployed the beacon at its predetermined slot.
259
+ error BeaconNotInitialized();
260
+
261
+ /// @notice CREATE3 deployed the beacon somewhere other than the predetermined address the
262
+ /// factory committed to at construction. Only possible on chains whose CREATE2
263
+ /// derivation deviates from the canonical EVM formula (e.g. zkSync Era).
264
+ error BeaconAddressMismatch(address expected, address actual);
265
+
266
+ /// @notice The candidate beacon implementation has no code.
267
+ error ImplementationNotAContract(address implementation);
268
+
269
+ /// @notice The candidate beacon implementation does not name this factory as its
270
+ /// enshrined {IdentityFactory}.
271
+ error ImplementationFactoryMismatch(address implementation);
272
+
273
+ /// @notice The candidate beacon implementation still has its initializers open, so it
274
+ /// could be initialized directly instead of only behind a proxy.
275
+ error ImplementationInitializersNotDisabled(address implementation);
276
+
277
+ /// @notice The candidate beacon implementation names a different registry module than
278
+ /// the one every deployed identity already holds its keys in.
279
+ error ImplementationRegistryMismatch(address expected, address actual);
280
+
281
+ /// @notice The candidate beacon implementation reports a different version than the one
282
+ /// the upgrader committed to in {IdentityFactory.upgradeBeacon}.
283
+ error ImplementationVersionMismatch(string expected, string actual);
284
+
285
+ /// @notice The sender does not have the management key.
286
+ error SenderDoesNotHaveManagementKey();
287
+
288
+ /// @notice The sender does not have the claim signer key.
289
+ error SenderDoesNotHaveClaimSignerKey();
290
+
291
+ /// @notice The sender does not have the action key.
292
+ error SenderDoesNotHaveActionKey();
293
+
294
+ /// @notice The caller holds no key on the target identity that authorizes proposing an
295
+ /// execution. PROPOSER, ACTION, CLAIM_SIGNER, CLAIM_ADDER, or MANAGEMENT works.
296
+ error SenderCannotPropose(address sender);
297
+
298
+ /// @notice The key is not registered.
299
+ error KeyNotRegistered(bytes32 key);
300
+
301
+ /// @notice The key already has the purpose.
302
+ error KeyAlreadyHasPurpose(bytes32 key, uint256 purpose);
303
+
304
+ /// @notice The key does not have the purpose.
305
+ error KeyDoesNotHavePurpose(bytes32 key, uint256 purpose);
306
+
307
+ /// @notice The claim is not registered.
308
+ error ClaimNotRegistered(bytes32 claimId);
309
+
310
+ /// @notice The request is not valid.
311
+ error InvalidRequestId();
312
+
313
+ /// @notice The request is already executed.
314
+ error RequestAlreadyExecuted();
315
+
316
+ /// @notice The key that queued the request no longer authorizes proposing on the identity.
317
+ error ProposerNoLongerAuthorized(address proposer);
318
+
319
+ /// @notice The request was queued before the module was last uninstalled and is void.
320
+ error RequestInvalidated();
321
+
322
+ /// @notice The claim is invalid.
323
+ error InvalidClaim();
324
+
325
+ /// @notice Topic 0 is the "no claim" sentinel and cannot be used for a stored claim.
326
+ error InvalidClaimTopic();
327
+
328
+ /// @notice The submitted scheme and uri do not match the metadataHash signed in the claim data.
329
+ error ClaimMetadataMismatch(uint256 scheme, string uri);
330
+
331
+ /* ----- SmartAccount ----- */
332
+
333
+ /// @notice The signature is invalid.
334
+ error InvalidSignature();
335
+
336
+ /// @notice The signer data is invalid or too short.
337
+ error InvalidSignerData();
338
+
339
+ /// @notice The last MANAGEMENT key cannot be removed (would render the identity unrecoverable).
340
+ error CannotRemoveLastManagementKey();
341
+
342
+ /// @notice Reverts when a ClaimIssuer attempts to revoke a claim that was not issued by itself.
343
+ error NotOwnIssuance();
344
+
345
+ /// @notice The validator module specified in a UserOp/signature is not installed.
346
+ error ValidatorModuleNotInstalled(address module);
347
+
348
+ /// @notice The signer key does not have the required purpose for the requested execution.
349
+ error PurposeNotAuthorizedForCall(bytes32 keyHash, address target);
350
+
351
+ /// @notice The execution mode requested is not supported by the account's purpose check.
352
+ error UnsupportedExecutionMode(bytes32 mode);
353
+
354
+ /// @notice A dispatched call targeted one of the account's own modules (an installed executor,
355
+ /// or the fallback handler for the call's selector). Module functions are reached via
356
+ /// the account's fallback dispatch, never via `execute(module, ...)`. The only caller
357
+ /// allowed to do this is the account itself.
358
+ error OwnModuleTargetBlocked(address target);
359
+
360
+ /// @notice An installed executor or fallback handler tried to dispatch a call whose target
361
+ /// is not authorized by the purpose registered for that module at install time.
362
+ /// Also raised at install time if the module's initData does not begin with a
363
+ /// non-zero `uint256 purpose`.
364
+ error ExecutorPurposeNotAuthorized();
365
+
366
+ /// @notice ETH push from `KeyApprovalModule` back to the identity failed.
367
+ error ReturnToAccountFailed();
368
+
369
+ /// @notice `addKey` `_type` doesn't match the existing key's stored type.
370
+ error KeyTypeMismatch(bytes32 key, uint256 storedType, uint256 providedType);
371
+
372
+ /* ----- IdentityUtilities ----- */
373
+
374
+ /// @notice 0 is not a valid topic.
375
+ error EmptyTopic();
376
+
377
+ /// @notice 0 is not a valid Format.
378
+ error EmptyFormat();
379
+
380
+ /// @notice Name cannot be left empty.
381
+ error EmptyName();
382
+
383
+ /// @notice Use update function for existing topics.
384
+ error TopicAlreadyExists(uint256 topic);
385
+
386
+ /// @notice Topic is not registered yet.
387
+ error TopicNotFound(uint256 topic);
388
+
389
+ /* ----- ClaimIssuerFactory ----- */
390
+
391
+ /// @notice The claim issuer already exists.
392
+ error ClaimIssuerAlreadyDeployed(address managementKey);
393
+
394
+ /// @notice The address is blacklisted.
395
+ error Blacklisted(address addr);
396
+
397
+ /// @notice The call failed.
398
+ error CallFailed();
399
+
400
+ /* ----- EASClaimIssuer ----- */
401
+
402
+ /// @notice Reverts when a caller invokes an `IClaimIssuer` or `IIdentity` method that has
403
+ /// no meaning on a stateless adapter (key management, claim storage, execution).
404
+ /// The adapter is a live view over EAS and holds no keys or claims.
405
+ error EASNotSupported();
406
+
407
+ }
@@ -0,0 +1,74 @@
1
+ // SPDX-License-Identifier: GPL-3.0
2
+ //
3
+ // ONCHAINID Smart Contracts
4
+ // Digital identities for the T-REX ecosystem.
5
+ //
6
+ // Copyright (C) 2026 Digital Asset Operational Services ISAC Ltd. ("T-REX Network")
7
+ //
8
+ // This file is part of the ONCHAINID smart contract suite.
9
+ //
10
+ // This program is free software: you can redistribute it and/or modify
11
+ // it under the terms of the GNU General Public License as published by
12
+ // the Free Software Foundation, either version 3 of the License, or
13
+ // (at your option) any later version.
14
+ //
15
+ // This program is distributed in the hope that it will be useful,
16
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
+ // GNU General Public License for more details.
19
+ //
20
+ // You should have received a copy of the GNU General Public License
21
+ // along with this program. If not, see <https://www.gnu.org/licenses/>.
22
+
23
+ pragma solidity ^0.8.27;
24
+
25
+ library FormatResolver {
26
+
27
+ /// @notice The formats we currently support
28
+ enum FormatType {
29
+ Unknown, // 0
30
+ StringType, // 1
31
+ TripleUint, // 2 => struct {uint256;uint256;uint256}
32
+ Uint16Type, // 3
33
+ StringArray, // 4
34
+ AddressType // 5
35
+ }
36
+
37
+ /// @notice Turn format integer into a `FormatType`
38
+ function resolve(uint256 formatId) internal pure returns (FormatType) {
39
+ if (formatId == 1) return FormatType.StringType;
40
+ if (formatId == 2) return FormatType.TripleUint;
41
+ if (formatId == 3) return FormatType.Uint16Type;
42
+ if (formatId == 4) return FormatType.StringArray;
43
+ if (formatId == 5) return FormatType.AddressType;
44
+ return FormatType.Unknown;
45
+ }
46
+
47
+ /// @notice Decode a `string` from raw bytes
48
+ function decodeString(bytes memory data) internal pure returns (string memory) {
49
+ return abi.decode(data, (string));
50
+ }
51
+
52
+ /// @notice Decode `{uint256;uint256;uint256}` struct from raw bytes
53
+ function decodeTripleUint(bytes memory data) internal pure returns (uint256 a, uint256 b, uint256 c) {
54
+ return abi.decode(data, (uint256, uint256, uint256));
55
+ }
56
+
57
+ /// @notice Decode a `uint16` (packed as uint256 in ABI) from raw bytes
58
+ function decodeUint16(bytes memory data) internal pure returns (uint16) {
59
+ uint256 raw = abi.decode(data, (uint256));
60
+ require(raw <= type(uint16).max, "FormatResolver: overflow");
61
+ return uint16(raw);
62
+ }
63
+
64
+ /// @notice Decode a `string[]` from raw bytes
65
+ function decodeStringArray(bytes memory data) internal pure returns (string[] memory) {
66
+ return abi.decode(data, (string[]));
67
+ }
68
+
69
+ /// @notice Decode an `address` from raw bytes
70
+ function decodeAddress(bytes memory data) internal pure returns (address) {
71
+ return abi.decode(data, (address));
72
+ }
73
+
74
+ }
@@ -0,0 +1,35 @@
1
+ // SPDX-License-Identifier: GPL-3.0
2
+ //
3
+ // ONCHAINID Smart Contracts
4
+ // Digital identities for the T-REX ecosystem.
5
+ //
6
+ // Copyright (C) 2026 Digital Asset Operational Services ISAC Ltd. ("T-REX Network")
7
+ //
8
+ // This file is part of the ONCHAINID smart contract suite.
9
+ //
10
+ // This program is free software: you can redistribute it and/or modify
11
+ // it under the terms of the GNU General Public License as published by
12
+ // the Free Software Foundation, either version 3 of the License, or
13
+ // (at your option) any later version.
14
+ //
15
+ // This program is distributed in the hope that it will be useful,
16
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
+ // GNU General Public License for more details.
19
+ //
20
+ // You should have received a copy of the GNU General Public License
21
+ // along with this program. If not, see <https://www.gnu.org/licenses/>.
22
+
23
+ pragma solidity ^0.8.27;
24
+
25
+ /// @notice Hash a 20-byte address the same way `keccak256(abi.encodePacked(addr))` does,
26
+ /// without going through the ABI encoder. Cheaper bytecode at every call site.
27
+ /// @dev `mstore` writes the address into the lower 20 bytes of slot 0 (with 12 leading
28
+ /// zero bytes of padding). We then hash only the address bytes by reading 20 bytes
29
+ /// starting at offset 12, which matches `abi.encodePacked(addr)` exactly.
30
+ function hashAddress(address input) pure returns (bytes32 hash) {
31
+ assembly ("memory-safe") {
32
+ mstore(0, input)
33
+ hash := keccak256(12, 20)
34
+ }
35
+ }
@@ -0,0 +1,53 @@
1
+ // SPDX-License-Identifier: GPL-3.0
2
+ //
3
+ // ONCHAINID Smart Contracts
4
+ // Digital identities for the T-REX ecosystem.
5
+ //
6
+ // Copyright (C) 2026 Digital Asset Operational Services ISAC Ltd. ("T-REX Network")
7
+ //
8
+ // This file is part of the ONCHAINID smart contract suite.
9
+ //
10
+ // This program is free software: you can redistribute it and/or modify
11
+ // it under the terms of the GNU General Public License as published by
12
+ // the Free Software Foundation, either version 3 of the License, or
13
+ // (at your option) any later version.
14
+ //
15
+ // This program is distributed in the hope that it will be useful,
16
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
+ // GNU General Public License for more details.
19
+ //
20
+ // You should have received a copy of the GNU General Public License
21
+ // along with this program. If not, see <https://www.gnu.org/licenses/>.
22
+
23
+ pragma solidity ^0.8.27;
24
+
25
+ /// @title IdentityTypes
26
+ /// @notice Constants for Identity Types
27
+ library IdentityTypes {
28
+
29
+ /// @dev 1: ASSET identity, used for token identities
30
+ uint256 internal constant ASSET = 1;
31
+
32
+ /// @dev 2: INDIVIDUAL identity
33
+ uint256 internal constant INDIVIDUAL = 2;
34
+
35
+ /// @dev 3: CORPORATE identity
36
+ uint256 internal constant CORPORATE = 3;
37
+
38
+ /// @dev 4: IOT identity
39
+ uint256 internal constant IOT = 4;
40
+
41
+ /// @dev 5: CLAIM_ISSUER identity
42
+ uint256 internal constant CLAIM_ISSUER = 5;
43
+
44
+ /// @dev 6: SMART_CONTRACT identity (DeFi protocols, vaults, bridges, escrows, etc.)
45
+ uint256 internal constant SMART_CONTRACT = 6;
46
+
47
+ /// @dev 7: PUBLIC_AUTHORITY identity (regulators, courts, government issuers, etc.)
48
+ uint256 internal constant PUBLIC_AUTHORITY = 7;
49
+
50
+ /// @dev 8: AI_AGENT identity
51
+ uint256 internal constant AI_AGENT = 8;
52
+
53
+ }
@@ -0,0 +1,49 @@
1
+ // SPDX-License-Identifier: GPL-3.0
2
+ //
3
+ // ONCHAINID Smart Contracts
4
+ // Digital identities for the T-REX ecosystem.
5
+ //
6
+ // Copyright (C) 2026 Digital Asset Operational Services ISAC Ltd. ("T-REX Network")
7
+ //
8
+ // This file is part of the ONCHAINID smart contract suite.
9
+ //
10
+ // This program is free software: you can redistribute it and/or modify
11
+ // it under the terms of the GNU General Public License as published by
12
+ // the Free Software Foundation, either version 3 of the License, or
13
+ // (at your option) any later version.
14
+ //
15
+ // This program is distributed in the hope that it will be useful,
16
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
+ // GNU General Public License for more details.
19
+ //
20
+ // You should have received a copy of the GNU General Public License
21
+ // along with this program. If not, see <https://www.gnu.org/licenses/>.
22
+
23
+ pragma solidity ^0.8.27;
24
+
25
+ /// @title KeyPurposes
26
+ /// @notice Constants for Key Purposes
27
+ library KeyPurposes {
28
+
29
+ /// @dev 1: MANAGEMENT keys, which can manage the identity
30
+ uint256 internal constant MANAGEMENT = 1;
31
+
32
+ /// @dev 2: ACTION keys, which perform actions in this identities name (signing, logins, transactions, etc.)
33
+ uint256 internal constant ACTION = 2;
34
+
35
+ /// @dev 3: CLAIM signer keys, used to sign claims on other identities which need to be revokable.
36
+ uint256 internal constant CLAIM_SIGNER = 3;
37
+
38
+ /// @dev 4: ENCRYPTION keys, used to encrypt data e.g. hold in claims.
39
+ uint256 internal constant ENCRYPTION = 4;
40
+
41
+ /// @dev 5: CLAIM_ADDER key, can add claims but cannot remove them.
42
+ uint256 internal constant CLAIM_ADDER = 5;
43
+
44
+ /// @dev 6: PROPOSER keys can queue executions on the identity but cannot auto-run
45
+ /// or self-approve them. Used to raise the floor on who can push entries onto
46
+ /// the execution queue without expanding any auto-approval rule.
47
+ uint256 internal constant PROPOSER = 6;
48
+
49
+ }
@@ -0,0 +1,46 @@
1
+ // SPDX-License-Identifier: GPL-3.0
2
+ //
3
+ // ONCHAINID Smart Contracts
4
+ // Digital identities for the T-REX ecosystem.
5
+ //
6
+ // Copyright (C) 2026 Digital Asset Operational Services ISAC Ltd. ("T-REX Network")
7
+ //
8
+ // This file is part of the ONCHAINID smart contract suite.
9
+ //
10
+ // This program is free software: you can redistribute it and/or modify
11
+ // it under the terms of the GNU General Public License as published by
12
+ // the Free Software Foundation, either version 3 of the License, or
13
+ // (at your option) any later version.
14
+ //
15
+ // This program is distributed in the hope that it will be useful,
16
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
+ // GNU General Public License for more details.
19
+ //
20
+ // You should have received a copy of the GNU General Public License
21
+ // along with this program. If not, see <https://www.gnu.org/licenses/>.
22
+
23
+ pragma solidity ^0.8.27;
24
+
25
+ /// @title KeyTypes
26
+ /// @notice Constants for Key Types
27
+ library KeyTypes {
28
+
29
+ /// @dev 1: ECDSA
30
+ uint256 internal constant ECDSA = 1;
31
+
32
+ /// @dev 2: RSA
33
+ uint256 internal constant RSA = 2;
34
+
35
+ /// @dev 3: WEBAUTHN (P-256 / secp256r1 via WebAuthn ceremony, ERC-7913)
36
+ uint256 internal constant WEBAUTHN = 3;
37
+
38
+ /// @dev 4: MODULE. Used for executor modules only (gates `executeFromExecutor`).
39
+ /// Not used for validators. Validators address signers, not modules.
40
+ uint256 internal constant MODULE = 4;
41
+
42
+ /// @dev 5: ACCESS_MANAGER. Signer is an OpenZeppelin AccessManager. Used to govern
43
+ /// an identity through roles instead of a single key. Intended purpose: MANAGEMENT.
44
+ uint256 internal constant ACCESS_MANAGER = 5;
45
+
46
+ }