@shroud-fi/agent-runtime 0.1.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/LICENSE +21 -0
- package/README.md +71 -0
- package/dist/cjs/agent.d.ts +235 -0
- package/dist/cjs/agent.d.ts.map +1 -0
- package/dist/cjs/agent.js +594 -0
- package/dist/cjs/agent.js.map +1 -0
- package/dist/cjs/browser.d.ts +38 -0
- package/dist/cjs/browser.d.ts.map +1 -0
- package/dist/cjs/browser.js +94 -0
- package/dist/cjs/browser.js.map +1 -0
- package/dist/cjs/constants.d.ts +17 -0
- package/dist/cjs/constants.d.ts.map +1 -0
- package/dist/cjs/constants.js +20 -0
- package/dist/cjs/constants.js.map +1 -0
- package/dist/cjs/errors.d.ts +107 -0
- package/dist/cjs/errors.d.ts.map +1 -0
- package/dist/cjs/errors.js +152 -0
- package/dist/cjs/errors.js.map +1 -0
- package/dist/cjs/factory.d.ts +19 -0
- package/dist/cjs/factory.d.ts.map +1 -0
- package/dist/cjs/factory.js +46 -0
- package/dist/cjs/factory.js.map +1 -0
- package/dist/cjs/index.d.ts +6 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +37 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/types.d.ts +151 -0
- package/dist/cjs/types.d.ts.map +1 -0
- package/dist/cjs/types.js +10 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/esm/agent.d.ts +235 -0
- package/dist/esm/agent.d.ts.map +1 -0
- package/dist/esm/agent.js +557 -0
- package/dist/esm/agent.js.map +1 -0
- package/dist/esm/browser.d.ts +38 -0
- package/dist/esm/browser.d.ts.map +1 -0
- package/dist/esm/browser.js +87 -0
- package/dist/esm/browser.js.map +1 -0
- package/dist/esm/constants.d.ts +17 -0
- package/dist/esm/constants.d.ts.map +1 -0
- package/dist/esm/constants.js +17 -0
- package/dist/esm/constants.js.map +1 -0
- package/dist/esm/errors.d.ts +107 -0
- package/dist/esm/errors.d.ts.map +1 -0
- package/dist/esm/errors.js +137 -0
- package/dist/esm/errors.js.map +1 -0
- package/dist/esm/factory.d.ts +19 -0
- package/dist/esm/factory.d.ts.map +1 -0
- package/dist/esm/factory.js +43 -0
- package/dist/esm/factory.js.map +1 -0
- package/dist/esm/index.d.ts +6 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +16 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/types.d.ts +151 -0
- package/dist/esm/types.d.ts.map +1 -0
- package/dist/esm/types.js +9 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/tsconfig.cjs.tsbuildinfo +1 -0
- package/dist/tsconfig.esm.tsbuildinfo +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +72 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* createShroudAgentFromBrowserWallet — browser / EIP-1193 wallet entry point.
|
|
4
|
+
*
|
|
5
|
+
* Flow:
|
|
6
|
+
* 1. Ask the wallet to sign BROWSER_KEY_MESSAGE via personal_sign.
|
|
7
|
+
* 2. HKDF the signature bytes to a deterministic 32-byte master seed.
|
|
8
|
+
* 3. Delegate to createShroudAgent.
|
|
9
|
+
*
|
|
10
|
+
* The same wallet always produces the same agent identity — no localStorage,
|
|
11
|
+
* no persistence. Bumping BROWSER_KEY_MESSAGE forks the identity space.
|
|
12
|
+
*
|
|
13
|
+
* Privacy invariants:
|
|
14
|
+
* - No console.* anywhere.
|
|
15
|
+
* - The signature bytes never appear in error messages or stack frames.
|
|
16
|
+
* - The derived master seed is passed to createShroudAgent and immediately
|
|
17
|
+
* consumed by createAgentIdentity; no caller-visible reference is retained.
|
|
18
|
+
*/
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.HKDF_BROWSER_INFO = exports.HKDF_BROWSER_SALT = exports.BROWSER_KEY_MESSAGE = void 0;
|
|
21
|
+
exports.createShroudAgentFromBrowserWallet = createShroudAgentFromBrowserWallet;
|
|
22
|
+
const hkdf_1 = require("@noble/hashes/hkdf");
|
|
23
|
+
const sha256_1 = require("@noble/hashes/sha256");
|
|
24
|
+
const factory_js_1 = require("./factory.js");
|
|
25
|
+
const constants_js_1 = require("./constants.js");
|
|
26
|
+
const errors_js_1 = require("./errors.js");
|
|
27
|
+
var constants_js_2 = require("./constants.js");
|
|
28
|
+
Object.defineProperty(exports, "BROWSER_KEY_MESSAGE", { enumerable: true, get: function () { return constants_js_2.BROWSER_KEY_MESSAGE; } });
|
|
29
|
+
Object.defineProperty(exports, "HKDF_BROWSER_SALT", { enumerable: true, get: function () { return constants_js_2.HKDF_BROWSER_SALT; } });
|
|
30
|
+
Object.defineProperty(exports, "HKDF_BROWSER_INFO", { enumerable: true, get: function () { return constants_js_2.HKDF_BROWSER_INFO; } });
|
|
31
|
+
/**
|
|
32
|
+
* Decode a 0x-prefixed hex string (e.g. an EIP-191 signature) into bytes.
|
|
33
|
+
* Returns null on malformed input — callers map this to a privacy-safe error
|
|
34
|
+
* rather than surfacing the raw value.
|
|
35
|
+
*/
|
|
36
|
+
function hexToBytesSafe(hex) {
|
|
37
|
+
if (typeof hex !== 'string')
|
|
38
|
+
return null;
|
|
39
|
+
const stripped = hex.startsWith('0x') ? hex.slice(2) : hex;
|
|
40
|
+
if (stripped.length === 0 || stripped.length % 2 !== 0)
|
|
41
|
+
return null;
|
|
42
|
+
const out = new Uint8Array(stripped.length / 2);
|
|
43
|
+
for (let i = 0; i < out.length; i++) {
|
|
44
|
+
const byte = parseInt(stripped.slice(i * 2, i * 2 + 2), 16);
|
|
45
|
+
if (Number.isNaN(byte))
|
|
46
|
+
return null;
|
|
47
|
+
out[i] = byte;
|
|
48
|
+
}
|
|
49
|
+
return out;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Build a ShroudAgent from a browser wallet adapter (e.g. MetaMask).
|
|
53
|
+
*
|
|
54
|
+
* @throws MissingBrowserWalletError if the adapter is missing required fields.
|
|
55
|
+
* @throws BrowserWalletSignatureRejectedError if the signature request is rejected.
|
|
56
|
+
*/
|
|
57
|
+
async function createShroudAgentFromBrowserWallet(args) {
|
|
58
|
+
const wallet = args.wallet;
|
|
59
|
+
if (wallet === undefined ||
|
|
60
|
+
wallet === null ||
|
|
61
|
+
typeof wallet.signMessage !== 'function' ||
|
|
62
|
+
typeof wallet.address !== 'string' ||
|
|
63
|
+
!wallet.address.startsWith('0x')) {
|
|
64
|
+
throw new errors_js_1.MissingBrowserWalletError();
|
|
65
|
+
}
|
|
66
|
+
let signature;
|
|
67
|
+
try {
|
|
68
|
+
signature = await wallet.signMessage(constants_js_1.BROWSER_KEY_MESSAGE);
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
// Never surface the underlying rejection reason — could embed wallet
|
|
72
|
+
// metadata or user prompt text.
|
|
73
|
+
throw new errors_js_1.BrowserWalletSignatureRejectedError();
|
|
74
|
+
}
|
|
75
|
+
const sigBytes = hexToBytesSafe(signature);
|
|
76
|
+
if (sigBytes === null || sigBytes.length === 0) {
|
|
77
|
+
throw new errors_js_1.BrowserWalletSignatureRejectedError();
|
|
78
|
+
}
|
|
79
|
+
// HKDF-SHA256: extract + expand the signature into a deterministic 32-byte
|
|
80
|
+
// master seed. The signature is the IKM, not the salt — salt and info are
|
|
81
|
+
// constant version tags.
|
|
82
|
+
const masterSeed = (0, hkdf_1.hkdf)(sha256_1.sha256, sigBytes, constants_js_1.HKDF_BROWSER_SALT, constants_js_1.HKDF_BROWSER_INFO, constants_js_1.BROWSER_MASTER_SEED_LENGTH);
|
|
83
|
+
const config = {
|
|
84
|
+
masterSeed,
|
|
85
|
+
transport: args.transport,
|
|
86
|
+
startBlock: args.startBlock,
|
|
87
|
+
...(args.stealthContract !== undefined
|
|
88
|
+
? { stealthContract: args.stealthContract }
|
|
89
|
+
: {}),
|
|
90
|
+
...(args.finality !== undefined ? { finality: args.finality } : {}),
|
|
91
|
+
};
|
|
92
|
+
return (0, factory_js_1.createShroudAgent)(config);
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=browser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../../src/browser.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent runtime constants.
|
|
3
|
+
*
|
|
4
|
+
* BROWSER_KEY_MESSAGE is the personal-sign payload the browser factory asks
|
|
5
|
+
* MetaMask (or any EIP-1193 wallet) to sign. It is HKDF'd into a deterministic
|
|
6
|
+
* 32-byte master seed so the same wallet always produces the same agent
|
|
7
|
+
* identity — no localStorage, no key persistence.
|
|
8
|
+
*
|
|
9
|
+
* Versioning the message string is load-bearing: bumping `-v1` to `-v2` will
|
|
10
|
+
* derive a different identity even for the same wallet. Treat as a one-way
|
|
11
|
+
* cryptographic input; never rename without a migration story.
|
|
12
|
+
*/
|
|
13
|
+
export declare const BROWSER_KEY_MESSAGE = "ShroudFi-Demo-Key-Derivation-v1";
|
|
14
|
+
export declare const HKDF_BROWSER_SALT: Uint8Array<ArrayBuffer>;
|
|
15
|
+
export declare const HKDF_BROWSER_INFO: Uint8Array<ArrayBuffer>;
|
|
16
|
+
export declare const BROWSER_MASTER_SEED_LENGTH = 32;
|
|
17
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,eAAO,MAAM,mBAAmB,oCACG,CAAC;AAEpC,eAAO,MAAM,iBAAiB,yBAA+C,CAAC;AAC9E,eAAO,MAAM,iBAAiB,yBAAgD,CAAC;AAE/E,eAAO,MAAM,0BAA0B,KAAK,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Agent runtime constants.
|
|
4
|
+
*
|
|
5
|
+
* BROWSER_KEY_MESSAGE is the personal-sign payload the browser factory asks
|
|
6
|
+
* MetaMask (or any EIP-1193 wallet) to sign. It is HKDF'd into a deterministic
|
|
7
|
+
* 32-byte master seed so the same wallet always produces the same agent
|
|
8
|
+
* identity — no localStorage, no key persistence.
|
|
9
|
+
*
|
|
10
|
+
* Versioning the message string is load-bearing: bumping `-v1` to `-v2` will
|
|
11
|
+
* derive a different identity even for the same wallet. Treat as a one-way
|
|
12
|
+
* cryptographic input; never rename without a migration story.
|
|
13
|
+
*/
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.BROWSER_MASTER_SEED_LENGTH = exports.HKDF_BROWSER_INFO = exports.HKDF_BROWSER_SALT = exports.BROWSER_KEY_MESSAGE = void 0;
|
|
16
|
+
exports.BROWSER_KEY_MESSAGE = 'ShroudFi-Demo-Key-Derivation-v1';
|
|
17
|
+
exports.HKDF_BROWSER_SALT = new TextEncoder().encode('ShroudFi-Demo-v1');
|
|
18
|
+
exports.HKDF_BROWSER_INFO = new TextEncoder().encode('agent-master-seed');
|
|
19
|
+
exports.BROWSER_MASTER_SEED_LENGTH = 32;
|
|
20
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AAEU,QAAA,mBAAmB,GAC9B,iCAAiC,CAAC;AAEvB,QAAA,iBAAiB,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;AACjE,QAAA,iBAAiB,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC;AAElE,QAAA,0BAA0B,GAAG,EAAE,CAAC"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Privacy-safe error classes for @shroud-fi/agent-runtime.
|
|
3
|
+
*
|
|
4
|
+
* Invariants (mirrored from @shroud-fi/scanning + @shroud-fi/payments):
|
|
5
|
+
* - No 32-byte hex (key material) in any message.
|
|
6
|
+
* - No ephemeral pubkey bytes in any message.
|
|
7
|
+
* - No raw signature bytes in any message.
|
|
8
|
+
* - No transfer amounts in any message.
|
|
9
|
+
* - Messages carry short, structured reasons only.
|
|
10
|
+
*/
|
|
11
|
+
export declare class AgentRuntimeError extends Error {
|
|
12
|
+
readonly name: string;
|
|
13
|
+
constructor(message: string);
|
|
14
|
+
}
|
|
15
|
+
export declare class AgentNotStartedError extends AgentRuntimeError {
|
|
16
|
+
readonly name: string;
|
|
17
|
+
constructor();
|
|
18
|
+
}
|
|
19
|
+
export declare class AgentAlreadyStartedError extends AgentRuntimeError {
|
|
20
|
+
readonly name: string;
|
|
21
|
+
constructor();
|
|
22
|
+
}
|
|
23
|
+
export declare class MissingBrowserWalletError extends AgentRuntimeError {
|
|
24
|
+
readonly name: string;
|
|
25
|
+
constructor();
|
|
26
|
+
}
|
|
27
|
+
export declare class BrowserWalletSignatureRejectedError extends AgentRuntimeError {
|
|
28
|
+
readonly name: string;
|
|
29
|
+
constructor();
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Thrown when `sweepViaRelayer` is called but no relayer contract has been
|
|
33
|
+
* registered for the agent's chain. Callers can pass an explicit
|
|
34
|
+
* `relayerContract` to override the lookup.
|
|
35
|
+
*/
|
|
36
|
+
export declare class RelayerContractNotConfiguredError extends AgentRuntimeError {
|
|
37
|
+
readonly name: string;
|
|
38
|
+
constructor();
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* P5.1 — thrown when the caller tries to use the ETH gasless sweep path but
|
|
42
|
+
* has not provided a `selfHostEndpoint`. ETH gasless requires a self-host
|
|
43
|
+
* relayer service that builds + broadcasts the EIP-7702 type-0x04 tx; there
|
|
44
|
+
* is no third-party fallback (Gelato's 7702 surface is wallet-shaped, not
|
|
45
|
+
* relayer-shaped).
|
|
46
|
+
*/
|
|
47
|
+
export declare class EthRelayerEndpointRequiredError extends AgentRuntimeError {
|
|
48
|
+
readonly name: string;
|
|
49
|
+
constructor();
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* P5.1 — thrown when no ShroudFiEthRelayer contract has been registered for
|
|
53
|
+
* the agent's chain and the caller did not pass `ethRelayerContract` to
|
|
54
|
+
* override the manifest lookup.
|
|
55
|
+
*/
|
|
56
|
+
export declare class EthRelayerContractNotConfiguredError extends AgentRuntimeError {
|
|
57
|
+
readonly name: string;
|
|
58
|
+
constructor();
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* @deprecated Retained as a soft-removed export — callers updated to use
|
|
62
|
+
* EthRelayerEndpointRequiredError or the gasless ETH path directly. P5.1
|
|
63
|
+
* activated the previously-stubbed ETH-via-relayer path.
|
|
64
|
+
*/
|
|
65
|
+
export declare class RelayerNotAvailableForETHError extends AgentRuntimeError {
|
|
66
|
+
readonly name: string;
|
|
67
|
+
constructor();
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* M3 — thrown when `register()` is called but the agent's registrant wallet
|
|
71
|
+
* already has a non-empty stealth meta-address on file in the canonical
|
|
72
|
+
* ERC-6538 registry for scheme 1. Callers should treat this as benign and
|
|
73
|
+
* skip the registration tx; `ensureRegistered` does this automatically.
|
|
74
|
+
*
|
|
75
|
+
* Privacy: the registrant wallet address is NOT placed in `.message` — it
|
|
76
|
+
* would link the agent's runtime wallet to the error log. Callers who need
|
|
77
|
+
* to display the wallet must source it from `transport.walletClient.account`
|
|
78
|
+
* themselves.
|
|
79
|
+
*/
|
|
80
|
+
export declare class AlreadyRegisteredError extends AgentRuntimeError {
|
|
81
|
+
readonly name: string;
|
|
82
|
+
constructor();
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* M3 — wraps an underlying error thrown while `ensureRegistered` runs inside
|
|
86
|
+
* `agent.sendToWallet` with `autoRegister: true`. Preserves the original via
|
|
87
|
+
* the standard `cause` chain so callers can introspect without parsing
|
|
88
|
+
* strings.
|
|
89
|
+
*
|
|
90
|
+
* Privacy: the inner error MUST itself comply with the runtime's no-amount /
|
|
91
|
+
* no-wallet / no-key rule. This wrapper never inlines key, signature, or
|
|
92
|
+
* amount material into its own message.
|
|
93
|
+
*/
|
|
94
|
+
export declare class AutoRegistrationFailedError extends AgentRuntimeError {
|
|
95
|
+
readonly name: string;
|
|
96
|
+
constructor(cause?: unknown);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* M3 — thrown when `register()` is invoked on a transport that has no
|
|
100
|
+
* `walletClient` (or no account on the walletClient). Registration is a state
|
|
101
|
+
* change tx that needs a signer; read-only transports cannot register.
|
|
102
|
+
*/
|
|
103
|
+
export declare class RegistrationRequiresWalletError extends AgentRuntimeError {
|
|
104
|
+
readonly name: string;
|
|
105
|
+
constructor();
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,qBAAa,iBAAkB,SAAQ,KAAK;IAC1C,SAAkB,IAAI,EAAE,MAAM,CAAuB;gBACzC,OAAO,EAAE,MAAM;CAG5B;AAED,qBAAa,oBAAqB,SAAQ,iBAAiB;IACzD,SAAkB,IAAI,EAAE,MAAM,CAA0B;;CAIzD;AAED,qBAAa,wBAAyB,SAAQ,iBAAiB;IAC7D,SAAkB,IAAI,EAAE,MAAM,CAA8B;;CAI7D;AAED,qBAAa,yBAA0B,SAAQ,iBAAiB;IAC9D,SAAkB,IAAI,EAAE,MAAM,CAA+B;;CAI9D;AAED,qBAAa,mCAAoC,SAAQ,iBAAiB;IACxE,SAAkB,IAAI,EAAE,MAAM,CAAyC;;CAIxE;AAED;;;;GAIG;AACH,qBAAa,iCAAkC,SAAQ,iBAAiB;IACtE,SAAkB,IAAI,EAAE,MAAM,CAAuC;;CAItE;AAED;;;;;;GAMG;AACH,qBAAa,+BAAgC,SAAQ,iBAAiB;IACpE,SAAkB,IAAI,EAAE,MAAM,CAAqC;;CAMpE;AAED;;;;GAIG;AACH,qBAAa,oCAAqC,SAAQ,iBAAiB;IACzE,SAAkB,IAAI,EAAE,MAAM,CAA0C;;CAIzE;AAED;;;;GAIG;AACH,qBAAa,8BAA+B,SAAQ,iBAAiB;IACnE,SAAkB,IAAI,EAAE,MAAM,CAAoC;;CAInE;AAED;;;;;;;;;;GAUG;AACH,qBAAa,sBAAuB,SAAQ,iBAAiB;IAC3D,SAAkB,IAAI,EAAE,MAAM,CAA4B;;CAI3D;AAED;;;;;;;;;GASG;AACH,qBAAa,2BAA4B,SAAQ,iBAAiB;IAChE,SAAkB,IAAI,EAAE,MAAM,CAAiC;gBACnD,KAAK,CAAC,EAAE,OAAO;CAS5B;AAED;;;;GAIG;AACH,qBAAa,+BAAgC,SAAQ,iBAAiB;IACpE,SAAkB,IAAI,EAAE,MAAM,CAAqC;;CAIpE"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Privacy-safe error classes for @shroud-fi/agent-runtime.
|
|
4
|
+
*
|
|
5
|
+
* Invariants (mirrored from @shroud-fi/scanning + @shroud-fi/payments):
|
|
6
|
+
* - No 32-byte hex (key material) in any message.
|
|
7
|
+
* - No ephemeral pubkey bytes in any message.
|
|
8
|
+
* - No raw signature bytes in any message.
|
|
9
|
+
* - No transfer amounts in any message.
|
|
10
|
+
* - Messages carry short, structured reasons only.
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.RegistrationRequiresWalletError = exports.AutoRegistrationFailedError = exports.AlreadyRegisteredError = exports.RelayerNotAvailableForETHError = exports.EthRelayerContractNotConfiguredError = exports.EthRelayerEndpointRequiredError = exports.RelayerContractNotConfiguredError = exports.BrowserWalletSignatureRejectedError = exports.MissingBrowserWalletError = exports.AgentAlreadyStartedError = exports.AgentNotStartedError = exports.AgentRuntimeError = void 0;
|
|
14
|
+
class AgentRuntimeError extends Error {
|
|
15
|
+
name = 'AgentRuntimeError';
|
|
16
|
+
constructor(message) {
|
|
17
|
+
super(message);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.AgentRuntimeError = AgentRuntimeError;
|
|
21
|
+
class AgentNotStartedError extends AgentRuntimeError {
|
|
22
|
+
name = 'AgentNotStartedError';
|
|
23
|
+
constructor() {
|
|
24
|
+
super('Agent has not been started — call start() first');
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.AgentNotStartedError = AgentNotStartedError;
|
|
28
|
+
class AgentAlreadyStartedError extends AgentRuntimeError {
|
|
29
|
+
name = 'AgentAlreadyStartedError';
|
|
30
|
+
constructor() {
|
|
31
|
+
super('Agent already started — call stop() before start() again');
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.AgentAlreadyStartedError = AgentAlreadyStartedError;
|
|
35
|
+
class MissingBrowserWalletError extends AgentRuntimeError {
|
|
36
|
+
name = 'MissingBrowserWalletError';
|
|
37
|
+
constructor() {
|
|
38
|
+
super('Browser wallet adapter missing required signMessage or address');
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.MissingBrowserWalletError = MissingBrowserWalletError;
|
|
42
|
+
class BrowserWalletSignatureRejectedError extends AgentRuntimeError {
|
|
43
|
+
name = 'BrowserWalletSignatureRejectedError';
|
|
44
|
+
constructor() {
|
|
45
|
+
super('Browser wallet rejected signature request');
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.BrowserWalletSignatureRejectedError = BrowserWalletSignatureRejectedError;
|
|
49
|
+
/**
|
|
50
|
+
* Thrown when `sweepViaRelayer` is called but no relayer contract has been
|
|
51
|
+
* registered for the agent's chain. Callers can pass an explicit
|
|
52
|
+
* `relayerContract` to override the lookup.
|
|
53
|
+
*/
|
|
54
|
+
class RelayerContractNotConfiguredError extends AgentRuntimeError {
|
|
55
|
+
name = 'RelayerContractNotConfiguredError';
|
|
56
|
+
constructor() {
|
|
57
|
+
super('Relayer contract not configured for this chain');
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.RelayerContractNotConfiguredError = RelayerContractNotConfiguredError;
|
|
61
|
+
/**
|
|
62
|
+
* P5.1 — thrown when the caller tries to use the ETH gasless sweep path but
|
|
63
|
+
* has not provided a `selfHostEndpoint`. ETH gasless requires a self-host
|
|
64
|
+
* relayer service that builds + broadcasts the EIP-7702 type-0x04 tx; there
|
|
65
|
+
* is no third-party fallback (Gelato's 7702 surface is wallet-shaped, not
|
|
66
|
+
* relayer-shaped).
|
|
67
|
+
*/
|
|
68
|
+
class EthRelayerEndpointRequiredError extends AgentRuntimeError {
|
|
69
|
+
name = 'EthRelayerEndpointRequiredError';
|
|
70
|
+
constructor() {
|
|
71
|
+
super('ETH gasless sweep requires a self-host relayer endpoint — pass relayerOptions.selfHostEndpoint');
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
exports.EthRelayerEndpointRequiredError = EthRelayerEndpointRequiredError;
|
|
75
|
+
/**
|
|
76
|
+
* P5.1 — thrown when no ShroudFiEthRelayer contract has been registered for
|
|
77
|
+
* the agent's chain and the caller did not pass `ethRelayerContract` to
|
|
78
|
+
* override the manifest lookup.
|
|
79
|
+
*/
|
|
80
|
+
class EthRelayerContractNotConfiguredError extends AgentRuntimeError {
|
|
81
|
+
name = 'EthRelayerContractNotConfiguredError';
|
|
82
|
+
constructor() {
|
|
83
|
+
super('ShroudFiEthRelayer contract not configured for this chain');
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
exports.EthRelayerContractNotConfiguredError = EthRelayerContractNotConfiguredError;
|
|
87
|
+
/**
|
|
88
|
+
* @deprecated Retained as a soft-removed export — callers updated to use
|
|
89
|
+
* EthRelayerEndpointRequiredError or the gasless ETH path directly. P5.1
|
|
90
|
+
* activated the previously-stubbed ETH-via-relayer path.
|
|
91
|
+
*/
|
|
92
|
+
class RelayerNotAvailableForETHError extends AgentRuntimeError {
|
|
93
|
+
name = 'RelayerNotAvailableForETHError';
|
|
94
|
+
constructor() {
|
|
95
|
+
super('Relayer sweep does not support ETH — use direct sweep or ERC-20');
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
exports.RelayerNotAvailableForETHError = RelayerNotAvailableForETHError;
|
|
99
|
+
/**
|
|
100
|
+
* M3 — thrown when `register()` is called but the agent's registrant wallet
|
|
101
|
+
* already has a non-empty stealth meta-address on file in the canonical
|
|
102
|
+
* ERC-6538 registry for scheme 1. Callers should treat this as benign and
|
|
103
|
+
* skip the registration tx; `ensureRegistered` does this automatically.
|
|
104
|
+
*
|
|
105
|
+
* Privacy: the registrant wallet address is NOT placed in `.message` — it
|
|
106
|
+
* would link the agent's runtime wallet to the error log. Callers who need
|
|
107
|
+
* to display the wallet must source it from `transport.walletClient.account`
|
|
108
|
+
* themselves.
|
|
109
|
+
*/
|
|
110
|
+
class AlreadyRegisteredError extends AgentRuntimeError {
|
|
111
|
+
name = 'AlreadyRegisteredError';
|
|
112
|
+
constructor() {
|
|
113
|
+
super('Agent is already registered in the ERC-6538 registry');
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
exports.AlreadyRegisteredError = AlreadyRegisteredError;
|
|
117
|
+
/**
|
|
118
|
+
* M3 — wraps an underlying error thrown while `ensureRegistered` runs inside
|
|
119
|
+
* `agent.sendToWallet` with `autoRegister: true`. Preserves the original via
|
|
120
|
+
* the standard `cause` chain so callers can introspect without parsing
|
|
121
|
+
* strings.
|
|
122
|
+
*
|
|
123
|
+
* Privacy: the inner error MUST itself comply with the runtime's no-amount /
|
|
124
|
+
* no-wallet / no-key rule. This wrapper never inlines key, signature, or
|
|
125
|
+
* amount material into its own message.
|
|
126
|
+
*/
|
|
127
|
+
class AutoRegistrationFailedError extends AgentRuntimeError {
|
|
128
|
+
name = 'AutoRegistrationFailedError';
|
|
129
|
+
constructor(cause) {
|
|
130
|
+
super('Auto-registration failed');
|
|
131
|
+
// Use the standard ES2022 `cause` slot. Avoid serializing the inner
|
|
132
|
+
// error into the message itself — the privacy invariant tests would
|
|
133
|
+
// catch a leak if the wrapped error embedded sensitive bytes.
|
|
134
|
+
if (cause !== undefined) {
|
|
135
|
+
this.cause = cause;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
exports.AutoRegistrationFailedError = AutoRegistrationFailedError;
|
|
140
|
+
/**
|
|
141
|
+
* M3 — thrown when `register()` is invoked on a transport that has no
|
|
142
|
+
* `walletClient` (or no account on the walletClient). Registration is a state
|
|
143
|
+
* change tx that needs a signer; read-only transports cannot register.
|
|
144
|
+
*/
|
|
145
|
+
class RegistrationRequiresWalletError extends AgentRuntimeError {
|
|
146
|
+
name = 'RegistrationRequiresWalletError';
|
|
147
|
+
constructor() {
|
|
148
|
+
super('Registration requires a walletClient with an account');
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
exports.RegistrationRequiresWalletError = RegistrationRequiresWalletError;
|
|
152
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAEH,MAAa,iBAAkB,SAAQ,KAAK;IACxB,IAAI,GAAW,mBAAmB,CAAC;IACrD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;CACF;AALD,8CAKC;AAED,MAAa,oBAAqB,SAAQ,iBAAiB;IACvC,IAAI,GAAW,sBAAsB,CAAC;IACxD;QACE,KAAK,CAAC,iDAAiD,CAAC,CAAC;IAC3D,CAAC;CACF;AALD,oDAKC;AAED,MAAa,wBAAyB,SAAQ,iBAAiB;IAC3C,IAAI,GAAW,0BAA0B,CAAC;IAC5D;QACE,KAAK,CAAC,0DAA0D,CAAC,CAAC;IACpE,CAAC;CACF;AALD,4DAKC;AAED,MAAa,yBAA0B,SAAQ,iBAAiB;IAC5C,IAAI,GAAW,2BAA2B,CAAC;IAC7D;QACE,KAAK,CAAC,gEAAgE,CAAC,CAAC;IAC1E,CAAC;CACF;AALD,8DAKC;AAED,MAAa,mCAAoC,SAAQ,iBAAiB;IACtD,IAAI,GAAW,qCAAqC,CAAC;IACvE;QACE,KAAK,CAAC,2CAA2C,CAAC,CAAC;IACrD,CAAC;CACF;AALD,kFAKC;AAED;;;;GAIG;AACH,MAAa,iCAAkC,SAAQ,iBAAiB;IACpD,IAAI,GAAW,mCAAmC,CAAC;IACrE;QACE,KAAK,CAAC,gDAAgD,CAAC,CAAC;IAC1D,CAAC;CACF;AALD,8EAKC;AAED;;;;;;GAMG;AACH,MAAa,+BAAgC,SAAQ,iBAAiB;IAClD,IAAI,GAAW,iCAAiC,CAAC;IACnE;QACE,KAAK,CACH,gGAAgG,CACjG,CAAC;IACJ,CAAC;CACF;AAPD,0EAOC;AAED;;;;GAIG;AACH,MAAa,oCAAqC,SAAQ,iBAAiB;IACvD,IAAI,GAAW,sCAAsC,CAAC;IACxE;QACE,KAAK,CAAC,2DAA2D,CAAC,CAAC;IACrE,CAAC;CACF;AALD,oFAKC;AAED;;;;GAIG;AACH,MAAa,8BAA+B,SAAQ,iBAAiB;IACjD,IAAI,GAAW,gCAAgC,CAAC;IAClE;QACE,KAAK,CAAC,iEAAiE,CAAC,CAAC;IAC3E,CAAC;CACF;AALD,wEAKC;AAED;;;;;;;;;;GAUG;AACH,MAAa,sBAAuB,SAAQ,iBAAiB;IACzC,IAAI,GAAW,wBAAwB,CAAC;IAC1D;QACE,KAAK,CAAC,sDAAsD,CAAC,CAAC;IAChE,CAAC;CACF;AALD,wDAKC;AAED;;;;;;;;;GASG;AACH,MAAa,2BAA4B,SAAQ,iBAAiB;IAC9C,IAAI,GAAW,6BAA6B,CAAC;IAC/D,YAAY,KAAe;QACzB,KAAK,CAAC,0BAA0B,CAAC,CAAC;QAClC,oEAAoE;QACpE,oEAAoE;QACpE,8DAA8D;QAC9D,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACvB,IAA4B,CAAC,KAAK,GAAG,KAAK,CAAC;QAC9C,CAAC;IACH,CAAC;CACF;AAXD,kEAWC;AAED;;;;GAIG;AACH,MAAa,+BAAgC,SAAQ,iBAAiB;IAClD,IAAI,GAAW,iCAAiC,CAAC;IACnE;QACE,KAAK,CAAC,sDAAsD,CAAC,CAAC;IAChE,CAAC;CACF;AALD,0EAKC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* createShroudAgent — server / Node entry point.
|
|
3
|
+
*
|
|
4
|
+
* Validates configuration, resolves the stealth contract address from the
|
|
5
|
+
* transport's chain, builds an AgentIdentity from the optional master seed,
|
|
6
|
+
* and constructs a ShroudAgent.
|
|
7
|
+
*
|
|
8
|
+
* Privacy: no seed or key bytes ever appear in error messages. Validation
|
|
9
|
+
* errors are short structured reasons only.
|
|
10
|
+
*/
|
|
11
|
+
import { ShroudAgent } from './agent.js';
|
|
12
|
+
import type { ShroudAgentConfig } from './types.js';
|
|
13
|
+
/**
|
|
14
|
+
* Build a fully-wired ShroudAgent from a config.
|
|
15
|
+
*
|
|
16
|
+
* @throws AgentRuntimeError on missing/invalid transport or negative startBlock.
|
|
17
|
+
*/
|
|
18
|
+
export declare function createShroudAgent(config: ShroudAgentConfig): ShroudAgent;
|
|
19
|
+
//# sourceMappingURL=factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src/factory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAGzC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,GAAG,WAAW,CA2BxE"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* createShroudAgent — server / Node entry point.
|
|
4
|
+
*
|
|
5
|
+
* Validates configuration, resolves the stealth contract address from the
|
|
6
|
+
* transport's chain, builds an AgentIdentity from the optional master seed,
|
|
7
|
+
* and constructs a ShroudAgent.
|
|
8
|
+
*
|
|
9
|
+
* Privacy: no seed or key bytes ever appear in error messages. Validation
|
|
10
|
+
* errors are short structured reasons only.
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.createShroudAgent = createShroudAgent;
|
|
14
|
+
const core_1 = require("@shroud-fi/core");
|
|
15
|
+
const transport_1 = require("@shroud-fi/transport");
|
|
16
|
+
const agent_js_1 = require("./agent.js");
|
|
17
|
+
const errors_js_1 = require("./errors.js");
|
|
18
|
+
/**
|
|
19
|
+
* Build a fully-wired ShroudAgent from a config.
|
|
20
|
+
*
|
|
21
|
+
* @throws AgentRuntimeError on missing/invalid transport or negative startBlock.
|
|
22
|
+
*/
|
|
23
|
+
function createShroudAgent(config) {
|
|
24
|
+
if (config.transport === undefined || config.transport.publicClient === undefined) {
|
|
25
|
+
throw new errors_js_1.AgentRuntimeError('transport.publicClient is required');
|
|
26
|
+
}
|
|
27
|
+
if (config.startBlock < 0n) {
|
|
28
|
+
throw new errors_js_1.AgentRuntimeError('startBlock must be non-negative');
|
|
29
|
+
}
|
|
30
|
+
const chainId = config.transport.chain.id;
|
|
31
|
+
const stealthContract = config.stealthContract ?? (0, transport_1.getShroudFiStealth)(chainId);
|
|
32
|
+
const identity = (0, core_1.createAgentIdentity)(config.masterSeed);
|
|
33
|
+
const opts = {
|
|
34
|
+
identity,
|
|
35
|
+
transport: config.transport,
|
|
36
|
+
stealthContract,
|
|
37
|
+
startBlock: config.startBlock,
|
|
38
|
+
...(config.finality !== undefined ? { finality: config.finality } : {}),
|
|
39
|
+
...(config.announcer !== undefined ? { announcer: config.announcer } : {}),
|
|
40
|
+
...(config.autoRegister !== undefined
|
|
41
|
+
? { autoRegister: config.autoRegister }
|
|
42
|
+
: {}),
|
|
43
|
+
};
|
|
44
|
+
return new agent_js_1.ShroudAgent(opts);
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../../src/factory.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;AAcH,8CA2BC;AAvCD,0CAAsD;AACtD,oDAA0D;AAC1D,yCAAyC;AAEzC,2CAAgD;AAGhD;;;;GAIG;AACH,SAAgB,iBAAiB,CAAC,MAAyB;IACzD,IAAI,MAAM,CAAC,SAAS,KAAK,SAAS,IAAI,MAAM,CAAC,SAAS,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;QAClF,MAAM,IAAI,6BAAiB,CAAC,oCAAoC,CAAC,CAAC;IACpE,CAAC;IACD,IAAI,MAAM,CAAC,UAAU,GAAG,EAAE,EAAE,CAAC;QAC3B,MAAM,IAAI,6BAAiB,CAAC,iCAAiC,CAAC,CAAC;IACjE,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;IAC1C,MAAM,eAAe,GACnB,MAAM,CAAC,eAAe,IAAI,IAAA,8BAAkB,EAAC,OAAO,CAAC,CAAC;IAExD,MAAM,QAAQ,GAAG,IAAA,0BAAmB,EAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAExD,MAAM,IAAI,GAA+B;QACvC,QAAQ;QACR,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,eAAe;QACf,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,GAAG,CAAC,MAAM,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACvE,GAAG,CAAC,MAAM,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1E,GAAG,CAAC,MAAM,CAAC,YAAY,KAAK,SAAS;YACnC,CAAC,CAAC,EAAE,YAAY,EAAE,MAAM,CAAC,YAAY,EAAE;YACvC,CAAC,CAAC,EAAE,CAAC;KACR,CAAC;IAEF,OAAO,IAAI,sBAAW,CAAC,IAAI,CAAC,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { ShroudAgent } from './agent.js';
|
|
2
|
+
export { createShroudAgent } from './factory.js';
|
|
3
|
+
export { createShroudAgentFromBrowserWallet, BROWSER_KEY_MESSAGE, HKDF_BROWSER_SALT, HKDF_BROWSER_INFO, } from './browser.js';
|
|
4
|
+
export type { ShroudAgentConfig, ShroudAgentStartOptions, BrowserWalletAdapter, AgentSweepResult, AgentRelayerSweepOptions, AgentRelayerSweepResult, AgentRelayerEthSweepOptions, AgentRelayerEthSweepResult, } from './types.js';
|
|
5
|
+
export { AgentRuntimeError, AgentNotStartedError, AgentAlreadyStartedError, MissingBrowserWalletError, BrowserWalletSignatureRejectedError, RelayerNotAvailableForETHError, RelayerContractNotConfiguredError, EthRelayerEndpointRequiredError, EthRelayerContractNotConfiguredError, AlreadyRegisteredError, AutoRegistrationFailedError, RegistrationRequiresWalletError, } from './errors.js';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EACL,kCAAkC,EAClC,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,cAAc,CAAC;AAGtB,YAAY,EACV,iBAAiB,EACjB,uBAAuB,EACvB,oBAAoB,EACpB,gBAAgB,EAChB,wBAAwB,EACxB,uBAAuB,EACvB,2BAA2B,EAC3B,0BAA0B,GAC3B,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,wBAAwB,EACxB,yBAAyB,EACzB,mCAAmC,EACnC,8BAA8B,EAC9B,iCAAiC,EACjC,+BAA+B,EAC/B,oCAAoC,EACpC,sBAAsB,EACtB,2BAA2B,EAC3B,+BAA+B,GAChC,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Public surface — @shroud-fi/agent-runtime
|
|
3
|
+
//
|
|
4
|
+
// Phase 4: ergonomic wrapper around @shroud-fi/core + @shroud-fi/payments +
|
|
5
|
+
// @shroud-fi/scanning + @shroud-fi/transport. Two construction paths:
|
|
6
|
+
// - createShroudAgent(config) — server / Node / AI agent (deterministic seed)
|
|
7
|
+
// - createShroudAgentFromBrowserWallet(args) — browser (MetaMask-derived seed)
|
|
8
|
+
//
|
|
9
|
+
// Re-exports trimmed to what callers actually need; deeper helpers stay
|
|
10
|
+
// inside the upstream packages.
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.RegistrationRequiresWalletError = exports.AutoRegistrationFailedError = exports.AlreadyRegisteredError = exports.EthRelayerContractNotConfiguredError = exports.EthRelayerEndpointRequiredError = exports.RelayerContractNotConfiguredError = exports.RelayerNotAvailableForETHError = exports.BrowserWalletSignatureRejectedError = exports.MissingBrowserWalletError = exports.AgentAlreadyStartedError = exports.AgentNotStartedError = exports.AgentRuntimeError = exports.HKDF_BROWSER_INFO = exports.HKDF_BROWSER_SALT = exports.BROWSER_KEY_MESSAGE = exports.createShroudAgentFromBrowserWallet = exports.createShroudAgent = exports.ShroudAgent = void 0;
|
|
13
|
+
// Class + factories
|
|
14
|
+
var agent_js_1 = require("./agent.js");
|
|
15
|
+
Object.defineProperty(exports, "ShroudAgent", { enumerable: true, get: function () { return agent_js_1.ShroudAgent; } });
|
|
16
|
+
var factory_js_1 = require("./factory.js");
|
|
17
|
+
Object.defineProperty(exports, "createShroudAgent", { enumerable: true, get: function () { return factory_js_1.createShroudAgent; } });
|
|
18
|
+
var browser_js_1 = require("./browser.js");
|
|
19
|
+
Object.defineProperty(exports, "createShroudAgentFromBrowserWallet", { enumerable: true, get: function () { return browser_js_1.createShroudAgentFromBrowserWallet; } });
|
|
20
|
+
Object.defineProperty(exports, "BROWSER_KEY_MESSAGE", { enumerable: true, get: function () { return browser_js_1.BROWSER_KEY_MESSAGE; } });
|
|
21
|
+
Object.defineProperty(exports, "HKDF_BROWSER_SALT", { enumerable: true, get: function () { return browser_js_1.HKDF_BROWSER_SALT; } });
|
|
22
|
+
Object.defineProperty(exports, "HKDF_BROWSER_INFO", { enumerable: true, get: function () { return browser_js_1.HKDF_BROWSER_INFO; } });
|
|
23
|
+
// Errors
|
|
24
|
+
var errors_js_1 = require("./errors.js");
|
|
25
|
+
Object.defineProperty(exports, "AgentRuntimeError", { enumerable: true, get: function () { return errors_js_1.AgentRuntimeError; } });
|
|
26
|
+
Object.defineProperty(exports, "AgentNotStartedError", { enumerable: true, get: function () { return errors_js_1.AgentNotStartedError; } });
|
|
27
|
+
Object.defineProperty(exports, "AgentAlreadyStartedError", { enumerable: true, get: function () { return errors_js_1.AgentAlreadyStartedError; } });
|
|
28
|
+
Object.defineProperty(exports, "MissingBrowserWalletError", { enumerable: true, get: function () { return errors_js_1.MissingBrowserWalletError; } });
|
|
29
|
+
Object.defineProperty(exports, "BrowserWalletSignatureRejectedError", { enumerable: true, get: function () { return errors_js_1.BrowserWalletSignatureRejectedError; } });
|
|
30
|
+
Object.defineProperty(exports, "RelayerNotAvailableForETHError", { enumerable: true, get: function () { return errors_js_1.RelayerNotAvailableForETHError; } });
|
|
31
|
+
Object.defineProperty(exports, "RelayerContractNotConfiguredError", { enumerable: true, get: function () { return errors_js_1.RelayerContractNotConfiguredError; } });
|
|
32
|
+
Object.defineProperty(exports, "EthRelayerEndpointRequiredError", { enumerable: true, get: function () { return errors_js_1.EthRelayerEndpointRequiredError; } });
|
|
33
|
+
Object.defineProperty(exports, "EthRelayerContractNotConfiguredError", { enumerable: true, get: function () { return errors_js_1.EthRelayerContractNotConfiguredError; } });
|
|
34
|
+
Object.defineProperty(exports, "AlreadyRegisteredError", { enumerable: true, get: function () { return errors_js_1.AlreadyRegisteredError; } });
|
|
35
|
+
Object.defineProperty(exports, "AutoRegistrationFailedError", { enumerable: true, get: function () { return errors_js_1.AutoRegistrationFailedError; } });
|
|
36
|
+
Object.defineProperty(exports, "RegistrationRequiresWalletError", { enumerable: true, get: function () { return errors_js_1.RegistrationRequiresWalletError; } });
|
|
37
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA,4CAA4C;AAC5C,EAAE;AACF,4EAA4E;AAC5E,sEAAsE;AACtE,gFAAgF;AAChF,iFAAiF;AACjF,EAAE;AACF,wEAAwE;AACxE,gCAAgC;;;AAEhC,oBAAoB;AACpB,uCAAyC;AAAhC,uGAAA,WAAW,OAAA;AACpB,2CAAiD;AAAxC,+GAAA,iBAAiB,OAAA;AAC1B,2CAKsB;AAJpB,gIAAA,kCAAkC,OAAA;AAClC,iHAAA,mBAAmB,OAAA;AACnB,+GAAA,iBAAiB,OAAA;AACjB,+GAAA,iBAAiB,OAAA;AAenB,SAAS;AACT,yCAaqB;AAZnB,8GAAA,iBAAiB,OAAA;AACjB,iHAAA,oBAAoB,OAAA;AACpB,qHAAA,wBAAwB,OAAA;AACxB,sHAAA,yBAAyB,OAAA;AACzB,gIAAA,mCAAmC,OAAA;AACnC,2HAAA,8BAA8B,OAAA;AAC9B,8HAAA,iCAAiC,OAAA;AACjC,4HAAA,+BAA+B,OAAA;AAC/B,iIAAA,oCAAoC,OAAA;AACpC,mHAAA,sBAAsB,OAAA;AACtB,wHAAA,2BAA2B,OAAA;AAC3B,4HAAA,+BAA+B,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|