Skip to content

Commit

Permalink
deps(dev): bump aegir from 37.12.1 to 38.1.7 (#211)
Browse files Browse the repository at this point in the history
* deps(dev): bump aegir from 37.12.1 to 38.1.7

Bumps [aegir](https://github.com/ipfs/aegir) from 37.12.1 to 38.1.7.
- [Release notes](https://github.com/ipfs/aegir/releases)
- [Changelog](https://github.com/ipfs/aegir/blob/master/CHANGELOG.md)
- [Commits](ipfs/aegir@v37.12.1...v38.1.7)

---
updated-dependencies:
- dependency-name: aegir
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* chore: fix linting and deps

* chore: fix build

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: achingbrain <alex@achingbrain.net>
  • Loading branch information
dependabot[bot] and achingbrain authored Mar 21, 2023
1 parent e7acdb9 commit 9b7cca0
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 11 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
"scripts": {
"clean": "aegir clean",
"lint": "aegir lint",
"dep-check": "aegir dep-check",
"dep-check": "aegir dep-check -i protons",
"build": "aegir build",
"test": "aegir test",
"test:node": "aegir test -t node --cov",
Expand All @@ -181,11 +181,12 @@
"multiformats": "^11.0.0",
"protons-runtime": "^4.0.1",
"timestamp-nano": "^1.0.0",
"uint8arraylist": "^2.4.3",
"uint8arrays": "^4.0.2"
},
"devDependencies": {
"@libp2p/peer-id-factory": "^2.0.0",
"aegir": "^37.0.11",
"aegir": "^38.1.7",
"protons": "^6.0.1"
}
}
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ const _create = async (peerId: PeerId, value: Uint8Array, seq: number | bigint,
const entry: IPNSEntry = {
value,
signature: signatureV1,
validityType: validityType,
validityType,
validity: isoValidity,
sequence: seq,
ttl,
Expand Down Expand Up @@ -146,7 +146,7 @@ export { peerIdFromRoutingKey } from './utils.js'
/**
* Sign ipns record data using the legacy V1 signature scheme
*/
const signLegacyV1 = async (privateKey: PrivateKey, value: Uint8Array, validityType: IpnsEntry.ValidityType, validity: Uint8Array) => {
const signLegacyV1 = async (privateKey: PrivateKey, value: Uint8Array, validityType: IpnsEntry.ValidityType, validity: Uint8Array): Promise<Uint8Array> => {
try {
const dataForSignature = ipnsEntryDataForV1Sig(value, validityType, validity)

Expand Down
2 changes: 1 addition & 1 deletion src/pb/ipns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export namespace IpnsEntry {
}

export namespace ValidityType {
export const codec = () => {
export const codec = (): Codec<ValidityType> => {
return enumeration<ValidityType>(__ValidityTypeValues)
}
}
Expand Down
9 changes: 5 additions & 4 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { IpnsEntry } from './pb/ipns.js'
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
import { concat as uint8ArrayConcat } from 'uint8arrays/concat'
import * as cborg from 'cborg'
import type { PublicKey } from '@libp2p/interface-keys'

const log = logger('ipns:utils')
const IPNS_PREFIX = uint8ArrayFromString('/ipns/')
Expand All @@ -17,7 +18,7 @@ const IPNS_PREFIX = uint8ArrayFromString('/ipns/')
* Convert a JavaScript date into an `RFC3339Nano` formatted
* string
*/
export function toRFC3339 (time: Date) {
export function toRFC3339 (time: Date): string {
const year = time.getUTCFullYear()
const month = String(time.getUTCMonth() + 1).padStart(2, '0')
const day = String(time.getUTCDate()).padStart(2, '0')
Expand All @@ -34,7 +35,7 @@ export function toRFC3339 (time: Date) {
* Parses a date string formatted as `RFC3339Nano` into a
* JavaScript Date object
*/
export function parseRFC3339 (time: string) {
export function parseRFC3339 (time: string): Date {
const rfc3339Matcher = new RegExp(
// 2006-01-02T
'(\\d{4})-(\\d{2})-(\\d{2})T' +
Expand Down Expand Up @@ -64,15 +65,15 @@ export function parseRFC3339 (time: string) {
* Extracts a public key from the passed PeerId, falling
* back to the pubKey embedded in the ipns record
*/
export const extractPublicKey = async (peerId: PeerId, entry: IpnsEntry) => {
export const extractPublicKey = async (peerId: PeerId, entry: IpnsEntry): Promise<PublicKey> => {
if (entry == null || peerId == null) {
const error = new Error('one or more of the provided parameters are not defined')

log.error(error)
throw errCode(error, ERRORS.ERR_UNDEFINED_PARAMETER)
}

let pubKey
let pubKey: PublicKey | undefined

if (entry.pubKey != null) {
try {
Expand Down
4 changes: 2 additions & 2 deletions src/validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const log = logger('ipns:validator')
/**
* Validates the given ipns entry against the given public key
*/
export const validate = async (publicKey: PublicKey, entry: IPNSEntry) => {
export const validate = async (publicKey: PublicKey, entry: IPNSEntry): Promise<void> => {
const { value, validityType, validity } = entry

let dataForSignature: Uint8Array
Expand Down Expand Up @@ -65,7 +65,7 @@ export const validate = async (publicKey: PublicKey, entry: IPNSEntry) => {
log('ipns entry for %b is valid', value)
}

const validateCborDataMatchesPbData = (entry: IPNSEntry) => {
const validateCborDataMatchesPbData = (entry: IPNSEntry): void => {
if (entry.data == null) {
throw errCode(new Error('Record data is missing'), ERRORS.ERR_INVALID_RECORD_DATA)
}
Expand Down

0 comments on commit 9b7cca0

Please sign in to comment.