Identities
Create a DID Document for an account
Any account on LTO network, for which the public key is known, can be resolved as DID (decentralized identifier). To explicitly create a DID use the identity builder.
import LTO from '@ltonetwork/lto';
import { IdentityBuilder } from '@ltonetwork/lto/identities';
const lto = new LTO('T');
const account = lto.account();
new IdentityBuilder(account)
.transactions.map(tx => lto.node.broadcast(tx));The main account is known as the management key.
Verification methods
By default, the account's public key is the only verification method of the DID. Other verification methods can be added through associations with other accounts.
import LTO from '@ltonetwork/lto';
import { IdentityBuilder } from '@ltonetwork/lto/identities';
const lto = new LTO('T');
const account = lto.account();
const key1 = lto.account({ publicKey: "8cMyCW5Esx98zBqQCy9N36UaGZuNcuJhVe17DuG42dHS" });
const key2 = lto.account({ publicKey: "9ubzzV9tRYTcQee68v1mUPJW7PHdB74LZEgG1MgZUExf" });
const expires = new Date();
expires.setFullYear(expires.getFullYear() + 1);
new IdentityBuilder(account)
.addVerificationMethod(key1)
.addVerificationMethod(key2, ['authentication', 'assertionMethod'], expires)
.transactions.map(tx => lto.node.broadcast(tx));If no verification relationships are specified, it is only listed as a verification method, which is typically not what you want. Optionally, you can have the verification method automatically expire.
Revoking verification methods
Verification methods can also be removed by address.
Services
Removing services
A service may also be removed by id.
Deactivation
If the management key is compromised, the DID should be deactivated.
Grant deactivation capability
Allow a trusted party to deactivate the DID in case the management key is lost.
The expires and revokeDelay arguments are optional.
Revoke deactivation capability
Last updated