@terminal3/t3n-sdk 0.8.0 → 0.10.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.
Files changed (46) hide show
  1. package/dist/index.d.ts +173 -292
  2. package/dist/index.esm.js +1 -1
  3. package/dist/index.js +1 -1
  4. package/dist/src/client/config.d.ts +30 -10
  5. package/dist/src/client/index.d.ts +0 -4
  6. package/dist/src/client/t3n-client.d.ts +27 -64
  7. package/dist/src/index.d.ts +7 -6
  8. package/dist/src/types/auth.d.ts +6 -5
  9. package/dist/src/types/index.d.ts +13 -37
  10. package/dist/src/utils/hkdf.d.ts +36 -0
  11. package/dist/src/utils/index.d.ts +1 -0
  12. package/dist/src/wasm/interface.d.ts +54 -89
  13. package/dist/src/wasm/loader.d.ts +55 -25
  14. package/dist/wasm/generated/interfaces/host-session-interfaces-contract-dispatch.d.ts +2 -0
  15. package/dist/wasm/generated/interfaces/host-session-interfaces-entropy.d.ts +2 -0
  16. package/dist/wasm/generated/interfaces/host-session-interfaces-eth-signer.d.ts +2 -0
  17. package/dist/wasm/generated/interfaces/host-session-interfaces-kem.d.ts +3 -0
  18. package/dist/wasm/generated/interfaces/host-session-interfaces-oidc-client.d.ts +2 -0
  19. package/dist/wasm/generated/interfaces/host-session-interfaces-oidc.d.ts +3 -0
  20. package/dist/wasm/generated/interfaces/host-session-interfaces-session-ops.d.ts +9 -0
  21. package/dist/wasm/generated/interfaces/host-session-interfaces-transport.d.ts +2 -0
  22. package/dist/wasm/generated/interfaces/tee-session-client-auth.d.ts +7 -0
  23. package/dist/wasm/generated/interfaces/tee-session-client-handshake.d.ts +12 -0
  24. package/dist/wasm/generated/interfaces/tee-session-cookie.d.ts +7 -0
  25. package/dist/wasm/generated/interfaces/tee-session-server-admin.d.ts +2 -0
  26. package/dist/wasm/generated/interfaces/tee-session-server-auth.d.ts +10 -0
  27. package/dist/wasm/generated/interfaces/tee-session-server-handshake.d.ts +15 -0
  28. package/dist/wasm/generated/interfaces/tee-session-server-webhook.d.ts +6 -0
  29. package/dist/wasm/generated/interfaces/tee-session-session-crypto.d.ts +3 -0
  30. package/dist/wasm/generated/session.core.wasm +0 -0
  31. package/dist/wasm/generated/session.core2.wasm +0 -0
  32. package/dist/wasm/generated/session.core3.wasm +0 -0
  33. package/dist/wasm/generated/session.d.ts +87 -12
  34. package/dist/wasm/generated/session.js +6640 -3702
  35. package/package.json +1 -1
  36. package/dist/demo.d.ts +0 -25
  37. package/dist/src/client/actions.d.ts +0 -22
  38. package/dist/src/client/encryption.d.ts +0 -30
  39. package/dist/src/client/handlers.d.ts +0 -73
  40. package/dist/src/client/request-parser.d.ts +0 -48
  41. package/dist/wasm/generated/interfaces/component-session-client-auth.d.ts +0 -12
  42. package/dist/wasm/generated/interfaces/component-session-client-handshake.d.ts +0 -12
  43. package/dist/wasm/generated/interfaces/component-session-cookie.d.ts +0 -8
  44. package/dist/wasm/generated/interfaces/component-session-server-auth.d.ts +0 -13
  45. package/dist/wasm/generated/interfaces/component-session-server-handshake.d.ts +0 -12
  46. package/dist/wasm/generated/interfaces/component-session-session.d.ts +0 -7
