-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: add Noise Extensions and update deps (#215)
* feat: Add Noise Extensions * Remove remoteEarlyData and lint:fix * Add workaround for proto2 issue * Use new interface defs * chore: fix lint * fix: proto file to pass interop tests Co-authored-by: Marin Petrunic <[email protected]>
- Loading branch information
Showing
10 changed files
with
188 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
import type { PeerId } from '@libp2p/interface-peer-id' | ||
import type { bytes } from './basic.js' | ||
import type { NoiseSession } from './handshake.js' | ||
import type { NoiseExtensions } from '../proto/payload.js' | ||
|
||
export interface IHandshake { | ||
session: NoiseSession | ||
remotePeer: PeerId | ||
remoteEarlyData: bytes | ||
remoteExtensions: NoiseExtensions | ||
encrypt: (plaintext: bytes, session: NoiseSession) => bytes | ||
decrypt: (ciphertext: bytes, session: NoiseSession) => {plaintext: bytes, valid: boolean} | ||
decrypt: (ciphertext: bytes, session: NoiseSession) => { plaintext: bytes, valid: boolean } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
import type { ConnectionEncrypter } from '@libp2p/interface-connection-encrypter' | ||
import type { bytes, bytes32 } from './basic.js' | ||
import type { NoiseExtensions } from '../proto/payload.js' | ||
import type { bytes32 } from './basic.js' | ||
|
||
export interface KeyPair { | ||
publicKey: bytes32 | ||
privateKey: bytes32 | ||
} | ||
|
||
export interface INoiseConnection extends ConnectionEncrypter { | ||
remoteEarlyData?: () => bytes | ||
} | ||
export interface INoiseConnection extends ConnectionEncrypter<NoiseExtensions> {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
syntax = "proto3"; | ||
package pb; | ||
|
||
message NoiseHandshakePayload { | ||
bytes identity_key = 1; | ||
bytes identity_sig = 2; | ||
bytes data = 3; | ||
message NoiseExtensions { | ||
repeated bytes webtransport_certhashes = 1; | ||
} | ||
|
||
message NoiseHandshakePayload { | ||
bytes identity_key = 1; | ||
bytes identity_sig = 2; | ||
optional NoiseExtensions extensions = 4; | ||
} |
Oops, something went wrong.