Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added admin as issuer #125

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 22 additions & 13 deletions setAdminProxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,36 @@ const IdentityManager = artifacts.require("AlastriaIdentityManager");
const fs = require("fs");
const path = require("path");
const ethers = require("ethers");
//const adminPath = path.resolve('./dev-tools/createFakeIdentities/mocked-identity-keys/admin-6e3976aeaa3a59e4af51783cc46ee0ffabc5dc11');
const adminPath = path.resolve('./dev-tools/createFakeIdentities/mocked-identity-keys/issuer-806bc0d7a47b890383a831634bcb92dd4030b092');
//const imAddress = "0xE0Fdc04F5AFAe99Db4BBe1D4e9Ac8d2628CB2db0";
const imAddress = "0x16947aD7c14419269e957Be374E6E345AD4EDf97";
// Admin keystore
const adminPath = path.resolve('./dev-tools/createFakeIdentities/mocked-identity-keys/admin-6e3976aeaa3a59e4af51783cc46ee0ffabc5dc11');
// Identity Manager Address
const imAddress = "0xbd4a2c84edb97be5beff7cd341bd63567e73f8c9";

module.exports = async function () {
try {
// let provider = new ethers.providers.JsonRpcProvider("http://63.33.206.111/rpc")
let provider = new ethers.providers.JsonRpcProvider("http://localhost:8545");
let adminKeystore = fs.readFileSync(adminPath,'utf-8');
let adminAccount = await ethers.Wallet.fromEncryptedJson(adminKeystore,"Passw0rd",(progress)=>{
let provider = new ethers.providers.JsonRpcProvider("http://63.33.206.111/rpc")
let adminKeystore = fs.readFileSync(adminPath, 'utf-8');
let adminAccount = await ethers.Wallet.fromEncryptedJson(adminKeystore, "Passw0rd",(progress)=>{
//console.log(progress);
});
const wallet = adminAccount.connect(provider);
let imInstance = new ethers.Contract(imAddress,IdentityManager.abi,wallet);
let imInstance = new ethers.Contract(imAddress, IdentityManager.abi, wallet);
// prepareAlastriaID with EoA admin address
const tx1 = await imInstance.prepareAlastriaID(adminAccount.address);
console.log(tx1);
console.log("tx1", tx1);
// createAlastriaIdentity with the admin public key (ABI encoded)
const tx2 = await imInstance.createAlastriaIdentity("0x50382c1a0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008430783034306365356564633230346165393737643664363966636336623333396135376235343465663464303934393239663365623931386137376466626132363939386537376563356232396133373964643539626265393632653262323237343531343361613262353263346138373562373439326331333765656562663430353500000000000000000000000000000000000000000000000000000000");
console.log(tx2);

console.log("tx2", tx2);
// addIdentityIssuer with the admin proxy address and eidas level
const tx3 = await imInstance.addIdentityIssuer("0x7F4fbC3f46d6ece0eC8D05B41EaC195862c946d0", 3);
console.log("tx3", tx3);
//addIdentityServiceProvider with the admin proxy address
const tx4 = await imInstance.addIdentityServiceProvider("0x7F4fbC3f46d6ece0eC8D05B41EaC195862c946d0");
console.log("tx4", tx4);
//addEntity with proxy address
const tx5 = await imInstance.addEntity("0x7F4fbC3f46d6ece0eC8D05B41EaC195862c946d0", "Entidad1", "A-28964782", "www.entidad1.com/logo", "www.entidad1.com/AID", "www.entidad1.com/AOA", true);
console.log("tx5",tx5);
} catch (error) {
console.log(error);
}
}
}