Skip to content

Commit

Permalink
proof cid for test uses base64 multibase
Browse files Browse the repository at this point in the history
  • Loading branch information
gobengo committed Mar 21, 2024
1 parent 96fe60f commit 2171390
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 1 addition & 2 deletions packages/api/src/utils/w3up.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { StoreMemory } from '@web3-storage/access/stores/store-memory'
import { CID } from 'multiformats/cid'
import * as bases from 'multiformats/bases/base'
import { base64 } from 'multiformats/bases/base64'
import { base32 } from 'multiformats/bases/base32'
import { identity } from 'multiformats/hashes/identity'
import { CarReader, CarWriter } from '@ipld/car'
import { importDAG } from '@ucanto/core/delegation'
Expand Down Expand Up @@ -34,7 +33,7 @@ export async function getW3upClient({ principal, proof } = {}) {
async function parseW3Proof(proof) {
let cid
try {
cid = CID.parse(proof, bases.or(base64, base32))
cid = CID.parse(proof, base64)
} catch (/** @type {any} */ err) {
if (err?.message?.includes('Unexpected end of data')) {
console.error(
Expand Down
3 changes: 2 additions & 1 deletion packages/api/test/nfts-upload.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { createServer } from 'node:http'
import { ed25519 } from '@ucanto/principal'
import { delegate } from '@ucanto/core'
import { encodeDelegationAsCid } from '../src/utils/w3up.js'
import { base64 } from 'multiformats/bases/base64'

const __dirname = path.dirname(fileURLToPath(import.meta.url))

Expand All @@ -56,7 +57,7 @@ test.before(async (t) => {
],
})
)
).toString(),
).toString(base64),
},
})
})
Expand Down

0 comments on commit 2171390

Please sign in to comment.