From 5ddd91dc8282b90815483be7be10675893c6fc8f Mon Sep 17 00:00:00 2001 From: Jessie Mongeon Date: Fri, 27 Sep 2024 15:55:01 -0500 Subject: [PATCH 1/3] Add info about using keys with NodeJS --- .../off-chain/agents/javascript-agent.mdx | 2 +- .../developer-tools/off-chain/agents/nodejs.mdx | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/docs/developer-docs/developer-tools/off-chain/agents/javascript-agent.mdx b/docs/developer-docs/developer-tools/off-chain/agents/javascript-agent.mdx index 6283c99470..95f74be05e 100644 --- a/docs/developer-docs/developer-tools/off-chain/agents/javascript-agent.mdx +++ b/docs/developer-docs/developer-tools/off-chain/agents/javascript-agent.mdx @@ -20,7 +20,7 @@ Calls made through the agent are intended to be structured through an actor and To get started with `agent-js`, it is recommended that your development environment include: - [x] IC SDK for canister creation and management. -- [x] Node JS (12, 14, or 16). +- [x] Node.JS (12, 14, or 16). - [x] A canister you want to experiment with.   - Suggestions:     - `dfx new` default project. diff --git a/docs/developer-docs/developer-tools/off-chain/agents/nodejs.mdx b/docs/developer-docs/developer-tools/off-chain/agents/nodejs.mdx index a1d5b1745f..dea5c9ca28 100644 --- a/docs/developer-docs/developer-tools/off-chain/agents/nodejs.mdx +++ b/docs/developer-docs/developer-tools/off-chain/agents/nodejs.mdx @@ -16,7 +16,16 @@ import { MarkdownChipRow } from "/src/components/Chip/MarkdownChipRow"; ## Identity management -Before you set up an actor, you will need to have an identity. You can set up an identity that will resolve a seed phrase to a principal by using the following code: +Before you set up an actor, you will need to have an identity. + +### Using keys through `agent-js` + +You can configure an authentication identity for Node.JS through `agent-js`'s default ECDSA private key. [Learn more in the agent-js docs](https://internetcomputer.org/docs/current/developer-docs/developer-tools/off-chain/agents/javascript-agent). + + +### Seed phrase + +Alternatively, you can set up an identity that will resolve a seed phrase to a principal by using the following code: ```js // identity.js @@ -35,7 +44,6 @@ The seed phrase in this example is derived from the word `test` repeated 12 time Remember to store any seed phrase you use in production in a secure place. Use environment variables, and never commit a real seed phrase in plain text to your codebase. ::: - ## Asset uploading A community library, `@dfinity/assets`, is available to upload assets to your project's asset canister. You'll need to get the canister ID, pass your agent, and then upload your files. Below is an example code snippet showcasing this workflow: From a32c2e55cbae4d8b4b1f4ef299466a506a78d8cf Mon Sep 17 00:00:00 2001 From: Jessie Mongeon <133128541+jessiemongeon1@users.noreply.github.com> Date: Fri, 27 Sep 2024 15:58:01 -0500 Subject: [PATCH 2/3] Update javascript-agent.mdx --- .../developer-tools/off-chain/agents/javascript-agent.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/developer-docs/developer-tools/off-chain/agents/javascript-agent.mdx b/docs/developer-docs/developer-tools/off-chain/agents/javascript-agent.mdx index 95f74be05e..0a8adfa049 100644 --- a/docs/developer-docs/developer-tools/off-chain/agents/javascript-agent.mdx +++ b/docs/developer-docs/developer-tools/off-chain/agents/javascript-agent.mdx @@ -20,7 +20,7 @@ Calls made through the agent are intended to be structured through an actor and To get started with `agent-js`, it is recommended that your development environment include: - [x] IC SDK for canister creation and management. -- [x] Node.JS (12, 14, or 16). +- [x] Node JS (12, 14, or 16). - [x] A canister you want to experiment with.   - Suggestions:     - `dfx new` default project. @@ -462,4 +462,4 @@ export const backend_canister = createActor(canisterId); - [`agent-js` documentation](https://agent-js.icp.xyz/agent/modules.html). -- [`agent-js` npm package](https://www.npmjs.com/package/@dfinity/agent). \ No newline at end of file +- [`agent-js` npm package](https://www.npmjs.com/package/@dfinity/agent). From 4d2e01c99a0952506c2d92c99d8d1de583606ef4 Mon Sep 17 00:00:00 2001 From: Jessie Mongeon <133128541+jessiemongeon1@users.noreply.github.com> Date: Fri, 27 Sep 2024 15:59:24 -0500 Subject: [PATCH 3/3] Update nodejs.mdx --- .../developer-tools/off-chain/agents/nodejs.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/developer-docs/developer-tools/off-chain/agents/nodejs.mdx b/docs/developer-docs/developer-tools/off-chain/agents/nodejs.mdx index dea5c9ca28..7b870f893f 100644 --- a/docs/developer-docs/developer-tools/off-chain/agents/nodejs.mdx +++ b/docs/developer-docs/developer-tools/off-chain/agents/nodejs.mdx @@ -20,7 +20,7 @@ Before you set up an actor, you will need to have an identity. ### Using keys through `agent-js` -You can configure an authentication identity for Node.JS through `agent-js`'s default ECDSA private key. [Learn more in the agent-js docs](https://internetcomputer.org/docs/current/developer-docs/developer-tools/off-chain/agents/javascript-agent). +You can configure an authentication identity for Node.js through `agent-js`'s using the ECDSA or Ed25519 private keys. [Learn more in the agent-js docs](https://internetcomputer.org/docs/current/developer-docs/developer-tools/off-chain/agents/javascript-agent). ### Seed phrase @@ -367,4 +367,4 @@ main(); - [ic-websocket-js](https://www.npmjs.com/package/ic-websocket-js) -- [End to end testing](https://internetcomputer.org/docs/current/tutorials/developer-journey/level-2/2.5-unit-testing#end2end-e2e-testing) \ No newline at end of file +- [End to end testing](https://internetcomputer.org/docs/current/tutorials/developer-journey/level-2/2.5-unit-testing#end2end-e2e-testing)