Skip to content

Commit 7df8bfa

Browse files
authored
chore: update libnpmpublish mocks for [email protected] (#6309)
1 parent e652dbd commit 7df8bfa

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

workspaces/libnpmpublish/test/publish.js

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,13 @@ t.test('publish existing package with provenance in gha', async t => {
668668
const fulcioURL = 'https://mock.fulcio'
669669
const leafCertificate = `-----BEGIN CERTIFICATE-----\nabc\n-----END CERTIFICATE-----\n`
670670
const rootCertificate = `-----BEGIN CERTIFICATE-----\nxyz\n-----END CERTIFICATE-----\n`
671-
const certificate = [leafCertificate, rootCertificate].join()
671+
const certificateResponse = {
672+
signedCertificateEmbeddedSct: {
673+
chain: {
674+
certificates: [leafCertificate, rootCertificate],
675+
},
676+
},
677+
}
672678

673679
// Data for mocking Rekor upload
674680
const rekorURL = 'https://mock.rekor'
@@ -749,14 +755,18 @@ t.test('publish existing package with provenance in gha', async t => {
749755
}).reply(200, { value: idToken })
750756

751757
const fulcioSrv = MockRegistry.tnock(t, fulcioURL)
752-
fulcioSrv.matchHeader('Accept', 'application/pem-certificate-chain')
753-
.matchHeader('Content-Type', 'application/json')
754-
.matchHeader('Authorization', `Bearer ${idToken}`)
755-
.post('/api/v1/signingCert', {
756-
publicKey: { content: /.+/i },
757-
signedEmailAddress: /.+/i,
758+
fulcioSrv.matchHeader('Content-Type', 'application/json')
759+
.post('/api/v2/signingCert', {
760+
credentials: { oidcIdentityToken: idToken },
761+
publicKeyRequest: {
762+
publicKey: {
763+
algorithm: 'ECDSA',
764+
content: /.+/i,
765+
},
766+
proofOfPossession: /.+/i,
767+
},
758768
})
759-
.reply(200, certificate)
769+
.reply(200, certificateResponse)
760770

761771
const rekorSrv = MockRegistry.tnock(t, rekorURL)
762772
rekorSrv

0 commit comments

Comments
 (0)