Skip to content

Commit

Permalink
Upgrade agent-js (#2373)
Browse files Browse the repository at this point in the history
* Upgrade agent-js

This PR upgrades `agent-js` to the latest version to fix a bug
related to WebAuthn registrations.
Fixes #2235.

* Switch let to const

* Switch to/fromHex to to/fromHexString
  • Loading branch information
Frederik Rothenberger authored Mar 20, 2024
1 parent 90c8902 commit 21856f9
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 53 deletions.
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();
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";
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)),
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

0 comments on commit 21856f9

Please sign in to comment.