MasumiIdentity
The single entry-point class for the SDK. Instantiate once per environment and reuse.
MasumiIdentity is the high-level client that wraps the Masumi credential server and KERIA into a small, typed, idiomatic surface.
Import
import { MasumiIdentity } from "@masumi_network/identity-sdk";Constructor
new MasumiIdentity(config: MasumiIdentityConfig)config: MasumiIdentityConfig
credentialServerUrlstringrequiredBase URL of the Masumi KERI credential server. Production:
https://cred-issuance.masumi-identity.xyz.
keriaUrlstringrequiredBase URL of the KERIA agent. Production: https://keria.masumi-identity.xyz.
Required for signature-verification flows; supply a placeholder if your
integration never calls verifyAidSignature / fetchKeyState.
fetchtypeof fetchOptional custom fetch implementation (useful for testing, tracing, or
non-Node runtimes). Defaults to the global fetch.
Example
import {
MasumiIdentity,
MASUMI_IDENTITY_ENDPOINTS,
} from "@masumi_network/identity-sdk";
const identity = new MasumiIdentity(MASUMI_IDENTITY_ENDPOINTS.production);import { MasumiIdentity } from "@masumi_network/identity-sdk";
const identity = new MasumiIdentity({
credentialServerUrl: "https://cred-issuance.masumi-identity.xyz",
keriaUrl: "https://keria.masumi-identity.xyz",
});import { MasumiIdentity } from "@masumi_network/identity-sdk";
const identity = new MasumiIdentity({
credentialServerUrl: process.env.CRED_URL!,
keriaUrl: process.env.KERIA_URL!,
});import { MasumiIdentity } from "@masumi_network/identity-sdk";
const tracedFetch: typeof fetch = async (input, init) => {
console.log("[SDK]", input);
return fetch(input, init);
};
const identity = new MasumiIdentity({
credentialServerUrl: "...",
keriaUrl: "...",
fetch: tracedFetch,
});Instance methods
Agent ↔ AID linking
| Method | Signature | Network |
|---|---|---|
getIssuerOobi | () => Promise<string> | Yes |
connectToAid | (oobi: string) => Promise<{ success: boolean; data: string }> | Yes |
isAidConnected | (aid: string) => Promise<boolean> | Yes |
Verifiable Credentials
| Method | Signature | Network |
|---|---|---|
issueCredential | (params: IssueCredentialParams) => Promise<{ success: boolean; data: string }> | Yes |
getCredentialsForAid | (aid: string) => Promise<Credential[]> | Yes |
validateCredential | (cred, options?) => CredentialValidationResult | No |
formatCredential | (cred) => FormattedCredential | No |
findCredentialBySchema | (creds, schemaSaid) => Credential | undefined | No |
KERI signature verification
| Method | Signature | Network |
|---|---|---|
verifyAidSignature | (params: VerifyAidSignatureParams) => Promise<boolean> | Yes |
fetchKeyState | (aid: string) => Promise<AidKeyState> | Yes |
Lifecycle
The client is safe to instantiate once per process and reuse. It holds no mutable state, only the configured base URLs and fetch implementation. There is no close() or dispose() — the underlying fetch connections are managed by the runtime.