-
Notifications
You must be signed in to change notification settings - Fork 15
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
feature: add API endpoint 'ecdsa_public_key' to ic-management #652
feature: add API endpoint 'ecdsa_public_key' to ic-management #652
Conversation
size-limit report 📦
|
packages/ic-management/README.md
Outdated
|
||
##### :gear: ecdsaPublicKey | ||
|
||
Calculate a SEC1 encoded ECDSA public key for the given canister using the given derivation path. If the `canister_id` is unspecified, it will default to the canister id of the caller. The `derivation_path` is a vector of variable length byte strings. Each byte string may be of arbitrary length, including empty. The total number of byte strings in the `derivation_path` must be at most 255. The `key_id` is a struct specifying both a `curve` and a `name`. The availability of a particular `key_id` depends on implementation. |
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 the
canister_id
is unspecified, it will default to the canister id of the caller.
Wait, are you sure this endpoint can be called from a frontend client?
Or is this description incorrect?
I don't see how the canister can be identified if the calls happen on the cllient side.
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.
Correct, it can be called without canister ID parameter and it will use the principal of the initialized service (the caller), that according to the code is defined during the creation of the service:
const { service } = createServices<IcManagementService>({
options: {
...options,
// Resolve to "aaaaa-aa" on mainnet
canisterId: Principal.fromHex(""),
callTransform: transform,
queryTransform: transform,
},
idlFactory,
certifiedIdlFactory,
});
If you prefer, we can make canisterId
non-optional for the ic-js
scope, but the original call to the API accepts this behavior, if you want to keep consistency (see function provisionalCreateCanisterWithCycles
in the same module).
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.
The documentation states the following:
If the canister_id is unspecified, it will default to the canister id of the caller.
So, assuming it's just misleading, I would review the documentation.
Then, regarding your answer.
Correct, it can be called without canister ID parameter and it will use the principal of the initialized service
Do you mean that it will use the principal of your snippet canisterId: Principal.fromHex("")
? If so, I doubt that's correct or, again it's a misunderstanding and the documentation should state that if no parameter canisterId is provided, the address will be deferred from the canisterId on which the service lies - i.e. the Bitcoin canisterId.
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.
Agree, it is misleading. Check the new description, let me know if it has improved.
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.
The PR should not be merged yet. We are currently reviewing the feature as it appears that the call can most likely only be performed by a canister and therefore cannot be used on the client side.
After discussing with the Execution Team, I found out that the endpoint |
Motivation
As first step, before including a function to generate a P2PKH address, we add the usage of IC method
ecdsa_public_key
.Changes
ecdsa_public_key
, adapted to the current package.ecdsaPublicKey
in ic-management module.ecdsaPublicKey
.Tests
Created a new test specific to the usage of
ecdsaPublicKey
.Todos