@@ -0,0 +1,7 @@
1
+ /** @module Interface tee:session/client-auth@1.0.0 **/
2
+ export function runEth(sessionKeys: Uint8Array, ethAddress: string, siweDomain: string | undefined, siweUrl: string | undefined, siweChainId: bigint | undefined): Outcome;
3
+ export function runOidc(sessionKeys: Uint8Array, provider: string): Outcome;
4
+ export interface Outcome {
5
+ did: string,
6
+ cookie?: string,
7
+ }
@@ -0,0 +1,12 @@
1
+ /** @module Interface tee:session/client-handshake@1.0.0 **/
2
+ export function run(sid: Uint8Array, cookie: string | undefined): Outcome;
3
+ export interface SessionKeys {
4
+ blob: Uint8Array,
5
+ sid: Uint8Array,
6
+ }
7
+ export interface Outcome {
8
+ keys: SessionKeys,
9
+ authenticated: boolean,
10
+ did?: string,
11
+ expirySec: bigint,
12
+ }
@@ -0,0 +1,7 @@
1
+ /** @module Interface tee:session/cookie@1.0.0 **/
2
+ export function validate(value: string, teeAddress: Uint8Array, nowSec: bigint): Validation;
3
+ export interface Validation {
4
+ authenticated: boolean,
5
+ did?: string,
6
+ exp: bigint,
7
+ }
@@ -0,0 +1,2 @@
1
+ /** @module Interface tee:session/server-admin@1.0.0 **/
2
+ export function run(headers: Array<[string, string]>, body: Uint8Array): Uint8Array;
@@ -0,0 +1,10 @@
1
+ /** @module Interface tee:session/server-auth@1.0.0 **/
2
+ export function run(persistedStateBytes: Uint8Array | undefined, initialActionJson: Uint8Array, siwePolicyJson: Uint8Array): Outcome;
3
+ export interface Outcome {
4
+ responseJson: Uint8Array,
5
+ stateBytes?: Uint8Array,
6
+ cookie?: string,
7
+ did?: string,
8
+ authenticatorsJson?: Uint8Array,
9
+ finalized: boolean,
10
+ }
@@ -0,0 +1,15 @@
1
+ /** @module Interface tee:session/server-handshake@1.0.0 **/
2
+ export function run(sid: Uint8Array, ciphertext: Uint8Array, cookieValue: string | undefined): Outcome;
3
+ export interface SessionKeys {
4
+ c2s: Uint8Array,
5
+ s2c: Uint8Array,
6
+ sid: Uint8Array,
7
+ }
8
+ export interface Outcome {
9
+ keys: SessionKeys,
10
+ rawSecret: Uint8Array,
11
+ authenticated: boolean,
12
+ did?: string,
13
+ expirySec: bigint,
14
+ refreshedCookie?: string,
15
+ }
@@ -0,0 +1,6 @@
1
+ /** @module Interface tee:session/server-webhook@1.0.0 **/
2
+ export function run(providerId: string, headers: Array<[string, string]>, body: Uint8Array): Outcome;
3
+ export interface Outcome {
4
+ replyJson: Uint8Array,
5
+ finalStateBytes: Uint8Array,
6
+ }
@@ -0,0 +1,3 @@
1
+ /** @module Interface tee:session/session-crypto@1.0.0 **/
2
+ export function encrypt(keys: Uint8Array, plaintext: Uint8Array): Uint8Array;
3
+ export function decrypt(keys: Uint8Array, ciphertext: Uint8Array): Uint8Array;
@@ -1,13 +1,88 @@
1
1
  // world root:component/root
