@abbababa/sdk 0.7.0 → 1.0.0
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 +178 -60
- package/dist/agents.d.ts +15 -4
- package/dist/agents.d.ts.map +1 -1
- package/dist/agents.js +14 -1
- package/dist/agents.js.map +1 -1
- package/dist/buyer.d.ts +136 -25
- package/dist/buyer.d.ts.map +1 -1
- package/dist/buyer.js +277 -45
- package/dist/buyer.js.map +1 -1
- package/dist/channels.d.ts +2 -2
- package/dist/channels.d.ts.map +1 -1
- package/dist/channels.js.map +1 -1
- package/dist/checkout.d.ts +2 -2
- package/dist/checkout.d.ts.map +1 -1
- package/dist/checkout.js.map +1 -1
- package/dist/client.d.ts +3 -3
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +7 -6
- package/dist/client.js.map +1 -1
- package/dist/crypto.d.ts +93 -0
- package/dist/crypto.d.ts.map +1 -0
- package/dist/crypto.js +298 -0
- package/dist/crypto.js.map +1 -0
- package/dist/errors.d.ts +7 -7
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +8 -8
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +9 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/dist/memory.d.ts +2 -2
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js.map +1 -1
- package/dist/messages.d.ts +27 -3
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +35 -0
- package/dist/messages.js.map +1 -1
- package/dist/register.d.ts +0 -1
- package/dist/register.d.ts.map +1 -1
- package/dist/register.js +3 -4
- package/dist/register.js.map +1 -1
- package/dist/seller.d.ts +102 -22
- package/dist/seller.d.ts.map +1 -1
- package/dist/seller.js +190 -45
- package/dist/seller.js.map +1 -1
- package/dist/services.d.ts +2 -2
- package/dist/services.d.ts.map +1 -1
- package/dist/services.js.map +1 -1
- package/dist/transactions.d.ts +2 -2
- package/dist/transactions.d.ts.map +1 -1
- package/dist/transactions.js.map +1 -1
- package/dist/types.d.ts +131 -57
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/wallet/abi.d.ts +15 -0
- package/dist/wallet/abi.d.ts.map +1 -1
- package/dist/wallet/abi.js +18 -8
- package/dist/wallet/abi.js.map +1 -1
- package/dist/wallet/constants.d.ts +8 -6
- package/dist/wallet/constants.d.ts.map +1 -1
- package/dist/wallet/constants.js +38 -23
- package/dist/wallet/constants.js.map +1 -1
- package/dist/wallet/eoa-wallet.d.ts +21 -0
- package/dist/wallet/eoa-wallet.d.ts.map +1 -0
- package/dist/wallet/eoa-wallet.js +37 -0
- package/dist/wallet/eoa-wallet.js.map +1 -0
- package/dist/wallet/escrow.d.ts +38 -8
- package/dist/wallet/escrow.d.ts.map +1 -1
- package/dist/wallet/escrow.js +71 -18
- package/dist/wallet/escrow.js.map +1 -1
- package/dist/wallet/index.d.ts +0 -2
- package/dist/wallet/index.d.ts.map +1 -1
- package/dist/wallet/index.js +0 -2
- package/dist/wallet/index.js.map +1 -1
- package/dist/wallet/session-key.d.ts +71 -0
- package/dist/wallet/session-key.d.ts.map +1 -0
- package/dist/wallet/session-key.js +82 -0
- package/dist/wallet/session-key.js.map +1 -0
- package/dist/wallet/session-keys.js +8 -8
- package/dist/wallet/smart-account.d.ts +2 -2
- package/dist/wallet/smart-account.js +4 -4
- package/package.json +14 -32
package/dist/messages.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ApiResponse } from './types.js';
|
|
1
|
+
import type { AbbaBabaClient } from './client.js';
|
|
2
|
+
import type { ApiResponse, E2EDecryptResult } from './types.js';
|
|
3
|
+
import type { AgentCrypto } from './crypto.js';
|
|
3
4
|
export interface SendMessageInput {
|
|
4
5
|
toAgentId?: string;
|
|
5
6
|
topic?: string;
|
|
@@ -52,7 +53,7 @@ export interface MessageSubscription {
|
|
|
52
53
|
}
|
|
53
54
|
export declare class MessagesClient {
|
|
54
55
|
private client;
|
|
55
|
-
constructor(client:
|
|
56
|
+
constructor(client: AbbaBabaClient);
|
|
56
57
|
send(input: SendMessageInput): Promise<ApiResponse<AgentMessage>>;
|
|
57
58
|
inbox(params?: InboxParams): Promise<ApiResponse<AgentMessage[]>>;
|
|
58
59
|
get(messageId: string): Promise<ApiResponse<AgentMessage>>;
|
|
@@ -61,5 +62,28 @@ export declare class MessagesClient {
|
|
|
61
62
|
unsubscribe(topic: string): Promise<ApiResponse<{
|
|
62
63
|
message: string;
|
|
63
64
|
}>>;
|
|
65
|
+
/**
|
|
66
|
+
* Send an end-to-end encrypted message to a recipient agent.
|
|
67
|
+
*
|
|
68
|
+
* The plaintext `body` is encrypted client-side using ECIES (abba-e2e-v1)
|
|
69
|
+
* and sent as `{ _e2e: EncryptedEnvelope }`. The platform never sees the
|
|
70
|
+
* plaintext — it relays the envelope as opaque JSON.
|
|
71
|
+
*
|
|
72
|
+
* @param input - Message parameters (same as `send()`). `body` is the plaintext.
|
|
73
|
+
* @param senderCrypto - The sending agent's AgentCrypto instance (holds private key).
|
|
74
|
+
* @param recipientPubKey - Recipient's compressed secp256k1 public key, hex (33 bytes).
|
|
75
|
+
* Obtain via `GET /api/v1/agents/:id/public-key`.
|
|
76
|
+
*/
|
|
77
|
+
sendEncrypted(input: SendMessageInput, senderCrypto: AgentCrypto, recipientPubKey: string): Promise<ApiResponse<AgentMessage>>;
|
|
78
|
+
/**
|
|
79
|
+
* Decrypt an encrypted message received in the inbox.
|
|
80
|
+
* Call this when `message.body._e2e` is present.
|
|
81
|
+
*
|
|
82
|
+
* @param message - Message from `inbox()` or `get()`.
|
|
83
|
+
* @param recipientCrypto - The receiving agent's AgentCrypto instance.
|
|
84
|
+
* @returns Decrypted plaintext, sender pubkey, timestamp, and signature validity.
|
|
85
|
+
* @throws If the ciphertext is tampered or the message is not encrypted.
|
|
86
|
+
*/
|
|
87
|
+
static decryptReceived(message: AgentMessage, recipientCrypto: AgentCrypto): Promise<E2EDecryptResult>;
|
|
64
88
|
}
|
|
65
89
|
//# sourceMappingURL=messages.d.ts.map
|
package/dist/messages.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../src/messages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../src/messages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,KAAK,EAAE,WAAW,EAAqB,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAClF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C,MAAM,WAAW,gBAAgB;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,WAAW,CAAA;IAC9C,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC7B,QAAQ,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,CAAA;IAC/C,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACnC;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAA;IACV,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,IAAI,EAAE,MAAM,CAAC,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,EAAE,CAAC,CAAC;IAUjE,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;IAI1D,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;IAI/D,SAAS,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC;IAI3E,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAS3E;;;;;;;;;;;OAWG;IACG,aAAa,CACjB,KAAK,EAAE,gBAAgB,EACvB,YAAY,EAAE,WAAW,EACzB,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;IAQrC;;;;;;;;OAQG;WACU,eAAe,CAC1B,OAAO,EAAE,YAAY,EACrB,eAAe,EAAE,WAAW,GAC3B,OAAO,CAAC,gBAAgB,CAAC;CAO7B"}
|
package/dist/messages.js
CHANGED
|
@@ -32,5 +32,40 @@ export class MessagesClient {
|
|
|
32
32
|
async unsubscribe(topic) {
|
|
33
33
|
return this.client.request('DELETE', '/api/v1/messages/subscribe', undefined, { topic });
|
|
34
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Send an end-to-end encrypted message to a recipient agent.
|
|
37
|
+
*
|
|
38
|
+
* The plaintext `body` is encrypted client-side using ECIES (abba-e2e-v1)
|
|
39
|
+
* and sent as `{ _e2e: EncryptedEnvelope }`. The platform never sees the
|
|
40
|
+
* plaintext — it relays the envelope as opaque JSON.
|
|
41
|
+
*
|
|
42
|
+
* @param input - Message parameters (same as `send()`). `body` is the plaintext.
|
|
43
|
+
* @param senderCrypto - The sending agent's AgentCrypto instance (holds private key).
|
|
44
|
+
* @param recipientPubKey - Recipient's compressed secp256k1 public key, hex (33 bytes).
|
|
45
|
+
* Obtain via `GET /api/v1/agents/:id/public-key`.
|
|
46
|
+
*/
|
|
47
|
+
async sendEncrypted(input, senderCrypto, recipientPubKey) {
|
|
48
|
+
const envelope = await senderCrypto.encryptFor(input.body, recipientPubKey);
|
|
49
|
+
return this.client.request('POST', '/api/v1/messages', {
|
|
50
|
+
...input,
|
|
51
|
+
body: { _e2e: envelope },
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Decrypt an encrypted message received in the inbox.
|
|
56
|
+
* Call this when `message.body._e2e` is present.
|
|
57
|
+
*
|
|
58
|
+
* @param message - Message from `inbox()` or `get()`.
|
|
59
|
+
* @param recipientCrypto - The receiving agent's AgentCrypto instance.
|
|
60
|
+
* @returns Decrypted plaintext, sender pubkey, timestamp, and signature validity.
|
|
61
|
+
* @throws If the ciphertext is tampered or the message is not encrypted.
|
|
62
|
+
*/
|
|
63
|
+
static async decryptReceived(message, recipientCrypto) {
|
|
64
|
+
const envelope = message.body._e2e;
|
|
65
|
+
if (!envelope) {
|
|
66
|
+
throw new Error('Message body does not contain an _e2e envelope. Is this an encrypted message?');
|
|
67
|
+
}
|
|
68
|
+
return recipientCrypto.decrypt(envelope);
|
|
69
|
+
}
|
|
35
70
|
}
|
|
36
71
|
//# sourceMappingURL=messages.js.map
|
package/dist/messages.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../src/messages.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../src/messages.ts"],"names":[],"mappings":"AA2DA,MAAM,OAAO,cAAc;IACL;IAApB,YAAoB,MAAsB;QAAtB,WAAM,GAAN,MAAM,CAAgB;IAAG,CAAC;IAE9C,KAAK,CAAC,IAAI,CAAC,KAAuB;QAChC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAe,MAAM,EAAE,kBAAkB,EAAE,KAAK,CAAC,CAAA;IAC7E,CAAC;IAED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K,EAAE,CACV,CAAA;IACH,CAAC;IAED;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,aAAa,CACjB,KAAuB,EACvB,YAAyB,EACzB,eAAuB;QAEvB,MAAM,QAAQ,GAAG,MAAM,YAAY,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,EAAE,eAAe,CAAC,CAAA;QAC3E,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAe,MAAM,EAAE,kBAAkB,EAAE;YACnE,GAAG,KAAK;YACR,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;SACzB,CAAC,CAAA;IACJ,CAAC;IAED;;;;;;;;OAQG;IACH,MAAM,CAAC,KAAK,CAAC,eAAe,CAC1B,OAAqB,EACrB,eAA4B;QAE5B,MAAM,QAAQ,GAAI,OAAO,CAAC,IAAgC,CAAC,IAAqC,CAAA;QAChG,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,+EAA+E,CAAC,CAAA;QAClG,CAAC;QACD,OAAO,eAAe,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;IAC1C,CAAC;CACF"}
|
package/dist/register.d.ts
CHANGED
package/dist/register.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../src/register.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,KAAK,MAAM,EAAE,CAAA;IACzB,SAAS,EAAE,MAAM,CAAA;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,EAAE,MAAM,CAAA;IACnB,aAAa,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../src/register.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,KAAK,MAAM,EAAE,CAAA;IACzB,SAAS,EAAE,MAAM,CAAA;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,EAAE,MAAM,CAAA;IACnB,aAAa,EAAE,MAAM,CAAA;CACtB;AAOD;;;;;;GAMG;AACH,wBAAsB,QAAQ,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CA+C7E"}
|
package/dist/register.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { privateKeyToAccount } from 'viem/accounts';
|
|
2
2
|
const DEFAULT_BASE_URL = 'https://abbababa.com';
|
|
3
|
-
const MESSAGE_PREFIX = 'Register
|
|
3
|
+
const MESSAGE_PREFIX = 'Register Abba Baba Agent';
|
|
4
4
|
function buildRegisterMessage(walletAddress) {
|
|
5
5
|
const timestamp = Math.floor(Date.now() / 1000);
|
|
6
6
|
return `${MESSAGE_PREFIX}\nWallet: ${walletAddress}\nTimestamp: ${timestamp}`;
|
|
@@ -18,10 +18,10 @@ export async function register(opts) {
|
|
|
18
18
|
const account = privateKeyToAccount(privateKey);
|
|
19
19
|
const message = buildRegisterMessage(account.address);
|
|
20
20
|
const signature = await account.signMessage({ message });
|
|
21
|
-
const response = await fetch(`${baseUrl}/api/v1/
|
|
21
|
+
const response = await fetch(`${baseUrl}/api/v1/agents/register`, {
|
|
22
22
|
method: 'POST',
|
|
23
23
|
headers: { 'Content-Type': 'application/json' },
|
|
24
|
-
body: JSON.stringify({ message, signature, agentName, agentDescription }),
|
|
24
|
+
body: JSON.stringify({ walletAddress: account.address, message, signature, agentName, agentDescription }),
|
|
25
25
|
});
|
|
26
26
|
const json = (await response.json());
|
|
27
27
|
if (!response.ok) {
|
|
@@ -46,7 +46,6 @@ export async function register(opts) {
|
|
|
46
46
|
agentId: json.agentId,
|
|
47
47
|
developerId: json.developerId,
|
|
48
48
|
walletAddress: json.walletAddress,
|
|
49
|
-
publicKey: json.publicKey,
|
|
50
49
|
};
|
|
51
50
|
}
|
|
52
51
|
//# sourceMappingURL=register.js.map
|
package/dist/register.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.js","sourceRoot":"","sources":["../src/register.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAEnD,MAAM,gBAAgB,GAAG,sBAAsB,CAAA;AAC/C,MAAM,cAAc,GAAG,0BAA0B,CAAA;
|
|
1
|
+
{"version":3,"file":"register.js","sourceRoot":"","sources":["../src/register.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAEnD,MAAM,gBAAgB,GAAG,sBAAsB,CAAA;AAC/C,MAAM,cAAc,GAAG,0BAA0B,CAAA;AAgBjD,SAAS,oBAAoB,CAAC,aAAqB;IACjD,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAA;IAC/C,OAAO,GAAG,cAAc,aAAa,aAAa,gBAAgB,SAAS,EAAE,CAAA;AAC/E,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,IAAqB;IAClD,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,gBAAgB,EAAE,GAAG,IAAI,CAAA;IACxD,MAAM,OAAO,GAAG,CAAC,IAAI,CAAC,OAAO,IAAI,gBAAgB,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;IAEtE,MAAM,OAAO,GAAG,mBAAmB,CAAC,UAAU,CAAC,CAAA;IAC/C,MAAM,OAAO,GAAG,oBAAoB,CAAC,OAAO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,OAAQ;QACtB,WAAW,EAAE,IAAI,CAAC,WAAY;QAC9B,aAAa,EAAE,IAAI,CAAC,aAAc;KACnC,CAAA;AACH,CAAC"}
|
package/dist/seller.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { AbbaBabaClient } from './client.js';
|
|
2
|
+
import { AgentCrypto } from './crypto.js';
|
|
3
|
+
import type { AbbaBabaConfig, CreateServiceInput, Service, Transaction, PollOptions, ApiResponse, AgentStats, E2EDecryptResult, SessionInfo } from './types.js';
|
|
3
4
|
export declare class SellerAgent {
|
|
4
|
-
readonly client:
|
|
5
|
+
readonly client: AbbaBabaClient;
|
|
5
6
|
private running;
|
|
6
7
|
private walletAddress;
|
|
7
|
-
private
|
|
8
|
-
private
|
|
9
|
-
constructor(config:
|
|
8
|
+
private walletClient;
|
|
9
|
+
private _crypto;
|
|
10
|
+
constructor(config: AbbaBabaConfig);
|
|
10
11
|
/** Register a service on the marketplace. */
|
|
11
12
|
listService(input: CreateServiceInput): Promise<Service>;
|
|
12
13
|
/**
|
|
@@ -15,34 +16,113 @@ export declare class SellerAgent {
|
|
|
15
16
|
* Tracks seen transaction IDs to avoid yielding duplicates.
|
|
16
17
|
*/
|
|
17
18
|
pollForPurchases(options?: PollOptions): AsyncGenerator<Transaction>;
|
|
19
|
+
/**
|
|
20
|
+
* Initialize a plain EOA wallet for on-chain delivery signing.
|
|
21
|
+
* The agent pays their own gas (~$0.02/tx on Base Sepolia).
|
|
22
|
+
*
|
|
23
|
+
* @param privateKey - 32-byte hex private key (0x-prefixed)
|
|
24
|
+
* @param chain - Target chain (default: 'baseSepolia')
|
|
25
|
+
*/
|
|
26
|
+
initEOAWallet(privateKey: string, chain?: 'baseSepolia' | 'base' | 'polygon' | 'polygonAmoy'): Promise<string>;
|
|
18
27
|
/** Deliver results for a transaction via the API. */
|
|
19
28
|
deliver(transactionId: string, responsePayload: unknown): Promise<ApiResponse<Transaction>>;
|
|
20
29
|
/**
|
|
21
|
-
* Submit delivery proof on-chain
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
30
|
+
* Submit delivery proof on-chain. Seller signs directly — no platform relay.
|
|
31
|
+
* Call this after deliver() to commit the proof hash to the escrow contract.
|
|
32
|
+
* Requires initEOAWallet() to have been called first.
|
|
33
|
+
*
|
|
34
|
+
* @param proofHash - keccak256 hash of the delivery proof (0x-prefixed)
|
|
25
35
|
*/
|
|
26
|
-
submitDelivery(transactionId: string, proofHash: `0x${string}
|
|
36
|
+
submitDelivery(transactionId: string, proofHash: `0x${string}`): Promise<string>;
|
|
27
37
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
38
|
+
* Get own on-chain reputation score.
|
|
39
|
+
* Does not require a wallet — read-only.
|
|
30
40
|
*/
|
|
31
|
-
|
|
41
|
+
getAgentScore(agentAddress?: string): Promise<AgentStats>;
|
|
32
42
|
/**
|
|
33
|
-
*
|
|
34
|
-
*
|
|
43
|
+
* Decrypt an encrypted `requestPayload` from an incoming transaction.
|
|
44
|
+
*
|
|
45
|
+
* When a buyer used `purchaseEncrypted()`, the `requestPayload` field contains
|
|
46
|
+
* `{ _e2e: EncryptedEnvelope }`. Call this to recover the plaintext job spec.
|
|
47
|
+
* Also verifies the buyer's ECDSA signature — reject if `result.verified` is false.
|
|
48
|
+
*
|
|
49
|
+
* Requires `initCrypto()` to have been called first.
|
|
35
50
|
*/
|
|
36
|
-
|
|
51
|
+
decryptRequestPayload(transaction: Transaction): Promise<E2EDecryptResult>;
|
|
37
52
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
53
|
+
* Deliver results with an encrypted `responsePayload`.
|
|
54
|
+
*
|
|
55
|
+
* Fetches the buyer agent's E2E public key, encrypts `responsePayload` client-side,
|
|
56
|
+
* then calls the deliver endpoint. The platform stores `{ _e2e: EncryptedEnvelope }` —
|
|
57
|
+
* only the buyer can decrypt the result with `decryptResponsePayload()`.
|
|
58
|
+
*
|
|
59
|
+
* Requires `initCrypto()` to have been called first.
|
|
60
|
+
*
|
|
61
|
+
* @param transactionId - Transaction to deliver.
|
|
62
|
+
* @param responsePayload - Plaintext result object to encrypt.
|
|
63
|
+
* @param buyerAgentId - The buyer's agent ID. Their E2E public key is fetched automatically.
|
|
40
64
|
*/
|
|
41
|
-
|
|
65
|
+
deliverEncrypted(transactionId: string, responsePayload: Record<string, unknown>, buyerAgentId: string): Promise<ApiResponse<Transaction>>;
|
|
66
|
+
/**
|
|
67
|
+
* Disclose the encrypted `responsePayload` as dispute evidence.
|
|
68
|
+
*
|
|
69
|
+
* Verifies the plaintext against the stored attestation hash, then submits it as
|
|
70
|
+
* `decrypted_payload` evidence so the resolver can inspect actual content.
|
|
71
|
+
*
|
|
72
|
+
* Requires `initCrypto()` to have been called first.
|
|
73
|
+
*
|
|
74
|
+
* @param transactionId - The disputed transaction.
|
|
75
|
+
* @param originalPayload - The same plaintext object that was passed to `deliverEncrypted()`.
|
|
76
|
+
* @throws If hash verification fails (plaintext does not match stored attestation).
|
|
77
|
+
*/
|
|
78
|
+
submitPayloadEvidence(transactionId: string, originalPayload: Record<string, unknown>): Promise<ApiResponse<{
|
|
79
|
+
evidenceId: string;
|
|
80
|
+
}>>;
|
|
81
|
+
/**
|
|
82
|
+
* Create a session bundle for a seller — purely local, no platform API call.
|
|
83
|
+
*
|
|
84
|
+
* Generates an ephemeral EOA wallet and E2E keypair for use in a delegated
|
|
85
|
+
* seller agent process. No budget or allowedServices concept for sellers.
|
|
86
|
+
*
|
|
87
|
+
* Seller sessions are used to delegate delivery signing to an untrusted
|
|
88
|
+
* process without exposing the main seller private key.
|
|
89
|
+
*
|
|
90
|
+
* @param opts.expiry - Session lifetime in seconds (default: 3600).
|
|
91
|
+
* @returns SessionInfo with a `serialize()` method for the bundle string.
|
|
92
|
+
*/
|
|
93
|
+
createSession(opts?: {
|
|
94
|
+
expiry?: number;
|
|
95
|
+
}): Promise<Pick<SessionInfo, 'expiry' | 'walletAddress' | 'e2ePublicKey'> & {
|
|
96
|
+
serialize(): string;
|
|
97
|
+
}>;
|
|
98
|
+
/**
|
|
99
|
+
* Initialize this seller agent from a serialized session bundle.
|
|
100
|
+
*
|
|
101
|
+
* Sets the session EOA wallet (for on-chain delivery signing) and E2E crypto
|
|
102
|
+
* keypair (for `decryptRequestPayload` / `deliverEncrypted`).
|
|
103
|
+
*
|
|
104
|
+
* Call this instead of `initEOAWallet()` + `initCrypto()` when operating
|
|
105
|
+
* as a delegated session seller.
|
|
106
|
+
*
|
|
107
|
+
* @param serializedBundle - The string from `session.serialize()`.
|
|
108
|
+
*/
|
|
109
|
+
initWithSession(serializedBundle: string): Promise<void>;
|
|
42
110
|
/** Stop the polling loop. */
|
|
43
111
|
stop(): void;
|
|
44
112
|
getWalletAddress(): string | null;
|
|
45
|
-
/**
|
|
46
|
-
|
|
113
|
+
/**
|
|
114
|
+
* Initialize E2E encryption for this agent using a secp256k1 private key.
|
|
115
|
+
* After calling this, buyers can encrypt job payloads to your `crypto.publicKey`
|
|
116
|
+
* and you can decrypt them with `MessagesClient.decryptReceived(message, crypto)`.
|
|
117
|
+
*
|
|
118
|
+
* @param privateKeyHex - 32-byte secp256k1 private key, hex string.
|
|
119
|
+
* Generate one with `AgentCrypto.generate()`.
|
|
120
|
+
*/
|
|
121
|
+
initCrypto(privateKeyHex: string): AgentCrypto;
|
|
122
|
+
/**
|
|
123
|
+
* The agent's E2E crypto context. `null` until `initCrypto()` is called.
|
|
124
|
+
* Share `crypto.publicKey` with buyers so they can address encrypted messages to you.
|
|
125
|
+
*/
|
|
126
|
+
get crypto(): AgentCrypto | null;
|
|
47
127
|
}
|
|
48
128
|
//# sourceMappingURL=seller.d.ts.map
|
package/dist/seller.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seller.d.ts","sourceRoot":"","sources":["../src/seller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"seller.d.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AC,gBAAgB,CAAC;IAahF;;;;;;;;;;;;OAYG;IACG,gBAAgB,CACpB,aAAa,EAAE,MAAM,EACrB,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACxC,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IAgBpC;;;;;;;;;;;OAWG;IACG,qBAAqB,CACzB,aAAa,EAAE,MAAM,EACrB,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACvC,OAAO,CAAC,WAAW,CAAC;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IA+B/C;;;;;;;;;;;OAWG;IACG,aAAa,CACjB,IAAI,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GACzB,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,GAAG,eAAe,GAAG,cAAc,CAAC,GAAG;QAAE,SAAS,IAAI,MAAM,CAAA;KAAE,CAAC;IA2BpG;;;;;;;;;;OAUG;IACG,eAAe,CAAC,gBAAgB,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAY9D,6BAA6B;IAC7B,IAAI,IAAI,IAAI;IAIZ,gBAAgB,IAAI,MAAM,GAAG,IAAI;IAIjC;;;;;;;OAOG;IACH,UAAU,CAAC,aAAa,EAAE,MAAM,GAAG,WAAW;IAK9C;;;OAGG;IACH,IAAI,MAAM,IAAI,WAAW,GAAG,IAAI,CAE/B;CACF"}
|
package/dist/seller.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AbbaBabaClient } from './client.js';
|
|
2
|
+
import { AgentCrypto, generateAttestation, verifyAttestation } from './crypto.js';
|
|
2
3
|
export class SellerAgent {
|
|
3
4
|
client;
|
|
4
5
|
running = false;
|
|
5
6
|
walletAddress = null;
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
walletClient = null;
|
|
8
|
+
_crypto = null;
|
|
8
9
|
constructor(config) {
|
|
9
|
-
this.client = new
|
|
10
|
+
this.client = new AbbaBabaClient(config);
|
|
10
11
|
}
|
|
11
12
|
/** Register a service on the marketplace. */
|
|
12
13
|
async listService(input) {
|
|
@@ -50,51 +51,38 @@ export class SellerAgent {
|
|
|
50
51
|
await sleep(interval);
|
|
51
52
|
}
|
|
52
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Initialize a plain EOA wallet for on-chain delivery signing.
|
|
56
|
+
* The agent pays their own gas (~$0.02/tx on Base Sepolia).
|
|
57
|
+
*
|
|
58
|
+
* @param privateKey - 32-byte hex private key (0x-prefixed)
|
|
59
|
+
* @param chain - Target chain (default: 'baseSepolia')
|
|
60
|
+
*/
|
|
61
|
+
async initEOAWallet(privateKey, chain) {
|
|
62
|
+
const { createEOAWallet } = await import('./wallet/eoa-wallet.js');
|
|
63
|
+
const result = await createEOAWallet({ privateKey, chain });
|
|
64
|
+
this.walletAddress = result.address;
|
|
65
|
+
this.walletClient = result.walletClient;
|
|
66
|
+
return result.address;
|
|
67
|
+
}
|
|
53
68
|
/** Deliver results for a transaction via the API. */
|
|
54
69
|
async deliver(transactionId, responsePayload) {
|
|
55
70
|
return this.client.transactions.deliver(transactionId, { responsePayload });
|
|
56
71
|
}
|
|
57
72
|
/**
|
|
58
|
-
* Submit delivery proof on-chain
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
73
|
+
* Submit delivery proof on-chain. Seller signs directly — no platform relay.
|
|
74
|
+
* Call this after deliver() to commit the proof hash to the escrow contract.
|
|
75
|
+
* Requires initEOAWallet() to have been called first.
|
|
76
|
+
*
|
|
77
|
+
* @param proofHash - keccak256 hash of the delivery proof (0x-prefixed)
|
|
62
78
|
*/
|
|
63
|
-
async submitDelivery(transactionId, proofHash
|
|
64
|
-
if (!this.
|
|
65
|
-
throw new Error('Wallet not initialized. Call
|
|
79
|
+
async submitDelivery(transactionId, proofHash) {
|
|
80
|
+
if (!this.walletClient) {
|
|
81
|
+
throw new Error('Wallet not initialized. Call initEOAWallet() first.');
|
|
66
82
|
}
|
|
67
83
|
const { EscrowClient } = await import('./wallet/escrow.js');
|
|
68
|
-
const escrow = new EscrowClient(this.
|
|
69
|
-
|
|
70
|
-
if (responsePayload !== undefined) {
|
|
71
|
-
await this.client.transactions.deliver(transactionId, { responsePayload });
|
|
72
|
-
}
|
|
73
|
-
return txHash;
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Initialize a ZeroDev smart account for on-chain operations.
|
|
77
|
-
* Requires @zerodev/sdk, @zerodev/ecdsa-validator, and permissionless as peer deps.
|
|
78
|
-
*/
|
|
79
|
-
async initWallet(config) {
|
|
80
|
-
const { createSmartAccount } = await import('./wallet/smart-account.js');
|
|
81
|
-
const result = await createSmartAccount(config);
|
|
82
|
-
this.walletAddress = result.address;
|
|
83
|
-
this.kernelClient = result.kernelClient;
|
|
84
|
-
this.resolvedGasStrategy = result.gasStrategy;
|
|
85
|
-
return result.address;
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Initialize wallet from a serialized session key (agent operation).
|
|
89
|
-
* No owner private key needed — only the serialized session key string.
|
|
90
|
-
*/
|
|
91
|
-
async initWithSessionKey(config) {
|
|
92
|
-
const { useSessionKey } = await import('./wallet/session-keys.js');
|
|
93
|
-
const result = await useSessionKey(config);
|
|
94
|
-
this.walletAddress = result.address;
|
|
95
|
-
this.kernelClient = result.kernelClient;
|
|
96
|
-
this.resolvedGasStrategy = result.gasStrategy;
|
|
97
|
-
return result.address;
|
|
84
|
+
const escrow = new EscrowClient(this.walletClient);
|
|
85
|
+
return escrow.submitDelivery(transactionId, proofHash);
|
|
98
86
|
}
|
|
99
87
|
/**
|
|
100
88
|
* Get own on-chain reputation score.
|
|
@@ -103,12 +91,154 @@ export class SellerAgent {
|
|
|
103
91
|
async getAgentScore(agentAddress) {
|
|
104
92
|
const address = agentAddress ?? this.walletAddress;
|
|
105
93
|
if (!address) {
|
|
106
|
-
throw new Error('No address. Provide agentAddress or call
|
|
94
|
+
throw new Error('No address. Provide agentAddress or call initEOAWallet() first.');
|
|
107
95
|
}
|
|
108
96
|
const { ScoreClient } = await import('./wallet/escrow.js');
|
|
109
97
|
const score = new ScoreClient();
|
|
110
98
|
return score.getAgentStats(address);
|
|
111
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* Decrypt an encrypted `requestPayload` from an incoming transaction.
|
|
102
|
+
*
|
|
103
|
+
* When a buyer used `purchaseEncrypted()`, the `requestPayload` field contains
|
|
104
|
+
* `{ _e2e: EncryptedEnvelope }`. Call this to recover the plaintext job spec.
|
|
105
|
+
* Also verifies the buyer's ECDSA signature — reject if `result.verified` is false.
|
|
106
|
+
*
|
|
107
|
+
* Requires `initCrypto()` to have been called first.
|
|
108
|
+
*/
|
|
109
|
+
async decryptRequestPayload(transaction) {
|
|
110
|
+
if (!this._crypto) {
|
|
111
|
+
throw new Error('E2E crypto not initialized. Call initCrypto() first.');
|
|
112
|
+
}
|
|
113
|
+
const payload = transaction.requestPayload;
|
|
114
|
+
if (!payload?._e2e) {
|
|
115
|
+
throw new Error('requestPayload does not contain an _e2e envelope. Was it sent with purchaseEncrypted()?');
|
|
116
|
+
}
|
|
117
|
+
return this._crypto.decrypt(payload._e2e);
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Deliver results with an encrypted `responsePayload`.
|
|
121
|
+
*
|
|
122
|
+
* Fetches the buyer agent's E2E public key, encrypts `responsePayload` client-side,
|
|
123
|
+
* then calls the deliver endpoint. The platform stores `{ _e2e: EncryptedEnvelope }` —
|
|
124
|
+
* only the buyer can decrypt the result with `decryptResponsePayload()`.
|
|
125
|
+
*
|
|
126
|
+
* Requires `initCrypto()` to have been called first.
|
|
127
|
+
*
|
|
128
|
+
* @param transactionId - Transaction to deliver.
|
|
129
|
+
* @param responsePayload - Plaintext result object to encrypt.
|
|
130
|
+
* @param buyerAgentId - The buyer's agent ID. Their E2E public key is fetched automatically.
|
|
131
|
+
*/
|
|
132
|
+
async deliverEncrypted(transactionId, responsePayload, buyerAgentId) {
|
|
133
|
+
if (!this._crypto) {
|
|
134
|
+
throw new Error('E2E crypto not initialized. Call initCrypto() first.');
|
|
135
|
+
}
|
|
136
|
+
const keyRes = await this.client.agents.getE2EPublicKey(buyerAgentId);
|
|
137
|
+
if (!keyRes.success || !keyRes.data) {
|
|
138
|
+
throw new Error(keyRes.error ?? 'Could not fetch buyer E2E public key');
|
|
139
|
+
}
|
|
140
|
+
const buyerPubKey = keyRes.data.publicKey;
|
|
141
|
+
const attestation = generateAttestation(responsePayload);
|
|
142
|
+
const envelope = await this._crypto.encryptFor(responsePayload, buyerPubKey);
|
|
143
|
+
return this.client.transactions.deliver(transactionId, {
|
|
144
|
+
responsePayload: { _e2e: envelope, attestation },
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Disclose the encrypted `responsePayload` as dispute evidence.
|
|
149
|
+
*
|
|
150
|
+
* Verifies the plaintext against the stored attestation hash, then submits it as
|
|
151
|
+
* `decrypted_payload` evidence so the resolver can inspect actual content.
|
|
152
|
+
*
|
|
153
|
+
* Requires `initCrypto()` to have been called first.
|
|
154
|
+
*
|
|
155
|
+
* @param transactionId - The disputed transaction.
|
|
156
|
+
* @param originalPayload - The same plaintext object that was passed to `deliverEncrypted()`.
|
|
157
|
+
* @throws If hash verification fails (plaintext does not match stored attestation).
|
|
158
|
+
*/
|
|
159
|
+
async submitPayloadEvidence(transactionId, originalPayload) {
|
|
160
|
+
const txRes = await this.client.transactions.get(transactionId);
|
|
161
|
+
if (!txRes.success || !txRes.data) {
|
|
162
|
+
throw new Error(txRes.error ?? 'Could not fetch transaction');
|
|
163
|
+
}
|
|
164
|
+
const rp = txRes.data.responsePayload;
|
|
165
|
+
const attestation = rp?.attestation;
|
|
166
|
+
if (!attestation) {
|
|
167
|
+
throw new Error('No attestation found in responsePayload. Was deliverEncrypted() used?');
|
|
168
|
+
}
|
|
169
|
+
const hashVerified = verifyAttestation(originalPayload, attestation);
|
|
170
|
+
if (!hashVerified) {
|
|
171
|
+
throw new Error('Hash verification failed: originalPayload does not match stored attestation hash');
|
|
172
|
+
}
|
|
173
|
+
const sections = Object.keys(originalPayload);
|
|
174
|
+
return this.client.transactions.submitEvidence(transactionId, {
|
|
175
|
+
evidenceType: 'decrypted_payload',
|
|
176
|
+
description: `Seller discloses encrypted responsePayload. Hash verified: ${hashVerified}. Sections: ${sections.join(', ')}`,
|
|
177
|
+
contentHash: attestation.hash,
|
|
178
|
+
metadata: {
|
|
179
|
+
role: 'seller',
|
|
180
|
+
payload: originalPayload,
|
|
181
|
+
senderVerified: true,
|
|
182
|
+
attestationHash: attestation.hash,
|
|
183
|
+
},
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Create a session bundle for a seller — purely local, no platform API call.
|
|
188
|
+
*
|
|
189
|
+
* Generates an ephemeral EOA wallet and E2E keypair for use in a delegated
|
|
190
|
+
* seller agent process. No budget or allowedServices concept for sellers.
|
|
191
|
+
*
|
|
192
|
+
* Seller sessions are used to delegate delivery signing to an untrusted
|
|
193
|
+
* process without exposing the main seller private key.
|
|
194
|
+
*
|
|
195
|
+
* @param opts.expiry - Session lifetime in seconds (default: 3600).
|
|
196
|
+
* @returns SessionInfo with a `serialize()` method for the bundle string.
|
|
197
|
+
*/
|
|
198
|
+
async createSession(opts) {
|
|
199
|
+
const { generateSessionWallet, generateE2EKeypair, SessionBundle } = await import('./wallet/session-key.js');
|
|
200
|
+
const wallet = generateSessionWallet();
|
|
201
|
+
const e2eKeypair = generateE2EKeypair();
|
|
202
|
+
const expirySecs = opts?.expiry ?? 3600;
|
|
203
|
+
const expiryTs = Math.floor(Date.now() / 1000) + expirySecs;
|
|
204
|
+
const bundlePayload = {
|
|
205
|
+
token: '', // seller sessions don't have a platform token
|
|
206
|
+
agentId: '',
|
|
207
|
+
budgetUsdc: null,
|
|
208
|
+
expiry: expiryTs,
|
|
209
|
+
walletPrivateKey: wallet.privateKey,
|
|
210
|
+
walletAddress: wallet.address,
|
|
211
|
+
e2ePrivateKey: e2eKeypair.privateKey,
|
|
212
|
+
e2ePublicKey: e2eKeypair.publicKey,
|
|
213
|
+
};
|
|
214
|
+
const serialized = SessionBundle.serialize(bundlePayload);
|
|
215
|
+
return {
|
|
216
|
+
expiry: expiryTs,
|
|
217
|
+
walletAddress: wallet.address,
|
|
218
|
+
e2ePublicKey: e2eKeypair.publicKey,
|
|
219
|
+
serialize: () => serialized,
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Initialize this seller agent from a serialized session bundle.
|
|
224
|
+
*
|
|
225
|
+
* Sets the session EOA wallet (for on-chain delivery signing) and E2E crypto
|
|
226
|
+
* keypair (for `decryptRequestPayload` / `deliverEncrypted`).
|
|
227
|
+
*
|
|
228
|
+
* Call this instead of `initEOAWallet()` + `initCrypto()` when operating
|
|
229
|
+
* as a delegated session seller.
|
|
230
|
+
*
|
|
231
|
+
* @param serializedBundle - The string from `session.serialize()`.
|
|
232
|
+
*/
|
|
233
|
+
async initWithSession(serializedBundle) {
|
|
234
|
+
const { SessionBundle } = await import('./wallet/session-key.js');
|
|
235
|
+
const payload = SessionBundle.deserialize(serializedBundle);
|
|
236
|
+
if (payload.expiry < Math.floor(Date.now() / 1000)) {
|
|
237
|
+
throw new Error('Session bundle has expired. Request a new session from the operator.');
|
|
238
|
+
}
|
|
239
|
+
await this.initEOAWallet(payload.walletPrivateKey);
|
|
240
|
+
this.initCrypto(payload.e2ePrivateKey);
|
|
241
|
+
}
|
|
112
242
|
/** Stop the polling loop. */
|
|
113
243
|
stop() {
|
|
114
244
|
this.running = false;
|
|
@@ -116,9 +246,24 @@ export class SellerAgent {
|
|
|
116
246
|
getWalletAddress() {
|
|
117
247
|
return this.walletAddress;
|
|
118
248
|
}
|
|
119
|
-
/**
|
|
120
|
-
|
|
121
|
-
|
|
249
|
+
/**
|
|
250
|
+
* Initialize E2E encryption for this agent using a secp256k1 private key.
|
|
251
|
+
* After calling this, buyers can encrypt job payloads to your `crypto.publicKey`
|
|
252
|
+
* and you can decrypt them with `MessagesClient.decryptReceived(message, crypto)`.
|
|
253
|
+
*
|
|
254
|
+
* @param privateKeyHex - 32-byte secp256k1 private key, hex string.
|
|
255
|
+
* Generate one with `AgentCrypto.generate()`.
|
|
256
|
+
*/
|
|
257
|
+
initCrypto(privateKeyHex) {
|
|
258
|
+
this._crypto = AgentCrypto.fromPrivateKey(privateKeyHex);
|
|
259
|
+
return this._crypto;
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* The agent's E2E crypto context. `null` until `initCrypto()` is called.
|
|
263
|
+
* Share `crypto.publicKey` with buyers so they can address encrypted messages to you.
|
|
264
|
+
*/
|
|
265
|
+
get crypto() {
|
|
266
|
+
return this._crypto;
|
|
122
267
|
}
|
|
123
268
|
}
|
|
124
269
|
function sleep(ms) {
|
package/dist/seller.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seller.js","sourceRoot":"","sources":["../src/seller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"seller.js","sourceRoot":"","sources":["../src/seller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAE5C,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAejF,MAAM,OAAO,WAAW;IACN,MAAM,CAAgB;IAC9B,OAAO,GAAG,KAAK,CAAA;IACf,aAAa,GAAkB,IAAI,CAAA;IACnC,YAAY,GAAwB,IAAI,CAAA;IACxC,OAAO,GAAuB,IAAI,CAAA;IAE1C,YAAY,MAAsB;QAChC,IAAI,CAAC,MAAM,GAAG,IAAI,cAAc,CAAC,MAAM,CAAC,CAAA;IAC1C,CAAC;IAED,6CAA6C;IAC7C,KAAK,CAAC,WAAW,CA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