Skip to content

Commit

Permalink
Processed review comments
Browse files Browse the repository at this point in the history
Signed-off-by: artem.ivanov <[email protected]>
  • Loading branch information
Artemkaaas committed Feb 28, 2024
1 parent 3cb70a9 commit 5963551
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion docs/design/legacy-identifiers-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ So that legacy DID can be associated with a new `did:ethr` and we can only use `
bytes32 sigS,
string calldata identifier,
bytes32 ed25519Key,
bytes calldata ed25518Signature
bytes calldata ed25519Signature
)
// check signatures
didMapping[identifier] = identity;
Expand Down
4 changes: 2 additions & 2 deletions docs/migration/migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@ Issuer need to run migration tool manually (on the machine containing Indy Walle
* `contracts` - specifications for contracts deployed on the network
* `signer` - transactions signer
2. DID ownership moving to Besu Ledger:
1. Issuer create Ed25518 key (with seed) in the Besu wallet
1. Issuer create Ed25519 key (with seed) in the Besu wallet
2. Issuer create a new Secp256k1 keypair in Besu wallet
3. Issuer publish Secp256k1 key to Indy ledger using ATTRIB transaction: `{ "besu": { "key": secp256k1_key } }`
* Now Besu Secp256k1 key is associated with the Issuer DID which is published on the Indy Ledger.
* ATTRIB transaction is signed with Ed25518 key. No signature request for `secp256k1_key`.
* ATTRIB transaction is signed with Ed25519 key. No signature request for `secp256k1_key`.
3. Issuer build DID Document which will include:
* DID - fully qualified form should be used: `did:besu:network:<did_value>` of DID which was published as NYM transaction to Indy Ledger
* Two Verification Methods must be included:
Expand Down
6 changes: 3 additions & 3 deletions network/config/besu/genesis.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions smart_contracts/contracts/migration/LegacyMappingRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ contract LegacyMappingRegistry is LegacyMappingRegistryInterface, ControlledUpgr
string calldata legacyIdentifier,
string calldata newDid,
bytes32 ed25519Key,
bytes calldata ed25518Signature
bytes calldata ed25519Signature
) public virtual {
bytes32 hash = keccak256(
abi.encodePacked(
Expand All @@ -90,7 +90,7 @@ contract LegacyMappingRegistry is LegacyMappingRegistryInterface, ControlledUpgr
legacyIdentifier,
newDid,
ed25519Key,
ed25518Signature
ed25519Signature
)
);
_createDidMapping(
Expand All @@ -99,7 +99,7 @@ contract LegacyMappingRegistry is LegacyMappingRegistryInterface, ControlledUpgr
legacyIdentifier,
newDid,
ed25519Key,
ed25518Signature
ed25519Signature
);
}

Expand Down Expand Up @@ -150,7 +150,7 @@ contract LegacyMappingRegistry is LegacyMappingRegistryInterface, ControlledUpgr
string calldata legacyIdentifier,
string calldata newDid,
bytes32 ed25519Key,
bytes calldata ed25518Signature
bytes calldata ed25519Signature
) internal _identityOwner(identity, actor) _senderIsTrusteeOrEndorserOrSteward {
// Checks the uniqueness of the DID mapping
if (!isEmpty(didMapping[legacyIdentifier].toSlice())) revert DidMappingAlreadyExist(legacyIdentifier);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe('LegacyMappingRegistry', function () {
).to.be.revertedWithCustomError(legacyMappingRegistry.baseInstance, MigrationErrors.DidMappingAlreadyExist)
})

it('Should fail if DID mapping is being created with not matching ed25518 key', async function () {
it('Should fail if DID mapping is being created with not matching ed25519 key', async function () {
const ed25519Key = Uint8Array.from([
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 25, 180, 23, 224, 175, 15, 188, 235, 170, 233, 240, 145, 111, 204, 153,
108, 117, 188, 145,
Expand Down
2 changes: 1 addition & 1 deletion vdr/src/contracts/migration/types/did.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl TryFrom<&LegacyDid> for ContractParam {
}
}

/// Wrapper structure for legacy ED25518 verification key
/// Wrapper structure for legacy ED25519 verification key
#[derive(Debug, Default, Clone, PartialEq, Deserialize, Serialize)]
pub struct LegacyVerkey(String);

Expand Down
2 changes: 1 addition & 1 deletion vdr/src/contracts/migration/types/ed25519_signature.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{types::ContractParam, VdrError};

/// Wrapper structure for ED25518 signature
/// Wrapper structure for ED25519 signature
#[derive(Debug, Default)]
pub struct Ed25519Signature(Vec<u8>);

Expand Down
2 changes: 1 addition & 1 deletion vdr/src/types/endorsing_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl TransactionEndorsingData {
})
}

/// Deserialize transaction endorsement data from JSOn string
/// Deserialize transaction endorsement data from JSON string
#[logfn(Trace)]
#[logfn_inputs(Trace)]
pub fn from_string(value: &str) -> VdrResult<Self> {
Expand Down
4 changes: 2 additions & 2 deletions vdr/src/types/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ impl Transaction {
})
}

/// Deserialize transaction from JSOn string
/// Deserialize transaction from JSON string
#[logfn(Trace)]
#[logfn_inputs(Trace)]
pub fn from_string(value: &str) -> VdrResult<Self> {
Expand Down Expand Up @@ -170,7 +170,7 @@ impl Transaction {
.clone();

let signature = EthTransactionSignature::new(
signature.v().0 + 35 + self.chain_id * 2,
signature.v().0 + 35 + self.chain_id * 2, // `v` is calculated according to EIP-155: https://eips.ethereum.org/EIPS/eip-155
H256::from_slice(&signature.r().0),
H256::from_slice(&signature.s().0),
)
Expand Down

0 comments on commit 5963551

Please sign in to comment.