├── bindings ├── wasm │ ├── identity_wasm │ │ ├── cypress │ │ │ ├── fixtures │ │ │ │ └── .gitkeep │ │ │ ├── plugins │ │ │ │ └── .gitkeep │ │ │ ├── support │ │ │ │ └── .gitkeep │ │ │ ├── app │ │ │ │ ├── src │ │ │ │ │ ├── main.ts │ │ │ │ │ ├── vite-env.d.ts │ │ │ │ │ └── identity.ts │ │ │ │ ├── package.json │ │ │ │ └── tsconfig.json │ │ │ ├── Dockerfile │ │ │ └── e2e │ │ │ │ └── tests.cy.js │ │ ├── .dockerignore │ │ ├── .cargo │ │ │ └── config.toml │ │ ├── tsconfig.typedoc.json │ │ ├── rust-toolchain.toml │ │ ├── tsconfig.node.json │ │ ├── src │ │ │ ├── revocation │ │ │ │ └── mod.rs │ │ │ ├── credential │ │ │ │ ├── revocation │ │ │ │ │ ├── mod.rs │ │ │ │ │ ├── validity_timeframe_2024 │ │ │ │ │ │ └── mod.rs │ │ │ │ │ └── status_list_2021 │ │ │ │ │ │ └── mod.rs │ │ │ │ ├── presentation │ │ │ │ │ └── mod.rs │ │ │ │ ├── jwt_presentation_validation │ │ │ │ │ └── mod.rs │ │ │ │ ├── jpt_presentiation_validation │ │ │ │ │ └── mod.rs │ │ │ │ ├── jpt_credential_validator │ │ │ │ │ └── mod.rs │ │ │ │ ├── jwt_credential_validation │ │ │ │ │ └── mod.rs │ │ │ │ ├── jws.rs │ │ │ │ └── jpt.rs │ │ │ ├── sd_jwt_vc │ │ │ │ ├── metadata │ │ │ │ │ └── mod.rs │ │ │ │ ├── sd_jwt_v2 │ │ │ │ │ └── mod.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── status.rs │ │ │ │ └── claims.rs │ │ │ ├── sd_jwt │ │ │ │ └── mod.rs │ │ │ ├── resolver │ │ │ │ ├── mod.rs │ │ │ │ └── resolver_types.rs │ │ │ ├── jose │ │ │ │ ├── mod.rs │ │ │ │ └── jwu.rs │ │ │ ├── common │ │ │ │ ├── mod.rs │ │ │ │ └── utils.rs │ │ │ ├── rebased │ │ │ │ └── mod.rs │ │ │ ├── iota │ │ │ │ ├── mod.rs │ │ │ │ └── iota_metadata_encoding.rs │ │ │ ├── jpt │ │ │ │ ├── mod.rs │ │ │ │ ├── jpt_claims.rs │ │ │ │ └── encoding.rs │ │ │ ├── verification │ │ │ │ ├── mod.rs │ │ │ │ └── wasm_method_relationship.rs │ │ │ ├── storage │ │ │ │ └── mod.rs │ │ │ └── did │ │ │ │ └── mod.rs │ │ ├── tsconfig.json │ │ ├── lib │ │ │ ├── jose │ │ │ │ ├── index.ts │ │ │ │ ├── jwk_use.ts │ │ │ │ ├── ed_curve.ts │ │ │ │ ├── ec_curve.ts │ │ │ │ ├── composite_jwk.ts │ │ │ │ ├── jwk_type.ts │ │ │ │ └── jwk_operation.ts │ │ │ ├── tsconfig.json │ │ │ ├── tsconfig.web.json │ │ │ ├── index.ts │ │ │ └── controller.ts │ │ ├── typedoc.json │ │ ├── examples │ │ │ ├── src │ │ │ │ └── tests │ │ │ │ │ ├── 8_zkp.ts │ │ │ │ │ ├── 6_sd_jwt.ts │ │ │ │ │ ├── 5_create_vc.ts │ │ │ │ │ ├── 6_create_vp.ts │ │ │ │ │ ├── 7_revoke_vc.ts │ │ │ │ │ ├── 10_sd_jwt_vc.ts │ │ │ │ │ ├── 0_create_did.ts │ │ │ │ │ ├── 1_update_did.ts │ │ │ │ │ ├── 2_resolve_did.ts │ │ │ │ │ ├── 4_delete_did.ts │ │ │ │ │ ├── 5_domain_linkage.ts │ │ │ │ │ ├── 9_zkp_revocation.ts │ │ │ │ │ ├── 7_status_list_2021.ts │ │ │ │ │ ├── 3_deactivate_did.ts │ │ │ │ │ ├── 4_custom_resolution.ts │ │ │ │ │ └── 12_iota_keytool_integration.ts │ │ │ └── tsconfig.web.json │ │ ├── .github_changelog_generator │ │ ├── tests │ │ │ ├── txm_readme.js │ │ │ └── txm_readme_rust.js │ │ └── proc_typescript │ │ │ └── Cargo.toml │ ├── .cargo │ │ └── config.toml │ ├── .license_template │ ├── .gitignore │ ├── tsconfig.json │ ├── typedoc.json │ └── build │ │ └── utils │ │ └── generatePackage.js └── grpc │ ├── tooling │ ├── start-rpc-server.sh │ ├── domain-linkage-test-server │ │ └── .well-known │ │ │ └── did-configuration.json │ └── start-http-server.sh │ ├── src │ ├── lib.rs │ ├── services │ │ ├── credential │ │ │ └── mod.rs │ │ ├── mod.rs │ │ └── health_check.rs │ └── server.rs │ ├── rustfmt.toml │ ├── proto │ ├── health_check.proto │ ├── utils.proto │ ├── document.proto │ └── sd_jwt.proto │ ├── build.rs │ ├── tests │ └── api │ │ ├── main.rs │ │ ├── health_check.rs │ │ └── did_document_creation.rs │ └── Dockerfile ├── .license_template_ignore ├── .dockerignore ├── identity_credential ├── tests │ └── fixtures │ │ ├── issuer-1.json │ │ ├── subject-3.json │ │ ├── status-1.json │ │ ├── subject-6.json │ │ ├── issuer-2.json │ │ ├── refresh-1.json │ │ ├── schema-2.json │ │ ├── schema-1.json │ │ ├── subject-4.json │ │ ├── subject-8.json │ │ ├── schema-3.json │ │ ├── subject-2.json │ │ ├── subject-7.json │ │ ├── subject-5.json │ │ ├── evidence-1.json │ │ ├── evidence-2.json │ │ ├── subject-1.json │ │ ├── policy-1.json │ │ ├── subject-9.json │ │ ├── policy-2.json │ │ ├── subject-10.json │ │ ├── credential-2.json │ │ ├── credential-3.json │ │ ├── credential-4.json │ │ ├── credential-6.json │ │ ├── credential-7.json │ │ ├── credential-10.json │ │ ├── credential-8.json │ │ ├── domain-config-valid.json │ │ ├── domain-config-invalid-context.json │ │ ├── credential-9.json │ │ ├── domain-config-extra-property.json │ │ ├── credential-1.json │ │ ├── credential-11.json │ │ ├── credential-5.json │ │ └── credential-12.json ├── src │ ├── revocation │ │ ├── revocation_bitmap_2022 │ │ │ └── mod.rs │ │ ├── validity_timeframe_2024 │ │ │ └── mod.rs │ │ ├── status_list_2021 │ │ │ └── mod.rs │ │ └── mod.rs │ ├── validator │ │ ├── sd_jwt │ │ │ └── mod.rs │ │ ├── jpt_credential_validation │ │ │ ├── mod.rs │ │ │ └── decoded_jpt_credential.rs │ │ ├── jpt_presentation_validation │ │ │ ├── mod.rs │ │ │ └── decoded_jpt_presentation.rs │ │ ├── jwt_presentation_validation │ │ │ └── mod.rs │ │ ├── jwt_credential_validation │ │ │ └── mod.rs │ │ └── mod.rs │ ├── sd_jwt_vc │ │ ├── metadata │ │ │ ├── mod.rs │ │ │ └── display.rs │ │ ├── mod.rs │ │ └── resolver.rs │ ├── domain_linkage │ │ └── mod.rs │ ├── utils.rs │ ├── credential │ │ ├── jws.rs │ │ ├── jpt.rs │ │ └── jwp_credential_options.rs │ ├── presentation │ │ ├── mod.rs │ │ └── jwp_presentation_options.rs │ └── lib.rs └── README.md ├── identity_verification ├── README.md ├── src │ ├── jose │ │ └── mod.rs │ ├── lib.rs │ └── verification_method │ │ ├── method_relationship.rs │ │ └── mod.rs └── Cargo.toml ├── .github ├── banner_identity.png ├── releases │ ├── v0.3.0.md │ ├── v0.5.0-dev.1.md │ ├── wasm-v0.5.0-dev.1.md │ ├── v0.5.0-dev.3.md │ ├── wasm-v0.5.0-dev.3.md │ ├── v0.5.0-dev.5.md │ ├── wasm-v0.5.0-dev.5.md │ ├── v1.0.0-rc.1.md │ ├── wasm-v1.0.0-rc.1.md │ ├── v0.7.0-alpha.1.md │ ├── wasm-v0.7.0-alpha.1.md │ ├── v0.6.0.md │ ├── wasm-v0.6.0.md │ ├── v0.5.0-dev.6.md │ └── wasm-v0.5.0-dev.6.md ├── workflows │ ├── scripts │ │ ├── array.sh │ │ ├── updateVersion.sh │ │ └── populate-changelog-descriptions.sh │ ├── enforce-pr-labels.yml │ ├── rust-create-hotfix-pr.yml │ ├── audit.yml │ ├── wasm-retag-npm.yml │ ├── wasm-create-hotfix-pr.yml │ ├── rust-publish-to-crates.yml │ ├── build-and-test-grpc.yml │ └── rust-automatic-release-and-publish.yml ├── ISSUE_TEMPLATE │ ├── config.yml │ ├── documentation-task.md │ ├── feature-request.md │ └── bug_report.md ├── actions │ ├── rust │ │ └── sccache │ │ │ └── stop-sccache │ │ │ └── action.yml │ └── publish │ │ └── publish-rust │ │ └── action.yml ├── .github_changelog_generator ├── CODEOWNERS └── pull_request_template.md ├── rust-toolchain.toml ├── identity_eddsa_verifier ├── README.md ├── src │ └── lib.rs └── Cargo.toml ├── identity_storage ├── src │ ├── key_id_storage │ │ ├── tests │ │ │ ├── mod.rs │ │ │ └── memstore.rs │ │ └── mod.rs │ ├── key_storage │ │ ├── tests │ │ │ ├── mod.rs │ │ │ └── memstore.rs │ │ ├── jwk_gen_output.rs │ │ ├── key_id.rs │ │ └── jwk_storage_pqc.rs │ ├── storage │ │ └── tests │ │ │ └── mod.rs │ └── lib.rs └── README.md ├── .license_template ├── identity_did ├── README.md ├── src │ ├── lib.rs │ └── error.rs └── Cargo.toml ├── identity_document ├── README.md ├── src │ ├── utils │ │ └── mod.rs │ ├── document │ │ └── mod.rs │ ├── verifiable │ │ ├── mod.rs │ │ └── jwp_verification_options.rs │ ├── service │ │ └── mod.rs │ └── lib.rs └── Cargo.toml ├── identity_ecdsa_verifier ├── README.md ├── src │ ├── tests │ │ └── mod.rs │ └── lib.rs └── Cargo.toml ├── identity_iota_core ├── src │ ├── did │ │ └── mod.rs │ ├── did_resolution │ │ └── mod.rs │ ├── rebased │ │ ├── assets │ │ │ └── mod.rs │ │ ├── client │ │ │ └── mod.rs │ │ ├── migration │ │ │ └── mod.rs │ │ ├── mod.rs │ │ └── iota │ │ │ ├── types │ │ │ ├── mod.rs │ │ │ └── number.rs │ │ │ └── move_calls │ │ │ └── mod.rs │ ├── state_metadata │ │ ├── mod.rs │ │ ├── encoding.rs │ │ └── version.rs │ ├── document │ │ ├── mod.rs │ │ └── test_utils.rs │ ├── iota_interaction_adapter.rs │ └── lib.rs ├── tests │ └── e2e │ │ ├── main.rs │ │ └── migration.rs ├── packages │ └── iota_identity │ │ ├── sources │ │ ├── proposals │ │ │ ├── delete.move │ │ │ ├── upgrade.move │ │ │ └── value.move │ │ ├── public_vc.move │ │ ├── utils.move │ │ └── permissions.move │ │ └── Move.toml └── scripts │ ├── publish_identity_package.sh │ └── upgrade_identity_package.sh ├── identity_stronghold ├── README.md └── src │ ├── tests │ └── mod.rs │ └── lib.rs ├── identity_jose ├── README.md └── src │ ├── jws │ ├── encoding │ │ └── mod.rs │ ├── custom_verification │ │ └── mod.rs │ ├── format.rs │ ├── mod.rs │ └── recipient.rs │ ├── jose │ ├── mod.rs │ └── traits.rs │ ├── jwu │ └── mod.rs │ ├── jwk │ ├── conversion │ │ ├── mod.rs │ │ ├── secp256k1.rs │ │ └── secp256r1.rs │ ├── curve │ │ ├── mod.rs │ │ ├── ecx.rs │ │ ├── ed.rs │ │ └── ec.rs │ ├── mod.rs │ └── key_use.rs │ ├── tests │ ├── mod.rs │ ├── rfc7638.rs │ ├── fixtures │ │ ├── rfc7638.rs │ │ ├── rfc8037_ed25519.rs │ │ └── rfc7797.rs │ └── rfc7517.rs │ ├── jwt │ └── mod.rs │ └── lib.rs ├── identity_resolver ├── README.md └── src │ ├── resolution │ ├── tests │ │ ├── mod.rs │ │ └── send_sync.rs │ └── mod.rs │ └── lib.rs ├── rustfmt.toml ├── identity_pqc_verifier ├── src │ └── lib.rs ├── README.md └── Cargo.toml ├── identity_core ├── src │ ├── convert │ │ └── mod.rs │ ├── lib.rs │ └── common │ │ ├── mod.rs │ │ └── key_comparable.rs └── tests │ └── custom_time.rs ├── .cargo └── audit.toml ├── dprint.json ├── .gitignore └── examples └── 0_basic └── 0_create_did.rs /bindings/wasm/identity_wasm/cypress/fixtures/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/cypress/plugins/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/cypress/support/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.license_template_ignore: -------------------------------------------------------------------------------- 1 | libjose/tests/fixtures/*.rs 2 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/.dockerignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | target 3 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | target/ 2 | bindings/wasm/identity_wasm 3 | bindings/grpc/target/ 4 | -------------------------------------------------------------------------------- /bindings/wasm/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | target = "wasm32-unknown-unknown" 3 | -------------------------------------------------------------------------------- /identity_credential/tests/fixtures/issuer-1.json: -------------------------------------------------------------------------------- 1 | "https://example.edu/issuers/14" 2 | -------------------------------------------------------------------------------- /identity_verification/README.md: -------------------------------------------------------------------------------- 1 | Verification data types and functionality for use with `identity_document`. -------------------------------------------------------------------------------- /.github/banner_identity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iotaledger/identity/HEAD/.github/banner_identity.png -------------------------------------------------------------------------------- /rust-toolchain.toml: -------------------------------------------------------------------------------- 1 | [toolchain] 2 | channel = "stable" 3 | components = ["rustfmt"] 4 | profile = "minimal" 5 | -------------------------------------------------------------------------------- /.github/releases/v0.3.0.md: -------------------------------------------------------------------------------- 1 | This release introduces the high-level `Account` API for creating and managing IOTA identities. -------------------------------------------------------------------------------- /bindings/wasm/.license_template: -------------------------------------------------------------------------------- 1 | // Copyright {20\d{2}(-20\d{2})?} IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | -------------------------------------------------------------------------------- /identity_credential/tests/fixtures/subject-3.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "did:example:abcdef1234567", 3 | "name": "Jane Doe" 4 | } 5 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/cypress/app/src/main.ts: -------------------------------------------------------------------------------- 1 | import { runTest } from "./identity.ts"; 2 | 3 | globalThis.runTest = runTest; 4 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [target.wasm32-unknown-unknown] 2 | rustflags = ['--cfg', 'getrandom_backend="wasm_js"'] 3 | -------------------------------------------------------------------------------- /.github/workflows/scripts/array.sh: -------------------------------------------------------------------------------- 1 | # joins an array with a delimiter 2 | joinBy() { 3 | local IFS="$1"; shift; echo "$*"; 4 | } 5 | 6 | "$@" -------------------------------------------------------------------------------- /identity_credential/tests/fixtures/status-1.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "https://example.edu/status/24", 3 | "type": "CredentialStatusList2017" 4 | } 5 | -------------------------------------------------------------------------------- /identity_credential/tests/fixtures/subject-6.json: -------------------------------------------------------------------------------- 1 | { 2 | "degreeType": "BachelorDegree", 3 | "degreeSchool": "College of Engineering" 4 | } 5 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/tsconfig.typedoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.node.json", 3 | "include": [ 4 | "node/**/*" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /identity_credential/tests/fixtures/issuer-2.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "did:example:76e12ec712ebc6f1c221ebfeb1f", 3 | "name": "Example University" 4 | } 5 | -------------------------------------------------------------------------------- /identity_credential/tests/fixtures/refresh-1.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "https://example.edu/refresh/3732", 3 | "type": "ManualRefreshService2018" 4 | } 5 | -------------------------------------------------------------------------------- /identity_credential/tests/fixtures/schema-2.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "https://example.org/examples/degree.zkp", 3 | "type": "ZkpExampleSchema2018" 4 | } 5 | -------------------------------------------------------------------------------- /identity_credential/tests/fixtures/schema-1.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "https://example.org/examples/degree.json", 3 | "type": "JsonSchemaValidator2018" 4 | } 5 | -------------------------------------------------------------------------------- /identity_credential/tests/fixtures/subject-4.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "did:example:abcdef1234567", 3 | "name": "Jane Doe", 4 | "favoriteFood": "Papaya" 5 | } 6 | -------------------------------------------------------------------------------- /identity_credential/tests/fixtures/subject-8.json: -------------------------------------------------------------------------------- 1 | { 2 | "degree": { 3 | "type": "BachelorDegree", 4 | "name": "Bachelor of Science and Arts" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /identity_eddsa_verifier/README.md: -------------------------------------------------------------------------------- 1 | IOTA Identity - EdDSA Verifier 2 | === 3 | 4 | This crate implements a `JwsVerifier` capable of verifying EdDSA signatures. 5 | 6 | -------------------------------------------------------------------------------- /identity_storage/src/key_id_storage/tests/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | mod memstore; 5 | mod utils; 6 | -------------------------------------------------------------------------------- /.license_template: -------------------------------------------------------------------------------- 1 | {(\/\/ Copyright.*\n)*?}// {(Modifications )?}Copyright {(\(c\) )?}{20\d{2}(-20\d{2})?} IOTA Stiftung{(?:, .+)?} 2 | // SPDX-License-Identifier: Apache-2.0 3 | -------------------------------------------------------------------------------- /identity_did/README.md: -------------------------------------------------------------------------------- 1 | IOTA Identity - DID 2 | === 3 | 4 | Types representing DIDs and DIDUrls as defined in the Decentralized Identifiers (DID) standard by the W3C. 5 | 6 | -------------------------------------------------------------------------------- /identity_document/README.md: -------------------------------------------------------------------------------- 1 | IOTA Identity - Document 2 | === 3 | 4 | Method-agnostic implementation of DID Documents from the Decentralized Identifiers (DID) standard from W3C. -------------------------------------------------------------------------------- /identity_ecdsa_verifier/README.md: -------------------------------------------------------------------------------- 1 | # ECDSA Verifier 2 | 3 | This crate implements a `JwsVerifier` capable of verifying EcDSA signatures with algorithms `ES256` and `ES256K`. 4 | -------------------------------------------------------------------------------- /identity_iota_core/src/did/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | pub use iota_did::IotaDID; 5 | 6 | mod iota_did; 7 | -------------------------------------------------------------------------------- /identity_stronghold/README.md: -------------------------------------------------------------------------------- 1 | IOTA Identity - Stronghold 2 | === 3 | 4 | This crate provides an implementation of `JwkStorage` and `KeyIdStorage` traits on top of `Stronghold`. -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/rust-toolchain.toml: -------------------------------------------------------------------------------- 1 | [toolchain] 2 | channel = "stable" 3 | components = ["rustfmt"] 4 | targets = ["wasm32-unknown-unknown"] 5 | profile = "minimal" 6 | -------------------------------------------------------------------------------- /identity_ecdsa_verifier/src/tests/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung, Filancore GmbH 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | mod secp256; 5 | mod secp256k; 6 | -------------------------------------------------------------------------------- /identity_jose/README.md: -------------------------------------------------------------------------------- 1 | IOTA Identity - JOSE 2 | === 3 | 4 | This crate provides a pluggable JSON Object Signing and Encryption (JOSE) implementation for use in IOTA Identity. 5 | -------------------------------------------------------------------------------- /identity_jose/src/jws/encoding/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | mod encoder; 5 | mod utils; 6 | 7 | pub use encoder::*; 8 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/tsconfig.node.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "esModuleInterop": true, 5 | "module": "commonjs" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /bindings/grpc/tooling/start-rpc-server.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd .. 3 | 4 | API_ENDPOINT=replace_me \ 5 | STRONGHOLD_PWD=replace_me \ 6 | SNAPSHOT_PATH=replace_me \ 7 | cargo +nightly run --release 8 | -------------------------------------------------------------------------------- /identity_credential/tests/fixtures/schema-3.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "did:example:cdf:35LB7w9ueWbagPL94T9bMLtyXDj9pX5o", 3 | "type": "did:example:schema:22KpkXgecryx9k7N6XN1QoN3gXwBkSU8SfyyYQG" 4 | } 5 | -------------------------------------------------------------------------------- /identity_resolver/README.md: -------------------------------------------------------------------------------- 1 | IOTA Identity - Resolver 2 | === 3 | 4 | This crate provides a pluggable Resolver implementation that allows for abstracting over the resolution of different DID methods. 5 | -------------------------------------------------------------------------------- /identity_resolver/src/resolution/tests/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2022 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | use super::resolver::*; 5 | mod resolution; 6 | mod send_sync; 7 | -------------------------------------------------------------------------------- /identity_storage/src/key_storage/tests/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | mod memstore; 5 | 6 | #[cfg(test)] 7 | pub(crate) mod utils; 8 | -------------------------------------------------------------------------------- /bindings/grpc/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #![allow(clippy::blocks_in_conditions)] 5 | 6 | pub mod server; 7 | pub mod services; 8 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/src/revocation/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2022 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | mod bitmap; 5 | 6 | pub use self::bitmap::WasmRevocationBitmap; 7 | -------------------------------------------------------------------------------- /identity_jose/src/jose/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | //! Traits for JOSE headers. 5 | 6 | mod traits; 7 | 8 | pub use self::traits::*; 9 | -------------------------------------------------------------------------------- /identity_iota_core/tests/e2e/main.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | mod asset; 5 | mod client; 6 | pub mod common; 7 | mod identity; 8 | mod migration; 9 | -------------------------------------------------------------------------------- /identity_storage/README.md: -------------------------------------------------------------------------------- 1 | IOTA Identity - Storage 2 | === 3 | 4 | This crate provides high-level abstractions over key management systems for secure storage of cryptographic keys for use in IOTA Identity. 5 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/src/credential/revocation/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | pub mod status_list_2021; 5 | pub mod validity_timeframe_2024; 6 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/src/credential/revocation/validity_timeframe_2024/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | mod status; 5 | 6 | pub use status::*; 7 | -------------------------------------------------------------------------------- /identity_credential/tests/fixtures/subject-2.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "did:example:ebfeb1f712ebc6f1c276e12ec21", 3 | "degree": { 4 | "type": "BachelorDegree", 5 | "name": "Bachelor of Science and Arts" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /identity_iota_core/src/did_resolution/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2022 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | pub use did_resolution_handler::DidResolutionHandler; 5 | 6 | mod did_resolution_handler; 7 | -------------------------------------------------------------------------------- /identity_jose/src/jws/custom_verification/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | mod error; 5 | mod jws_verifier; 6 | pub use error::*; 7 | pub use jws_verifier::*; 8 | -------------------------------------------------------------------------------- /identity_stronghold/src/tests/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | mod test_bbs_ext; 5 | mod test_jwk_storage; 6 | mod test_key_id_storage; 7 | pub(crate) mod utils; 8 | -------------------------------------------------------------------------------- /identity_credential/tests/fixtures/subject-7.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "http://example.com/credentials/245", 3 | "currentStatus": "Disputed", 4 | "statusReason": { 5 | "value": "Address is out of date.", 6 | "lang": "en" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /identity_iota_core/src/rebased/assets/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | mod asset; 5 | mod public_available_vc; 6 | 7 | pub use asset::*; 8 | pub use public_available_vc::*; 9 | -------------------------------------------------------------------------------- /rustfmt.toml: -------------------------------------------------------------------------------- 1 | comment_width = 120 2 | format_code_in_doc_comments = true 3 | max_width = 120 4 | normalize_comments = false 5 | normalize_doc_attributes = false 6 | tab_spaces = 2 7 | wrap_comments = true 8 | imports_granularity = "Item" 9 | -------------------------------------------------------------------------------- /identity_credential/src/revocation/revocation_bitmap_2022/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | mod bitmap; 5 | mod document_ext; 6 | 7 | pub use bitmap::*; 8 | pub use document_ext::*; 9 | -------------------------------------------------------------------------------- /identity_pqc_verifier/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2025 IOTA Stiftung, Fondazione Links 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | mod oqs_verifier; 5 | mod pqc_verifier; 6 | 7 | pub use oqs_verifier::*; 8 | pub use pqc_verifier::*; 9 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Official IOTA Discord 4 | url: https://discord.iota.org/ 5 | about: "Contact the maintainers by joining the #identity channel on the IOTA Discord." 6 | -------------------------------------------------------------------------------- /bindings/grpc/rustfmt.toml: -------------------------------------------------------------------------------- 1 | comment_width = 120 2 | format_code_in_doc_comments = true 3 | max_width = 120 4 | normalize_comments = false 5 | normalize_doc_attributes = false 6 | tab_spaces = 2 7 | wrap_comments = true 8 | imports_granularity = "Item" 9 | -------------------------------------------------------------------------------- /bindings/grpc/tooling/domain-linkage-test-server/.well-known/did-configuration.json: -------------------------------------------------------------------------------- 1 | { 2 | "@context": "https://identity.foundation/.well-known/did-configuration/v1", 3 | "linked_dids": [ 4 | "add your domain linkage credential here" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "baseUrl": ".", 5 | "paths": { 6 | "@iota/identity-wasm/*": [ 7 | "./*" 8 | ] 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /identity_jose/src/jwu/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | //! JSON Web Utilities. 5 | 6 | mod base64; 7 | mod serde; 8 | 9 | pub use self::base64::*; 10 | pub(crate) use self::serde::*; 11 | -------------------------------------------------------------------------------- /bindings/grpc/tooling/start-http-server.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | http-server ./domain-linkage-test-server & 3 | # replace or omint the --domain parameter if you don't have a static domain or don't want to use it 4 | ngrok http --domain=example-static-domain.ngrok-free.app 8080 -------------------------------------------------------------------------------- /identity_pqc_verifier/README.md: -------------------------------------------------------------------------------- 1 | IOTA Identity - PQC Verifier 2 | === 3 | 4 | This crate implements a `JwsVerifier` capable of verifying Post-Quantum (PQ) signatures, based on [liboqs-rust](https://github.com/open-quantum-safe/liboqs-rust) signatures implementation. -------------------------------------------------------------------------------- /identity_credential/tests/fixtures/subject-5.json: -------------------------------------------------------------------------------- 1 | { 2 | "givenName": "Jane", 3 | "familyName": "Doe", 4 | "degree": { 5 | "type": "BachelorDegree", 6 | "name": "Bachelor of Science and Arts", 7 | "college": "College of Engineering" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/lib/jose/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./composite_jwk"; 2 | export * from "./ec_curve"; 3 | export * from "./ed_curve"; 4 | export * from "./jwk_operation"; 5 | export * from "./jwk_type"; 6 | export * from "./jwk_use"; 7 | export * from "./jws_algorithm"; 8 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/src/sd_jwt_vc/metadata/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | mod claim; 5 | mod issuer; 6 | mod vc_type; 7 | 8 | pub use claim::*; 9 | pub use issuer::*; 10 | pub use vc_type::*; 11 | -------------------------------------------------------------------------------- /identity_iota_core/src/state_metadata/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2022 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | mod document; 5 | mod encoding; 6 | mod version; 7 | 8 | pub use document::*; 9 | pub use encoding::*; 10 | pub(crate) use version::*; 11 | -------------------------------------------------------------------------------- /identity_jose/src/jwk/conversion/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2025 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | mod ed25519; 5 | mod from_jwk; 6 | mod secp256k1; 7 | mod secp256r1; 8 | mod to_jwk; 9 | 10 | pub use from_jwk::*; 11 | pub use to_jwk::*; 12 | -------------------------------------------------------------------------------- /identity_jose/src/tests/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | mod ed25519; 5 | mod es256; 6 | mod hs256; 7 | mod rfc7515; 8 | mod rfc7517; 9 | mod rfc7638; 10 | mod rfc7797; 11 | mod rfc8037; 12 | mod roundtrip; 13 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/src/credential/presentation/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | mod presentation; 5 | mod presentation_builder; 6 | 7 | pub use self::presentation::*; 8 | pub use self::presentation_builder::*; 9 | -------------------------------------------------------------------------------- /identity_storage/src/storage/tests/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | mod api; 5 | mod credential_jws; 6 | mod credential_validation; 7 | mod kb_jwt; 8 | mod presentation_validation; 9 | pub(crate) mod test_utils; 10 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/cypress/app/src/vite-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | declare const IOTA_IDENTITY_PKG_ID: string; 3 | declare const NETWORK_NAME_FAUCET: string; 4 | declare const ENV_NETWORK_URL: string; 5 | declare const runTest: (example: string) => void; 6 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/typedoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@iota/identity-wasm API documentation", 3 | "extends": [ 4 | "../typedoc.json" 5 | ], 6 | "entryPoints": [ 7 | "./node/" 8 | ], 9 | "tsconfig": "./tsconfig.typedoc.json", 10 | "out": "./docs/wasm" 11 | } -------------------------------------------------------------------------------- /identity_jose/src/jwk/curve/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | mod bls; 5 | mod ec; 6 | mod ecx; 7 | mod ed; 8 | 9 | pub use self::bls::*; 10 | pub use self::ec::*; 11 | pub use self::ecx::*; 12 | pub use self::ed::*; 13 | -------------------------------------------------------------------------------- /identity_jose/src/jwt/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | //! JSON Web Tokens ([JWT](https://tools.ietf.org/html/rfc7519)) 5 | 6 | mod claims; 7 | mod header; 8 | 9 | pub use self::claims::*; 10 | pub use self::header::*; 11 | -------------------------------------------------------------------------------- /identity_credential/src/validator/sd_jwt/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | mod error; 5 | mod kb_validation_options; 6 | mod validator; 7 | 8 | pub use error::*; 9 | pub use kb_validation_options::*; 10 | pub use validator::*; 11 | -------------------------------------------------------------------------------- /identity_document/src/utils/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | //! Functionality for Querying DID Urls. 5 | pub use did_url_query::DIDUrlQuery; 6 | pub use queryable::Queryable; 7 | 8 | mod did_url_query; 9 | mod queryable; 10 | -------------------------------------------------------------------------------- /identity_iota_core/src/rebased/client/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | mod full_client; 5 | mod read_only; 6 | 7 | pub use full_client::*; 8 | 9 | pub use read_only::*; 10 | 11 | pub use iota_interaction::IotaKeySignature; 12 | -------------------------------------------------------------------------------- /identity_eddsa_verifier/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #[cfg(feature = "ed25519")] 5 | mod ed25519_verifier; 6 | mod eddsa_verifier; 7 | 8 | #[cfg(feature = "ed25519")] 9 | pub use ed25519_verifier::*; 10 | pub use eddsa_verifier::*; 11 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/examples/src/tests/8_zkp.ts: -------------------------------------------------------------------------------- 1 | import { zkp } from "../1_advanced/8_zkp"; 2 | 3 | // Only verifies that no uncaught exceptions are thrown, including syntax errors etc. 4 | describe("Test node examples", function() { 5 | it("zkp", async () => { 6 | await zkp(); 7 | }); 8 | }); 9 | -------------------------------------------------------------------------------- /identity_iota_core/packages/iota_identity/sources/proposals/delete.move: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | module iota_identity::delete_proposal; 5 | 6 | public struct Delete has copy, drop, store {} 7 | 8 | public fun new(): Delete { 9 | Delete {} 10 | } 11 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/src/credential/revocation/status_list_2021/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | mod credential; 5 | mod entry; 6 | mod status_list; 7 | 8 | pub use credential::*; 9 | pub use entry::*; 10 | pub use status_list::WasmStatusList2021; 11 | -------------------------------------------------------------------------------- /identity_iota_core/packages/iota_identity/Move.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2024 IOTA Stiftung 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | [package] 5 | name = "IotaIdentity" 6 | edition = "2024" 7 | 8 | [dependencies] 9 | 10 | [addresses] 11 | iota_identity = "0x0" 12 | 13 | [dev-dependencies] 14 | 15 | [dev-addresses] 16 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/examples/src/tests/6_sd_jwt.ts: -------------------------------------------------------------------------------- 1 | import { sdJwt } from "../1_advanced/6_sd_jwt"; 2 | 3 | // Only verifies that no uncaught exceptions are thrown, including syntax errors etc. 4 | describe("Test node examples", function() { 5 | it("Domain Linkage", async () => { 6 | await sdJwt(); 7 | }); 8 | }); 9 | -------------------------------------------------------------------------------- /identity_stronghold/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | pub(crate) mod ed25519; 5 | mod storage; 6 | pub(crate) mod stronghold_key_type; 7 | #[cfg(test)] 8 | mod tests; 9 | pub(crate) mod utils; 10 | 11 | pub use storage::*; 12 | pub use stronghold_key_type::*; 13 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/examples/src/tests/5_create_vc.ts: -------------------------------------------------------------------------------- 1 | import { createVC } from "../0_basic/5_create_vc"; 2 | 3 | // Only verifies that no uncaught exceptions are thrown, including syntax errors etc. 4 | describe("Test node examples", function() { 5 | it("Create VC", async () => { 6 | await createVC(); 7 | }); 8 | }); 9 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/examples/src/tests/6_create_vp.ts: -------------------------------------------------------------------------------- 1 | import { createVP } from "../0_basic/6_create_vp"; 2 | 3 | // Only verifies that no uncaught exceptions are thrown, including syntax errors etc. 4 | describe("Test node examples", function() { 5 | it("Create VP", async () => { 6 | await createVP(); 7 | }); 8 | }); 9 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/examples/src/tests/7_revoke_vc.ts: -------------------------------------------------------------------------------- 1 | import { revokeVC } from "../0_basic/7_revoke_vc"; 2 | 3 | // Only verifies that no uncaught exceptions are thrown, including syntax errors etc. 4 | describe("Test node examples", function() { 5 | it("Revoke VC", async () => { 6 | await revokeVC(); 7 | }); 8 | }); 9 | -------------------------------------------------------------------------------- /identity_credential/src/revocation/validity_timeframe_2024/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung, Fondazione Links 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | //! Implementation of a new Revocation mechanism for ZK Verifiable Credentials. 5 | 6 | mod revocation_timeframe_status; 7 | 8 | pub use revocation_timeframe_status::*; 9 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/examples/src/tests/10_sd_jwt_vc.ts: -------------------------------------------------------------------------------- 1 | import { sdJwtVc } from "../1_advanced/10_sd_jwt_vc"; 2 | 3 | // Only verifies that no uncaught exceptions are thrown, including syntax errors etc. 4 | describe("Test node examples", function() { 5 | it("SD-JWT VC", async () => { 6 | await sdJwtVc(); 7 | }); 8 | }); 9 | -------------------------------------------------------------------------------- /identity_credential/tests/fixtures/evidence-1.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "https://example.edu/evidence/f2aeec97-fc0d-42bf-8ca7-0548192d4231", 3 | "type": ["DocumentVerification"], 4 | "verifier": "https://example.edu/issuers/14", 5 | "evidenceDocument": "DriversLicense", 6 | "subjectPresence": "Physical", 7 | "documentPresence": "Physical" 8 | } 9 | -------------------------------------------------------------------------------- /identity_iota_core/src/document/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | pub use iota_document::IotaDocument; 5 | pub use iota_document_metadata::IotaDocumentMetadata; 6 | 7 | mod iota_document; 8 | mod iota_document_metadata; 9 | 10 | #[cfg(test)] 11 | pub(crate) mod test_utils; 12 | -------------------------------------------------------------------------------- /identity_credential/tests/fixtures/evidence-2.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "https://example.edu/evidence/f2aeec97-fc0d-42bf-8ca7-0548192dxyzab", 3 | "type": ["SupportingActivity"], 4 | "verifier": "https://example.edu/issuers/14", 5 | "evidenceDocument": "Fluid Dynamics Focus", 6 | "subjectPresence": "Digital", 7 | "documentPresence": "Digital" 8 | } 9 | -------------------------------------------------------------------------------- /identity_credential/src/sd_jwt_vc/metadata/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | mod claim; 5 | mod display; 6 | mod integrity; 7 | mod issuer; 8 | mod vc_type; 9 | 10 | pub use claim::*; 11 | pub use display::*; 12 | pub use integrity::*; 13 | pub use issuer::*; 14 | pub use vc_type::*; 15 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/examples/src/tests/0_create_did.ts: -------------------------------------------------------------------------------- 1 | import { createIdentity } from "../0_basic/0_create_did"; 2 | 3 | // Only verifies that no uncaught exceptions are thrown, including syntax errors etc. 4 | describe("Test node examples", function() { 5 | it("Create Identity", async () => { 6 | await createIdentity(); 7 | }); 8 | }); 9 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/examples/src/tests/1_update_did.ts: -------------------------------------------------------------------------------- 1 | import { updateIdentity } from "../0_basic/1_update_did"; 2 | 3 | // Only verifies that no uncaught exceptions are thrown, including syntax errors etc. 4 | describe("Test node examples", function() { 5 | it("Update Identity", async () => { 6 | await updateIdentity(); 7 | }); 8 | }); 9 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/examples/src/tests/2_resolve_did.ts: -------------------------------------------------------------------------------- 1 | import { resolveIdentity } from "../0_basic/2_resolve_did"; 2 | 3 | // Only verifies that no uncaught exceptions are thrown, including syntax errors etc. 4 | describe("Test node examples", function() { 5 | it("Resolve Identity", async () => { 6 | await resolveIdentity(); 7 | }); 8 | }); 9 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/examples/src/tests/4_delete_did.ts: -------------------------------------------------------------------------------- 1 | import { deleteIdentityDID } from "../0_basic/4_delete_did"; 2 | 3 | // Only verifies that no uncaught exceptions are thrown, including syntax errors etc. 4 | describe("Test node examples", function() { 5 | it("Delete identity", async () => { 6 | await deleteIdentityDID(); 7 | }); 8 | }); 9 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/examples/src/tests/5_domain_linkage.ts: -------------------------------------------------------------------------------- 1 | import { domainLinkage } from "../1_advanced/5_domain_linkage"; 2 | 3 | // Only verifies that no uncaught exceptions are thrown, including syntax errors etc. 4 | describe("Test node examples", function() { 5 | it("Domain Linkage", async () => { 6 | await domainLinkage(); 7 | }); 8 | }); 9 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/examples/src/tests/9_zkp_revocation.ts: -------------------------------------------------------------------------------- 1 | import { zkp_revocation } from "../1_advanced/9_zkp_revocation"; 2 | 3 | // Only verifies that no uncaught exceptions are thrown, including syntax errors etc. 4 | describe("Test node examples", function() { 5 | it("zkp_revocation", async () => { 6 | await zkp_revocation(); 7 | }); 8 | }); 9 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/lib/jose/jwk_use.ts: -------------------------------------------------------------------------------- 1 | /** Supported algorithms for the JSON Web Key `use` property. 2 | * 3 | * [More Info](https://www.iana.org/assignments/jose/jose.xhtml#web-key-use) */ 4 | export const enum JwkUse { 5 | /** Digital Signature or MAC. */ 6 | Signature = "sig", 7 | /** Encryption. */ 8 | Encryption = "enc", 9 | } 10 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/examples/src/tests/7_status_list_2021.ts: -------------------------------------------------------------------------------- 1 | import { statusList2021 } from "../1_advanced/7_status_list_2021"; 2 | 3 | // Only verifies that no uncaught exceptions are thrown, including syntax errors etc. 4 | describe("Test node examples", function() { 5 | it("StatusList2021", async () => { 6 | await statusList2021(); 7 | }); 8 | }); 9 | -------------------------------------------------------------------------------- /identity_core/src/convert/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2021 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | //! Functionality for JSON conversion and Base de- and encoding. 5 | 6 | pub use self::json::FmtJson; 7 | pub use self::json::FromJson; 8 | pub use self::json::ToJson; 9 | pub use base_encoding::*; 10 | 11 | mod base_encoding; 12 | mod json; 13 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/examples/src/tests/3_deactivate_did.ts: -------------------------------------------------------------------------------- 1 | import { deactivateIdentity } from "../0_basic/3_deactivate_did"; 2 | 3 | // Only verifies that no uncaught exceptions are thrown, including syntax errors etc. 4 | describe("Test node examples", function() { 5 | it("Deactivate identity", async () => { 6 | await deactivateIdentity(); 7 | }); 8 | }); 9 | -------------------------------------------------------------------------------- /identity_credential/tests/fixtures/subject-1.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "did:example:ebfeb1f712ebc6f1c276e12ec21", 3 | "alumniOf": { 4 | "id": "did:example:c276e12ec21ebfeb1f712ebc6f1", 5 | "name": [{ 6 | "value": "Example University", 7 | "lang": "en" 8 | }, { 9 | "value": "Exemple d'Université", 10 | "lang": "fr" 11 | }] 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /.github/releases/v0.5.0-dev.1.md: -------------------------------------------------------------------------------- 1 | This release introduces multiple breaking changes to the structure of IOTA DID Documents and their Tangle messages, rendering any identity created with a prior version incompatible and unresolvable. A versioning system has been introduced so any new identities should hopefully be forward compatible with any future breaking changes to the message structure. -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/examples/src/tests/4_custom_resolution.ts: -------------------------------------------------------------------------------- 1 | import { customResolution } from "../1_advanced/4_custom_resolution"; 2 | 3 | // Only verifies that no uncaught exceptions are thrown, including syntax errors etc. 4 | describe("Test node examples", function() { 5 | it("Custom Resolution", async () => { 6 | await customResolution(); 7 | }); 8 | }); 9 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/lib/jose/ed_curve.ts: -------------------------------------------------------------------------------- 1 | /** Supported Elliptic Curves. 2 | * 3 | * [More Info](https://www.iana.org/assignments/jose/jose.xhtml#web-key-elliptic-curve) */ 4 | export const enum EdCurve { 5 | /** Ed25519 signature algorithm key pairs. */ 6 | Ed25519 = "Ed25519", 7 | /** Ed448 signature algorithm key pairs. */ 8 | Ed448 = "Ed448", 9 | } 10 | -------------------------------------------------------------------------------- /.github/releases/wasm-v0.5.0-dev.1.md: -------------------------------------------------------------------------------- 1 | This release introduces multiple breaking changes to the structure of IOTA DID Documents and their Tangle messages, rendering any identity created with a prior version incompatible and unresolvable. A versioning system has been introduced so any new identities should hopefully be forward compatible with any future breaking changes to the message structure. -------------------------------------------------------------------------------- /identity_document/src/document/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | //! Defines the core (implementation agnostic) DID Document type. 5 | 6 | #![allow(clippy::module_inception)] 7 | 8 | pub use self::builder::DocumentBuilder; 9 | pub use self::core_document::CoreDocument; 10 | 11 | mod builder; 12 | mod core_document; 13 | -------------------------------------------------------------------------------- /identity_iota_core/src/rebased/migration/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | mod alias; 5 | mod controller_token; 6 | mod identity; 7 | mod multicontroller; 8 | mod registry; 9 | 10 | pub use alias::*; 11 | pub use controller_token::*; 12 | pub use identity::*; 13 | pub use multicontroller::*; 14 | pub use registry::*; 15 | -------------------------------------------------------------------------------- /bindings/grpc/proto/health_check.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | syntax = "proto3"; 5 | package health_check; 6 | 7 | message HealthCheckRequest {} 8 | 9 | message HealthCheckResponse { 10 | string status = 1; 11 | } 12 | 13 | service HealthCheck { 14 | rpc Check(HealthCheckRequest) returns (HealthCheckResponse); 15 | } -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/src/sd_jwt/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | mod decoder; 5 | mod disclosure; 6 | mod encoder; 7 | mod key_binding_jwt_claims; 8 | mod wasm_sd_jwt; 9 | 10 | pub use decoder::*; 11 | pub use disclosure::*; 12 | pub use encoder::*; 13 | pub use key_binding_jwt_claims::*; 14 | pub use wasm_sd_jwt::*; 15 | -------------------------------------------------------------------------------- /bindings/wasm/.gitignore: -------------------------------------------------------------------------------- 1 | # Rust 2 | target/ 3 | Cargo.lock 4 | 5 | # npm / yarn 6 | node_modules/ 7 | 8 | # Build artifacts 9 | web/ 10 | node/ 11 | pkg/ 12 | **/dist/ 13 | 14 | # cypress 15 | cypress/screenshots/ 16 | cypress/videos/ 17 | 18 | # files generated by cypress-parallel 19 | multi-reporter-config.json 20 | runner-results 21 | cypress/parallel-weights.json 22 | 23 | .DS_STORE 24 | -------------------------------------------------------------------------------- /.github/actions/rust/sccache/stop-sccache/action.yml: -------------------------------------------------------------------------------- 1 | name: 'stop-sccache' 2 | description: 'Stop sccache.' 3 | inputs: 4 | os: 5 | description: 'OS of the runner, used for sccache installation and start.' 6 | required: true 7 | runs: 8 | using: "composite" 9 | steps: 10 | 11 | - name: Stop sccache 12 | shell: bash 13 | run: | 14 | sccache --stop-server || true -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/src/resolver/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | mod irl_resolver; 5 | mod resolver_config; 6 | mod resolver_types; 7 | mod wasm_did_resolution_handler; 8 | mod wasm_resolver; 9 | 10 | pub use irl_resolver::*; 11 | pub use resolver_types::*; 12 | pub use wasm_did_resolution_handler::WasmDidResolutionHandler; 13 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/src/sd_jwt_vc/sd_jwt_v2/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | mod builder; 5 | mod disclosure; 6 | mod hasher; 7 | mod kb_jwt; 8 | mod sd_jwt; 9 | mod signer; 10 | 11 | pub use builder::*; 12 | pub use disclosure::*; 13 | pub use hasher::*; 14 | pub use kb_jwt::*; 15 | pub use sd_jwt::*; 16 | pub use signer::*; 17 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/lib/jose/ec_curve.ts: -------------------------------------------------------------------------------- 1 | /** Supported Elliptic Curves. 2 | * 3 | * [More Info](https://www.iana.org/assignments/jose/jose.xhtml#web-key-elliptic-curve) */ 4 | export const enum EcCurve { 5 | /** P-256 Curve. */ 6 | P256, 7 | /** P-384 Curve. */ 8 | P384, 9 | /** P-521 Curve. */ 10 | P521, 11 | /** SECG secp256k1 curve. */ 12 | Secp256K1, 13 | } 14 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/src/jose/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2025 IOTA Stiftung, Fondazione LINKS 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | mod compositejwk; 5 | mod decoded_jws; 6 | mod jwk; 7 | mod jws_header; 8 | mod jwu; 9 | mod types; 10 | 11 | pub use compositejwk::*; 12 | pub use decoded_jws::*; 13 | pub use jwk::*; 14 | pub use jws_header::*; 15 | pub use jwu::*; 16 | pub use types::*; 17 | -------------------------------------------------------------------------------- /identity_document/src/verifiable/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | //! Additional functionality for DID assisted digital signatures. 5 | 6 | pub use self::jwp_verification_options::JwpVerificationOptions; 7 | pub use self::jws_verification_options::JwsVerificationOptions; 8 | 9 | mod jwp_verification_options; 10 | mod jws_verification_options; 11 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/examples/src/tests/12_iota_keytool_integration.ts: -------------------------------------------------------------------------------- 1 | import { iotaKeytoolIntegration } from "../1_advanced/12_iota_keytool_integration"; 2 | 3 | // Only verifies that no uncaught exceptions are thrown, including syntax errors etc. 4 | describe("Test node examples", function() { 5 | it("IOTA Keytool Integration", async () => { 6 | await iotaKeytoolIntegration(); 7 | }); 8 | }); 9 | -------------------------------------------------------------------------------- /identity_credential/tests/fixtures/policy-1.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "IssuerPolicy", 3 | "id": "http://example.com/policies/credential/4", 4 | "profile": "http://example.com/profiles/credential", 5 | "prohibition": [{ 6 | "assigner": "https://example.edu/issuers/14", 7 | "assignee": "AllVerifiers", 8 | "target": "http://example.edu/credentials/3732", 9 | "action": ["Archival"] 10 | }] 11 | } 12 | -------------------------------------------------------------------------------- /.github/releases/v0.5.0-dev.3.md: -------------------------------------------------------------------------------- 1 | This release introduces a breaking change for diff updates created by versions `v0.5.0-dev.1` and `v0.5.0-dev.2` (previous diff updates from `<=v0.4.0` are already incompatible due to breaking changes to the document and message structure in `v0.5.0-dev.1`). To migrate, please publish an integration update containing all diff changes to prevent unexpected changes to resolved DID Documents. 2 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/src/sd_jwt_vc/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | mod builder; 5 | mod claims; 6 | pub mod metadata; 7 | mod presentation; 8 | mod resolver; 9 | pub mod sd_jwt_v2; 10 | mod status; 11 | mod token; 12 | 13 | pub use builder::*; 14 | pub use claims::*; 15 | pub use presentation::*; 16 | pub use status::*; 17 | pub use token::*; 18 | -------------------------------------------------------------------------------- /.github/releases/wasm-v0.5.0-dev.3.md: -------------------------------------------------------------------------------- 1 | This release introduces a breaking change for diff updates created by versions `v0.5.0-dev.1` and `v0.5.0-dev.2` (previous diff updates from `<=v0.4.0` are already incompatible due to breaking changes to the document and message structure in `v0.5.0-dev.1`). To migrate, please publish an integration update containing all diff changes to prevent unexpected changes to resolved DID Documents. 2 | -------------------------------------------------------------------------------- /identity_credential/tests/fixtures/subject-9.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "did:example:ebfeb1f712ebc6f1c276e12ec21", 3 | "image": "https://example.edu/images/58473", 4 | "alumniOf": { 5 | "id": "did:example:c276e12ec21ebfeb1f712ebc6f1", 6 | "name": [{ 7 | "value": "Example University", 8 | "lang": "en" 9 | }, { 10 | "value": "Exemple d'Université", 11 | "lang": "fr" 12 | }] 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /identity_document/src/service/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | //! Implements the DID Document Service specification. 5 | #![allow(clippy::module_inception)] 6 | 7 | mod builder; 8 | mod service; 9 | mod service_endpoint; 10 | 11 | pub use self::builder::ServiceBuilder; 12 | pub use self::service::Service; 13 | pub use self::service_endpoint::ServiceEndpoint; 14 | -------------------------------------------------------------------------------- /identity_storage/src/key_id_storage/tests/memstore.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | use crate::key_id_storage::memstore::KeyIdMemstore; 5 | 6 | use crate::key_id_storage::tests::utils::test_storage_operations; 7 | 8 | #[tokio::test] 9 | async fn test_memstore() { 10 | let memstore: KeyIdMemstore = KeyIdMemstore::new(); 11 | test_storage_operations(memstore).await; 12 | } 13 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/src/common/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2022 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | pub use timestamp::*; 5 | pub use types::*; 6 | pub(crate) use utils::*; 7 | 8 | pub(crate) use self::imported_document_lock::ImportedDocumentLock; 9 | pub(crate) use self::imported_document_lock::ImportedDocumentReadGuard; 10 | 11 | mod imported_document_lock; 12 | mod timestamp; 13 | mod types; 14 | mod utils; 15 | -------------------------------------------------------------------------------- /identity_credential/tests/fixtures/policy-2.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "HolderPolicy", 3 | "id": "http://example.com/policies/credential/6", 4 | "profile": "http://example.com/profiles/credential", 5 | "prohibition": [{ 6 | "assigner": "did:example:ebfeb1f712ebc6f1c276e12ec21", 7 | "assignee": "https://wineonline.example.org/", 8 | "target": "http://example.edu/credentials/3732", 9 | "action": ["3rdPartyCorrelation"] 10 | }] 11 | } 12 | -------------------------------------------------------------------------------- /identity_iota_core/packages/iota_identity/sources/proposals/upgrade.move: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | module iota_identity::upgrade_proposal; 5 | 6 | /// Proposal's action used to upgrade an `Identity` to the package's current version. 7 | public struct Upgrade has copy, drop, store {} 8 | 9 | /// Creates a new `Upgrade` action. 10 | public fun new(): Upgrade { 11 | Upgrade {} 12 | } 13 | -------------------------------------------------------------------------------- /identity_credential/tests/fixtures/subject-10.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "did:example:ebfeb1f712ebc6f1c276e12ec21", 3 | "image": "ipfs:/ipfs/QmXfrS3pHerg44zzK6QKQj6JDk8H6cMtQS7pdXbohwNQfK/image", 4 | "alumniOf": { 5 | "id": "did:example:c276e12ec21ebfeb1f712ebc6f1", 6 | "name": [{ 7 | "value": "Example University", 8 | "lang": "en" 9 | }, { 10 | "value": "Exemple d'Université", 11 | "lang": "fr" 12 | }] 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/lib/jose/composite_jwk.ts: -------------------------------------------------------------------------------- 1 | // Copyright 2024 Fondazione Links 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export const enum CompositeAlgId { 5 | IdMldsa44Ed25519 = "id-MLDSA44-Ed25519", 6 | 7 | IdMldsa65Ed25519 = "id-MLDSA65-Ed25519", 8 | } 9 | 10 | export const enum CompositeAlgIdDomain { 11 | IdMldsa44Ed25519 = "060B6086480186FA6B5008013E", 12 | 13 | IdMldsa65Ed25519 = "060B6086480186FA6B50080147", 14 | } 15 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/examples/tsconfig.web.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2020", 4 | "outDir": "./dist/web", 5 | "baseUrl": "./", 6 | "lib": [ 7 | "ES6", 8 | "dom" 9 | ], 10 | "esModuleInterop": true, 11 | "moduleResolution": "node", 12 | "paths": { 13 | "@iota/identity-wasm/node": [ 14 | "../web" 15 | ] 16 | } 17 | }, 18 | "exclude": [ 19 | "tests" 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /.github/.github_changelog_generator: -------------------------------------------------------------------------------- 1 | issues=false 2 | pr-wo-labels=false 3 | author=false 4 | breaking-label=### Changed 5 | breaking-labels=Breaking change 6 | enhancement-label=### Added 7 | enhancement-labels=Added 8 | bugs-label=### Patch 9 | bug-labels=Patch 10 | deprecated-prefix=### Deprecated 11 | deprecated-labels=Deprecated 12 | removed-prefix=### Removed 13 | removed-labels=Removed 14 | exclude-labels=Documentation,No changelog 15 | include-labels=Rust 16 | verbose=true -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/cypress/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM cypress/browsers:latest 2 | 3 | ARG IOTA_IDENTITY_PKG_ID 4 | 5 | ENV IOTA_IDENTITY_PKG_ID=$IOTA_IDENTITY_PKG_ID 6 | 7 | ARG NETWORK_NAME_FAUCET 8 | 9 | ENV NETWORK_NAME_FAUCET=$NETWORK_NAME_FAUCET 10 | 11 | ARG NETWORK_URL 12 | 13 | ENV NETWORK_URL=$NETWORK_URL 14 | 15 | COPY ./ /e2e 16 | 17 | WORKDIR /e2e/identity_wasm 18 | 19 | RUN npm ci 20 | 21 | RUN npm run build:examples:web 22 | 23 | ENTRYPOINT [ "npm", "run" ] -------------------------------------------------------------------------------- /bindings/grpc/build.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | fn main() -> Result<(), Box> { 5 | let proto_files = std::fs::read_dir("./proto")? 6 | .filter_map(|entry| entry.ok().map(|e| e.path())) 7 | .filter(|path| path.extension().and_then(|ext| ext.to_str()) == Some("proto")); 8 | 9 | for proto in proto_files { 10 | tonic_build::compile_protos(proto)?; 11 | } 12 | 13 | Ok(()) 14 | } 15 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/src/rebased/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2022 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | mod controller; 5 | mod identity; 6 | mod proposals; 7 | mod wasm_identity_client; 8 | mod wasm_identity_client_read_only; 9 | 10 | pub use controller::*; 11 | pub use identity::*; 12 | pub use wasm_identity_client::*; 13 | pub use wasm_identity_client_read_only::*; 14 | 15 | pub type WasmIotaAddress = String; 16 | pub type WasmObjectID = String; 17 | -------------------------------------------------------------------------------- /bindings/wasm/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "lib": [ 4 | "ES2020", 5 | "DOM" 6 | ], 7 | "target": "ES2022", 8 | "declaration": true, 9 | "sourceMap": true, 10 | "strict": true, 11 | "moduleResolution": "node", 12 | "noImplicitAny": true, 13 | "preserveConstEnums": true, 14 | "forceConsistentCasingInFileNames": true, 15 | "skipLibCheck": true 16 | }, 17 | "exclude": [ 18 | "node_modules" 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/.github_changelog_generator: -------------------------------------------------------------------------------- 1 | issues=false 2 | pr-wo-labels=false 3 | author=false 4 | breaking-label=### Changed 5 | breaking-labels=Breaking change 6 | enhancement-label=### Added 7 | enhancement-labels=Added 8 | bugs-label=### Patch 9 | bug-labels=Patch 10 | deprecated-prefix=### Deprecated 11 | deprecated-labels=Deprecated 12 | removed-prefix=### Removed 13 | removed-labels=Removed 14 | exclude-labels=Documentation,No changelog 15 | include-labels=Wasm 16 | verbose=true -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/cypress/app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vite-project", 3 | "private": true, 4 | "version": "0.0.0", 5 | "type": "module", 6 | "scripts": { 7 | "dev": "vite", 8 | "build": "tsc && vite build", 9 | "preview": "vite preview" 10 | }, 11 | "devDependencies": { 12 | "typescript": "~5.7.2", 13 | "vite": "^6.2.0" 14 | }, 15 | "dependencies": { 16 | "@iota/identity-wasm": "file:../..", 17 | "@iota/iota-sdk": "^1.0.0" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/lib/jose/jwk_type.ts: -------------------------------------------------------------------------------- 1 | /** Supported types for the JSON Web Key `kty` property. 2 | * 3 | * [More Info](https://www.iana.org/assignments/jose/jose.xhtml#web-key-types) */ 4 | export const enum JwkType { 5 | /** Elliptic Curve. */ 6 | Ec = "EC", 7 | /** RSA. */ 8 | Rsa = "RSA", 9 | /** Octet sequence. */ 10 | Oct = "oct", 11 | /** Octet string key pairs. */ 12 | Okp = "OKP", 13 | /** Algorithm key pair. */ 14 | Akp = "AKP", 15 | } 16 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/src/credential/jwt_presentation_validation/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2025 IOTA Stiftung, Fondazione LINKS 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | mod decoded_jwt_presentation; 5 | mod jwt_presentation_validator; 6 | mod jwt_presentation_validator_hybrid; 7 | mod options; 8 | 9 | pub use self::decoded_jwt_presentation::*; 10 | pub use self::jwt_presentation_validator::*; 11 | pub use self::jwt_presentation_validator_hybrid::*; 12 | pub use self::options::*; 13 | -------------------------------------------------------------------------------- /identity_credential/src/validator/jpt_credential_validation/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung, Fondazione Links 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | mod decoded_jpt_credential; 5 | mod jpt_credential_validation_options; 6 | mod jpt_credential_validator; 7 | mod jpt_credential_validator_utils; 8 | 9 | pub use decoded_jpt_credential::*; 10 | pub use jpt_credential_validation_options::*; 11 | pub use jpt_credential_validator::*; 12 | pub use jpt_credential_validator_utils::*; 13 | -------------------------------------------------------------------------------- /identity_resolver/src/resolution/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2022 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | mod commands; 5 | mod resolver; 6 | #[cfg(test)] 7 | mod tests; 8 | 9 | use self::commands::SingleThreadedCommand; 10 | use identity_document::document::CoreDocument; 11 | 12 | pub use resolver::Resolver; 13 | /// Alias for a [`Resolver`] that is not [`Send`] + [`Sync`]. 14 | pub type SingleThreadedResolver = Resolver>; 15 | -------------------------------------------------------------------------------- /.github/workflows/scripts/updateVersion.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # takes a string and increments the last number 4 | # e.g. $(updateVersion 1.1.0) -> 1.1.1 5 | # e.g. $(updateVersion 1.1.0-dev.1) -> 1.1.0-dev.2 6 | 7 | [[ ${1} =~ ^(.*[^0-9])?([0-9]+)$ ]] && \ 8 | [[ ${#BASH_REMATCH[1]} -gt 0 ]] && \ 9 | printf "%s%0${#BASH_REMATCH[2]}d" "${BASH_REMATCH[1]}" "$((10#${BASH_REMATCH[2]} + 1 ))" || \ 10 | printf "%0${#BASH_REMATCH[2]}d" "$((10#${BASH_REMATCH[2]} + 1))" || \ 11 | printf "${1}" 12 | -------------------------------------------------------------------------------- /identity_credential/src/validator/jpt_presentation_validation/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung, Fondazione Links 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | mod decoded_jpt_presentation; 5 | mod jpt_presentation_validation_options; 6 | mod jpt_presentation_validator; 7 | mod jpt_presentation_validator_utils; 8 | 9 | pub use decoded_jpt_presentation::*; 10 | pub use jpt_presentation_validation_options::*; 11 | pub use jpt_presentation_validator::*; 12 | pub use jpt_presentation_validator_utils::*; 13 | -------------------------------------------------------------------------------- /bindings/grpc/tests/api/main.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #[cfg(test)] 5 | mod credential_revocation_check; 6 | #[cfg(test)] 7 | mod credential_validation; 8 | #[cfg(test)] 9 | mod did_document_creation; 10 | #[cfg(test)] 11 | mod domain_linkage; 12 | #[cfg(test)] 13 | mod health_check; 14 | #[cfg(test)] 15 | mod helpers; 16 | #[cfg(test)] 17 | mod jwt; 18 | #[cfg(test)] 19 | mod sd_jwt_validation; 20 | #[cfg(test)] 21 | mod status_list_2021; 22 | mod utils; 23 | -------------------------------------------------------------------------------- /identity_credential/src/revocation/status_list_2021/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | //! Implementation of [StatusList2021](https://www.w3.org/TR/2023/WD-vc-status-list-20230427/). 5 | 6 | /// Implementation of [StatusList2021Credential](https://www.w3.org/TR/2023/WD-vc-status-list-20230427/#statuslist2021credential). 7 | mod credential; 8 | mod entry; 9 | mod status_list; 10 | 11 | pub use credential::*; 12 | pub use entry::*; 13 | pub use status_list::*; 14 | -------------------------------------------------------------------------------- /.cargo/audit.toml: -------------------------------------------------------------------------------- 1 | [advisories] 2 | ignore = [ 3 | "RUSTSEC-2024-0437", # protobuf uncontrolled recursion https://github.com/iotaledger/iota/issues/5861 4 | "RUSTSEC-2021-0127", # serde_cbor is unmaintained https://github.com/iotaledger/identity/issues/518 5 | "RUSTSEC-2023-0052", # temporary ignore until fix is provided 6 | "RUSTSEC-2023-0065", # temporary ignore until fix is provided 7 | "RUSTSEC-2023-0071", # temporary ignore until fix is provided 8 | "RUSTSEC-2024-0437", # temporary ignore until fix is provided 9 | ] 10 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/documentation-task.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Documentation Task 3 | about: Add a documentation task (Only use when agreed upon by maintainers) 4 | title: "[Doc] " 5 | labels: documentation 6 | assignees: '' 7 | 8 | --- 9 | 10 | ## Description 11 | Describe the documentation task. 12 | 13 | ## Reference material 14 | Links resources such as RFCs, specifications, and other documentation. 15 | 16 | ## To-do List 17 | Create a task-specific to-do list 18 | 19 | - [ ] Item one 20 | - [ ] Item two 21 | - [ ] Item three 22 | -------------------------------------------------------------------------------- /identity_iota_core/packages/iota_identity/sources/public_vc.move: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | module iota_identity::public_vc; 5 | 6 | public struct PublicVc has store { 7 | data: vector, 8 | } 9 | 10 | public fun new(data: vector): PublicVc { 11 | PublicVc { data } 12 | } 13 | 14 | public fun data(self: &PublicVc): &vector { 15 | &self.data 16 | } 17 | 18 | public fun set_data(self: &mut PublicVc, data: vector) { 19 | self.data = data 20 | } 21 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/cypress/app/src/identity.ts: -------------------------------------------------------------------------------- 1 | import url from "@iota/identity-wasm/web/identity_wasm_bg.wasm?url"; 2 | 3 | import { init } from "@iota/identity-wasm/web"; 4 | import { main } from "../../../examples/dist/web/web-main"; 5 | 6 | export const runTest = async (example: string) => { 7 | try { 8 | await main(example); 9 | console.log("success"); 10 | } catch (error) { 11 | throw (error); 12 | } 13 | }; 14 | 15 | init(url) 16 | .then(() => { 17 | console.log("init"); 18 | }); 19 | -------------------------------------------------------------------------------- /.github/releases/v0.5.0-dev.5.md: -------------------------------------------------------------------------------- 1 | This release introduces a breaking change to the proof field of DID Documents created by versions `v0.5.0-dev.1` through `v0.5.0-dev.4`, making all prior documents incompatible. The main feature of this release is the introduction of WebAssembly (Wasm) bindings for the high-level `Account` API for Javascript/Typescript in both Node.js and the browser. This includes Stronghold storage support but only for Node.js, as it was determined that compiling Stronghold to Wasm for private key storage in the browser would not be sufficiently secure. 2 | -------------------------------------------------------------------------------- /identity_credential/src/domain_linkage/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | //! Implementation of [Domain Linkage](https://identity.foundation/.well-known/resources/did-configuration/). 5 | 6 | mod domain_linkage_configuration; 7 | mod domain_linkage_credential_builder; 8 | mod domain_linkage_validator; 9 | mod error; 10 | 11 | pub use self::domain_linkage_configuration::*; 12 | pub use self::domain_linkage_credential_builder::*; 13 | pub use self::domain_linkage_validator::*; 14 | pub use error::*; 15 | -------------------------------------------------------------------------------- /.github/releases/wasm-v0.5.0-dev.5.md: -------------------------------------------------------------------------------- 1 | This release introduces a breaking change to the proof field of DID Documents created by versions `v0.5.0-dev.1` through `v0.5.0-dev.4`, making all prior documents incompatible. The main feature of this release is the introduction of WebAssembly (Wasm) bindings for the high-level `Account` API for Javascript/Typescript in both Node.js and the browser. This includes Stronghold storage support but only for Node.js, as it was determined that compiling Stronghold to Wasm for private key storage in the browser would not be sufficiently secure. 2 | -------------------------------------------------------------------------------- /identity_pqc_verifier/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "identity_pqc_verifier" 3 | version = "1.8.0-beta.1" 4 | authors.workspace = true 5 | edition.workspace = true 6 | homepage.workspace = true 7 | keywords = ["iota", "identity", "jose", "jwk", "jws"] 8 | license.workspace = true 9 | readme = "./README.md" 10 | repository.workspace = true 11 | 12 | description = "JWS PQC signature verification for IOTA Identity" 13 | 14 | [dependencies] 15 | identity_jose = { version = "=1.8.0-beta.1", path = "../identity_jose", default-features = true } 16 | oqs.workspace = true 17 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/src/sd_jwt_vc/status.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | use wasm_bindgen::prelude::wasm_bindgen; 5 | 6 | #[wasm_bindgen(typescript_custom_section)] 7 | const I_SD_JWT_VC_STATUS: &str = r#" 8 | interface SdJwtVcStatusListRef { 9 | uri: string; 10 | idx: number; 11 | } 12 | 13 | type SdJwtVcStatus = { status_list: SdJwtVcStatusListRef } | unknown; 14 | "#; 15 | 16 | #[wasm_bindgen] 17 | extern "C" { 18 | #[wasm_bindgen(js_name = "SdJwtVcStatus")] 19 | pub type WasmStatus; 20 | } 21 | -------------------------------------------------------------------------------- /dprint.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://dprint.dev/schemas/v0.json", 3 | "incremental": true, 4 | "typescript": { 5 | "indentWidth": 4, 6 | "arrayExpression.preferHanging": true 7 | }, 8 | "toml": {}, 9 | "includes": [ 10 | "**/*.{toml,js,ts}" 11 | ], 12 | "excludes": [ 13 | "documentation", 14 | "**/{node_modules,target}", 15 | "bindings/wasm/identity_wasm/{node,web}/**/*.{js,ts}" 16 | ], 17 | "plugins": [ 18 | "https://plugins.dprint.dev/toml-0.5.1.wasm", 19 | "https://plugins.dprint.dev/typescript-0.73.1.wasm" 20 | ] 21 | } -------------------------------------------------------------------------------- /.github/releases/v1.0.0-rc.1.md: -------------------------------------------------------------------------------- 1 | This version introduces a new DID method targeting the IOTA UTXO ledger. This method works fundamentally differently from the previous method and introduces new capabilities to interact with Layer 1 assets like Native Tokens, NFTs and various Output types. 2 | \n 3 | This version changes the credential and presentation format to JWT, as specified by the [VC Data Model v1.1](https://www.w3.org/TR/vc-data-model/#json-web-token). 4 | \n\n 5 | Note: Identities and credentials created with the earlier versions cannot be resolved with this version of the library. 6 | \n\n -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/lib/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.node.json", 3 | "compilerOptions": { 4 | "baseUrl": "./", 5 | "paths": { 6 | "~identity_wasm": [ 7 | "../node/identity_wasm", 8 | "./identity_wasm.js" 9 | ], 10 | "@iota/iota-interaction-ts/*": [ 11 | "../node_modules/@iota/iota-interaction-ts/node/*", 12 | "@iota/iota-interaction-ts/node/" 13 | ], 14 | "../lib": [ 15 | "." 16 | ] 17 | }, 18 | "outDir": "../node", 19 | "declarationDir": "../node" 20 | } 21 | } -------------------------------------------------------------------------------- /identity_jose/src/tests/rfc7638.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | use crate::jwk::Jwk; 5 | 6 | #[test] 7 | fn test_rfc7638() { 8 | struct TestVector { 9 | jwk_json: &'static str, 10 | thumbprint_b64: &'static str, 11 | } 12 | 13 | static TVS: &[TestVector] = &include!("fixtures/rfc7638.rs"); 14 | 15 | for tv in TVS { 16 | let key: Jwk = serde_json::from_str(tv.jwk_json).unwrap(); 17 | let kid: String = key.thumbprint_sha256_b64(); 18 | 19 | assert_eq!(kid, tv.thumbprint_b64); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /.github/releases/wasm-v1.0.0-rc.1.md: -------------------------------------------------------------------------------- 1 | This version introduces a new DID method targeting the IOTA UTXO ledger. This method works fundamentally differently from the previous method and introduces new capabilities to interact with Layer 1 assets like Native Tokens, NFTs and various Output types. 2 | \n 3 | This version changes the credential and presentation format to JWT, as specified by the [VC Data Model v1.1](https://www.w3.org/TR/vc-data-model/#json-web-token). 4 | \n\n 5 | Note: Identities and credentials created with the earlier versions cannot be resolved with this version of the library. 6 | \n\n -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/src/credential/jpt_presentiation_validation/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | mod decoded_jpt_presentation; 5 | mod jpt_presentation_validation_options; 6 | mod jpt_presentation_validator; 7 | mod jpt_presentation_validator_utils; 8 | mod jwp_presentation_options; 9 | 10 | pub use decoded_jpt_presentation::*; 11 | pub use jpt_presentation_validation_options::*; 12 | pub use jpt_presentation_validator::*; 13 | pub use jpt_presentation_validator_utils::*; 14 | pub use jwp_presentation_options::*; 15 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/src/iota/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2025 IOTA Stiftung, Fondazione LINKS 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | pub use iota_did::WasmIotaDID; 5 | pub(crate) use iota_document::IotaDocumentLock; 6 | pub use iota_document::PromiseIotaDocument; 7 | pub use iota_document::WasmIotaDocument; 8 | pub use iota_document_metadata::WasmIotaDocumentMetadata; 9 | pub use iota_metadata_encoding::WasmStateMetadataEncoding; 10 | 11 | mod iota_did; 12 | mod iota_document; 13 | mod iota_document_ext; 14 | mod iota_document_metadata; 15 | mod iota_metadata_encoding; 16 | -------------------------------------------------------------------------------- /identity_iota_core/tests/e2e/migration.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | use crate::common::get_funded_test_client; 5 | use identity_iota_core::rebased::migration; 6 | use iota_sdk::types::base_types::ObjectID; 7 | 8 | #[tokio::test] 9 | async fn migration_registry_is_found() -> anyhow::Result<()> { 10 | let client = get_funded_test_client().await?; 11 | let random_alias_id = ObjectID::random(); 12 | 13 | let doc = migration::lookup(&client, random_alias_id).await?; 14 | assert!(doc.is_none()); 15 | 16 | Ok(()) 17 | } 18 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Lines starting with '#' are comments. 2 | # Each line is a file pattern followed by one or more owners. 3 | 4 | # More details are here: https://help.github.com/articles/about-codeowners/ 5 | 6 | # The '*' pattern is global owners. 7 | 8 | # Order is important. The last matching pattern has the most precedence. 9 | # The folders are ordered as follows: 10 | 11 | # In each subsection folders are ordered first by depth, then alphabetically. 12 | # This should make it easy to add new rules without breaking existing ones. 13 | 14 | # Global rule: 15 | * @iotaledger/identity -------------------------------------------------------------------------------- /bindings/grpc/proto/utils.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | syntax = "proto3"; 5 | package utils; 6 | 7 | message DataSigningRequest { 8 | // Raw data that will be signed. 9 | bytes data = 1; 10 | // Signing key's ID. 11 | string key_id = 2; 12 | } 13 | 14 | message DataSigningResponse { 15 | // Raw data signature. 16 | bytes signature = 1; 17 | } 18 | 19 | // Service that handles signing operations on raw data. 20 | service Signing { 21 | rpc sign(DataSigningRequest) returns (DataSigningResponse); 22 | } 23 | 24 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/lib/tsconfig.web.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "baseUrl": "./", 5 | "paths": { 6 | "~identity_wasm": [ 7 | "../web/identity_wasm", 8 | "./identity_wasm.js" 9 | ], 10 | "@iota/iota-interaction-ts/*": [ 11 | "../node_modules/@iota/iota-interaction-ts/web/*", 12 | "@iota/iota-interaction-ts/web/" 13 | ], 14 | "../lib": [ 15 | "." 16 | ] 17 | }, 18 | "outDir": "../web", 19 | "declarationDir": "../web", 20 | "module": "ES2022" 21 | } 22 | } -------------------------------------------------------------------------------- /identity_core/tests/custom_time.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | use identity_core::common::Timestamp; 5 | use identity_core::register_custom_now_utc; 6 | 7 | const STATIC_TIME: i64 = 1724402964; // 2024-08-23T11:33:30+00:00 8 | pub fn static_now_utc() -> Timestamp { 9 | Timestamp::from_unix(STATIC_TIME).unwrap() 10 | } 11 | 12 | register_custom_now_utc!(static_now_utc); 13 | 14 | #[test] 15 | fn should_use_registered_static_time() { 16 | let timestamp = Timestamp::now_utc(); 17 | assert_eq!(timestamp.to_unix(), STATIC_TIME) 18 | } 19 | -------------------------------------------------------------------------------- /.github/releases/v0.7.0-alpha.1.md: -------------------------------------------------------------------------------- 1 | This version introduces a new DID method targeting the IOTA UTXO ledger. This method works fundamentally differently from the previous method and introduces new capabilities to interact with Layer 1 entities like native tokens, NFTs and smart contracts. 2 | \n\n 3 | This is an early alpha release, so there may be breaking changes in upcoming versions that invalidate DIDs created with this version. The method at this point is only intended for experimentation. 4 | \n\n 5 | Note: Identities created with the earlier versions cannot be resolved with this version of the library. 6 | \n\n -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/src/jpt/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | mod encoding; 5 | mod issuer_protected_header; 6 | mod jpt_claims; 7 | mod jwp_issued; 8 | mod jwp_presentation_builder; 9 | mod payload; 10 | mod presentation_protected_header; 11 | mod proof_algorithm; 12 | 13 | pub use encoding::*; 14 | pub use issuer_protected_header::*; 15 | pub use jpt_claims::*; 16 | pub use jwp_issued::*; 17 | pub use jwp_presentation_builder::*; 18 | pub use payload::*; 19 | pub use presentation_protected_header::*; 20 | pub use proof_algorithm::*; 21 | -------------------------------------------------------------------------------- /.github/releases/wasm-v0.7.0-alpha.1.md: -------------------------------------------------------------------------------- 1 | This version introduces a new DID method targeting the IOTA UTXO ledger. This method works fundamentally differently from the previous method and introduces new capabilities to interact with Layer 1 entities like native tokens, NFTs and smart contracts. 2 | \n\n 3 | This is an early alpha release, so there may be breaking changes in upcoming versions that invalidate DIDs created with this version. The method at this point is only intended for experimentation. 4 | \n\n 5 | Note: Identities created with the earlier versions cannot be resolved with this version of the library. 6 | \n\n -------------------------------------------------------------------------------- /.github/workflows/enforce-pr-labels.yml: -------------------------------------------------------------------------------- 1 | name: Enforce PR labels 2 | 3 | on: 4 | pull_request: 5 | types: [labeled, unlabeled, opened, reopened, edited, synchronize] 6 | jobs: 7 | enforce-label: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: yogevbd/enforce-label-action@a3c219da6b8fa73f6ba62b68ff09c469b3a1c024 11 | with: 12 | REQUIRED_LABELS_ANY: "Rust,Wasm,Documentation,No changelog" 13 | - uses: yogevbd/enforce-label-action@a3c219da6b8fa73f6ba62b68ff09c469b3a1c024 14 | with: 15 | REQUIRED_LABELS_ANY: "Breaking change,Added,Patch,Deprecated,Removed,Documentation,No changelog" -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/src/credential/jpt_credential_validator/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | mod decoded_jpt_credential; 5 | mod jpt_credential_validation_options; 6 | mod jpt_credential_validator; 7 | mod jpt_credential_validator_utils; 8 | mod jwp_credential_options; 9 | mod jwp_verification_options; 10 | 11 | pub use decoded_jpt_credential::*; 12 | pub use jpt_credential_validation_options::*; 13 | pub use jpt_credential_validator::*; 14 | pub use jpt_credential_validator_utils::*; 15 | pub use jwp_credential_options::*; 16 | pub use jwp_verification_options::*; 17 | -------------------------------------------------------------------------------- /identity_iota_core/src/iota_interaction_adapter.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2025 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | // The following platform compile switch provides all the 5 | // ...Adapter types from iota_interaction_rust or iota_interaction_ts 6 | // like IotaClientAdapter, AssetMoveCallsAdapter, IdentityMoveCallsAdapter, 7 | // TransactionBuilderAdapter, MigrationMoveCallsAdapter, ... and so on 8 | 9 | cfg_if::cfg_if! { 10 | if #[cfg(target_arch = "wasm32")] { 11 | pub(crate) use iota_interaction_ts::*; 12 | } else { 13 | pub(crate) use iota_interaction_rust::*; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /identity_credential/tests/fixtures/credential-2.json: -------------------------------------------------------------------------------- 1 | { 2 | "@context": [ 3 | "https://www.w3.org/2018/credentials/v1", 4 | "https://www.w3.org/2018/credentials/examples/v1" 5 | ], 6 | "id": "http://example.edu/credentials/3732", 7 | "type": ["VerifiableCredential", "UniversityDegreeCredential"], 8 | "issuer": "https://example.edu/issuers/14", 9 | "issuanceDate": "2010-01-01T19:23:24Z", 10 | "credentialSubject": { 11 | "id": "did:example:ebfeb1f712ebc6f1c276e12ec21", 12 | "degree": { 13 | "type": "BachelorDegree", 14 | "name": "Bachelor of Science in Mechanical Engineering" 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /identity_credential/tests/fixtures/credential-3.json: -------------------------------------------------------------------------------- 1 | { 2 | "@context": [ 3 | "https://www.w3.org/2018/credentials/v1", 4 | "https://www.w3.org/2018/credentials/examples/v1" 5 | ], 6 | "id": "http://example.edu/credentials/3732", 7 | "type": ["VerifiableCredential", "UniversityDegreeCredential"], 8 | "issuer": "https://example.edu/issuers/14", 9 | "issuanceDate": "2010-01-01T19:23:24Z", 10 | "credentialSubject": { 11 | "id": "did:example:ebfeb1f712ebc6f1c276e12ec21", 12 | "degree": { 13 | "type": "BachelorDegree", 14 | "name": "Bachelor of Science in Mechanical Engineering" 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /identity_credential/tests/fixtures/credential-4.json: -------------------------------------------------------------------------------- 1 | { 2 | "@context": [ 3 | "https://www.w3.org/2018/credentials/v1", 4 | "https://www.w3.org/2018/credentials/examples/v1" 5 | ], 6 | "id": "http://example.edu/credentials/3732", 7 | "type": ["VerifiableCredential", "UniversityDegreeCredential"], 8 | "issuer": "https://example.edu/issuers/14", 9 | "issuanceDate": "2010-01-01T19:23:24Z", 10 | "credentialSubject": { 11 | "id": "did:example:ebfeb1f712ebc6f1c276e12ec21", 12 | "degree": { 13 | "type": "BachelorDegree", 14 | "name": "Bachelor of Science in Mechanical Engineering" 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /identity_resolver/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2022 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #![forbid(unsafe_code)] 5 | #![doc = include_str!("./../README.md")] 6 | #![warn( 7 | rust_2018_idioms, 8 | unreachable_pub, 9 | missing_docs, 10 | rustdoc::missing_crate_level_docs, 11 | rustdoc::broken_intra_doc_links, 12 | rustdoc::private_intra_doc_links, 13 | rustdoc::private_doc_tests, 14 | clippy::missing_safety_doc 15 | )] 16 | 17 | mod error; 18 | mod resolution; 19 | 20 | pub use self::error::Error; 21 | pub use self::error::ErrorCause; 22 | pub use self::error::Result; 23 | pub use resolution::*; 24 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature-request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature Request 3 | about: Request a feature for IOTA Identity 4 | title: "[Request]" 5 | labels: Request 6 | assignees: '' 7 | 8 | --- 9 | 10 | ## Description 11 | Briefly describe the feature that you are requesting. 12 | 13 | ## Motivation 14 | Explain why this feature is needed. 15 | 16 | ## Requirements 17 | Write a list of what you want this feature to do. 18 | 19 | 1. 20 | 2. 21 | 3. 22 | 23 | ## Open questions (optional) 24 | Use this section to ask any questions that are related to the feature. 25 | 26 | ## Are you planning to do it yourself in a pull request? 27 | 28 | Yes/No 29 | -------------------------------------------------------------------------------- /bindings/grpc/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rust:bookworm as builder 2 | 3 | # install protobuf 4 | RUN apt-get update && apt-get install -y protobuf-compiler libprotobuf-dev musl-tools 5 | 6 | COPY . /usr/src/app/ 7 | WORKDIR /usr/src/app/bindings/grpc 8 | RUN rustup target add x86_64-unknown-linux-musl 9 | RUN cargo build --target x86_64-unknown-linux-musl --release --bin identity-grpc 10 | 11 | FROM gcr.io/distroless/static-debian11 as runner 12 | 13 | # get binary 14 | COPY --from=builder /usr/src/app/bindings/grpc/target/x86_64-unknown-linux-musl/release/identity-grpc / 15 | 16 | # set run env 17 | EXPOSE 50051 18 | 19 | # run it 20 | CMD ["/identity-grpc"] -------------------------------------------------------------------------------- /identity_storage/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #![forbid(unsafe_code)] 5 | #![doc = include_str!("./../README.md")] 6 | #![warn( 7 | rust_2018_idioms, 8 | unreachable_pub, 9 | missing_docs, 10 | rustdoc::missing_crate_level_docs, 11 | rustdoc::broken_intra_doc_links, 12 | rustdoc::private_intra_doc_links, 13 | rustdoc::private_doc_tests, 14 | clippy::missing_safety_doc 15 | )] 16 | 17 | pub mod key_id_storage; 18 | pub mod key_storage; 19 | pub mod storage; 20 | 21 | pub use key_id_storage::*; 22 | pub use key_storage::public_modules::*; 23 | pub use storage::*; 24 | -------------------------------------------------------------------------------- /bindings/grpc/src/services/credential/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | pub mod jwt; 5 | pub mod revocation; 6 | pub mod validation; 7 | 8 | use identity_stronghold::StrongholdStorage; 9 | use identity_iota::iota::rebased::client::IdentityClientReadOnly; 10 | use tonic::service::RoutesBuilder; 11 | 12 | pub fn init_services(routes: &mut RoutesBuilder, client: &IdentityClientReadOnly, stronghold: &StrongholdStorage) { 13 | routes.add_service(revocation::service(client)); 14 | routes.add_service(jwt::service(client, stronghold)); 15 | routes.add_service(validation::service(client)); 16 | } 17 | -------------------------------------------------------------------------------- /identity_jose/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #![forbid(unsafe_code)] 5 | #![doc = include_str!("./../README.md")] 6 | #![allow(clippy::upper_case_acronyms)] 7 | #![warn( 8 | rust_2018_idioms, 9 | unreachable_pub, 10 | missing_docs, 11 | rustdoc::missing_crate_level_docs, 12 | rustdoc::broken_intra_doc_links, 13 | rustdoc::private_intra_doc_links, 14 | rustdoc::private_doc_tests, 15 | clippy::missing_safety_doc 16 | )] 17 | 18 | pub mod error; 19 | pub mod jose; 20 | pub mod jwk; 21 | pub mod jws; 22 | pub mod jwt; 23 | pub mod jwu; 24 | 25 | #[cfg(test)] 26 | mod tests; 27 | -------------------------------------------------------------------------------- /identity_iota_core/packages/iota_identity/sources/utils.move: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | module iota_identity::utils; 5 | 6 | use iota::vec_map::{Self, VecMap}; 7 | 8 | public fun vec_map_from_keys_values( 9 | keys: vector, 10 | values: vector, 11 | ): VecMap { 12 | vec_map::from_keys_values(keys, values) 13 | } 14 | 15 | #[test] 16 | fun from_keys_values_works() { 17 | let addresses = vector[@0x1, @0x2]; 18 | let vps = vector[1, 1]; 19 | 20 | let map = vec_map_from_keys_values(addresses, vps); 21 | assert!(map.size() == 2, 0); 22 | } 23 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/src/sd_jwt_vc/claims.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | use wasm_bindgen::prelude::wasm_bindgen; 5 | 6 | #[wasm_bindgen(typescript_custom_section)] 7 | const I_SD_JWT_VC_CLAIMS: &str = r#" 8 | interface ISdJwtVcClaims { 9 | iss: string; 10 | vct: string; 11 | status: SdJwtVcStatus; 12 | nbf?: string; 13 | exp?: string; 14 | iat?: string; 15 | sub?: string; 16 | } 17 | 18 | type SdJwtVcClaims = ISdJwtVcClaims & SdJwtClaims; 19 | "#; 20 | 21 | #[wasm_bindgen] 22 | extern "C" { 23 | #[wasm_bindgen(typescript_type = "SdJwtVcClaims")] 24 | pub type WasmSdJwtVcClaims; 25 | } 26 | -------------------------------------------------------------------------------- /identity_credential/src/revocation/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | //! Contains the implementations for all the credential revocation methods that can be used with IOTA's Identity 5 | //! framework. 6 | 7 | mod error; 8 | mod revocation_bitmap_2022; 9 | #[cfg(feature = "status-list-2021")] 10 | pub mod status_list_2021; 11 | 12 | #[cfg(feature = "jpt-bbs-plus")] 13 | pub mod validity_timeframe_2024; 14 | 15 | pub use self::error::RevocationError; 16 | pub use self::error::RevocationResult; 17 | pub use revocation_bitmap_2022::*; 18 | #[cfg(feature = "jpt-bbs-plus")] 19 | pub use validity_timeframe_2024::*; 20 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/src/jose/jwu.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | use crate::error::Result; 5 | use crate::error::WasmResult; 6 | use identity_iota::verification::jose::jwu; 7 | use wasm_bindgen::prelude::*; 8 | 9 | /// Encode the given bytes in url-safe base64. 10 | #[wasm_bindgen(js_name = encodeB64)] 11 | pub fn encode_b64(data: &[u8]) -> String { 12 | jwu::encode_b64(data) 13 | } 14 | 15 | /// Decode the given url-safe base64-encoded slice into its raw bytes. 16 | #[wasm_bindgen(js_name = decodeB64)] 17 | pub fn decode_b64(data: &[u8]) -> Result> { 18 | jwu::decode_b64(data).wasm_result() 19 | } 20 | -------------------------------------------------------------------------------- /identity_iota_core/src/rebased/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | /// Module for handling assets. 5 | pub mod assets; 6 | /// Module for handling client operations. 7 | pub mod client; 8 | mod error; 9 | mod iota; 10 | /// Module for handling migration operations. 11 | pub mod migration; 12 | /// Contains the operations of proposals. 13 | pub mod proposals; 14 | /// Contains utility functions. 15 | #[cfg(not(target_arch = "wasm32"))] 16 | pub mod utils; 17 | 18 | pub use assets::*; 19 | pub use error::*; 20 | 21 | /// Integration with IOTA's Keytool. 22 | #[cfg(feature = "keytool")] 23 | pub use iota_interaction::keytool; 24 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/lib/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright 2021-2022 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import "./append_functions.js"; 5 | 6 | export * from "./jose"; 7 | export * from "./jwk_storage"; 8 | export * from "./key_id_storage"; 9 | 10 | export * from "~identity_wasm"; 11 | 12 | export * from "./controller"; 13 | export * from "./proposal"; 14 | 15 | export * from "@iota/iota-interaction-ts/transaction_internal"; 16 | 17 | // keep this export last to override the original `Resolver` from `identity_wasm` in the exports 18 | export { Resolver } from "./resolver"; 19 | 20 | export * from "./jwk_storage_pq.js"; 21 | export * from "./pq_verifier.js"; 22 | -------------------------------------------------------------------------------- /identity_credential/src/sd_jwt_vc/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | mod builder; 5 | mod claims; 6 | mod error; 7 | /// Additional metadata defined by the SD-JWT VC specification 8 | /// such as issuer's metadata and credential type metadata. 9 | pub mod metadata; 10 | mod presentation; 11 | /// Resolver trait. 12 | pub mod resolver; 13 | mod status; 14 | #[cfg(test)] 15 | pub(crate) mod tests; 16 | mod token; 17 | 18 | pub use builder::*; 19 | pub use claims::*; 20 | pub use error::Error; 21 | pub use error::Result; 22 | pub use presentation::*; 23 | pub use resolver::Resolver; 24 | pub use status::*; 25 | pub use token::*; 26 | -------------------------------------------------------------------------------- /identity_credential/src/utils.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | use identity_core::common::Url; 5 | 6 | pub(crate) fn url_only_includes_origin(url: &Url) -> bool { 7 | url.path() == "/" && url.query().is_none() && url.fragment().is_none() 8 | } 9 | 10 | #[cfg(test)] 11 | mod tests { 12 | use super::url_only_includes_origin; 13 | use identity_core::common::Url; 14 | 15 | #[test] 16 | fn empty_path_and_root_are_valid_origins() { 17 | let urls = ["https://example.com", "https://example.com/"]; 18 | for url in urls { 19 | assert!(url_only_includes_origin(&Url::parse(url).unwrap())); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /identity_credential/tests/fixtures/credential-6.json: -------------------------------------------------------------------------------- 1 | { 2 | "@context": [ 3 | "https://www.w3.org/2018/credentials/v1", 4 | "https://www.w3.org/2018/credentials/examples/v1" 5 | ], 6 | "id": "http://example.edu/credentials/3732", 7 | "type": ["VerifiableCredential", "UniversityDegreeCredential"], 8 | "issuer": "https://example.edu/issuers/14", 9 | "issuanceDate": "2010-01-01T19:23:24Z", 10 | "expirationDate": "2020-01-01T19:23:24Z", 11 | "credentialSubject": { 12 | "id": "did:example:ebfeb1f712ebc6f1c276e12ec21", 13 | "degree": { 14 | "type": "BachelorDegree", 15 | "name": "Bachelor of Science in Mechanical Engineering" 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /identity_storage/src/key_storage/jwk_gen_output.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | use identity_verification::jose::jwk::Jwk; 5 | 6 | use super::KeyId; 7 | 8 | /// The output of a JWK key generation. 9 | #[non_exhaustive] 10 | #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] 11 | pub struct JwkGenOutput { 12 | /// The key identifier of the generated JWK. 13 | pub key_id: KeyId, 14 | /// The generated JWK. 15 | pub jwk: Jwk, 16 | } 17 | 18 | impl JwkGenOutput { 19 | /// Constructs a new JWK generation output. 20 | pub fn new(key_id: KeyId, jwk: Jwk) -> Self { 21 | Self { key_id, jwk } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /.github/releases/v0.6.0.md: -------------------------------------------------------------------------------- 1 | The main feature of this release is the addition of the `RevocationBitmap2022` specification, offering efficient credential revocation on-Tangle. This is the replacement for the `MerkleKeyCollection` removed in v0.5.0, which offered similar functionality but fundamentally failed to scale beyond a few thousand revocations. 2 | \n\n 3 | Other changes include encryption support using Elliptic Curve Diffie-Hellman (ECDH) and quality of life improvements for verifiable credential and presentation types in the Wasm bindings. 4 | \n\n 5 | DID Documents created with v0.5.0 remain compatible with v0.6.0. This will be the last major release prior to changes for the Stardust update. 6 | \n\n -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/src/credential/jwt_credential_validation/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2025 IOTA Stiftung, Fondazione LINKS 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | mod decoded_jwt_credential; 5 | mod jwt_credential_validator; 6 | mod jwt_credential_validator_hybrid; 7 | mod kb_validation_options; 8 | mod options; 9 | mod sd_jwt_validator; 10 | mod unknown_credential; 11 | 12 | pub use self::decoded_jwt_credential::*; 13 | pub use self::jwt_credential_validator::*; 14 | pub use self::jwt_credential_validator_hybrid::*; 15 | pub use self::kb_validation_options::*; 16 | pub use self::options::*; 17 | pub use self::sd_jwt_validator::*; 18 | pub use self::unknown_credential::*; 19 | -------------------------------------------------------------------------------- /.github/releases/wasm-v0.6.0.md: -------------------------------------------------------------------------------- 1 | The main feature of this release is the addition of the `RevocationBitmap2022` specification, offering efficient credential revocation on-Tangle. This is the replacement for the `MerkleKeyCollection` removed in v0.5.0, which offered similar functionality but fundamentally failed to scale beyond a few thousand revocations. 2 | \n\n 3 | Other changes include encryption support using Elliptic Curve Diffie-Hellman (ECDH) and quality of life improvements for verifiable credential and presentation types in the Wasm bindings. 4 | \n\n 5 | DID Documents created with v0.5.0 remain compatible with v0.6.0. This will be the last major release prior to changes for the Stardust update. 6 | \n\n -------------------------------------------------------------------------------- /bindings/wasm/typedoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://typedoc.org/schema.json", 3 | "disableSources": true, 4 | "excludePrivate": true, 5 | "excludeInternal": true, 6 | "excludeNotDocumented": true, 7 | "excludeExternals": true, 8 | "entryPointStrategy": "expand", 9 | "plugin": [ 10 | "typedoc-plugin-markdown" 11 | ], 12 | "readme": "none", 13 | "githubPages": false, 14 | "theme": "markdown", 15 | "entryFileName": "api_ref.md", 16 | "hideBreadcrumbs": true, 17 | "hideGenerator": true, 18 | "sort": [ 19 | "source-order" 20 | ], 21 | "compilerOptions": { 22 | "skipLibCheck": true 23 | }, 24 | "validation": { 25 | "notDocumented": true, 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /identity_jose/src/jws/format.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | /// The serialization format used for the JWS. 5 | #[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord, Default)] 6 | pub enum JwsFormat { 7 | /// JWS Compact Serialization (). 8 | #[default] 9 | Compact, 10 | /// General JWS JSON Serialization (). 11 | General, 12 | /// Flattened JWS JSON Serialization (). 13 | /// 14 | /// Should be used for single signature or MAC use cases. 15 | Flatten, 16 | } 17 | -------------------------------------------------------------------------------- /identity_credential/src/validator/jwt_presentation_validation/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2025 IOTA Stiftung, Fondazione LINKS 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | mod decoded_jwt_presentation; 5 | mod error; 6 | mod jwt_presentation_validation_options; 7 | mod jwt_presentation_validator; 8 | #[cfg(feature = "hybrid")] 9 | mod jwt_presentation_validator_hybrid; 10 | mod jwt_presentation_validator_utils; 11 | 12 | pub use decoded_jwt_presentation::*; 13 | pub use error::*; 14 | pub use jwt_presentation_validation_options::*; 15 | pub use jwt_presentation_validator::*; 16 | #[cfg(feature = "hybrid")] 17 | pub use jwt_presentation_validator_hybrid::*; 18 | pub use jwt_presentation_validator_utils::*; 19 | -------------------------------------------------------------------------------- /identity_iota_core/scripts/publish_identity_package.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2020-2024 IOTA Stiftung 4 | # SPDX-License-Identifier: Apache-2.0 5 | 6 | script_dir=$(cd "$(dirname $0)" && pwd) 7 | package_dir=$script_dir/../packages/iota_identity 8 | 9 | # echo "publishing package from $package_dir" 10 | RESPONSE=$(iota client publish --with-unpublished-dependencies --silence-warnings --json --gas-budget 500000000 $package_dir) 11 | { # try 12 | PACKAGE_ID=$(echo $RESPONSE | jq --raw-output '.objectChanges[] | select(.type | contains("published")) | .packageId') 13 | } || { # catch 14 | echo $RESPONSE 15 | } 16 | 17 | export IOTA_IDENTITY_PKG_ID=$PACKAGE_ID 18 | echo "${IOTA_IDENTITY_PKG_ID}" 19 | -------------------------------------------------------------------------------- /identity_verification/src/jose/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | //! Provides JWK and JWS types and functionality. 4 | 5 | // Re-export necessary types from `identity_jose`. 6 | 7 | pub mod jwk { 8 | //! Reexport of [identity_jose::jwk]. 9 | 10 | pub use identity_jose::jwk::*; 11 | } 12 | 13 | pub mod jws { 14 | //! Reexport of [identity_jose::jwk]. 15 | 16 | pub use identity_jose::jws::*; 17 | } 18 | 19 | pub mod jwu { 20 | //! Reexport of [identity_jose::jwu]. 21 | 22 | pub use identity_jose::jwu::*; 23 | } 24 | 25 | pub mod error { 26 | //! Reexport of [identity_jose::error]. 27 | 28 | pub use identity_jose::error::*; 29 | } 30 | -------------------------------------------------------------------------------- /identity_credential/src/credential/jws.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | /// A wrapper around a JSON Web Signature (JWS). 5 | #[derive(Debug, Clone)] 6 | pub struct Jws(String); 7 | 8 | impl Jws { 9 | /// Creates a new `Jws` from the given string. 10 | pub fn new(jws_string: String) -> Self { 11 | Self(jws_string) 12 | } 13 | 14 | /// Returns a reference of the JWS string. 15 | pub fn as_str(&self) -> &str { 16 | &self.0 17 | } 18 | } 19 | 20 | impl From for Jws { 21 | fn from(jws: String) -> Self { 22 | Self::new(jws) 23 | } 24 | } 25 | impl From for String { 26 | fn from(jws: Jws) -> Self { 27 | jws.0 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/tests/txm_readme.js: -------------------------------------------------------------------------------- 1 | const assert = require("assert"); 2 | const spawn = require("child_process").spawn; 3 | 4 | describe.skip("Test TXM", () => { 5 | before((done) => { 6 | let process = spawn("txm", ["README.md"]); 7 | process.stdout.on("data", function(data) { 8 | console.log(data.toString()); 9 | }); 10 | process.stderr.on("data", function(data) { 11 | console.log(data.toString()); 12 | }); 13 | process.on("exit", (code) => { 14 | exitCode = code; 15 | done(); 16 | }); 17 | }); 18 | it("exit code should be zero", () => { 19 | assert.equal(exitCode, 0); 20 | }); 21 | }); 22 | -------------------------------------------------------------------------------- /identity_iota_core/src/rebased/iota/types/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | mod number; 5 | 6 | use iota_interaction::types::base_types::ObjectID; 7 | use iota_interaction::types::id::UID; 8 | pub(crate) use number::*; 9 | use serde::Deserialize; 10 | use serde::Serialize; 11 | 12 | #[derive(Clone, Debug, Serialize, Deserialize)] 13 | pub(crate) struct Bag { 14 | pub id: UID, 15 | #[serde(deserialize_with = "serde_aux::field_attributes::deserialize_number_from_string")] 16 | pub size: u64, 17 | } 18 | 19 | impl Default for Bag { 20 | fn default() -> Self { 21 | Self { 22 | id: UID::new(ObjectID::ZERO), 23 | size: 0, 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /bindings/wasm/build/utils/generatePackage.js: -------------------------------------------------------------------------------- 1 | module.exports = (options) => { 2 | const rootPackage = require(`../../${options.artifact}/package.json`); 3 | const newPackage = { 4 | name: rootPackage.name, 5 | description: rootPackage.description, 6 | version: rootPackage.version, 7 | license: rootPackage.license, 8 | homepage: rootPackage.homepage, 9 | repository: rootPackage.repository, 10 | module: options.module, 11 | main: options.main, 12 | types: options.types, 13 | }; 14 | 15 | // remove empty keys 16 | Object.keys(newPackage).forEach(key => newPackage[key] === undefined && delete newPackage[key]); 17 | 18 | return newPackage; 19 | }; 20 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/tests/txm_readme_rust.js: -------------------------------------------------------------------------------- 1 | const assert = require("assert"); 2 | const spawn = require("child_process").spawn; 3 | 4 | describe("Test TXM", () => { 5 | before((done) => { 6 | let process = spawn("txm", ["../../../README.md"]); 7 | process.stdout.on("data", function(data) { 8 | console.log(data.toString()); 9 | }); 10 | process.stderr.on("data", function(data) { 11 | console.log(data.toString()); 12 | }); 13 | process.on("exit", (code) => { 14 | exitCode = code; 15 | done(); 16 | }); 17 | }); 18 | it("exit code should be zero", () => { 19 | assert.equal(exitCode, 0); 20 | }); 21 | }); 22 | -------------------------------------------------------------------------------- /identity_jose/src/jose/traits.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | use crate::jwt::JwtHeader; 5 | 6 | /// An abstraction over different JOSE headers. 7 | pub trait JoseHeader { 8 | /// Returns the header common to all [`JoseHeader`]s. 9 | fn common(&self) -> &JwtHeader; 10 | 11 | /// Returns `true` if the header has the given `claim`, `false` otherwise. 12 | fn has_claim(&self, claim: &str) -> bool; 13 | } 14 | 15 | impl<'a, T: 'a> JoseHeader for &'a T 16 | where 17 | T: JoseHeader, 18 | { 19 | fn common(&self) -> &JwtHeader { 20 | (**self).common() 21 | } 22 | 23 | fn has_claim(&self, claim: &str) -> bool { 24 | (**self).has_claim(claim) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/lib/controller.ts: -------------------------------------------------------------------------------- 1 | import { DelegationToken } from "~identity_wasm"; 2 | 3 | /** 4 | * Permissions of a {@link DelegationToken}. 5 | */ 6 | export enum DelegatePermissions { 7 | /** No permissions. */ 8 | None = 0, 9 | /** Delegate can create new proposals. */ 10 | CreateProposal = 1, 11 | /** Delegate can approve existing proposals. */ 12 | ApproveProposal = 1 << 1, 13 | /** Delegate can execute proposals. */ 14 | ExecuteProposal = 1 << 2, 15 | /** Delegate can delete proposals. */ 16 | DeleteProposal = 1 << 3, 17 | /** Delegate can remove its controller's approval. */ 18 | RemoveApproval = 1 << 4, 19 | /** All permissions. */ 20 | All = 0xffffffff, 21 | } 22 | -------------------------------------------------------------------------------- /identity_eddsa_verifier/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "identity_eddsa_verifier" 3 | version = "1.8.0-beta.1" 4 | authors.workspace = true 5 | edition.workspace = true 6 | homepage.workspace = true 7 | keywords = ["iota", "identity", "jose", "jwk", "jws"] 8 | license.workspace = true 9 | readme = "./README.md" 10 | repository.workspace = true 11 | description = "JWS EdDSA signature verification for IOTA Identity" 12 | 13 | [dependencies] 14 | identity_jose = { version = "=1.8.0-beta.1", path = "../identity_jose", default-features = false } 15 | iota-crypto = { version = "0.23.2", default-features = false, features = ["std"] } 16 | 17 | [features] 18 | ed25519 = ["iota-crypto/ed25519"] 19 | default = ["ed25519"] 20 | 21 | [lints] 22 | workspace = true 23 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/cypress/app/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "useDefineForClassFields": true, 5 | "module": "ESNext", 6 | "lib": ["ES2020", "DOM", "DOM.Iterable"], 7 | "skipLibCheck": true, 8 | "allowJs": true, 9 | 10 | /* Bundler mode */ 11 | "moduleResolution": "bundler", 12 | "allowImportingTsExtensions": true, 13 | "isolatedModules": true, 14 | "moduleDetection": "force", 15 | "noEmit": true, 16 | 17 | /* Linting */ 18 | "strict": true, 19 | "noUnusedLocals": true, 20 | "noUnusedParameters": true, 21 | "noFallthroughCasesInSwitch": true, 22 | "noUncheckedSideEffectImports": true 23 | }, 24 | "include": ["src"] 25 | } 26 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/src/resolver/resolver_types.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | use wasm_bindgen::prelude::*; 5 | 6 | #[wasm_bindgen] 7 | extern "C" { 8 | #[wasm_bindgen(typescript_type = "Promise>")] 9 | pub type PromiseArrayIToCoreDocument; 10 | 11 | #[wasm_bindgen(typescript_type = "Promise")] 12 | pub type PromiseIToCoreDocument; 13 | 14 | #[wasm_bindgen(typescript_type = "CoreDocument | IToCoreDocument | undefined")] 15 | pub type OptionIToCoreDocument; 16 | 17 | #[wasm_bindgen(typescript_type = "Array | undefined")] 18 | pub type OptionArrayIToCoreDocument; 19 | } 20 | -------------------------------------------------------------------------------- /identity_iota_core/scripts/upgrade_identity_package.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2020-2025 IOTA Stiftung 4 | # SPDX-License-Identifier: Apache-2.0 5 | 6 | script_dir=$(cd "$(dirname $0)" && pwd) 7 | package_dir=$script_dir/../packages/iota_identity 8 | 9 | chain_id=$(iota client chain-identifier) 10 | current_pkg_id=$(toml get "$package_dir/Move.lock" env | jq --raw-output "map(values | select(.[\"chain-id\"] == \"$chain_id\") .[\"latest-published-id\"]) | first") 11 | upgrade_cap_id=$(iota client objects --json | jq --raw-output "map(select(.data.type == \"0x2::package::UpgradeCap\" and .data.content.fields.package == \"$current_pkg_id\")) | first | .data.objectId") 12 | 13 | iota client upgrade --upgrade-capability $upgrade_cap_id $package_dir 14 | -------------------------------------------------------------------------------- /bindings/grpc/proto/document.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | syntax = "proto3"; 5 | package document; 6 | 7 | message CreateDIDRequest { 8 | // KeyID for getting the public key from stronghold. 9 | string key_id = 1; 10 | } 11 | 12 | message CreateDIDResponse { 13 | // The created DID document, encoded as JSON. 14 | string document_json = 1; 15 | // The stronghold's fragment for the generated document's auth method. 16 | string fragment = 2; 17 | // The DID of the created document. 18 | string did = 3; 19 | } 20 | 21 | service DocumentService { 22 | /// Creates a new DID document stored on Tangle. 23 | rpc create(CreateDIDRequest) returns (CreateDIDResponse); 24 | } -------------------------------------------------------------------------------- /identity_credential/src/validator/jwt_credential_validation/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2025 IOTA Stiftung, Fondazione LINKS 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | //! Contains functionality for validating credentials issued as JWTs. 5 | mod decoded_jwt_credential; 6 | mod error; 7 | mod jwt_credential_validation_options; 8 | mod jwt_credential_validator; 9 | #[cfg(feature = "hybrid")] 10 | mod jwt_credential_validator_hybrid; 11 | mod jwt_credential_validator_utils; 12 | 13 | pub use decoded_jwt_credential::*; 14 | pub use error::*; 15 | pub use jwt_credential_validation_options::*; 16 | pub use jwt_credential_validator::*; 17 | #[cfg(feature = "hybrid")] 18 | pub use jwt_credential_validator_hybrid::*; 19 | pub use jwt_credential_validator_utils::*; 20 | -------------------------------------------------------------------------------- /identity_credential/tests/fixtures/credential-7.json: -------------------------------------------------------------------------------- 1 | { 2 | "@context": [ 3 | "https://www.w3.org/2018/credentials/v1", 4 | "https://www.w3.org/2018/credentials/examples/v1" 5 | ], 6 | "id": "http://example.edu/credentials/3732", 7 | "type": ["VerifiableCredential", "UniversityDegreeCredential"], 8 | "issuer": "https://example.edu/issuers/14", 9 | "issuanceDate": "2010-01-01T19:23:24Z", 10 | "credentialSubject": { 11 | "id": "did:example:ebfeb1f712ebc6f1c276e12ec21", 12 | "degree": { 13 | "type": "BachelorDegree", 14 | "name": "Bachelor of Science in Mechanical Engineering" 15 | } 16 | }, 17 | "credentialStatus": { 18 | "id": "https://example.edu/status/24", 19 | "type": "CredentialStatusList2017" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /identity_credential/tests/fixtures/credential-10.json: -------------------------------------------------------------------------------- 1 | { 2 | "@context": [ 3 | "https://www.w3.org/2018/credentials/v1", 4 | "https://www.w3.org/2018/credentials/examples/v1" 5 | ], 6 | "id": "http://example.edu/credentials/3732", 7 | "type": ["VerifiableCredential", "UniversityDegreeCredential"], 8 | "issuer": "https://example.edu/issuers/14", 9 | "issuanceDate": "2010-01-01T19:23:24Z", 10 | "credentialSubject": { 11 | "id": "did:example:ebfeb1f712ebc6f1c276e12ec21", 12 | "degree": { 13 | "type": "BachelorDegree", 14 | "name": "Bachelor of Science in Mechanical Engineering" 15 | } 16 | }, 17 | "refreshService": { 18 | "id": "https://example.edu/refresh/3732", 19 | "type": "ManualRefreshService2018" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /identity_iota_core/src/state_metadata/encoding.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2022 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | use num_traits::FromPrimitive; 5 | 6 | use crate::Error; 7 | 8 | /// Indicates the encoding of a DID document in state metadata. 9 | #[derive(Copy, Clone, Debug, Default, Ord, PartialOrd, Eq, PartialEq, num_derive::FromPrimitive)] 10 | #[non_exhaustive] 11 | pub enum StateMetadataEncoding { 12 | /// State Metadata encoded as JSON. 13 | #[default] 14 | Json = 0, 15 | } 16 | 17 | impl TryFrom for StateMetadataEncoding { 18 | type Error = Error; 19 | 20 | fn try_from(value: u8) -> Result { 21 | FromPrimitive::from_u8(value).ok_or(Error::InvalidStateMetadata("unsupported encoding")) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /.github/workflows/rust-create-hotfix-pr.yml: -------------------------------------------------------------------------------- 1 | name: Rust Create Hotfix PR 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | branch: 7 | description: 'Name of the support branch (e.g. `support/v1.2`)' 8 | required: true 9 | 10 | jobs: 11 | create-hotfix-pr: 12 | uses: './.github/workflows/shared-create-hotfix-pr.yml' 13 | with: 14 | branch: ${{ github.event.inputs.branch }} 15 | branch-regex: ^support\/v[0-9]+\.[0-9]+$ 16 | tag-prefix: v 17 | main-tag-regex: ^v[0-9]+\.[0-9]+\.[0-9]+$ 18 | changelog-config-path: ./.github/.github_changelog_generator 19 | release-target: rust 20 | secrets: 21 | GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} 22 | GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} 23 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/proc_typescript/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "proc_typescript" 3 | version = "0.1.0" 4 | authors = ["IOTA Stiftung"] 5 | edition = "2021" 6 | homepage = "https://www.iota.org" 7 | license = "Apache-2.0" 8 | publish = false 9 | repository = "https://github.com/iotaledger/identity" 10 | description = "Annotate structs as TypeScript interfaces for wasm-bindgen." 11 | 12 | [lib] 13 | name = "proc_typescript" 14 | proc-macro = true 15 | 16 | [dependencies] 17 | darling = { version = "0.14.0", default-features = false, features = ["suggestions"] } 18 | proc-macro2 = { version = "1.0", default-features = false } 19 | quote = { version = "1.0", default-features = false } 20 | syn = { version = "1.0", default-features = false, features = ["parsing"] } 21 | -------------------------------------------------------------------------------- /identity_credential/tests/fixtures/credential-8.json: -------------------------------------------------------------------------------- 1 | { 2 | "@context": [ 3 | "https://www.w3.org/2018/credentials/v1", 4 | "https://www.w3.org/2018/credentials/examples/v1" 5 | ], 6 | "id": "http://example.edu/credentials/3732", 7 | "type": ["VerifiableCredential", "UniversityDegreeCredential"], 8 | "issuer": "https://example.edu/issuers/14", 9 | "issuanceDate": "2010-01-01T19:23:24Z", 10 | "credentialSubject": { 11 | "id": "did:example:ebfeb1f712ebc6f1c276e12ec21", 12 | "degree": { 13 | "type": "BachelorDegree", 14 | "name": "Bachelor of Science in Mechanical Engineering" 15 | } 16 | }, 17 | "credentialSchema": { 18 | "id": "https://example.org/examples/degree.json", 19 | "type": "JsonSchemaValidator2018" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /identity_document/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #![forbid(unsafe_code)] 5 | #![doc = include_str!("./../README.md")] 6 | #![allow(clippy::upper_case_acronyms)] 7 | #![warn( 8 | rust_2018_idioms, 9 | unreachable_pub, 10 | // missing_docs, 11 | rustdoc::missing_crate_level_docs, 12 | rustdoc::broken_intra_doc_links, 13 | rustdoc::private_intra_doc_links, 14 | rustdoc::private_doc_tests, 15 | clippy::missing_safety_doc, 16 | // clippy::missing_errors_doc 17 | )] 18 | 19 | #[macro_use] 20 | extern crate serde; 21 | 22 | pub mod document; 23 | pub mod error; 24 | pub mod service; 25 | pub mod utils; 26 | pub mod verifiable; 27 | 28 | pub use self::error::Error; 29 | pub use self::error::Result; 30 | -------------------------------------------------------------------------------- /identity_ecdsa_verifier/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung, Filancore GmbH 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #![doc = include_str!("./../README.md")] 5 | #![warn( 6 | rust_2018_idioms, 7 | unreachable_pub, 8 | missing_docs, 9 | rustdoc::missing_crate_level_docs, 10 | rustdoc::broken_intra_doc_links, 11 | rustdoc::private_intra_doc_links, 12 | rustdoc::private_doc_tests, 13 | clippy::missing_safety_doc 14 | )] 15 | 16 | mod ecdsa_jws_verifier; 17 | #[cfg(feature = "es256k")] 18 | mod secp256k1; 19 | #[cfg(feature = "es256")] 20 | mod secp256r1; 21 | 22 | pub use ecdsa_jws_verifier::*; 23 | #[cfg(feature = "es256k")] 24 | pub use secp256k1::*; 25 | #[cfg(feature = "es256")] 26 | pub use secp256r1::*; 27 | 28 | #[cfg(test)] 29 | mod tests; 30 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/src/verification/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | mod custom_verification; 5 | 6 | mod jws_verifier; 7 | mod wasm_method_data; 8 | mod wasm_method_relationship; 9 | mod wasm_method_scope; 10 | mod wasm_method_type; 11 | mod wasm_verification_method; 12 | 13 | pub use custom_verification::*; 14 | 15 | pub use self::wasm_method_data::WasmMethodData; 16 | pub use self::wasm_method_relationship::WasmMethodRelationship; 17 | pub use self::wasm_method_scope::OptionMethodScope; 18 | pub use self::wasm_method_scope::RefMethodScope; 19 | pub use self::wasm_method_scope::WasmMethodScope; 20 | pub use self::wasm_method_type::WasmMethodType; 21 | pub use self::wasm_verification_method::WasmVerificationMethod; 22 | -------------------------------------------------------------------------------- /identity_verification/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #![forbid(unsafe_code)] 5 | #![doc = include_str!("./../README.md")] 6 | #![allow(clippy::upper_case_acronyms)] 7 | #![warn( 8 | rust_2018_idioms, 9 | unreachable_pub, 10 | missing_docs, 11 | rustdoc::missing_crate_level_docs, 12 | rustdoc::broken_intra_doc_links, 13 | rustdoc::private_intra_doc_links, 14 | rustdoc::private_doc_tests, 15 | clippy::missing_safety_doc 16 | )] 17 | 18 | #[macro_use] 19 | extern crate serde; 20 | 21 | mod error; 22 | pub mod jose; 23 | pub mod verification_method; 24 | pub use error::Error; 25 | pub use error::Result; 26 | pub use jose::jwk; 27 | pub use jose::jws; 28 | pub use jose::jwu; 29 | pub use verification_method::*; 30 | -------------------------------------------------------------------------------- /.github/workflows/audit.yml: -------------------------------------------------------------------------------- 1 | name: Audit 2 | 3 | on: 4 | schedule: 5 | - cron: '0 0 * * *' # run at midnight every day 6 | push: 7 | branches: 8 | - main 9 | paths: 10 | - "**/Cargo.lock" 11 | - "**/Cargo.toml" 12 | - ".github/workflows/audit.yml" 13 | - ".cargo/audit.toml" 14 | pull_request: 15 | branches: 16 | - main 17 | - 'feat/**' 18 | - 'support/**' 19 | paths: 20 | - "**/Cargo.lock" 21 | - "**/Cargo.toml" 22 | - ".github/workflows/audit.yml" 23 | - ".cargo/audit.toml" 24 | 25 | jobs: 26 | audit: 27 | runs-on: ubuntu-latest 28 | steps: 29 | - uses: actions/checkout@v3 30 | - uses: actions-rs/audit-check@v1 31 | with: 32 | token: ${{ secrets.GITHUB_TOKEN }} 33 | -------------------------------------------------------------------------------- /identity_iota_core/src/state_metadata/version.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2022 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | use num_traits::FromPrimitive; 5 | 6 | use crate::Error; 7 | 8 | /// Indicates the version of a DID document in state metadata. 9 | #[derive(Copy, Clone, Debug, Ord, PartialOrd, Eq, PartialEq, num_derive::FromPrimitive)] 10 | #[non_exhaustive] 11 | pub(crate) enum StateMetadataVersion { 12 | V1 = 1, 13 | } 14 | 15 | impl StateMetadataVersion { 16 | pub(crate) const CURRENT: Self = Self::V1; 17 | } 18 | 19 | impl TryFrom for StateMetadataVersion { 20 | type Error = Error; 21 | 22 | fn try_from(value: u8) -> Result { 23 | FromPrimitive::from_u8(value).ok_or(Error::InvalidStateMetadata("unsupported version number")) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /identity_iota_core/src/rebased/iota/move_calls/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | use iota_interaction::types::base_types::ObjectRef; 5 | 6 | pub(crate) mod asset; 7 | pub(crate) mod identity; 8 | pub(crate) mod migration; 9 | mod utils; 10 | 11 | #[derive(Debug, Clone, Copy)] 12 | pub(crate) enum ControllerTokenRef { 13 | Controller(ObjectRef), 14 | Delegate(ObjectRef), 15 | } 16 | 17 | impl ControllerTokenRef { 18 | pub(crate) fn object_ref(&self) -> ObjectRef { 19 | match self { 20 | Self::Controller(obj_ref) => *obj_ref, 21 | Self::Delegate(obj_ref) => *obj_ref, 22 | } 23 | } 24 | 25 | #[inline(always)] 26 | pub(crate) fn is_controller_cap(&self) -> bool { 27 | matches!(self, Self::Controller(_)) 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /identity_resolver/src/resolution/tests/send_sync.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | use super::*; 5 | 6 | use identity_did::DID; 7 | use identity_document::document::CoreDocument; 8 | 9 | fn is_send(_t: T) {} 10 | fn is_send_sync(_t: T) {} 11 | 12 | #[allow(dead_code)] 13 | fn default_resolver_is_send_sync + Send + Sync + 'static>() { 14 | let resolver = Resolver::::new(); 15 | is_send_sync(resolver); 16 | } 17 | 18 | #[allow(dead_code)] 19 | fn resolver_methods_give_send_futures(did: D) 20 | where 21 | DOC: AsRef + Send + Sync + 'static, 22 | D: DID + Send + Sync + 'static, 23 | { 24 | let resolver = Resolver::::new(); 25 | is_send(resolver.resolve(&did)); 26 | } 27 | -------------------------------------------------------------------------------- /.github/workflows/wasm-retag-npm.yml: -------------------------------------------------------------------------------- 1 | name: Wasm re-tag npm 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | tag: 7 | description: 'Tag to set' 8 | required: true 9 | version: 10 | description: 'version to set' 11 | required: true 12 | 13 | jobs: 14 | release-wasm: 15 | runs-on: ubuntu-latest 16 | steps: 17 | - name: Set up Node.js 18 | uses: actions/setup-node@v2 19 | with: 20 | node-version: '20.x' 21 | registry-url: 'https://registry.npmjs.org' 22 | 23 | - name: Run dist-tag 24 | shell: sh 25 | env: 26 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} 27 | run: | 28 | npm dist-tag add @iota/identity-wasm@${{ github.event.inputs.version }} ${{ github.event.inputs.tag }} 29 | -------------------------------------------------------------------------------- /identity_jose/src/tests/fixtures/rfc7638.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | [ 4 | // https://tools.ietf.org/html/rfc7638#section-3.1 5 | TestVector { 6 | jwk_json: r#" 7 | { 8 | "kty": "RSA", 9 | "n": "0vx7agoebGcQSuuPiLJXZptN9nndrQmbXEps2aiAFbWhM78LhWx4cbbfAAtVT86zwu1RK7aPFFxuhDR1L6tSoc_BJECPebWKRXjBZCiFV4n3oknjhMstn64tZ_2W-5JsGY4Hc5n9yBXArwl93lqt7_RN5w6Cf0h4QyQ5v-65YGjQR0_FDW2QvzqY368QQMicAtaSqzs8KJZgnYb9c7d0zgdAZHzu6qMQvRL5hajrn1n91CbOpbISD08qNLyrdkt-bFTWhAI4vMQFh6WeZu0fM4lFd2NcRwr3XPksINHaQ-G_xBniIqbw0Ls1jF44-csFCur-kEgU8awapJzKnqDKgw", 10 | "e": "AQAB", 11 | "alg": "RS256", 12 | "kid": "2011-04-29" 13 | } 14 | "#, 15 | thumbprint_b64: "NzbLsXh8uDCcd-6MNwXF4W_7noWXFZAfHkxZsRGC9Xs", 16 | }, 17 | ] 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # Will have compiled files and executables 3 | /target/ 4 | target/ 5 | 6 | # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries 7 | # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html 8 | Cargo.lock 9 | 10 | # These are backup files generated by rustfmt 11 | **/*.rs.bk 12 | 13 | # Ignore IDE/editor files 14 | .idea/ 15 | .vscode/ 16 | 17 | # Ignore temporary test files 18 | test-storage/ 19 | 20 | # remove book 21 | book 22 | 23 | # ignore files generated by example 24 | *.hodl 25 | *.hodl.* 26 | 27 | !/bindings/wasm/identity_wasm/static/index.html 28 | 29 | docs 30 | # ignore IOTA build artifacts & package locks 31 | build 32 | 33 | # ignore folder created in CI for downloaded iota binaries 34 | /iota/ 35 | /toml-cli/ 36 | -------------------------------------------------------------------------------- /bindings/grpc/tests/api/health_check.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | use _health_check::health_check_client::HealthCheckClient; 5 | use _health_check::HealthCheckRequest; 6 | use _health_check::HealthCheckResponse; 7 | 8 | use crate::helpers::TestServer; 9 | 10 | mod _health_check { 11 | tonic::include_proto!("health_check"); 12 | } 13 | 14 | #[tokio::test] 15 | async fn health_check() -> anyhow::Result<()> { 16 | let server = TestServer::new().await; 17 | let mut grpc_client = HealthCheckClient::connect(server.endpoint()).await?; 18 | let request = tonic::Request::new(HealthCheckRequest {}); 19 | 20 | let response = grpc_client.check(request).await?; 21 | assert_eq!(response.into_inner(), HealthCheckResponse { status: "OK".into() }); 22 | 23 | Ok(()) 24 | } 25 | -------------------------------------------------------------------------------- /.github/releases/v0.5.0-dev.6.md: -------------------------------------------------------------------------------- 1 | Note that all features related to diff chain updates are now marked as deprecated. Diff chains are a useful optimisation when publishing many updates to a DID Document. However, their design may be incompatible with upcoming changes to the IOTA network and should be considered unstable. 2 | 3 | Another major change is the removal of the `MerkleKeyCollection` verification method type, which provided a compact representation for issuing and revoking Verifiable Credentials with multiple cryptographic keys. The `MerkleKeyCollection` suffered from disadvantages which limited scalability when managing more than a few thousand keys. While these disadvantages could be mitigated somewhat, the decision was made to replace it with one or more alternatives not affected by its fundamental limitations, upcoming in the next major release. -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/src/iota/iota_metadata_encoding.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2022 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | use identity_iota::iota::StateMetadataEncoding; 5 | use serde_repr::Deserialize_repr; 6 | use serde_repr::Serialize_repr; 7 | use wasm_bindgen::prelude::*; 8 | 9 | /// Indicates the encoding of a DID document in state metadata. 10 | #[wasm_bindgen(js_name = StateMetadataEncoding)] 11 | #[derive(Serialize_repr, Deserialize_repr)] 12 | #[repr(u8)] 13 | pub enum WasmStateMetadataEncoding { 14 | /// State Metadata encoded as JSON. 15 | Json = 0, 16 | } 17 | 18 | impl From for StateMetadataEncoding { 19 | fn from(encoding: WasmStateMetadataEncoding) -> Self { 20 | match encoding { 21 | WasmStateMetadataEncoding::Json => Self::Json, 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /identity_verification/src/verification_method/method_relationship.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | /// Verification relationships. 5 | /// 6 | /// See also: . 7 | #[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord, Deserialize, Serialize, strum::IntoStaticStr)] 8 | pub enum MethodRelationship { 9 | /// The authentication verification relationship. 10 | Authentication, 11 | /// The assertion method verification relationship. 12 | AssertionMethod, 13 | /// The key agreement verification relationship. 14 | KeyAgreement, 15 | /// The capability delegation verification relationship. 16 | CapabilityDelegation, 17 | /// The capability invocation verification relationship. 18 | CapabilityInvocation, 19 | } 20 | -------------------------------------------------------------------------------- /identity_core/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2021 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #![doc = include_str!("./../README.md")] 5 | #![allow(clippy::upper_case_acronyms)] 6 | #![warn( 7 | rust_2018_idioms, 8 | unreachable_pub, 9 | missing_docs, 10 | rustdoc::missing_crate_level_docs, 11 | rustdoc::broken_intra_doc_links, 12 | rustdoc::private_intra_doc_links, 13 | rustdoc::private_doc_tests, 14 | clippy::missing_safety_doc, 15 | // clippy::missing_errors_doc 16 | )] 17 | 18 | #[doc(inline)] 19 | pub use serde_json::json; 20 | 21 | #[forbid(unsafe_code)] 22 | pub mod common; 23 | #[forbid(unsafe_code)] 24 | pub mod convert; 25 | #[forbid(unsafe_code)] 26 | pub mod error; 27 | 28 | #[cfg(feature = "custom_time")] 29 | pub mod custom_time; 30 | 31 | pub use self::error::Error; 32 | pub use self::error::Result; 33 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/src/credential/jws.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | use identity_iota::credential::Jws; 5 | use wasm_bindgen::prelude::*; 6 | 7 | /// A wrapper around a JSON Web Signature (JWS). 8 | #[wasm_bindgen(js_name = Jws)] 9 | pub struct WasmJws(pub(crate) Jws); 10 | 11 | #[wasm_bindgen(js_class = Jws)] 12 | impl WasmJws { 13 | pub(crate) fn new(jws: Jws) -> Self { 14 | WasmJws(jws) 15 | } 16 | /// Creates a new {@link Jws} from the given string. 17 | #[wasm_bindgen(constructor)] 18 | pub fn constructor(jws_string: String) -> Self { 19 | Self(Jws::new(jws_string)) 20 | } 21 | 22 | /// Returns a clone of the JWS string. 23 | #[wasm_bindgen(js_name = toString)] 24 | pub fn to_string_clone(&self) -> String { 25 | self.0.as_str().to_owned() 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /identity_jose/src/jwk/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2025 IOTA Stiftung, Fondazione LINKS 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | //! JSON Web Keys ([JWK](https://tools.ietf.org/html/rfc7517)) 5 | 6 | mod composite_jwk; 7 | #[cfg(feature = "jwk-conversion")] 8 | mod conversion; 9 | mod curve; 10 | mod jwk_akp; 11 | mod jwk_ext; 12 | mod key; 13 | mod key_hybrid; 14 | mod key_operation; 15 | mod key_params; 16 | mod key_set; 17 | mod key_type; 18 | mod key_use; 19 | 20 | pub use self::composite_jwk::*; 21 | #[cfg(feature = "jwk-conversion")] 22 | pub use self::conversion::*; 23 | pub use self::curve::*; 24 | pub use self::jwk_akp::*; 25 | pub use self::key::*; 26 | pub use self::key_hybrid::*; 27 | pub use self::key_operation::*; 28 | pub use self::key_params::*; 29 | pub use self::key_set::*; 30 | pub use self::key_type::*; 31 | pub use self::key_use::*; 32 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/lib/jose/jwk_operation.ts: -------------------------------------------------------------------------------- 1 | /** Supported algorithms for the JSON Web Key `key_ops` property. 2 | * 3 | * [More Info](https://www.iana.org/assignments/jose/jose.xhtml#web-key-operations) */ 4 | export const enum JwkOperation { 5 | /** Compute digital signature or MAC. */ 6 | Sign = "sign", 7 | /** Verify digital signature or MAC. */ 8 | Verify = "verify", 9 | /** Encrypt content. */ 10 | Encrypt = "encrypt", 11 | /** Decrypt content and validate decryption, if applicable. */ 12 | Decrypt = "decrypt", 13 | /** Encrypt key. */ 14 | WrapKey = "wrapKey", 15 | /** Decrypt key and validate decryption, if applicable. */ 16 | UnwrapKey = "unwrapKey", 17 | /** Derive key. */ 18 | DeriveKey = "deriveKey", 19 | /** Derive bits not to be used as a key. */ 20 | DeriveBits = "deriveBits", 21 | } 22 | -------------------------------------------------------------------------------- /identity_credential/src/validator/jpt_credential_validation/decoded_jpt_credential.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung, Fondazione Links 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | use identity_core::common::Object; 5 | use jsonprooftoken::jwp::issued::JwpIssued; 6 | 7 | use crate::credential::Credential; 8 | 9 | /// Decoded [`Credential`] from a cryptographically verified JWP. 10 | #[non_exhaustive] 11 | #[derive(Debug, Clone)] 12 | pub struct DecodedJptCredential { 13 | /// The decoded credential parsed to the [Verifiable Credentials Data model](https://www.w3.org/TR/vc-data-model/). 14 | pub credential: Credential, 15 | /// The custom claims parsed from the JPT. 16 | pub custom_claims: Option, 17 | /// The decoded and verifier Issued JWP, will be used to construct the Presented JWP 18 | pub decoded_jwp: JwpIssued, 19 | } 20 | -------------------------------------------------------------------------------- /identity_storage/src/key_id_storage/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | //! A Key ID Storage is used to store the identifiers of keys 5 | //! that were generated in a Key Storage. 6 | //! 7 | //! This module provides the [`KeyIdStorage`] trait that 8 | //! stores the mapping from a method, identified by a [`MethodDigest`], 9 | //! to its [`KeyId`](crate::key_storage::KeyId). 10 | 11 | #[allow(clippy::module_inception)] 12 | mod key_id_storage; 13 | mod key_id_storage_error; 14 | mod method_digest; 15 | 16 | #[cfg(feature = "keytool")] 17 | mod keytool; 18 | #[cfg(feature = "memstore")] 19 | mod memstore; 20 | 21 | #[cfg(test)] 22 | mod tests; 23 | 24 | pub use key_id_storage::*; 25 | pub use key_id_storage_error::*; 26 | #[cfg(feature = "memstore")] 27 | pub use memstore::*; 28 | pub use method_digest::*; 29 | -------------------------------------------------------------------------------- /.github/workflows/wasm-create-hotfix-pr.yml: -------------------------------------------------------------------------------- 1 | name: Wasm Create Hotfix PR 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | branch: 7 | description: 'Name of the support branch (e.g. `support/wasm-v1.2`)' 8 | required: true 9 | 10 | jobs: 11 | create-hotfix-pr: 12 | uses: './.github/workflows/shared-create-hotfix-pr.yml' 13 | with: 14 | branch: ${{ github.event.inputs.branch }} 15 | branch-regex: ^support\/wasm-v[0-9]+\.[0-9]+$ 16 | tag-prefix: wasm-v 17 | main-tag-regex: ^wasm-v[0-9]+\.[0-9]+\.[0-9]+$ 18 | changelog-config-path: ./bindings/wasm/identity_wasm/.github_changelog_generator 19 | changelog-path: ./bindings/wasm/identity_wasm/CHANGELOG.md 20 | release-target: wasm 21 | secrets: 22 | GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} 23 | GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} 24 | -------------------------------------------------------------------------------- /identity_credential/src/credential/jpt.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung, Fondazione Links 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | use serde::Deserialize; 5 | use serde::Serialize; 6 | 7 | /// This JSON Proof Token could represent a JWP both in the Issued and Presented forms. 8 | #[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq)] 9 | pub struct Jpt(String); 10 | 11 | impl Jpt { 12 | /// Creates a new `Jwt` from the given string. 13 | pub fn new(jpt_string: String) -> Self { 14 | Self(jpt_string) 15 | } 16 | 17 | /// Returns a reference of the JWT string. 18 | pub fn as_str(&self) -> &str { 19 | &self.0 20 | } 21 | } 22 | 23 | impl From for Jpt { 24 | fn from(jpt: String) -> Self { 25 | Self::new(jpt) 26 | } 27 | } 28 | 29 | impl From for String { 30 | fn from(jpt: Jpt) -> Self { 31 | jpt.0 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/src/storage/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2025 IOTA Stiftung, Fondazione LINKS 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | mod jpt_timeframe_revocation_ext; 5 | mod jwk_gen_output; 6 | mod jwk_storage; 7 | mod jwk_storage_bbs_plus_ext; 8 | mod jwk_storage_pqc; 9 | mod jwt_presentation_options; 10 | mod key_id_storage; 11 | #[cfg(feature = "keytool")] 12 | mod keytool_storage; 13 | mod method_digest; 14 | mod signature_options; 15 | mod wasm_storage; 16 | mod wasm_storage_signer; 17 | 18 | pub use jpt_timeframe_revocation_ext::*; 19 | pub use jwk_gen_output::*; 20 | pub use jwk_storage::*; 21 | pub use jwt_presentation_options::*; 22 | pub use key_id_storage::*; 23 | #[cfg(feature = "keytool")] 24 | pub use keytool_storage::*; 25 | pub use method_digest::*; 26 | pub use signature_options::*; 27 | pub use wasm_storage::*; 28 | pub use wasm_storage_signer::*; 29 | -------------------------------------------------------------------------------- /identity_verification/src/verification_method/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | //! The `verification` module contains code for verifying the correctness of core DID-related types. 5 | //! 6 | //! This crate DOES NOT verify IOTA-specific invariants, those are exposed by the 7 | //! `identity_iota_core_legacy` crate. 8 | 9 | mod builder; 10 | mod material; 11 | mod method; 12 | mod method_ref; 13 | mod method_relationship; 14 | mod method_scope; 15 | mod method_type; 16 | 17 | pub use self::builder::MethodBuilder; 18 | pub use self::material::CustomMethodData; 19 | pub use self::material::MethodData; 20 | pub use self::method::VerificationMethod; 21 | pub use self::method_ref::MethodRef; 22 | pub use self::method_relationship::MethodRelationship; 23 | pub use self::method_scope::MethodScope; 24 | pub use self::method_type::MethodType; 25 | -------------------------------------------------------------------------------- /identity_credential/tests/fixtures/domain-config-valid.json: -------------------------------------------------------------------------------- 1 | { 2 | "@context": "https://identity.foundation/.well-known/did-configuration/v1", 3 | "linked_dids": [ 4 | "eyJraWQiOiJkaWQ6ZXhhbXBsZTpEUnZvYXpzR05yNmFzWlNWUHVzWDIyN3ZYVnYzTDU4b1loZkFlUU12b3JieCNqd2siLCJhbGciOiJFZERTQSJ9.eyJleHAiOjE3MTc4MzY0NjcsImlzcyI6ImRpZDpleGFtcGxlOkRSdm9henNHTnI2YXNaU1ZQdXNYMjI3dlhWdjNMNThvWWhmQWVRTXZvcmJ4IiwibmJmIjoxNjg2MzAwNDY3LCJzdWIiOiJkaWQ6ZXhhbXBsZTpEUnZvYXpzR05yNmFzWlNWUHVzWDIyN3ZYVnYzTDU4b1loZkFlUU12b3JieCIsInZjIjp7IkBjb250ZXh0IjpbImh0dHBzOi8vd3d3LnczLm9yZy8yMDE4L2NyZWRlbnRpYWxzL3YxIiwiaHR0cHM6Ly9pZGVudGl0eS5mb3VuZGF0aW9uLy53ZWxsLWtub3duL2RpZC1jb25maWd1cmF0aW9uL3YxIl0sInR5cGUiOlsiVmVyaWZpYWJsZUNyZWRlbnRpYWwiLCJEb21haW5MaW5rYWdlQ3JlZGVudGlhbCJdLCJjcmVkZW50aWFsU3ViamVjdCI6eyJvcmlnaW4iOiJodHRwczovL2Zvby5leGFtcGxlLmNvbS8ifX19.-XQpvYM0ZzQbn9cBaJKzgPu1XXMRS6KDe663JHbNvvD6ALD5yYJRTeh5ABzjHA3eBQ7D6yj5C3uSaXPe_A2hCw" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /identity_credential/tests/fixtures/domain-config-invalid-context.json: -------------------------------------------------------------------------------- 1 | { 2 | "@context": "https://identity.foundation/.well-known/did-configuration/v0", 3 | "linked_dids": [ 4 | "eyJraWQiOiJkaWQ6ZXhhbXBsZTpEUnZvYXpzR05yNmFzWlNWUHVzWDIyN3ZYVnYzTDU4b1loZkFlUU12b3JieCNqd2siLCJhbGciOiJFZERTQSJ9.eyJleHAiOjE3MTc4MzY0NjcsImlzcyI6ImRpZDpleGFtcGxlOkRSdm9henNHTnI2YXNaU1ZQdXNYMjI3dlhWdjNMNThvWWhmQWVRTXZvcmJ4IiwibmJmIjoxNjg2MzAwNDY3LCJzdWIiOiJkaWQ6ZXhhbXBsZTpEUnZvYXpzR05yNmFzWlNWUHVzWDIyN3ZYVnYzTDU4b1loZkFlUU12b3JieCIsInZjIjp7IkBjb250ZXh0IjpbImh0dHBzOi8vd3d3LnczLm9yZy8yMDE4L2NyZWRlbnRpYWxzL3YxIiwiaHR0cHM6Ly9pZGVudGl0eS5mb3VuZGF0aW9uLy53ZWxsLWtub3duL2RpZC1jb25maWd1cmF0aW9uL3YxIl0sInR5cGUiOlsiVmVyaWZpYWJsZUNyZWRlbnRpYWwiLCJEb21haW5MaW5rYWdlQ3JlZGVudGlhbCJdLCJjcmVkZW50aWFsU3ViamVjdCI6eyJvcmlnaW4iOiJodHRwczovL2Zvby5leGFtcGxlLmNvbS8ifX19.-XQpvYM0ZzQbn9cBaJKzgPu1XXMRS6KDe663JHbNvvD6ALD5yYJRTeh5ABzjHA3eBQ7D6yj5C3uSaXPe_A2hCw" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /identity_verification/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "identity_verification" 3 | version = "1.8.0-beta.1" 4 | authors.workspace = true 5 | edition.workspace = true 6 | homepage.workspace = true 7 | license.workspace = true 8 | repository.workspace = true 9 | description = "Verification data types and functionality for IOTA Identity" 10 | 11 | [dependencies] 12 | identity_core = { version = "=1.8.0-beta.1", path = "./../identity_core" } 13 | identity_did = { version = "=1.8.0-beta.1", path = "./../identity_did", default-features = false } 14 | identity_jose = { version = "=1.8.0-beta.1", path = "./../identity_jose", default-features = false } 15 | serde.workspace = true 16 | serde_json.workspace = true 17 | strum.workspace = true 18 | thiserror.workspace = true 19 | 20 | [dev-dependencies] 21 | 22 | [lints] 23 | workspace = true 24 | 25 | [features] 26 | jwk-conversion = [ 27 | "identity_jose/jwk-conversion", 28 | ] 29 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/src/jpt/jpt_claims.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | use wasm_bindgen::prelude::*; 5 | 6 | #[wasm_bindgen] 7 | extern "C" { 8 | #[wasm_bindgen(typescript_type = "JptClaims")] 9 | pub type WasmJptClaims; 10 | } 11 | 12 | #[wasm_bindgen(typescript_custom_section)] 13 | const I_JPT_CLAIMS: &'static str = r#" 14 | /** JPT claims */ 15 | 16 | interface JptClaims { 17 | /** Who issued the JWP*/ 18 | readonly iss?: string; 19 | /** Subject of the JPT. */ 20 | readonly sub?: string; 21 | /** Expiration time. */ 22 | readonly exp?: number; 23 | /** Issuance date. */ 24 | readonly iat?: number; 25 | /** Time before which the JPT MUST NOT be accepted */ 26 | readonly nbf?: number; 27 | /** Unique ID for the JPT. */ 28 | readonly jti?: string; 29 | /** Custom claims. */ 30 | readonly [properties: string]: any; 31 | }"#; 32 | -------------------------------------------------------------------------------- /identity_core/src/common/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2022 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | //! Definitions of common types (`Url`, `Timestamp`, JSON types, etc). 5 | 6 | pub use self::context::Context; 7 | pub use self::data_url::*; 8 | pub use self::key_comparable::KeyComparable; 9 | pub use self::one_or_many::OneOrMany; 10 | pub use self::one_or_set::OneOrSet; 11 | pub use self::ordered_set::OrderedSet; 12 | pub use self::single_struct_error::*; 13 | pub use self::timestamp::Duration; 14 | pub use self::timestamp::Timestamp; 15 | pub use self::url::Url; 16 | pub use product_common::object::Object; 17 | pub use product_common::object::Value; 18 | pub use string_or_url::StringOrUrl; 19 | 20 | mod context; 21 | mod data_url; 22 | mod key_comparable; 23 | mod one_or_many; 24 | mod one_or_set; 25 | mod ordered_set; 26 | mod single_struct_error; 27 | mod string_or_url; 28 | mod timestamp; 29 | mod url; 30 | -------------------------------------------------------------------------------- /identity_credential/tests/fixtures/credential-9.json: -------------------------------------------------------------------------------- 1 | { 2 | "@context": [ 3 | "https://www.w3.org/2018/credentials/v1", 4 | "https://www.w3.org/2018/credentials/examples/v1" 5 | ], 6 | "id": "http://example.edu/credentials/3732", 7 | "type": ["VerifiableCredential", "UniversityDegreeCredential"], 8 | "issuer": "https://example.edu/issuers/14", 9 | "issuanceDate": "2010-01-01T19:23:24Z", 10 | "credentialSubject": { 11 | "id": "did:example:ebfeb1f712ebc6f1c276e12ec21", 12 | "degree": { 13 | "type": "BachelorDegree", 14 | "name": "Bachelor of Science in Mechanical Engineering" 15 | } 16 | }, 17 | "credentialSchema": [ 18 | { 19 | "id": "https://example.org/examples/degree.json", 20 | "type": "JsonSchemaValidator2018" 21 | }, 22 | { 23 | "id": "https://example.org/examples/degree.zkp", 24 | "type": "ZkpExampleSchema2018" 25 | } 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /bindings/grpc/proto/sd_jwt.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | syntax = "proto3"; 5 | package sd_jwt; 6 | 7 | message KeyBindingOptions { 8 | optional string nonce = 1; 9 | optional string aud = 2; 10 | // TODO: add JWS validation options 11 | optional string earliest_issuance_date = 3; 12 | optional string latest_issuance_date = 4; 13 | string holder_did = 5; 14 | } 15 | 16 | message VerificationRequest { 17 | // SD-JWT encoded credential. 18 | string jwt = 1; 19 | optional KeyBindingOptions kb_options = 2; 20 | } 21 | 22 | message VerificationResponse { 23 | // JSON encoded credential, extracted from the request's SD-JWT. 24 | string credential = 1; 25 | } 26 | 27 | service Verification { 28 | // Performs all validation steps on a SD-JWT encoded credential. 29 | rpc verify(VerificationRequest) returns (VerificationResponse); 30 | } -------------------------------------------------------------------------------- /identity_jose/src/jwk/curve/ecx.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | use core::fmt::Display; 5 | use core::fmt::Formatter; 6 | use core::fmt::Result; 7 | 8 | /// Supported Elliptic Curves. 9 | /// 10 | /// [More Info](https://www.iana.org/assignments/jose/jose.xhtml#web-key-elliptic-curve) 11 | #[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] 12 | pub enum EcxCurve { 13 | /// X25519 function key pairs. 14 | X25519, 15 | /// X448 function key pairs. 16 | X448, 17 | } 18 | 19 | impl EcxCurve { 20 | /// Returns the name of the curve as a string slice. 21 | pub const fn name(self) -> &'static str { 22 | match self { 23 | Self::X25519 => "X25519", 24 | Self::X448 => "X448", 25 | } 26 | } 27 | } 28 | 29 | impl Display for EcxCurve { 30 | fn fmt(&self, f: &mut Formatter<'_>) -> Result { 31 | f.write_str(self.name()) 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /identity_credential/tests/fixtures/domain-config-extra-property.json: -------------------------------------------------------------------------------- 1 | { 2 | "@context": "https://identity.foundation/.well-known/did-configuration/v1", 3 | "linked_dids": [ 4 | "eyJraWQiOiJkaWQ6ZXhhbXBsZTpEUnZvYXpzR05yNmFzWlNWUHVzWDIyN3ZYVnYzTDU4b1loZkFlUU12b3JieCNqd2siLCJhbGciOiJFZERTQSJ9.eyJleHAiOjE3MTc4MzY0NjcsImlzcyI6ImRpZDpleGFtcGxlOkRSdm9henNHTnI2YXNaU1ZQdXNYMjI3dlhWdjNMNThvWWhmQWVRTXZvcmJ4IiwibmJmIjoxNjg2MzAwNDY3LCJzdWIiOiJkaWQ6ZXhhbXBsZTpEUnZvYXpzR05yNmFzWlNWUHVzWDIyN3ZYVnYzTDU4b1loZkFlUU12b3JieCIsInZjIjp7IkBjb250ZXh0IjpbImh0dHBzOi8vd3d3LnczLm9yZy8yMDE4L2NyZWRlbnRpYWxzL3YxIiwiaHR0cHM6Ly9pZGVudGl0eS5mb3VuZGF0aW9uLy53ZWxsLWtub3duL2RpZC1jb25maWd1cmF0aW9uL3YxIl0sInR5cGUiOlsiVmVyaWZpYWJsZUNyZWRlbnRpYWwiLCJEb21haW5MaW5rYWdlQ3JlZGVudGlhbCJdLCJjcmVkZW50aWFsU3ViamVjdCI6eyJvcmlnaW4iOiJodHRwczovL2Zvby5leGFtcGxlLmNvbS8ifX19.-XQpvYM0ZzQbn9cBaJKzgPu1XXMRS6KDe663JHbNvvD6ALD5yYJRTeh5ABzjHA3eBQ7D6yj5C3uSaXPe_A2hCw" 5 | ], 6 | "other": "some value" 7 | } 8 | -------------------------------------------------------------------------------- /identity_credential/README.md: -------------------------------------------------------------------------------- 1 | # IOTA Identity - Credentials 2 | 3 | This crate contains types representing verifiable credentials and verifiable presentations as defined in the [W3C Verifiable Credentials Data Model](https://www.w3.org/TR/vc-data-model/). 4 | 5 | Convenience methods for validating [Verifiable Credentials](https://docs.iota.org/iota-identity/explanations/verifiable-credentials) and [Verifiable Presentations](https://docs.iota.org/iota-identity/explanations/verifiable-presentations) are also provided: 6 | 7 | - [`JwtCredentialValidator`](crate::validator::JwtCredentialValidator) 8 | - [`JwtPresentationValidator`](crate::validator::JwtPresentationValidator) 9 | 10 | The [IOTA Identity Framework Docs](https://docs.iota.org/iota-identity) offers a comprehensive overview of verifiable credentials and presentations along with practical demonstrations and examples showcasing the capabilities of this crate in creating and validating them. 11 | -------------------------------------------------------------------------------- /identity_credential/src/sd_jwt_vc/metadata/display.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | use serde::Deserialize; 5 | use serde::Serialize; 6 | use serde_json::Value; 7 | 8 | /// Credential type's display information of a given language. 9 | #[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize)] 10 | pub struct DisplayMetadata { 11 | /// Language tag as defined in [RFC5646](https://www.rfc-editor.org/rfc/rfc5646.txt). 12 | pub lang: String, 13 | /// VC type's human-readable name. 14 | pub name: String, 15 | /// VC type's human-readable description. 16 | pub description: Option, 17 | /// Optional rendering information. 18 | pub rendering: Option, 19 | } 20 | 21 | /// Information on how to render a given credential type. 22 | #[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize)] 23 | pub struct RenderingMetadata(serde_json::Map); 24 | -------------------------------------------------------------------------------- /identity_did/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2025 IOTA Stiftung, Fondazione LINKS 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #![forbid(unsafe_code)] 5 | #![doc = include_str!("./../README.md")] 6 | #![allow(clippy::upper_case_acronyms)] 7 | #![warn( 8 | rust_2018_idioms, 9 | unreachable_pub, 10 | // missing_docs, 11 | rustdoc::missing_crate_level_docs, 12 | rustdoc::broken_intra_doc_links, 13 | rustdoc::private_intra_doc_links, 14 | rustdoc::private_doc_tests, 15 | clippy::missing_safety_doc, 16 | // clippy::missing_errors_doc 17 | )] 18 | 19 | #[allow(clippy::module_inception)] 20 | mod did; 21 | mod did_compositejwk; 22 | mod did_jwk; 23 | mod did_url; 24 | mod error; 25 | 26 | pub use crate::did_url::DIDUrl; 27 | pub use crate::did_url::RelativeDIDUrl; 28 | pub use ::did_url_parser::DID as BaseDIDUrl; 29 | pub use did::CoreDID; 30 | pub use did::DID; 31 | pub use did_compositejwk::*; 32 | pub use did_jwk::*; 33 | pub use error::Error; 34 | -------------------------------------------------------------------------------- /identity_jose/src/jwk/curve/ed.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | use core::fmt::Display; 5 | use core::fmt::Formatter; 6 | use core::fmt::Result; 7 | 8 | /// Supported Elliptic Curves. 9 | /// 10 | /// [More Info](https://www.iana.org/assignments/jose/jose.xhtml#web-key-elliptic-curve) 11 | #[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] 12 | pub enum EdCurve { 13 | /// Ed25519 signature algorithm key pairs. 14 | Ed25519, 15 | /// Ed448 signature algorithm key pairs. 16 | Ed448, 17 | } 18 | 19 | impl EdCurve { 20 | /// Returns the name of the curve as a string slice. 21 | pub const fn name(self) -> &'static str { 22 | match self { 23 | Self::Ed25519 => "Ed25519", 24 | Self::Ed448 => "Ed448", 25 | } 26 | } 27 | } 28 | 29 | impl Display for EdCurve { 30 | fn fmt(&self, f: &mut Formatter<'_>) -> Result { 31 | f.write_str(self.name()) 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /identity_jose/src/tests/fixtures/rfc8037_ed25519.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | [ 4 | // https://tools.ietf.org/html/rfc8037#appendix-A.4 5 | TestVector { 6 | private_jwk: r#" 7 | { 8 | "kty": "OKP", 9 | "crv": "Ed25519", 10 | "d": "nWGxne_9WmC6hEr0kuwsxERJxWl7MmkZcDusAxyuf2A", 11 | "x": "11qYAYKxCrfVS_7TyWQHOg7hcvPapiMlrwIaaPcHURo" 12 | } 13 | "#, 14 | public_jwk: r#" 15 | { 16 | "kty": "OKP", 17 | "crv": "Ed25519", 18 | "x": "11qYAYKxCrfVS_7TyWQHOg7hcvPapiMlrwIaaPcHURo" 19 | } 20 | "#, 21 | thumbprint_b64: "kPrK_qmxVWaYVA9wwBF6Iuo3vVzz7TxHCTwXBygrS4k", 22 | header: r#"{"alg":"EdDSA"}"#, 23 | payload: "Example of Ed25519 signing", 24 | encoded: "eyJhbGciOiJFZERTQSJ9.RXhhbXBsZSBvZiBFZDI1NTE5IHNpZ25pbmc.hgyY0il_MGCjP0JzlnLWG1PPOt7-09PGcvMg3AIbQR6dWbhijcNR4ki4iylGjg5BhVsPt9g7sVvpAr_MuM0KAg", 25 | }, 26 | ] 27 | -------------------------------------------------------------------------------- /identity_credential/src/validator/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | //! Verifiable Credential and Presentation validators. 5 | 6 | #[cfg(feature = "jpt-bbs-plus")] 7 | pub use self::jpt_credential_validation::*; 8 | #[cfg(feature = "jpt-bbs-plus")] 9 | pub use self::jpt_presentation_validation::*; 10 | pub use self::jwt_credential_validation::*; 11 | pub use self::jwt_presentation_validation::*; 12 | pub use self::options::FailFast; 13 | pub use self::options::StatusCheck; 14 | pub use self::options::SubjectHolderRelationship; 15 | #[cfg(feature = "sd-jwt")] 16 | pub use self::sd_jwt::*; 17 | 18 | #[cfg(feature = "jpt-bbs-plus")] 19 | mod jpt_credential_validation; 20 | #[cfg(feature = "jpt-bbs-plus")] 21 | mod jpt_presentation_validation; 22 | mod jwt_credential_validation; 23 | mod jwt_presentation_validation; 24 | mod options; 25 | #[cfg(feature = "sd-jwt")] 26 | mod sd_jwt; 27 | #[cfg(test)] 28 | pub(crate) mod test_utils; 29 | -------------------------------------------------------------------------------- /identity_credential/src/credential/jwp_credential_options.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung, Fondazione Links 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | /// Options for creating a JSON Web Proof. 5 | #[non_exhaustive] 6 | #[derive(Debug, Default, serde::Serialize, serde::Deserialize, Eq, PartialEq, Clone)] 7 | #[serde(rename_all = "camelCase")] 8 | #[serde(default)] 9 | pub struct JwpCredentialOptions { 10 | /// The kid to set in the Issuer Protected Header. 11 | /// 12 | /// If unset, the kid of the JWK with which the JWP is produced is used. 13 | #[serde(skip_serializing_if = "Option::is_none")] 14 | pub kid: Option, 15 | } 16 | 17 | impl JwpCredentialOptions { 18 | /// Creates a new [`JwsSignatureOptions`]. 19 | pub fn new() -> Self { 20 | Self::default() 21 | } 22 | 23 | /// Replace the value of the `kid` field. 24 | pub fn kid(mut self, value: impl Into) -> Self { 25 | self.kid = Some(value.into()); 26 | self 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /identity_credential/tests/fixtures/credential-1.json: -------------------------------------------------------------------------------- 1 | { 2 | "@context": [ 3 | "https://www.w3.org/2018/credentials/v1", 4 | "https://www.w3.org/2018/credentials/examples/v1" 5 | ], 6 | "id": "http://example.edu/credentials/58473", 7 | "type": ["VerifiableCredential", "AlumniCredential"], 8 | "issuer": "https://example.edu/issuers/14", 9 | "issuanceDate": "2010-01-01T19:23:24Z", 10 | "credentialSubject": { 11 | "id": "did:example:ebfeb1f712ebc6f1c276e12ec21", 12 | "alumniOf": "Example University" 13 | }, 14 | "proof": { 15 | "type": "RsaSignature2018", 16 | "created": "2017-06-18T21:19:10Z", 17 | "proofPurpose": "assertionMethod", 18 | "verificationMethod": "https://example.com/jdoe/keys/1", 19 | "jws": "eyJhbGciOiJSUzI1NiIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..TCYt5XsITJX1CxPCT8yAV-TVkIEq_PbChOMqsLfRoPsnsgw5WEuts01mq-pQy7UJiN5mgRxD-WUcX16dUEMGlv50aqzpqh4Qktb3rk-BuQy72IFLOqV0G_zS245-kronKb78cPN25DGlcTwLtjPAYuNzVBAh4vGHSrQyHUdBBPM" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /identity_credential/src/validator/jpt_presentation_validation/decoded_jpt_presentation.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung, Fondazione Links 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | use identity_core::common::Object; 5 | use identity_core::common::Url; 6 | use jsonprooftoken::jwp::presented::JwpPresented; 7 | 8 | use crate::credential::Credential; 9 | 10 | /// Decoded [`Credential`] from a cryptographically verified JWP. 11 | #[non_exhaustive] 12 | #[derive(Debug, Clone)] 13 | pub struct DecodedJptPresentation { 14 | /// The decoded credential parsed to the [Verifiable Credentials Data model](https://www.w3.org/TR/vc-data-model/). 15 | pub credential: Credential, 16 | /// The `aud` property parsed from the JWT claims. 17 | pub aud: Option, 18 | /// The custom claims parsed from the JPT. 19 | pub custom_claims: Option, 20 | /// The decoded and verifier Issued JWP, will be used to construct the Presented JWP 21 | pub decoded_jwp: JwpPresented, 22 | } 23 | -------------------------------------------------------------------------------- /identity_jose/src/jws/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | //! JSON Web Signatures ([JWS](https://tools.ietf.org/html/rfc7515)) 5 | //! 6 | //! The encoding and decoding APIs are strongly informed by the requirements of the higher level functionality 7 | //! offered by the IOTA Identity library. Hence these APIs may possibly not be immediately recognizable from a standard 8 | //! JWT/JWS perspective. See `identity_jose/examples/jws_encoding_decoding.rs` for a complete example of how to encode 9 | //! and then decode a JWS. 10 | 11 | mod algorithm; 12 | mod charset; 13 | mod custom_verification; 14 | mod decoder; 15 | mod encoding; 16 | mod format; 17 | mod header; 18 | mod recipient; 19 | 20 | pub use self::algorithm::*; 21 | pub use self::charset::*; 22 | pub use self::custom_verification::*; 23 | pub use self::decoder::*; 24 | pub use self::encoding::*; 25 | pub use self::format::*; 26 | pub use self::header::*; 27 | pub use self::recipient::*; 28 | -------------------------------------------------------------------------------- /.github/workflows/rust-publish-to-crates.yml: -------------------------------------------------------------------------------- 1 | name: Rust publish to crates.io 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | version: 7 | description: 'Version to publish Rust under (e.g. `1.2.3-dev.1`)' 8 | required: true 9 | branch: 10 | description: 'Branch to run publish from' 11 | required: true 12 | dry-run: 13 | description: 'Run in dry-run mode' 14 | type: boolean 15 | required: false 16 | default: true 17 | 18 | jobs: 19 | publish-rust: 20 | runs-on: ubuntu-latest 21 | steps: 22 | - name: Checkout 23 | uses: actions/checkout@v3 24 | with: 25 | ref: ${{ github.event.inputs.branch }} 26 | - name: Publish to crates.io 27 | uses: './.github/actions/publish/publish-rust' 28 | with: 29 | version: ${{ github.event.inputs.version }} 30 | crates-token: ${{ secrets.CRATES_IO_TOKEN }} 31 | dry-run: ${{ github.event.inputs.dry-run }} 32 | -------------------------------------------------------------------------------- /identity_storage/src/key_storage/key_id.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | /// An identifier for a private key stored in a key storage. 5 | /// 6 | /// This type is returned by a key storage implementation when 7 | /// generating cryptographic key pairs and later used as a parameter when signing data. 8 | #[derive(Debug, Clone, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)] 9 | pub struct KeyId(String); 10 | 11 | impl KeyId { 12 | /// Creates a new key identifier from a string. 13 | pub fn new(id: impl Into) -> Self { 14 | Self(id.into()) 15 | } 16 | 17 | /// Returns string representation of the key id. 18 | pub fn as_str(&self) -> &str { 19 | &self.0 20 | } 21 | } 22 | 23 | impl std::fmt::Display for KeyId { 24 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 25 | f.write_str(&self.0) 26 | } 27 | } 28 | 29 | impl From for String { 30 | fn from(value: KeyId) -> Self { 31 | value.0 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /identity_jose/src/jwk/conversion/secp256k1.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2025 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | use anyhow::Context; 5 | use fastcrypto::secp256k1::Secp256k1KeyPair; 6 | use fastcrypto::secp256k1::Secp256k1PublicKeyAsBytes; 7 | use fastcrypto::traits::ToFromBytes; 8 | use k256::PublicKey; 9 | use k256::SecretKey; 10 | 11 | use crate::jwk::Jwk; 12 | use crate::jws::JwsAlgorithm; 13 | 14 | pub(crate) fn pk_to_jwk(pk: &Secp256k1PublicKeyAsBytes) -> Jwk { 15 | let jwk_str = PublicKey::from_sec1_bytes(&pk.0) 16 | .expect("valid secp256k1 pk") 17 | .to_jwk_string(); 18 | let mut jwk: Jwk = serde_json::from_str(&jwk_str).expect("valid JWK encoded secp256k1"); 19 | jwk.set_alg(JwsAlgorithm::ES256K.name()); 20 | jwk 21 | } 22 | 23 | pub(crate) fn jwk_to_keypair(jwk: &Jwk) -> anyhow::Result { 24 | let sk = SecretKey::from_jwk_str(&serde_json::to_string(jwk)?)?; 25 | Secp256k1KeyPair::from_bytes(sk.to_bytes().as_ref()).context("failed to create secp256k1 keypair from JWK") 26 | } 27 | -------------------------------------------------------------------------------- /identity_jose/src/jwk/conversion/secp256r1.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2025 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | use anyhow::Context; 5 | use fastcrypto::secp256r1::Secp256r1KeyPair; 6 | use fastcrypto::secp256r1::Secp256r1PublicKeyAsBytes; 7 | use fastcrypto::traits::ToFromBytes; 8 | use p256::PublicKey; 9 | use p256::SecretKey; 10 | 11 | use crate::jwk::Jwk; 12 | use crate::jws::JwsAlgorithm; 13 | 14 | pub(crate) fn pk_to_jwk(pk: &Secp256r1PublicKeyAsBytes) -> Jwk { 15 | let jwk_str = PublicKey::from_sec1_bytes(&pk.0) 16 | .expect("valid secp256r1 pk") 17 | .to_jwk_string(); 18 | let mut jwk: Jwk = serde_json::from_str(&jwk_str).expect("valid JWK encoded secp256r1"); 19 | jwk.set_alg(JwsAlgorithm::ES256.name()); 20 | jwk 21 | } 22 | 23 | pub(crate) fn jwk_to_keypair(jwk: &Jwk) -> anyhow::Result { 24 | let sk = SecretKey::from_jwk_str(&serde_json::to_string(jwk)?)?; 25 | Secp256r1KeyPair::from_bytes(sk.to_bytes().as_ref()).context("failed to create secp256r1 keypair from JWK") 26 | } 27 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/src/did/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2025 IOTA Stiftung, Fondazione LINKS 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | mod did_compositejwk; 5 | mod did_jwk; 6 | mod jws_verification_options; 7 | mod service; 8 | mod wasm_core_did; 9 | mod wasm_core_document; 10 | mod wasm_did_jwk_document_ext; 11 | mod wasm_did_url; 12 | 13 | pub use self::jws_verification_options::*; 14 | pub use self::service::IService; 15 | pub use self::service::UServiceEndpoint; 16 | pub use self::service::WasmService; 17 | pub use self::wasm_core_did::IToCoreDID; 18 | pub use self::wasm_core_did::WasmCoreDID; 19 | pub use self::wasm_core_document::ArrayIToCoreDocument; 20 | pub(crate) use self::wasm_core_document::CoreDocumentLock; 21 | pub use self::wasm_core_document::IToCoreDocument; 22 | pub use self::wasm_core_document::PromiseJws; 23 | pub use self::wasm_core_document::PromiseJwt; 24 | pub use self::wasm_core_document::WasmCoreDocument; 25 | pub use self::wasm_did_url::WasmDIDUrl; 26 | pub use did_compositejwk::*; 27 | pub use did_jwk::*; 28 | -------------------------------------------------------------------------------- /.github/workflows/scripts/populate-changelog-descriptions.sh: -------------------------------------------------------------------------------- 1 | CHANGELOG_PATH=$1 2 | RELEASES_FOLDER=.github/releases/ 3 | FILES="$RELEASES_FOLDER*" 4 | 5 | echo Working on $CHANGELOG_PATH 6 | 7 | # for every entry in the releases folder 8 | for file in $(eval echo $FILES) 9 | do 10 | if [ -f "$file" ] 11 | then 12 | echo "Processing $file" 13 | filename=$(basename -- "$file") 14 | filename="${filename%.*}" 15 | # read the file contents 16 | filecontent=$(cat $file) 17 | # replace new lines in file contents, so we can pipe it into sed 18 | replaced_content=$(echo $filecontent | sed '$!s/$/\\n/' | tr -d '\n') 19 | # add file content after the line with the full changelog link (e.g. [Full Changelog](https://github.com/iotaledger/identity/compare/v0.3.0...v0.5.0-dev.1) of corresponding version 20 | # note we use '@' as a delimiter because the content contains '\' 21 | sed -i "\@\.\.\.$filename@a\ \n$replaced_content" $CHANGELOG_PATH 22 | else 23 | echo "Warning: Could not find \"$file\"" 24 | fi 25 | done 26 | echo "Done" -------------------------------------------------------------------------------- /bindings/grpc/src/server.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | use std::net::SocketAddr; 5 | 6 | use identity_stronghold::StrongholdStorage; 7 | use identity_iota::iota::rebased::client::IdentityClientReadOnly; 8 | use tonic::transport::server::Router; 9 | use tonic::transport::server::Server; 10 | 11 | use crate::services; 12 | 13 | #[derive(Debug)] 14 | pub struct GRpcServer { 15 | router: Router, 16 | stronghold: StrongholdStorage, 17 | } 18 | 19 | impl GRpcServer { 20 | pub fn new(client: IdentityClientReadOnly, stronghold: StrongholdStorage) -> Self { 21 | let router = Server::builder().add_routes(services::routes(&client, &stronghold)); 22 | Self { router, stronghold } 23 | } 24 | pub async fn serve(self, addr: SocketAddr) -> Result<(), tonic::transport::Error> { 25 | self.router.serve(addr).await 26 | } 27 | pub fn into_router(self) -> Router { 28 | self.router 29 | } 30 | pub fn stronghold(&self) -> StrongholdStorage { 31 | self.stronghold.clone() 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /bindings/grpc/src/services/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | pub mod credential; 5 | pub mod document; 6 | pub mod domain_linkage; 7 | pub mod health_check; 8 | pub mod sd_jwt; 9 | pub mod status_list_2021; 10 | pub mod utils; 11 | 12 | use identity_stronghold::StrongholdStorage; 13 | use identity_iota::iota::rebased::client::IdentityClientReadOnly; 14 | use tonic::service::Routes; 15 | use tonic::service::RoutesBuilder; 16 | 17 | pub fn routes(client: &IdentityClientReadOnly, stronghold: &StrongholdStorage) -> Routes { 18 | let mut routes = RoutesBuilder::default(); 19 | routes.add_service(health_check::service()); 20 | credential::init_services(&mut routes, client, stronghold); 21 | routes.add_service(sd_jwt::service(client)); 22 | routes.add_service(domain_linkage::service(client)); 23 | routes.add_service(document::service(client, stronghold)); 24 | routes.add_service(status_list_2021::service()); 25 | routes.add_service(utils::service(stronghold)); 26 | 27 | routes.routes() 28 | } 29 | -------------------------------------------------------------------------------- /identity_jose/src/jwk/curve/ec.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | use core::fmt::Display; 5 | use core::fmt::Formatter; 6 | use core::fmt::Result; 7 | 8 | /// Supported Elliptic Curves. 9 | /// 10 | /// [More Info](https://www.iana.org/assignments/jose/jose.xhtml#web-key-elliptic-curve) 11 | #[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] 12 | pub enum EcCurve { 13 | /// P-256 Curve. 14 | P256, 15 | /// P-384 Curve. 16 | P384, 17 | /// P-521 Curve. 18 | P521, 19 | /// SECG secp256k1 curve. 20 | Secp256K1, 21 | } 22 | 23 | impl EcCurve { 24 | /// Returns the name of the curve as a string slice. 25 | pub const fn name(self) -> &'static str { 26 | match self { 27 | Self::P256 => "P-256", 28 | Self::P384 => "P-384", 29 | Self::P521 => "P-521", 30 | Self::Secp256K1 => "secp256k1", 31 | } 32 | } 33 | } 34 | 35 | impl Display for EcCurve { 36 | fn fmt(&self, f: &mut Formatter<'_>) -> Result { 37 | f.write_str(self.name()) 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/src/common/utils.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2022 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | use wasm_bindgen::JsCast; 5 | use wasm_bindgen::JsValue; 6 | 7 | use crate::error::Result; 8 | use crate::error::WasmResult; 9 | 10 | /// Special-case for deserializing [`js_sys::Map`], which otherwise serializes to JSON as an empty 11 | /// object `{}`. This uses a [`js_sys::Object`] as an intermediate representation to convert 12 | /// to the required struct via JSON. 13 | /// 14 | /// Useful for deserializing properties fields which have the TypeScript type: 15 | /// `Map | Record` 16 | pub(crate) fn deserialize_map_or_any(value: &JsValue) -> Result 17 | where 18 | T: for<'a> serde::de::Deserialize<'a>, 19 | { 20 | if let Some(map) = JsCast::dyn_ref::(value) { 21 | // Map 22 | js_sys::Object::from_entries(map).and_then(|object| JsValue::into_serde(&object).wasm_result()) 23 | } else { 24 | // any 25 | value.into_serde().wasm_result() 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: "[Bug] " 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | ## Bug description 11 | Briefly describe the bug. 12 | 13 | ## Language version 14 | What programming language are you using? Rust or one of the bindings? 15 | Which version of the language are you running? 16 | 17 | - Language: 18 | - Version: 19 | 20 | ## IOTA Identity version 21 | Which version of IOTA Identity are you using? 22 | 23 | - Version (version number, commit, or branch): 24 | 25 | ## Hardware specification 26 | What hardware are you using? (Delete if not relevant) 27 | 28 | - Operating system: 29 | - RAM: 30 | - Cores: 31 | - Device: 32 | 33 | ## Steps To reproduce the bug 34 | Explain how the maintainer can reproduce the bug. 35 | 36 | 1. 37 | 2. 38 | 3. 39 | 40 | ## Expected behaviour 41 | Describe what you expect to happen. 42 | 43 | ## Actual behaviour 44 | Describe what actually happens. 45 | 46 | ## Errors 47 | Paste any errors that you see, including logs, errors, or screenshots. 48 | -------------------------------------------------------------------------------- /identity_credential/src/presentation/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | //! The core types used to create Verifiable Presentations. 5 | 6 | #![allow(clippy::module_inception)] 7 | 8 | #[cfg(feature = "jpt-bbs-plus")] 9 | mod jwp_presentation_builder; 10 | #[cfg(feature = "jpt-bbs-plus")] 11 | mod jwp_presentation_options; 12 | mod jwt_presentation_options; 13 | mod jwt_serialization; 14 | mod presentation; 15 | mod presentation_builder; 16 | 17 | #[cfg(feature = "jpt-bbs-plus")] 18 | pub use self::jwp_presentation_builder::SelectiveDisclosurePresentation; 19 | pub use self::jwt_presentation_options::JwtPresentationOptions; 20 | pub use self::presentation::Presentation; 21 | pub use self::presentation_builder::PresentationBuilder; 22 | #[cfg(feature = "jpt-bbs-plus")] 23 | pub use jwp_presentation_options::JwpPresentationOptions; 24 | 25 | #[cfg(feature = "validator")] 26 | pub(crate) use self::jwt_serialization::JwtPresentationV2Claims; 27 | #[cfg(feature = "validator")] 28 | pub(crate) use self::jwt_serialization::PresentationJwtClaims; 29 | -------------------------------------------------------------------------------- /identity_jose/src/tests/fixtures/rfc7797.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | [ 4 | // https://tools.ietf.org/html/rfc7797#section-4.1 5 | TestVector { 6 | detach: false, 7 | header: br#"{"alg":"HS256"}"#, 8 | encoded: b"eyJhbGciOiJIUzI1NiJ9.JC4wMg.5mvfOroL-g7HyqJoozehmsaqmvTYGEq5jTI1gVvoEoQ", 9 | payload: b"$.02", 10 | public_key: r#" 11 | { 12 | "kty": "oct", 13 | "k": "AyM1SysPpbyDfgZld3umj1qzKObwVMkoqQ-EstJQLr_T-1qS0gZH75aKtMN3Yj0iPS4hcgUuTwjAzZr1Z9CAow" 14 | } 15 | "#, 16 | }, 17 | // https://tools.ietf.org/html/rfc7797#section-4.2 18 | TestVector { 19 | detach: true, 20 | header: br#"{"alg":"HS256","b64":false,"crit":["b64"]}"#, 21 | encoded: b"eyJhbGciOiJIUzI1NiIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..A5dxf2s96_n5FLueVuW1Z_vh161FwXZC4YLPff6dmDY", 22 | payload: b"$.02", 23 | public_key: r#" 24 | { 25 | "kty": "oct", 26 | "k": "AyM1SysPpbyDfgZld3umj1qzKObwVMkoqQ-EstJQLr_T-1qS0gZH75aKtMN3Yj0iPS4hcgUuTwjAzZr1Z9CAow" 27 | } 28 | "#, 29 | }, 30 | ] 31 | -------------------------------------------------------------------------------- /identity_credential/src/sd_jwt_vc/resolver.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | use async_trait::async_trait; 5 | use thiserror::Error; 6 | 7 | pub(crate) type Result = std::result::Result; 8 | 9 | /// [`Resolver`]'s errors. 10 | #[derive(Debug, Error)] 11 | pub enum Error { 12 | /// The queried item doesn't exist. 13 | #[error("The requested item \"{0}\" was not found.")] 14 | NotFound(String), 15 | /// Failed to parse input. 16 | #[error("Failed to parse the provided input into a resolvable type: {0}")] 17 | ParsingFailure(#[source] anyhow::Error), 18 | /// Generic error. 19 | #[error(transparent)] 20 | Generic(#[from] anyhow::Error), 21 | } 22 | 23 | /// A type capable of asynchronously producing values of type `T` from inputs of type `I`. 24 | #[cfg_attr(target_arch = "wasm32", async_trait(?Send))] 25 | #[cfg_attr(not(target_arch = "wasm32"), async_trait)] 26 | pub trait Resolver { 27 | /// Fetch the resource of type [`Resolver::Target`] using `input`. 28 | async fn resolve(&self, input: &I) -> Result; 29 | } 30 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/src/jpt/encoding.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2025 IOTA Stiftung, Fondazione LINKS 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | use jsonprooftoken::encoding::SerializationType; 5 | use wasm_bindgen::prelude::*; 6 | 7 | #[wasm_bindgen(js_name = SerializationType)] 8 | pub enum WasmSerializationType { 9 | COMPACT = 0, 10 | JSON = 1, 11 | CBOR = 2, 12 | } 13 | 14 | impl From for SerializationType { 15 | fn from(value: WasmSerializationType) -> Self { 16 | match value { 17 | WasmSerializationType::COMPACT => SerializationType::COMPACT, 18 | WasmSerializationType::JSON => SerializationType::JSON, 19 | WasmSerializationType::CBOR => SerializationType::CBOR, 20 | } 21 | } 22 | } 23 | 24 | impl From for WasmSerializationType { 25 | fn from(value: SerializationType) -> Self { 26 | match value { 27 | SerializationType::COMPACT => WasmSerializationType::COMPACT, 28 | SerializationType::JSON => WasmSerializationType::JSON, 29 | SerializationType::CBOR => WasmSerializationType::CBOR, 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /identity_jose/src/jwk/key_use.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | use core::fmt::Display; 5 | use core::fmt::Formatter; 6 | use core::fmt::Result; 7 | 8 | /// Supported algorithms for the JSON Web Key `use` property. 9 | /// 10 | /// [More Info](https://www.iana.org/assignments/jose/jose.xhtml#web-key-use) 11 | #[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord, serde::Deserialize, serde::Serialize)] 12 | pub enum JwkUse { 13 | /// Digital Signature or MAC. 14 | #[serde(rename = "sig")] 15 | Signature, 16 | /// Encryption. 17 | #[serde(rename = "enc")] 18 | Encryption, 19 | /// Proof 20 | #[serde(rename = "proof")] 21 | Proof, 22 | } 23 | 24 | impl JwkUse { 25 | /// Returns the JWK "use" as a `str` slice. 26 | pub const fn name(&self) -> &'static str { 27 | match self { 28 | Self::Signature => "sig", 29 | Self::Encryption => "enc", 30 | Self::Proof => "proof", 31 | } 32 | } 33 | } 34 | 35 | impl Display for JwkUse { 36 | fn fmt(&self, f: &mut Formatter<'_>) -> Result { 37 | f.write_str(self.name()) 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /bindings/grpc/src/services/health_check.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | use health_check::health_check_server::HealthCheck; 5 | use health_check::health_check_server::HealthCheckServer; 6 | use health_check::HealthCheckRequest; 7 | use health_check::HealthCheckResponse; 8 | use tonic::Request; 9 | use tonic::Response; 10 | use tonic::Status; 11 | 12 | #[allow(clippy::module_inception)] 13 | mod health_check { 14 | tonic::include_proto!("health_check"); 15 | } 16 | 17 | #[derive(Debug, Default)] 18 | pub struct HealthChecker {} 19 | 20 | #[tonic::async_trait] 21 | impl HealthCheck for HealthChecker { 22 | #[tracing::instrument( 23 | name = "health_check", 24 | skip_all, 25 | fields(request = ?_req.get_ref()) 26 | ret, 27 | err, 28 | )] 29 | async fn check(&self, _req: Request) -> Result, Status> { 30 | Ok(Response::new(HealthCheckResponse { status: "OK".into() })) 31 | } 32 | } 33 | 34 | pub fn service() -> HealthCheckServer { 35 | HealthCheckServer::new(HealthChecker::default()) 36 | } 37 | -------------------------------------------------------------------------------- /identity_credential/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #![forbid(unsafe_code)] 5 | #![doc = include_str!("./../README.md")] 6 | #![warn( 7 | rust_2018_idioms, 8 | unreachable_pub, 9 | missing_docs, 10 | rustdoc::missing_crate_level_docs, 11 | rustdoc::broken_intra_doc_links, 12 | rustdoc::private_intra_doc_links, 13 | rustdoc::private_doc_tests, 14 | clippy::missing_safety_doc 15 | )] 16 | 17 | #[cfg(feature = "credential")] 18 | pub mod credential; 19 | #[cfg(feature = "domain-linkage")] 20 | pub mod domain_linkage; 21 | pub mod error; 22 | #[cfg(feature = "presentation")] 23 | pub mod presentation; 24 | #[cfg(feature = "revocation-bitmap")] 25 | pub mod revocation; 26 | mod utils; 27 | #[cfg(feature = "validator")] 28 | pub mod validator; 29 | 30 | /// Implementation of the SD-JWT VC token specification. 31 | #[cfg(feature = "sd-jwt-vc")] 32 | pub mod sd_jwt_vc; 33 | 34 | pub use error::Error; 35 | pub use error::Result; 36 | 37 | #[cfg(feature = "sd-jwt")] 38 | pub use sd_jwt_payload; 39 | 40 | #[cfg(feature = "sd-jwt-vc")] 41 | pub use sd_jwt_payload_rework as sd_jwt_v2; 42 | -------------------------------------------------------------------------------- /identity_credential/tests/fixtures/credential-11.json: -------------------------------------------------------------------------------- 1 | { 2 | "@context": [ 3 | "https://www.w3.org/2018/credentials/v1", 4 | "https://www.w3.org/2018/credentials/examples/v1" 5 | ], 6 | "id": "http://example.edu/credentials/3732", 7 | "type": ["VerifiableCredential", "UniversityDegreeCredential"], 8 | "issuer": "https://example.edu/issuers/14", 9 | "issuanceDate": "2010-01-01T19:23:24Z", 10 | "credentialSubject": { 11 | "id": "did:example:ebfeb1f712ebc6f1c276e12ec21", 12 | "degree": { 13 | "type": "BachelorDegree", 14 | "name": "Bachelor of Science in Mechanical Engineering" 15 | } 16 | }, 17 | "termsOfUse": [ 18 | { 19 | "type": "IssuerPolicy", 20 | "id": "http://example.com/policies/credential/4", 21 | "profile": "http://example.com/profiles/credential", 22 | "prohibition": [ 23 | { 24 | "assigner": "https://example.edu/issuers/14", 25 | "assignee": "AllVerifiers", 26 | "target": "http://example.edu/credentials/3732", 27 | "action": [ 28 | "Archival" 29 | ] 30 | } 31 | ] 32 | } 33 | ] 34 | } 35 | -------------------------------------------------------------------------------- /identity_jose/src/tests/rfc7517.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | use crate::jwk::Jwk; 5 | use crate::jwk::JwkSet; 6 | use serde_json::Value; 7 | 8 | #[test] 9 | fn test_rfc7517() { 10 | enum TestVector { 11 | KeySet { json: &'static str }, 12 | Key { json: &'static str }, 13 | } 14 | 15 | static TVS: &[TestVector] = &include!("fixtures/rfc7517.rs"); 16 | 17 | for tv in TVS { 18 | match tv { 19 | TestVector::KeySet { json } => { 20 | let value: Value = serde_json::from_str(json).unwrap(); 21 | let jwks: JwkSet = serde_json::from_str(json).unwrap(); 22 | 23 | for (index, jwk) in jwks.iter().enumerate() { 24 | let ser: Value = serde_json::to_value(jwk).unwrap(); 25 | assert_eq!(ser, value["keys"][index]); 26 | } 27 | } 28 | TestVector::Key { json } => { 29 | let value: Value = serde_json::from_str(json).unwrap(); 30 | let jwk: Jwk = serde_json::from_str(json).unwrap(); 31 | let ser: Value = serde_json::to_value(&jwk).unwrap(); 32 | 33 | assert_eq!(ser, value); 34 | } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /identity_storage/src/key_storage/tests/memstore.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | use super::utils::test_generate_and_sign; 5 | use super::utils::test_incompatible_key_alg; 6 | use super::utils::test_incompatible_key_type; 7 | use super::utils::test_insertion; 8 | use super::utils::test_key_exists; 9 | use crate::key_storage::JwkMemStore; 10 | 11 | #[tokio::test] 12 | async fn insert() { 13 | let store: JwkMemStore = JwkMemStore::new(); 14 | test_insertion(store).await; 15 | } 16 | 17 | #[tokio::test] 18 | async fn incompatible_key_alg() { 19 | let store: JwkMemStore = JwkMemStore::new(); 20 | test_incompatible_key_alg(store).await; 21 | } 22 | 23 | #[tokio::test] 24 | async fn incompatible_key_types() { 25 | let store: JwkMemStore = JwkMemStore::new(); 26 | test_incompatible_key_type(store).await; 27 | } 28 | 29 | #[tokio::test] 30 | async fn generate_and_sign() { 31 | let store: JwkMemStore = JwkMemStore::new(); 32 | test_generate_and_sign(store).await; 33 | } 34 | 35 | #[tokio::test] 36 | async fn key_exists() { 37 | let store: JwkMemStore = JwkMemStore::new(); 38 | test_key_exists(store).await; 39 | } 40 | -------------------------------------------------------------------------------- /identity_credential/tests/fixtures/credential-5.json: -------------------------------------------------------------------------------- 1 | { 2 | "@context": [ 3 | "https://www.w3.org/2018/credentials/v1", 4 | "https://www.w3.org/2018/credentials/examples/v1" 5 | ], 6 | "id": "http://example.gov/credentials/3732", 7 | "type": ["VerifiableCredential", "UniversityDegreeCredential"], 8 | "issuer": "https://example.edu", 9 | "issuanceDate": "2017-06-18T21:19:00Z", 10 | "credentialSubject": { 11 | "id": "did:example:ebfeb1f712ebc6f1c276e12ec21", 12 | "degree": { 13 | "type": "BachelorDegree", 14 | "name": "Bachelor of Science in Mechanical Engineering" 15 | } 16 | }, 17 | "someExtraProperty": { 18 | "proof": "This should not prevent proof from being deserialized." 19 | }, 20 | "proof": { 21 | "type": "RsaSignature2018", 22 | "created": "2017-06-18T21:19:10Z", 23 | "proofPurpose": "assertionMethod", 24 | "verificationMethod": "https://example.com/jdoe/keys/1", 25 | "jws": "eyJhbGciOiJSUzI1NiIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..TCYt5XsITJX1CxPCT8yAV-TVkIEq_PbChOMqsLfRoPsnsgw5WEuts01mq-pQy7UJiN5mgRxD-WUcX16dUEMGlv50aqzpqh4Qktb3rk-BuQy72IFLOqV0G_zS245-kronKb78cPN25DGlcTwLtjPAYuNzVBAh4vGHSrQyHUdBBPM" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /identity_storage/src/key_storage/jwk_storage_pqc.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2025 IOTA Stiftung, Fondazione Links 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | use crate::key_storage::KeyId; 5 | use crate::key_storage::KeyType; 6 | use async_trait::async_trait; 7 | use identity_verification::jose::jws::JwsAlgorithm; 8 | use identity_verification::jwk::PostQuantumJwk; 9 | 10 | use super::jwk_gen_output::JwkGenOutput; 11 | use super::JwkStorage; 12 | use super::KeyStorageResult; 13 | 14 | /// Extension to the JwkStorage to handle post-quantum keys. 15 | #[cfg_attr(not(feature = "send-sync-storage"), async_trait(?Send))] 16 | #[cfg_attr(feature = "send-sync-storage", async_trait)] 17 | pub trait JwkStoragePQ: JwkStorage { 18 | /// Generates a JWK representing a PQ key. 19 | async fn generate_pq_key(&self, key_type: KeyType, alg: JwsAlgorithm) -> KeyStorageResult; 20 | 21 | /// Sign the provided `data` using a PQ algorithm, ctx is optional for the ctx paramter of the algorithm ML-DSA. 22 | async fn pq_sign( 23 | &self, 24 | key_id: &KeyId, 25 | data: &[u8], 26 | public_key: &PostQuantumJwk, 27 | ctx: Option<&[u8]>, 28 | ) -> KeyStorageResult>; 29 | } 30 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/src/credential/jpt.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | use identity_iota::credential::Jpt; 5 | use wasm_bindgen::prelude::*; 6 | 7 | /// A JSON Proof Token (JPT). 8 | #[wasm_bindgen(js_name = Jpt)] 9 | pub struct WasmJpt(pub(crate) Jpt); 10 | 11 | #[wasm_bindgen(js_class = Jpt)] 12 | impl WasmJpt { 13 | /// Creates a new {@link Jpt}. 14 | #[wasm_bindgen(constructor)] 15 | pub fn new(jpt_string: String) -> Self { 16 | WasmJpt(Jpt::new(jpt_string)) 17 | } 18 | 19 | // Returns the string representation for this {@link Jpt}. 20 | #[allow(clippy::inherent_to_string)] 21 | #[wasm_bindgen(js_name = "toString")] 22 | pub fn to_string(&self) -> String { 23 | self.0.as_str().to_owned() 24 | } 25 | } 26 | 27 | impl_wasm_clone!(WasmJpt, Jpt); 28 | 29 | impl From for WasmJpt { 30 | fn from(value: Jpt) -> Self { 31 | WasmJpt(value) 32 | } 33 | } 34 | 35 | impl From for Jpt { 36 | fn from(value: WasmJpt) -> Self { 37 | value.0 38 | } 39 | } 40 | 41 | #[wasm_bindgen] 42 | extern "C" { 43 | #[wasm_bindgen(typescript_type = "Promise")] 44 | pub type PromiseJpt; 45 | } 46 | -------------------------------------------------------------------------------- /.github/workflows/build-and-test-grpc.yml: -------------------------------------------------------------------------------- 1 | name: Build and run grpc tests 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | pull_request: 8 | types: [ opened, synchronize, reopened, ready_for_review ] 9 | branches: 10 | - main 11 | - 'feat/**' 12 | - 'support/**' 13 | paths: 14 | - '.github/workflows/build-and-test.yml' 15 | - '.github/actions/**' 16 | - '**.rs' 17 | - '**.toml' 18 | - 'bindings/grpc/**' 19 | 20 | jobs: 21 | check-for-run-condition: 22 | runs-on: ubuntu-latest 23 | outputs: 24 | should-run: ${{ !github.event.pull_request || github.event.pull_request.draft == false }} 25 | steps: 26 | - run: | 27 | # this run step does nothing, but is needed to get the job output 28 | 29 | build-and-test: 30 | runs-on: ubuntu-latest 31 | steps: 32 | - name: Check out the repo 33 | uses: actions/checkout@v4 34 | 35 | - name: Build Docker image 36 | uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 37 | with: 38 | context: . 39 | file: bindings/grpc/Dockerfile 40 | push: false 41 | tags: iotaledger/identity-grpc:latest -------------------------------------------------------------------------------- /identity_did/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "identity_did" 3 | version = "1.8.0-beta.1" 4 | authors.workspace = true 5 | edition = "2021" 6 | homepage.workspace = true 7 | keywords = ["iota", "tangle", "identity", "did"] 8 | license.workspace = true 9 | readme = "./README.md" 10 | repository.workspace = true 11 | description = "Agnostic implementation of the Decentralized Identifiers (DID) standard." 12 | 13 | [dependencies] 14 | did_url_parser = { version = "0.3.0", features = ["std", "serde"] } 15 | form_urlencoded = { version = "1.2.0", default-features = false, features = ["alloc"] } 16 | identity_core = { version = "=1.8.0-beta.1", path = "../identity_core", default-features = false } 17 | identity_jose = { version = "=1.8.0-beta.1", path = "../identity_jose" } 18 | serde.workspace = true 19 | strum.workspace = true 20 | thiserror.workspace = true 21 | 22 | [dev-dependencies] 23 | proptest = { version = "1.0" } 24 | serde_json.workspace = true 25 | 26 | [package.metadata.docs.rs] 27 | # To build locally: 28 | # RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --all-features --no-deps --workspace --open 29 | all-features = true 30 | rustdoc-args = ["--cfg", "docsrs"] 31 | 32 | [lints] 33 | workspace = true 34 | -------------------------------------------------------------------------------- /identity_core/src/common/key_comparable.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2022 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | /// A trait for comparing types only by a certain key. 5 | pub trait KeyComparable { 6 | /// Key type for comparisons. 7 | type Key: PartialEq + ?Sized; 8 | 9 | /// Returns a reference to the key. 10 | fn key(&self) -> &Self::Key; 11 | } 12 | 13 | /// Macro to implement the `KeyComparable` trait for primitive types. 14 | /// 15 | /// This approach is used to avoid conflicts from a blanket implementation where the type is the 16 | /// key itself. 17 | macro_rules! impl_key_comparable { 18 | ($($t:ty)*) => ($( 19 | impl KeyComparable for $t { 20 | type Key = $t; 21 | #[inline] 22 | fn key(&self) -> &Self::Key { self } 23 | } 24 | )*) 25 | } 26 | 27 | impl_key_comparable! { 28 | str bool char usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 29 | } 30 | 31 | impl KeyComparable for &str { 32 | type Key = str; 33 | 34 | fn key(&self) -> &Self::Key { 35 | self 36 | } 37 | } 38 | 39 | impl KeyComparable for String { 40 | type Key = str; 41 | 42 | fn key(&self) -> &Self::Key { 43 | self 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /.github/releases/wasm-v0.5.0-dev.6.md: -------------------------------------------------------------------------------- 1 | This release introduces preliminary Stronghold storage bindings for Node.js. Stronghold offers best-effort secure software storage for cryptographic keys, written in Rust. To use the Stronghold storage package install `@iota/identity-stronghold-nodejs` and follow the instructions of the package [README](https://github.com/iotaledger/identity/tree/dev/bindings/stronghold-nodejs). 2 | 3 | Note that all features related to diff chain updates are now marked as deprecated. Diff chains are a useful optimisation when publishing many updates to a DID Document. However, their design may be incompatible with upcoming changes to the IOTA network and should be considered unstable. 4 | 5 | Another major change is the removal of the `MerkleKeyCollection` verification method type, which provided a compact representation for issuing and revoking Verifiable Credentials with multiple cryptographic keys. The `MerkleKeyCollection` suffered from disadvantages which limited scalability when managing more than a few thousand keys. While these disadvantages could be mitigated somewhat, the decision was made to replace it with one or more alternatives not affected by its fundamental limitations, upcoming in the next major release. -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/cypress/e2e/tests.cy.js: -------------------------------------------------------------------------------- 1 | const { _ } = Cypress; 2 | 3 | describe( 4 | "Test Examples", 5 | () => { 6 | const examples = [ 7 | "0_create_did", 8 | "1_update_did", 9 | "2_resolve_did", 10 | "3_deactivate_did", 11 | "4_delete_did", 12 | "5_create_vc", 13 | "6_create_vp", 14 | "7_revoke_vc", 15 | "4_custom_resolution", 16 | "5_domain_linkage", 17 | "6_sd_jwt", 18 | "7_status_list_2021", 19 | "8_zkp", 20 | "9_zkp_revocation", 21 | "10_sd_jwt_vc", 22 | ]; 23 | 24 | _.each(examples, (example) => { 25 | it(example, () => { 26 | cy.visit("/", { 27 | onBeforeLoad(win) { 28 | cy.stub(win.console, "log").as("consoleLog"); 29 | }, 30 | }); 31 | cy.get("@consoleLog").should("be.calledWith", "init"); 32 | cy.window().then(win => win.runTest(example)); 33 | cy.get("@consoleLog").should("be.calledWith", "success"); 34 | }); 35 | }); 36 | }, 37 | ); 38 | -------------------------------------------------------------------------------- /identity_credential/src/presentation/jwp_presentation_options.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung, Fondazione Links 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | use identity_core::common::Url; 5 | use serde::Deserialize; 6 | use serde::Serialize; 7 | 8 | /// Options to be set in the JWT claims of a verifiable presentation. 9 | #[derive(Clone, Debug, Serialize, Deserialize, Default)] 10 | pub struct JwpPresentationOptions { 11 | /// Sets the audience for presentation (`aud` property in JWP Presentation Header). 12 | /// Default: `None`. 13 | #[serde(skip_serializing_if = "Option::is_none")] 14 | pub audience: Option, 15 | 16 | /// The nonce to be placed in the Presentation Protected Header. 17 | #[serde(skip_serializing_if = "Option::is_none")] 18 | pub nonce: Option, 19 | } 20 | 21 | impl JwpPresentationOptions { 22 | /// Sets the audience for presentation (`aud` property in JWT claims). 23 | pub fn audience(mut self, audience: Url) -> Self { 24 | self.audience = Some(audience); 25 | self 26 | } 27 | 28 | /// Replace the value of the `nonce` field. 29 | pub fn nonce(mut self, value: impl Into) -> Self { 30 | self.nonce = Some(value.into()); 31 | self 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /identity_ecdsa_verifier/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "identity_ecdsa_verifier" 3 | version = "1.8.0-beta.1" 4 | authors = ["IOTA Stiftung", "Filancore GmbH"] 5 | edition.workspace = true 6 | homepage.workspace = true 7 | keywords = ["iota", "identity", "jose", "jwk", "jws"] 8 | license.workspace = true 9 | readme = "./README.md" 10 | repository.workspace = true 11 | description = "JWS ECDSA signature verification for IOTA Identity" 12 | 13 | [lints] 14 | workspace = true 15 | 16 | [dependencies] 17 | identity_verification = { version = "=1.8.0-beta.1", path = "../identity_verification", default-features = false } 18 | k256 = { version = "0.13.3", default-features = false, features = ["std", "ecdsa", "ecdsa-core"], optional = true } 19 | p256 = { version = "0.13.2", default-features = false, features = ["std", "ecdsa", "ecdsa-core"], optional = true } 20 | signature = { version = "2", default-features = false } 21 | 22 | [dev-dependencies] 23 | josekit = "0.8.6" 24 | serde_json.workspace = true 25 | 26 | [features] 27 | default = ["es256", "es256k"] 28 | # Enables the EcDSAJwsVerifier to verify JWS with alg = ES256. 29 | es256 = ["dep:p256"] 30 | # Enables the EcDSAJwsVerifier to verify JWS with alg = ES256K. 31 | es256k = ["dep:k256"] 32 | -------------------------------------------------------------------------------- /identity_iota_core/src/rebased/iota/types/number.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | use serde::Deserialize; 5 | use serde::Serialize; 6 | use std::str::FromStr; 7 | 8 | #[derive(Debug, Serialize, Deserialize, Clone)] 9 | #[serde(untagged)] 10 | pub enum Number { 11 | Num(N), 12 | Str(String), 13 | } 14 | 15 | macro_rules! impl_conversions { 16 | ($t:ty) => { 17 | impl TryFrom> for $t { 18 | type Error = <$t as FromStr>::Err; 19 | fn try_from(value: Number<$t>) -> Result<$t, Self::Error> { 20 | match value { 21 | Number::Num(n) => Ok(n), 22 | Number::Str(s) => s.parse(), 23 | } 24 | } 25 | } 26 | 27 | impl From<$t> for Number<$t> { 28 | fn from(value: $t) -> Number<$t> { 29 | Number::Num(value) 30 | } 31 | } 32 | }; 33 | } 34 | 35 | impl_conversions!(u8); 36 | impl_conversions!(u16); 37 | impl_conversions!(u32); 38 | impl_conversions!(u64); 39 | impl_conversions!(u128); 40 | impl_conversions!(usize); 41 | 42 | impl_conversions!(i8); 43 | impl_conversions!(i16); 44 | impl_conversions!(i32); 45 | impl_conversions!(i64); 46 | impl_conversions!(i128); 47 | impl_conversions!(isize); 48 | -------------------------------------------------------------------------------- /identity_document/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "identity_document" 3 | version = "1.8.0-beta.1" 4 | authors.workspace = true 5 | edition.workspace = true 6 | homepage.workspace = true 7 | keywords = ["iota", "tangle", "identity", "did"] 8 | license.workspace = true 9 | readme = "./README.md" 10 | repository.workspace = true 11 | description = "Method-agnostic implementation of the Decentralized Identifiers (DID) standard." 12 | 13 | [dependencies] 14 | did_url_parser = { version = "0.2.0", features = ["std", "serde"] } 15 | identity_core = { version = "=1.8.0-beta.1", path = "../identity_core", default-features = false } 16 | identity_did = { version = "=1.8.0-beta.1", path = "../identity_did" } 17 | identity_verification = { version = "=1.8.0-beta.1", path = "../identity_verification", default-features = false } 18 | indexmap = { version = "2.0", default-features = false, features = ["std", "serde"] } 19 | serde.workspace = true 20 | strum.workspace = true 21 | thiserror.workspace = true 22 | 23 | [dev-dependencies] 24 | criterion = { version = "0.4.0", default-features = false, features = ["cargo_bench_support"] } 25 | serde_json.workspace = true 26 | 27 | [[bench]] 28 | name = "deserialize_document" 29 | harness = false 30 | 31 | [lints] 32 | workspace = true 33 | -------------------------------------------------------------------------------- /identity_iota_core/src/document/test_utils.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | use crypto::signatures::ed25519::PublicKey; 5 | use crypto::signatures::ed25519::SecretKey; 6 | use identity_verification::jwk::EdCurve; 7 | use identity_verification::jwk::Jwk; 8 | use identity_verification::jwk::JwkParamsOkp; 9 | use identity_verification::jws::JwsAlgorithm; 10 | use identity_verification::jwu; 11 | use identity_verification::VerificationMethod; 12 | 13 | use crate::IotaDID; 14 | 15 | pub(crate) fn generate_method(controller: &IotaDID, fragment: &str) -> VerificationMethod { 16 | let secret: SecretKey = SecretKey::generate().unwrap(); 17 | let public: PublicKey = secret.public_key(); 18 | let jwk: Jwk = encode_public_ed25519_jwk(public.as_ref()); 19 | VerificationMethod::new_from_jwk(controller.to_owned(), jwk, Some(fragment)).unwrap() 20 | } 21 | 22 | fn encode_public_ed25519_jwk(public_key: &[u8]) -> Jwk { 23 | let x = jwu::encode_b64(public_key); 24 | let mut params = JwkParamsOkp::new(); 25 | params.x = x; 26 | params.d = None; 27 | params.crv = EdCurve::Ed25519.name().to_string(); 28 | let mut jwk = Jwk::from_params(params); 29 | jwk.set_alg(JwsAlgorithm::EdDSA.name()); 30 | jwk 31 | } 32 | -------------------------------------------------------------------------------- /bindings/wasm/identity_wasm/src/verification/wasm_method_relationship.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | use identity_iota::verification::MethodRelationship; 5 | use serde_repr::Deserialize_repr; 6 | use serde_repr::Serialize_repr; 7 | use wasm_bindgen::prelude::*; 8 | 9 | #[wasm_bindgen(js_name = MethodRelationship)] 10 | #[derive(Serialize_repr, Deserialize_repr)] 11 | #[repr(u8)] 12 | pub enum WasmMethodRelationship { 13 | Authentication = 0, 14 | AssertionMethod = 1, 15 | KeyAgreement = 2, 16 | CapabilityDelegation = 3, 17 | CapabilityInvocation = 4, 18 | } 19 | 20 | impl From for MethodRelationship { 21 | fn from(relationship: WasmMethodRelationship) -> Self { 22 | match relationship { 23 | WasmMethodRelationship::Authentication => MethodRelationship::Authentication, 24 | WasmMethodRelationship::AssertionMethod => MethodRelationship::AssertionMethod, 25 | WasmMethodRelationship::KeyAgreement => MethodRelationship::KeyAgreement, 26 | WasmMethodRelationship::CapabilityDelegation => MethodRelationship::CapabilityDelegation, 27 | WasmMethodRelationship::CapabilityInvocation => MethodRelationship::CapabilityInvocation, 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /identity_iota_core/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #![doc = include_str!("./../README.md")] 5 | #![warn( 6 | rust_2018_idioms, 7 | unreachable_pub, 8 | missing_docs, 9 | rustdoc::missing_crate_level_docs, 10 | rustdoc::broken_intra_doc_links, 11 | rustdoc::private_intra_doc_links, 12 | rustdoc::private_doc_tests, 13 | clippy::missing_safety_doc 14 | )] 15 | #![allow(clippy::upper_case_acronyms)] 16 | 17 | pub use did::IotaDID; 18 | #[cfg(feature = "iota-client")] 19 | pub use did_resolution::DidResolutionHandler; 20 | pub use document::*; 21 | pub use state_metadata::*; 22 | 23 | pub use self::error::Error; 24 | pub use self::error::Result; 25 | 26 | mod did; 27 | mod document; 28 | mod error; 29 | mod state_metadata; 30 | 31 | #[cfg(feature = "iota-client")] 32 | mod did_resolution; 33 | #[cfg(feature = "iota-client")] 34 | mod iota_interaction_adapter; 35 | 36 | #[cfg(feature = "iota-client")] 37 | /// Contains the rebased Identity and the interaction with the IOTA Client. 38 | pub mod rebased; 39 | 40 | /// Contains the types needed to interact with HTTP-based interfaces. 41 | #[cfg(feature = "gas-station")] 42 | pub mod http { 43 | pub use product_common::http_client::*; 44 | } 45 | -------------------------------------------------------------------------------- /.github/workflows/rust-automatic-release-and-publish.yml: -------------------------------------------------------------------------------- 1 | name: Rust Automatic Release and Publish 2 | 3 | # Automatically creates a GitHub release and publishes the latest Rust crate versions to crates.io when a release PR is merged. 4 | on: 5 | pull_request: 6 | branches: 7 | - main 8 | - support/v* 9 | types: [closed] 10 | jobs: 11 | call-create-release-workflow: 12 | if: github.event.pull_request.merged == true 13 | uses: './.github/workflows/shared-release.yml' 14 | with: 15 | changelog-config-path: ./.github/.github_changelog_generator 16 | pre-release-tag-regex: ^v[0-9]+\.[0-9]+\.[0-9]+-(?\w+)\.\d+$ 17 | main-release-tag-regex: ^v[0-9]+\.[0-9]+\.[0-9]+$ 18 | create-github-release: true 19 | secrets: 20 | GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} 21 | GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} 22 | release: 23 | runs-on: ubuntu-latest 24 | needs: call-create-release-workflow 25 | if: ${{ needs.call-create-release-workflow.outputs.is-release }} 26 | steps: 27 | - name: Checkout 28 | uses: actions/checkout@v3 29 | - name: Dummy Publish to crates.io 30 | # TODO: implement proper publish 31 | run: echo beep boop, pretending to publish -------------------------------------------------------------------------------- /bindings/grpc/tests/api/did_document_creation.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | use identity_stronghold::StrongholdStorage; 5 | use identity_iota::iota::rebased::utils::request_funds; 6 | 7 | use tonic::Request; 8 | 9 | use crate::helpers::get_address; 10 | use crate::helpers::make_stronghold; 11 | use crate::helpers::Entity; 12 | use crate::helpers::TestServer; 13 | 14 | use _document::document_service_client::DocumentServiceClient; 15 | use _document::CreateDidRequest; 16 | 17 | mod _document { 18 | tonic::include_proto!("document"); 19 | } 20 | 21 | #[tokio::test] 22 | async fn did_document_creation() -> anyhow::Result<()> { 23 | let stronghold = StrongholdStorage::new(make_stronghold()); 24 | let server = TestServer::new_with_stronghold(stronghold.clone()).await; 25 | 26 | let user = Entity::new_with_stronghold(stronghold); 27 | let (user_address, key_id, _) = get_address(user.storage()).await?; 28 | 29 | request_funds(&user_address).await?; 30 | 31 | let mut grpc_client = DocumentServiceClient::connect(server.endpoint()).await?; 32 | grpc_client 33 | .create(Request::new(CreateDidRequest { 34 | key_id: key_id.as_str().to_string(), 35 | })) 36 | .await?; 37 | 38 | Ok(()) 39 | } 40 | -------------------------------------------------------------------------------- /identity_iota_core/packages/iota_identity/sources/proposals/value.move: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | module iota_identity::update_value_proposal; 5 | 6 | use iota_identity::controller::DelegationToken; 7 | use iota_identity::multicontroller::Multicontroller; 8 | 9 | public struct UpdateValue has drop, store { 10 | new_value: V, 11 | } 12 | 13 | public fun propose_update( 14 | multi: &mut Multicontroller, 15 | cap: &DelegationToken, 16 | new_value: V, 17 | expiration: Option, 18 | ctx: &mut TxContext, 19 | ): ID { 20 | let update_action = UpdateValue { new_value }; 21 | multi.create_proposal(cap, update_action, expiration, ctx) 22 | } 23 | 24 | public fun execute_update( 25 | multi: &mut Multicontroller, 26 | cap: &DelegationToken, 27 | proposal_id: ID, 28 | ctx: &mut TxContext, 29 | ) { 30 | let action = multi.execute_proposal(cap, proposal_id, ctx); 31 | let UpdateValue { new_value } = action.unpack_action(); 32 | 33 | multi.set_controlled_value(new_value) 34 | } 35 | 36 | public(package) fun into_inner(self: UpdateValue): V { 37 | let UpdateValue { new_value } = self; 38 | new_value 39 | } 40 | -------------------------------------------------------------------------------- /examples/0_basic/0_create_did.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | use examples::create_did_document; 5 | use examples::get_funded_client; 6 | 7 | use examples::get_memstorage; 8 | 9 | /// Demonstrates how to create a DID Document and publish it on chain. 10 | /// 11 | /// In this example we connect to a locally running private network, but it can be adapted 12 | /// to run on any IOTA node by setting the network and faucet endpoints. 13 | /// 14 | /// See the following instructions on running your own private network 15 | /// https://github.com/iotaledger/hornet/tree/develop/private_tangle 16 | #[tokio::main] 17 | async fn main() -> anyhow::Result<()> { 18 | // create new client to interact with chain and get funded account with keys 19 | let storage = get_memstorage()?; 20 | let identity_client = get_funded_client(&storage).await?; 21 | 22 | // create new DID document and publish it 23 | let (document, _) = create_did_document(&identity_client, &storage).await?; 24 | println!("Published DID document: {document:#}"); 25 | 26 | // check if we can resolve it via client 27 | let resolved = identity_client.resolve_did(document.id()).await?; 28 | println!("Resolved DID document: {resolved:#}"); 29 | 30 | Ok(()) 31 | } 32 | -------------------------------------------------------------------------------- /identity_credential/tests/fixtures/credential-12.json: -------------------------------------------------------------------------------- 1 | { 2 | "@context": [ 3 | "https://www.w3.org/2018/credentials/v1", 4 | "https://www.w3.org/2018/credentials/examples/v1" 5 | ], 6 | "id": "http://example.edu/credentials/3732", 7 | "type": ["VerifiableCredential", "UniversityDegreeCredential"], 8 | "issuer": "https://example.edu/issuers/14", 9 | "issuanceDate": "2010-01-01T19:23:24Z", 10 | "credentialSubject": { 11 | "id": "did:example:ebfeb1f712ebc6f1c276e12ec21", 12 | "degree": { 13 | "type": "BachelorDegree", 14 | "name": "Bachelor of Science in Mechanical Engineering" 15 | } 16 | }, 17 | "evidence": [{ 18 | "id": "https://example.edu/evidence/f2aeec97-fc0d-42bf-8ca7-0548192d4231", 19 | "type": ["DocumentVerification"], 20 | "verifier": "https://example.edu/issuers/14", 21 | "evidenceDocument": "DriversLicense", 22 | "subjectPresence": "Physical", 23 | "documentPresence": "Physical" 24 | },{ 25 | "id": "https://example.edu/evidence/f2aeec97-fc0d-42bf-8ca7-0548192dxyzab", 26 | "type": ["SupportingActivity"], 27 | "verifier": "https://example.edu/issuers/14", 28 | "evidenceDocument": "Fluid Dynamics Focus", 29 | "subjectPresence": "Digital", 30 | "documentPresence": "Digital" 31 | }] 32 | } 33 | -------------------------------------------------------------------------------- /.github/actions/publish/publish-rust/action.yml: -------------------------------------------------------------------------------- 1 | name: 'publish-rust' 2 | description: 'Publishes Rust library to crates.io' 3 | inputs: 4 | crates-token: 5 | description: 'used for authenticating towards crates.io' 6 | required: true 7 | version: 8 | description: 'the version to release under (e.g. `1.2.3-dev.1`)' 9 | required: true 10 | dry-run: 11 | description: "'true' = only log potential result; 'false' = publish'" 12 | required: true 13 | runs: 14 | using: "composite" 15 | steps: 16 | - name: Setup Rust 17 | uses: './.github/actions/rust/rust-setup' 18 | with: 19 | os: ${{ runner.os }} 20 | job: ${{ github.job }} 21 | 22 | - name: Install cargo-release 23 | shell: bash 24 | run: cargo install --version =0.25 cargo-release 25 | 26 | - name: Publish library to crates.io 27 | shell: bash 28 | run: | 29 | echo "dry-run: '${{ inputs.dry-run }}'" 30 | echo "version: '${{ inputs.version }}'" 31 | cargo login ${{ inputs.crates-token }} 32 | cargo release config 33 | cargo release version --verbose --execute --no-confirm ${{ inputs.version }} 34 | cargo release publish --verbose $(if [ "${{ inputs.dry-run }}" = "false" ]; then echo --execute --no-confirm; fi) 35 | -------------------------------------------------------------------------------- /identity_iota_core/packages/iota_identity/sources/permissions.move: -------------------------------------------------------------------------------- 1 | module iota_identity::permissions; 2 | 3 | /// Permission that enables a controller's delegate to create proposals. 4 | const CAN_CREATE_PROPOSAL: u32 = 0x1; 5 | /// Permission that enables a controller's delegate to approve proposals. 6 | const CAN_APPROVE_PROPOSAL: u32 = 0x1 << 1; 7 | /// Permission that enables a controller's delegate to execute proposals. 8 | const CAN_EXECUTE_PROPOSAL: u32 = 0x1 << 2; 9 | /// Permission that enables a controller's delegate to delete proposals. 10 | const CAN_DELETE_PROPOSAL: u32 = 0x1 << 3; 11 | /// Permission that enables a controller's delegate to remove a proposal's approval. 12 | const CAN_REMOVE_APPROVAL: u32 = 0x1 << 4; 13 | const ALL_PERMISSIONS: u32 = 0xFFFFFFFF; 14 | 15 | public fun can_create_proposal(): u32 { CAN_CREATE_PROPOSAL } 16 | 17 | public fun can_approve_proposal(): u32 { CAN_APPROVE_PROPOSAL } 18 | 19 | public fun can_execute_proposal(): u32 { CAN_EXECUTE_PROPOSAL } 20 | 21 | public fun can_delete_proposal(): u32 { CAN_DELETE_PROPOSAL } 22 | 23 | public fun can_remove_approval(): u32 { CAN_REMOVE_APPROVAL } 24 | 25 | public fun all(): u32 { ALL_PERMISSIONS } 26 | 27 | /// Negate a permission 28 | public fun not(permission: u32): u32 { 29 | permission ^ all() 30 | } 31 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | # Description of change 2 | Please write a summary of your changes and why you made them. 3 | 4 | ## Links to any relevant issues 5 | Be sure to reference any related issues by adding `fixes issue #`. 6 | 7 | ## Type of change 8 | Add an `x` to the boxes that are relevant to your changes. 9 | 10 | - [ ] Bug fix (a non-breaking change which fixes an issue) 11 | - [ ] Enhancement (a non-breaking change which adds functionality) 12 | - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) 13 | - [ ] Documentation Fix 14 | 15 | ## How the change has been tested 16 | Describe the tests that you ran to verify your changes. 17 | Make sure to provide instructions for the maintainer as well as any relevant configurations. 18 | 19 | ## Change checklist 20 | Add an `x` to the boxes that are relevant to your changes. 21 | 22 | - [ ] I have followed the contribution guidelines for this project 23 | - [ ] I have performed a self-review of my own code 24 | - [ ] I have commented my code, particularly in hard-to-understand areas 25 | - [ ] I have made corresponding changes to the documentation 26 | - [ ] I have added tests that prove my fix is effective or that my feature works 27 | - [ ] New and existing unit tests pass locally with my changes 28 | -------------------------------------------------------------------------------- /identity_did/src/error.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2022 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | use core::fmt::Debug; 5 | 6 | /// Error type caused by invalid DID handling. 7 | #[derive(Debug, thiserror::Error, strum::IntoStaticStr)] 8 | #[non_exhaustive] 9 | pub enum Error { 10 | #[error("invalid fragment")] 11 | InvalidFragment, 12 | #[error("invalid method id")] 13 | InvalidMethodId, 14 | #[error("invalid method name")] 15 | InvalidMethodName, 16 | #[error("invalid path")] 17 | InvalidPath, 18 | #[error("invalid query")] 19 | InvalidQuery, 20 | #[error("invalid scheme")] 21 | InvalidScheme, 22 | #[error("{0}")] 23 | Other(&'static str), 24 | } 25 | 26 | impl From for Error { 27 | fn from(error: did_url_parser::Error) -> Self { 28 | match error { 29 | did_url_parser::Error::InvalidFragment => Self::InvalidFragment, 30 | did_url_parser::Error::InvalidMethodId => Self::InvalidMethodId, 31 | did_url_parser::Error::InvalidMethodName => Self::InvalidMethodName, 32 | did_url_parser::Error::InvalidPath => Self::InvalidPath, 33 | did_url_parser::Error::InvalidQuery => Self::InvalidQuery, 34 | did_url_parser::Error::InvalidScheme => Self::InvalidScheme, 35 | error => Self::Other(error.as_str()), 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /identity_jose/src/jws/recipient.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2023 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | use crate::jws::JwsHeader; 5 | 6 | /// The recipient of a JWS. 7 | /// 8 | /// The contained headers determine the specifics of the signature for that recipient, 9 | /// such as what algorithm (`alg`) or key (`kid`) will be or was used to create the signature. 10 | #[derive(Clone, Copy)] 11 | pub struct Recipient<'a> { 12 | /// The integrity-protected JOSE header. 13 | pub protected: Option<&'a JwsHeader>, 14 | /// The non integrity-protected JOSE header. 15 | pub unprotected: Option<&'a JwsHeader>, 16 | } 17 | 18 | impl Default for Recipient<'_> { 19 | fn default() -> Self { 20 | Self::new() 21 | } 22 | } 23 | 24 | impl<'a> Recipient<'a> { 25 | /// Creates a new recipient with no header set. 26 | pub fn new() -> Self { 27 | Self { 28 | protected: None, 29 | unprotected: None, 30 | } 31 | } 32 | 33 | /// Set the integrity-protected JOSE header. 34 | pub fn protected(mut self, value: &'a JwsHeader) -> Self { 35 | self.protected = Some(value); 36 | self 37 | } 38 | 39 | /// Set the non integrity-protected JOSE header. 40 | pub fn unprotected(mut self, value: &'a JwsHeader) -> Self { 41 | self.unprotected = Some(value); 42 | self 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /identity_document/src/verifiable/jwp_verification_options.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2024 IOTA Stiftung 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | use identity_did::DIDUrl; 5 | use identity_verification::MethodScope; 6 | 7 | /// Holds additional options for verifying a JWP 8 | #[non_exhaustive] 9 | #[derive(Default, Debug, serde::Serialize, serde::Deserialize, Clone)] 10 | #[serde(rename_all = "camelCase")] 11 | pub struct JwpVerificationOptions { 12 | /// Verify the signing verification method relation matches this. 13 | pub method_scope: Option, 14 | /// The DID URl of the method, whose JWK should be used to verify the JWP. 15 | /// If unset, the `kid` of the JWP is used as the DID Url. 16 | pub method_id: Option, 17 | } 18 | 19 | impl JwpVerificationOptions { 20 | /// Creates a new [`JwpVerificationOptions`]. 21 | pub fn new() -> Self { 22 | Self::default() 23 | } 24 | 25 | /// Set the scope of the verification methods that may be used to verify the given JWP. 26 | pub fn method_scope(mut self, value: MethodScope) -> Self { 27 | self.method_scope = Some(value); 28 | self 29 | } 30 | 31 | /// The DID URl of the method, whose JWK should be used to verify the JWP. 32 | pub fn method_id(mut self, value: DIDUrl) -> Self { 33 | self.method_id = Some(value); 34 | self 35 | } 36 | } 37 | --------------------------------------------------------------------------------