@kadi.build/deploy-ability 0.0.6 → 0.0.8
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/.env-example +72 -0
- package/README.md +240 -0
- package/dist/errors/error-utils.d.ts +31 -0
- package/dist/errors/error-utils.d.ts.map +1 -0
- package/dist/errors/error-utils.js +44 -0
- package/dist/errors/error-utils.js.map +1 -0
- package/dist/errors/index.d.ts +1 -0
- package/dist/errors/index.d.ts.map +1 -1
- package/dist/errors/index.js +2 -0
- package/dist/errors/index.js.map +1 -1
- package/dist/targets/akash/certificate-manager.d.ts.map +1 -1
- package/dist/targets/akash/certificate-manager.js +11 -6
- package/dist/targets/akash/certificate-manager.js.map +1 -1
- package/dist/targets/akash/client.d.ts.map +1 -1
- package/dist/targets/akash/client.js +18 -11
- package/dist/targets/akash/client.js.map +1 -1
- package/dist/targets/akash/deployer.d.ts +64 -3
- package/dist/targets/akash/deployer.d.ts.map +1 -1
- package/dist/targets/akash/deployer.js +169 -10
- package/dist/targets/akash/deployer.js.map +1 -1
- package/dist/targets/akash/index.d.ts +86 -2
- package/dist/targets/akash/index.d.ts.map +1 -1
- package/dist/targets/akash/index.js +49 -2
- package/dist/targets/akash/index.js.map +1 -1
- package/dist/targets/akash/provider-manager.d.ts.map +1 -1
- package/dist/targets/akash/provider-manager.js +15 -9
- package/dist/targets/akash/provider-manager.js.map +1 -1
- package/dist/targets/akash/sdl-generator.js +9 -3
- package/dist/targets/akash/sdl-generator.js.map +1 -1
- package/dist/targets/akash/secrets-provider.d.ts +189 -0
- package/dist/targets/akash/secrets-provider.d.ts.map +1 -0
- package/dist/targets/akash/secrets-provider.js +249 -0
- package/dist/targets/akash/secrets-provider.js.map +1 -0
- package/dist/targets/akash/types.d.ts +96 -0
- package/dist/targets/akash/types.d.ts.map +1 -1
- package/dist/targets/akash/wallet-manager.d.ts +21 -3
- package/dist/targets/akash/wallet-manager.d.ts.map +1 -1
- package/dist/targets/akash/wallet-manager.js +152 -18
- package/dist/targets/akash/wallet-manager.js.map +1 -1
- package/dist/targets/local/deployer.d.ts.map +1 -1
- package/dist/targets/local/deployer.js +23 -13
- package/dist/targets/local/deployer.js.map +1 -1
- package/dist/targets/local/network-manager.d.ts.map +1 -1
- package/dist/targets/local/network-manager.js +4 -3
- package/dist/targets/local/network-manager.js.map +1 -1
- package/dist/types/common.d.ts +106 -23
- package/dist/types/common.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/options.d.ts +83 -1
- package/dist/types/options.d.ts.map +1 -1
- package/dist/types/profiles.d.ts +11 -3
- package/dist/types/profiles.d.ts.map +1 -1
- package/dist/types/profiles.js.map +1 -1
- package/dist/utils/registry/manager.d.ts +10 -9
- package/dist/utils/registry/manager.d.ts.map +1 -1
- package/dist/utils/registry/manager.js +41 -24
- package/dist/utils/registry/manager.js.map +1 -1
- package/dist/utils/registry/setup.d.ts +2 -2
- package/dist/utils/registry/setup.d.ts.map +1 -1
- package/dist/utils/registry/setup.js +7 -5
- package/dist/utils/registry/setup.js.map +1 -1
- package/dist/utils/registry/transformer.d.ts +1 -1
- package/dist/utils/registry/transformer.js +1 -1
- package/dist/utils/registry/types.d.ts +36 -12
- package/dist/utils/registry/types.d.ts.map +1 -1
- package/package.json +4 -3
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Secrets Provider for Akash Autonomous Deployments
|
|
3
|
+
*
|
|
4
|
+
* Integrates with KADI's secret-ability to securely retrieve
|
|
5
|
+
* wallet mnemonics and certificates from local vaults.
|
|
6
|
+
*
|
|
7
|
+
* Uses a "global" vault stored in ~/.kadi/akash-secrets.toml
|
|
8
|
+
* for machine-level secrets (not project-specific).
|
|
9
|
+
*/
|
|
10
|
+
import type { SecretsProvider } from './types.js';
|
|
11
|
+
/**
|
|
12
|
+
* Default vault name for Akash secrets.
|
|
13
|
+
* This vault uses 'age' encryption with OS keychain for master key.
|
|
14
|
+
*/
|
|
15
|
+
export declare const AKASH_VAULT_NAME = "global";
|
|
16
|
+
/**
|
|
17
|
+
* Global config path for machine-level secrets.
|
|
18
|
+
* Stored in ~/.kadi/secrets/config.toml (not project-specific).
|
|
19
|
+
*/
|
|
20
|
+
export declare const GLOBAL_CONFIG_PATH: string;
|
|
21
|
+
/**
|
|
22
|
+
* Key names for Akash secrets in the vault.
|
|
23
|
+
* These are the standardized key names used across the KADI ecosystem.
|
|
24
|
+
*/
|
|
25
|
+
export declare const AKASH_SECRET_KEYS: {
|
|
26
|
+
/**
|
|
27
|
+
* BIP39 mnemonic phrase for the Akash wallet (12 or 24 words).
|
|
28
|
+
* Example: "abandon abandon abandon ... about"
|
|
29
|
+
*/
|
|
30
|
+
readonly WALLET_MNEMONIC: "AKASH_WALLET";
|
|
31
|
+
/**
|
|
32
|
+
* Cached TLS certificate for Akash provider communication.
|
|
33
|
+
* Stored as JSON: { cert: string, pubkey: string, privkey: string }
|
|
34
|
+
*/
|
|
35
|
+
readonly TLS_CERTIFICATE: "akash-tls-certificate";
|
|
36
|
+
/**
|
|
37
|
+
* Optional: Wallet password if the mnemonic is BIP39 password-protected.
|
|
38
|
+
* Most wallets don't use this, but we support it.
|
|
39
|
+
*/
|
|
40
|
+
readonly WALLET_PASSWORD: "akash-wallet-password";
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Configuration for the secrets provider.
|
|
44
|
+
*/
|
|
45
|
+
export interface SecretsProviderConfig {
|
|
46
|
+
/**
|
|
47
|
+
* Path to the secrets TOML config file.
|
|
48
|
+
* Defaults to ~/.kadi/akash-secrets.toml for global vault.
|
|
49
|
+
*/
|
|
50
|
+
configPath?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Vault name to use within the config file.
|
|
53
|
+
* Defaults to 'akash'.
|
|
54
|
+
*/
|
|
55
|
+
vaultName?: string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Certificate data structure for vault storage.
|
|
59
|
+
* Maps to/from AkashProviderTlsCertificate.
|
|
60
|
+
*/
|
|
61
|
+
export interface StoredCertificateData {
|
|
62
|
+
cert: string;
|
|
63
|
+
privateKey: string;
|
|
64
|
+
publicKey: string;
|
|
65
|
+
chain?: string;
|
|
66
|
+
createdAt?: string;
|
|
67
|
+
expiresAt?: string;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Interface matching secret-ability's tool invocation pattern.
|
|
71
|
+
* This allows the provider to work with KADI's agent infrastructure.
|
|
72
|
+
*/
|
|
73
|
+
export interface SecretAbilityClient {
|
|
74
|
+
invoke(tool: 'get', params: {
|
|
75
|
+
configPath?: string;
|
|
76
|
+
vault: string;
|
|
77
|
+
key: string;
|
|
78
|
+
}): Promise<{
|
|
79
|
+
value: string;
|
|
80
|
+
}>;
|
|
81
|
+
invoke(tool: 'set', params: {
|
|
82
|
+
configPath?: string;
|
|
83
|
+
vault: string;
|
|
84
|
+
key: string;
|
|
85
|
+
value: string;
|
|
86
|
+
}): Promise<void>;
|
|
87
|
+
invoke(tool: 'exists', params: {
|
|
88
|
+
configPath?: string;
|
|
89
|
+
vault: string;
|
|
90
|
+
key: string;
|
|
91
|
+
}): Promise<{
|
|
92
|
+
exists: boolean;
|
|
93
|
+
}>;
|
|
94
|
+
invoke(tool: 'config.createVault', params: {
|
|
95
|
+
configPath?: string;
|
|
96
|
+
name: string;
|
|
97
|
+
type: 'age' | 'kadi';
|
|
98
|
+
}): Promise<{
|
|
99
|
+
vault: string;
|
|
100
|
+
type: string;
|
|
101
|
+
}>;
|
|
102
|
+
invoke(tool: 'list', params: {
|
|
103
|
+
configPath?: string;
|
|
104
|
+
vault: string;
|
|
105
|
+
}): Promise<{
|
|
106
|
+
keys: string[];
|
|
107
|
+
}>;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Create a SecretsProvider that integrates with secret-ability.
|
|
111
|
+
*
|
|
112
|
+
* This provider retrieves secrets from a local 'age' vault encrypted
|
|
113
|
+
* with ChaCha20-Poly1305, with the master key stored in the OS keychain.
|
|
114
|
+
*
|
|
115
|
+
* @param client - The secret-ability client (from KADI agent)
|
|
116
|
+
* @param config - Optional configuration overrides
|
|
117
|
+
* @returns A SecretsProvider for autonomous deployments
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```typescript
|
|
121
|
+
* // In KADI agent context:
|
|
122
|
+
* const secrets = createSecretsProvider(this.secrets);
|
|
123
|
+
*
|
|
124
|
+
* // Use in autonomous deployment:
|
|
125
|
+
* await deployToAkash({
|
|
126
|
+
* autonomous: {
|
|
127
|
+
* secrets,
|
|
128
|
+
* bidStrategy: 'cheapest',
|
|
129
|
+
* },
|
|
130
|
+
* profile: myProfile,
|
|
131
|
+
* });
|
|
132
|
+
* ```
|
|
133
|
+
*/
|
|
134
|
+
export declare function createSecretsProvider(client: SecretAbilityClient, config?: SecretsProviderConfig): SecretsProvider;
|
|
135
|
+
/**
|
|
136
|
+
* Initialize the Akash secrets vault.
|
|
137
|
+
* Call this once to set up the vault before storing secrets.
|
|
138
|
+
*
|
|
139
|
+
* @param client - The secret-ability client
|
|
140
|
+
* @param config - Optional configuration overrides
|
|
141
|
+
*
|
|
142
|
+
* @example
|
|
143
|
+
* ```typescript
|
|
144
|
+
* // Set up the vault:
|
|
145
|
+
* await initializeAkashVault(this.secrets);
|
|
146
|
+
*
|
|
147
|
+
* // Then store the mnemonic:
|
|
148
|
+
* await this.secrets.invoke('set', {
|
|
149
|
+
* configPath: GLOBAL_CONFIG_PATH,
|
|
150
|
+
* vault: 'akash',
|
|
151
|
+
* key: 'akash-wallet-mnemonic',
|
|
152
|
+
* value: 'your 24 word mnemonic phrase here',
|
|
153
|
+
* });
|
|
154
|
+
* ```
|
|
155
|
+
*/
|
|
156
|
+
export declare function initializeAkashVault(client: SecretAbilityClient, config?: SecretsProviderConfig): Promise<void>;
|
|
157
|
+
/**
|
|
158
|
+
* Check if the Akash vault has all required secrets configured.
|
|
159
|
+
*
|
|
160
|
+
* @param client - The secret-ability client
|
|
161
|
+
* @param config - Optional configuration overrides
|
|
162
|
+
* @returns Object indicating which secrets are present
|
|
163
|
+
*/
|
|
164
|
+
export declare function checkAkashVaultStatus(client: SecretAbilityClient, config?: SecretsProviderConfig): Promise<{
|
|
165
|
+
vaultExists: boolean;
|
|
166
|
+
hasMnemonic: boolean;
|
|
167
|
+
hasCertificate: boolean;
|
|
168
|
+
keys: string[];
|
|
169
|
+
}>;
|
|
170
|
+
/**
|
|
171
|
+
* Create a simple SecretsProvider from a raw mnemonic.
|
|
172
|
+
* Use this for testing or when secret-ability is not available.
|
|
173
|
+
*
|
|
174
|
+
* ⚠️ WARNING: This stores the mnemonic in memory. For production use,
|
|
175
|
+
* prefer createSecretsProvider() with secret-ability integration.
|
|
176
|
+
*
|
|
177
|
+
* @param mnemonic - The BIP39 mnemonic phrase
|
|
178
|
+
* @returns A SecretsProvider for autonomous deployments
|
|
179
|
+
*
|
|
180
|
+
* @example
|
|
181
|
+
* ```typescript
|
|
182
|
+
* // For testing only:
|
|
183
|
+
* const secrets = createSimpleMnemonicProvider(
|
|
184
|
+
* 'abandon abandon abandon ... about'
|
|
185
|
+
* );
|
|
186
|
+
* ```
|
|
187
|
+
*/
|
|
188
|
+
export declare function createSimpleMnemonicProvider(mnemonic: string): SecretsProvider;
|
|
189
|
+
//# sourceMappingURL=secrets-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secrets-provider.d.ts","sourceRoot":"","sources":["../../../src/targets/akash/secrets-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,eAAe,EAA+B,MAAM,YAAY,CAAC;AAM/E;;;GAGG;AACH,eAAO,MAAM,gBAAgB,WAAW,CAAC;AAEzC;;;GAGG;AACH,eAAO,MAAM,kBAAkB,QAA6D,CAAC;AAE7F;;;GAGG;AACH,eAAO,MAAM,iBAAiB;IAC5B;;;OAGG;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AC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,KAAK,GAAG,MAAM,CAAA;KAAE,GAClE,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAE5C,MAAM,CACJ,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAC7C,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;CAChC;AAMD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,mBAAmB,EAC3B,MAAM,GAAE,qBAA0B,GACjC,eAAe,CAwEjB;AAMD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,mBAAmB,EAC3B,MAAM,GAAE,qBAA0B,GACjC,OAAO,CAAC,IAAI,CAAC,CAiBf;AAED;;;;;;GAMG;AACH,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,mBAAmB,EAC3B,MAAM,GAAE,qBAA0B,GACjC,OAAO,CAAC;IACT,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,cAAc,EAAE,OAAO,CAAC;IACxB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB,CAAC,CAwBD;AAMD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,MAAM,GAAG,eAAe,CAgB9E"}
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Secrets Provider for Akash Autonomous Deployments
|
|
3
|
+
*
|
|
4
|
+
* Integrates with KADI's secret-ability to securely retrieve
|
|
5
|
+
* wallet mnemonics and certificates from local vaults.
|
|
6
|
+
*
|
|
7
|
+
* Uses a "global" vault stored in ~/.kadi/akash-secrets.toml
|
|
8
|
+
* for machine-level secrets (not project-specific).
|
|
9
|
+
*/
|
|
10
|
+
import * as os from 'node:os';
|
|
11
|
+
import * as path from 'node:path';
|
|
12
|
+
// =============================================================================
|
|
13
|
+
// Constants - Key Names and Vault Configuration
|
|
14
|
+
// =============================================================================
|
|
15
|
+
/**
|
|
16
|
+
* Default vault name for Akash secrets.
|
|
17
|
+
* This vault uses 'age' encryption with OS keychain for master key.
|
|
18
|
+
*/
|
|
19
|
+
export const AKASH_VAULT_NAME = 'global';
|
|
20
|
+
/**
|
|
21
|
+
* Global config path for machine-level secrets.
|
|
22
|
+
* Stored in ~/.kadi/secrets/config.toml (not project-specific).
|
|
23
|
+
*/
|
|
24
|
+
export const GLOBAL_CONFIG_PATH = path.join(os.homedir(), '.kadi', 'secrets', 'config.toml');
|
|
25
|
+
/**
|
|
26
|
+
* Key names for Akash secrets in the vault.
|
|
27
|
+
* These are the standardized key names used across the KADI ecosystem.
|
|
28
|
+
*/
|
|
29
|
+
export const AKASH_SECRET_KEYS = {
|
|
30
|
+
/**
|
|
31
|
+
* BIP39 mnemonic phrase for the Akash wallet (12 or 24 words).
|
|
32
|
+
* Example: "abandon abandon abandon ... about"
|
|
33
|
+
*/
|
|
34
|
+
WALLET_MNEMONIC: 'AKASH_WALLET',
|
|
35
|
+
/**
|
|
36
|
+
* Cached TLS certificate for Akash provider communication.
|
|
37
|
+
* Stored as JSON: { cert: string, pubkey: string, privkey: string }
|
|
38
|
+
*/
|
|
39
|
+
TLS_CERTIFICATE: 'akash-tls-certificate',
|
|
40
|
+
/**
|
|
41
|
+
* Optional: Wallet password if the mnemonic is BIP39 password-protected.
|
|
42
|
+
* Most wallets don't use this, but we support it.
|
|
43
|
+
*/
|
|
44
|
+
WALLET_PASSWORD: 'akash-wallet-password',
|
|
45
|
+
};
|
|
46
|
+
// =============================================================================
|
|
47
|
+
// SecretsProvider Implementation
|
|
48
|
+
// =============================================================================
|
|
49
|
+
/**
|
|
50
|
+
* Create a SecretsProvider that integrates with secret-ability.
|
|
51
|
+
*
|
|
52
|
+
* This provider retrieves secrets from a local 'age' vault encrypted
|
|
53
|
+
* with ChaCha20-Poly1305, with the master key stored in the OS keychain.
|
|
54
|
+
*
|
|
55
|
+
* @param client - The secret-ability client (from KADI agent)
|
|
56
|
+
* @param config - Optional configuration overrides
|
|
57
|
+
* @returns A SecretsProvider for autonomous deployments
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```typescript
|
|
61
|
+
* // In KADI agent context:
|
|
62
|
+
* const secrets = createSecretsProvider(this.secrets);
|
|
63
|
+
*
|
|
64
|
+
* // Use in autonomous deployment:
|
|
65
|
+
* await deployToAkash({
|
|
66
|
+
* autonomous: {
|
|
67
|
+
* secrets,
|
|
68
|
+
* bidStrategy: 'cheapest',
|
|
69
|
+
* },
|
|
70
|
+
* profile: myProfile,
|
|
71
|
+
* });
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
export function createSecretsProvider(client, config = {}) {
|
|
75
|
+
const configPath = config.configPath ?? GLOBAL_CONFIG_PATH;
|
|
76
|
+
const vaultName = config.vaultName ?? AKASH_VAULT_NAME;
|
|
77
|
+
return {
|
|
78
|
+
async getMnemonic() {
|
|
79
|
+
try {
|
|
80
|
+
const result = await client.invoke('get', {
|
|
81
|
+
configPath,
|
|
82
|
+
vault: vaultName,
|
|
83
|
+
key: AKASH_SECRET_KEYS.WALLET_MNEMONIC,
|
|
84
|
+
});
|
|
85
|
+
return result.value;
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
89
|
+
throw new Error(`Failed to retrieve Akash wallet mnemonic from vault '${vaultName}': ${message}. ` +
|
|
90
|
+
`Make sure you have stored the mnemonic using: ` +
|
|
91
|
+
`secrets.invoke('set', { configPath: '${configPath}', vault: '${vaultName}', ` +
|
|
92
|
+
`key: '${AKASH_SECRET_KEYS.WALLET_MNEMONIC}', value: '<your-mnemonic>' })`);
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
async getCertificate() {
|
|
96
|
+
try {
|
|
97
|
+
// Check if certificate exists
|
|
98
|
+
const { exists } = await client.invoke('exists', {
|
|
99
|
+
configPath,
|
|
100
|
+
vault: vaultName,
|
|
101
|
+
key: AKASH_SECRET_KEYS.TLS_CERTIFICATE,
|
|
102
|
+
});
|
|
103
|
+
if (!exists) {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
const result = await client.invoke('get', {
|
|
107
|
+
configPath,
|
|
108
|
+
vault: vaultName,
|
|
109
|
+
key: AKASH_SECRET_KEYS.TLS_CERTIFICATE,
|
|
110
|
+
});
|
|
111
|
+
const stored = JSON.parse(result.value);
|
|
112
|
+
return {
|
|
113
|
+
cert: stored.cert,
|
|
114
|
+
privateKey: stored.privateKey,
|
|
115
|
+
publicKey: stored.publicKey,
|
|
116
|
+
chain: stored.chain,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
// Certificate retrieval is optional - return null on error
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
async storeCertificate(cert) {
|
|
125
|
+
const stored = {
|
|
126
|
+
cert: cert.cert,
|
|
127
|
+
privateKey: cert.privateKey,
|
|
128
|
+
publicKey: cert.publicKey,
|
|
129
|
+
chain: cert.chain,
|
|
130
|
+
createdAt: new Date().toISOString(),
|
|
131
|
+
};
|
|
132
|
+
await client.invoke('set', {
|
|
133
|
+
configPath,
|
|
134
|
+
vault: vaultName,
|
|
135
|
+
key: AKASH_SECRET_KEYS.TLS_CERTIFICATE,
|
|
136
|
+
value: JSON.stringify(stored),
|
|
137
|
+
});
|
|
138
|
+
},
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
// =============================================================================
|
|
142
|
+
// Vault Setup Utilities
|
|
143
|
+
// =============================================================================
|
|
144
|
+
/**
|
|
145
|
+
* Initialize the Akash secrets vault.
|
|
146
|
+
* Call this once to set up the vault before storing secrets.
|
|
147
|
+
*
|
|
148
|
+
* @param client - The secret-ability client
|
|
149
|
+
* @param config - Optional configuration overrides
|
|
150
|
+
*
|
|
151
|
+
* @example
|
|
152
|
+
* ```typescript
|
|
153
|
+
* // Set up the vault:
|
|
154
|
+
* await initializeAkashVault(this.secrets);
|
|
155
|
+
*
|
|
156
|
+
* // Then store the mnemonic:
|
|
157
|
+
* await this.secrets.invoke('set', {
|
|
158
|
+
* configPath: GLOBAL_CONFIG_PATH,
|
|
159
|
+
* vault: 'akash',
|
|
160
|
+
* key: 'akash-wallet-mnemonic',
|
|
161
|
+
* value: 'your 24 word mnemonic phrase here',
|
|
162
|
+
* });
|
|
163
|
+
* ```
|
|
164
|
+
*/
|
|
165
|
+
export async function initializeAkashVault(client, config = {}) {
|
|
166
|
+
const configPath = config.configPath ?? GLOBAL_CONFIG_PATH;
|
|
167
|
+
const vaultName = config.vaultName ?? AKASH_VAULT_NAME;
|
|
168
|
+
try {
|
|
169
|
+
await client.invoke('config.createVault', {
|
|
170
|
+
configPath,
|
|
171
|
+
name: vaultName,
|
|
172
|
+
type: 'age',
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
catch (error) {
|
|
176
|
+
// Vault might already exist - that's okay
|
|
177
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
178
|
+
if (!message.includes('already exists')) {
|
|
179
|
+
throw error;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Check if the Akash vault has all required secrets configured.
|
|
185
|
+
*
|
|
186
|
+
* @param client - The secret-ability client
|
|
187
|
+
* @param config - Optional configuration overrides
|
|
188
|
+
* @returns Object indicating which secrets are present
|
|
189
|
+
*/
|
|
190
|
+
export async function checkAkashVaultStatus(client, config = {}) {
|
|
191
|
+
const configPath = config.configPath ?? GLOBAL_CONFIG_PATH;
|
|
192
|
+
const vaultName = config.vaultName ?? AKASH_VAULT_NAME;
|
|
193
|
+
try {
|
|
194
|
+
const { keys } = await client.invoke('list', {
|
|
195
|
+
configPath,
|
|
196
|
+
vault: vaultName,
|
|
197
|
+
});
|
|
198
|
+
return {
|
|
199
|
+
vaultExists: true,
|
|
200
|
+
hasMnemonic: keys.includes(AKASH_SECRET_KEYS.WALLET_MNEMONIC),
|
|
201
|
+
hasCertificate: keys.includes(AKASH_SECRET_KEYS.TLS_CERTIFICATE),
|
|
202
|
+
keys,
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
catch {
|
|
206
|
+
return {
|
|
207
|
+
vaultExists: false,
|
|
208
|
+
hasMnemonic: false,
|
|
209
|
+
hasCertificate: false,
|
|
210
|
+
keys: [],
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
// =============================================================================
|
|
215
|
+
// Simple Mnemonic Provider (No Secret-Ability Required)
|
|
216
|
+
// =============================================================================
|
|
217
|
+
/**
|
|
218
|
+
* Create a simple SecretsProvider from a raw mnemonic.
|
|
219
|
+
* Use this for testing or when secret-ability is not available.
|
|
220
|
+
*
|
|
221
|
+
* ⚠️ WARNING: This stores the mnemonic in memory. For production use,
|
|
222
|
+
* prefer createSecretsProvider() with secret-ability integration.
|
|
223
|
+
*
|
|
224
|
+
* @param mnemonic - The BIP39 mnemonic phrase
|
|
225
|
+
* @returns A SecretsProvider for autonomous deployments
|
|
226
|
+
*
|
|
227
|
+
* @example
|
|
228
|
+
* ```typescript
|
|
229
|
+
* // For testing only:
|
|
230
|
+
* const secrets = createSimpleMnemonicProvider(
|
|
231
|
+
* 'abandon abandon abandon ... about'
|
|
232
|
+
* );
|
|
233
|
+
* ```
|
|
234
|
+
*/
|
|
235
|
+
export function createSimpleMnemonicProvider(mnemonic) {
|
|
236
|
+
let cachedCertificate = null;
|
|
237
|
+
return {
|
|
238
|
+
async getMnemonic() {
|
|
239
|
+
return mnemonic;
|
|
240
|
+
},
|
|
241
|
+
async getCertificate() {
|
|
242
|
+
return cachedCertificate;
|
|
243
|
+
},
|
|
244
|
+
async storeCertificate(cert) {
|
|
245
|
+
cachedCertificate = cert;
|
|
246
|
+
},
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
//# sourceMappingURL=secrets-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secrets-provider.js","sourceRoot":"","sources":["../../../src/targets/akash/secrets-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAGlC,gFAAgF;AAChF,gDAAgD;AAChD,gFAAgF;AAEhF;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAEzC;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC;AAE7F;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B;;;OAGG;IACH,eAAe,EAAE,cAAc;IAE/B;;;OAGG;IACH,eAAe,EAAE,uBAAuB;IAExC;;;OAGG;IACH,eAAe,EAAE,uBAAuB;CAChC,CAAC;AAwEX,gFAAgF;AAChF,iCAAiC;AACjC,gFAAgF;AAEhF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,qBAAqB,CACnC,MAA2B,EAC3B,SAAgC,EAAE;IAElC,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,IAAI,kBAAkB,CAAC;IAC3D,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,IAAI,gBAAgB,CAAC;IAEvD,OAAO;QACL,KAAK,CAAC,WAAW;YACf,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE;oBACxC,UAAU;oB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,100 @@ export interface LeaseDetails {
|
|
|
105
105
|
};
|
|
106
106
|
readonly createdAt: string;
|
|
107
107
|
}
|
|
108
|
+
/**
|
|
109
|
+
* Interface for retrieving deployment secrets
|
|
110
|
+
*
|
|
111
|
+
* Agents implement this interface to provide wallet credentials and certificate storage
|
|
112
|
+
* for fully automated deployments without user interaction.
|
|
113
|
+
*
|
|
114
|
+
* **SECURITY:** Implementations should retrieve secrets from secure storage
|
|
115
|
+
* (e.g., encrypted vault, KMS, secure environment variables).
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* ```typescript
|
|
119
|
+
* const secretsProvider: SecretsProvider = {
|
|
120
|
+
* getMnemonic: async () => {
|
|
121
|
+
* // Retrieve from secure storage
|
|
122
|
+
* return await vault.getSecret('akash-wallet-mnemonic');
|
|
123
|
+
* },
|
|
124
|
+
* getCertificate: async () => {
|
|
125
|
+
* // Return cached cert or null to generate new
|
|
126
|
+
* return await storage.get('akash-certificate');
|
|
127
|
+
* },
|
|
128
|
+
* storeCertificate: async (cert) => {
|
|
129
|
+
* // Cache for future deployments
|
|
130
|
+
* await storage.set('akash-certificate', cert);
|
|
131
|
+
* }
|
|
132
|
+
* };
|
|
133
|
+
* ```
|
|
134
|
+
*/
|
|
135
|
+
export interface SecretsProvider {
|
|
136
|
+
/**
|
|
137
|
+
* Retrieve the mnemonic phrase for the deployment wallet
|
|
138
|
+
*
|
|
139
|
+
* Called once at the start of deployment to create the signing wallet.
|
|
140
|
+
* The mnemonic should be a valid BIP39 phrase (12 or 24 words).
|
|
141
|
+
*
|
|
142
|
+
* @returns The mnemonic phrase
|
|
143
|
+
* @throws If mnemonic cannot be retrieved
|
|
144
|
+
*/
|
|
145
|
+
getMnemonic(): Promise<string>;
|
|
146
|
+
/**
|
|
147
|
+
* Retrieve an existing TLS certificate (optional)
|
|
148
|
+
*
|
|
149
|
+
* If a valid certificate is returned, it will be used for provider communication.
|
|
150
|
+
* If null is returned, a new certificate will be generated and broadcast.
|
|
151
|
+
*
|
|
152
|
+
* Providing a cached certificate saves one blockchain transaction (~0.01 AKT).
|
|
153
|
+
*
|
|
154
|
+
* @returns Existing certificate or null to generate new
|
|
155
|
+
*/
|
|
156
|
+
getCertificate?(): Promise<AkashProviderTlsCertificate | null>;
|
|
157
|
+
/**
|
|
158
|
+
* Store a newly generated certificate (optional)
|
|
159
|
+
*
|
|
160
|
+
* Called when a new certificate is generated and broadcast to the blockchain.
|
|
161
|
+
* Implementations should persist this for future deployments to avoid
|
|
162
|
+
* regenerating certificates.
|
|
163
|
+
*
|
|
164
|
+
* @param certificate - The newly generated certificate to store
|
|
165
|
+
*/
|
|
166
|
+
storeCertificate?(certificate: AkashProviderTlsCertificate): Promise<void>;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Bid selection strategy for autonomous deployments
|
|
170
|
+
*/
|
|
171
|
+
export type BidStrategy = 'cheapest' | 'most-reliable' | 'balanced';
|
|
172
|
+
/**
|
|
173
|
+
* Uptime period for reliability filtering
|
|
174
|
+
*/
|
|
175
|
+
export type UptimePeriod = '1d' | '7d' | '30d';
|
|
176
|
+
/**
|
|
177
|
+
* Filter criteria for bid selection
|
|
178
|
+
*/
|
|
179
|
+
export interface BidFilterCriteria {
|
|
180
|
+
/** Maximum price per block in uAKT */
|
|
181
|
+
readonly maxPricePerBlock?: number;
|
|
182
|
+
/**
|
|
183
|
+
* Minimum uptime requirement
|
|
184
|
+
*
|
|
185
|
+
* @example
|
|
186
|
+
* ```typescript
|
|
187
|
+
* // Require 95% uptime over last 7 days
|
|
188
|
+
* minUptime: { value: 0.95, period: '7d' }
|
|
189
|
+
* ```
|
|
190
|
+
*/
|
|
191
|
+
readonly minUptime?: {
|
|
192
|
+
/** Uptime percentage (0-1), e.g., 0.95 = 95% */
|
|
193
|
+
readonly value: number;
|
|
194
|
+
/** Period to check: '1d', '7d', or '30d' */
|
|
195
|
+
readonly period: UptimePeriod;
|
|
196
|
+
};
|
|
197
|
+
/** Require audited providers only */
|
|
198
|
+
readonly requireAudited?: boolean;
|
|
199
|
+
/** Preferred regions (ISO country codes) */
|
|
200
|
+
readonly preferredRegions?: readonly string[];
|
|
201
|
+
/** Require provider to be online */
|
|
202
|
+
readonly requireOnline?: boolean;
|
|
203
|
+
}
|
|
108
204
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/targets/akash/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAExD,8FAA8F;AAC9F,MAAM,MAAM,WAAW,GAAG,kBAAkB,GAAG,mBAAmB,CAAC;AAEnE,sDAAsD;AACtD,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CAAC;IACnC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED,gGAAgG;AAChG,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,aAAa,EAAE,WAAW,CAAC;IACpC,QAAQ,CAAC,UAAU,CAAC,EAAE,YAAY,CAAC,OAAO,UAAU,CAAC,CAAC;IACtD,QAAQ,CAAC,OAAO,CAAC,EAAE,YAAY,CAAC,MAAM,CAAC;IACvC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,O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IACH,QAAQ,CAAC,SAAS,CAAC,EAAE;QACnB,gDAAgD;QAChD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QACvB,4CAA4C;QAC5C,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;KAC/B,CAAC;IACF,qCAAqC;IACrC,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IAClC,4CAA4C;IAC5C,QAAQ,CAAC,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9C,oCAAoC;IACpC,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;CAClC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Akash Network Wallet Connection Module
|
|
3
3
|
*
|
|
4
|
-
* Provides a clean, step-by-step API for connecting to Keplr wallet via WalletConnect
|
|
4
|
+
* Provides a clean, step-by-step API for connecting to Keplr wallet via WalletConnect
|
|
5
|
+
* or creating agent-controlled wallets from mnemonics for fully automated deployments.
|
|
5
6
|
* This is a LIBRARY - no QR code display, no prompts, just pure wallet operations.
|
|
6
7
|
*
|
|
7
8
|
* @module targets/akash/wallet
|
|
@@ -188,22 +189,39 @@ export declare function connectWallet(projectId: string, network: AkashNetwork,
|
|
|
188
189
|
/**
|
|
189
190
|
* Create wallet context from mnemonic (for agent-controlled wallets)
|
|
190
191
|
*
|
|
192
|
+
* Creates a fully functional wallet context from a BIP39 mnemonic phrase,
|
|
193
|
+
* enabling fully automated deployments without any user interaction.
|
|
194
|
+
*
|
|
191
195
|
* **SECURITY WARNING:** Only use this for automation YOU control (CI/CD, your own agents).
|
|
192
196
|
* For third-party services, use connectWallet() with WalletConnect instead to avoid
|
|
193
197
|
* exposing your mnemonic.
|
|
194
198
|
*
|
|
195
199
|
* @param mnemonic - BIP39 mnemonic phrase (12 or 24 words)
|
|
196
200
|
* @param network - Akash network to connect to
|
|
201
|
+
* @param options - Optional configuration
|
|
197
202
|
* @returns Result with wallet context or error
|
|
198
203
|
*
|
|
199
204
|
* @example
|
|
200
205
|
* ```typescript
|
|
201
|
-
*
|
|
206
|
+
* // Agent-controlled deployment
|
|
207
|
+
* const mnemonic = await mySecretsPlugin.getWalletMnemonic();
|
|
202
208
|
* const wallet = await createWalletFromMnemonic(mnemonic, 'mainnet');
|
|
203
209
|
* if (wallet.success) {
|
|
204
210
|
* await deployToAkash({ wallet: wallet.data, ... });
|
|
205
211
|
* }
|
|
206
212
|
* ```
|
|
213
|
+
*
|
|
214
|
+
* @example
|
|
215
|
+
* ```typescript
|
|
216
|
+
* // CI/CD pipeline
|
|
217
|
+
* const mnemonic = process.env.DEPLOYMENT_WALLET_MNEMONIC!;
|
|
218
|
+
* const wallet = await createWalletFromMnemonic(mnemonic, 'mainnet');
|
|
219
|
+
* ```
|
|
207
220
|
*/
|
|
208
|
-
export declare function createWalletFromMnemonic(
|
|
221
|
+
export declare function createWalletFromMnemonic(mnemonic: string, network: AkashNetwork, options?: {
|
|
222
|
+
/** HD derivation path (defaults to Cosmos standard: m/44'/118'/0'/0/0) */
|
|
223
|
+
hdPath?: string;
|
|
224
|
+
/** Account index for HD derivation (defaults to 0) */
|
|
225
|
+
accountIndex?: number;
|
|
226
|
+
}): Promise<Result<WalletContext, WalletError>>;
|
|
209
227
|
//# sourceMappingURL=wallet-manager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallet-manager.d.ts","sourceRoot":"","sources":["../../../src/targets/akash/wallet-manager.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"wallet-manager.d.ts","sourceRoot":"","sources":["../../../src/targets/akash/wallet-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAKxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,K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