@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,88 @@
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.28;
24
+
25
+ import {
26
+ ERC7579SocialRecoveryExecutor
27
+ } from "@openzeppelin/accounts/modules/executors/ERC7579SocialRecoveryExecutor.sol";
28
+
29
+ /// @title RecoveryModule
30
+ /// @notice Social recovery for ONCHAINID identities. Wraps OZ's
31
+ /// {ERC7579SocialRecoveryExecutor} (vendored via soldeer from
32
+ /// OpenZeppelin/openzeppelin-accounts, commit e4c2a32a). All logic lives
33
+ /// upstream, we add nothing.
34
+ ///
35
+ /// @dev Why a wrapper file when there is no body.
36
+ /// The upstream contract is marked `abstract`, so we can't deploy it
37
+ /// directly. Inheriting it once gives us a concrete contract we can
38
+ /// instantiate with `new RecoveryModule()`, a stable name to reference
39
+ /// from scripts and tests, and a place to override later if we ever need
40
+ /// to (we don't today).
41
+ ///
42
+ /// @dev Why OZ instead of writing our own.
43
+ /// The recovery flow holds authority that can replace MANAGEMENT keys, so
44
+ /// writing our own means owning the audit. OZ already built the M-of-N +
45
+ /// delay + cancel design we want and pointed us at this file. We pin to
46
+ /// a commit so an upstream change can't surprise us. The upstream repo
47
+ /// is private and not audited yet; bump the pin once OZ tags an audited
48
+ /// release.
49
+ ///
50
+ /// @dev How an account uses it.
51
+ /// A MANAGEMENT key holder installs this as an ERC-7579 executor module
52
+ /// and registers the module address in {KeyManager} with the MANAGEMENT
53
+ /// purpose. That second step is the ONCHAINID-specific bit: without it,
54
+ /// {SmartAccount} would reject the self-targeted `addKey` call the
55
+ /// module dispatches at execution time. Same pattern KeyApprovalModule
56
+ /// uses.
57
+ ///
58
+ /// Install data is OZ's length-prefixed format documented on
59
+ /// `ERC7579SocialRecoveryExecutor.onInstall`:
60
+ /// [uint16(execLen), execArgs, uint16(msigLen), msigArgs]
61
+ /// where:
62
+ /// execArgs = abi.encodePacked(uint32 delay, uint32 expiration)
63
+ /// msigArgs = abi.encode(bytes[] guardians, uint64 threshold, uint64[] weights)
64
+ ///
65
+ /// @dev How the identity cancels and reconfigures.
66
+ /// The owner path of `cancelRecovery` and the setters for guardians,
67
+ /// threshold, weights, delay and expiration only accept the account
68
+ /// as caller. To reach them, the account calls `execute` on itself
69
+ /// with an inner `execute` that targets this module. The outer call
70
+ /// needs MANAGEMENT like any self-targeted execution, and the inner
71
+ /// call is allowed because {SmartAccount} lets the account call its
72
+ /// own modules. Guardians keep their own quorum-signed
73
+ /// `cancelRecovery` path.
74
+ ///
75
+ /// @dev What recovery actually does.
76
+ /// `executeRecovery` dispatches whatever ERC-7579 execution the guardians
77
+ /// signed. The canonical recovery payload is a self-targeted
78
+ /// `addKeyWithData(newKey, MANAGEMENT, ECDSA, ...)`, which installs a
79
+ /// fresh MANAGEMENT key on the identity. The integration tests in
80
+ /// test/modules/recovery/RecoveryModule.t.sol exercise that round-trip
81
+ /// and show the recovered key works the same as the original for every
82
+ /// MANAGEMENT-gated operation.
83
+ ///
84
+ /// @dev Why this works with our Identity.
85
+ /// OZ's module scopes signatures to the account's EIP-712 domain by
86
+ /// calling `IERC5267(account).eip712Domain()`. {Identity} inherits OZ's
87
+ /// {EIP712}, which exposes that interface. Nothing extra to wire.
88
+ contract RecoveryModule is ERC7579SocialRecoveryExecutor { }