Skip to content

Commit

Permalink
fix: string pattern for IPFS CIDv1 hashes (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
guidota authored Nov 17, 2021
1 parent bc28268 commit 6479aa8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/misc/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ export type IPFSv2 = string
export namespace IPFSv2 {
export const schema: JSONSchema<IPFSv2> = {
type: 'string',
pattern: '^(bafy)[a-zA-Z0-9]{55}$'
pattern: '^(ba)[a-zA-Z0-9]{57}$'
}
const schemaValidator: ValidateFunction<IPFSv2> = generateValidator(schema);
export const validate: ValidateFunction<IPFSv2> = (hash: any): hash is IPFSv2 =>
schemaValidator(hash)
}
}

0 comments on commit 6479aa8

Please sign in to comment.