This repository has been archived by the owner on Sep 1, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8a02e75
commit f959dc1
Showing
9 changed files
with
120 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
-----BEGIN RSA PRIVATE KEY----- | ||
MIIEowIBAAKCAQEAzd55FbthjoKxo0SmKjS28M0IgK9uw+xY2ts/X2EEwM/g3svk | ||
GND7rBikE26pJtJdRk6iJhn7eUHTKGRP48T5sXJaBvGexpmnAk6F1JS5J9YOl9hz | ||
C4WIF3aiUGSs07Y9zUJGiuTWFcZAZh4bLxV/mijxGgC6DKZ3CluGLTguEwNHTLaC | ||
j2+5rPIvRA5UjHq3du993MppKZChpdUoXWscfgVIX/sXQUtRXr+FRvZiahzqzq/a | ||
kQBnZ7Z481KegEHfCZu70w98moI42sBFQ2HBj1TT4G4vHkB7O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1YrvWxDcI3YXVmBxplTfj4SDicWDp | ||
K9wfJKQ0T5CdsL9JANuJ+8OlSlJfUx28cey6zQ5UV2Q1tZhCbF1J+3E3yI8fr3FL | ||
nrTyhQKBgEFpRGDssD/k+3VT8gYcpJZkYYUinHYq9C2A6KQguk964+GmHmkHMgh7 | ||
AP+6ikZB+XZST2ujL9NOrrrIhH/4iIabz7h8fibPYyzOufV/xUmmW2phqzoQX+IU | ||
2wDdT8uGvCOkQ3FlWm9YuZkSok+t0yw6XA5tmfu9JzC2Q6sBB59y | ||
-----END RSA PRIVATE KEY----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
-----BEGIN PUBLIC KEY----- | ||
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzd55FbthjoKxo0SmKjS2 | ||
8M0IgK9uw+xY2ts/X2EEwM/g3svkGND7rBikE26pJtJdRk6iJhn7eUHTKGRP48T5 | ||
sXJaBvGexpmnAk6F1JS5J9YOl9hzC4WIF3aiUGSs07Y9zUJGiuTWFcZAZh4bLxV/ | ||
mijxGgC6DKZ3CluGLTguEwNHTLaCj2+5rPIvRA5UjHq3du993MppKZChpdUoXWsc | ||
fgVIX/sXQUtRXr+FRvZiahzqzq/akQBnZ7Z481KegEHfCZu70w98moI42sBFQ2HB | ||
j1TT4G4vHkB7OegyD8UTyQPmiuKLoJtWxmjff3ZmJV/nPznO1qihTaQZ20+YAkkE | ||
4wIDAQAB | ||
-----END PUBLIC KEY----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
const test = require('tap').test | ||
const bakery = require('..') | ||
const jws = require('jws') | ||
|
||
|
||
const ASSERTION = {verify: { url: 'oh sup'}} | ||
const sig = jws.sign({ | ||
header: { alg: 'rs256' }, | ||
privateKey: file('rsa-private.pem'), | ||
payload: ASSERTION | ||
}) | ||
|
||
test('baking svg badges with signatures', function (t) { | ||
bakery.bake({ | ||
image: file('unbaked.svg'), | ||
signature: sig | ||
}, function (err, baked) { | ||
bakery.debake(baked, function (err, assertion) { | ||
t.same(ASSERTION, assertion, 'assertions should match') | ||
t.end() | ||
}) | ||
}) | ||
}) | ||
|
||
test('baking png badges with signatures', function (t) { | ||
bakery.bake({ | ||
image: file('unbaked.png'), | ||
signature: sig | ||
}, function (err, baked) { | ||
bakery.debake(baked, function (err, assertion) { | ||
t.same(ASSERTION, assertion, 'assertions should match') | ||
t.end() | ||
}) | ||
}) | ||
}) | ||
|
||
|
||
|
||
function file(name) { | ||
return ( | ||
require('fs').readFileSync( | ||
require('path').join(__dirname, name)) | ||
) | ||
} |