@evvm/x402 0.0.1 → 0.1.3
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/LICENSE +193 -0
- package/README.md +10 -34
- package/dist/index.browser.mjs +76 -0
- package/dist/index.cjs +76 -0
- package/dist/index.mjs +76 -0
- package/dist/types/lib/local-facilitator.d.ts +20 -0
- package/dist/types/lib/parse-header.d.ts +6 -0
- package/dist/types/lib/payment-responses.d.ts +11 -0
- package/dist/types/middleware/express.d.ts +6 -0
- package/dist/types/middleware/next.d.ts +7 -0
- package/dist/types/types/evvm-schema.type.d.ts +18 -0
- package/dist/types/types/facilitator.type.d.ts +5 -0
- package/{src/types/payment-payload.type.ts → dist/types/types/payment-payload.type.d.ts} +2 -4
- package/package.json +54 -2
- package/bun.lock +0 -370
- package/index.ts +0 -1
- package/src/lib/local-facilitator.ts +0 -106
- package/src/lib/parse-header.ts +0 -29
- package/src/lib/payment-responses.ts +0 -64
- package/src/middleware/express.ts +0 -92
- package/src/middleware/next.ts +0 -79
- package/src/types/evvm-schema.type.ts +0 -19
- package/src/types/facilitator.type.ts +0 -15
- package/tsconfig.json +0 -29
- /package/{src/index.ts → dist/types/index.d.ts} +0 -0
- /package/{src/lib/index.ts → dist/types/lib/index.d.ts} +0 -0
- /package/{src/middleware/index.ts → dist/types/middleware/index.d.ts} +0 -0
- /package/{src/types/index.ts → dist/types/types/index.d.ts} +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
================================================================================
|
|
2
|
+
EVVM NONCOMMERCIAL LICENSE v1.0
|
|
3
|
+
================================================================================
|
|
4
|
+
|
|
5
|
+
SPDX-License-Identifier: EVVM-NONCOMMERCIAL-1.0
|
|
6
|
+
|
|
7
|
+
Copyright (c) 2025 MATE Labs Inc., a Delaware corporation
|
|
8
|
+
|
|
9
|
+
================================================================================
|
|
10
|
+
|
|
11
|
+
1. OVERVIEW
|
|
12
|
+
|
|
13
|
+
This software is licensed under a modified PolyForm Noncommercial License
|
|
14
|
+
1.0.0 with additional share-alike requirements. You may use, modify, and
|
|
15
|
+
distribute this software for noncommercial purposes only, subject to the terms
|
|
16
|
+
below.
|
|
17
|
+
|
|
18
|
+
COMMERCIAL USE REQUIRES A SEPARATE LICENSE.
|
|
19
|
+
For commercial licensing inquiries, contact: g@evvm.org
|
|
20
|
+
|
|
21
|
+
Full license text available at:
|
|
22
|
+
https://polyformproject.org/licenses/noncommercial/1.0.0/
|
|
23
|
+
|
|
24
|
+
================================================================================
|
|
25
|
+
|
|
26
|
+
2. BASE LICENSE: PolyForm Noncommercial 1.0.0
|
|
27
|
+
|
|
28
|
+
2.1 Acceptance
|
|
29
|
+
|
|
30
|
+
By using this software, you agree to these terms as binding obligations and
|
|
31
|
+
conditions.
|
|
32
|
+
|
|
33
|
+
2.2 Copyright License
|
|
34
|
+
|
|
35
|
+
MATE Labs Inc. grants you a copyright license to use the software for any
|
|
36
|
+
permitted purpose, subject to the distribution and modification restrictions
|
|
37
|
+
below.
|
|
38
|
+
|
|
39
|
+
2.3 Distribution License
|
|
40
|
+
|
|
41
|
+
You may distribute copies of the software, including modified versions,
|
|
42
|
+
provided you comply with Section 3 (Share-Alike Requirements) and Section 2.4
|
|
43
|
+
(Notices).
|
|
44
|
+
|
|
45
|
+
2.4 Notices
|
|
46
|
+
|
|
47
|
+
Anyone receiving the software from you must also receive:
|
|
48
|
+
- A copy of this license or the URL:
|
|
49
|
+
https://polyformproject.org/licenses/noncommercial/1.0.0/
|
|
50
|
+
- The following notice: "Copyright (c) 2025 MATE Labs Inc."
|
|
51
|
+
|
|
52
|
+
2.5 Changes and New Works License
|
|
53
|
+
|
|
54
|
+
You may create modifications and derivative works for any permitted purpose,
|
|
55
|
+
subject to Section 3.
|
|
56
|
+
|
|
57
|
+
2.6 Patent License
|
|
58
|
+
|
|
59
|
+
MATE Labs Inc. grants you a patent license covering any patent claims that
|
|
60
|
+
would be infringed by using the software.
|
|
61
|
+
|
|
62
|
+
2.7 Permitted Purposes
|
|
63
|
+
|
|
64
|
+
The following are permitted purposes:
|
|
65
|
+
|
|
66
|
+
- Noncommercial purposes: Any use that does not generate revenue or provide
|
|
67
|
+
commercial advantage
|
|
68
|
+
|
|
69
|
+
- Personal use: Research, experimentation, testing, study, entertainment,
|
|
70
|
+
hobbies, or religious observance without commercial application
|
|
71
|
+
|
|
72
|
+
- Noncommercial organizations: Use by charitable, educational, research,
|
|
73
|
+
public safety, health, environmental, or government institutions
|
|
74
|
+
|
|
75
|
+
2.8 Fair Use
|
|
76
|
+
|
|
77
|
+
These terms do not limit your fair use rights under applicable law.
|
|
78
|
+
|
|
79
|
+
2.9 No Sublicensing
|
|
80
|
+
|
|
81
|
+
You may not sublicense or transfer your licenses to others.
|
|
82
|
+
|
|
83
|
+
2.10 Patent Defense
|
|
84
|
+
|
|
85
|
+
If you or your company claims the software infringes any patent, all your
|
|
86
|
+
licenses terminate immediately.
|
|
87
|
+
|
|
88
|
+
2.11 Violations and Cure Period
|
|
89
|
+
|
|
90
|
+
If you violate these terms, you have 32 days from written notification to:
|
|
91
|
+
- Come into full compliance, AND
|
|
92
|
+
- Take practical steps to correct past violations
|
|
93
|
+
|
|
94
|
+
Otherwise, all licenses terminate immediately.
|
|
95
|
+
|
|
96
|
+
================================================================================
|
|
97
|
+
|
|
98
|
+
3. SHARE-ALIKE REQUIREMENTS
|
|
99
|
+
|
|
100
|
+
3.1 Scope
|
|
101
|
+
|
|
102
|
+
If you create a Derivative Work and engage in Triggering Distribution, you
|
|
103
|
+
must publicly release that Derivative Work under this same license.
|
|
104
|
+
|
|
105
|
+
3.2 Definitions
|
|
106
|
+
|
|
107
|
+
"Derivative Work" means any modification, enhancement, or work based on the
|
|
108
|
+
software that:
|
|
109
|
+
- Alters, adds, or removes functionality of the original code
|
|
110
|
+
- Incorporates substantial portions of the original source code
|
|
111
|
+
- Creates new components that depend on or interface with the original
|
|
112
|
+
software
|
|
113
|
+
|
|
114
|
+
Derivative Work does NOT include:
|
|
115
|
+
- Configuration files or parameters
|
|
116
|
+
- Plugins or extensions that use only public APIs
|
|
117
|
+
- Works that merely link to or use the software as a library without
|
|
118
|
+
modification
|
|
119
|
+
|
|
120
|
+
"Triggering Distribution" means:
|
|
121
|
+
- Making the Derivative Work available to any third party (whether by
|
|
122
|
+
download, hosting, or other means)
|
|
123
|
+
- Using the Derivative Work to provide services accessible to third parties
|
|
124
|
+
- Deploying the Derivative Work in production environments accessible to
|
|
125
|
+
others
|
|
126
|
+
|
|
127
|
+
3.3 Publication Requirements
|
|
128
|
+
|
|
129
|
+
Within 90 days of first Triggering Distribution, you must:
|
|
130
|
+
|
|
131
|
+
1. Publish source code on a publicly accessible platform (e.g., GitHub,
|
|
132
|
+
GitLab, Codeberg)
|
|
133
|
+
|
|
134
|
+
2. Include this license with the published code
|
|
135
|
+
|
|
136
|
+
3. Provide clear attribution identifying:
|
|
137
|
+
- The original work (EVVM)
|
|
138
|
+
- MATE Labs Inc. as the original licensor
|
|
139
|
+
- A description of your modifications
|
|
140
|
+
|
|
141
|
+
4. Ensure accessibility - the code must remain publicly available for at
|
|
142
|
+
least 3 years
|
|
143
|
+
|
|
144
|
+
3.4 Internal Use Exception
|
|
145
|
+
|
|
146
|
+
You are NOT required to publish Derivative Works that:
|
|
147
|
+
- Remain internal to your organization
|
|
148
|
+
- Are not distributed to third parties
|
|
149
|
+
- Are not used to provide services to external users
|
|
150
|
+
|
|
151
|
+
However, once you engage in Triggering Distribution, the 90-day publication
|
|
152
|
+
requirement begins.
|
|
153
|
+
|
|
154
|
+
================================================================================
|
|
155
|
+
|
|
156
|
+
4. NO LIABILITY
|
|
157
|
+
|
|
158
|
+
AS FAR AS THE LAW ALLOWS, THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT ANY
|
|
159
|
+
WARRANTY, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
|
|
160
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NONINFRINGEMENT.
|
|
161
|
+
|
|
162
|
+
MATE LABS INC. SHALL NOT BE LIABLE FOR ANY DAMAGES ARISING FROM THE USE OF
|
|
163
|
+
THIS SOFTWARE UNDER ANY LEGAL THEORY.
|
|
164
|
+
|
|
165
|
+
================================================================================
|
|
166
|
+
|
|
167
|
+
5. DEFINITIONS
|
|
168
|
+
|
|
169
|
+
- "MATE Labs Inc." or "Licensor": MATE Labs Inc., a Delaware corporation
|
|
170
|
+
|
|
171
|
+
- "Software": EVVM and all related components distributed under this license
|
|
172
|
+
|
|
173
|
+
- "You": The individual or entity agreeing to these terms
|
|
174
|
+
|
|
175
|
+
- "Your company": Any legal entity you work for, plus all entities under
|
|
176
|
+
common control
|
|
177
|
+
|
|
178
|
+
- "Control": Ownership of substantially all assets or power to direct
|
|
179
|
+
management
|
|
180
|
+
|
|
181
|
+
- "Use": Any activity with the software requiring a license
|
|
182
|
+
|
|
183
|
+
================================================================================
|
|
184
|
+
|
|
185
|
+
6. QUESTIONS AND COMMERCIAL LICENSING
|
|
186
|
+
|
|
187
|
+
For questions about this license or to obtain a commercial license:
|
|
188
|
+
- Email: g@evvm.org
|
|
189
|
+
- Include "EVVM License Inquiry" in subject line
|
|
190
|
+
|
|
191
|
+
================================================================================
|
|
192
|
+
|
|
193
|
+
END OF LICENSE
|
package/README.md
CHANGED
|
@@ -5,21 +5,13 @@ A TypeScript library for integrating [EVVM](https://evvm.org) payments into Node
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install @evvm/x402
|
|
8
|
+
npm install @evvm/x402 @evvm/evvm-js
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
or with bun:
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
|
-
bun add @evvm/x402
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
## Peer Dependencies
|
|
18
|
-
|
|
19
|
-
This package requires Next.js (>=15) as a peer dependency when using the Next.js middleware:
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
npm install next@>=15
|
|
14
|
+
bun add @evvm/x402 @evvm/evvm-js
|
|
23
15
|
```
|
|
24
16
|
|
|
25
17
|
## Setup
|
|
@@ -59,26 +51,6 @@ export const offers: IEvvmSchema[] = [
|
|
|
59
51
|
];
|
|
60
52
|
```
|
|
61
53
|
|
|
62
|
-
## Quick Start
|
|
63
|
-
|
|
64
|
-
```typescript
|
|
65
|
-
// src/index.ts
|
|
66
|
-
import { requireEvvmPaymentExpress } from "@evvm/x402";
|
|
67
|
-
import { facilitator } from "./facilitator";
|
|
68
|
-
import { offers } from "./offers";
|
|
69
|
-
import express from "express";
|
|
70
|
-
|
|
71
|
-
const app = express();
|
|
72
|
-
|
|
73
|
-
app.get(
|
|
74
|
-
"/api/protected",
|
|
75
|
-
requireEvvmPaymentExpress(facilitator, offers),
|
|
76
|
-
(req, res) => {
|
|
77
|
-
res.json({ message: "Hello, paid user!" });
|
|
78
|
-
},
|
|
79
|
-
);
|
|
80
|
-
```
|
|
81
|
-
|
|
82
54
|
## Middlewares
|
|
83
55
|
|
|
84
56
|
### Express.js
|
|
@@ -92,10 +64,14 @@ import { offers } from "./offers";
|
|
|
92
64
|
|
|
93
65
|
const app = express();
|
|
94
66
|
|
|
95
|
-
app.get(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
67
|
+
app.get(
|
|
68
|
+
"/api/secure",
|
|
69
|
+
requireEvvmPaymentExpress(facilitator, offers),
|
|
70
|
+
(req, res) => {
|
|
71
|
+
// Payment was verified and settled
|
|
72
|
+
res.json({ data: "Access granted" });
|
|
73
|
+
},
|
|
74
|
+
);
|
|
99
75
|
```
|
|
100
76
|
|
|
101
77
|
#### How it works:
|