@interest-protocol/enclave-sdk 0.0.1

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 ADDED
@@ -0,0 +1,45 @@
1
+ # @lattice/enclave-sdk
2
+
3
+ SDK for AWS Nitro Enclave attestation verification on Sui.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ bun install
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```typescript
14
+ import { Enclave } from '@lattice/enclave-sdk';
15
+
16
+ const enclave = new Enclave({
17
+ suiClient,
18
+ packageId: ENCLAVE_PACKAGE_ID,
19
+ enclaveConfigSharedObjectData,
20
+ });
21
+
22
+ // Register a new enclave
23
+ const tx = enclave.registerEnclave({
24
+ attestationDocument: attestation,
25
+ });
26
+
27
+ // Verify enclave signature
28
+ const tx = enclave.verifySignature({
29
+ enclaveId,
30
+ message,
31
+ signature,
32
+ });
33
+ ```
34
+
35
+ ## Development
36
+
37
+ ```bash
38
+ bun run build # Build package
39
+ bun run test # Run tests
40
+ bun run lint # Run linter
41
+ ```
42
+
43
+ ## Documentation
44
+
45
+ See [../CLAUDE.md](../CLAUDE.md) for SDK architecture patterns.
@@ -0,0 +1,17 @@
1
+ export declare const MAINNET_PACKAGE_ID = "0x0d8210045df3ec6b95c2e814562d12403cd8e3204959b50f1e1dde34e9ec5724";
2
+ export declare const PCR_LENGTH = 48;
3
+ export declare const Modules: {
4
+ readonly Enclave: "enclave";
5
+ };
6
+ export declare const Functions: {
7
+ readonly NewCap: "new_cap";
8
+ readonly Register: "register";
9
+ readonly Update: "update";
10
+ readonly VerifySignature: "verify_signature";
11
+ readonly NewIntentMessage: "new_intent_message";
12
+ readonly Pcr0: "pcr0";
13
+ readonly Pcr1: "pcr1";
14
+ readonly Pcr2: "pcr2";
15
+ readonly Pk: "pk";
16
+ };
17
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,uEACyC,CAAC;AAEzE,eAAO,MAAM,UAAU,KAAK,CAAC;AAE7B,eAAO,MAAM,OAAO;;CAEV,CAAC;AAEX,eAAO,MAAM,SAAS;;;;;;;;;;CAUZ,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { Transaction } from '@mysten/sui/transactions';
2
+ import type { EnclaveConstructorArgs, GetPkArgs, Pcrs, RegisterArgs, UpdateArgs } from './enclave.types';
3
+ export declare class Enclave {
4
+ #private;
5
+ constructor({ suiClient, packageId, enclaveCapId, enclaveSharedObjectData, witnessType, }: EnclaveConstructorArgs);
6
+ register({ tx, attestationDocument }: RegisterArgs): Transaction;
7
+ update({ tx, attestationDocument }: UpdateArgs): Transaction;
8
+ getPk({ enclaveId }?: GetPkArgs): Promise<Uint8Array>;
9
+ getPcrs(enclaveId?: string): Promise<Pcrs>;
10
+ }
11
+ //# sourceMappingURL=enclave.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enclave.d.ts","sourceRoot":"","sources":["../src/enclave.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAIvD,OAAO,KAAK,EACR,sBAAsB,EACtB,SAAS,EACT,IAAI,EACJ,YAAY,EAEZ,UAAU,EACb,MAAM,iBAAiB,CAAC;AAGzB,qBAAa,OAAO;;gBAOJ,EACR,SAAS,EACT,SAAS,EACT,YAAY,EACZ,uBAAuB,EACvB,WAAW,GACd,EAAE,sBAAsB;IAiBzB,QAAQ,CAAC,EAAE,EAAsB,EAAE,mBAAmB,EAAE,EAAE,YAAY,GAAG,WAAW;IAUpF,MAAM,CAAC,EAAE,EAAsB,EAAE,mBAAmB,EAAE,EAAE,UAAU,GAAG,WAAW;IAc1E,KAAK,CAAC,EAAE,SAAS,EAAE,GAAE,SAAc,GAAG,OAAO,CAAC,UAAU,CAAC;IAezD,OAAO,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAmBnD"}
@@ -0,0 +1,47 @@
1
+ import type { SuiClient } from '@mysten/sui/client';
2
+ import type { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
3
+ export interface SharedObjectData {
4
+ objectId: string;
5
+ initialSharedVersion: string;
6
+ }
7
+ export interface EnclaveConstructorArgs {
8
+ suiClient: SuiClient;
9
+ packageId?: string;
10
+ enclaveCapId: string;
11
+ enclaveSharedObjectData?: SharedObjectData;
12
+ witnessType: string;
13
+ }
14
+ export interface Pcrs {
15
+ pcr0: Uint8Array;
16
+ pcr1: Uint8Array;
17
+ pcr2: Uint8Array;
18
+ }
19
+ export interface RegisterArgs {
20
+ tx?: Transaction;
21
+ attestationDocument: TransactionObjectArgument;
22
+ }
23
+ export interface UpdateArgs {
24
+ tx?: Transaction;
25
+ attestationDocument: TransactionObjectArgument;
26
+ }
27
+ export interface GetPkArgs {
28
+ enclaveId?: string;
29
+ }
30
+ export interface EnclaveFields {
31
+ pcrs: {
32
+ fields: {
33
+ pcr0: number[];
34
+ pcr1: number[];
35
+ pcr2: number[];
36
+ };
37
+ };
38
+ pk: number[];
39
+ cap_id: string;
40
+ }
41
+ export interface EnclaveObject {
42
+ id: string;
43
+ capId: string;
44
+ pcrs: Pcrs;
45
+ pk: Uint8Array;
46
+ }
47
+ //# sourceMappingURL=enclave.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enclave.types.d.ts","sourceRoot":"","sources":["../src/enclave.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAEvF,MAAM,WAAW,gBAAgB;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,oBAAoB,EAAE,MAAM,CAAC;CAChC;AAED,MAAM,WAAW,sBAAsB;IACnC,SAAS,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,uBAAuB,CAAC,EAAE,gBAAgB,CAAC;IAC3C,WAAW,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,IAAI;IACjB,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,EAAE,UAAU,CAAC;CACpB;AAED,MAAM,WAAW,YAAY;IACzB,EAAE,CAAC,EAAE,WAAW,CAAC;IACjB,mBAAmB,EAAE,yBAAyB,CAAC;CAClD;AAED,MAAM,WAAW,UAAU;IACvB,EAAE,CAAC,EAAE,WAAW,CAAC;IACjB,mBAAmB,EAAE,yBAAyB,CAAC;CAClD;AAED,MAAM,WAAW,SAAS;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,aAAa;IAC1B,IAAI,EAAE;QACF,MAAM,EAAE;YACJ,IAAI,EAAE,MAAM,EAAE,CAAC;YACf,IAAI,EAAE,MAAM,EAAE,CAAC;YACf,IAAI,EAAE,MAAM,EAAE,CAAC;SAClB,CAAC;KACL,CAAC;IACF,EAAE,EAAE,MAAM,EAAE,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,IAAI,CAAC;IACX,EAAE,EAAE,UAAU,CAAC;CAClB"}
@@ -0,0 +1,4 @@
1
+ export * from './constants';
2
+ export * from './enclave';
3
+ export * from './enclave.types';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC"}