Skip to content

Commit

Permalink
uncomment
Browse files Browse the repository at this point in the history
  • Loading branch information
0xverin committed Jul 23, 2024
1 parent 090766a commit 034b4aa
Showing 1 changed file with 80 additions and 80 deletions.
160 changes: 80 additions & 80 deletions tee-worker/ts-tests/integration-tests/dr_vc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,86 +48,86 @@ describe('Test Vc (direct request)', function () {
aliceSubstrateIdentity = await context.web3Wallets.substrate.Alice.getIdentity(context);
});

// step('linking identities (alice)', async function () {
// let currentNonce = (await getSidechainNonce(context, aliceSubstrateIdentity)).toNumber();
// const getNextNonce = () => currentNonce++;

// const twitterNonce = getNextNonce();
// const twitterIdentity = await buildIdentityHelper('mock_user', 'Twitter', context);
// const twitterValidation = await buildWeb2Validation({
// identityType: 'Twitter',
// context,
// signerIdentitity: aliceSubstrateIdentity,
// linkIdentity: twitterIdentity,
// verificationType: 'PublicTweet',
// validationNonce: twitterNonce,
// });
// const twitterNetworks = context.api.createType('Vec<Web3Network>', []);
// linkIdentityRequestParams.push({
// nonce: twitterNonce,
// identity: twitterIdentity,
// validation: twitterValidation,
// networks: twitterNetworks,
// });

// const evmNonce = getNextNonce();

// const evmIdentity = await context.web3Wallets.evm.Alice.getIdentity(context);
// const evmValidation = await buildValidations(
// context,
// aliceSubstrateIdentity,
// evmIdentity,
// evmNonce,
// 'ethereum',
// context.web3Wallets.evm.Alice
// );
// const evmNetworks = context.api.createType('Vec<Web3Network>', ['Ethereum', 'Bsc']);
// linkIdentityRequestParams.push({
// nonce: evmNonce,
// identity: evmIdentity,
// validation: evmValidation,
// networks: evmNetworks,
// });

// const bitcoinNonce = getNextNonce();

// const bitcoinIdentity = await context.web3Wallets.bitcoin.Alice.getIdentity(context);
// console.log('bitcoin id: ', bitcoinIdentity.toHuman());
// const bitcoinValidation = await buildValidations(
// context,
// aliceSubstrateIdentity,
// bitcoinIdentity,
// bitcoinNonce,
// 'bitcoin',
// context.web3Wallets.bitcoin.Alice
// );
// const bitcoinNetworks = context.api.createType('Vec<Web3Network>', ['BitcoinP2tr']);
// linkIdentityRequestParams.push({
// nonce: bitcoinNonce,
// identity: bitcoinIdentity,
// validation: bitcoinValidation,
// networks: bitcoinNetworks,
// });

// for (const { nonce, identity, validation, networks } of linkIdentityRequestParams) {
// const requestIdentifier = `0x${randomBytes(32).toString('hex')}`;
// const linkIdentityCall = await createSignedTrustedCallLinkIdentity(
// context.api,
// context.mrEnclave,
// context.api.createType('Index', nonce),
// context.web3Wallets.substrate.Alice,
// aliceSubstrateIdentity,
// identity.toHex(),
// validation.toHex(),
// networks.toHex(),
// context.api.createType('Option<RequestAesKey>', aesKey).toHex(),
// requestIdentifier
// );

// const res = await sendRequestFromTrustedCall(context, teeShieldingKey, linkIdentityCall);
// await assertIsInSidechainBlock('linkIdentityCall', res);
// }
// });
step('linking identities (alice)', async function () {
let currentNonce = (await getSidechainNonce(context, aliceSubstrateIdentity)).toNumber();
const getNextNonce = () => currentNonce++;

const twitterNonce = getNextNonce();
const twitterIdentity = await buildIdentityHelper('mock_user', 'Twitter', context);
const twitterValidation = await buildWeb2Validation({
identityType: 'Twitter',
context,
signerIdentitity: aliceSubstrateIdentity,
linkIdentity: twitterIdentity,
verificationType: 'PublicTweet',
validationNonce: twitterNonce,
});
const twitterNetworks = context.api.createType('Vec<Web3Network>', []);
linkIdentityRequestParams.push({
nonce: twitterNonce,
identity: twitterIdentity,
validation: twitterValidation,
networks: twitterNetworks,
});

const evmNonce = getNextNonce();

const evmIdentity = await context.web3Wallets.evm.Alice.getIdentity(context);
const evmValidation = await buildValidations(
context,
aliceSubstrateIdentity,
evmIdentity,
evmNonce,
'ethereum',
context.web3Wallets.evm.Alice
);
const evmNetworks = context.api.createType('Vec<Web3Network>', ['Ethereum', 'Bsc']);
linkIdentityRequestParams.push({
nonce: evmNonce,
identity: evmIdentity,
validation: evmValidation,
networks: evmNetworks,
});

const bitcoinNonce = getNextNonce();

const bitcoinIdentity = await context.web3Wallets.bitcoin.Alice.getIdentity(context);
console.log('bitcoin id: ', bitcoinIdentity.toHuman());
const bitcoinValidation = await buildValidations(
context,
aliceSubstrateIdentity,
bitcoinIdentity,
bitcoinNonce,
'bitcoin',
context.web3Wallets.bitcoin.Alice
);
const bitcoinNetworks = context.api.createType('Vec<Web3Network>', ['BitcoinP2tr']);
linkIdentityRequestParams.push({
nonce: bitcoinNonce,
identity: bitcoinIdentity,
validation: bitcoinValidation,
networks: bitcoinNetworks,
});

for (const { nonce, identity, validation, networks } of linkIdentityRequestParams) {
const requestIdentifier = `0x${randomBytes(32).toString('hex')}`;
const linkIdentityCall = await createSignedTrustedCallLinkIdentity(
context.api,
context.mrEnclave,
context.api.createType('Index', nonce),
context.web3Wallets.substrate.Alice,
aliceSubstrateIdentity,
identity.toHex(),
validation.toHex(),
networks.toHex(),
context.api.createType('Option<RequestAesKey>', aesKey).toHex(),
requestIdentifier
);

const res = await sendRequestFromTrustedCall(context, teeShieldingKey, linkIdentityCall);
await assertIsInSidechainBlock('linkIdentityCall', res);
}
});

mockBatchAssertion.forEach(({ description, assertion }) => {
step(`request vc payload: ${JSON.stringify(assertion)} (alice)`, async function () {
Expand Down

0 comments on commit 034b4aa

Please sign in to comment.