@neus/sdk 1.0.12 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,208 +1,206 @@
1
- # @neus/sdk
2
-
3
- Create, check, and reuse NEUS trust receipts from apps and backends. The same package ships the **`neus`** CLI for wiring **hosted NEUS MCP** into editors and agents.
4
-
5
- NEUS makes trust portable across the internet so people, apps, and AI agents can prove what is real before access, payout, or execution.
6
-
7
- ## Install (library)
8
-
9
- ```bash
10
- npm install @neus/sdk
11
- ```
12
-
13
- ## Connect editors and assistants (MCP)
14
-
15
- Use one command to merge NEUS into Cursor, VS Code, and Claude Code when those tools are detected. No separate NEUS editor extension is required.
16
-
17
- ```bash
18
- npx -y -p @neus/sdk neus setup
19
- ```
20
-
21
- Add your NEUS Profile access key in the same step (needed for account-aware tools such as `neus_me`):
22
-
23
- ```bash
24
- npx -y -p @neus/sdk neus setup --access-key <npk_...>
25
- ```
26
-
27
- Check configuration and connectivity:
28
-
29
- ```bash
30
- npx -y -p @neus/sdk neus doctor
31
- ```
32
-
33
- Create keys under **Profile → Account → Access keys** on [neus.network](https://neus.network/profile?tab=account). Never put access keys in browser bundles or public repos.
34
-
35
- | Topic | Link |
36
- | --- | --- |
37
- | Setup, JSON snippets, and headers | [MCP setup](https://docs.neus.network/mcp/setup) |
38
- | Tools and session order | [MCP overview](https://docs.neus.network/mcp/overview) |
39
- | Discovery URLs | [Discovery and endpoints](https://docs.neus.network/mcp/endpoints) |
40
- | Optional Claude Code plugin + skill | [NEUS for Claude Code](https://docs.neus.network/mcp/claude-code-marketplace) |
41
-
42
- Prefer `neus setup` over hand-editing config files so every host stays on **`https://mcp.neus.network/mcp`**.
43
-
44
- ## What you can build
45
-
46
- - Issue a proof that a user, wallet, org, app, file, release, profile, or result belongs to someone
47
- - Store the returned `qHash` as a durable trust receipt ID
48
- - Check receipts later for access, eligibility, provenance, or display
49
- - Add proof-gated UX with React widgets
50
- - Connect IDEs and agents through optional MCP
51
-
52
- ## Fastest path: Hosted Verify
53
-
54
- Use Hosted Verify when you want NEUS to handle the signing/verification flow outside your app UI.
55
-
56
- ```js
57
- import { getHostedCheckoutUrl } from '@neus/sdk';
58
-
59
- const url = getHostedCheckoutUrl({
60
- verifiers: ['ownership-basic'],
61
- returnUrl: 'https://yourapp.com/auth/callback'
62
- });
63
-
64
- window.location.assign(url);
65
- ```
66
-
67
- After completion, NEUS redirects back with a `qHash`.
68
-
69
- Store that `qHash` with your user record.
70
-
71
- ## Create a signed receipt directly
72
-
73
- When your app handles signing. This example is EVM. For non-EVM wallets, pass the provider explicitly and include `chain` as a CAIP-2 value; see the CAIP-380 standards page in the docs.
74
-
75
- ```js
76
- import { NeusClient } from '@neus/sdk';
77
-
78
- const client = new NeusClient({
79
- appId: 'your-app-id'
80
- });
81
-
82
- const proof = await client.verify({
83
- verifier: 'ownership-basic',
84
- data: {
85
- owner: '0x...',
86
- contentType: 'application/json',
87
- content: JSON.stringify({
88
- title: 'Verified claim',
89
- type: 'project-update',
90
- summary: 'Public summary of what is being proven.'
91
- }),
92
- reference: {
93
- type: 'url',
94
- id: 'https://example.com/source',
95
- title: 'Source record'
96
- }
97
- },
98
- wallet: window.ethereum // EVM provider
99
- });
100
-
101
- console.log(proof.qHash);
102
- console.log(proof.proofUrl);
103
- ```
104
-
105
- ## React widget
106
-
107
- Use `VerifyGate` when you want a drop-in verification flow in React.
108
-
109
- ```jsx
110
- import { VerifyGate } from '@neus/sdk/widgets';
111
-
112
- export function Page() {
113
- return (
114
- <VerifyGate
115
- appId="your-app-id"
116
- requiredVerifiers={['ownership-basic']}
117
- verifierData={{
118
- 'ownership-basic': {
119
- owner: '0x...',
120
- contentType: 'application/json',
121
- content: JSON.stringify({
122
- title: 'Verified claim',
123
- summary: 'Public summary of what is being proven.'
124
- }),
125
- reference: {
126
- type: 'url',
127
- id: 'https://example.com/source'
128
- }
129
- }
130
- }}
131
- onVerified={(result) => {
132
- console.log(result.qHash || result.qHashes);
133
- }}
134
- />
135
- );
136
- }
137
- ```
138
-
139
- ## Check receipts
140
-
141
- Use `gateCheck` from trusted server code when you need allow/deny or eligibility checks.
142
-
143
- ```js
144
- import { NeusClient } from '@neus/sdk';
145
-
146
- const client = new NeusClient({
147
- appId: 'your-app-id'
148
- });
149
-
150
- const result = await client.gateCheck({
151
- address: '0x...',
152
- verifierIds: ['ownership-basic']
153
- });
154
-
155
- if (!result.data?.eligible) {
156
- throw new Error('Access denied');
157
- }
158
- ```
159
-
160
- Never ship access keys in browser code.
161
-
162
- ## Core methods
163
-
164
- | Method | Use it for |
165
- | ------------------------------- | ------------------------------------------- |
166
- | `getHostedCheckoutUrl()` | Send a user to Hosted Verify |
167
- | `client.verify()` | Create a proof |
168
- | `client.getProof()` | Fetch a proof by `qHash` |
169
- | `client.pollProofStatus()` | Wait for async completion |
170
- | `client.gateCheck()` | Server-side eligibility checks |
171
- | `client.checkGate()` | Local preview against already-loaded proofs |
172
- | `client.createWalletLinkData()` | Advanced wallet-link payloads |
173
-
174
- ## Configuration
175
-
176
- ```js
177
- const client = new NeusClient({
178
- apiUrl: 'https://api.neus.network',
179
- appId: 'your-app-id',
180
- timeout: 30000
181
- });
182
- ```
183
-
184
- `appId` is public attribution for your app.
185
- `apiKey` / `npk_*` is optional and server-side only.
186
-
187
- ## MCP: step-by-step (alternative to `setup`)
188
-
189
- ```bash
190
- npx -y -p @neus/sdk neus init
191
- ```
192
-
193
- Add or rotate a Profile access key on an existing install:
194
-
195
- ```bash
196
- npx -y -p @neus/sdk neus auth --access-key <npk_...>
197
- ```
198
-
199
- Claude Code (optional): add marketplace `https://github.com/neus/network`, install **`neus-mcp@neus`**, then run **`neus setup`** so your key matches every editor. See [NEUS for Claude Code](https://docs.neus.network/mcp/claude-code-marketplace).
200
-
201
- ## Docs
202
-
203
- - Quickstart: https://docs.neus.network/quickstart
204
- - JavaScript SDK: https://docs.neus.network/sdks/javascript
205
- - Ownership Basic: https://docs.neus.network/verification/ownership-basic
206
- - Widgets: https://docs.neus.network/widgets/overview
207
- - MCP: https://docs.neus.network/mcp/overview
208
- - API: https://docs.neus.network/api/overview
1
+ # @neus/sdk
2
+
3
+ Create, check, and reuse NEUS trust receipts from apps and backends. The same package ships the **`neus`** CLI for hosted MCP setup and portable agent import.
4
+
5
+ NEUS makes trust portable across apps, agents, and ecosystems before access, payment, or action.
6
+
7
+ Roadmap: [docs.neus.network/platform/status](https://docs.neus.network/platform/status)
8
+
9
+ ## Install (library)
10
+
11
+ ```bash
12
+ npm install @neus/sdk
13
+ ```
14
+
15
+ ## Bring Your Own Agent (BYOA)
16
+
17
+ Already have an agent setup? Use the CLI to package supported local agent context, including instructions, rules, skills, and MCP server references from **OpenClaw, Cursor, Claude Code, and Claude Desktop**:
18
+
19
+ ```bash
20
+ npx -y -p @neus/sdk neus import
21
+ ```
22
+
23
+ This prepares a local portable-agent manifest. In MCP, call `neus_agent_link` first; if setup is missing, use `neus_agent_create`, complete the hosted or signing steps, then call `neus_agent_link` again until `linked: true`.
24
+
25
+ *To check what will be imported without writing changes:*
26
+ ```bash
27
+ npx -y -p @neus/sdk neus import --dry-run
28
+ ```
29
+
30
+ ## Connect editors and assistants
31
+
32
+ | Topic | Link |
33
+ | --------------------------------- | ----------------------------------------------------------------------------- |
34
+ | Setup, JSON snippets, and headers | [MCP setup](https://docs.neus.network/mcp/setup) |
35
+ | Tools and session order | [MCP overview](https://docs.neus.network/mcp/overview) |
36
+ | Discovery URLs | [Discovery and endpoints](https://docs.neus.network/mcp/endpoints) |
37
+ | NEUS for AI assistants | [NEUS for AI assistants](https://docs.neus.network/mcp/ide-plugin) |
38
+
39
+ Prefer `neus setup` over hand-editing config files so every host stays on **`https://mcp.neus.network/mcp`**.
40
+
41
+ ## What you can ship
42
+
43
+ - Hosted verification flows that return a reusable receipt
44
+ - Server checks before access, rewards, payments, or actions
45
+ - React gates with `VerifyGate`
46
+ - Agent identity and scoped delegation
47
+ - MCP setup for assistants and agent tools
48
+
49
+ ## Fastest path: Hosted Verify
50
+
51
+ Use Hosted Verify when you want NEUS to handle the signing/verification flow outside your app UI.
52
+
53
+ ```js
54
+ import { getHostedCheckoutUrl } from '@neus/sdk';
55
+
56
+ const url = getHostedCheckoutUrl({
57
+ verifiers: ['ownership-basic'],
58
+ returnUrl: 'https://yourapp.com/auth/callback'
59
+ });
60
+
61
+ window.location.assign(url);
62
+ ```
63
+
64
+ After completion, NEUS redirects back with a `qHash`. Store it with your user or record.
65
+
66
+ ## Advanced: in-app signing
67
+
68
+ Use this only when your app intentionally handles signing. This example is EVM. For non-EVM accounts, pass the provider explicitly and include `chain` as a CAIP-2 value.
69
+
70
+ ```js
71
+ import { NeusClient } from '@neus/sdk';
72
+
73
+ const client = new NeusClient({
74
+ appId: 'your-app-id'
75
+ });
76
+
77
+ const proof = await client.verify({
78
+ verifier: 'ownership-basic',
79
+ data: {
80
+ owner: '0x...',
81
+ contentType: 'application/json',
82
+ content: JSON.stringify({
83
+ title: 'Verified claim',
84
+ type: 'project-update',
85
+ summary: 'Public summary of what is being proven.'
86
+ }),
87
+ reference: {
88
+ type: 'url',
89
+ id: 'https://example.com/source',
90
+ title: 'Source record'
91
+ }
92
+ },
93
+ wallet: window.ethereum // EVM provider
94
+ });
95
+
96
+ console.log(proof.qHash);
97
+ console.log(proof.proofUrl);
98
+ ```
99
+
100
+ ## React widget
101
+
102
+ Use `VerifyGate` when you want a drop-in verification flow in React.
103
+
104
+ ```jsx
105
+ import { VerifyGate } from '@neus/sdk/widgets';
106
+
107
+ export function Page() {
108
+ return (
109
+ <VerifyGate
110
+ appId="your-app-id"
111
+ requiredVerifiers={['ownership-basic']}
112
+ verifierData={{
113
+ 'ownership-basic': {
114
+ owner: '0x...',
115
+ contentType: 'application/json',
116
+ content: JSON.stringify({
117
+ title: 'Verified claim',
118
+ summary: 'Public summary of what is being proven.'
119
+ }),
120
+ reference: {
121
+ type: 'url',
122
+ id: 'https://example.com/source'
123
+ }
124
+ }
125
+ }}
126
+ onVerified={result => {
127
+ console.log(result.qHash || result.qHashes);
128
+ }}
129
+ />
130
+ );
131
+ }
132
+ ```
133
+
134
+ ## Check receipts
135
+
136
+ Use `gateCheck` from trusted server code when you need allow/deny or eligibility checks.
137
+
138
+ ```js
139
+ import { NeusClient } from '@neus/sdk';
140
+
141
+ const client = new NeusClient({
142
+ appId: 'your-app-id'
143
+ });
144
+
145
+ const result = await client.gateCheck({
146
+ address: '0x...',
147
+ verifierIds: ['ownership-basic']
148
+ });
149
+
150
+ if (!result.data?.eligible) {
151
+ throw new Error('Access denied');
152
+ }
153
+ ```
154
+
155
+ Never ship access keys in browser code.
156
+
157
+ ## Core methods
158
+
159
+ | Method | Use it for |
160
+ | ------------------------------- | ------------------------------------------- |
161
+ | `getHostedCheckoutUrl()` | Send a user to Hosted Verify |
162
+ | `client.verify()` | Create a proof |
163
+ | `client.getProof()` | Fetch a receipt by `qHash` |
164
+ | `client.pollProofStatus()` | Wait for async completion |
165
+ | `client.gateCheck()` | Server-side eligibility checks |
166
+ | `client.checkGate()` | Local preview against already-loaded proofs |
167
+ | `client.createWalletLinkData()` | Wallet-link payloads |
168
+
169
+ ## Configuration
170
+
171
+ ```js
172
+ const client = new NeusClient({
173
+ apiUrl: 'https://api.neus.network',
174
+ appId: 'your-app-id',
175
+ timeout: 30000
176
+ });
177
+ ```
178
+
179
+ `appId` is public attribution for your app.
180
+ `apiKey` / `npk_*` is optional and server-side only.
181
+
182
+ ## MCP step-by-step
183
+
184
+ ```bash
185
+ npx -y -p @neus/sdk neus setup
186
+ npx -y -p @neus/sdk neus auth
187
+ npx -y -p @neus/sdk neus doctor --live
188
+ ```
189
+
190
+ Re-sign in or rotate credentials:
191
+
192
+ ```bash
193
+ npx -y -p @neus/sdk neus auth
194
+ npx -y -p @neus/sdk neus auth --access-key <npk_...> # servers and CI only
195
+ ```
196
+
197
+ Editors with plugin marketplaces can install **`neus-trust@neus`** for the bundled session workflow. OpenClaw, Hermes, and other runtimes: see [NEUS for AI assistants](https://docs.neus.network/mcp/ide-plugin) for exact paths.
198
+
199
+ ## Docs
200
+
201
+ - Quickstart: https://docs.neus.network/quickstart
202
+ - JavaScript SDK: https://docs.neus.network/sdks/javascript
203
+ - Ownership Basic: https://docs.neus.network/verification/ownership-basic
204
+ - Widgets: https://docs.neus.network/widgets/overview
205
+ - MCP: https://docs.neus.network/mcp/overview
206
+ - API: https://docs.neus.network/api/overview