-
Notifications
You must be signed in to change notification settings - Fork 20
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
Direct invocation demo code #1676
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the examples, If that's all what it takes, it doesn't look complex 🙌
const keyring = new Keyring({ type: 'sr25519' }); | ||
|
||
const PARACHAIN_WS_ENDPINT = 'ws://localhost:9944'; | ||
const WORKER_TRUSTED_WS_ENDPOINT = 'wss://localhost:2000'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understood correctly from Nitesh some time ago, this endpoint is not publicly available for security reasons. Is it still the case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #1010
We don't see security issues - only server load (similar to any other rpc service provider)
...call.toU8a(), | ||
...nonce.toU8a(), | ||
...hexToU8a(mrenclave), | ||
...hexToU8a(mrenclave), // should be shard, but it's the same as MRENCLAVE in our case |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"in our case" here means our Parachain regardless of the network, right? How likely it is to change in the future?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it's network unrelated.
How likely it is to change in the future?
Highly improbable, even if it's going to change, that's not in near future
top: Uint8Array | ||
) => { | ||
let cyphertext = compactAddLength(bufferToU8a(encryptWithTeeShieldingKey(teeShieldingKey, top))); | ||
return parachain_api.createType('Request', { shard: hexToU8a(mrenclave), cyphertext }).toU8a(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Kailai-Wang, cyphertext
-> ciphertext
– Is it a typo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IDHub uses ciphertext
😭😭😭
This PR has addressed most of #1658
It shows how to construct a direct trusted call and send it, currently supported trusted call:
set_user_shielding_key_direct
create_identity_direct
It also demonstrates the public query to e.g. retrieve TEE's shielding key.
It includes a basic RPC response handling as well.
The subscription to parachain header and the subsequent handling are not written as we have the code already I believe.
Please bear with my crude ts code.
See
ts-tests/examples/direct-invocation/README.md
for more information.cc @jonalvarezz