import { IdentityKit, DIDAuth, KeyType } from '@nuwa-ai/identity-kit';
// Bootstrap environment (register VDRs, create KeyManager & KeyStore)
const env = await IdentityKit.bootstrap({
method: 'rooch',
vdrOptions: { rpcUrl: 'https://test-seed.rooch.network' },
});
// Load or create a DID (shortened)
const kit = await env.loadDid('did:rooch:0xYourDid');
// Sign a DIDAuth v1 payload
const sig = await DIDAuth.v1.createSignature(
{ operation: 'example', params: { message: 'hello' } },
env.keyManager,
kit.getDIDDocument().verificationMethod![0].id
);
// Convert to Authorization header value
const header = DIDAuth.v1.toAuthorizationHeader(sig);
// -> pass `header` as `Authorization: DIDAuthV1 <...>` when calling services