Skip to content
This repository has been archived by the owner on Jul 21, 2023. It is now read-only.

Commit

Permalink
deps: update protons to support no-copy ops (#268)
Browse files Browse the repository at this point in the history
  • Loading branch information
achingbrain committed Jul 31, 2022
1 parent 10ca181 commit 920b081
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 12 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,14 +185,14 @@
"iso-random-stream": "^2.0.0",
"multiformats": "^9.4.5",
"node-forge": "^1.1.0",
"protons-runtime": "^1.0.4",
"protons-runtime": "^2.0.2",
"uint8arrays": "^3.0.0"
},
"devDependencies": {
"@types/mocha": "^9.0.0",
"aegir": "^37.0.12",
"benchmark": "^2.1.4",
"protons": "^3.0.4",
"protons": "^4.0.1",
"sinon": "^14.0.0",
"util": "^0.12.3",
"wherearewe": "^1.0.0"
Expand Down
4 changes: 2 additions & 2 deletions src/keys/ed25519-class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class Ed25519PublicKey {
return pbm.PublicKey.encode({
Type: pbm.KeyType.Ed25519,
Data: this.marshal()
})
}).subarray()
}

equals (key: any) {
Expand Down Expand Up @@ -67,7 +67,7 @@ export class Ed25519PrivateKey {
return pbm.PrivateKey.encode({
Type: pbm.KeyType.Ed25519,
Data: this.marshal()
})
}).subarray()
}

equals (key: any) {
Expand Down
9 changes: 5 additions & 4 deletions src/keys/keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import { enumeration, encodeMessage, decodeMessage, message, bytes } from 'protons-runtime'
import type { Codec } from 'protons-runtime'
import type { Uint8ArrayList } from 'uint8arraylist'

export enum KeyType {
RSA = 'RSA',
Expand Down Expand Up @@ -34,11 +35,11 @@ export namespace PublicKey {
})
}

export const encode = (obj: PublicKey): Uint8Array => {
export const encode = (obj: PublicKey): Uint8ArrayList => {
return encodeMessage(obj, PublicKey.codec())
}

export const decode = (buf: Uint8Array): PublicKey => {
export const decode = (buf: Uint8Array | Uint8ArrayList): PublicKey => {
return decodeMessage(buf, PublicKey.codec())
}
}
Expand All @@ -56,11 +57,11 @@ export namespace PrivateKey {
})
}

export const encode = (obj: PrivateKey): Uint8Array => {
export const encode = (obj: PrivateKey): Uint8ArrayList => {
return encodeMessage(obj, PrivateKey.codec())
}

export const decode = (buf: Uint8Array): PrivateKey => {
export const decode = (buf: Uint8Array | Uint8ArrayList): PrivateKey => {
return decodeMessage(buf, PrivateKey.codec())
}
}
4 changes: 2 additions & 2 deletions src/keys/rsa-class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class RsaPublicKey {
return pbm.PublicKey.encode({
Type: pbm.KeyType.RSA,
Data: this.marshal()
})
}).subarray()
}

encrypt (bytes: Uint8Array) {
Expand Down Expand Up @@ -84,7 +84,7 @@ export class RsaPrivateKey {
return pbm.PrivateKey.encode({
Type: pbm.KeyType.RSA,
Data: this.marshal()
})
}).subarray()
}

equals (key: any) {
Expand Down
4 changes: 2 additions & 2 deletions src/keys/secp256k1-class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class Secp256k1PublicKey {
return keysProtobuf.PublicKey.encode({
Type: keysProtobuf.KeyType.Secp256k1,
Data: this.marshal()
})
}).subarray()
}

equals (key: any) {
Expand Down Expand Up @@ -67,7 +67,7 @@ export class Secp256k1PrivateKey {
return keysProtobuf.PrivateKey.encode({
Type: keysProtobuf.KeyType.Secp256k1,
Data: this.marshal()
})
}).subarray()
}

equals (key: any) {
Expand Down

0 comments on commit 920b081

Please sign in to comment.