@buildersgarden/siwa 0.0.1 → 0.0.2
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/dist/addresses.d.ts +20 -0
- package/dist/addresses.js +82 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/keystore.js +3 -2
- package/dist/proxy-auth.d.ts +2 -2
- package/dist/proxy-auth.js +2 -2
- package/package.json +3 -2
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* addresses.ts
|
|
3
|
+
*
|
|
4
|
+
* Canonical ERC-8004 contract addresses, chain metadata, and helpers.
|
|
5
|
+
* Published as part of the SDK so consumers don't need to hard-code addresses.
|
|
6
|
+
*/
|
|
7
|
+
export declare const REGISTRY_ADDRESSES: Record<number, string>;
|
|
8
|
+
export declare const REPUTATION_ADDRESSES: Record<number, string>;
|
|
9
|
+
export declare const RPC_ENDPOINTS: Record<number, string>;
|
|
10
|
+
export declare const CHAIN_NAMES: Record<number, string>;
|
|
11
|
+
export declare const FAUCETS: Record<number, string>;
|
|
12
|
+
export declare const BLOCK_EXPLORERS: Record<number, string>;
|
|
13
|
+
/**
|
|
14
|
+
* Get the identity registry address for a chain, or throw if unsupported.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getRegistryAddress(chainId: number): string;
|
|
17
|
+
/**
|
|
18
|
+
* Get the agent registry string in `eip155:{chainId}:{address}` format.
|
|
19
|
+
*/
|
|
20
|
+
export declare function getAgentRegistryString(chainId: number): string;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* addresses.ts
|
|
3
|
+
*
|
|
4
|
+
* Canonical ERC-8004 contract addresses, chain metadata, and helpers.
|
|
5
|
+
* Published as part of the SDK so consumers don't need to hard-code addresses.
|
|
6
|
+
*/
|
|
7
|
+
// ---------------------------------------------------------------------------
|
|
8
|
+
// Identity Registries
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
10
|
+
export const REGISTRY_ADDRESSES = {
|
|
11
|
+
8453: '0x8004A169FB4a3325136EB29fA0ceB6D2e539a432', // Base
|
|
12
|
+
84532: '0x8004A818BFB912233c491871b3d84c89A494BD9e', // Base Sepolia
|
|
13
|
+
11155111: '0x8004a6090Cd10A7288092483047B097295Fb8847', // ETH Sepolia
|
|
14
|
+
59141: '0x8004aa7C931bCE1233973a0C6A667f73F66282e7', // Linea Sepolia
|
|
15
|
+
80002: '0x8004ad19E14B9e0654f73353e8a0B600D46C2898', // Polygon Amoy
|
|
16
|
+
};
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
// Reputation Registries
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
export const REPUTATION_ADDRESSES = {
|
|
21
|
+
8453: '0x8004BAa17C55a88189AE136b182e5fdA19dE9b63', // Base
|
|
22
|
+
84532: '0x8004B663056A597Dffe9eCcC1965A193B7388713', // Base Sepolia
|
|
23
|
+
};
|
|
24
|
+
// ---------------------------------------------------------------------------
|
|
25
|
+
// RPC Endpoints (public, rate-limited)
|
|
26
|
+
// ---------------------------------------------------------------------------
|
|
27
|
+
export const RPC_ENDPOINTS = {
|
|
28
|
+
8453: 'https://mainnet.base.org',
|
|
29
|
+
84532: 'https://sepolia.base.org',
|
|
30
|
+
11155111: 'https://rpc.sepolia.org',
|
|
31
|
+
59141: 'https://rpc.sepolia.linea.build',
|
|
32
|
+
80002: 'https://rpc-amoy.polygon.technology',
|
|
33
|
+
};
|
|
34
|
+
// ---------------------------------------------------------------------------
|
|
35
|
+
// Chain Names
|
|
36
|
+
// ---------------------------------------------------------------------------
|
|
37
|
+
export const CHAIN_NAMES = {
|
|
38
|
+
8453: 'Base',
|
|
39
|
+
84532: 'Base Sepolia',
|
|
40
|
+
11155111: 'Ethereum Sepolia',
|
|
41
|
+
59141: 'Linea Sepolia',
|
|
42
|
+
80002: 'Polygon Amoy',
|
|
43
|
+
};
|
|
44
|
+
// ---------------------------------------------------------------------------
|
|
45
|
+
// Faucets (testnets only)
|
|
46
|
+
// ---------------------------------------------------------------------------
|
|
47
|
+
export const FAUCETS = {
|
|
48
|
+
84532: 'https://www.alchemy.com/faucets/base-sepolia',
|
|
49
|
+
11155111: 'https://www.alchemy.com/faucets/ethereum-sepolia',
|
|
50
|
+
59141: 'https://faucets.chain.link/linea-sepolia',
|
|
51
|
+
80002: 'https://faucet.polygon.technology/',
|
|
52
|
+
};
|
|
53
|
+
// ---------------------------------------------------------------------------
|
|
54
|
+
// Block Explorers
|
|
55
|
+
// ---------------------------------------------------------------------------
|
|
56
|
+
export const BLOCK_EXPLORERS = {
|
|
57
|
+
8453: 'https://basescan.org',
|
|
58
|
+
84532: 'https://sepolia.basescan.org',
|
|
59
|
+
11155111: 'https://sepolia.etherscan.io',
|
|
60
|
+
59141: 'https://sepolia.lineascan.build',
|
|
61
|
+
80002: 'https://amoy.polygonscan.com',
|
|
62
|
+
};
|
|
63
|
+
// ---------------------------------------------------------------------------
|
|
64
|
+
// Helpers
|
|
65
|
+
// ---------------------------------------------------------------------------
|
|
66
|
+
/**
|
|
67
|
+
* Get the identity registry address for a chain, or throw if unsupported.
|
|
68
|
+
*/
|
|
69
|
+
export function getRegistryAddress(chainId) {
|
|
70
|
+
const addr = REGISTRY_ADDRESSES[chainId];
|
|
71
|
+
if (!addr) {
|
|
72
|
+
const supported = Object.keys(REGISTRY_ADDRESSES).join(', ');
|
|
73
|
+
throw new Error(`No identity registry for chainId ${chainId}. Supported: ${supported}`);
|
|
74
|
+
}
|
|
75
|
+
return addr;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Get the agent registry string in `eip155:{chainId}:{address}` format.
|
|
79
|
+
*/
|
|
80
|
+
export function getAgentRegistryString(chainId) {
|
|
81
|
+
return `eip155:${chainId}:${getRegistryAddress(chainId)}`;
|
|
82
|
+
}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/keystore.js
CHANGED
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
import { ethers } from 'ethers';
|
|
38
38
|
import * as fs from 'fs';
|
|
39
39
|
import * as crypto from 'crypto';
|
|
40
|
+
import * as os from 'os';
|
|
40
41
|
import { computeHmac } from './proxy-auth.js';
|
|
41
42
|
// ---------------------------------------------------------------------------
|
|
42
43
|
// Constants
|
|
@@ -116,8 +117,8 @@ function deriveMachinePassword() {
|
|
|
116
117
|
const factors = [
|
|
117
118
|
process.env.USER || process.env.USERNAME || 'agent',
|
|
118
119
|
process.env.HOME || process.env.USERPROFILE || '/tmp',
|
|
119
|
-
|
|
120
|
-
|
|
120
|
+
os.hostname(),
|
|
121
|
+
os.platform(),
|
|
121
122
|
];
|
|
122
123
|
return crypto
|
|
123
124
|
.createHash('sha256')
|
package/dist/proxy-auth.d.ts
CHANGED
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
* - Constant-time comparison via crypto.timingSafeEqual
|
|
11
11
|
*/
|
|
12
12
|
export interface HmacHeaders {
|
|
13
|
-
'X-
|
|
14
|
-
'X-
|
|
13
|
+
'X-Keyring-Timestamp': string;
|
|
14
|
+
'X-Keyring-Signature': string;
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* Compute HMAC-SHA256 headers for an outgoing request.
|
package/dist/proxy-auth.js
CHANGED
|
@@ -22,8 +22,8 @@ export function computeHmac(secret, method, path, body) {
|
|
|
22
22
|
.update(payload)
|
|
23
23
|
.digest('hex');
|
|
24
24
|
return {
|
|
25
|
-
'X-
|
|
26
|
-
'X-
|
|
25
|
+
'X-Keyring-Timestamp': timestamp,
|
|
26
|
+
'X-Keyring-Signature': signature,
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
29
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buildersgarden/siwa",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": { "types": "./dist/index.d.ts", "default": "./dist/index.js" },
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
"./siwa": { "types": "./dist/siwa.d.ts", "default": "./dist/siwa.js" },
|
|
9
9
|
"./memory": { "types": "./dist/memory.d.ts", "default": "./dist/memory.js" },
|
|
10
10
|
"./proxy-auth": { "types": "./dist/proxy-auth.d.ts", "default": "./dist/proxy-auth.js" },
|
|
11
|
-
"./registry": { "types": "./dist/registry.d.ts", "default": "./dist/registry.js" }
|
|
11
|
+
"./registry": { "types": "./dist/registry.d.ts", "default": "./dist/registry.js" },
|
|
12
|
+
"./addresses": { "types": "./dist/addresses.d.ts", "default": "./dist/addresses.js" }
|
|
12
13
|
},
|
|
13
14
|
"main": "./dist/index.js",
|
|
14
15
|
"types": "./dist/index.d.ts",
|