-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented manifest signatures (#27)
* Implemented manifest signatures * Vendor tweetnacl * Various changes * New verifySignature command * Tests for validating signatures * keygen command now outputs to two files * manifest command now uses public key files instead of strings * Update CI deno version * Optional external key for verification, flow control using exit instead of throw * Verify that hashes match
- Loading branch information
Showing
49 changed files
with
838 additions
and
27 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,29 @@ | ||
import { colors, flags } from './deps.ts' | ||
import { revokeNet } from './utils.ts' | ||
import { EDWARDS25519SHA512BATCH, keygen as cryptoKeygen, keyId, serializeKey } from './lib/crypto.ts' | ||
|
||
export const keygen = async (args: string[]) => { | ||
await revokeNet() | ||
const parsedArgs = flags.parse(args) | ||
const key = cryptoKeygen(EDWARDS25519SHA512BATCH) | ||
const pubKeyData = { | ||
version: '1.0.0', | ||
pubkey: serializeKey(key, false) | ||
} | ||
const keyData = { | ||
...pubKeyData, | ||
privkey: serializeKey(key, true) | ||
} | ||
const result = JSON.stringify(keyData) | ||
const pubResult = JSON.stringify(pubKeyData) | ||
|
||
const idx = keyId(key).slice(-12) | ||
const outFile = parsedArgs['out'] || `${EDWARDS25519SHA512BATCH}-${idx}.json` | ||
const pubOutFile = parsedArgs['pubout'] || `${EDWARDS25519SHA512BATCH}-${idx}.pub.json` | ||
|
||
await Deno.writeTextFile(outFile, result) | ||
console.log(colors.green('wrote:'), outFile, colors.blue('(secret)')) | ||
|
||
await Deno.writeTextFile(pubOutFile, pubResult) | ||
console.log(colors.green('wrote:'), pubOutFile, colors.blue('(public)')) | ||
} |
Oops, something went wrong.