Skip to content

Conversation

cmwhited
Copy link
Collaborator

@cmwhited cmwhited commented Jan 9, 2025

Description

Closes #85

This came from a few discussions, but the goal of this is to move the functionality in the:

  • graph-framework
  • graph-framework-utils/identity/messages/key/schema/space-events

packages into one publishable package: hypergraph (with npm name @graphprotocol/hypergraph).

This will be the package that devs will install in their apps to interact with the hypergraph framework.

Can import like:

// import everything from the top-level, which exports all sub-packages
import { GraphFramework, Schema } from '@graphprotocol/hypergraph'
// or from the sub-package directly
import { Schema } from '@graphprotocol/hypergraph/schema'
// or as a barrel import
import * as Schema from '@graphprotocol/hypergraph/schema'

This first PR just moved the code/files/tests into this newly created and setup hypergraph package.

Followup PRs will be made to:

  • update apps/server & apps/events to import from hypergraph
  • delete graph-framework{-identity/key/messages/schema/space-events/utils} packages
    • and cleanup all the vitest/tsconfig, etc
  • remove the react dependency and put into separate @graphprotocol/hypergraph-react package
  • setup changesets for publishing

Notes

A couple tests broke?? Not sure if it was due to dependency updates or what. But may need help fixing cc @nikgraf @pcarranzav


describe('identity encryption', () => {
// figure out why this test is failing
it.skip('should encrypt and decrypt an identity using a wallet', async () => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pcarranzav will need your help once you return. I am not sure why this test, is suddenly failing; but passes in the graph-framework-identity package. I tried making sure deps were all the same, etc. Not sure what is going on. Here is the failure:

TypeError: Failed to normalize algorithm: 'info' of 'HkdfParams' (passed algorithm) is not instance of ArrayBuffer, Buffer, TypedArray, or DataView.
 ❯ hkdf ../../node_modules/.pnpm/@[email protected][email protected][email protected][email protected][email protected]/node_modules/@xmtp/xmtp-js/src/encryption/encryption.ts:79:24
 ❯ Module.encrypt$1 ../../node_modules/.pnpm/@[email protected][email protected][email protected][email protected][email protected]/node_modules/@xmtp/xmtp-js/src/encryption/encryption.ts:25:15
 ❯ Module.encryptIdentity src/identity/identity-encryption.ts:46:34
     44|   ].join('\n');
     45|   const keysMsg = new TextEncoder().encode(keysTxt);
     46|   const ciphertext = bytesToHex((await encrypt(keysMsg, secretKey)).toBytes());
       |                                  ^
     47|   return { ciphertext, nonce: bytesToHex(nonce) };
     48| }

@nikgraf nikgraf force-pushed the chris.whited/chore-consolidate-pkg branch from fd8cc74 to 61c14f8 Compare January 14, 2025 08:13
@cmwhited
Copy link
Collaborator Author

Replaced by #89

@cmwhited cmwhited closed this Jan 14, 2025
@cmwhited cmwhited deleted the chris.whited/chore-consolidate-pkg branch January 18, 2025 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[RFC] Consolidate packages and update names to hypergraph approach

1 participant