Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update MapeoManager to return and handle project public IDs #247

Merged
merged 4 commits into from
Sep 6, 2023

Conversation

achou11
Copy link
Member

@achou11 achou11 commented Sep 5, 2023

Closes #234

Notes:

  • Updates @mapeo/crypto to 1.0.0-alpha.8
  • Adds two opaque types: ProjectId and ProjectPublicId.
    • ProjectId refers to the "internal" project id, whereas ProjectPublicId is what's used for client consumption
  • Adds a projectPublicId column to the projectKeys client db table
    • Tried a couple of things, but wasn't able to get Drizzle to understand that the projectPublicId column should store and return the opaque ProjectPublicId type. Pretty sure there's a way but my initial attempts failed me. For now, there are a couple of type casts in the manager code.

* @returns {Buffer} 24-byte nonce (same length as sodium.crypto_aead_xchacha20poly1305_ietf_NPUBBYTES)
*/
export function projectIdToNonce(projectId) {
return Buffer.from(projectId, 'hex').subarray(0, 24)
Copy link
Member Author

Choose a reason for hiding this comment

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

didn't use the sodium constant because it seems that sodium-javascript doesn't export it

@achou11 achou11 changed the title fix: update MapeoManager to return and handle project public IDs update MapeoManager to return and handle project public IDs Sep 5, 2023
@achou11 achou11 requested a review from gmaclennan September 5, 2023 21:13
Copy link
Member

@gmaclennan gmaclennan left a comment

Choose a reason for hiding this comment

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

Looks good to me 👍

@achou11 achou11 force-pushed the 234/project-public-id branch from e57cd47 to ebce746 Compare September 6, 2023 14:09
@achou11 achou11 merged commit 5b0361c into main Sep 6, 2023
@achou11 achou11 deleted the 234/project-public-id branch September 6, 2023 14:15
gmaclennan added a commit that referenced this pull request Sep 7, 2023
* main:
  expose member namespace in MapeoProject (#253)
  blobStore.createReadStream should not wait (#243)
  update MapeoManager to return and handle project public IDs (#247)
  return content hash from blobApi.create (#242)
gmaclennan added a commit that referenced this pull request Sep 12, 2023
* main:
  feat: Add set & get deviceInfo & datatype (#250)
  expose member namespace in MapeoProject (#253)
  blobStore.createReadStream should not wait (#243)
  update MapeoManager to return and handle project public IDs (#247)
  return content hash from blobApi.create (#242)
gmaclennan added a commit that referenced this pull request Sep 19, 2023
* main:
  chore: condense setup code in MemberAPI tests (#267)
  chore: replace queries opt in MemberAPI with dataType (#266)
  feat: add getMany method to member api (#263)
  feat: add getById method to member api (#262)
  chore: Update @digidem/types and remove patch (#269)
  feat: share all core keys via extension messages (#264)
  feat: send core "haves" bitfield on first connect (#254)
  fix: invite.encryptionKeys should be required (#260)
  feat: Add set & get deviceInfo & datatype (#250)
  expose member namespace in MapeoProject (#253)
  blobStore.createReadStream should not wait (#243)
  update MapeoManager to return and handle project public IDs (#247)
  return content hash from blobApi.create (#242)
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.

Use @mapeo/crypto to derive project id from project key
2 participants