Skip to content

Commit

Permalink
Remap new domain to old domain in expected origin for id alias (#68)
Browse files Browse the repository at this point in the history
# Motivation

II uses the old domain `ic0.app` to derive the principals even when the
dapp is hosted in the new domain `icp0.io`. This happens in the
`remapToLegacyDomain` helper in II.

Therefore, the origin of the id alias credential uses the old domain
`ic0.app` even though the dapp is hosted in the new domain `icp0.io`.

Instead of requiring the developers to understand and know about this
implementation detail, we decided to map the new domain of the expected
origin to the old domain before comparing them.

# Changes

* New helper `remap_to_legacy_domain`.
* Use new helper when comparing domains.

# Tests

* Add tests for the helper.
* Add a test where the expected origin uses the new domain.

# Todos

- [ ] Add entry to changelog (if necessary). NOT NECESSARY.
  • Loading branch information
lmuntaner authored Oct 29, 2024
1 parent ccad4bf commit a6ce1b1
Show file tree
Hide file tree
Showing 3 changed files with 239 additions and 32 deletions.
19 changes: 10 additions & 9 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions rust-packages/ic-verifiable-credentials/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ serde_cbor.workspace = true
serde_json = "1"
sha2.workspace = true
base64.workspace = true
regex = "1.11.1"

[dev-dependencies]
assert_matches = "1.5"
Loading

0 comments on commit a6ce1b1

Please sign in to comment.