Skip to main content

Getting Started with Wasm

Minimum Requirements

Install the Library

If your project does not contain it already, install the peer dependency @iota/iota-sdk as well.

npm install @iota/iota-sdk

You can install the latest beta version of the library by running the following command:

npm install @iota/identity-wasm@beta

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.

Usage in Node.js and Web

The Wasm packages are bundled for both Node.js and web. To use them, you must import them from the correct entry point:

Node.js

import { ... } from '@iota/identity/node';

Web

import { ... } from '@iota/identity/web';

Usage Examples

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"
}
}

API Reference

Examples