Skip to content

Commit

Permalink
chore: rebase and update submodule
Browse files Browse the repository at this point in the history
  • Loading branch information
TejasvOnly committed Sep 20, 2024
1 parent 70adca4 commit 9f46e05
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 71 deletions.
129 changes: 62 additions & 67 deletions apps/node/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import DeviceConnection, {
updateLogger as updateLoggerHid,
updateLogger as updateLoggerHid,
} from '@cypherock/sdk-hw-hid';
import DeviceConnectionSerialport from '@cypherock/sdk-hw-serialport';
import { ManagerApp, updateLogger } from '@cypherock/sdk-app-manager';
Expand All @@ -17,72 +17,67 @@ import { createServiceLogger } from './logger';
import { InheritanceApp } from '@cypherock/sdk-app-inheritance';

Check failure on line 17 in apps/node/src/index.ts

View workflow job for this annotation

GitHub Actions / test (18.x)

`@cypherock/sdk-app-inheritance` import should occur before import of `./logger`

const run = async () => {
updateLogger(createServiceLogger);
updateLoggerCore(createServiceLogger);
updateLoggerHid(createServiceLogger);

setBitcoinJSLib(bitcoinJsLib);
setEthersLib(ethers);
setNearApiJs(nearApiJs);
setSolanaWeb3(solanaWeb3);

let connection: IDeviceConnection;

try {
connection = await DeviceConnection.create();
} catch (error) {
connection = await DeviceConnectionSerialport.create();
}

console.log('started');

const managerApp = await ManagerApp.create(connection);

const { walletList } = await managerApp.getWallets();

const inheritanceApp = await InheritanceApp.create(connection);

setTimeout(async () => {
//console.log('aborting');
//await inheritanceApp.abort();
//console.log('aborted');
}, 3000);

//console.log(walletList[1].id.join(','));
const walletId = walletList[1].id;

//await inheritanceApp.authWallet({
// challenge: walletId,
// walletId: walletId,
// withPublicKey: true,
// type: 'wallet-based',
//});

await inheritanceApp.testSessionStart();

const thing = await inheritanceApp.encryptMessagesWithPin({
walletId: walletId,
messages: [
{
value: 'test message',
verifyOnDevice: false,
},
{
value:
'Lorem ipsum dolor sit amet, -=test "device" consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
verifyOnDevice: true,
},
],
});

const output = await inheritanceApp.decryptMessagesWithPin({
walletId: walletId,
encryptedData: thing.encryptedPacket,
});

await inheritanceApp.testSessionStop();

console.log(JSON.stringify(output));
updateLogger(createServiceLogger);
updateLoggerCore(createServiceLogger);
updateLoggerHid(createServiceLogger);

setBitcoinJSLib(bitcoinJsLib);
setEthersLib(ethers);
setNearApiJs(nearApiJs);
setSolanaWeb3(solanaWeb3);

let connection: IDeviceConnection;

try {
connection = await DeviceConnection.create();
} catch (error) {
connection = await DeviceConnectionSerialport.create();
}

console.log('started');

const managerApp = await ManagerApp.create(connection);

const { walletList } = await managerApp.getWallets();

const inheritanceApp = await InheritanceApp.create(connection);

setTimeout(async () => {
//console.log('aborting');

Check failure on line 46 in apps/node/src/index.ts

View workflow job for this annotation

GitHub Actions / test (18.x)

Expected exception block, space or tab after '//' in comment
//await inheritanceApp.abort();

Check failure on line 47 in apps/node/src/index.ts

View workflow job for this annotation

GitHub Actions / test (18.x)

Expected exception block, space or tab after '//' in comment
//console.log('aborted');

Check failure on line 48 in apps/node/src/index.ts

View workflow job for this annotation

GitHub Actions / test (18.x)

Expected exception block, space or tab after '//' in comment
}, 3000);

//console.log(walletList[1].id.join(','));

Check failure on line 51 in apps/node/src/index.ts

View workflow job for this annotation

GitHub Actions / test (18.x)

Expected exception block, space or tab after '//' in comment
const walletId = walletList[1].id;

//await inheritanceApp.authWallet({

Check failure on line 54 in apps/node/src/index.ts

View workflow job for this annotation

GitHub Actions / test (18.x)

Expected exception block, space or tab after '//' in comment
// challenge: walletId,
// walletId: walletId,
// withPublicKey: true,
// type: 'wallet-based',
//});

Check failure on line 59 in apps/node/src/index.ts

View workflow job for this annotation

GitHub Actions / test (18.x)

Expected exception block, space or tab after '//' in comment

await inheritanceApp.testSessionStart();

const thing = await inheritanceApp.encryptMessagesWithPin({
walletId: walletId,

Check failure on line 64 in apps/node/src/index.ts

View workflow job for this annotation

GitHub Actions / test (18.x)

Expected property shorthand
messages: {
2: {
value: 'test value',
verifyOnDevice: true,
},
},
});

const output = await inheritanceApp.decryptMessagesWithPin({
walletId: walletId,

Check failure on line 74 in apps/node/src/index.ts

View workflow job for this annotation

GitHub Actions / test (18.x)

Expected property shorthand
encryptedData: thing.encryptedPacket,
});

await inheritanceApp.testSessionStop();

console.log(JSON.stringify(output));
};

run();
41 changes: 38 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion submodules/common

0 comments on commit 9f46e05

Please sign in to comment.