Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps(dev): bump aegir from 37.12.1 to 38.1.7 #211

Merged
merged 3 commits into from
Mar 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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