This repository has been archived by the owner on Jun 23, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🔥 Minor update to fix #2
- Loading branch information
Showing
11 changed files
with
83 additions
and
26 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,6 @@ yarn-error.log* | |
# folders | ||
./test*/ | ||
coverage*/ | ||
demo*/ | ||
node_modules/ | ||
|
||
# .js files | ||
|
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 |
---|---|---|
|
@@ -19,3 +19,6 @@ node_modules/ | |
|
||
# .js files | ||
gulpfile*.js | ||
|
||
# Do not ignore | ||
!**/json.d.ts |
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,2 @@ | ||
# Do not ignore | ||
!**/*.js |
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,23 @@ | ||
// @ts-check | ||
|
||
const signatur = require('../../'); | ||
|
||
void async function main() { | ||
try { | ||
const payload = { | ||
id: 'test-id', | ||
first_name: 'John', | ||
last_name: 'Doe', | ||
timestamp: '2020-02-02T02:20:202', | ||
}; | ||
const opts = { | ||
secret: 'test-secret', | ||
}; | ||
const enc = await signatur.sign(payload, opts); | ||
const dec = await signatur.unsign(enc, opts); | ||
|
||
console.log({ enc, dec }); | ||
} catch (e) { | ||
console.error('🔥 ERR', e); | ||
} | ||
}() |
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,30 @@ | ||
// @ts-check | ||
|
||
export default interface Payload { | ||
id: string; | ||
first_name: string; | ||
last_name: string; | ||
timestamp: string; | ||
} | ||
|
||
import signatur from '../../'; | ||
|
||
void async function main() { | ||
try { | ||
const payload: Payload = { | ||
id: 'test-id', | ||
first_name: 'John', | ||
last_name: 'Doe', | ||
timestamp: '2020-02-02T02:20:202', | ||
}; | ||
const opts = { | ||
secret: 'test-secret', | ||
}; | ||
const enc = await signatur.sign(payload, opts); | ||
const dec = await signatur.unsign<Payload>(enc, opts) as Payload; | ||
|
||
console.log({ enc, dec }); | ||
} catch (e) { | ||
console.error('🔥 ERR', e); | ||
} | ||
}(); |
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