Skip to content

Commit 7dc514a

Browse files
authored
Merge branch 'main' into arshavir/enforce-unique-passkey-pubkeys
2 parents 0c94f61 + ed29198 commit 7dc514a

File tree

70 files changed

+2352
-1365
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+2352
-1365
lines changed

.github/workflows/canister-tests.yml

Lines changed: 58 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,46 @@ jobs:
137137
# downloaded file
138138
path: archive.wasm.gz
139139

140+
docker-build-internet_identity_frontend:
141+
runs-on: ubuntu-latest
142+
needs: docker-build-base
143+
steps:
144+
- uses: actions/checkout@v4
145+
146+
- name: Infer version
147+
id: version
148+
run: |
149+
version="$(./scripts/version)"
150+
echo "Inferred version: '$version'"
151+
echo "version=$version" >> "$GITHUB_OUTPUT"
152+
153+
- name: Set up docker buildx
154+
uses: docker/setup-buildx-action@v3
155+
156+
- name: Build internet_identity_frontend.wasm.gz
157+
uses: docker/build-push-action@v5
158+
with:
159+
context: .
160+
file: Dockerfile
161+
build-args: |
162+
II_VERSION=${{ steps.version.outputs.version }}
163+
II_DEV_CSP=0
164+
cache-from: type=gha,scope=cached-stage
165+
# Exports the artefacts from the final stage
166+
outputs: ./out
167+
target: scratch_internet_identity_frontend
168+
169+
- run: mv out/internet_identity_frontend.wasm.gz internet_identity_frontend.wasm.gz
170+
- run: sha256sum internet_identity_frontend.wasm.gz
171+
- name: "Upload internet_identity_frontend.wasm.gz"
172+
uses: actions/upload-artifact@v4
173+
with:
174+
# name is the name used to display and retrieve the artifact
175+
name: internet_identity_frontend.wasm.gz
176+
# path is the name used as the file to upload and the name of the
177+
# downloaded file
178+
path: internet_identity_frontend.wasm.gz
179+
140180
wasm-size:
141181
runs-on: ubuntu-latest
142182
needs: docker-build-ii
@@ -518,7 +558,7 @@ jobs:
518558
svg='<svg viewBox=\\\"0 0 24 24\\\"><path d=\\\"m14 2.8-2.6 1.8v16.6l2.6-1.4zm-3.3 5.4C1.9 9 2 14.7 2 14.7c0 5.6 8.7 6.5 8.7 6.5v-1.9c-6.3-1-5.5-4.5-5.5-4.5.3-4 5.5-4.3 5.5-4.3Zm4 0v2.1s1.6 0 3 1.2l-1.5.6 5.8 1.4V9l-2 1.1s-1.7-1.7-5.3-1.9z\\\" style=\\\"fill: currentColor;\\\"></path></svg>'
519559
configs=()
520560
for port in ${{ env.openid_providers }}; do
521-
configs+=("record { name = \\\"Test OpenID $port\\\"; logo = \\\"$svg\\\"; issuer = \\\"http://localhost:$port\\\"; client_id = \\\"internet_identity\\\"; jwks_uri = \\\"http://localhost:$port/jwks\\\"; auth_uri = \\\"http://localhost:$port/auth\\\"; auth_scope = vec { \\\"openid\\\"; \\\"profile\\\"; \\\"email\\\" }; fedcm_uri = opt \\\"\\\"; }")
561+
configs+=("record { name = \\\"Test OpenID $port\\\"; logo = \\\"$svg\\\"; issuer = \\\"http://localhost:$port\\\"; client_id = \\\"internet_identity\\\"; jwks_uri = \\\"http://localhost:$port/jwks\\\"; auth_uri = \\\"http://localhost:$port/auth\\\"; auth_scope = vec { \\\"openid\\\"; \\\"profile\\\"; \\\"email\\\" }; fedcm_uri = opt \\\"\\\"; email_verification = opt variant { Google }; }")
522562
done
523563
openid_configs="$(IFS='; '; echo "${configs[*]}")"
524564
echo "OPENID_CONFIGS=$openid_configs" >> "$GITHUB_OUTPUT"
@@ -528,7 +568,8 @@ jobs:
528568
# NOTE: dfx install will run the postinstall scripts from dfx.json
529569
dfx canister install internet_identity --wasm internet_identity_test.wasm.gz --argument "(opt record { captcha_config = opt record { max_unsolved_captchas= 50:nat64; captcha_trigger = variant {Static = variant { CaptchaDisabled }}}; related_origins = opt vec { \"https://id.ai\"; \"https://identity.ic0.app\"; \"https://identity.internetcomputer.org\" }; new_flow_origins = opt vec { \"https://id.ai\" }; dummy_auth = opt opt record { prompt_for_index = true }; openid_configs = opt vec { ${{ steps.openid-configs.outputs.OPENID_CONFIGS }} } })"
530570
if [ "${{ matrix.canister == 'split' }}" = "true" ]; then
531-
dfx canister install internet_identity_frontend --wasm internet_identity_frontend_test.wasm.gz
571+
II_CANISTER_ID=$(dfx canister id internet_identity)
572+
dfx canister install internet_identity_frontend --wasm internet_identity_frontend_test.wasm.gz --argument "(record { backend_canister_id = principal \"$II_CANISTER_ID\"; backend_origin = \"https://backend.id.ai\"; related_origins = opt vec { \"https://id.ai\"; \"https://identity.ic0.app\"; \"https://identity.internetcomputer.org\" }; dummy_auth = opt opt record { prompt_for_index = true } })"
532573
fi
533574
dfx canister install test_app --wasm demos/test-app/test_app.wasm
534575
@@ -721,7 +762,13 @@ jobs:
721762
# On release tags, a new release is created and the assets are uploaded.
722763
release:
723764
runs-on: ubuntu-latest
724-
needs: [docker-build-ii, docker-build-archive, vc_demo_issuer-build]
765+
needs:
766+
[
767+
docker-build-ii,
768+
docker-build-archive,
769+
docker-build-internet_identity_frontend,
770+
vc_demo_issuer-build,
771+
]
725772

