mppx 0.3.3 → 0.3.5
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 +0 -52
- package/dist/Challenge.d.ts +8 -0
- package/dist/Challenge.d.ts.map +1 -1
- package/dist/Challenge.js +20 -4
- package/dist/Challenge.js.map +1 -1
- package/dist/Errors.d.ts +7 -7
- package/dist/Errors.d.ts.map +1 -1
- package/dist/Errors.js +7 -7
- package/dist/Errors.js.map +1 -1
- package/dist/cli.js +280 -119
- package/dist/cli.js.map +1 -1
- package/dist/internal/env.js +2 -2
- package/dist/internal/env.js.map +1 -1
- package/dist/server/Mppx.d.ts +2 -0
- package/dist/server/Mppx.d.ts.map +1 -1
- package/dist/server/Mppx.js +4 -3
- package/dist/server/Mppx.js.map +1 -1
- package/dist/tempo/client/ChannelOps.d.ts +5 -5
- package/dist/tempo/client/ChannelOps.d.ts.map +1 -1
- package/dist/tempo/client/ChannelOps.js +3 -3
- package/dist/tempo/client/ChannelOps.js.map +1 -1
- package/dist/tempo/client/Session.d.ts +2 -2
- package/dist/tempo/client/Session.d.ts.map +1 -1
- package/dist/tempo/client/Session.js +3 -3
- package/dist/tempo/client/Session.js.map +1 -1
- package/dist/tempo/client/SessionManager.d.ts +4 -4
- package/dist/tempo/client/SessionManager.d.ts.map +1 -1
- package/dist/tempo/client/SessionManager.js +4 -4
- package/dist/tempo/client/SessionManager.js.map +1 -1
- package/dist/tempo/index.d.ts +1 -1
- package/dist/tempo/index.d.ts.map +1 -1
- package/dist/tempo/index.js +1 -1
- package/dist/tempo/index.js.map +1 -1
- package/dist/tempo/server/Charge.js +1 -1
- package/dist/tempo/server/Charge.js.map +1 -1
- package/dist/tempo/server/Methods.d.ts +1 -1
- package/dist/tempo/server/Methods.d.ts.map +1 -1
- package/dist/tempo/server/Session.d.ts +8 -8
- package/dist/tempo/server/Session.d.ts.map +1 -1
- package/dist/tempo/server/Session.js +24 -24
- package/dist/tempo/server/Session.js.map +1 -1
- package/dist/tempo/server/index.d.ts +2 -2
- package/dist/tempo/server/index.d.ts.map +1 -1
- package/dist/tempo/server/index.js +2 -2
- package/dist/tempo/server/index.js.map +1 -1
- package/dist/tempo/server/internal/transport.d.ts +4 -4
- package/dist/tempo/server/internal/transport.d.ts.map +1 -1
- package/dist/tempo/server/internal/transport.js +3 -3
- package/dist/tempo/server/internal/transport.js.map +1 -1
- package/dist/tempo/session/Chain.d.ts.map +1 -0
- package/dist/tempo/session/Chain.js.map +1 -0
- package/dist/tempo/session/Channel.d.ts.map +1 -0
- package/dist/tempo/session/Channel.js.map +1 -0
- package/dist/tempo/session/ChannelStore.d.ts.map +1 -0
- package/dist/tempo/session/ChannelStore.js.map +1 -0
- package/dist/tempo/session/Receipt.d.ts +22 -0
- package/dist/tempo/session/Receipt.d.ts.map +1 -0
- package/dist/tempo/{stream → session}/Receipt.js +6 -6
- package/dist/tempo/session/Receipt.js.map +1 -0
- package/dist/tempo/{stream → session}/Sse.d.ts +7 -7
- package/dist/tempo/session/Sse.d.ts.map +1 -0
- package/dist/tempo/{stream → session}/Sse.js +4 -4
- package/dist/tempo/session/Sse.js.map +1 -0
- package/dist/tempo/{stream → session}/Types.d.ts +4 -4
- package/dist/tempo/session/Types.d.ts.map +1 -0
- package/dist/tempo/{stream → session}/Types.js.map +1 -1
- package/dist/tempo/session/Voucher.d.ts.map +1 -0
- package/dist/tempo/session/Voucher.js.map +1 -0
- package/dist/tempo/{stream → session}/escrow.abi.d.ts.map +1 -1
- package/dist/tempo/session/escrow.abi.js.map +1 -0
- package/dist/tempo/session/index.d.ts.map +1 -0
- package/dist/tempo/session/index.js.map +1 -0
- package/package.json +1 -1
- package/src/Challenge.test.ts +201 -11
- package/src/Challenge.ts +34 -4
- package/src/Errors.test.ts +10 -10
- package/src/Errors.ts +7 -7
- package/src/Store.test.ts +93 -0
- package/src/cli.test.ts +234 -38
- package/src/cli.ts +340 -135
- package/src/client/Transport.test.ts +4 -4
- package/src/internal/env.test.ts +42 -0
- package/src/internal/env.ts +2 -2
- package/src/middlewares/express.test.ts +1 -1
- package/src/middlewares/hono.test.ts +1 -1
- package/src/middlewares/nextjs.test.ts +1 -1
- package/src/server/Mppx.test.ts +173 -0
- package/src/server/Mppx.ts +6 -3
- package/src/server/Transport.test.ts +6 -6
- package/src/tempo/client/ChannelOps.test.ts +2 -2
- package/src/tempo/client/ChannelOps.ts +8 -8
- package/src/tempo/client/Session.test.ts +3 -3
- package/src/tempo/client/Session.ts +9 -9
- package/src/tempo/client/SessionManager.test.ts +3 -3
- package/src/tempo/client/SessionManager.ts +9 -9
- package/src/tempo/index.ts +1 -1
- package/src/tempo/server/Charge.ts +1 -1
- package/src/tempo/server/Session.test.ts +61 -9
- package/src/tempo/server/Session.ts +47 -47
- package/src/tempo/server/Sse.test.ts +3 -3
- package/src/tempo/server/index.ts +2 -2
- package/src/tempo/server/internal/transport.test.ts +285 -0
- package/src/tempo/server/internal/transport.ts +6 -6
- package/src/tempo/{stream → session}/Chain.test.ts +1 -1
- package/src/tempo/{stream → session}/Receipt.test.ts +16 -12
- package/src/tempo/{stream → session}/Receipt.ts +9 -9
- package/src/tempo/{stream → session}/Sse.test.ts +5 -5
- package/src/tempo/{stream → session}/Sse.ts +11 -11
- package/src/tempo/{stream → session}/Types.ts +4 -4
- package/dist/tempo/stream/Chain.d.ts.map +0 -1
- package/dist/tempo/stream/Chain.js.map +0 -1
- package/dist/tempo/stream/Channel.d.ts.map +0 -1
- package/dist/tempo/stream/Channel.js.map +0 -1
- package/dist/tempo/stream/ChannelStore.d.ts.map +0 -1
- package/dist/tempo/stream/ChannelStore.js.map +0 -1
- package/dist/tempo/stream/Receipt.d.ts +0 -22
- package/dist/tempo/stream/Receipt.d.ts.map +0 -1
- package/dist/tempo/stream/Receipt.js.map +0 -1
- package/dist/tempo/stream/Sse.d.ts.map +0 -1
- package/dist/tempo/stream/Sse.js.map +0 -1
- package/dist/tempo/stream/Types.d.ts.map +0 -1
- package/dist/tempo/stream/Voucher.d.ts.map +0 -1
- package/dist/tempo/stream/Voucher.js.map +0 -1
- package/dist/tempo/stream/escrow.abi.js.map +0 -1
- package/dist/tempo/stream/index.d.ts.map +0 -1
- package/dist/tempo/stream/index.js.map +0 -1
- /package/dist/tempo/{stream → session}/Chain.d.ts +0 -0
- /package/dist/tempo/{stream → session}/Chain.js +0 -0
- /package/dist/tempo/{stream → session}/Channel.d.ts +0 -0
- /package/dist/tempo/{stream → session}/Channel.js +0 -0
- /package/dist/tempo/{stream → session}/ChannelStore.d.ts +0 -0
- /package/dist/tempo/{stream → session}/ChannelStore.js +0 -0
- /package/dist/tempo/{stream → session}/Types.js +0 -0
- /package/dist/tempo/{stream → session}/Voucher.d.ts +0 -0
- /package/dist/tempo/{stream → session}/Voucher.js +0 -0
- /package/dist/tempo/{stream → session}/escrow.abi.d.ts +0 -0
- /package/dist/tempo/{stream → session}/escrow.abi.js +0 -0
- /package/dist/tempo/{stream → session}/index.d.ts +0 -0
- /package/dist/tempo/{stream → session}/index.js +0 -0
- /package/src/tempo/{stream → session}/Chain.ts +0 -0
- /package/src/tempo/{stream → session}/Channel.test.ts +0 -0
- /package/src/tempo/{stream → session}/Channel.ts +0 -0
- /package/src/tempo/{stream → session}/ChannelStore.test.ts +0 -0
- /package/src/tempo/{stream → session}/ChannelStore.ts +0 -0
- /package/src/tempo/{stream → session}/Voucher.test.ts +0 -0
- /package/src/tempo/{stream → session}/Voucher.ts +0 -0
- /package/src/tempo/{stream → session}/escrow.abi.ts +0 -0
- /package/src/tempo/{stream → session}/index.ts +0 -0
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import { Challenge, Credential } from 'mppx'
|
|
2
|
+
import type { Address, Hex } from 'viem'
|
|
3
|
+
import { describe, expect, test } from 'vitest'
|
|
4
|
+
import * as Store from '../../../Store.js'
|
|
5
|
+
import * as ChannelStore from '../../session/ChannelStore.js'
|
|
6
|
+
import { sse } from './transport.js'
|
|
7
|
+
|
|
8
|
+
const channelId = '0x0000000000000000000000000000000000000000000000000000000000000001' as Hex
|
|
9
|
+
const challengeId = 'challenge-1'
|
|
10
|
+
|
|
11
|
+
function memoryStore() {
|
|
12
|
+
return ChannelStore.fromStore(Store.memory())
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function seedChannel(
|
|
16
|
+
storage: ChannelStore.ChannelStore,
|
|
17
|
+
balance: bigint,
|
|
18
|
+
): Promise<ChannelStore.State | null> {
|
|
19
|
+
return storage.updateChannel(channelId, () => ({
|
|
20
|
+
channelId,
|
|
21
|
+
payer: '0x0000000000000000000000000000000000000001' as Address,
|
|
22
|
+
payee: '0x0000000000000000000000000000000000000002' as Address,
|
|
23
|
+
token: '0x0000000000000000000000000000000000000003' as Address,
|
|
24
|
+
authorizedSigner: '0x0000000000000000000000000000000000000004' as Address,
|
|
25
|
+
chainId: 42431,
|
|
26
|
+
escrowContract: '0x542831e3E4Ace07559b7C8787395f4Fb99F70787' as Address,
|
|
27
|
+
deposit: balance,
|
|
28
|
+
settledOnChain: 0n,
|
|
29
|
+
highestVoucherAmount: balance,
|
|
30
|
+
highestVoucher: null,
|
|
31
|
+
spent: 0n,
|
|
32
|
+
units: 0,
|
|
33
|
+
finalized: false,
|
|
34
|
+
createdAt: new Date().toISOString(),
|
|
35
|
+
}))
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function makeChallenge() {
|
|
39
|
+
return Challenge.from({
|
|
40
|
+
id: challengeId,
|
|
41
|
+
realm: 'test.example.com',
|
|
42
|
+
method: 'tempo',
|
|
43
|
+
intent: 'session',
|
|
44
|
+
request: {
|
|
45
|
+
amount: '1000000',
|
|
46
|
+
currency: '0x20c0000000000000000000000000000000000001',
|
|
47
|
+
recipient: '0x0000000000000000000000000000000000000002',
|
|
48
|
+
},
|
|
49
|
+
})
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function makeCredential() {
|
|
53
|
+
const challenge = makeChallenge()
|
|
54
|
+
return Credential.from({
|
|
55
|
+
challenge,
|
|
56
|
+
payload: {
|
|
57
|
+
action: 'voucher',
|
|
58
|
+
channelId,
|
|
59
|
+
cumulativeAmount: '1000000',
|
|
60
|
+
signature: '0xdeadbeef',
|
|
61
|
+
},
|
|
62
|
+
})
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function makeAuthorizedRequest(): Request {
|
|
66
|
+
const credential = makeCredential()
|
|
67
|
+
const header = Credential.serialize(credential)
|
|
68
|
+
return new Request('https://test.example.com/session', {
|
|
69
|
+
headers: { Authorization: header },
|
|
70
|
+
})
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function makeReceipt() {
|
|
74
|
+
return {
|
|
75
|
+
method: 'tempo',
|
|
76
|
+
status: 'success' as const,
|
|
77
|
+
timestamp: new Date().toISOString(),
|
|
78
|
+
reference: channelId,
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
describe('sse transport', () => {
|
|
83
|
+
test('getCredential returns null when no Authorization header', () => {
|
|
84
|
+
const store = memoryStore()
|
|
85
|
+
const transport = sse({ store })
|
|
86
|
+
const request = new Request('https://test.example.com/session')
|
|
87
|
+
expect(transport.getCredential(request)).toBeNull()
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
test('getCredential returns credential from Authorization header', () => {
|
|
91
|
+
const store = memoryStore()
|
|
92
|
+
const transport = sse({ store })
|
|
93
|
+
const request = makeAuthorizedRequest()
|
|
94
|
+
const credential = transport.getCredential(request)
|
|
95
|
+
expect(credential).not.toBeNull()
|
|
96
|
+
expect(credential!.challenge.id).toBe(challengeId)
|
|
97
|
+
expect((credential!.payload as any).channelId).toBe(channelId)
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
test('getCredential captures SSE context in contextMap', async () => {
|
|
101
|
+
const store = memoryStore()
|
|
102
|
+
await seedChannel(store, 10000000n)
|
|
103
|
+
const transport = sse({ store })
|
|
104
|
+
|
|
105
|
+
const request = makeAuthorizedRequest()
|
|
106
|
+
transport.getCredential(request)
|
|
107
|
+
|
|
108
|
+
async function* gen() {
|
|
109
|
+
yield 'test'
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const response = transport.respondReceipt({
|
|
113
|
+
receipt: makeReceipt(),
|
|
114
|
+
response: gen(),
|
|
115
|
+
challengeId,
|
|
116
|
+
})
|
|
117
|
+
expect(response.headers.get('Content-Type')).toContain('text/event-stream')
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
test('respondChallenge delegates to base http transport', async () => {
|
|
121
|
+
const store = memoryStore()
|
|
122
|
+
const transport = sse({ store })
|
|
123
|
+
const challenge = makeChallenge()
|
|
124
|
+
|
|
125
|
+
const response = await transport.respondChallenge({
|
|
126
|
+
challenge,
|
|
127
|
+
input: new Request('https://test.example.com/session'),
|
|
128
|
+
})
|
|
129
|
+
expect(response).toBeInstanceOf(Response)
|
|
130
|
+
expect(response.status).toBe(402)
|
|
131
|
+
expect(response.headers.get('WWW-Authenticate')).toContain('Payment')
|
|
132
|
+
})
|
|
133
|
+
|
|
134
|
+
test('respondReceipt with AsyncIterable produces SSE response', async () => {
|
|
135
|
+
const store = memoryStore()
|
|
136
|
+
await seedChannel(store, 10000000n)
|
|
137
|
+
const transport = sse({ store })
|
|
138
|
+
|
|
139
|
+
transport.getCredential(makeAuthorizedRequest())
|
|
140
|
+
|
|
141
|
+
async function* gen() {
|
|
142
|
+
yield 'hello'
|
|
143
|
+
yield 'world'
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const response = transport.respondReceipt({
|
|
147
|
+
receipt: makeReceipt(),
|
|
148
|
+
response: gen(),
|
|
149
|
+
challengeId,
|
|
150
|
+
})
|
|
151
|
+
expect(response.headers.get('Content-Type')).toContain('text/event-stream')
|
|
152
|
+
})
|
|
153
|
+
|
|
154
|
+
test('respondReceipt with AsyncGeneratorFunction passes stream controller', async () => {
|
|
155
|
+
const store = memoryStore()
|
|
156
|
+
await seedChannel(store, 10000000n)
|
|
157
|
+
const transport = sse({ store })
|
|
158
|
+
|
|
159
|
+
transport.getCredential(makeAuthorizedRequest())
|
|
160
|
+
|
|
161
|
+
const response = transport.respondReceipt({
|
|
162
|
+
receipt: makeReceipt(),
|
|
163
|
+
response: async function* (stream) {
|
|
164
|
+
await stream.charge()
|
|
165
|
+
yield 'hello'
|
|
166
|
+
},
|
|
167
|
+
challengeId,
|
|
168
|
+
})
|
|
169
|
+
expect(response.headers.get('Content-Type')).toContain('text/event-stream')
|
|
170
|
+
})
|
|
171
|
+
|
|
172
|
+
test('respondReceipt with upstream SSE Response auto-detects and iterates', async () => {
|
|
173
|
+
const store = memoryStore()
|
|
174
|
+
await seedChannel(store, 10000000n)
|
|
175
|
+
const transport = sse({ store })
|
|
176
|
+
|
|
177
|
+
transport.getCredential(makeAuthorizedRequest())
|
|
178
|
+
|
|
179
|
+
const encoder = new TextEncoder()
|
|
180
|
+
const upstream = new Response(
|
|
181
|
+
new ReadableStream({
|
|
182
|
+
start(controller) {
|
|
183
|
+
controller.enqueue(encoder.encode('event: message\ndata: chunk1\n\n'))
|
|
184
|
+
controller.enqueue(encoder.encode('event: message\ndata: chunk2\n\n'))
|
|
185
|
+
controller.close()
|
|
186
|
+
},
|
|
187
|
+
}),
|
|
188
|
+
{ headers: { 'Content-Type': 'text/event-stream; charset=utf-8' } },
|
|
189
|
+
)
|
|
190
|
+
|
|
191
|
+
const response = transport.respondReceipt({
|
|
192
|
+
receipt: makeReceipt(),
|
|
193
|
+
response: upstream,
|
|
194
|
+
challengeId,
|
|
195
|
+
})
|
|
196
|
+
expect(response.headers.get('Content-Type')).toContain('text/event-stream')
|
|
197
|
+
})
|
|
198
|
+
|
|
199
|
+
test('respondReceipt with plain Response delegates to base http transport', () => {
|
|
200
|
+
const store = memoryStore()
|
|
201
|
+
const transport = sse({ store })
|
|
202
|
+
const receipt = makeReceipt()
|
|
203
|
+
|
|
204
|
+
const plainResponse = new Response('ok', {
|
|
205
|
+
headers: { 'Content-Type': 'application/json' },
|
|
206
|
+
})
|
|
207
|
+
|
|
208
|
+
const response = transport.respondReceipt({
|
|
209
|
+
receipt,
|
|
210
|
+
response: plainResponse,
|
|
211
|
+
challengeId,
|
|
212
|
+
})
|
|
213
|
+
expect(response).toBeInstanceOf(Response)
|
|
214
|
+
expect(response.headers.get('Payment-Receipt')).toBeTruthy()
|
|
215
|
+
})
|
|
216
|
+
|
|
217
|
+
test('respondReceipt cleans up contextMap after use', async () => {
|
|
218
|
+
const store = memoryStore()
|
|
219
|
+
await seedChannel(store, 10000000n)
|
|
220
|
+
const transport = sse({ store })
|
|
221
|
+
|
|
222
|
+
transport.getCredential(makeAuthorizedRequest())
|
|
223
|
+
|
|
224
|
+
async function* gen() {
|
|
225
|
+
yield 'first'
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
transport.respondReceipt({
|
|
229
|
+
receipt: makeReceipt(),
|
|
230
|
+
response: gen(),
|
|
231
|
+
challengeId,
|
|
232
|
+
})
|
|
233
|
+
|
|
234
|
+
async function* gen2() {
|
|
235
|
+
yield 'second'
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
expect(() =>
|
|
239
|
+
transport.respondReceipt({
|
|
240
|
+
receipt: makeReceipt(),
|
|
241
|
+
response: gen2(),
|
|
242
|
+
challengeId,
|
|
243
|
+
}),
|
|
244
|
+
).toThrow('No SSE context available')
|
|
245
|
+
})
|
|
246
|
+
|
|
247
|
+
test('respondReceipt throws when no SSE context available', () => {
|
|
248
|
+
const store = memoryStore()
|
|
249
|
+
const transport = sse({ store })
|
|
250
|
+
|
|
251
|
+
async function* gen() {
|
|
252
|
+
yield 'hello'
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
expect(() =>
|
|
256
|
+
transport.respondReceipt({
|
|
257
|
+
receipt: makeReceipt(),
|
|
258
|
+
response: gen(),
|
|
259
|
+
challengeId,
|
|
260
|
+
}),
|
|
261
|
+
).toThrow('No SSE context available')
|
|
262
|
+
})
|
|
263
|
+
|
|
264
|
+
test('poll: true strips waitForUpdate from store', async () => {
|
|
265
|
+
const store = memoryStore()
|
|
266
|
+
;(store as any).waitForUpdate = async () => {}
|
|
267
|
+
await seedChannel(store, 10000000n)
|
|
268
|
+
|
|
269
|
+
const transport = sse({ store, poll: true })
|
|
270
|
+
|
|
271
|
+
transport.getCredential(makeAuthorizedRequest())
|
|
272
|
+
|
|
273
|
+
async function* gen() {
|
|
274
|
+
yield 'test'
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
const response = transport.respondReceipt({
|
|
278
|
+
receipt: makeReceipt(),
|
|
279
|
+
response: gen(),
|
|
280
|
+
challengeId,
|
|
281
|
+
})
|
|
282
|
+
expect(response.headers.get('Content-Type')).toContain('text/event-stream')
|
|
283
|
+
expect(transport.name).toBe('sse')
|
|
284
|
+
})
|
|
285
|
+
})
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
* @internal
|
|
7
7
|
*/
|
|
8
8
|
import * as Transport from '../../../server/Transport.js'
|
|
9
|
-
import type * as ChannelStore from '../../
|
|
10
|
-
import * as Sse_core from '../../
|
|
9
|
+
import type * as ChannelStore from '../../session/ChannelStore.js'
|
|
10
|
+
import * as Sse_core from '../../session/Sse.js'
|
|
11
11
|
|
|
12
|
-
/** SSE transport with Tempo
|
|
13
|
-
export type Sse = Transport.Sse<Sse_core.
|
|
12
|
+
/** SSE transport with Tempo session controller. */
|
|
13
|
+
export type Sse = Transport.Sse<Sse_core.SessionController>
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Creates a Tempo-metered SSE transport.
|
|
@@ -46,7 +46,7 @@ export function sse(options: sse.Options & { store: ChannelStore.ChannelStore })
|
|
|
46
46
|
const ctx = Sse_core.fromRequest(request)
|
|
47
47
|
contextMap.set(ctx.challengeId, { ...ctx, signal: request.signal })
|
|
48
48
|
} catch {
|
|
49
|
-
// ignore — non-SSE credentials won't have
|
|
49
|
+
// ignore — non-SSE credentials won't have session context
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
return credential
|
|
@@ -72,7 +72,7 @@ export function sse(options: sse.Options & { store: ChannelStore.ChannelStore })
|
|
|
72
72
|
contextMap.delete(challengeId)
|
|
73
73
|
|
|
74
74
|
// Pass async generator functions directly so Sse.serve gives them
|
|
75
|
-
// a
|
|
75
|
+
// a SessionController for manual charge(). Pass raw AsyncIterables
|
|
76
76
|
// as-is so Sse.serve auto-charges per yielded value.
|
|
77
77
|
const generate: Sse_core.serve.Options['generate'] = isAsyncGeneratorFunction(resolved)
|
|
78
78
|
? (resolved as Sse_core.serve.Options['generate'])
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import type { Hex } from 'viem'
|
|
2
2
|
import { describe, expect, test } from 'vitest'
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
createSessionReceipt,
|
|
5
|
+
deserializeSessionReceipt,
|
|
6
|
+
serializeSessionReceipt,
|
|
7
|
+
} from './Receipt.js'
|
|
4
8
|
|
|
5
9
|
const channelId = '0x0000000000000000000000000000000000000000000000000000000000000001' as Hex
|
|
6
10
|
|
|
7
11
|
describe('Receipt', () => {
|
|
8
|
-
test('
|
|
9
|
-
const receipt =
|
|
12
|
+
test('createSessionReceipt', () => {
|
|
13
|
+
const receipt = createSessionReceipt({
|
|
10
14
|
challengeId: 'test-challenge-id',
|
|
11
15
|
channelId,
|
|
12
16
|
acceptedCumulative: 5000000n,
|
|
@@ -27,9 +31,9 @@ describe('Receipt', () => {
|
|
|
27
31
|
expect(receipt.txHash).toBeUndefined()
|
|
28
32
|
})
|
|
29
33
|
|
|
30
|
-
test('
|
|
34
|
+
test('createSessionReceipt with txHash', () => {
|
|
31
35
|
const txHash = '0xabcdef' as Hex
|
|
32
|
-
const receipt =
|
|
36
|
+
const receipt = createSessionReceipt({
|
|
33
37
|
challengeId: 'test-challenge-id',
|
|
34
38
|
channelId,
|
|
35
39
|
acceptedCumulative: 5000000n,
|
|
@@ -41,8 +45,8 @@ describe('Receipt', () => {
|
|
|
41
45
|
expect(receipt.units).toBeUndefined()
|
|
42
46
|
})
|
|
43
47
|
|
|
44
|
-
test('
|
|
45
|
-
const receipt =
|
|
48
|
+
test('createSessionReceipt omits optional fields when undefined', () => {
|
|
49
|
+
const receipt = createSessionReceipt({
|
|
46
50
|
challengeId: 'test-challenge-id',
|
|
47
51
|
channelId,
|
|
48
52
|
acceptedCumulative: 1000n,
|
|
@@ -54,7 +58,7 @@ describe('Receipt', () => {
|
|
|
54
58
|
})
|
|
55
59
|
|
|
56
60
|
test('serialize and deserialize round-trip', () => {
|
|
57
|
-
const receipt =
|
|
61
|
+
const receipt = createSessionReceipt({
|
|
58
62
|
challengeId: 'test-challenge-id',
|
|
59
63
|
channelId,
|
|
60
64
|
acceptedCumulative: 5000000n,
|
|
@@ -62,22 +66,22 @@ describe('Receipt', () => {
|
|
|
62
66
|
units: 42,
|
|
63
67
|
})
|
|
64
68
|
|
|
65
|
-
const encoded =
|
|
69
|
+
const encoded = serializeSessionReceipt(receipt)
|
|
66
70
|
expect(typeof encoded).toBe('string')
|
|
67
71
|
|
|
68
|
-
const decoded =
|
|
72
|
+
const decoded = deserializeSessionReceipt(encoded)
|
|
69
73
|
expect(decoded).toEqual(receipt)
|
|
70
74
|
})
|
|
71
75
|
|
|
72
76
|
test('serialize produces base64url without padding', () => {
|
|
73
|
-
const receipt =
|
|
77
|
+
const receipt = createSessionReceipt({
|
|
74
78
|
challengeId: 'test-challenge-id',
|
|
75
79
|
channelId,
|
|
76
80
|
acceptedCumulative: 1n,
|
|
77
81
|
spent: 0n,
|
|
78
82
|
})
|
|
79
83
|
|
|
80
|
-
const encoded =
|
|
84
|
+
const encoded = serializeSessionReceipt(receipt)
|
|
81
85
|
// base64url uses - and _ instead of + and /, no = padding
|
|
82
86
|
expect(encoded).not.toMatch(/[+/=]/)
|
|
83
87
|
})
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { Base64 } from 'ox'
|
|
2
2
|
import type { Hex } from 'viem'
|
|
3
|
-
import type {
|
|
3
|
+
import type { SessionReceipt } from './Types.js'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Create a
|
|
6
|
+
* Create a session receipt.
|
|
7
7
|
*/
|
|
8
|
-
export function
|
|
8
|
+
export function createSessionReceipt(params: {
|
|
9
9
|
challengeId: string
|
|
10
10
|
channelId: Hex
|
|
11
11
|
acceptedCumulative: bigint
|
|
12
12
|
spent: bigint
|
|
13
13
|
units?: number | undefined
|
|
14
14
|
txHash?: Hex | undefined
|
|
15
|
-
}):
|
|
15
|
+
}): SessionReceipt {
|
|
16
16
|
return {
|
|
17
17
|
method: 'tempo',
|
|
18
18
|
intent: 'session',
|
|
@@ -29,17 +29,17 @@ export function createStreamReceipt(params: {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
|
-
* Serialize a
|
|
32
|
+
* Serialize a session receipt to the Payment-Receipt header format.
|
|
33
33
|
*/
|
|
34
|
-
export function
|
|
34
|
+
export function serializeSessionReceipt(receipt: SessionReceipt): string {
|
|
35
35
|
const json = JSON.stringify(receipt)
|
|
36
36
|
return Base64.fromString(json, { pad: false, url: true })
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
|
-
* Deserialize a Payment-Receipt header value to a
|
|
40
|
+
* Deserialize a Payment-Receipt header value to a session receipt.
|
|
41
41
|
*/
|
|
42
|
-
export function
|
|
42
|
+
export function deserializeSessionReceipt(encoded: string): SessionReceipt {
|
|
43
43
|
const json = Base64.toString(encoded)
|
|
44
|
-
return JSON.parse(json) as
|
|
44
|
+
return JSON.parse(json) as SessionReceipt
|
|
45
45
|
}
|
|
@@ -2,14 +2,14 @@ import type { Address, Hex } from 'viem'
|
|
|
2
2
|
import { describe, expect, test } from 'vitest'
|
|
3
3
|
import type * as ChannelStore from './ChannelStore.js'
|
|
4
4
|
import { formatNeedVoucherEvent, formatReceiptEvent, parseEvent, serve } from './Sse.js'
|
|
5
|
-
import type { NeedVoucherEvent,
|
|
5
|
+
import type { NeedVoucherEvent, SessionReceipt } from './Types.js'
|
|
6
6
|
|
|
7
7
|
const channelId = '0x0000000000000000000000000000000000000000000000000000000000000001' as Hex
|
|
8
8
|
const challengeId = 'challenge-1'
|
|
9
9
|
|
|
10
10
|
describe('formatReceiptEvent', () => {
|
|
11
11
|
test('produces valid SSE format', () => {
|
|
12
|
-
const receipt:
|
|
12
|
+
const receipt: SessionReceipt = {
|
|
13
13
|
method: 'tempo',
|
|
14
14
|
intent: 'session',
|
|
15
15
|
status: 'success',
|
|
@@ -30,7 +30,7 @@ describe('formatReceiptEvent', () => {
|
|
|
30
30
|
})
|
|
31
31
|
|
|
32
32
|
test('includes txHash when present', () => {
|
|
33
|
-
const receipt:
|
|
33
|
+
const receipt: SessionReceipt = {
|
|
34
34
|
method: 'tempo',
|
|
35
35
|
intent: 'session',
|
|
36
36
|
status: 'success',
|
|
@@ -112,7 +112,7 @@ describe('parseEvent', () => {
|
|
|
112
112
|
})
|
|
113
113
|
|
|
114
114
|
test('parses payment-receipt event', () => {
|
|
115
|
-
const receipt:
|
|
115
|
+
const receipt: SessionReceipt = {
|
|
116
116
|
method: 'tempo',
|
|
117
117
|
intent: 'session',
|
|
118
118
|
status: 'success',
|
|
@@ -136,7 +136,7 @@ describe('parseEvent', () => {
|
|
|
136
136
|
})
|
|
137
137
|
|
|
138
138
|
test('round-trips formatReceiptEvent', () => {
|
|
139
|
-
const receipt:
|
|
139
|
+
const receipt: SessionReceipt = {
|
|
140
140
|
method: 'tempo',
|
|
141
141
|
intent: 'session',
|
|
142
142
|
status: 'success',
|
|
@@ -9,16 +9,16 @@
|
|
|
9
9
|
import type { Hex } from 'viem'
|
|
10
10
|
import * as Credential from '../../Credential.js'
|
|
11
11
|
import * as ChannelStore from './ChannelStore.js'
|
|
12
|
-
import {
|
|
13
|
-
import type { NeedVoucherEvent,
|
|
12
|
+
import { createSessionReceipt } from './Receipt.js'
|
|
13
|
+
import type { NeedVoucherEvent, SessionCredentialPayload, SessionReceipt } from './Types.js'
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
* Format a
|
|
16
|
+
* Format a session receipt as a Server-Sent Event.
|
|
17
17
|
*
|
|
18
18
|
* Produces a valid SSE event string with `event: payment-receipt`
|
|
19
19
|
* and the receipt JSON as the `data` field.
|
|
20
20
|
*/
|
|
21
|
-
export function formatReceiptEvent(receipt:
|
|
21
|
+
export function formatReceiptEvent(receipt: SessionReceipt): string {
|
|
22
22
|
return `event: payment-receipt\ndata: ${JSON.stringify(receipt)}\n\n`
|
|
23
23
|
}
|
|
24
24
|
|
|
@@ -39,7 +39,7 @@ export function formatNeedVoucherEvent(params: NeedVoucherEvent): string {
|
|
|
39
39
|
export type SseEvent =
|
|
40
40
|
| { type: 'message'; data: string }
|
|
41
41
|
| { type: 'payment-need-voucher'; data: NeedVoucherEvent }
|
|
42
|
-
| { type: 'payment-receipt'; data:
|
|
42
|
+
| { type: 'payment-receipt'; data: SessionReceipt }
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
45
|
* Parse a raw SSE event string into a typed event.
|
|
@@ -72,13 +72,13 @@ export function parseEvent(raw: string): SseEvent | null {
|
|
|
72
72
|
case 'payment-need-voucher':
|
|
73
73
|
return { type: 'payment-need-voucher', data: JSON.parse(data) as NeedVoucherEvent }
|
|
74
74
|
case 'payment-receipt':
|
|
75
|
-
return { type: 'payment-receipt', data: JSON.parse(data) as
|
|
75
|
+
return { type: 'payment-receipt', data: JSON.parse(data) as SessionReceipt }
|
|
76
76
|
default:
|
|
77
77
|
return { type: 'message', data }
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
export type
|
|
81
|
+
export type SessionController = {
|
|
82
82
|
charge(): Promise<void>
|
|
83
83
|
}
|
|
84
84
|
|
|
@@ -88,7 +88,7 @@ export type StreamController = {
|
|
|
88
88
|
* `generate` may be either:
|
|
89
89
|
* - An `AsyncIterable<string>` — each yielded value is automatically charged
|
|
90
90
|
* (one `tickCost` per value).
|
|
91
|
-
* - A callback `(stream:
|
|
91
|
+
* - A callback `(stream: SessionController) => AsyncIterable<string>` — the
|
|
92
92
|
* generator controls when charges happen by calling `stream.charge()`.
|
|
93
93
|
*
|
|
94
94
|
* For each emitted value the stream:
|
|
@@ -143,7 +143,7 @@ export function serve(options: serve.Options): ReadableStream<Uint8Array> {
|
|
|
143
143
|
if (!aborted()) {
|
|
144
144
|
const channel = await store.getChannel(channelId)
|
|
145
145
|
if (channel) {
|
|
146
|
-
const receipt =
|
|
146
|
+
const receipt = createSessionReceipt({
|
|
147
147
|
challengeId,
|
|
148
148
|
channelId,
|
|
149
149
|
acceptedCumulative: channel.highestVoucherAmount,
|
|
@@ -168,7 +168,7 @@ export declare namespace serve {
|
|
|
168
168
|
channelId: Hex
|
|
169
169
|
challengeId: string
|
|
170
170
|
tickCost: bigint
|
|
171
|
-
generate: AsyncIterable<string> | ((stream:
|
|
171
|
+
generate: AsyncIterable<string> | ((stream: SessionController) => AsyncIterable<string>)
|
|
172
172
|
pollIntervalMs?: number | undefined
|
|
173
173
|
signal?: AbortSignal | undefined
|
|
174
174
|
}
|
|
@@ -203,7 +203,7 @@ export function fromRequest(request: Request): fromRequest.Context {
|
|
|
203
203
|
if (!payment) throw new Error('Missing Payment credential in Authorization header.')
|
|
204
204
|
|
|
205
205
|
const credential = Credential.deserialize(payment)
|
|
206
|
-
const payload = credential.payload as
|
|
206
|
+
const payload = credential.payload as SessionCredentialPayload
|
|
207
207
|
return {
|
|
208
208
|
challengeId: credential.challenge.id,
|
|
209
209
|
channelId: payload.channelId,
|
|
@@ -17,9 +17,9 @@ export interface SignedVoucher extends Voucher {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
20
|
+
* Session credential payload (discriminated union).
|
|
21
21
|
*/
|
|
22
|
-
export type
|
|
22
|
+
export type SessionCredentialPayload =
|
|
23
23
|
| {
|
|
24
24
|
action: 'open'
|
|
25
25
|
type: 'transaction'
|
|
@@ -68,9 +68,9 @@ export interface NeedVoucherEvent {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
/**
|
|
71
|
-
*
|
|
71
|
+
* Session receipt returned in Payment-Receipt header.
|
|
72
72
|
*/
|
|
73
|
-
export interface
|
|
73
|
+
export interface SessionReceipt {
|
|
74
74
|
method: 'tempo'
|
|
75
75
|
intent: 'session'
|
|
76
76
|
status: 'success'
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Chain.d.ts","sourceRoot":"","sources":["../../../src/tempo/stream/Chain.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,MAAM,EAGX,KAAK,GAAG,EAER,KAAK,sBAAsB,EAE5B,MAAM,MAAM,CAAA;AAIb,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE/C,OAAO,EAAE,SAAS,EAAE,CAAA;AAIpB;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,sBAAsB,CAAC,OAAO,SAAS,EAAE,YAAY,CAAC,CAAA;AAEnF;;GAEG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,OAAO,EACvB,SAAS,EAAE,GAAG,GACb,OAAO,CAAC,cAAc,CAAC,CAOzB;AAED;;GAEG;AACH,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,OAAO,EACvB,SAAS,EAAE,GAAG,EACd,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAY9B;AAQD;;GAEG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,OAAO,EACvB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,GAAG,CAAC,CAUd;AAED;;GAEG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,OAAO,EACvB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"mappings":"AACA,OAAO,KAAK,KAAK,GAAG,MAAM,QAAQ,CAAA;AAElC;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,UAAU,EAAE,SAAS,CAAC,UAAU,GAAG,GAAG,CAAC,GAAG,CAsBnE;AAED,MAAM,CAAC,OAAO,WAAW,SAAS,CAAC;IACjC,KAAK,UAAU,GAAG;QAChB,kEAAkE;QAClE,gBAAgB,EAAE,GAAG,CAAC,GAAG,CAAA;QACzB,kEAAkE;QAClE,OAAO,EAAE,MAAM,CAAA;QACf,sCAAsC;QACtC,cAAc,EAAE,GAAG,CAAC,GAAG,CAAA;QACvB,wCAAwC;QACxC,KAAK,EAAE,GAAG,CAAC,GAAG,CAAA;QACd,qCAAqC;QACrC,KAAK,EAAE,GAAG,CAAC,GAAG,CAAA;QACd,sEAAsE;QACtE,IAAI,EAAE,GAAG,CAAC,GAAG,CAAA;QACb,6CAA6C;QAC7C,KAAK,EAAE,GAAG,CAAC,GAAG,CAAA;KACf,CAAA;CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Channel.js","sourceRoot":"","sources":["../../../src/tempo/stream/Channel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,IAAI,CAAA;AAGxC;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,UAAgC;IACxD,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAClC,aAAa,CAAC,IAAI,CAAC;QACjB,eAAe;QACf,eAAe;QACf,eAAe;QACf,cAAc;QACd,0BAA0B;QAC1B,wBAAwB;QACxB,iBAAiB;KAClB,CAAC,EACF;QACE,UAAU,CAAC,KAAK;QAChB,UAAU,CAAC,KAAK;QAChB,UAAU,CAAC,KAAK;QAChB,UAAU,CAAC,IAAI;QACf,UAAU,CAAC,gBAAgB;QAC3B,UAAU,CAAC,cAAc;QACzB,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC;KAC3B,CACF,CAAA;IACD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|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { Hex } from 'viem';
|
|
2
|
-
import type { StreamReceipt } from './Types.js';
|
|
3
|
-
/**
|
|
4
|
-
* Create a stream receipt.
|
|
5
|
-
*/
|
|
6
|
-
export declare function createStreamReceipt(params: {
|
|
7
|
-
challengeId: string;
|
|
8
|
-
channelId: Hex;
|
|
9
|
-
acceptedCumulative: bigint;
|
|
10
|
-
spent: bigint;
|
|
11
|
-
units?: number | undefined;
|
|
12
|
-
txHash?: Hex | undefined;
|
|
13
|
-
}): StreamReceipt;
|
|
14
|
-
/**
|
|
15
|
-
* Serialize a stream receipt to the Payment-Receipt header format.
|
|
16
|
-
*/
|
|
17
|
-
export declare function serializeStreamReceipt(receipt: StreamReceipt): string;
|
|
18
|
-
/**
|
|
19
|
-
* Deserialize a Payment-Receipt header value to a stream receipt.
|
|
20
|
-
*/
|
|
21
|
-
export declare function deserializeStreamReceipt(encoded: string): StreamReceipt;
|
|
22
|
-
//# sourceMappingURL=Receipt.d.ts.map
|