@open-wallet-standard/core 0.4.2 → 0.5.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 +23 -15
- package/index.d.ts +25 -0
- package/index.js +8 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
|
+
<!-- Generated from readme/templates/node.md + readme/partials/ — edit those, then run readme/generate.sh -->
|
|
2
|
+
|
|
1
3
|
# @open-wallet-standard/core
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
Local, policy-gated signing and wallet management for every chain.
|
|
4
6
|
|
|
5
7
|
[](https://www.npmjs.com/package/@open-wallet-standard/core)
|
|
6
8
|
[](https://github.com/open-wallet-standard/core/blob/main/LICENSE)
|
|
7
9
|
|
|
8
10
|
## Why OWS
|
|
9
11
|
|
|
10
|
-
- **
|
|
11
|
-
- **Every chain, one interface.** EVM, Solana, Sui, Bitcoin, Cosmos, Tron, TON — all first-class. CAIP-2/CAIP-10 addressing abstracts away chain-specific details.
|
|
12
|
-
- **Policy before signing.** A pre-signing policy engine gates
|
|
13
|
-
- **Built for agents.**
|
|
12
|
+
- **Local key custody.** Private keys stay encrypted at rest and are decrypted only inside the OWS signing path after the relevant checks pass. Current implementations harden in-process memory handling and wipe key material after use.
|
|
13
|
+
- **Every chain, one interface.** EVM, Solana, Sui, Bitcoin, Cosmos, Tron, TON, Spark, Filecoin — all first-class. CAIP-2/CAIP-10 addressing abstracts away chain-specific details.
|
|
14
|
+
- **Policy before signing.** A pre-signing policy engine gates agent (API key) operations before decryption — chain allowlists, expiry, and optional custom executables.
|
|
15
|
+
- **Built for agents.** Native SDK and CLI today. A wallet created by one tool works in every other.
|
|
14
16
|
|
|
15
17
|
## Install
|
|
16
18
|
|
|
@@ -27,7 +29,7 @@ The package is **fully self-contained** — it embeds the Rust core via native F
|
|
|
27
29
|
import { createWallet, signMessage } from "@open-wallet-standard/core";
|
|
28
30
|
|
|
29
31
|
const wallet = createWallet("agent-treasury");
|
|
30
|
-
// => accounts for EVM, Solana,
|
|
32
|
+
// => accounts for EVM, Solana, Bitcoin, Cosmos, Tron, TON, Filecoin, and Sui
|
|
31
33
|
|
|
32
34
|
const sig = signMessage("agent-treasury", "evm", "hello");
|
|
33
35
|
console.log(sig.signature);
|
|
@@ -36,14 +38,14 @@ console.log(sig.signature);
|
|
|
36
38
|
### CLI
|
|
37
39
|
|
|
38
40
|
```bash
|
|
39
|
-
# Create a wallet (derives addresses for
|
|
41
|
+
# Create a wallet (derives addresses for the current auto-derived chain set)
|
|
40
42
|
ows wallet create --name "agent-treasury"
|
|
41
43
|
|
|
42
44
|
# Sign a message
|
|
43
45
|
ows sign message --wallet agent-treasury --chain evm --message "hello"
|
|
44
46
|
|
|
45
47
|
# Sign a transaction
|
|
46
|
-
ows sign tx --wallet agent-treasury --chain evm --tx
|
|
48
|
+
ows sign tx --wallet agent-treasury --chain evm --tx "deadbeef..."
|
|
47
49
|
```
|
|
48
50
|
|
|
49
51
|
## Supported Chains
|
|
@@ -57,6 +59,7 @@ ows sign tx --wallet agent-treasury --chain evm --tx-hex "deadbeef..."
|
|
|
57
59
|
| Tron | secp256k1 | base58check | `m/44'/195'/0'/0/0` |
|
|
58
60
|
| TON | Ed25519 | raw/bounceable | `m/44'/607'/0'` |
|
|
59
61
|
| Sui | Ed25519 | 0x + BLAKE2b-256 hex | `m/44'/784'/0'/0'/0'` |
|
|
62
|
+
| Spark (Bitcoin L2) | secp256k1 | spark: prefixed | `m/84'/0'/0'/0/0` |
|
|
60
63
|
| Filecoin | secp256k1 | f1 base32 | `m/44'/461'/0'/0/0` |
|
|
61
64
|
|
|
62
65
|
## CLI Reference
|
|
@@ -74,6 +77,11 @@ ows sign tx --wallet agent-treasury --chain evm --tx-hex "deadbeef..."
|
|
|
74
77
|
| `ows fund balance` | Check token balances for a wallet |
|
|
75
78
|
| `ows mnemonic generate` | Generate a BIP-39 mnemonic phrase |
|
|
76
79
|
| `ows mnemonic derive` | Derive an address from a mnemonic |
|
|
80
|
+
| `ows policy create` | Register a policy from a JSON file |
|
|
81
|
+
| `ows policy list` | List all registered policies |
|
|
82
|
+
| `ows key create` | Create an API key for agent access |
|
|
83
|
+
| `ows key list` | List all API keys |
|
|
84
|
+
| `ows key revoke` | Revoke an API key |
|
|
77
85
|
| `ows update` | Update ows and bindings |
|
|
78
86
|
| `ows uninstall` | Remove ows from the system |
|
|
79
87
|
|
|
@@ -82,18 +90,18 @@ ows sign tx --wallet agent-treasury --chain evm --tx-hex "deadbeef..."
|
|
|
82
90
|
```
|
|
83
91
|
Agent / CLI / App
|
|
84
92
|
│
|
|
85
|
-
│ OWS Interface (
|
|
93
|
+
│ OWS Interface (SDK / CLI)
|
|
86
94
|
▼
|
|
87
95
|
┌─────────────────────┐
|
|
88
|
-
│ Access Layer │ 1.
|
|
89
|
-
│ ┌────────────────┐ │ 2. Policy engine evaluates
|
|
90
|
-
│ │ Policy Engine │ │ 3.
|
|
96
|
+
│ Access Layer │ 1. Caller invokes sign()
|
|
97
|
+
│ ┌────────────────┐ │ 2. Policy engine evaluates for API tokens
|
|
98
|
+
│ │ Policy Engine │ │ 3. Key decrypted in hardened memory
|
|
91
99
|
│ │ (pre-signing) │ │ 4. Transaction signed
|
|
92
100
|
│ └───────┬────────┘ │ 5. Key wiped from memory
|
|
93
101
|
│ ┌───────▼────────┐ │ 6. Signature returned
|
|
94
|
-
│ │
|
|
95
|
-
│ │
|
|
96
|
-
│ └───────┬────────┘ │
|
|
102
|
+
│ │ Signing Core │ │
|
|
103
|
+
│ │ (in-process) │ │ The OWS API never returns
|
|
104
|
+
│ └───────┬────────┘ │ raw private keys.
|
|
97
105
|
│ ┌───────▼────────┐ │
|
|
98
106
|
│ │ Wallet Vault │ │
|
|
99
107
|
│ │ ~/.ows/wallets/ │ │
|
package/index.d.ts
CHANGED
|
@@ -60,5 +60,30 @@ export declare function signTransaction(wallet: string, chain: string, txHex: st
|
|
|
60
60
|
export declare function signMessage(wallet: string, chain: string, message: string, passphrase?: string | undefined | null, encoding?: string | undefined | null, index?: number | undefined | null, vaultPathOpt?: string | undefined | null): SignResult
|
|
61
61
|
/** Sign EIP-712 typed structured data (EVM only). Returns hex-encoded signature. */
|
|
62
62
|
export declare function signTypedData(wallet: string, chain: string, typedDataJson: string, passphrase?: string | undefined | null, index?: number | undefined | null, vaultPathOpt?: string | undefined | null): SignResult
|
|
63
|
+
/** Register a policy from a JSON string. */
|
|
64
|
+
export declare function createPolicy(policyJson: string, vaultPathOpt?: string | undefined | null): void
|
|
65
|
+
/** List all registered policies. */
|
|
66
|
+
export declare function listPolicies(vaultPathOpt?: string | undefined | null): Array<any>
|
|
67
|
+
/** Get a single policy by ID. */
|
|
68
|
+
export declare function getPolicy(id: string, vaultPathOpt?: string | undefined | null): any
|
|
69
|
+
/** Delete a policy by ID. */
|
|
70
|
+
export declare function deletePolicy(id: string, vaultPathOpt?: string | undefined | null): void
|
|
71
|
+
/** API key creation result. */
|
|
72
|
+
export interface ApiKeyResult {
|
|
73
|
+
/** The raw token (shown once — caller must save it). */
|
|
74
|
+
token: string
|
|
75
|
+
/** The key file ID. */
|
|
76
|
+
id: string
|
|
77
|
+
name: string
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Create an API key for agent access to wallets.
|
|
81
|
+
* Returns the raw token (shown once) and key metadata.
|
|
82
|
+
*/
|
|
83
|
+
export declare function createApiKey(name: string, walletIds: Array<string>, policyIds: Array<string>, passphrase: string, expiresAt?: string | undefined | null, vaultPathOpt?: string | undefined | null): ApiKeyResult
|
|
84
|
+
/** List all API keys (tokens are never returned). */
|
|
85
|
+
export declare function listApiKeys(vaultPathOpt?: string | undefined | null): Array<any>
|
|
86
|
+
/** Revoke (delete) an API key by ID. */
|
|
87
|
+
export declare function revokeApiKey(id: string, vaultPathOpt?: string | undefined | null): void
|
|
63
88
|
/** Sign and broadcast a transaction. Returns the transaction hash. */
|
|
64
89
|
export declare function signAndSend(wallet: string, chain: string, txHex: string, passphrase?: string | undefined | null, index?: number | undefined | null, rpcUrl?: string | undefined | null, vaultPathOpt?: string | undefined | null): SendResult
|
package/index.js
CHANGED
|
@@ -310,7 +310,7 @@ if (!nativeBinding) {
|
|
|
310
310
|
throw new Error(`Failed to load native binding`)
|
|
311
311
|
}
|
|
312
312
|
|
|
313
|
-
const { generateMnemonic, deriveAddress, createWallet, importWalletMnemonic, importWalletPrivateKey, listWallets, getWallet, deleteWallet, exportWallet, renameWallet, signTransaction, signMessage, signTypedData, signAndSend } = nativeBinding
|
|
313
|
+
const { generateMnemonic, deriveAddress, createWallet, importWalletMnemonic, importWalletPrivateKey, listWallets, getWallet, deleteWallet, exportWallet, renameWallet, signTransaction, signMessage, signTypedData, createPolicy, listPolicies, getPolicy, deletePolicy, createApiKey, listApiKeys, revokeApiKey, signAndSend } = nativeBinding
|
|
314
314
|
|
|
315
315
|
module.exports.generateMnemonic = generateMnemonic
|
|
316
316
|
module.exports.deriveAddress = deriveAddress
|
|
@@ -325,4 +325,11 @@ module.exports.renameWallet = renameWallet
|
|
|
325
325
|
module.exports.signTransaction = signTransaction
|
|
326
326
|
module.exports.signMessage = signMessage
|
|
327
327
|
module.exports.signTypedData = signTypedData
|
|
328
|
+
module.exports.createPolicy = createPolicy
|
|
329
|
+
module.exports.listPolicies = listPolicies
|
|
330
|
+
module.exports.getPolicy = getPolicy
|
|
331
|
+
module.exports.deletePolicy = deletePolicy
|
|
332
|
+
module.exports.createApiKey = createApiKey
|
|
333
|
+
module.exports.listApiKeys = listApiKeys
|
|
334
|
+
module.exports.revokeApiKey = revokeApiKey
|
|
328
335
|
module.exports.signAndSend = signAndSend
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-wallet-standard/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Node.js native bindings for the Open Wallet Standard",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"@napi-rs/cli": "^2.18.0"
|
|
32
32
|
},
|
|
33
33
|
"optionalDependencies": {
|
|
34
|
-
"@open-wallet-standard/core-linux-x64-gnu": "0.
|
|
35
|
-
"@open-wallet-standard/core-linux-arm64-gnu": "0.
|
|
36
|
-
"@open-wallet-standard/core-darwin-x64": "0.
|
|
37
|
-
"@open-wallet-standard/core-darwin-arm64": "0.
|
|
34
|
+
"@open-wallet-standard/core-linux-x64-gnu": "0.5.0",
|
|
35
|
+
"@open-wallet-standard/core-linux-arm64-gnu": "0.5.0",
|
|
36
|
+
"@open-wallet-standard/core-darwin-x64": "0.5.0",
|
|
37
|
+
"@open-wallet-standard/core-darwin-arm64": "0.5.0"
|
|
38
38
|
},
|
|
39
39
|
"license": "MIT",
|
|
40
40
|
"files": [
|