726773
steps:
727774
- uses: actions/checkout@v4
@@ -750,6 +797,12 @@ jobs:
750797
name: archive.wasm.gz
751798
path: .
752799

800+
- name: "Download frontend"
801+
uses: actions/download-artifact@v4
802+
with:
803+
name: internet_identity_frontend.wasm.gz
804+
path: .
805+
753806
- name: "Download issuer"
754807
uses: actions/download-artifact@v4
755808
with:
@@ -815,6 +868,7 @@ jobs:
815868
internet_identity_production.wasm.gz
816869
internet_identity_dev.wasm.gz
817870
internet_identity_test.wasm.gz
871+
internet_identity_frontend.wasm.gz
818872
archive.wasm.gz
819873
vc_demo_issuer.wasm.gz
820874
production_asset: internet_identity_production.wasm.gz
@@ -842,6 +896,7 @@ jobs:
842896
internet_identity_production.wasm.gz.sha256 \
843897
internet_identity_dev.wasm.gz \
844898
internet_identity_test.wasm.gz \
899+
internet_identity_frontend.wasm.gz \
845900
src/internet_identity/internet_identity.did \
846901
archive.wasm.gz \
847902
vc_demo_issuer.wasm.gz

Dockerfile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,27 @@ RUN touch src/*/src/lib.rs
9999
RUN ./scripts/build --archive
100100
RUN sha256sum /archive.wasm.gz
101101

102+
FROM deps as build_internet_identity_frontend
103+
104+
COPY . .
105+
106+
# The version baked in
107+
ARG II_VERSION=
108+
109+
# The features, see README
110+
ARG II_DEV_CSP=
111+
112+
RUN touch src/*/src/lib.rs
113+
RUN npm ci
114+
115+
RUN ./scripts/build --frontend
116+
RUN sha256sum /internet_identity_frontend.wasm.gz
117+
102118
FROM scratch AS scratch_internet_identity
103119
COPY --from=build_internet_identity /internet_identity.wasm.gz /
104120

105121
FROM scratch AS scratch_archive
106122
COPY --from=build_archive /archive.wasm.gz /
123+
124+
FROM scratch AS scratch_internet_identity_frontend
125+
COPY --from=build_internet_identity_frontend /internet_identity_frontend.wasm.gz /

dfx.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"candid": "src/internet_identity_frontend/internet_identity_frontend.did",
66
"wasm": "internet_identity_frontend.wasm.gz",
77
"build": "bash -c 'II_DEV_CSP=1 II_FETCH_ROOT_KEY=1 II_DUMMY_CAPTCHA=${II_DUMMY_CAPTCHA:-1} scripts/build --frontend'",
8+
"init_arg_file": "src/internet_identity_frontend/local_test_arg.did",
89
"shrink": false
910
},
1011
"internet_identity": {
@@ -27,9 +28,7 @@
2728
"wasm": "demos/vc_issuer/vc_demo_issuer.wasm.gz",
2829
"build": "demos/vc_issuer/build.sh",
2930
"post_install": "bash -c 'demos/vc_issuer/provision'",
30-
"dependencies": [
31-
"internet_identity"
32-
]
31+
"dependencies": ["internet_identity"]
3332
}
3433
},
3534
"defaults": {
@@ -39,4 +38,4 @@
3938
},
4039
"dfx": "0.29.0",
4140
"version": 1
42-
}
41+
}

scripts/build

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
set -euo pipefail
3+
set -xeuo pipefail
44

55
# Make sure we always run from the root
66
SCRIPTS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
@@ -84,14 +84,14 @@ if [ ${#CANISTERS[@]} -eq 0 ]; then
8484
CANISTERS=("internet_identity")
8585
fi
8686

87-
# Checking for dependencies
88-
if [[ ! "$(command -v ic-wasm)" || "$(ic-wasm --version)" != "ic-wasm 0.8.5" ]]
89-
then
90-
echo "could not find ic-wasm 0.8.5"
91-
echo "ic-wasm version 0.8.5 is needed, please run the following command:"
92-
echo " cargo install ic-wasm --version 0.8.5"
93-
exit 1
94-
fi
87+
# # Checking for dependencies
88+
# if [[ ! "$(command -v ic-wasm)" || "$(ic-wasm --version)" != "ic-wasm 0.8.5" ]]
89+
# then
90+
# echo "could not find ic-wasm 0.8.5"
91+
# echo "ic-wasm version 0.8.5 is needed, please run the following command:"
92+
# echo " cargo install ic-wasm --version 0.8.5"
93+
# exit 1
94+
# fi
9595

9696
# Check for exact node version
9797
if [[ "$(node --version)" != "v$(cat .node-version)" ]]

0 commit comments

Comments
 (0)