Skip to content

Commit

Permalink
deps: update all deps (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
achingbrain authored Aug 10, 2022
1 parent 31dc528 commit 5d5d788
Show file tree
Hide file tree
Showing 8 changed files with 591 additions and 70 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@
"dependencies": {
"@libp2p/components": "^2.0.0",
"@libp2p/crypto": "^1.0.0",
"@libp2p/interface-connection": "^2.0.0",
"@libp2p/interface-connection": "^3.0.1",
"@libp2p/interface-peer-id": "^1.0.2",
"@libp2p/interface-pubsub": "^2.0.0",
"@libp2p/interface-registrar": "^2.0.0",
Expand All @@ -205,8 +205,8 @@
"it-pair": "^2.0.2",
"p-defer": "^4.0.0",
"p-wait-for": "^5.0.0",
"protons": "^4.0.1",
"protons-runtime": "^2.0.2",
"protons": "^5.0.0",
"protons-runtime": "^3.0.1",
"sinon": "^14.0.0",
"util": "^0.12.4"
}
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -485,13 +485,13 @@ export abstract class PubSubBaseProtocol<Events = PubSubEvents> extends EventEmi
* Encode RPC object into a Uint8Array.
* This can be override to use a custom router protobuf.
*/
abstract encodeRpc (rpc: PubSubRPC): Uint8ArrayList
abstract encodeRpc (rpc: PubSubRPC): Uint8Array

/**
* Encode RPC object into a Uint8Array.
* This can be override to use a custom router protobuf.
*/
abstract encodeMessage (rpc: PubSubRPCMessage): Uint8ArrayList
abstract encodeMessage (rpc: PubSubRPCMessage): Uint8Array

/**
* Send an rpc object to a peer
Expand Down
5 changes: 2 additions & 3 deletions src/sign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ import type { PeerId } from '@libp2p/interface-peer-id'
import { keys } from '@libp2p/crypto'
import type { PubSubRPCMessage, SignedMessage } from '@libp2p/interface-pubsub'
import { peerIdFromKeys } from '@libp2p/peer-id'
import type { Uint8ArrayList } from 'uint8arraylist'

export const SignPrefix = uint8ArrayFromString('libp2p-pubsub:')

/**
* Signs the provided message with the given `peerId`
*/
export async function signMessage (peerId: PeerId, message: { from: PeerId, topic: string, data: Uint8Array, sequenceNumber: bigint }, encode: (rpc: PubSubRPCMessage) => Uint8ArrayList): Promise<SignedMessage> {
export async function signMessage (peerId: PeerId, message: { from: PeerId, topic: string, data: Uint8Array, sequenceNumber: bigint }, encode: (rpc: PubSubRPCMessage) => Uint8Array): Promise<SignedMessage> {
if (peerId.privateKey == null) {
throw new Error('Cannot sign message, no private key present')
}
Expand Down Expand Up @@ -46,7 +45,7 @@ export async function signMessage (peerId: PeerId, message: { from: PeerId, topi
/**
* Verifies the signature of the given message
*/
export async function verifySignature (message: SignedMessage, encode: (rpc: PubSubRPCMessage) => Uint8ArrayList) {
export async function verifySignature (message: SignedMessage, encode: (rpc: PubSubRPCMessage) => Uint8Array) {
if (message.type !== 'signed') {
throw new Error('Message type must be "signed" to be verified')
}
Expand Down
4 changes: 2 additions & 2 deletions test/instance.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ class PubsubProtocol extends PubSubBaseProtocol {
throw new Error('Method not implemented.')
}

encodeRpc (rpc: PubSubRPC): Uint8ArrayList {
encodeRpc (rpc: PubSubRPC): Uint8Array {
throw new Error('Method not implemented.')
}

decodeMessage (bytes: Uint8Array | Uint8ArrayList): PubSubRPCMessage {
throw new Error('Method not implemented.')
}

encodeMessage (rpc: PubSubRPCMessage): Uint8ArrayList {
encodeMessage (rpc: PubSubRPCMessage): Uint8Array {
throw new Error('Method not implemented.')
}

Expand Down
4 changes: 2 additions & 2 deletions test/lifecycle.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ class PubsubProtocol extends PubSubBaseProtocol {
throw new Error('Method not implemented.')
}

encodeRpc (rpc: PubSubRPC): Uint8ArrayList {
encodeRpc (rpc: PubSubRPC): Uint8Array {
throw new Error('Method not implemented.')
}

decodeMessage (bytes: Uint8Array | Uint8ArrayList): PubSubRPCMessage {
throw new Error('Method not implemented.')
}

encodeMessage (rpc: PubSubRPCMessage): Uint8ArrayList {
encodeMessage (rpc: PubSubRPCMessage): Uint8Array {
throw new Error('Method not implemented.')
}

Expand Down
Loading

0 comments on commit 5d5d788

Please sign in to comment.