|
1 |
| -import * as cbor from 'cbor'; |
2 |
| -import { Numeric, Serialize } from 'eosjs'; |
| 1 | +//import * as util from 'util'; |
| 2 | +//import * as cbor from 'cbor'; |
| 3 | +//import { Numeric, Serialize } from 'eosjs'; |
3 | 4 | import * as express from 'express';
|
4 | 5 | import * as fs from 'fs';
|
5 | 6 | import * as SocketIO from 'socket.io';
|
6 |
| -import * as util from 'util'; |
7 | 7 | import { Key } from '../common/Key';
|
8 | 8 |
|
9 | 9 | const keysPath = 'keys.json';
|
10 | 10 |
|
11 | 11 | let unloadedModule = false;
|
12 | 12 | export const router = express.Router();
|
13 | 13 |
|
14 |
| -const textDecoder = new util.TextDecoder(); |
| 14 | +//const textDecoder = new util.TextDecoder(); |
15 | 15 |
|
16 | 16 | interface AddKeyArgs {
|
17 | 17 | rpid: string;
|
@@ -58,17 +58,18 @@ async function sendKeys() {
|
58 | 58 |
|
59 | 59 | async function addKey(k: AddKeyArgs) {
|
60 | 60 | try {
|
61 |
| - const decoded = await decodeKey(k); |
| 61 | + var r = 9; |
| 62 | + /*const decoded = await decodeKey(k); |
62 | 63 | console.log(decoded);
|
63 | 64 | keys.push(decoded);
|
64 | 65 | fs.writeFileSync(keysPath, JSON.stringify(keys, null, 4));
|
65 |
| - sendKeys(); |
| 66 | + sendKeys();*/ |
66 | 67 | } catch (e) {
|
67 | 68 | console.log('??????', e);
|
68 | 69 | socket.emit('err', e.message);
|
69 | 70 | }
|
70 | 71 | }
|
71 |
| - |
| 72 | +/* |
72 | 73 | async function decodeKey(k: AddKeyArgs): Promise<Key> {
|
73 | 74 | // todo: check RP ID hash
|
74 | 75 | // todo: check signature
|
@@ -134,6 +135,7 @@ async function decodeKey(k: AddKeyArgs): Promise<Key> {
|
134 | 135 | key,
|
135 | 136 | };
|
136 | 137 | }
|
| 138 | +*/ |
137 | 139 |
|
138 | 140 | let socketIO: SocketIO.Server;
|
139 | 141 | export function start(io: SocketIO.Server) {
|
|
0 commit comments