Skip to content

hjs-spec/sdk-js

JEP JavaScript SDK v0.6

JavaScript SDK for the JEP v0.6 API seed.

This SDK targets the current JEP API shape:

POST /events/create
POST /events/verify
GET  /health

It is aligned with:

  • draft-wang-jep-judgment-event-protocol-06
  • draft-wang-jep-profiles-00
  • draft-wang-jep-conformance-00
  • hjs-spec/jep-api

Status

Experimental implementation seed.

This SDK does not define new JEP-Core semantics and does not determine legal liability, factual truth, regulatory compliance, or complete-log availability.

Installation

npm install @hjs-spec/jep-sdk-js

For local development:

npm test

Quick Start

import { JEPClient, Verb } from "@hjs-spec/jep-sdk-js";

const client = new JEPClient({
  baseUrl: "http://127.0.0.1:8000",
});

const created = await client.createEvent({
  verb: Verb.Judgment,
  who: "did:example:agent-789",
  what: { claim: "approve" },
});

console.log(created.event_hash);

const verified = await client.verifyEvent({
  event: created.event,
  mode: "archival",
});

console.log(verified.valid);

Core Exports

  • JEPClient
  • Verb
  • JEPValidationError
  • JEPAPIError
  • eventToJSON
  • isValidationResult

Supported verbs:

Verb.Judgment
Verb.Delegation
Verb.Termination
Verb.Verification

API

Create event

const resp = await client.createEvent({
  verb: Verb.Judgment,
  who: "did:example:agent",
  what: "sha256:...",
});

Verify event

const result = await client.verifyEvent({
  event: resp.event,
  mode: "archival",
});

Convenience helpers

await client.judgment("did:example:agent", what);
await client.delegation("did:example:agent", what);
await client.termination("did:example:agent", what, "sha256:parent");
await client.verification("did:example:agent", what, "sha256:parent");

Health

const health = await client.health();

Extensions

await client.createEvent({
  verb: Verb.Judgment,
  who: "did:example:agent",
  what: { claim: "approve" },
  ext: {
    "https://example.org/profile": { name: "demo" },
  },
  ext_crit: ["https://example.org/profile"],
});

Testing

npm test

Tests use a local in-process HTTP server and do not require a live JEP API.

Related Repositories

Public Drafts

License

MIT

About

JavaScript SDK seed for creating and verifying JEP v0.6 events through the JEP API.

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors