Skip to content

Commit

Permalink
publish fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
OR13 committed Aug 10, 2024
1 parent a9d15a8 commit e5cd1b4
Show file tree
Hide file tree
Showing 19 changed files with 115 additions and 26 deletions.
1 change: 0 additions & 1 deletion scripts/.gitignore

This file was deleted.

32 changes: 16 additions & 16 deletions scripts/diagnostic.sh
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
rm ./scripts/diagnostic/*
echo '{"message":"⌛ My lungs taste the air of Time Blown past falling sands"}' > ./scripts/diagnostic/message.json
rm ./tests/fixtures/*
echo '{"message":"⌛ My lungs taste the air of Time Blown past falling sands"}' > ./tests/fixtures/message.json
npm run build

# signing keys
npm run -s transmute -- jose keygen --alg ES256 > ./scripts/diagnostic/private.sig.jwk.json
npm run -s transmute -- jose keypub ./scripts/diagnostic/private.sig.jwk.json > ./scripts/diagnostic/public.sig.jwk.json
npm run -s transmute -- jose keygen --alg ES256 > ./tests/fixtures/private.sig.jwk.json
npm run -s transmute -- jose keypub ./tests/fixtures/private.sig.jwk.json > ./tests/fixtures/public.sig.jwk.json

# encryption keys
npm run -s transmute -- jose keygen --alg ECDH-ES+A128KW --crv P-384 > ./scripts/diagnostic/private.enc.jwk.json
npm run -s transmute -- jose keypub ./scripts/diagnostic/private.enc.jwk.json > ./scripts/diagnostic/public.enc.jwk.json
npm run -s transmute -- jose keygen --alg ECDH-ES+A128KW --crv P-384 > ./tests/fixtures/private.enc.jwk.json
npm run -s transmute -- jose keypub ./tests/fixtures/private.enc.jwk.json > ./tests/fixtures/public.enc.jwk.json

# attached
npm run -s transmute -- jose sign ./scripts/diagnostic/private.sig.jwk.json ./scripts/diagnostic/message.json > ./scripts/diagnostic/message.signature.json
npm run -s transmute -- jose verify ./scripts/diagnostic/public.sig.jwk.json ./scripts/diagnostic/message.signature.json --output ./scripts/diagnostic/message.verified.json > ./scripts/diagnostic/message.signature.verified.json
npm run -s transmute -- jose sign ./tests/fixtures/private.sig.jwk.json ./tests/fixtures/message.json > ./tests/fixtures/message.signature.json
npm run -s transmute -- jose verify ./tests/fixtures/public.sig.jwk.json ./tests/fixtures/message.signature.json --output ./tests/fixtures/message.verified.json > ./tests/fixtures/message.signature.verified.json

# detached
npm run -s transmute -- jose sign ./scripts/diagnostic/private.sig.jwk.json ./scripts/diagnostic/message.json --detached > ./scripts/diagnostic/message.signature.detached.json
npm run -s transmute -- jose verify ./scripts/diagnostic/public.sig.jwk.json ./scripts/diagnostic/message.signature.detached.json ./scripts/diagnostic/message.json --detached> ./scripts/diagnostic/message.signature.detached.verified.json
npm run -s transmute -- jose sign ./tests/fixtures/private.sig.jwk.json ./tests/fixtures/message.json --detached > ./tests/fixtures/message.signature.detached.json
npm run -s transmute -- jose verify ./tests/fixtures/public.sig.jwk.json ./tests/fixtures/message.signature.detached.json ./tests/fixtures/message.json --detached> ./tests/fixtures/message.signature.detached.verified.json

# detached compact
npm run -s transmute -- jose sign ./scripts/diagnostic/private.sig.jwk.json ./scripts/diagnostic/message.json --detached --compact > ./scripts/diagnostic/message.signature.detached.compact.jws
npm run -s transmute -- jose verify ./scripts/diagnostic/public.sig.jwk.json ./scripts/diagnostic/message.signature.detached.compact.jws ./scripts/diagnostic/message.json --detached --compact > ./scripts/diagnostic/message.signature.detached.compact.jws.verified.json
npm run -s transmute -- jose sign ./tests/fixtures/private.sig.jwk.json ./tests/fixtures/message.json --detached --compact > ./tests/fixtures/message.signature.detached.compact.jws
npm run -s transmute -- jose verify ./tests/fixtures/public.sig.jwk.json ./tests/fixtures/message.signature.detached.compact.jws ./tests/fixtures/message.json --detached --compact > ./tests/fixtures/message.signature.detached.compact.jws.verified.json

# encrypt
npm run -s transmute -- jose encrypt ./scripts/diagnostic/public.enc.jwk.json ./scripts/diagnostic/message.json --enc A128GCM > ./scripts/diagnostic/message.ciphertext.json
npm run -s transmute -- jose decrypt ./scripts/diagnostic/private.enc.jwk.json ./scripts/diagnostic/message.ciphertext.json --output ./scripts/diagnostic/message.plaintext.json > ./scripts/diagnostic/message.decrypted.json
npm run -s transmute -- jose encrypt ./tests/fixtures/public.enc.jwk.json ./tests/fixtures/message.json --enc A128GCM > ./tests/fixtures/message.ciphertext.json
npm run -s transmute -- jose decrypt ./tests/fixtures/private.enc.jwk.json ./tests/fixtures/message.ciphertext.json --output ./tests/fixtures/message.plaintext.json > ./tests/fixtures/message.decrypted.json

# encrypt compact
npm run -s transmute -- jose encrypt ./scripts/diagnostic/public.enc.jwk.json ./scripts/diagnostic/message.json --enc A128GCM --compact > ./scripts/diagnostic/message.ciphertext.compact.jwe
npm run -s transmute -- jose decrypt ./scripts/diagnostic/private.enc.jwk.json ./scripts/diagnostic/message.ciphertext.compact.jwe --output ./scripts/diagnostic/message.plaintext.json --compact > ./scripts/diagnostic/message.decrypted.json
npm run -s transmute -- jose encrypt ./tests/fixtures/public.enc.jwk.json ./tests/fixtures/message.json --enc A128GCM --compact > ./tests/fixtures/message.ciphertext.compact.jwe
npm run -s transmute -- jose decrypt ./tests/fixtures/private.enc.jwk.json ./tests/fixtures/message.ciphertext.compact.jwe --output ./tests/fixtures/message.plaintext.json --compact > ./tests/fixtures/message.decrypted.json
18 changes: 9 additions & 9 deletions tests/facade.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,58 +22,58 @@ it('keygen', async () => {
})

it('keypub', async () => {
await facade(`jose keypub ./scripts/diagnostic/private.sig.jwk.json --verbose`)
await facade(`jose keypub ./tests/fixtures/private.sig.jwk.json --verbose`)
expect(debug).toHaveBeenCalledTimes(1)
expect(secret).toHaveBeenCalledTimes(1)
expect(output).toHaveBeenCalledTimes(1)
})

it('sign', async () => {
await facade(`jose sign ./scripts/diagnostic/private.sig.jwk.json ./scripts/diagnostic/message.json --verbose`)
await facade(`jose sign ./tests/fixtures/private.sig.jwk.json ./tests/fixtures/message.json --verbose`)
expect(debug).toHaveBeenCalledTimes(1)
expect(secret).toHaveBeenCalledTimes(1)
expect(output).toHaveBeenCalledTimes(1)
})

it('sign detached', async () => {
await facade(`jose sign ./scripts/diagnostic/private.sig.jwk.json ./scripts/diagnostic/message.json --verbose --detached`)
await facade(`jose sign ./tests/fixtures/private.sig.jwk.json ./tests/fixtures/message.json --verbose --detached`)
expect(debug).toHaveBeenCalledTimes(1)
expect(secret).toHaveBeenCalledTimes(1)
expect(output).toHaveBeenCalledTimes(1)
})

it('verify', async () => {
await facade(`jose verify ./scripts/diagnostic/public.sig.jwk.json ./scripts/diagnostic/message.signature.json --verbose`)
await facade(`jose verify ./tests/fixtures/public.sig.jwk.json ./tests/fixtures/message.signature.json --verbose`)
expect(debug).toHaveBeenCalledTimes(1)
expect(output).toHaveBeenCalledTimes(1)
})

it('verify detached', async () => {
await facade(`jose verify ./scripts/diagnostic/public.sig.jwk.json ./scripts/diagnostic/message.signature.detached.json ./scripts/diagnostic/message.json --verbose --detached`)
await facade(`jose verify ./tests/fixtures/public.sig.jwk.json ./tests/fixtures/message.signature.detached.json ./tests/fixtures/message.json --verbose --detached`)
expect(debug).toHaveBeenCalledTimes(1)
expect(output).toHaveBeenCalledTimes(1)
})

it('encrypt', async () => {
await facade(`jose encrypt ./scripts/diagnostic/public.enc.jwk.json ./scripts/diagnostic/message.json --verbose --enc A128GCM`)
await facade(`jose encrypt ./tests/fixtures/public.enc.jwk.json ./tests/fixtures/message.json --verbose --enc A128GCM`)
expect(debug).toHaveBeenCalledTimes(1)
expect(output).toHaveBeenCalledTimes(1)
})

it('decrypt', async () => {
await facade(`jose decrypt ./scripts/diagnostic/private.enc.jwk.json ./scripts/diagnostic/message.ciphertext.json --verbose`)
await facade(`jose decrypt ./tests/fixtures/private.enc.jwk.json ./tests/fixtures/message.ciphertext.json --verbose`)
expect(debug).toHaveBeenCalledTimes(1)
expect(output).toHaveBeenCalledTimes(1)
})

it('encrypt compact', async () => {
await facade(`jose encrypt ./scripts/diagnostic/public.enc.jwk.json ./scripts/diagnostic/message.json --verbose --enc A128GCM --compact`)
await facade(`jose encrypt ./tests/fixtures/public.enc.jwk.json ./tests/fixtures/message.json --verbose --enc A128GCM --compact`)
expect(debug).toHaveBeenCalledTimes(1)
expect(output).toHaveBeenCalledTimes(1)
})

it('decrypt compact', async () => {
await facade(`jose decrypt ./scripts/diagnostic/private.enc.jwk.json ./scripts/diagnostic/message.ciphertext.compact.jwe --verbose --compact`)
await facade(`jose decrypt ./tests/fixtures/private.enc.jwk.json ./tests/fixtures/message.ciphertext.compact.jwe --verbose --compact`)
expect(debug).toHaveBeenCalledTimes(1)
expect(output).toHaveBeenCalledTimes(1)
})
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/message.ciphertext.compact.jwe
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
eyJlbmMiOiJBMTI4R0NNIiwiYWxnIjoiRUNESC1FUytBMTI4S1ciLCJlcGsiOnsieCI6ImZ6NVBLUngwNG1FX2ZBX2NBYWNEY0c3N3p5U1h5WGJ3RTZaSU9MQlYyUWtyUFNGMDBxVVdETEFCQ2MtMWIxWXAiLCJjcnYiOiJQLTM4NCIsImt0eSI6IkVDIiwieSI6Il9IbUczQjRYaGxTbThJWDVqZHRWTHRXZ0RPWDJlU0lTWC03cU9PUkhVMkZBU3luRUZ1c3lyZGpTRm56UGFCbnUifX0.hQpufFxzUrZYiGg_QkWXfEj8GlR-AolX.Hfzg7NgxJyXN1Cli.U5X-1BrqQge7fC3_YHmc-s7Yyc0u3MWN1hgiz4XCxhaJfafqODMWJHuaJooNENoxFO0zz2zck1Ch7jHKCVZyUaEEqaJgd5pLbm8.HjDtvd4vDVECs3e9BZpfvw
14 changes: 14 additions & 0 deletions tests/fixtures/message.ciphertext.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"ciphertext": "zcTReJ_ldyUT0KheEePLwEU1zESl62AnZBAJ-c2u6XL3AI99uK5IlFeg2KWo1ROJUjzObeS-DSNiVrQDUFzEOjNxhcya073tExU",
"iv": "hysHgzpaW_LGJ4Ws",
"recipients": [
{
"encrypted_key": "lc5THKeZ0f811h8sSuLpw_JEzsHBbr48",
"header": {
"alg": "ECDH-ES+A128KW"
}
}
],
"tag": "L7HUNLLer8W7zbIgk3w1ag",
"protected": "eyJlbmMiOiJBMTI4R0NNIiwiZXBrIjp7IngiOiJzYlF0eUhXd1F2V0NBdl9mRVdEVFpPLURrOWI2QnpNd3JSYnRUNnJUUUdOM0FhTnBaekdlVGJia3RQajJGMDcyIiwiY3J2IjoiUC0zODQiLCJrdHkiOiJFQyIsInkiOiIzajJCYlIyMWJLT0pUSlVoSWFHRkI4U1lRX0pwbW9hZEFNYWRseVhZTEx3dEllQU1xNE5NaFA5bnRlRWtiUGZOIn19"
}
10 changes: 10 additions & 0 deletions tests/fixtures/message.decrypted.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"enc": "A128GCM",
"alg": "ECDH-ES+A128KW",
"epk": {
"x": "fz5PKRx04mE_fA_cAacDcG77zySXyXbwE6ZIOLBV2QkrPSF00qUWDLABCc-1b1Yp",
"crv": "P-384",
"kty": "EC",
"y": "_HmG3B4XhlSm8IX5jdtVLtWgDOX2eSISX-7qOORHU2FASynEFusyrdjSFnzPaBnu"
}
}
1 change: 1 addition & 0 deletions tests/fixtures/message.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"message":"⌛ My lungs taste the air of Time Blown past falling sands"}
1 change: 1 addition & 0 deletions tests/fixtures/message.plaintext.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"message":"⌛ My lungs taste the air of Time Blown past falling sands"}
1 change: 1 addition & 0 deletions tests/fixtures/message.signature.detached.compact.jws
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
eyJhbGciOiJFUzI1NiIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..biT6WtP64CFbToPdbXhnqLR1HHGlt4rdNeV7WTSUeWfl3IOrtl2qTOSIYETcytTaP8pVgq5gknJfBJ1_n29tsw
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"alg": "ES256",
"b64": false,
"crit": [
"b64"
]
}
5 changes: 5 additions & 0 deletions tests/fixtures/message.signature.detached.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"signature": "OdsdYvR89x3qDFiCNc8TZ8bobYOykyzCB5vsFl-6QGeS2Hjm2QmDjYLTTBCCrXhoR1u9L6xwcztaBHGDnPB0hg",
"payload": "",
"protected": "eyJhbGciOiJFUzI1NiIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19"
}
7 changes: 7 additions & 0 deletions tests/fixtures/message.signature.detached.verified.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"alg": "ES256",
"b64": false,
"crit": [
"b64"
]
}
5 changes: 5 additions & 0 deletions tests/fixtures/message.signature.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"signature": "cecIZFdJnTO7ID7JVPSbUrV2G24UQ9yYlo_Pe51zQ0Viq_8Xf-XPHoGjHGS72FhiBiZGbUBmS_m4tF3aNc9tig",
"payload": "eyJtZXNzYWdlIjoi4oybIE15IGx1bmdzIHRhc3RlIHRoZSBhaXIgb2YgVGltZSBCbG93biBwYXN0IGZhbGxpbmcgc2FuZHMifQo",
"protected": "eyJhbGciOiJFUzI1NiJ9"
}
3 changes: 3 additions & 0 deletions tests/fixtures/message.signature.verified.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"alg": "ES256"
}
1 change: 1 addition & 0 deletions tests/fixtures/message.verified.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"message":"⌛ My lungs taste the air of Time Blown past falling sands"}
9 changes: 9 additions & 0 deletions tests/fixtures/private.enc.jwk.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"kid": "gssD4KFLIb7x0vuNwJcI6vaJG1VWkz7uNiLRbT2eY8M",
"kty": "EC",
"crv": "P-384",
"alg": "ECDH-ES+A128KW",
"x": "jTnh07iGoSZhhkQU4YrQYz1qBay-Ew5GIEfLtAcP8cqSM4mscbBUCL7dUR4AJJTR",
"y": "BDs3vSj7EW72TywLlFA2KL7XhhU77Fjs54B5ALc4bJCsbq1g-imuhJtrKyUoqRrg",
"d": "kNU19KCuXpEGXAJZ7uv3lpc18AK189J5Ys40QZo9mAVjyF6oCH89AgxQFSjAUPWG"
}
9 changes: 9 additions & 0 deletions tests/fixtures/private.sig.jwk.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"kid": "6iSq2WlhW3dLmSl7_Z6uTuqyB07uvoAA87QvQSfcaYM",
"kty": "EC",
"crv": "P-256",
"alg": "ES256",
"x": "MAE7eYtog-0tk29yCgQsIXEHd4D11myEGUlVf6MmbNg",
"y": "uMyAgLpw4IfQCFgUjRrbLfFORI_5SUT5suO8WBi5_lw",
"d": "gOhNzI1D477voK9KSGY9_ACHBsVFpC-5IM7XCEhvNKc"
}
8 changes: 8 additions & 0 deletions tests/fixtures/public.enc.jwk.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"kid": "gssD4KFLIb7x0vuNwJcI6vaJG1VWkz7uNiLRbT2eY8M",
"kty": "EC",
"crv": "P-384",
"alg": "ECDH-ES+A128KW",
"x": "jTnh07iGoSZhhkQU4YrQYz1qBay-Ew5GIEfLtAcP8cqSM4mscbBUCL7dUR4AJJTR",
"y": "BDs3vSj7EW72TywLlFA2KL7XhhU77Fjs54B5ALc4bJCsbq1g-imuhJtrKyUoqRrg"
}
8 changes: 8 additions & 0 deletions tests/fixtures/public.sig.jwk.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"kid": "6iSq2WlhW3dLmSl7_Z6uTuqyB07uvoAA87QvQSfcaYM",
"kty": "EC",
"crv": "P-256",
"alg": "ES256",
"x": "MAE7eYtog-0tk29yCgQsIXEHd4D11myEGUlVf6MmbNg",
"y": "uMyAgLpw4IfQCFgUjRrbLfFORI_5SUT5suO8WBi5_lw"
}

0 comments on commit e5cd1b4

Please sign in to comment.