@aura-protocol/cli 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/README.md +307 -0
- package/bin/aura.js +8 -0
- package/dist/commands/confidential.d.ts +2 -0
- package/dist/commands/confidential.js +564 -0
- package/dist/commands/confidential.js.map +1 -0
- package/dist/commands/config.d.ts +2 -0
- package/dist/commands/config.js +123 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/dashboard.d.ts +2 -0
- package/dist/commands/dashboard.js +29 -0
- package/dist/commands/dashboard.js.map +1 -0
- package/dist/commands/dwallet.d.ts +2 -0
- package/dist/commands/dwallet.js +131 -0
- package/dist/commands/dwallet.js.map +1 -0
- package/dist/commands/execution.d.ts +2 -0
- package/dist/commands/execution.js +261 -0
- package/dist/commands/execution.js.map +1 -0
- package/dist/commands/governance.d.ts +2 -0
- package/dist/commands/governance.js +169 -0
- package/dist/commands/governance.js.map +1 -0
- package/dist/commands/helpers.d.ts +79 -0
- package/dist/commands/helpers.js +219 -0
- package/dist/commands/helpers.js.map +1 -0
- package/dist/commands/treasury.d.ts +2 -0
- package/dist/commands/treasury.js +319 -0
- package/dist/commands/treasury.js.map +1 -0
- package/dist/config.d.ts +35 -0
- package/dist/config.js +96 -0
- package/dist/config.js.map +1 -0
- package/dist/context.d.ts +37 -0
- package/dist/context.js +57 -0
- package/dist/context.js.map +1 -0
- package/dist/dashboard.d.ts +7 -0
- package/dist/dashboard.js +95 -0
- package/dist/dashboard.js.map +1 -0
- package/dist/domain.d.ts +16 -0
- package/dist/domain.js +86 -0
- package/dist/domain.js.map +1 -0
- package/dist/format.d.ts +9 -0
- package/dist/format.js +92 -0
- package/dist/format.js.map +1 -0
- package/dist/ika.d.ts +76 -0
- package/dist/ika.js +178 -0
- package/dist/ika.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +43 -0
- package/dist/index.js.map +1 -0
- package/dist/output.d.ts +32 -0
- package/dist/output.js +134 -0
- package/dist/output.js.map +1 -0
- package/dist/protocol.d.ts +99 -0
- package/dist/protocol.js +353 -0
- package/dist/protocol.js.map +1 -0
- package/dist/sdk.d.ts +6 -0
- package/dist/sdk.js +6 -0
- package/dist/sdk.js.map +1 -0
- package/dist/treasury-view.d.ts +11 -0
- package/dist/treasury-view.js +103 -0
- package/dist/treasury-view.js.map +1 -0
- package/dist/vendor/encrypt/generated/grpc/encrypt_service.d.ts +195 -0
- package/dist/vendor/encrypt/generated/grpc/encrypt_service.js +514 -0
- package/dist/vendor/encrypt/generated/grpc/encrypt_service.js.map +1 -0
- package/dist/vendor/encrypt/grpc.d.ts +70 -0
- package/dist/vendor/encrypt/grpc.js +108 -0
- package/dist/vendor/encrypt/grpc.js.map +1 -0
- package/dist/vendor/ika/bcs-types.d.ts +1045 -0
- package/dist/vendor/ika/bcs-types.js +185 -0
- package/dist/vendor/ika/bcs-types.js.map +1 -0
- package/dist/vendor/ika/generated/grpc/ika_dwallet.d.ts +141 -0
- package/dist/vendor/ika/generated/grpc/ika_dwallet.js +531 -0
- package/dist/vendor/ika/generated/grpc/ika_dwallet.js.map +1 -0
- package/dist/vendor/ika/grpc.d.ts +16 -0
- package/dist/vendor/ika/grpc.js +129 -0
- package/dist/vendor/ika/grpc.js.map +1 -0
- package/dist/wallet.d.ts +2 -0
- package/dist/wallet.js +21 -0
- package/dist/wallet.js.map +1 -0
- package/package.json +54 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Encrypt gRPC client — static typed wrapper.
|
|
3
|
+
*
|
|
4
|
+
* Uses statically generated types from the proto (no runtime proto loading).
|
|
5
|
+
* Re-exports types for convenience.
|
|
6
|
+
*/
|
|
7
|
+
import * as grpc from "@grpc/grpc-js";
|
|
8
|
+
// Re-export generated types
|
|
9
|
+
export {} from "./generated/grpc/encrypt_service.js";
|
|
10
|
+
import { Chain as ProtoChain, EncryptServiceClient as GrpcClient, } from "./generated/grpc/encrypt_service.js";
|
|
11
|
+
/** Chain identifier (matches proto enum, camelCase for ergonomics). */
|
|
12
|
+
export const Chain = {
|
|
13
|
+
Solana: ProtoChain.SOLANA,
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* BCS-encode a ReadCiphertextMessage.
|
|
17
|
+
*
|
|
18
|
+
* BCS format: chain(u8) + ciphertext_identifier(vec) + reencryption_key(vec) + epoch(u64)
|
|
19
|
+
* where vec = ULEB128 length prefix + bytes.
|
|
20
|
+
*/
|
|
21
|
+
export function encodeReadCiphertextMessage(chain, ciphertextIdentifier, reencryptionKey, epoch) {
|
|
22
|
+
// BCS ULEB128: for lengths <= 127, it's just 1 byte
|
|
23
|
+
const ctIdLen = ciphertextIdentifier.length;
|
|
24
|
+
const rekeyLen = reencryptionKey.length;
|
|
25
|
+
const totalLen = 1 + 1 + ctIdLen + 1 + rekeyLen + 8;
|
|
26
|
+
const buf = Buffer.alloc(totalLen);
|
|
27
|
+
let offset = 0;
|
|
28
|
+
buf[offset++] = chain;
|
|
29
|
+
buf[offset++] = ctIdLen; // ULEB128 (works for len < 128)
|
|
30
|
+
Buffer.from(ciphertextIdentifier).copy(buf, offset);
|
|
31
|
+
offset += ctIdLen;
|
|
32
|
+
buf[offset++] = rekeyLen;
|
|
33
|
+
Buffer.from(reencryptionKey).copy(buf, offset);
|
|
34
|
+
offset += rekeyLen;
|
|
35
|
+
buf.writeBigUInt64LE(epoch, offset);
|
|
36
|
+
return buf;
|
|
37
|
+
}
|
|
38
|
+
/** gRPC endpoint for the Encrypt pre-alpha on Solana devnet. */
|
|
39
|
+
export const DEVNET_PRE_ALPHA_GRPC_URL = "pre-alpha-dev-1.encrypt.ika-network.net:443";
|
|
40
|
+
/**
|
|
41
|
+
* Create a gRPC client connected to the Encrypt executor.
|
|
42
|
+
*
|
|
43
|
+
* Defaults to the pre-alpha devnet endpoint (TLS).
|
|
44
|
+
* Pass `"localhost:50051"` for local dev.
|
|
45
|
+
*/
|
|
46
|
+
export function createEncryptClient(grpcUrl = DEVNET_PRE_ALPHA_GRPC_URL) {
|
|
47
|
+
const isLocal = grpcUrl.startsWith("localhost") || grpcUrl.startsWith("127.0.0.1");
|
|
48
|
+
const creds = isLocal
|
|
49
|
+
? grpc.credentials.createInsecure()
|
|
50
|
+
: grpc.credentials.createSsl();
|
|
51
|
+
const client = new GrpcClient(grpcUrl, creds);
|
|
52
|
+
return {
|
|
53
|
+
/**
|
|
54
|
+
* Submit encrypted inputs and get back their on-chain identifiers.
|
|
55
|
+
*/
|
|
56
|
+
createInput(params) {
|
|
57
|
+
return new Promise((resolve, reject) => {
|
|
58
|
+
client.createInput({
|
|
59
|
+
chain: params.chain,
|
|
60
|
+
inputs: params.inputs.map((inp) => ({
|
|
61
|
+
ciphertextBytes: Buffer.from(inp.ciphertextBytes),
|
|
62
|
+
fheType: inp.fheType,
|
|
63
|
+
})),
|
|
64
|
+
proof: params.proof ?? Buffer.alloc(0),
|
|
65
|
+
authorized: Buffer.from(params.authorized),
|
|
66
|
+
networkEncryptionPublicKey: Buffer.from(params.networkEncryptionPublicKey),
|
|
67
|
+
}, (err, response) => {
|
|
68
|
+
if (err)
|
|
69
|
+
reject(err);
|
|
70
|
+
else
|
|
71
|
+
resolve({
|
|
72
|
+
ciphertextIdentifiers: response.ciphertextIdentifiers,
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
},
|
|
77
|
+
/**
|
|
78
|
+
* Read a ciphertext off-chain.
|
|
79
|
+
*
|
|
80
|
+
* For public ciphertexts: signature/signer can be zero-filled.
|
|
81
|
+
* For private ciphertexts: signature must be valid ed25519 over `message`.
|
|
82
|
+
*
|
|
83
|
+
* Use `encodeReadCiphertextMessage()` to build the BCS message.
|
|
84
|
+
*/
|
|
85
|
+
readCiphertext(params) {
|
|
86
|
+
return new Promise((resolve, reject) => {
|
|
87
|
+
client.readCiphertext({
|
|
88
|
+
message: params.message,
|
|
89
|
+
signature: params.signature,
|
|
90
|
+
signer: params.signer,
|
|
91
|
+
}, (err, response) => {
|
|
92
|
+
if (err)
|
|
93
|
+
reject(err);
|
|
94
|
+
else
|
|
95
|
+
resolve({
|
|
96
|
+
value: response.value,
|
|
97
|
+
fheType: response.fheType,
|
|
98
|
+
digest: response.digest,
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
},
|
|
103
|
+
close() {
|
|
104
|
+
client.close();
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=grpc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grpc.js","sourceRoot":"","sources":["../../../src/vendor/encrypt/grpc.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,IAAI,MAAM,eAAe,CAAC;AAEtC,4BAA4B;AAC5B,OAAO,EAMN,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EACL,KAAK,IAAI,UAAU,EACnB,oBAAoB,IAAI,UAAU,GAInC,MAAM,qCAAqC,CAAC;AAE7C,uEAAuE;AACvE,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,MAAM,EAAE,UAAU,CAAC,MAAM;CACjB,CAAC;AAqCX;;;;;GAKG;AACH,MAAM,UAAU,2BAA2B,CACzC,KAAa,EACb,oBAAgC,EAChC,eAA2B,EAC3B,KAAa;IAEb,oDAAoD;IACpD,MAAM,OAAO,GAAG,oBAAoB,CAAC,MAAM,CAAC;IAC5C,MAAM,QAAQ,GAAG,eAAe,CAAC,MAAM,CAAC;IACxC,MAAM,QAAQ,GAAG,CAAC,GAAG,CAAC,GAAG,OAAO,GAAG,CAAC,GAAG,QAAQ,GAAG,CAAC,CAAC;IACpD,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IACnC,IAAI,MAAM,GAAG,CAAC,CAAC;IAEf,GAAG,CAAC,MAAM,EAAE,CAAC,GAAG,KAAK,CAAC;IACtB,GAAG,CAAC,MAAM,EAAE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