@@ -10,6 +10,7 @@ import { createKey } from "./command/create";
1010import { deleteKey } from "./command/delete" ;
1111import { exportKey } from "./command/export" ;
1212import { importKey } from "./command/import" ;
13+ import { importRawKey } from "./command/importRaw" ;
1314import { listKeys } from "./command/list" ;
1415import { CLIError , CLIErrorType } from "./error" ;
1516import {
@@ -54,6 +55,12 @@ program
5455 . option ( "-p, --passphrase <passphrase>" , "passphrase" )
5556 . action ( handleError ( importCommand ) ) ;
5657
58+ program
59+ . command ( "import-raw <privateKey>" )
60+ . description ( "import a raw private key (32 byte hexadecimal string)" )
61+ . option ( "-p, --passphrase <passphrase>" , "passphrase" )
62+ . action ( handleError ( importRawCommand ) ) ;
63+
5764program
5865 . command ( "export" )
5966 . description ( "export the key" )
@@ -103,6 +110,13 @@ async function importCommand(path: string, option: ImportOption) {
103110 await importKey ( cckey , accountType , JSON . parse ( contents ) , passphrase ) ;
104111}
105112
113+ async function importRawCommand ( privateKey : string , option : ImportOption ) {
114+ const cckey = await CCKey . create ( ) ;
115+ const accountType = parseAccountType ( option . parent . accountType ) ;
116+ const passphrase = parsePassphrase ( option . passphrase ) ;
117+ await importRawKey ( cckey , accountType , privateKey , passphrase ) ;
118+ }
119+
106120async function exportCommand ( option : ExportOption ) {
107121 const cckey = await CCKey . create ( ) ;
108122 const accountType = parseAccountType ( option . parent . accountType ) ;
0 commit comments