Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented manifest signatures #27

Merged
merged 6 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@
"files": {
"exclude": ["node_modules/", "test/", "vendor/", "dist/", "build/"]
}
}
},
"importMap": "./vendor/import_map.json"
}
24 changes: 23 additions & 1 deletion deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export { eventsAfter } from './eventsAfter.ts'
export { get } from './get.ts'
export { hash } from './hash.ts'
export { help } from './help.ts'
export { keygen } from './keygen.ts'
export { manifest } from './manifest.ts'
export { migrate } from './migrate.ts'
export { upload } from './upload.ts'
Expand Down
1 change: 1 addition & 0 deletions src/deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export * as colors from "https://deno.land/std@0.141.0/fmt/colors.ts"
export * as fs from 'https://deno.land/std@0.141.0/fs/mod.ts'
export * as path from 'https://deno.land/std@0.141.0/path/mod.ts'
export * as streams from "https://deno.land/std@0.141.0/streams/mod.ts"
export { default as tweetnacl } from 'https://esm.sh/tweetnacl@1.0.3?pin=v120'
export { base58btc } from 'https://esm.sh/multiformats@11.0.2/bases/base58?pin=v120'
export { type Multibase } from 'https://esm.sh/multiformats@11.0.2?pin=v120'
export { default as blake } from 'https://esm.sh/@multiformats/blake2@1.0.13?pin=v120'
Expand Down
21 changes: 21 additions & 0 deletions src/keygen.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { flags } from './deps.ts'
import { revokeNet } from './utils.ts'
import { EDWARDS25519SHA512BATCH, keygen as cryptoKeygen, serializeKey } from './lib/crypto.ts'

export const keygen = async (args: string[]) => {
await revokeNet()
const parsedArgs = flags.parse(args)
const key = cryptoKeygen(EDWARDS25519SHA512BATCH)
const textEncoder = new TextEncoder()
const result = textEncoder.encode(JSON.stringify({
version: '1.0.0',
pubkey: serializeKey(key, false),
privkey: serializeKey(key, true)
}))

if (parsedArgs['out']) {
await Deno.writeFile(parsedArgs['out'], result)
} else {
await Deno.stdout.write(result)
}
Copy link
Member

@taoeffect taoeffect Feb 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Request:

  • output 2 files, one for the public key (for verifying with chel latestState), and one for the private key for signing with chel manifest (like SSH)
  • remove the STDOUT. you can have a default filename based on the key type (make sure to output to STDOUT where this file is saved, and check to see if it already exists, in which case, just add a suffix like id_edssa.1.pub and id_edssa.1.priv) or something to that effect

}
Loading
Loading