Getting Started with Wasm
Minimum Requirements
- Node.js (>=
v20
)
Install the Library
If your project does not contain it already, install the peer dependency @iota/iota-sdk
as well.
- npm
- Yarn
- pnpm
npm install @iota/iota-sdk
yarn add @iota/iota-sdk
pnpm add @iota/iota-sdk
You can install the latest alpha version of the library by running the following command:
- npm
- Yarn
- pnpm
npm install @iota/identity-wasm@alpha
yarn add @iota/identity-wasm@alpha
pnpm add @iota/identity-wasm@alpha
Build the Library
Alternatively, you can build the bindings to work with currently unreleased features. You can find instructions for this in the identity.rs
repository.
Node.js Usage
The following code creates a new IOTA DID Document suitable for publishing to a locally running test network.
bindings/wasm/identity_wasm/examples/src/0_basic/0_create_did.ts
loading...
See utils for details about the implementations about the helper functions used here.
Expected Output
Last part of the output should look as following:
Resolved DID document: {
"doc": {
"id": "did:iota:aa8c860b:0xa46b033974ca00aca19f4ea319f55cc1cfb44f7fbeb758149a632c43f98acc52",
"verificationMethod": [
{
"id": "did:iota:aa8c860b:0xa46b033974ca00aca19f4ea319f55cc1cfb44f7fbeb758149a632c43f98acc52#key-1",
"controller": "did:iota:aa8c860b:0xa46b033974ca00aca19f4ea319f55cc1cfb44f7fbeb758149a632c43f98acc52",
"type": "JsonWebKey2020",
"publicKeyJwk": {
"kty": "OKP",
"alg": "EdDSA",
"crv": "Ed25519",
"x": "Hx9cgXJke2LtgVzA0a6VSRa7Yfpzzf9BXa-fGPipgyA"
}
}
]
},
"meta": {
"created": "2025-03-11T08:07:02Z",
"updated": "2025-03-11T08:07:02Z"
}
}