Skip to content
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

Upgrade agent-js #2373

Merged
merged 3 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions demos/test-app/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -347,11 +347,13 @@ init();

whoamiBtn.addEventListener("click", async () => {
const canisterId = Principal.fromText(readCanisterId());
const agent = new HttpAgent({
host: hostUrlEl.value,
identity: delegationIdentity,
});
await agent.fetchRootKey();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fetching the root key is now necessary because the agent now verifies the replica signature on queries too.

const actor = Actor.createActor(idlFactory, {
agent: new HttpAgent({
host: hostUrlEl.value,
identity: delegationIdentity,
}),
agent,
canisterId,
});

Expand Down
92 changes: 54 additions & 38 deletions package-lock.json

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

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@
"webdriverio": "8.32.3"
},
"dependencies": {
"@dfinity/agent": "^0.19.2",
"@dfinity/auth-client": "^0.19.2",
"@dfinity/candid": "^0.19.2",
"@dfinity/identity": "^0.19.2",
"@dfinity/agent": "^1.1.1",
"@dfinity/auth-client": "^1.1.1",
"@dfinity/candid": "^1.1.1",
"@dfinity/identity": "^1.1.1",
"@dfinity/internet-identity-vc-api": "*",
"@dfinity/principal": "^0.19.2",
"@dfinity/utils": "^0.0.20",
"@dfinity/principal": "^1.1.1",
"@dfinity/utils": "^2.1.2",
"bip39": "^3.0.4",
"buffer": "^6.0.3",
"dompurify": "^3.0.6",
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/crypto/ed25519.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { fromHexString } from "@dfinity/candid";
import { Ed25519PublicKey } from "@dfinity/identity";
import { fromHexString } from "@dfinity/identity/lib/cjs/buffer";
import * as ed25519 from "./ed25519";

type TestVector = {
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/crypto/mnemonic.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { isUserNumber } from "$src/utils/userNumber";
import { toHexString } from "@dfinity/identity/lib/cjs/buffer";
import { toHexString } from "@dfinity/candid";
import { entropyToMnemonic, validateMnemonic, wordlists } from "bip39";

/**
Expand Down
3 changes: 1 addition & 2 deletions src/frontend/src/utils/iiConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ import {
} from "@dfinity/identity";
import { Principal } from "@dfinity/principal";
import { isNullish, nonNullish } from "@dfinity/utils";
import * as tweetnacl from "tweetnacl";
frederikrothenberger marked this conversation as resolved.
Show resolved Hide resolved
import { MultiWebAuthnIdentity } from "./multiWebAuthnIdentity";
import { RecoveryDevice, isRecoveryDevice } from "./recoveryDevice";
import { isWebAuthnCancel } from "./webAuthnErrorUtils";
Expand Down Expand Up @@ -719,7 +718,7 @@ export const creationOptions = (
name: "Internet Identity Service",
},
user: {
id: tweetnacl.randomBytes(16),
id: window.crypto.getRandomValues(new Uint8Array(16)),
peterpeterparker marked this conversation as resolved.
Show resolved Hide resolved
name: "Internet Identity",
displayName: "Internet Identity",
},
Expand Down
2 changes: 1 addition & 1 deletion src/vite-plugins/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"vite": "^4.5.2",
"undici": "*",
"vite-plugin-compression": "^0.5.1",
"@dfinity/utils": "^0.0.20",
"@dfinity/utils": "^2.1.2",
"@types/html-minifier-terser": "^7.0.0",
"html-minifier-terser": "^7.2.0"
}
Expand Down
Loading