From 3d757a0f4805c62bbfe3eb2affe3eb8bf6c1c817 Mon Sep 17 00:00:00 2001 From: 8e8b2c <8e8b2c@proton.me> Date: Tue, 30 Jul 2024 11:44:39 +0100 Subject: [PATCH] chore: bump versions; rm rocket references --- .github/workflows/e2e.yml | 2 -- .gitignore | 1 - README.md | 19 ++++++++----------- package-lock.json | 10 +++++----- packages/authority/package.json | 4 ++-- packages/client/package.json | 4 ++-- ...xternal-id-attestation-requestor-client.ts | 14 +++++--------- packages/client/src/index.ts | 1 + packages/e2e/src/main.ts | 6 ++++-- packages/e2e/tests/evm-wallet-binding.test.js | 8 ++++---- packages/e2e/tests/metadata.test.js | 6 +++--- packages/e2e/tests/username.test.js | 6 +++--- packages/e2e/tests/utils/testcontainers.js | 6 +++--- packages/types/package.json | 2 +- 14 files changed, 41 insertions(+), 48 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 9096cd2..d49e7e1 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -176,8 +176,6 @@ jobs: path: happ_workdir - name: Move DNA run: mv happ_workdir/holoom.dna ./holoom.dna - - name: Move server binary - run: mv rocket-artifact/holoom_rocket_server ./holoom_rocket_server-bookworm - name: Download types dist uses: actions/download-artifact@v4 diff --git a/.gitignore b/.gitignore index 5a4a95a..07018bc 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,5 @@ dist /packages/client/docs docker/misc_hc/happ_workdir -docker/rocket/holoom_rocket_server .DS_Store \ No newline at end of file diff --git a/README.md b/README.md index 8ce6f32..b136846 100644 --- a/README.md +++ b/README.md @@ -16,9 +16,13 @@ A Holoom hApp network provides a space in which users can: An npm library that provides helpers for interacting with a Holoom hApp agent, whether that be via the holo network, or with a conductor directly. -### Holoom Rocket Server +### `@holoom/authority` -Provides a REST API wrapper for a Holoom conductor instance (usually the authority agent). This is useful for building services around a Holoom network that are intended to be accessed without requiring ownership of an agent within the network. +Provides several micro-service-like nodeJS applications that can be attached to an authority agent enabling: + +- REST queries of the user registry +- Fulfillment of username attestation requests +- Fulfillment of External ID attestation requests ## The Authority Agent @@ -36,19 +40,12 @@ npm run test:dna ### `packages/e2e` -This provides coverage for using the hApp in conjunction with the `@holoom/client` and `holoom_rocket_server` components. To run these tests locally, docker should be running, and a one-time setup script needs invoking: - -``` -scripts/build_rocket_builder.sh -``` - -The above script enables caching of `holoom_rocket_server` build artefacts. (CI doesn't use this.) The full build and tests can then be invoked via: +This provides coverage for using the hApp in conjunction with the `@holoom/client` and `@holoom/authority` components. The full build and tests can then be invoked via: ``` npm run test:e2e ``` -## API documents +## API documents [Holoom API docs](https://holochain-open-dev.github.io/holoom) - diff --git a/package-lock.json b/package-lock.json index 89d136d..faec4af 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10090,11 +10090,11 @@ }, "packages/authority": { "name": "@holoom/authority", - "version": "0.1.0-dev.9", + "version": "0.1.0-dev.10", "license": "MIT", "dependencies": { "@holochain/client": "^0.18.0-dev", - "@holoom/types": "0.1.0-dev.9", + "@holoom/types": "0.1.0-dev.10", "@msgpack/msgpack": "^2.7.2", "bs58": "^4.0.1", "dotenv": "^16.4.5", @@ -10134,10 +10134,10 @@ }, "packages/client": { "name": "@holoom/client", - "version": "0.1.0-dev.9", + "version": "0.1.0-dev.10", "license": "MIT", "dependencies": { - "@holoom/types": "0.1.0-dev.9", + "@holoom/types": "0.1.0-dev.10", "@msgpack/msgpack": "^2.7.2", "bs58": "^4.0.1", "uuid": "^9.0.1", @@ -10338,7 +10338,7 @@ }, "packages/types": { "name": "@holoom/types", - "version": "0.1.0-dev.9", + "version": "0.1.0-dev.10", "license": "MIT", "devDependencies": { "@holochain/client": "^0.18.0-dev", diff --git a/packages/authority/package.json b/packages/authority/package.json index 9352165..4a36132 100644 --- a/packages/authority/package.json +++ b/packages/authority/package.json @@ -1,6 +1,6 @@ { "name": "@holoom/authority", - "version": "0.1.0-dev.9", + "version": "0.1.0-dev.10", "description": "Helpers for interacting with a holoom network authority agent", "type": "module", "license": "MIT", @@ -50,7 +50,7 @@ "//": "TODO: These should probably be peer deps", "dependencies": { "@holochain/client": "^0.18.0-dev", - "@holoom/types": "0.1.0-dev.9", + "@holoom/types": "0.1.0-dev.10", "@msgpack/msgpack": "^2.7.2", "bs58": "^4.0.1", "dotenv": "^16.4.5", diff --git a/packages/client/package.json b/packages/client/package.json index 13fce8d..3c68766 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@holoom/client", - "version": "0.1.0-dev.9", + "version": "0.1.0-dev.10", "description": "Helpers for interacting with a holoom network agent", "type": "module", "license": "MIT", @@ -55,7 +55,7 @@ "@solana/web3.js": "^1.87.6" }, "dependencies": { - "@holoom/types": "0.1.0-dev.9", + "@holoom/types": "0.1.0-dev.10", "@msgpack/msgpack": "^2.7.2", "bs58": "^4.0.1", "uuid": "^9.0.1", diff --git a/packages/client/src/external-id-attestation-requestor-client.ts b/packages/client/src/external-id-attestation-requestor-client.ts index 2c0113e..9441475 100644 --- a/packages/client/src/external-id-attestation-requestor-client.ts +++ b/packages/client/src/external-id-attestation-requestor-client.ts @@ -1,20 +1,18 @@ -import type { AppWebsocket, AppSignal } from "@holochain/client"; +import type { AppWebsocket, AppSignal, Record } from "@holochain/client"; import { v4 as uuidV4 } from "uuid"; import { - ExternalIdAttestation, LocalHoloomSignal, SendExternalIdAttestationRequestPayload, } from "@holoom/types"; -import { decodeAppEntry } from "./utils"; import { PickByType } from "./types"; type ExternalIdAttested = PickByType; type ExternalIdRejected = PickByType; class RequestResolver { - resolve!: (attestation: ExternalIdAttestation) => void; + resolve!: (record: Record) => void; reject!: (reason: string) => void; - prom = new Promise((resolve, reject) => { + prom = new Promise((resolve, reject) => { this.resolve = resolve; this.reject = reject; }); @@ -55,7 +53,7 @@ export class ExternalIdAttestationRequestorClient { async requestExternalIdAttestation( codeVerifier: string, code: string - ): Promise { + ): Promise { const requestId = uuidV4(); const resolver = new RequestResolver(); this.resolvers[requestId] = resolver; @@ -93,14 +91,12 @@ export class ExternalIdAttestationRequestorClient { private handleExternalIdAttested(signal: ExternalIdAttested) { try { - const attestation = decodeAppEntry(signal.record); - const resolver = this.resolvers[signal.request_id]; if (!resolver) { console.error(`Resolver for ${signal.request_id} not found`); return; } - resolver.resolve(attestation); + resolver.resolve(signal.record); } catch (err) { console.error( "ExternalIdAttestationRequestorClient failed to decode ExternalIdAttestation" diff --git a/packages/client/src/index.ts b/packages/client/src/index.ts index b368805..d561462 100644 --- a/packages/client/src/index.ts +++ b/packages/client/src/index.ts @@ -2,4 +2,5 @@ export { HoloomClient } from "./holoom-client"; export { ExternalIdAttestationRequestorClient } from "./external-id-attestation-requestor-client"; export { EvmBytesSignatureRequestorClient } from "./evm-bytes-signature-requestor-client"; export { FaceitAuthFlowClient } from "./faceit-auth-flow-client"; +export * from "./utils"; export * from "@holoom/types"; diff --git a/packages/e2e/src/main.ts b/packages/e2e/src/main.ts index 11112ed..4f2661e 100644 --- a/packages/e2e/src/main.ts +++ b/packages/e2e/src/main.ts @@ -5,6 +5,7 @@ import { FaceitAuthFlowClient, ExternalIdAttestationRequestorClient, EvmBytesSignatureRequestorClient, + decodeAppEntry, } from "@holoom/client"; import WebSdkApi, { ChaperoneState } from "@holo-host/web-sdk"; @@ -54,8 +55,9 @@ async function createClients() { ); if (window.location.pathname.includes("/auth/callback")) { const { code, codeVerifier } = faceitAuthFlow.getCodes(); - global.externalIdRequestProm = - externalIdRequestor.requestExternalIdAttestation(codeVerifier!, code!); + global.externalIdRequestProm = externalIdRequestor + .requestExternalIdAttestation(codeVerifier!, code!) + .then(decodeAppEntry); } else { } return { diff --git a/packages/e2e/tests/evm-wallet-binding.test.js b/packages/e2e/tests/evm-wallet-binding.test.js index ef983fc..5ebc612 100644 --- a/packages/e2e/tests/evm-wallet-binding.test.js +++ b/packages/e2e/tests/evm-wallet-binding.test.js @@ -6,7 +6,7 @@ const { queryFetch } = require("./utils/query"); describe("EVM Wallet Binding", () => { let testContainers; beforeEach(async () => { - testContainers = await startTestContainers({ rocket: true }); + testContainers = await startTestContainers({ query: true }); }, 60_000); afterEach(async () => { await Promise.all([testContainers?.stop(), jestPuppeteer.resetPage()]); @@ -32,7 +32,7 @@ describe("EVM Wallet Binding", () => { evm_addresses: [], solana_addresses: [], }); - debug("Checked rocket serves empty wallet list"); + debug("Checked query serves empty wallet list"); // Setup EVM signer in memory // First account of seed phrase: test test test test test test test test test test test junk @@ -71,7 +71,7 @@ describe("EVM Wallet Binding", () => { } debug("Polled bound wallets until correctly gossiped"); - // Poll rocket until bound wallet gossiped + // Poll query until bound wallet gossiped while (true) { const data = await queryFetch( `username_registry/${agentPubKeyB64}/wallets` @@ -86,6 +86,6 @@ describe("EVM Wallet Binding", () => { } await new Promise((r) => setTimeout(r, 500)); } - debug("Polled bound wallets on rocket until correctly gossiped"); + debug("Polled bound wallets on query until correctly gossiped"); }, 120_000); }); diff --git a/packages/e2e/tests/metadata.test.js b/packages/e2e/tests/metadata.test.js index 4baa848..14bc781 100644 --- a/packages/e2e/tests/metadata.test.js +++ b/packages/e2e/tests/metadata.test.js @@ -5,7 +5,7 @@ const { queryFetch } = require("./utils/query"); describe("metadata", () => { let testContainers; beforeEach(async () => { - testContainers = await startTestContainers({ rocket: true }); + testContainers = await startTestContainers({ query: true }); }, 60_000); afterEach(async () => { await Promise.all([testContainers?.stop(), jestPuppeteer.resetPage()]); @@ -29,7 +29,7 @@ describe("metadata", () => { success: true, metadata: {}, }); - debug("Checked rocket serves empty metadata"); + debug("Checked query serves empty metadata"); await expect( page.evaluate(() => @@ -83,6 +83,6 @@ describe("metadata", () => { } await new Promise((r) => setTimeout(r, 500)); } - debug("Polled rocket metadata until metadata matched expected"); + debug("Polled query metadata until metadata matched expected"); }, 120_000); }); diff --git a/packages/e2e/tests/username.test.js b/packages/e2e/tests/username.test.js index e922792..b286153 100644 --- a/packages/e2e/tests/username.test.js +++ b/packages/e2e/tests/username.test.js @@ -5,7 +5,7 @@ const { queryFetch } = require("./utils/query"); describe("username", () => { let testContainers; beforeEach(async () => { - testContainers = await startTestContainers({ rocket: true }); + testContainers = await startTestContainers({ query: true }); }, 60_000); afterEach(async () => { await Promise.all([testContainers?.stop(), jestPuppeteer.resetPage()]); @@ -26,7 +26,7 @@ describe("username", () => { success: true, items: [], }); - debug("Checked rocket serves empty user list"); + debug("Checked query serves empty user list"); // First register succeeds await expect( @@ -53,6 +53,6 @@ describe("username", () => { await expect(queryFetch("username_registry")).resolves.toSatisfy( (data) => data.items.length === 1 && data.items[0].username === "test1234" ); - debug("Checked rocket serves single user"); + debug("Checked query serves single user"); }, 120_000); }); diff --git a/packages/e2e/tests/utils/testcontainers.js b/packages/e2e/tests/utils/testcontainers.js index 52e867c..19085b8 100644 --- a/packages/e2e/tests/utils/testcontainers.js +++ b/packages/e2e/tests/utils/testcontainers.js @@ -55,7 +55,7 @@ function startHoloContainer(network, localServicesIp) { .start(); } -function startRocketContainer(network, authorityIp) { +function startQueryContainer(network, authorityIp) { return new GenericContainer("holoom/query") .withExposedPorts({ host: 8000, container: 8000 }) .withNetwork(network) @@ -156,10 +156,10 @@ module.exports.startTestContainers = async (opts = {}) => { const containerProms = [localServicesProm, authorityProm, holoProm]; - if (opts.rocket) { + if (opts.query) { containerProms.push( authorityIpProm.then((authorityIp) => - startRocketContainer(network, authorityIp) + startQueryContainer(network, authorityIp) ) ); } diff --git a/packages/types/package.json b/packages/types/package.json index f6d91e6..13dca5e 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@holoom/types", - "version": "0.1.0-dev.9", + "version": "0.1.0-dev.10", "description": "Types generated from the holoom_types rust lib", "type": "module", "license": "MIT",