Git Product home page Git Product logo

internet-identity's Introduction

Internet Identity

Canister Tests Rust Frontend checks and lints GitHub all releases

πŸ”— https://identity.ic0.app β€’ πŸ“œ Specification
―
πŸ“š Forum β€’ πŸš‘ Report an Issue β€’ πŸ“ž Discord


Internet Identity is an authentication service for the Internet Computer. It is the authentication system that allows hundreds of thousands of users to log in to Dapps like Distrikt, DSCVR and more.

Internet Identity is:

  • Simple: It uses some of the WebAuthn API to allow users to register and authenticate without passwords, using TouchID, FaceID, Windows Hello, and more.
  • Flexible: Integrating Internet Identity in a Dapp (or even Web 2 app) is as simple as opening the Internet Identity's HTTP interface, https://identity.ic0.app, in a new tab. No need to interact with the canister smart contract directly.
  • Secure: Different identities are issued for each app a user authenticates to and cannot be linked back to the user.

For more information, see What is Internet Identity? on internetcomputer.org.

Table of Contents

Getting Started

This section gives an overview of Internet Identity's architecture, instructions on how to build the Wasm module (canister), and finally pointers for integrating Internet Identity in your own applications.

Local Replica

Use the Internet Identity canister in your local dfx project by adding the following code snippet to your dfx.json file:

{
  "canisters": {
    "internet_identity": {
      "type": "custom",
      "candid": "https://github.com/dfinity/internet-identity/releases/download/release-2024-06-07/internet_identity.did",
      "wasm": "https://github.com/dfinity/internet-identity/releases/download/release-2024-06-07/internet_identity_dev.wasm.gz",
      "remote": {
        "id": {
          "ic": "rdmx6-jaaaa-aaaaa-aaadq-cai"
        }
      },
      "frontend": {}
    }
  }
}

To deploy, run dfx deploy.

To access Internet Identity or configure it for your dapp, use one of the following URLs:

  • Chrome, Firefox: http://<canister_id>.localhost:4943
  • Safari: http://localhost:4943?canisterId=<canister_id>

Architecture Overview

Internet Identity is an authentication service for the Internet Computer. All programs on the Internet Computer are Wasm modules, or canisters (canister smart contracts).

Architecture

Internet Identity runs as a single canister which both serves the frontend application code, and handles the requests sent by the frontend application code.

πŸ’‘ The canister (backend) interface is specified by the internet_identity.did candid interface. The (backend) canister code is located in src/internet_identity, and the frontend application code (served by the canister through the http_request method) is located in src/frontend.

The Internet Identity authentication service works indirectly by issuing "delegations" on the user's behalf; basically attestations signed with some private cryptographic material owned by the user. The private cryptographic material never leaves the user's device. The Internet Identity frontend application uses the WebAuthn API to first create the private cryptographic material, and then the WebAuthn API is used again to sign delegations.

For information on how Internet Identity works in more detail, please refer to the following:

Building with Docker

To get the canister (Wasm module) for Internet Identity, you can either download a release from the releases page, or build the code yourself. The simplest way to build the code yourself is to use Docker and the docker-build script:

$ ./scripts/docker-build

The Dockerfile specifies build instructions for Internet Identity. Building the Dockerfile will result in a scratch container that contains the Wasm module at /internet_identity.wasm.gz.

πŸ’‘ The build can be customized with build features.

We recommend using the docker-build script. It simplifies the usage of build features and extracts the Wasm module from the final scratch container.

πŸ’‘ You can find instructions for building the code without Docker in the HACKING document.

Integration with Internet Identity

The using-dev-build demo shows a documented example project that integrates Internet Identity. For more, please refer to the Client Authentication Protocol section of the Internet Identity Specification to integration Internet Identity in your app from scratch. For a just-add-water approach using the agent-js library (also used by using-dev-build), check out Kyle Peacock's blogpost.

If you're interested in the infrastructure of how to get the Internet Identity canister and how to test it within your app, check out using-dev-build, which uses the Internet Identity development canister.

Build Features and Flavors

The Internet Identity build can be customized to include features that are useful when developing and testing. We provide pre-built flavors of Internet Identity that include different sets of features.

Features

These options can be used both when building with docker and without docker. The features are enabled by setting the corresponding environment variable to 1. Any other string, as well as not setting the environment variable, will disable the feature.

For instance:

$ II_FETCH_ROOT_KEY=1 dfx build
$ II_DUMMY_CAPTCHA=1 II_DUMMY_AUTH=1 ./scripts/docker-build

⚠️ These options should only ever be used during development as they effectively poke security holes in Internet Identity

The features are described below:

