(name: string)
| 51 | } |
| 52 | |
| 53 | export function createIdentity(name: string) { |
| 54 | const buffer = new Uint32Array(10) |
| 55 | getRandomValues(buffer) |
| 56 | const hmac = createHmac('sha256', buffer) |
| 57 | hmac.update(name) |
| 58 | const privkey = hmac.digest().toString('hex') |
| 59 | const pubkey = Buffer.from(secp256k1.getPublicKey(privkey, true)).toString('hex').substring(2) |
| 60 | const author = { |
| 61 | name, |
| 62 | privkey, |
| 63 | pubkey, |
| 64 | } |
| 65 | return author |
| 66 | } |
| 67 | |
| 68 | export async function createSubscription( |
| 69 | ws: WebSocket, |
no test coverage detected