2
- export type * as WasiCliEnvironment029 from './interfaces/wasi-cli-environment.js'; // import wasi:cli/environment@0.2.9
3
- export type * as WasiCliExit029 from './interfaces/wasi-cli-exit.js'; // import wasi:cli/exit@0.2.9
4
- export type * as WasiCliStderr029 from './interfaces/wasi-cli-stderr.js'; // import wasi:cli/stderr@0.2.9
5
- export type * as WasiIoError029 from './interfaces/wasi-io-error.js'; // import wasi:io/error@0.2.9
6
- export type * as WasiIoStreams029 from './interfaces/wasi-io-streams.js'; // import wasi:io/streams@0.2.9
7
- export type * as WasiRandomRandom029 from './interfaces/wasi-random-random.js'; // import wasi:random/random@0.2.9
8
- export * as clientAuth from './interfaces/component-session-client-auth.js'; // export component:session/client-auth@0.1.0
9
- export * as serverAuth from './interfaces/component-session-server-auth.js'; // export component:session/server-auth@0.1.0
10
- export * as clientHandshake from './interfaces/component-session-client-handshake.js'; // export component:session/client-handshake@0.1.0
11
- export * as serverHandshake from './interfaces/component-session-server-handshake.js'; // export component:session/server-handshake@0.1.0
12
- export * as session from './interfaces/component-session-session.js'; // export component:session/session@0.1.0
13
- export * as cookie from './interfaces/component-session-cookie.js'; // export component:session/cookie@0.1.0
2
+ import type * as HostSessionInterfacesContractDispatch from './interfaces/host-session-interfaces-contract-dispatch.js'; // host:session-interfaces/contract-dispatch@1.0.0
3
+ import type * as HostSessionInterfacesEntropy from './interfaces/host-session-interfaces-entropy.js'; // host:session-interfaces/entropy@1.0.0
4
+ import type * as HostSessionInterfacesEthSigner from './interfaces/host-session-interfaces-eth-signer.js'; // host:session-interfaces/eth-signer@1.0.0
5
+ import type * as HostSessionInterfacesKem from './interfaces/host-session-interfaces-kem.js'; // host:session-interfaces/kem@1.0.0
6
+ import type * as HostSessionInterfacesOidcClient from './interfaces/host-session-interfaces-oidc-client.js'; // host:session-interfaces/oidc-client@1.0.0
7
+ import type * as HostSessionInterfacesOidc from './interfaces/host-session-interfaces-oidc.js'; // host:session-interfaces/oidc@1.0.0
8
+ import type * as HostSessionInterfacesSessionOps from './interfaces/host-session-interfaces-session-ops.js'; // host:session-interfaces/session-ops@1.0.0
9
+ import type * as HostSessionInterfacesTransport from './interfaces/host-session-interfaces-transport.js'; // host:session-interfaces/transport@1.0.0
10
+ import type * as WasiCliEnvironment from './interfaces/wasi-cli-environment.js'; // wasi:cli/environment@0.2.9
11
+ import type * as WasiCliExit from './interfaces/wasi-cli-exit.js'; // wasi:cli/exit@0.2.9
12
+ import type * as WasiCliStderr from './interfaces/wasi-cli-stderr.js'; // wasi:cli/stderr@0.2.9
13
+ import type * as WasiIoError from './interfaces/wasi-io-error.js'; // wasi:io/error@0.2.9
14
+ import type * as WasiIoStreams from './interfaces/wasi-io-streams.js'; // wasi:io/streams@0.2.9
15
+ import type * as WasiRandomRandom from './interfaces/wasi-random-random.js'; // wasi:random/random@0.2.9
16
+ import type * as TeeSessionClientHandshake from './interfaces/tee-session-client-handshake.js'; // tee:session/client-handshake@1.0.0
17
+ import type * as TeeSessionClientAuth from './interfaces/tee-session-client-auth.js'; // tee:session/client-auth@1.0.0
18
+ import type * as TeeSessionServerHandshake from './interfaces/tee-session-server-handshake.js'; // tee:session/server-handshake@1.0.0
19
+ import type * as TeeSessionServerAuth from './interfaces/tee-session-server-auth.js'; // tee:session/server-auth@1.0.0
20
+ import type * as TeeSessionServerAdmin from './interfaces/tee-session-server-admin.js'; // tee:session/server-admin@1.0.0
21
+ import type * as TeeSessionServerWebhook from './interfaces/tee-session-server-webhook.js'; // tee:session/server-webhook@1.0.0
22
+ import type * as TeeSessionSessionCrypto from './interfaces/tee-session-session-crypto.js'; // tee:session/session-crypto@1.0.0
23
+ import type * as TeeSessionCookie from './interfaces/tee-session-cookie.js'; // tee:session/cookie@1.0.0
24
+ export interface ImportObject {
25
+ 'host:session-interfaces/contract-dispatch@1.0.0': typeof HostSessionInterfacesContractDispatch,
26
+ 'host:session-interfaces/entropy@1.0.0': typeof HostSessionInterfacesEntropy,
27
+ 'host:session-interfaces/eth-signer@1.0.0': typeof HostSessionInterfacesEthSigner,
28
+ 'host:session-interfaces/kem@1.0.0': typeof HostSessionInterfacesKem,
29
+ 'host:session-interfaces/oidc-client@1.0.0': typeof HostSessionInterfacesOidcClient,
30
+ 'host:session-interfaces/oidc@1.0.0': typeof HostSessionInterfacesOidc,
31
+ 'host:session-interfaces/session-ops@1.0.0': typeof HostSessionInterfacesSessionOps,
32
+ 'host:session-interfaces/transport@1.0.0': typeof HostSessionInterfacesTransport,
33
+ 'wasi:cli/environment@0.2.9': typeof WasiCliEnvironment,
34
+ 'wasi:cli/exit@0.2.9': typeof WasiCliExit,
35
+ 'wasi:cli/stderr@0.2.9': typeof WasiCliStderr,
36
+ 'wasi:io/error@0.2.9': typeof WasiIoError,
37
+ 'wasi:io/streams@0.2.9': typeof WasiIoStreams,
38
+ 'wasi:random/random@0.2.9': typeof WasiRandomRandom,
39
+ }
40
+ export interface Root {
41
+ 'tee:session/client-handshake@1.0.0': typeof TeeSessionClientHandshake,
42
+ clientHandshake: typeof TeeSessionClientHandshake,
43
+ 'tee:session/client-auth@1.0.0': typeof TeeSessionClientAuth,
44
+ clientAuth: typeof TeeSessionClientAuth,
45
+ 'tee:session/server-handshake@1.0.0': typeof TeeSessionServerHandshake,
46
+ serverHandshake: typeof TeeSessionServerHandshake,
47
+ 'tee:session/server-auth@1.0.0': typeof TeeSessionServerAuth,
48
+ serverAuth: typeof TeeSessionServerAuth,
49
+ 'tee:session/server-admin@1.0.0': typeof TeeSessionServerAdmin,
50
+ serverAdmin: typeof TeeSessionServerAdmin,
51
+ 'tee:session/server-webhook@1.0.0': typeof TeeSessionServerWebhook,
52
+ serverWebhook: typeof TeeSessionServerWebhook,
53
+ 'tee:session/session-crypto@1.0.0': typeof TeeSessionSessionCrypto,
54
+ sessionCrypto: typeof TeeSessionSessionCrypto,
55
+ 'tee:session/cookie@1.0.0': typeof TeeSessionCookie,
56
+ cookie: typeof TeeSessionCookie,
57
+ }
58
+
59
+ /**
60
+ * Instantiates this component with the provided imports and
61
+ * returns a map of all the exports of the component.
62
+ *
63
+ * This function is intended to be similar to the
64
+ * `WebAssembly.instantiate` function. The second `imports`
65
+ * argument is the "import object" for wasm, except here it
66
+ * uses component-model-layer types instead of core wasm
67
+ * integers/numbers/etc.
68
+ *
69
+ * The first argument to this function, `getCoreModule`, is
70
+ * used to compile core wasm modules within the component.
71
+ * Components are composed of core wasm modules and this callback
72
+ * will be invoked per core wasm module. The caller of this
73
+ * function is responsible for reading the core wasm module
74
+ * identified by `path` and returning its compiled
75
+ * `WebAssembly.Module` object. This would use `compileStreaming`
76
+ * on the web, for example.
77
+ */
78
+ export function instantiate(
79
+ getCoreModule: (path: string) => WebAssembly.Module,
80
+ imports: ImportObject,
81
+ instantiateCore?: (module: WebAssembly.Module, imports: Record<string, any>) => WebAssembly.Instance
82
+ ): Root;
83
+ export function instantiate(
84
+ getCoreModule: (path: string) => WebAssembly.Module | Promise<WebAssembly.Module>,
85
+ imports: ImportObject,
86
+ instantiateCore?: (module: WebAssembly.Module, imports: Record<string, any>) => WebAssembly.Instance | Promise<WebAssembly.Instance>
87
+ ): Root | Promise<Root>;
88
+