Environment variable Description
II_FETCH_ROOT_KEY When enabled, this instructs the frontend code to fetch the "root key" from the replica.
The Internet Computer (https://ic0.app) uses a private key to sign responses. This private key not being available locally, the (local) replica generates its own. This option effectively tells the Internet Identity frontend to fetch the public key from the replica it connects to. When this option is not enabled, the Internet Identity frontend code will use the (hard coded) public key of the Internet Computer.
II_DUMMY_CAPTCHA When enabled, the CAPTCHA challenge (sent by the canister code to the frontend code) is always the known string "a". This is useful for automated testing.
II_DUMMY_AUTH When enabled, the frontend code will use a known, stable private key for registering anchors and authenticating. This means that all anchors will have the same public key(s). In particular this bypasses the WebAuthn flows (TouchID, Windows Hello, etc), which simplifies automated testing.
II_DEV_CSP When enabled, the content security policy is weakend to allow connections to II using HTTP and allow II to connect via http in order to facilitate development.

Flavors

We offer some pre-built Wasm modules that contain flavors, i.e. sets of features targeting a particular use case. Flavors can be downloaded from the table below for the latest release or from the release page for a particular release.

Flavor Description
Production This is the production build deployed to https://identity.ic0.app. Includes none of the build features. πŸ’Ύ
Test This flavor is used by Internet Identity's test suite. It fully supports authentication but uses a known CAPTCHA value for test automation. Includes the following features:
  • II_FETCH_ROOT_KEY
  • II_DUMMY_CAPTCHA
πŸ’Ύ
Development This flavor contains a version of Internet Identity that effectively performs no checks. It can be useful for external developers who want to integrate Internet Identity in their project and care about the general Internet Identity authentication flow, without wanting to deal with authentication and, in particular, WebAuthentication. Includes the following features:
  • II_FETCH_ROOT_KEY
  • II_DUMMY_CAPTCHA
  • II_DUMMY_AUTH
  • II_DEV_CSP

See the using-dev-build project for an example on how to use this flavor.
πŸ’Ύ

Stable Memory Compatibility

Internet Identity requires data in stable memory to have a specific layout in order to be upgradeable. The layout has been changed multiple times in the past. This is why II stable memory is versioned and each version of II is only compatible to some stable memory versions.

If on upgrade II traps with the message stable memory layout version ... is no longer supported then the stable memory layout has changed and is no longer compatible.

The easiest way to address this is to reinstall the canister (thus wiping stable memory). A canister can be reinstalled by executing dfx deploy <canister> --mode reinstall.

Getting Help

We're here to help! Here are some ways you can reach out for help if you get stuck:

  • Internet Identity Bug Tracker: Create a new ticket if you encounter a bug using Internet Identity, or if an issue arises when you try to build the code.
  • DFINITY Forum: The forum is a great place to look for information and to ask for help.
  • Support: Create a support request if you'd like to keep things private.

Links

internet-identity's People

Contributors

ais-dfn avatar andrewwylde avatar bitdivine avatar dependabot[bot] avatar dfinity-bjoern avatar dfx-json avatar drprofesq avatar dsarlis avatar dskloetd avatar dubovitskaya avatar eve832 avatar frederikrothenberger avatar ggreif avatar github-actions[bot] avatar gix-bot avatar hansl avatar ielashi avatar kritzcreek avatar krpeacock avatar lmuntaner avatar lsgunnlsgunn avatar meodai avatar mminder avatar nmattia avatar nomeata avatar peterpeterparker avatar przydatek avatar robin-kunzler avatar roman-kashitsyn avatar wackyleo459 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

internet-identity's Issues

help getting internet-identity to run locally

I've got Internet Identity running locally, and am able to interact with the UI, move around the site, create an identity and authorize it twice with finger print then I get a message either ..

Call was rejected: Request ID: 5c0f48ff860be6ef8c0461a243c10150af51396075ce816d79bfb337dcd9b408 Reject code: οΏ½ Reject text: Canister rwlgt-iiaaa-aaaaa-aaaaa-cai has no update method 'register'

or

We couldn't reach Internet Identity We failed to call the Internet Identity service, please try again. Error details Server returned an error: Code: 404 (Not Found) Body: Requested canister has no wasm module Try again

any help would be greatly appreciated!

Update docs with rust and cmake requirements and instructions.

Action Item: Add readme text to the local install to make sure you have the latest version of rust by running curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh or rustup install stable and rustup update.

Action Item: I also had to add cmake to my macos machine. I downloaded from https://cmake.org/download/ and then had to make symlinks by running sudo "/Applications/CMake.app/Contents/bin/cmake-gui" --install

I'm trying to run the identity canister locally and I'm getting an error upon deploy:


MacBook-Pro-4:internet-identity austin$ dfx deploy --no-wallet --argument '(null)'
Deploying all canisters.
All canisters have already been created.
Building canisters...
Executing 'src/internet_identity/build.sh'
Compiling frontend assets

> [email protected] build /Users/austin/Documents/Dropbox/development/internet-identity
> NODE_ENV=production webpack

assets by status 771 KiB [big]
  asset index.js 431 KiB [compared for emit] [minimized] [big] (name: index) 2 related assets
  asset glitch-loop.webp 341 KiB [compared for emit] [from: src/frontend/assets/glitch-loop.webp] [copied] [big]
asset favicon.ico 15 KiB [compared for emit] [from: src/frontend/assets/favicon.ico] [copied]
asset index.html 521 bytes [compared for emit] [from: src/frontend/assets/index.html] [copied]
orphan modules 270 KiB [orphan] 43 modules
runtime modules 1.16 KiB 6 modules
modules by path ./ 895 KiB
  modules by path ./node_modules/ 810 KiB
    modules by path ./node_modules/borc/ 113 KiB 10 modules
    modules by path ./node_modules/@dfinity/ 320 KiB
      modules by path ./node_modules/@dfinity/agent/ 248 KiB 2 modules
      modules by path ./node_modules/@dfinity/identity/ 71.6 KiB 2 modules
    modules by path ./node_modules/simple-cbor/src/*.js 17.5 KiB 3 modules
    modules by path ./node_modules/iso-url/ 4.36 KiB 3 modules
  modules by path ./src/frontend/ 85.1 KiB 34 modules
crypto (ignored) 15 bytes [built] [code generated]

WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets: 
  index.js (431 KiB)
  glitch-loop.webp (341 KiB)

WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
  index (431 KiB)
      index.js


WARNING in webpack performance recommendations: 
You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.
For more info visit https://webpack.js.org/guides/code-splitting/

webpack 5.24.4 compiled with 3 warnings in 8621 ms
warning: unused manifest key: package.edition
warning: unused manifest key: package.edition
warning: unused manifest key: package.edition
warning: unused manifest key: package.edition
error: failed to parse lock file at: /Users/austin/Documents/Dropbox/development/internet-identity/Cargo.lock

Caused by:
  invalid serialized PackageId for key `package.dependencies`
The build step failed for canister 'r7inp-6aaaa-aaaaa-aaabq-cai' with an embedded error: The custom tool failed.

I found a solution at neovide/neovide#101 that basically amounted to making sure my rust install was up to date by running rustup install stable and rustup update .

Later I got:

--- stderr
  thread 'main' panicked at '
  failed to execute command: No such file or directory (os error 2)
  is `cmake` not installed?

I installed cmake and now it seems to install the cannister! Just putting this here in case other run into the same errors. Feel free to close after maybe adding something to the docs.

error[E0658]: arbitrary expressions in key-value attributes are unstable

Hi. Would appreciate some help on this one. Trying to get internet identity built locally. I am on mac M1.

After running the deploy command

II_ENV=development dfx deploy --no-wallet --argument '(null)'

I get the following error

error[E0658]: arbitrary expressions in key-value attributes are unstable
--> /Users/ansleydsouza/.cargo/registry/src/github.com-1ecc6299db9ec823/clap-3.0.0-beta.4/src/lib.rs:8:10
|
8 | #![doc = include_str!("../README.md")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #78835 rust-lang/rust#78835 for more information

error[E0658]: use of unstable library feature 'osstring_ascii'
--> /Users/ansleydsouza/.cargo/registry/src/github.com-1ecc6299db9ec823/clap-3.0.0-beta.4/src/parse/matches/matched_arg.rs:130:19
|
130 | v.eq_ignore_ascii_case(val)
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #70516 rust-lang/rust#70516 for more information

error: aborting due to 2 previous errors

For more information about this error, try rustc --explain E0658.
error: could not compile clap

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...

II won't allow me to auth using anything but security key if it's plugged in to my computer

As an end user, I have the following device combos registered:
Yubikey + mac + chrome
Mac + biometrics + chrome

When I attempt to authenticate using Internet Identity, I am only given the option to use the security key (it's plugged in).
In order to see the option to use my biometrics or computer password, I have to click the "back" arrow in the app.
The options do not work unless I remove the security key.

1st Suggestion:
All authentication options are available at the same time, on the same screen and work.

2nd Suggestion:
A message telling the user to "Click back if you want to use your device biometrics or passcode" and work.

Will it support authing for other type of apps, eg, android/ios?

We are currently making the flutter agent for IC,soon there will be devs to build other types of client.

I'm thinking to build a auth-client package for flutter, which will works similar to the javascript package.

However there are some differences between web app authing and native app authing.

  1. To use current browser's Webauthn feature, the native side will open browser window or shared modal.
  2. To the auth-client of js, it use window.postMessage to pass the request payload to the Auth page. But native does not, so we are thinking to pass the URLParameters to it.
  3. So the Identity WebApp will find a way to extract the query info, then pass the login process.
  4. Then after login success or fail, the Identity WebApp will use window.location.href={scheme}://{callback_path}?success={true|false}&payload={payload} to pass the response with delegations back to the native which will use auth-client to receive.

That may require some changes and any good idea we can discuss about?

Running locally: Fail to verify certificate

I got my ID canister running locally, but when I try to create a new Identity I get the following error.

image

A couple of messages from the console:

Fetch failed loading: POST "http://localhost:8000/api/v2/canister/rwlgt-iiaaa-aaaaa-aaaaa-cai/call".

index.js:2 Fetch finished loading: POST "http://localhost:8000/api/v2/canister/rwlgt-iiaaa-aaaaa-aaaaa-cai/read_state".

If I try to run the provided dfx canister call internet_identity register '(123, "test", vec {1; 2; 3}, null)'

I get:

The wallet canister on the "local" network for user "default" is "rrkah-fqaaa-aaaaa-aaaaq-cai"
Invalid data: Unable to serialize Candid values: type mismatch: 123 can not be of type record {
  alias : text;
  pubkey : DeviceKey;
  key_type : KeyType;
  purpose : Purpose;
  credential_id : opt CredentialId;
}

wabt-sys cannot Compiling,help me!!

I have a problem after running dfx deploy --no-wallet --argument'(null)'
Operating environment:
macos big sur 11.2.3
rust 1.51
dfx 0.7.1
cmake 3.20.3

`
webpack 5.24.4 compiled with 3 warnings in 12472 ms
Finished release [optimized] target(s) in 0.15s
Updating crates.io index
Installing ic-cdk-optimizer v0.3.0
Compiling proc-macro2 v1.0.27
Compiling libc v0.2.95
Compiling cc v1.0.68
Compiling unicode-xid v0.2.2
Compiling memchr v2.4.0
Compiling version_check v0.9.3
Compiling syn v1.0.72
Compiling unicode-segmentation v1.7.1
Compiling cfg-if v1.0.0
Compiling regex-syntax v0.6.25
Compiling serde v1.0.126
Compiling ryu v1.0.5
Compiling autocfg v1.0.1
Compiling bitflags v1.2.1
Compiling serde_json v1.0.64
Compiling serde_derive v1.0.126
Compiling ppv-lite86 v0.2.10
Compiling itoa v0.4.7
Compiling hashbrown v0.9.1
Compiling unicode-width v0.1.8
Compiling remove_dir_all v0.5.3
Compiling termcolor v1.1.2
Compiling strsim v0.10.0
Compiling lazy_static v1.4.0
Compiling vec_map v0.8.2
Compiling os_str_bytes v2.4.0
Compiling humansize v1.1.1
Compiling heck v0.3.3
Compiling proc-macro-error-attr v1.0.4
Compiling proc-macro-error v1.0.4
Compiling cmake v0.1.45
Compiling indexmap v1.6.2
Compiling textwrap v0.12.1
Compiling wabt-sys v0.8.0
Compiling quote v1.0.9
Compiling aho-corasick v0.7.18
Compiling getrandom v0.2.3
Compiling atty v0.2.14
Compiling regex v1.5.4
Compiling rand_core v0.6.2
Compiling rand_chacha v0.3.0
Compiling rand v0.8.3
Compiling tempfile v3.2.0
Compiling binaryen-sys v0.12.0
Compiling clap_derive v3.0.0-beta.2
Compiling clap v3.0.0-beta.2
Compiling wabt v0.10.0
error: failed to add native library /tmp/cargo-installyRniTi/release/build/wabt-sys-3602112ed66c1793/out/build/libwabt.a: file too small to be an archive

error: aborting due to previous error

error: could not compile wabt-sys

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
Building [========================> ] 73/77: binaryen-sys(build)
error: failed to compile ic-cdk-optimizer v0.3.0, intermediate artifacts can be found at /tmp/cargo-installyRniTi

Caused by:
build failed
The build step failed for canister 'rwlgt-iiaaa-aaaaa-aaaaa-cai' with an embedded error: The custom tool failed.
`

The error reported above seems to be that wabt-sys cannot Compiling, but I cannot locate the cause by myself and cannot solve this problem.
Can anyone help me?

Unable to recover account using first four letters of words in seed phrase

The source code for Internet Identity suggests that the seed phrase is a BIP39 mnemonic.

Some backup solutions only allow storing the first 4 letters in accordance with the BIP39 protocol. My understanding is that the first-four-letter combinations are unique and sufficient to recover the full word.

However, when I try recovering an account using only the first four letters of each word in the seed phrase I get the "invalid seedphrase" message.

Call with register function failed

After deploying, call dfx canister call internet_identity register '(123, "test", vec {1; 2; 3}, null)'

Got:

Invalid data: Unable to serialize Candid values: type mismatch: 123 can not be of type record {
  alias : text;
  pubkey : DeviceKey;
  key_type : KeyType;
  purpose : Purpose;
  credential_id : opt CredentialId;
}

Local docker build fails

 > [10/18] RUN cargo install ic-cdk-optimizer --version 0.3.0:
#13 0.227 /lib64/ld-linux-x86-64.so.2: No such file or directory

Current deployed WASM does not match the docker built version of the WASM

The two methods of producing sha256sum for the CURRENT wasm do not seem to match.

FROM THE PAST: I was able to reproduce the build from the commit mentioned in the 5 month old article at https://www.joachim-breitner.de/blog/779-Verifying_the_code_of_the_Internet_Identity_service. i.e. the SHA256SUM was the same as mentioned in your article: d4af92…c04.

CURRENT WASM
I used the Update 20211115T1700Z.md (3 days ago) with the commit 1373a58 as it seemed to have the latest commit.

The dfx reported hash:
through dfx canister --no-wallet --network ic info rdmx6-jaaaa-aaaaa-aaadq-cai
0xfe00bbec790a6db930f6c826623d3831597227f71852e5538065099afad416b3

The docker build reported hash:
through sudo docker build -t internet-identity-service .
6b854cfffb919c1ec28c728e3ec9e594c86ed359343d8d200907f4ac2a163538

Clarify BAD Captcha error message

Since this text is displayed even after the new challenge has been generated I would rather have the text say something like this:
"The value you entered is incorrect. Please try again."
And maybe highlight the error more (e.g. with the exclamation mark icon).
@frederikrothenberger
#460 (comment)

I think this makes sense. We'll need to adapt the UI a bit.

Face ID clearing the Cache

I have a serious issue. I have created an account on my iPhone using Face ID as a security key. I don’t use a physical token.
Now after clearing the Cache. I try to log in but the Face ID verification is not possible anymore. The website ist just asking for a physical token.

i don't have other device

secp256k1 unavailable, reverting to browser version

The error is unclear where its coming from but I get this error:

secp256k1 unavailable, reverting to browser version
8:43:38 AM [vite] Error when evaluating SSR module /node_modules/@dfinity/identity/node_modules/tweetnacl/nacl-fast.js?v=7d3a1fc0:
ReferenceError: self is not defined
    at /node_modules/@dfinity/identity/node_modules/tweetnacl/nacl-fast.js?v=7d3a1fc0:2391:72
    at instantiateModule (/home/ettinger/src/oblivion/Catalyze-frontend/node_modules/vite/dist/node/chunks/dep-9c153816.js:56193:15)
8:43:38 AM [vite] Error when evaluating SSR module /node_modules/@dfinity/identity/lib/esm/identity/ed25519.js:
ReferenceError: self is not defined
    at /node_modules/@dfinity/identity/node_modules/tweetnacl/nacl-fast.js?v=7d3a1fc0:2391:72
    at instantiateModule (/home/ettinger/src/oblivion/Catalyze-frontend/node_modules/vite/dist/node/chunks/dep-9c153816.js:56193:15)
8:43:38 AM [vite] Error when evaluating SSR module /node_modules/@dfinity/identity/lib/esm/index.js?v=7d3a1fc0:
ReferenceError: self is not defined
    at /node_modules/@dfinity/identity/node_modules/tweetnacl/nacl-fast.js?v=7d3a1fc0:2391:72
    at instantiateModule (/home/ettinger/src/oblivion/Catalyze-frontend/node_modules/vite/dist/node/chunks/dep-9c153816.js:56193:15)
8:43:38 AM [vite] Error when evaluating SSR module /src/lib/auth/openLogin.ts:
ReferenceError: self is not defined
    at /node_modules/@dfinity/identity/node_modules/tweetnacl/nacl-fast.js?v=7d3a1fc0:2391:72
    at instantiateModule (/home/ettinger/src/oblivion/Catalyze-frontend/node_modules/vite/dist/node/chunks/dep-9c153816.js:56193:15)
8:43:38 AM [vite] Error when evaluating SSR module /src/lib/chat.ts:
ReferenceError: self is not defined
    at /node_modules/@dfinity/identity/node_modules/tweetnacl/nacl-fast.js?v=7d3a1fc0:2391:72
    at instantiateModule (/home/ettinger/src/oblivion/Catalyze-frontend/node_modules/vite/dist/node/chunks/dep-9c153816.js:56193:15)
8:43:38 AM [vite] Error when evaluating SSR module /src/components/Messages/Test.svelte:
ReferenceError: self is not defined
    at /node_modules/@dfinity/identity/node_modules/tweetnacl/nacl-fast.js?v=7d3a1fc0:2391:72
    at instantiateModule (/home/ettinger/src/oblivion/Catalyze-frontend/node_modules/vite/dist/node/chunks/dep-9c153816.js:56193:15)
8:43:38 AM [vite] Error when evaluating SSR module /src/routes/messages.svelte:
ReferenceError: self is not defined
    at /node_modules/@dfinity/identity/node_modules/tweetnacl/nacl-fast.js?v=7d3a1fc0:2391:72
    at instantiateModule (/home/ettinger/src/oblivion/Catalyze-frontend/node_modules/vite/dist/node/chunks/dep-9c153816.js:56193:15)
self is not defined
ReferenceError: self is not defined
    at /node_modules/@dfinity/identity/node_modules/tweetnacl/nacl-fast.js?v=7d3a1fc0:2391:72
    at instantiateModule (/home/ettinger/src/oblivion/Catalyze-frontend/node_modules/vite/dist/node/chunks/dep-9c153816.js:56193:15)

I think its coming from here: import { Ed25519KeyIdentity } from '@dfinity/identity';

Add backend tests for CAPTCHA

The soon-to-be introduced CAPTCHAs will need some backend-tests to make sure they don't get broken in the future. Right now they are only tested with Selenium.

#460

why is the publicKeyCredentialCreationOptions challenge not random

From webauthn.guide:

challenge: The challenge is a buffer of cryptographically random bytes generated on the server, and is needed to prevent "replay attacks".

From the specs:

As a cryptographic protocol, Web Authentication is dependent upon randomized challenges to avoid replay attacks. Therefore, the values of both PublicKeyCredentialCreationOptions.challenge and PublicKeyCredentialRequestOptions.challenge MUST be randomly generated by Relying Parties in an environment they trust (e.g., on the server-side), and the returned challenge value in the client’s response MUST match what was generated. This SHOULD be done in a fashion that does not rely upon a client’s behavior, e.g., the Relying Party SHOULD store the challenge temporarily until the operation is complete. Tolerating a mismatch will compromise the security of the protocol.
In order to prevent replay attacks, the challenges MUST contain enough entropy to make guessing them infeasible. Challenges SHOULD therefore be at least 16 bytes long.

But the implementation is not random:

createOptions used in register

Check canister id in `post_upgrade`

Currently, we hard-code the canister id in the canister itself, at least in the frontend. (We could do it differently and let the canister inject the canister id into the front end code somehow). Since we have that information, it seems prudent to check, in canister_init and canister_post_upgrade, whether the actual canister id is as expected, and trap if it does not.

This would also be a good safeguard against accidentialy installing the Internet Identity canister over another NNS canister.

Replica error with code 5 : Wasm module of canister rwlgt-iiaaa-aaaaa-aaaaa-cai is not valid

Getting the following error when running the latest build

I'm getting the same error on both MacOs and Linux (Ubuntu 20.04)

Stripping Unused Data Segments...
Pass did not result in smaller WASM... Skipping.
Execute a binaryen optimization pass on your WASM....
Pass did not result in smaller WASM... Skipping.

Final Size: 1.26 MiB (0.0% smaller)
Installing canisters...
Installing code for canister internet_identity, with canister_id rwlgt-iiaaa-aaaaa-aaaaa-cai
The Replica returned an error: code 5, message: "Wasm module of canister rwlgt-iiaaa-aaaaa-aaaaa-cai is not valid: Wasm module has an invalid import section. Module imports function 'stable64_grow' from 'ic0' that is not exported by the runtime."

wabt-sys cannot Compiling,help me!!

I have a problem after running dfx deploy --no-wallet --argument'(null)'
Operating environment:
macos big sur 11.2.3
rust 1.51
dfx 0.7.1
cmake 3.20.3

`
webpack 5.24.4 compiled with 3 warnings in 12472 ms
Finished release [optimized] target(s) in 0.15s
Updating crates.io index
Installing ic-cdk-optimizer v0.3.0
Compiling proc-macro2 v1.0.27
Compiling libc v0.2.95
Compiling cc v1.0.68
Compiling unicode-xid v0.2.2
Compiling memchr v2.4.0
Compiling version_check v0.9.3
Compiling syn v1.0.72
Compiling unicode-segmentation v1.7.1
Compiling cfg-if v1.0.0
Compiling regex-syntax v0.6.25
Compiling serde v1.0.126
Compiling ryu v1.0.5
Compiling autocfg v1.0.1
Compiling bitflags v1.2.1
Compiling serde_json v1.0.64
Compiling serde_derive v1.0.126
Compiling ppv-lite86 v0.2.10
Compiling itoa v0.4.7
Compiling hashbrown v0.9.1
Compiling unicode-width v0.1.8
Compiling remove_dir_all v0.5.3
Compiling termcolor v1.1.2
Compiling strsim v0.10.0
Compiling lazy_static v1.4.0
Compiling vec_map v0.8.2
Compiling os_str_bytes v2.4.0
Compiling humansize v1.1.1
Compiling heck v0.3.3
Compiling proc-macro-error-attr v1.0.4
Compiling proc-macro-error v1.0.4
Compiling cmake v0.1.45
Compiling indexmap v1.6.2
Compiling textwrap v0.12.1
Compiling wabt-sys v0.8.0
Compiling quote v1.0.9
Compiling aho-corasick v0.7.18
Compiling getrandom v0.2.3
Compiling atty v0.2.14
Compiling regex v1.5.4
Compiling rand_core v0.6.2
Compiling rand_chacha v0.3.0
Compiling rand v0.8.3
Compiling tempfile v3.2.0
Compiling binaryen-sys v0.12.0
Compiling clap_derive v3.0.0-beta.2
Compiling clap v3.0.0-beta.2
Compiling wabt v0.10.0
error: failed to add native library /tmp/cargo-installyRniTi/release/build/wabt-sys-3602112ed66c1793/out/build/libwabt.a: file too small to be an archive

error: aborting due to previous error

error: could not compile wabt-sys

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
Building [========================> ] 73/77: binaryen-sys(build)
error: failed to compile ic-cdk-optimizer v0.3.0, intermediate artifacts can be found at /tmp/cargo-installyRniTi

Caused by:
build failed
The build step failed for canister 'rwlgt-iiaaa-aaaaa-aaaaa-cai' with an embedded error: The custom tool failed.`

The error reported above seems to be that wabt-sys cannot Compiling, but I cannot locate the cause by myself and cannot solve this problem.
Can anyone help me?

Change UX for deleting last (FIDO) device + improve account security

Currently an internet-identity user can delete their last FIDO device without being fully aware what it really means: the destruction of the account.

Demonstration

When deleting the last device two warnings are shown:

The default one:
delete-last-device

A special one for the deletion of the last device:
delete-last-device2

With a soft message:

This will remove your only remaining identity and may impact your ability to log in to accounts you have linked

The use of "may" seems to be kind of an understatement here πŸ˜‰

Suggestions

Instead of just changing the soft message displayed, the UX of removing the last device should be changed.
Following suggestions:

  • Don't allow the deletion of the last device.
  • Add a separate button to delete the account (which will of course remove the last device).
  • When deleting the account (and thus the last device), the user should be prompted to verify the deletion with their device. -> This will make it harder to accidentally destroy the account (e.g. by a user using the same computer)

Deployment failed with error: "Module imports function 'stable64_grow' from 'ic0' that is not exported by the runtime."

Cannot deploy II locally:
Branch: master
Commit: 6d8fbc7 Nicolas Mattia [email protected] on 26/10/2021 at 11:18
DFX version: 0.8.3

Running II_ENV=development dfx deploy --no-wallet --argument '(null)' command I get following error:

➜  internet-identity git:(main) βœ— II_ENV=development dfx deploy --no-wallet --argument '(null)'
Deploying all canisters.
All canisters have already been created.
Building canisters...
Executing 'src/internet_identity/build.sh'
Compiling frontend assets

> [email protected] build
> NODE_ENV=production webpack

assets by status 1.2 MiB [big]
  asset index.js 700 KiB [compared for emit] [minimized] [big] (name: index) 2 related assets
  asset loader.webp 526 KiB [compared for emit] [from: src/frontend/assets/loader.webp] [copied] [big]
asset favicon.ico 15 KiB [compared for emit] [from: src/frontend/assets/favicon.ico] [copied]
asset index.html 521 bytes [compared for emit] [from: src/frontend/assets/index.html] [copied]
orphan modules 275 KiB [orphan] 43 modules
runtime modules 1.16 KiB 6 modules
javascript modules 1 MiB
  modules by path ./node_modules/ 893 KiB 59 modules
  modules by path ./src/frontend/ 132 KiB 47 modules
  crypto (ignored) 15 bytes [built] [code generated]
  util (ignored) 15 bytes [built] [code generated]
  util (ignored) 15 bytes [built] [code generated]
optional modules 159 KiB [optional] 10 modules

WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets: 
  index.js (700 KiB)
  loader.webp (526 KiB)

WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
  index (700 KiB)
      index.js


WARNING in webpack performance recommendations: 
You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.
For more info visit https://webpack.js.org/guides/code-splitting/

webpack 5.45.1 compiled with 3 warnings in 9364 ms
    Finished release [optimized] target(s) in 0.26s
     Ignored package `ic-cdk-optimizer v0.3.1` is already installed, use --force to override
warning: be sure to add `src/internet_identity/../../target/bin` to your PATH to be able to run the installed binaries
Original:          1.26 MiB
Stripping Unused Data Segments...
Pass did not result in smaller WASM... Skipping.
Execute a binaryen optimization pass on your WASM....
    Size:          1.26 MiB (0.0% smaller)

Final Size: 1.26 MiB (0.0% smaller)
Installing canisters...
Installing code for canister internet_identity, with canister_id qoctq-giaaa-aaaaa-aaaea-cai
The Replica returned an error: code 5, message: "Wasm module of canister qoctq-giaaa-aaaaa-aaaea-cai is not valid: Wasm module has an invalid import section. Module imports function 'stable64_grow' from 'ic0' that is not exported by the runtime."

Security key

I'm trying to register my laptop (Macbook). Is it possible to do this without owning a hardware security key or using my phone as a security key? I managed to register my phone (Android) through the Chrome browser with the lock-screen method.

When I navigate to: https://identity.ic0.app, click "Already registered but using a new device?" and fill in my Identity number, the only option is to use a security key.

Not getting front-end error when device count limit is reached

Error in console:

Uncaught (in promise) Error: Call was rejected:
  Request ID: ...
  Reject code: 5
  Reject text: Canister rdmx6-jaaaa-aaaaa-aaadq-cai trapped explicitly: at most 10 authentication information entries are allowed per user

Expected to show a proper UI to frontend, and before adding device not after the process

Error Compiling on Mac M1 - 'could not compile wabt-sys'

I run this command on macbook pro M1

II_ENV=development dfx deploy --no-wallet --argument '(null)'

Hangs up on this for a long while

Building [=======================> ] 68/75: wabt-sys(build), binaryen-sys(build)

error message produced after hanging up

`error: failed to add native library /var/folders/z8/06mhg00s4lzd_dzykt3q0s6m0000gn/T/cargo-installNkJZeH/release/build/wabt-sys-0c5d3f90b9057634/out/build/libwabt.a: file too small to be an archive

error: aborting due to previous error

error: could not compile wabt-sys

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
Building [========================> ] 71/75: binaryen-sys(build) `

Add device link not removed from URL

When I create a link to add a device, then go there and add the device, I am at the page where I see my list of devices. Good so far! But the URL still looks like

localhost:8080/manage.html#device=10000;305e300c060a2b0601040183b8430101034e00a501020326200121582066158895fe05e440aaff0abbd9a1f1c0e2ca4746faf97223662359da6d61598e2258202a1a2b478283a0f26c577a420a38470575ec8401f3137bc903fd098cea372a93;cd57b4002128c123b4ea58b89c44baefa40c58ef84c0b2004b27e0a40229a9bfcd8dbeae92c5158de0229f368e9d3619608765907e3692bf81d8d6bcaa82cb80```
so if I reload (Ctrl-R), it tries to add them again.

The frontend should probably clear the fragment from the location at a suitable time during this flow.

windows 10: error specified ingress_expriry not within expected range

Actual Behavior

I've got quite a old Windows 10 laptop which I use time to time as test machine. When I try to access https://identity.ic0.app I get following error:

An error happened: Error: Server returned an error:
Code: 400 (Bad Request)
Body: Specified ingress_expiry not within expected range:
Minimum allowed expiry: 2021-07-26 09:18:02.184107451 UTC
Maximum allowed expiry: 2021-07-26 09:23:02.184107451 UTC
Provided expiry: 2021-07-26 09:24:48.162 UTC
Local replica time: 2021-07-26 09:18:02.184109445 UTC

Tested with both up-to-date browsers Firefox and Chrome

Not sure if the error occurs because of Windows or an i18n date thing (the laptop is in ch-FR).

Screenshot

image

WIndows 10: Confirm new device fails locally.

Repo steps

  1. Start II in a terminal - II_ENV=development dfx deploy --no-wallet --argument '(null)'
  2. Open in browser http://localhost:8000/?canisterId=rwlgt-iiaaa-aaaaa-aaaaa-cai#authorize
  3. Create an Internet Identity Anchor
  4. Fill in Device name and click create.
  5. I get a pop up window to setup my security key and click ok. Enter my pin. And touch my security key.
  6. Confirm new device and am again prompted to touch my security key.
  7. Server returned an error:
    Code: 404 (Not Found)
    Body: Requested canister does not exist

Im stuck here. Not being able to create any Identity Anchors locally.

Any help would be greatly appreciated.]

Unable to deploy, Object is of type 'unknown'

I just updated from dfx verion 0.7.1 to 0.8.1
I deleted the internet-identity repo and started from scratch.
I'm compiling the latest version of internet identity from main
rustc version 1.52.1
When I call II_ENV=development dfx deploy --no-wallet --argument '(null)'
I get the following errors:

Deploying all canisters.
Creating canisters...
Creating canister "internet_identity"...
"internet_identity" canister created with canister id: "rwlgt-iiaaa-aaaaa-aaaaa-cai"
Building canisters...
Executing 'src/internet_identity/build.sh'
Compiling frontend assets

> [email protected] build
> NODE_ENV=production webpack

assets by status 1.21 MiB [cached] 4 assets
orphan modules 275 KiB [orphan] 43 modules
runtime modules 1.16 KiB 6 modules
javascript modules 1 MiB
  modules by path ./node_modules/ 894 KiB 61 modules
  modules by path ./src/frontend/ 132 KiB 36 modules
  crypto (ignored) 15 bytes [built] [code generated]
  util (ignored) 15 bytes [built] [code generated]
  util (ignored) 15 bytes [built] [code generated]
optional modules 159 KiB [optional] 10 modules

ERROR in /Users/sneilan/workspace/blockchain/dfinity/internet-identity/src/frontend/src/flows/addDevice.ts
./src/frontend/src/flows/addDevice.ts 97:18-23
[tsl] ERROR in /Users/sneilan/workspace/blockchain/dfinity/internet-identity/src/frontend/src/flows/addDevice.ts(97,19)
      TS2571: Object is of type 'unknown'.
 @ ./src/frontend/src/index.ts 9:20-48

ERROR in /Users/sneilan/workspace/blockchain/dfinity/internet-identity/src/frontend/src/flows/addDeviceUserNumber.ts
./src/frontend/src/flows/addDeviceUserNumber.ts 81:18-23
[tsl] ERROR in /Users/sneilan/workspace/blockchain/dfinity/internet-identity/src/frontend/src/flows/addDeviceUserNumber.ts(81,19)
      TS2571: Object is of type 'unknown'.
 @ ./src/frontend/src/flows/loginUnknown.ts 10:30-62
 @ ./src/frontend/src/flows/login.ts 13:23-48
 @ ./src/frontend/src/index.ts 7:16-40

ERROR in /Users/sneilan/workspace/blockchain/dfinity/internet-identity/src/frontend/src/flows/login.ts
./src/frontend/src/flows/login.ts 69:6-12
[tsl] ERROR in /Users/sneilan/workspace/blockchain/dfinity/internet-identity/src/frontend/src/flows/login.ts(69,7)
      TS2322: Type 'unknown' is not assignable to type 'string | undefined'.
  Type 'unknown' is not assignable to type 'string'.
 @ ./src/frontend/src/index.ts 7:16-40

ERROR in /Users/sneilan/workspace/blockchain/dfinity/internet-identity/src/frontend/src/flows/manage.ts
./src/frontend/src/flows/manage.ts 205:37-42
[tsl] ERROR in /Users/sneilan/workspace/blockchain/dfinity/internet-identity/src/frontend/src/flows/manage.ts(205,38)
      TS2345: Argument of type 'unknown' is not assignable to parameter of type 'Error'.
 @ ./src/frontend/src/index.ts 10:17-42

ERROR in /Users/sneilan/workspace/blockchain/dfinity/internet-identity/src/frontend/src/flows/manage.ts
./src/frontend/src/flows/manage.ts 226:38-43
[tsl] ERROR in /Users/sneilan/workspace/blockchain/dfinity/internet-identity/src/frontend/src/flows/manage.ts(226,39)
      TS2345: Argument of type 'unknown' is not assignable to parameter of type 'Error'.
 @ ./src/frontend/src/index.ts 10:17-42

ERROR in /Users/sneilan/workspace/blockchain/dfinity/internet-identity/src/frontend/src/flows/manage.ts
./src/frontend/src/flows/manage.ts 245:38-43
[tsl] ERROR in /Users/sneilan/workspace/blockchain/dfinity/internet-identity/src/frontend/src/flows/manage.ts(245,39)
      TS2345: Argument of type 'unknown' is not assignable to parameter of type 'Error'.
 @ ./src/frontend/src/index.ts 10:17-42

ERROR in /Users/sneilan/workspace/blockchain/dfinity/internet-identity/src/frontend/src/flows/manage.ts
./src/frontend/src/flows/manage.ts 364:16-19
[tsl] ERROR in /Users/sneilan/workspace/blockchain/dfinity/internet-identity/src/frontend/src/flows/manage.ts(364,17)
      TS2571: Object is of type 'unknown'.
 @ ./src/frontend/src/index.ts 10:17-42

ERROR in /Users/sneilan/workspace/blockchain/dfinity/internet-identity/src/frontend/src/flows/recovery/setupRecovery.ts
./src/frontend/src/flows/recovery/setupRecovery.ts 38:20-23
[tsl] ERROR in /Users/sneilan/workspace/blockchain/dfinity/internet-identity/src/frontend/src/flows/recovery/setupRecovery.ts(38,21)
      TS2571: Object is of type 'unknown'.
 @ ./src/frontend/src/index.ts 17:24-65

ERROR in /Users/sneilan/workspace/blockchain/dfinity/internet-identity/src/frontend/src/flows/recovery/setupRecovery.ts
./src/frontend/src/flows/recovery/setupRecovery.ts 78:14-17
[tsl] ERROR in /Users/sneilan/workspace/blockchain/dfinity/internet-identity/src/frontend/src/flows/recovery/setupRecovery.ts(78,15)
      TS2571: Object is of type 'unknown'.
 @ ./src/frontend/src/index.ts 17:24-65

ERROR in /Users/sneilan/workspace/blockchain/dfinity/internet-identity/src/frontend/src/utils/iiConnection.ts
./src/frontend/src/utils/iiConnection.ts 87:33-38
[tsl] ERROR in /Users/sneilan/workspace/blockchain/dfinity/internet-identity/src/frontend/src/utils/iiConnection.ts(87,34)
      TS2322: Type 'unknown' is not assignable to type 'Error'.
 @ ./src/frontend/src/index.ts 18:23-54

ERROR in /Users/sneilan/workspace/blockchain/dfinity/internet-identity/src/frontend/src/utils/iiConnection.ts
./src/frontend/src/utils/iiConnection.ts 110:33-38
[tsl] ERROR in /Users/sneilan/workspace/blockchain/dfinity/internet-identity/src/frontend/src/utils/iiConnection.ts(110,34)
      TS2322: Type 'unknown' is not assignable to type 'Error'.
 @ ./src/frontend/src/index.ts 18:23-54

ERROR in /Users/sneilan/workspace/blockchain/dfinity/internet-identity/src/frontend/src/utils/iiConnection.ts
./src/frontend/src/utils/iiConnection.ts 136:8-13
[tsl] ERROR in /Users/sneilan/workspace/blockchain/dfinity/internet-identity/src/frontend/src/utils/iiConnection.ts(136,9)
      TS2322: Type 'unknown' is not assignable to type 'Error'.
 @ ./src/frontend/src/index.ts 18:23-54

ERROR in /Users/sneilan/workspace/blockchain/dfinity/internet-identity/src/frontend/src/utils/iiConnection.ts
./src/frontend/src/utils/iiConnection.ts 163:33-38
[tsl] ERROR in /Users/sneilan/workspace/blockchain/dfinity/internet-identity/src/frontend/src/utils/iiConnection.ts(163,34)
      TS2322: Type 'unknown' is not assignable to type 'Error'.
 @ ./src/frontend/src/index.ts 18:23-54

13 errors have detailed information that is not shown.
Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.

webpack 5.45.1 compiled with 13 errors in 9860 ms
The build step failed for canister 'rwlgt-iiaaa-aaaaa-aaaaa-cai' with an embedded error: The custom tool failed.

Any ideas or suggestions?

dfx deploy fails

dfx 0.8.0, rust 1.51, node 12.18, MacOS Catalina

After npm install, II_ENV=development dfx deploy --no-wallet --argument '(null)' fails with errors:

error[E0463]: can't find crate for core |= note: the wasm32-unknown-unknown target may not be installed
error: aborting due to previous error
For more information about this error, try rustc --explain E0463.
error: could not compile cfg-if

rustc --explain E0463 --> A plugin/crate was declared but cannot be found.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.