The following code examples demonstrate how to use the IOTA Identity Wasm bindings in JavaScript/TypeScript.
The examples are written in TypeScript and can be run with Node.js.
Install the dependencies:
npm install
Build the bindings:
npm run build
Then, run an example using:
npm run example:node -- <example-name>
For instance, to run the 0_create_did
example execute:
npm run example:node -- 0_create_did
The following basic CRUD (Create, Read, Update, Delete) examples are available:
Name | Information |
---|---|
0_create_did | Demonstrates how to create a DID Document and publish it in a new Alias Output. |
1_update_did | Demonstrates how to update a DID document in an existing Alias Output. |
2_resolve_did | Demonstrates how to resolve an existing DID in an Alias Output. |
3_deactivate_did | Demonstrates how to deactivate a DID in an Alias Output. |
4_delete_did | Demonstrates how to delete a DID in an Alias Output, reclaiming the storage deposit. |
5_create_vc | Demonstrates how to create and verify verifiable credentials. |
6_create_vp | Demonstrates how to create and verify verifiable presentations. |
7_revoke_vc | Demonstrates how to revoke a verifiable credential. |
The following advanced examples are available:
Name | Information |
---|---|
0_did_controls_did | Demonstrates how an identity can control another identity. |
1_did_issues_nft | Demonstrates how an identity can issue and own NFTs, and how observers can verify the issuer of the NFT. |
2_nft_owns_did | Demonstrates how an identity can be owned by NFTs, and how observers can verify that relationship. |
3_did_issues_tokens | Demonstrates how an identity can issue and control a Token Foundry and its tokens. |
4_custom_resolution | Demonstrates how to set up a resolver using custom handlers. |
5_domain_linkage | Demonstrates how to link a domain and a DID and verify the linkage. |
6_sd_jwt | Demonstrates how to create a selective disclosure verifiable credential |
7_domain_linkage | Demonstrates how to revoke a credential using StatusList2021 . |
While the examples should work in a browser environment, we do not provide browser examples yet.