Skip to content

Update protobufjs from v5 to v7#21

Merged
stefanrammo merged 1 commit intomainfrom
update-protobufjs
Nov 28, 2025
Merged

Update protobufjs from v5 to v7#21
stefanrammo merged 1 commit intomainfrom
update-protobufjs

Conversation

@stefanrammo
Copy link
Copy Markdown
Collaborator

API changes required for v7:

  • loadProto().build() -> parse().root.lookupType()/lookupEnum().values
  • new Type() -> Type.create()
  • .toArrayBuffer() -> .encode().finish()
  • .decode(buf) -> .decode(new Uint8Array(buf))
  • snake_case -> camelCase field names (automatic in v7)
  • ByteBuffer -> Uint8Array for bytes fields

Behavior change for empty bytes handling:

  • Check hello.challenge && hello.challenge.length because v7 returns empty Uint8Array (truthy) for unset bytes fields instead of null

API changes required for v7:
- loadProto().build() -> parse().root.lookupType()/lookupEnum().values
- new Type() -> Type.create()
- .toArrayBuffer() -> .encode().finish()
- .decode(buf) -> .decode(new Uint8Array(buf))
- snake_case -> camelCase field names (automatic in v7)
- ByteBuffer -> Uint8Array for bytes fields

Behavior change for empty bytes handling:
- Check hello.challenge && hello.challenge.length because v7 returns
  empty Uint8Array (truthy) for unset bytes fields instead of null
@stefanrammo stefanrammo requested a review from Karmo7 November 27, 2025 12:51
Comment thread index.js
crypto.subtle.digest('SHA-256', credentials.buffer)
.then(function(digest) {
var colon = new Int8Array([':'.charCodeAt(0)]);
var buffer = obj.appendBuffer(obj.appendBuffer(challenge.buffer.slice(challenge.offset, challenge.limit), colon.buffer), digest);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The slicing is not needed anymore?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The slice was needed in v5 for ByteBuffer. In v7 protobufjs the bytes are just the challenge payload as Uint8Array. ByteBuffer was removed in protobufjs v6 as a dependency.

@stefanrammo stefanrammo merged commit b88174a into main Nov 28, 2025
1 check passed
@stefanrammo stefanrammo deleted the update-protobufjs branch November 28, 2025 08:40
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.

2 participants