@blindmarket/sdk 0.1.4
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 +72 -0
- package/biome.json +19 -0
- package/dist/BlindEscrowClient-CyPuKMge.d.cts +54 -0
- package/dist/BlindEscrowClient-R7iGpE-n.d.ts +54 -0
- package/dist/KeyStore-Be_SSpCt.d.cts +21 -0
- package/dist/KeyStore-k1JgYPJY.d.ts +21 -0
- package/dist/Signer-BnqH_qew.d.cts +38 -0
- package/dist/Signer-LColE0Uo.d.ts +38 -0
- package/dist/Storage-4QOrh7rm.d.ts +17 -0
- package/dist/Storage-Cf4IJRMk.d.cts +17 -0
- package/dist/TaskRegistryClient-Ch6lYqM_.d.ts +24 -0
- package/dist/TaskRegistryClient-CrQjddDc.d.cts +24 -0
- package/dist/aes-J-7HrHze.d.cts +17 -0
- package/dist/aes-J-7HrHze.d.ts +17 -0
- package/dist/agent/Agent.d.ts +59 -0
- package/dist/agent/Agent.js +73 -0
- package/dist/agent/index.cjs +425 -0
- package/dist/agent/index.cjs.map +1 -0
- package/dist/agent/index.d.cts +63 -0
- package/dist/agent/index.d.ts +1 -0
- package/dist/agent/index.js +1 -0
- package/dist/agent/index.js.map +1 -0
- package/dist/api/index.cjs +4 -0
- package/dist/api/index.cjs.map +1 -0
- package/dist/api/index.d.cts +2 -0
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +1 -0
- package/dist/api/index.js.map +1 -0
- package/dist/chain/BlindEscrowClient.d.ts +51 -0
- package/dist/chain/BlindEscrowClient.js +142 -0
- package/dist/chain/BlindReputationClient.d.ts +16 -0
- package/dist/chain/BlindReputationClient.js +45 -0
- package/dist/chain/ChainClient.d.ts +26 -0
- package/dist/chain/ChainClient.js +46 -0
- package/dist/chain/TaskRegistryClient.d.ts +21 -0
- package/dist/chain/TaskRegistryClient.js +70 -0
- package/dist/chain/abi/BlindEscrow.json +1113 -0
- package/dist/chain/abi/BlindReputation.json +447 -0
- package/dist/chain/abi/TaskRegistry.json +586 -0
- package/dist/chain/abi/index.d.ts +4 -0
- package/dist/chain/abi/index.js +4 -0
- package/dist/chain/errors.d.ts +8 -0
- package/dist/chain/errors.js +32 -0
- package/dist/chain/index.cjs +2484 -0
- package/dist/chain/index.cjs.map +1 -0
- package/dist/chain/index.d.cts +2305 -0
- package/dist/chain/index.d.ts +6 -0
- package/dist/chain/index.js +6 -0
- package/dist/chain/index.js.map +1 -0
- package/dist/compute/index.cjs +4 -0
- package/dist/compute/index.cjs.map +1 -0
- package/dist/compute/index.d.cts +2 -0
- package/dist/compute/index.d.ts +1 -0
- package/dist/compute/index.js +1 -0
- package/dist/compute/index.js.map +1 -0
- package/dist/crypto/aes.d.ts +15 -0
- package/dist/crypto/aes.js +81 -0
- package/dist/crypto/constants.d.ts +7 -0
- package/dist/crypto/constants.js +7 -0
- package/dist/crypto/ecies.d.ts +8 -0
- package/dist/crypto/ecies.js +51 -0
- package/dist/crypto/envelope.d.ts +35 -0
- package/dist/crypto/envelope.js +103 -0
- package/dist/crypto/hkdf.d.ts +5 -0
- package/dist/crypto/hkdf.js +34 -0
- package/dist/crypto/index.cjs +424 -0
- package/dist/crypto/index.cjs.map +1 -0
- package/dist/crypto/index.d.cts +74 -0
- package/dist/crypto/index.d.ts +6 -0
- package/dist/crypto/index.js +6 -0
- package/dist/crypto/index.js.map +1 -0
- package/dist/crypto/keys.d.ts +12 -0
- package/dist/crypto/keys.js +42 -0
- package/dist/errors/BlindBountyError.d.ts +14 -0
- package/dist/errors/BlindBountyError.js +30 -0
- package/dist/errors/codes.d.ts +19 -0
- package/dist/errors/codes.js +48 -0
- package/dist/errors/index.cjs +136 -0
- package/dist/errors/index.cjs.map +1 -0
- package/dist/errors/index.d.cts +60 -0
- package/dist/errors/index.d.ts +3 -0
- package/dist/errors/index.js +3 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/errors/subclasses.d.ts +26 -0
- package/dist/errors/subclasses.js +41 -0
- package/dist/events/EventBus.d.ts +13 -0
- package/dist/events/EventBus.js +41 -0
- package/dist/events/index.cjs +41 -0
- package/dist/events/index.cjs.map +1 -0
- package/dist/events/index.d.cts +61 -0
- package/dist/events/index.d.ts +2 -0
- package/dist/events/index.js +2 -0
- package/dist/events/index.js.map +1 -0
- package/dist/events/types.d.ts +45 -0
- package/dist/events/types.js +1 -0
- package/dist/index.cjs +4 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +129 -0
- package/dist/index.js +154 -0
- package/dist/index.js.map +1 -0
- package/dist/keystore/InMemoryKeyStore.d.ts +21 -0
- package/dist/keystore/InMemoryKeyStore.js +111 -0
- package/dist/keystore/KeyStore.d.ts +18 -0
- package/dist/keystore/KeyStore.js +1 -0
- package/dist/keystore/index.cjs +335 -0
- package/dist/keystore/index.cjs.map +1 -0
- package/dist/keystore/index.d.cts +23 -0
- package/dist/keystore/index.d.ts +2 -0
- package/dist/keystore/index.js +2 -0
- package/dist/keystore/index.js.map +1 -0
- package/dist/network/index.cjs +74 -0
- package/dist/network/index.cjs.map +1 -0
- package/dist/network/index.d.cts +36 -0
- package/dist/network/index.d.ts +3 -0
- package/dist/network/index.js +3 -0
- package/dist/network/index.js.map +1 -0
- package/dist/network/presets.d.ts +24 -0
- package/dist/network/presets.js +23 -0
- package/dist/network/resolve.d.ts +7 -0
- package/dist/network/resolve.js +17 -0
- package/dist/network/types.d.ts +16 -0
- package/dist/network/types.js +1 -0
- package/dist/signer/EthersSigner.d.ts +24 -0
- package/dist/signer/EthersSigner.js +68 -0
- package/dist/signer/PrivateKeySigner.d.ts +14 -0
- package/dist/signer/PrivateKeySigner.js +18 -0
- package/dist/signer/Signer.d.ts +35 -0
- package/dist/signer/Signer.js +1 -0
- package/dist/signer/index.cjs +121 -0
- package/dist/signer/index.cjs.map +1 -0
- package/dist/signer/index.d.cts +40 -0
- package/dist/signer/index.d.ts +3 -0
- package/dist/signer/index.js +3 -0
- package/dist/signer/index.js.map +1 -0
- package/dist/storage/MemoryStorage.d.ts +18 -0
- package/dist/storage/MemoryStorage.js +40 -0
- package/dist/storage/Storage.d.ts +14 -0
- package/dist/storage/Storage.js +1 -0
- package/dist/storage/ZgStorage.d.ts +24 -0
- package/dist/storage/ZgStorage.js +102 -0
- package/dist/storage/index.cjs +221 -0
- package/dist/storage/index.cjs.map +1 -0
- package/dist/storage/index.d.cts +44 -0
- package/dist/storage/index.d.ts +3 -0
- package/dist/storage/index.js +3 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/testing/index.cjs +4 -0
- package/dist/testing/index.cjs.map +1 -0
- package/dist/testing/index.d.cts +2 -0
- package/dist/testing/index.d.ts +1 -0
- package/dist/testing/index.js +1 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/types-BOG5Ub1z.d.cts +31 -0
- package/dist/types-BOG5Ub1z.d.ts +31 -0
- package/dist/types-V7_ZmUb-.d.cts +19 -0
- package/dist/types-hAsITUQ7.d.ts +19 -0
- package/dist/types.d.ts +58 -0
- package/dist/types.js +1 -0
- package/dist/verifier/index.cjs +4 -0
- package/dist/verifier/index.cjs.map +1 -0
- package/dist/verifier/index.d.cts +2 -0
- package/dist/verifier/index.d.ts +1 -0
- package/dist/verifier/index.js +1 -0
- package/dist/verifier/index.js.map +1 -0
- package/dist/worker/Worker.d.ts +53 -0
- package/dist/worker/Worker.js +53 -0
- package/dist/worker/index.cjs +382 -0
- package/dist/worker/index.cjs.map +1 -0
- package/dist/worker/index.d.cts +58 -0
- package/dist/worker/index.d.ts +1 -0
- package/dist/worker/index.js +1 -0
- package/dist/worker/index.js.map +1 -0
- package/examples/agent-demo.ts +121 -0
- package/package.json +46 -0
- package/scripts/gen-crypto-fixtures.mjs +72 -0
- package/src/agent/Agent.ts +122 -0
- package/src/agent/index.ts +1 -0
- package/src/api/index.ts +1 -0
- package/src/chain/BlindEscrowClient.ts +182 -0
- package/src/chain/BlindReputationClient.ts +55 -0
- package/src/chain/ChainClient.ts +59 -0
- package/src/chain/TaskRegistryClient.ts +82 -0
- package/src/chain/abi/BlindEscrow.json +1113 -0
- package/src/chain/abi/BlindReputation.json +447 -0
- package/src/chain/abi/TaskRegistry.json +586 -0
- package/src/chain/abi/index.ts +5 -0
- package/src/chain/errors.ts +43 -0
- package/src/chain/index.ts +6 -0
- package/src/compute/index.ts +1 -0
- package/src/crypto/aes.ts +104 -0
- package/src/crypto/constants.ts +7 -0
- package/src/crypto/ecies.ts +60 -0
- package/src/crypto/envelope.ts +131 -0
- package/src/crypto/hkdf.ts +45 -0
- package/src/crypto/index.ts +6 -0
- package/src/crypto/keys.ts +56 -0
- package/src/errors/BlindMarketError.ts +38 -0
- package/src/errors/codes.ts +67 -0
- package/src/errors/index.ts +3 -0
- package/src/errors/subclasses.ts +59 -0
- package/src/events/EventBus.ts +45 -0
- package/src/events/index.ts +2 -0
- package/src/events/types.ts +13 -0
- package/src/index.ts +222 -0
- package/src/keystore/InMemoryKeyStore.ts +146 -0
- package/src/keystore/KeyStore.ts +19 -0
- package/src/keystore/index.ts +2 -0
- package/src/network/index.ts +3 -0
- package/src/network/presets.ts +27 -0
- package/src/network/resolve.ts +19 -0
- package/src/network/types.ts +18 -0
- package/src/signer/EthersSigner.ts +82 -0
- package/src/signer/PrivateKeySigner.ts +19 -0
- package/src/signer/Signer.ts +40 -0
- package/src/signer/index.ts +3 -0
- package/src/storage/MemoryStorage.ts +49 -0
- package/src/storage/Storage.ts +15 -0
- package/src/storage/ZgStorage.ts +124 -0
- package/src/storage/index.ts +3 -0
- package/src/testing/index.ts +1 -0
- package/src/types.ts +76 -0
- package/src/verifier/index.ts +1 -0
- package/src/worker/Worker.ts +98 -0
- package/src/worker/index.ts +1 -0
- package/test/agent.test.ts +193 -0
- package/test/chain.test.ts +145 -0
- package/test/crypto.aes.test.ts +81 -0
- package/test/crypto.compat.test.ts +33 -0
- package/test/crypto.ecies.test.ts +64 -0
- package/test/envelope.test.ts +82 -0
- package/test/errors.test.ts +64 -0
- package/test/events.test.ts +59 -0
- package/test/fixtures/crypto.json +16 -0
- package/test/keystore.test.ts +103 -0
- package/test/network.test.ts +53 -0
- package/test/signer.test.ts +66 -0
- package/test/smoke.test.ts +7 -0
- package/test/storage.test.ts +55 -0
- package/test/worker.test.ts +181 -0
- package/tsconfig.build.json +1 -0
- package/tsconfig.json +13 -0
- package/tsup.config.ts +32 -0
- package/vitest.config.ts +17 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { BlindBountyError } from './BlindBountyError.js';
|
|
2
|
+
export class ConfigError extends BlindBountyError {
|
|
3
|
+
constructor(code, msg, opts) {
|
|
4
|
+
super(code, msg, opts);
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
export class CryptoError extends BlindBountyError {
|
|
8
|
+
constructor(code, msg, opts) {
|
|
9
|
+
super(code, msg, opts);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export class StorageError extends BlindBountyError {
|
|
13
|
+
constructor(code, msg, opts) {
|
|
14
|
+
super(code, msg, opts);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export class ChainError extends BlindBountyError {
|
|
18
|
+
constructor(code, msg, opts) {
|
|
19
|
+
super(code, msg, opts);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export class ComputeError extends BlindBountyError {
|
|
23
|
+
constructor(code, msg, opts) {
|
|
24
|
+
super(code, msg, opts);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export class ApiError extends BlindBountyError {
|
|
28
|
+
constructor(code, msg, opts) {
|
|
29
|
+
super(code, msg, opts);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export class LifecycleError extends BlindBountyError {
|
|
33
|
+
constructor(code, msg, opts) {
|
|
34
|
+
super(code, msg, opts);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export class TimeoutError extends BlindBountyError {
|
|
38
|
+
constructor(code, msg, opts) {
|
|
39
|
+
super(code, msg, opts);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
type Handler<T> = (payload: T) => void;
|
|
2
|
+
/**
|
|
3
|
+
* Typed pub/sub. Listener exceptions are swallowed so one bad subscriber
|
|
4
|
+
* cannot block others — telemetry plugins can observe failures via onError.
|
|
5
|
+
*/
|
|
6
|
+
export declare class EventBus<E> {
|
|
7
|
+
private handlers;
|
|
8
|
+
on<K extends keyof E>(event: K, fn: Handler<E[K]>): () => void;
|
|
9
|
+
once<K extends keyof E>(event: K, fn: Handler<E[K]>): () => void;
|
|
10
|
+
off<K extends keyof E>(event: K, fn: Handler<E[K]>): void;
|
|
11
|
+
emit<K extends keyof E>(event: K, payload: E[K]): void;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed pub/sub. Listener exceptions are swallowed so one bad subscriber
|
|
3
|
+
* cannot block others — telemetry plugins can observe failures via onError.
|
|
4
|
+
*/
|
|
5
|
+
export class EventBus {
|
|
6
|
+
handlers = {};
|
|
7
|
+
on(event, fn) {
|
|
8
|
+
let set = this.handlers[event];
|
|
9
|
+
if (!set) {
|
|
10
|
+
set = new Set();
|
|
11
|
+
this.handlers[event] = set;
|
|
12
|
+
}
|
|
13
|
+
set.add(fn);
|
|
14
|
+
return () => {
|
|
15
|
+
this.off(event, fn);
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
once(event, fn) {
|
|
19
|
+
const wrapped = (p) => {
|
|
20
|
+
this.off(event, wrapped);
|
|
21
|
+
fn(p);
|
|
22
|
+
};
|
|
23
|
+
return this.on(event, wrapped);
|
|
24
|
+
}
|
|
25
|
+
off(event, fn) {
|
|
26
|
+
this.handlers[event]?.delete(fn);
|
|
27
|
+
}
|
|
28
|
+
emit(event, payload) {
|
|
29
|
+
const hs = this.handlers[event];
|
|
30
|
+
if (!hs)
|
|
31
|
+
return;
|
|
32
|
+
for (const h of hs) {
|
|
33
|
+
try {
|
|
34
|
+
h(payload);
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
// Isolated per-listener — prevents one bad subscriber from blocking others.
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/events/EventBus.ts
|
|
4
|
+
var EventBus = class {
|
|
5
|
+
handlers = {};
|
|
6
|
+
on(event, fn) {
|
|
7
|
+
let set = this.handlers[event];
|
|
8
|
+
if (!set) {
|
|
9
|
+
set = /* @__PURE__ */ new Set();
|
|
10
|
+
this.handlers[event] = set;
|
|
11
|
+
}
|
|
12
|
+
set.add(fn);
|
|
13
|
+
return () => {
|
|
14
|
+
this.off(event, fn);
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
once(event, fn) {
|
|
18
|
+
const wrapped = (p) => {
|
|
19
|
+
this.off(event, wrapped);
|
|
20
|
+
fn(p);
|
|
21
|
+
};
|
|
22
|
+
return this.on(event, wrapped);
|
|
23
|
+
}
|
|
24
|
+
off(event, fn) {
|
|
25
|
+
this.handlers[event]?.delete(fn);
|
|
26
|
+
}
|
|
27
|
+
emit(event, payload) {
|
|
28
|
+
const hs = this.handlers[event];
|
|
29
|
+
if (!hs) return;
|
|
30
|
+
for (const h of hs) {
|
|
31
|
+
try {
|
|
32
|
+
h(payload);
|
|
33
|
+
} catch {
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
exports.EventBus = EventBus;
|
|
40
|
+
//# sourceMappingURL=index.cjs.map
|
|
41
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/events/EventBus.ts"],"names":[],"mappings":";;;AAMO,IAAM,WAAN,MAAkB;AAAA,EACf,WAAoD,EAAC;AAAA,EAE7D,EAAA,CAAsB,OAAU,EAAA,EAA+B;AAC7D,IAAA,IAAI,GAAA,GAAM,IAAA,CAAK,QAAA,CAAS,KAAK,CAAA;AAC7B,IAAA,IAAI,CAAC,GAAA,EAAK;AACR,MAAA,GAAA,uBAAU,GAAA,EAAmB;AAC7B,MAAA,IAAA,CAAK,QAAA,CAAS,KAAK,CAAA,GAAI,GAAA;AAAA,IACzB;AACA,IAAA,GAAA,CAAI,IAAI,EAAE,CAAA;AACV,IAAA,OAAO,MAAM;AACX,MAAA,IAAA,CAAK,GAAA,CAAI,OAAO,EAAE,CAAA;AAAA,IACpB,CAAA;AAAA,EACF;AAAA,EAEA,IAAA,CAAwB,OAAU,EAAA,EAA+B;AAC/D,IAAA,MAAM,OAAA,GAAyB,CAAC,CAAA,KAAM;AACpC,MAAA,IAAA,CAAK,GAAA,CAAI,OAAO,OAAO,CAAA;AACvB,MAAA,EAAA,CAAG,CAAC,CAAA;AAAA,IACN,CAAA;AACA,IAAA,OAAO,IAAA,CAAK,EAAA,CAAG,KAAA,EAAO,OAAO,CAAA;AAAA,EAC/B;AAAA,EAEA,GAAA,CAAuB,OAAU,EAAA,EAAyB;AACxD,IAAA,IAAA,CAAK,QAAA,CAAS,KAAK,CAAA,EAAG,MAAA,CAAO,EAAE,CAAA;AAAA,EACjC;AAAA,EAEA,IAAA,CAAwB,OAAU,OAAA,EAAqB;AACrD,IAAA,MAAM,EAAA,GAAK,IAAA,CAAK,QAAA,CAAS,KAAK,CAAA;AAC9B,IAAA,IAAI,CAAC,EAAA,EAAI;AACT,IAAA,KAAA,MAAW,KAAK,EAAA,EAAI;AAClB,MAAA,IAAI;AACF,QAAA,CAAA,CAAE,OAAO,CAAA;AAAA,MACX,CAAA,CAAA,MAAQ;AAAA,MAER;AAAA,IACF;AAAA,EACF;AACF","file":"index.cjs","sourcesContent":["type Handler<T> = (payload: T) => void;\n\n/**\n * Typed pub/sub. Listener exceptions are swallowed so one bad subscriber\n * cannot block others — telemetry plugins can observe failures via onError.\n */\nexport class EventBus<E> {\n private handlers: { [K in keyof E]?: Set<Handler<E[K]>> } = {};\n\n on<K extends keyof E>(event: K, fn: Handler<E[K]>): () => void {\n let set = this.handlers[event];\n if (!set) {\n set = new Set<Handler<E[K]>>();\n this.handlers[event] = set;\n }\n set.add(fn);\n return () => {\n this.off(event, fn);\n };\n }\n\n once<K extends keyof E>(event: K, fn: Handler<E[K]>): () => void {\n const wrapped: Handler<E[K]> = (p) => {\n this.off(event, wrapped);\n fn(p);\n };\n return this.on(event, wrapped);\n }\n\n off<K extends keyof E>(event: K, fn: Handler<E[K]>): void {\n this.handlers[event]?.delete(fn);\n }\n\n emit<K extends keyof E>(event: K, payload: E[K]): void {\n const hs = this.handlers[event];\n if (!hs) return;\n for (const h of hs) {\n try {\n h(payload);\n } catch {\n // Isolated per-listener — prevents one bad subscriber from blocking others.\n }\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { T as TaskId, H as Hex, d as RootHash, A as Address } from '../types-BOG5Ub1z.cjs';
|
|
2
|
+
|
|
3
|
+
type Handler<T> = (payload: T) => void;
|
|
4
|
+
/**
|
|
5
|
+
* Typed pub/sub. Listener exceptions are swallowed so one bad subscriber
|
|
6
|
+
* cannot block others — telemetry plugins can observe failures via onError.
|
|
7
|
+
*/
|
|
8
|
+
declare class EventBus<E> {
|
|
9
|
+
private handlers;
|
|
10
|
+
on<K extends keyof E>(event: K, fn: Handler<E[K]>): () => void;
|
|
11
|
+
once<K extends keyof E>(event: K, fn: Handler<E[K]>): () => void;
|
|
12
|
+
off<K extends keyof E>(event: K, fn: Handler<E[K]>): void;
|
|
13
|
+
emit<K extends keyof E>(event: K, payload: E[K]): void;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface SdkEvents {
|
|
17
|
+
'task.created': {
|
|
18
|
+
taskId: TaskId;
|
|
19
|
+
txHash: Hex;
|
|
20
|
+
rootHash: RootHash;
|
|
21
|
+
};
|
|
22
|
+
'task.assigned': {
|
|
23
|
+
taskId: TaskId;
|
|
24
|
+
worker: Address;
|
|
25
|
+
txHash: Hex;
|
|
26
|
+
};
|
|
27
|
+
'task.cancelled': {
|
|
28
|
+
taskId: TaskId;
|
|
29
|
+
txHash: Hex;
|
|
30
|
+
};
|
|
31
|
+
'evidence.submitted': {
|
|
32
|
+
taskId: TaskId;
|
|
33
|
+
rootHash: RootHash;
|
|
34
|
+
txHash: Hex;
|
|
35
|
+
};
|
|
36
|
+
'verification.done': {
|
|
37
|
+
taskId: TaskId;
|
|
38
|
+
passed: boolean;
|
|
39
|
+
confidence: number;
|
|
40
|
+
};
|
|
41
|
+
'payment.claimed': {
|
|
42
|
+
taskId: TaskId;
|
|
43
|
+
txHash: Hex;
|
|
44
|
+
amount: bigint;
|
|
45
|
+
};
|
|
46
|
+
'tx.sent': {
|
|
47
|
+
hash: Hex;
|
|
48
|
+
from: Address;
|
|
49
|
+
to: Address;
|
|
50
|
+
};
|
|
51
|
+
'tx.confirmed': {
|
|
52
|
+
hash: Hex;
|
|
53
|
+
blockNumber: number;
|
|
54
|
+
};
|
|
55
|
+
'tx.failed': {
|
|
56
|
+
hash: Hex;
|
|
57
|
+
reason: string;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export { EventBus, type SdkEvents };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/events/EventBus.ts"],"names":[],"mappings":";AAMO,IAAM,WAAN,MAAkB;AAAA,EACf,WAAoD,EAAC;AAAA,EAE7D,EAAA,CAAsB,OAAU,EAAA,EAA+B;AAC7D,IAAA,IAAI,GAAA,GAAM,IAAA,CAAK,QAAA,CAAS,KAAK,CAAA;AAC7B,IAAA,IAAI,CAAC,GAAA,EAAK;AACR,MAAA,GAAA,uBAAU,GAAA,EAAmB;AAC7B,MAAA,IAAA,CAAK,QAAA,CAAS,KAAK,CAAA,GAAI,GAAA;AAAA,IACzB;AACA,IAAA,GAAA,CAAI,IAAI,EAAE,CAAA;AACV,IAAA,OAAO,MAAM;AACX,MAAA,IAAA,CAAK,GAAA,CAAI,OAAO,EAAE,CAAA;AAAA,IACpB,CAAA;AAAA,EACF;AAAA,EAEA,IAAA,CAAwB,OAAU,EAAA,EAA+B;AAC/D,IAAA,MAAM,OAAA,GAAyB,CAAC,CAAA,KAAM;AACpC,MAAA,IAAA,CAAK,GAAA,CAAI,OAAO,OAAO,CAAA;AACvB,MAAA,EAAA,CAAG,CAAC,CAAA;AAAA,IACN,CAAA;AACA,IAAA,OAAO,IAAA,CAAK,EAAA,CAAG,KAAA,EAAO,OAAO,CAAA;AAAA,EAC/B;AAAA,EAEA,GAAA,CAAuB,OAAU,EAAA,EAAyB;AACxD,IAAA,IAAA,CAAK,QAAA,CAAS,KAAK,CAAA,EAAG,MAAA,CAAO,EAAE,CAAA;AAAA,EACjC;AAAA,EAEA,IAAA,CAAwB,OAAU,OAAA,EAAqB;AACrD,IAAA,MAAM,EAAA,GAAK,IAAA,CAAK,QAAA,CAAS,KAAK,CAAA;AAC9B,IAAA,IAAI,CAAC,EAAA,EAAI;AACT,IAAA,KAAA,MAAW,KAAK,EAAA,EAAI;AAClB,MAAA,IAAI;AACF,QAAA,CAAA,CAAE,OAAO,CAAA;AAAA,MACX,CAAA,CAAA,MAAQ;AAAA,MAER;AAAA,IACF;AAAA,EACF;AACF","file":"index.js","sourcesContent":["type Handler<T> = (payload: T) => void;\n\n/**\n * Typed pub/sub. Listener exceptions are swallowed so one bad subscriber\n * cannot block others — telemetry plugins can observe failures via onError.\n */\nexport class EventBus<E> {\n private handlers: { [K in keyof E]?: Set<Handler<E[K]>> } = {};\n\n on<K extends keyof E>(event: K, fn: Handler<E[K]>): () => void {\n let set = this.handlers[event];\n if (!set) {\n set = new Set<Handler<E[K]>>();\n this.handlers[event] = set;\n }\n set.add(fn);\n return () => {\n this.off(event, fn);\n };\n }\n\n once<K extends keyof E>(event: K, fn: Handler<E[K]>): () => void {\n const wrapped: Handler<E[K]> = (p) => {\n this.off(event, wrapped);\n fn(p);\n };\n return this.on(event, wrapped);\n }\n\n off<K extends keyof E>(event: K, fn: Handler<E[K]>): void {\n this.handlers[event]?.delete(fn);\n }\n\n emit<K extends keyof E>(event: K, payload: E[K]): void {\n const hs = this.handlers[event];\n if (!hs) return;\n for (const h of hs) {\n try {\n h(payload);\n } catch {\n // Isolated per-listener — prevents one bad subscriber from blocking others.\n }\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { Address, Hex, RootHash, TaskId } from '../types.js';
|
|
2
|
+
export interface SdkEvents {
|
|
3
|
+
'task.created': {
|
|
4
|
+
taskId: TaskId;
|
|
5
|
+
txHash: Hex;
|
|
6
|
+
rootHash: RootHash;
|
|
7
|
+
};
|
|
8
|
+
'task.assigned': {
|
|
9
|
+
taskId: TaskId;
|
|
10
|
+
worker: Address;
|
|
11
|
+
txHash: Hex;
|
|
12
|
+
};
|
|
13
|
+
'task.cancelled': {
|
|
14
|
+
taskId: TaskId;
|
|
15
|
+
txHash: Hex;
|
|
16
|
+
};
|
|
17
|
+
'evidence.submitted': {
|
|
18
|
+
taskId: TaskId;
|
|
19
|
+
rootHash: RootHash;
|
|
20
|
+
txHash: Hex;
|
|
21
|
+
};
|
|
22
|
+
'verification.done': {
|
|
23
|
+
taskId: TaskId;
|
|
24
|
+
passed: boolean;
|
|
25
|
+
confidence: number;
|
|
26
|
+
};
|
|
27
|
+
'payment.claimed': {
|
|
28
|
+
taskId: TaskId;
|
|
29
|
+
txHash: Hex;
|
|
30
|
+
amount: bigint;
|
|
31
|
+
};
|
|
32
|
+
'tx.sent': {
|
|
33
|
+
hash: Hex;
|
|
34
|
+
from: Address;
|
|
35
|
+
to: Address;
|
|
36
|
+
};
|
|
37
|
+
'tx.confirmed': {
|
|
38
|
+
hash: Hex;
|
|
39
|
+
blockNumber: number;
|
|
40
|
+
};
|
|
41
|
+
'tx.failed': {
|
|
42
|
+
hash: Hex;
|
|
43
|
+
reason: string;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.cjs"}
|
package/dist/index.d.cts
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { Wallet, ethers } from 'ethers';
|
|
2
|
+
export interface BlindMarketConfig {
|
|
3
|
+
apiBase?: string;
|
|
4
|
+
apiKey: string;
|
|
5
|
+
rpcUrl?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface DeployAgentParams {
|
|
8
|
+
name: string;
|
|
9
|
+
instructions: string;
|
|
10
|
+
provider: 'openai' | 'anthropic' | 'groq' | 'gemini';
|
|
11
|
+
model: string;
|
|
12
|
+
apiKey: string;
|
|
13
|
+
ownerAddress: string;
|
|
14
|
+
ownerPublicKey: string;
|
|
15
|
+
capabilities?: string[];
|
|
16
|
+
tools?: object[];
|
|
17
|
+
}
|
|
18
|
+
export interface PostTaskParams {
|
|
19
|
+
instructions: string;
|
|
20
|
+
category: string;
|
|
21
|
+
amount: string;
|
|
22
|
+
token: string;
|
|
23
|
+
locationZone?: string;
|
|
24
|
+
duration?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface DeployedAgent {
|
|
27
|
+
id: string;
|
|
28
|
+
name: string;
|
|
29
|
+
walletAddress: string;
|
|
30
|
+
publicKey: string;
|
|
31
|
+
inftTokenId?: number;
|
|
32
|
+
status: string;
|
|
33
|
+
}
|
|
34
|
+
export interface PostedTask {
|
|
35
|
+
unsignedTx: object;
|
|
36
|
+
taskHash: string;
|
|
37
|
+
storageRoot: string;
|
|
38
|
+
}
|
|
39
|
+
export declare class BlindMarket {
|
|
40
|
+
private apiBase;
|
|
41
|
+
private apiKey;
|
|
42
|
+
constructor(config: BlindMarketConfig);
|
|
43
|
+
private req;
|
|
44
|
+
/**
|
|
45
|
+
* Deploy a new agent. Generates a wallet, mints an INFT, returns the agent.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* const agent = await bb.deployAgent({
|
|
49
|
+
* name: 'research-agent',
|
|
50
|
+
* instructions: 'You research topics and post tasks for humans to verify.',
|
|
51
|
+
* provider: 'anthropic',
|
|
52
|
+
* model: 'claude-sonnet-4-5',
|
|
53
|
+
* apiKey: process.env.ANTHROPIC_API_KEY!,
|
|
54
|
+
* ownerAddress: wallet.address,
|
|
55
|
+
* ownerPublicKey: wallet.publicKey,
|
|
56
|
+
* });
|
|
57
|
+
*/
|
|
58
|
+
deployAgent(params: DeployAgentParams): Promise<DeployedAgent>;
|
|
59
|
+
/**
|
|
60
|
+
* List all agents owned by an address.
|
|
61
|
+
*/
|
|
62
|
+
listAgents(ownerAddress: string): Promise<DeployedAgent[]>;
|
|
63
|
+
/**
|
|
64
|
+
* Encrypt instructions and post a task. Returns an unsigned tx to sign + broadcast.
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* const { unsignedTx, taskHash } = await bb.postTask({
|
|
68
|
+
* instructions: 'Photograph the exterior of 42 Oak Street, NYC.',
|
|
69
|
+
* category: 'photography',
|
|
70
|
+
* amount: ethers.parseEther('30').toString(),
|
|
71
|
+
* token: '0x317227efcA18D004E12CA8046AEf7E1597458F25',
|
|
72
|
+
* locationZone: 'US-NY',
|
|
73
|
+
* });
|
|
74
|
+
* const receipt = await wallet.sendTransaction(unsignedTx);
|
|
75
|
+
*/
|
|
76
|
+
postTask(params: PostTaskParams): Promise<PostedTask>;
|
|
77
|
+
/**
|
|
78
|
+
* Assign a worker to a task. Returns an unsigned tx.
|
|
79
|
+
*/
|
|
80
|
+
assignWorker(taskId: string, worker: string): Promise<{
|
|
81
|
+
unsignedTx: object;
|
|
82
|
+
}>;
|
|
83
|
+
/**
|
|
84
|
+
* Trigger TEE verification for a task.
|
|
85
|
+
*/
|
|
86
|
+
verify(params: {
|
|
87
|
+
taskId: number;
|
|
88
|
+
requirements: string;
|
|
89
|
+
evidenceSummary: string;
|
|
90
|
+
category?: string;
|
|
91
|
+
}): Promise<{
|
|
92
|
+
passed: boolean;
|
|
93
|
+
confidence: number;
|
|
94
|
+
reasoning: string;
|
|
95
|
+
}>;
|
|
96
|
+
/**
|
|
97
|
+
* Submit evidence for an assigned task.
|
|
98
|
+
*/
|
|
99
|
+
submitEvidence(params: {
|
|
100
|
+
taskId: number;
|
|
101
|
+
evidence: string;
|
|
102
|
+
}): Promise<{
|
|
103
|
+
unsignedTx: object;
|
|
104
|
+
}>;
|
|
105
|
+
/**
|
|
106
|
+
* Get task status.
|
|
107
|
+
*/
|
|
108
|
+
getTask(taskId: string): Promise<{
|
|
109
|
+
status: number;
|
|
110
|
+
agent: string;
|
|
111
|
+
worker: string;
|
|
112
|
+
amount: string;
|
|
113
|
+
}>;
|
|
114
|
+
/**
|
|
115
|
+
* List open tasks.
|
|
116
|
+
*/
|
|
117
|
+
listTasks(limit?: number): Promise<object[]>;
|
|
118
|
+
/**
|
|
119
|
+
* Authenticate with a wallet and return a JWT.
|
|
120
|
+
* Use this to get the apiKey for the constructor.
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* const wallet = new ethers.Wallet(privateKey);
|
|
124
|
+
* const apiKey = await BlindMarket.authenticate(wallet, 'http://localhost:3001');
|
|
125
|
+
* const bb = new BlindMarket({ apiKey });
|
|
126
|
+
*/
|
|
127
|
+
static authenticate(wallet: Wallet, apiBase?: string): Promise<string>;
|
|
128
|
+
}
|
|
129
|
+
export { ethers };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { ethers } from 'ethers';
|
|
2
|
+
import { createCipheriv, randomBytes, createHash } from 'crypto';
|
|
3
|
+
export class BlindMarket {
|
|
4
|
+
apiBase;
|
|
5
|
+
apiKey;
|
|
6
|
+
constructor(config) {
|
|
7
|
+
this.apiBase = config.apiBase ?? 'http://localhost:3001';
|
|
8
|
+
this.apiKey = config.apiKey;
|
|
9
|
+
}
|
|
10
|
+
async req(method, path, body) {
|
|
11
|
+
const res = await fetch(`${this.apiBase}${path}`, {
|
|
12
|
+
method,
|
|
13
|
+
headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${this.apiKey}` },
|
|
14
|
+
body: body ? JSON.stringify(body) : undefined,
|
|
15
|
+
});
|
|
16
|
+
const json = await res.json();
|
|
17
|
+
if (!json.success)
|
|
18
|
+
throw new Error(json.error?.message ?? `HTTP ${res.status}`);
|
|
19
|
+
return json.data;
|
|
20
|
+
}
|
|
21
|
+
// ── Agent deployment ──────────────────────────────────────────────────────
|
|
22
|
+
/**
|
|
23
|
+
* Deploy a new agent. Generates a wallet, mints an INFT, returns the agent.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* const agent = await bb.deployAgent({
|
|
27
|
+
* name: 'research-agent',
|
|
28
|
+
* instructions: 'You research topics and post tasks for humans to verify.',
|
|
29
|
+
* provider: 'anthropic',
|
|
30
|
+
* model: 'claude-sonnet-4-5',
|
|
31
|
+
* apiKey: process.env.ANTHROPIC_API_KEY!,
|
|
32
|
+
* ownerAddress: wallet.address,
|
|
33
|
+
* ownerPublicKey: wallet.publicKey,
|
|
34
|
+
* });
|
|
35
|
+
*/
|
|
36
|
+
async deployAgent(params) {
|
|
37
|
+
return this.req('POST', '/api/v1/agents/deploy', params);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* List all agents owned by an address.
|
|
41
|
+
*/
|
|
42
|
+
async listAgents(ownerAddress) {
|
|
43
|
+
return this.req('GET', `/api/v1/agents?owner=${ownerAddress}`);
|
|
44
|
+
}
|
|
45
|
+
// ── Task lifecycle ────────────────────────────────────────────────────────
|
|
46
|
+
/**
|
|
47
|
+
* Encrypt instructions and post a task. Returns an unsigned tx to sign + broadcast.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* const { unsignedTx, taskHash } = await bb.postTask({
|
|
51
|
+
* instructions: 'Photograph the exterior of 42 Oak Street, NYC.',
|
|
52
|
+
* category: 'photography',
|
|
53
|
+
* amount: ethers.parseEther('30').toString(),
|
|
54
|
+
* token: '0x317227efcA18D004E12CA8046AEf7E1597458F25',
|
|
55
|
+
* locationZone: 'US-NY',
|
|
56
|
+
* });
|
|
57
|
+
* const receipt = await wallet.sendTransaction(unsignedTx);
|
|
58
|
+
*/
|
|
59
|
+
async postTask(params) {
|
|
60
|
+
// Encrypt instructions
|
|
61
|
+
const key = randomBytes(32);
|
|
62
|
+
const iv = randomBytes(12);
|
|
63
|
+
const cipher = createCipheriv('aes-256-gcm', key, iv);
|
|
64
|
+
const encrypted = Buffer.concat([cipher.update(params.instructions, 'utf8'), cipher.final()]);
|
|
65
|
+
const tag = cipher.getAuthTag();
|
|
66
|
+
const blob = Buffer.concat([iv, tag, encrypted]).toString('base64');
|
|
67
|
+
// Upload to storage
|
|
68
|
+
const { rootHash } = await this.req('POST', '/api/v1/storage/upload', { data: blob });
|
|
69
|
+
// taskHash = SHA-256 of ciphertext
|
|
70
|
+
const taskHash = '0x' + createHash('sha256').update(Buffer.concat([iv, tag, encrypted])).digest('hex');
|
|
71
|
+
// Build unsigned tx
|
|
72
|
+
const { unsignedTx } = await this.req('POST', '/api/v1/tasks', {
|
|
73
|
+
taskHash,
|
|
74
|
+
token: params.token,
|
|
75
|
+
amount: params.amount,
|
|
76
|
+
category: params.category,
|
|
77
|
+
locationZone: params.locationZone ?? 'global',
|
|
78
|
+
duration: params.duration ?? '86400',
|
|
79
|
+
});
|
|
80
|
+
return { unsignedTx, taskHash, storageRoot: rootHash };
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Assign a worker to a task. Returns an unsigned tx.
|
|
84
|
+
*/
|
|
85
|
+
async assignWorker(taskId, worker) {
|
|
86
|
+
return this.req('POST', `/api/v1/tasks/${taskId}/assign`, { worker });
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Trigger TEE verification for a task.
|
|
90
|
+
*/
|
|
91
|
+
async verify(params) {
|
|
92
|
+
return this.req('POST', '/api/v1/verification/trigger', {
|
|
93
|
+
taskId: params.taskId,
|
|
94
|
+
taskCategory: params.category ?? 'general',
|
|
95
|
+
taskRequirements: params.requirements,
|
|
96
|
+
evidenceSummary: params.evidenceSummary,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Submit evidence for an assigned task.
|
|
101
|
+
*/
|
|
102
|
+
async submitEvidence(params) {
|
|
103
|
+
const key = randomBytes(32);
|
|
104
|
+
const iv = randomBytes(12);
|
|
105
|
+
const cipher = createCipheriv('aes-256-gcm', key, iv);
|
|
106
|
+
const encrypted = Buffer.concat([cipher.update(params.evidence, 'utf8'), cipher.final()]);
|
|
107
|
+
const tag = cipher.getAuthTag();
|
|
108
|
+
const blob = Buffer.concat([iv, tag, encrypted]).toString('base64');
|
|
109
|
+
await this.req('POST', '/api/v1/storage/upload', { data: blob });
|
|
110
|
+
const evidenceHash = '0x' + createHash('sha256').update(Buffer.concat([iv, tag, encrypted])).digest('hex');
|
|
111
|
+
return this.req('POST', '/api/v1/submissions/submit', { taskId: params.taskId, evidenceHash });
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Get task status.
|
|
115
|
+
*/
|
|
116
|
+
async getTask(taskId) {
|
|
117
|
+
return this.req('GET', `/api/v1/tasks/${taskId}`);
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* List open tasks.
|
|
121
|
+
*/
|
|
122
|
+
async listTasks(limit = 20) {
|
|
123
|
+
const { tasks } = await this.req('GET', `/api/v1/tasks?limit=${limit}`);
|
|
124
|
+
return tasks;
|
|
125
|
+
}
|
|
126
|
+
// ── Auth helper ───────────────────────────────────────────────────────────
|
|
127
|
+
/**
|
|
128
|
+
* Authenticate with a wallet and return a JWT.
|
|
129
|
+
* Use this to get the apiKey for the constructor.
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* const wallet = new ethers.Wallet(privateKey);
|
|
133
|
+
* const apiKey = await BlindMarket.authenticate(wallet, 'http://localhost:3001');
|
|
134
|
+
* const bb = new BlindMarket({ apiKey });
|
|
135
|
+
*/
|
|
136
|
+
static async authenticate(wallet, apiBase = 'http://localhost:3001') {
|
|
137
|
+
const nonceRes = await fetch(`${apiBase}/api/v1/auth/nonce`, {
|
|
138
|
+
method: 'POST',
|
|
139
|
+
headers: { 'Content-Type': 'application/json' },
|
|
140
|
+
body: JSON.stringify({ address: wallet.address }),
|
|
141
|
+
});
|
|
142
|
+
const { data: { nonce } } = await nonceRes.json();
|
|
143
|
+
const message = `Sign this message to authenticate with BlindMarket.\n\nNonce: ${nonce}`;
|
|
144
|
+
const signature = await wallet.signMessage(message);
|
|
145
|
+
const verifyRes = await fetch(`${apiBase}/api/v1/auth/verify`, {
|
|
146
|
+
method: 'POST',
|
|
147
|
+
headers: { 'Content-Type': 'application/json' },
|
|
148
|
+
body: JSON.stringify({ address: wallet.address, signature }),
|
|
149
|
+
});
|
|
150
|
+
const { data: { token } } = await verifyRes.json();
|
|
151
|
+
return token;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
export { ethers };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { generateAesKey } from '../crypto/index.js';
|
|
2
|
+
import type { Address, Hex, TaskId, TaskKey, TaskKeyRef } from '../types.js';
|
|
3
|
+
import type { KeyStore } from './KeyStore.js';
|
|
4
|
+
/**
|
|
5
|
+
* Default KeyStore. Non-persistent — keys live only for the process lifetime.
|
|
6
|
+
* Export/import is encrypted with a passphrase via HKDF-derived AES-256-GCM,
|
|
7
|
+
* so exported blobs are safe to move between processes.
|
|
8
|
+
*/
|
|
9
|
+
export declare class InMemoryKeyStore implements KeyStore {
|
|
10
|
+
private readonly keys;
|
|
11
|
+
private readonly peers;
|
|
12
|
+
putTaskKey(taskId: TaskId, key: TaskKey): Promise<void>;
|
|
13
|
+
getTaskKey(taskId: TaskId): Promise<TaskKey | null>;
|
|
14
|
+
putPeerPubKey(addr: Address, pubkey: Hex): Promise<void>;
|
|
15
|
+
getPeerPubKey(addr: Address): Promise<Hex | null>;
|
|
16
|
+
list(): Promise<TaskKeyRef[]>;
|
|
17
|
+
delete(taskId: TaskId): Promise<void>;
|
|
18
|
+
export(passphrase: string): Promise<string>;
|
|
19
|
+
import(data: string, passphrase: string): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
export { generateAesKey };
|