Skip to content

Commit d84ea71

Browse files
committed
some lint
1 parent ab0899b commit d84ea71

2 files changed

Lines changed: 16 additions & 16 deletions

File tree

src/chat/keys.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import {schnorr} from '@noble/curves/secp256k1'
2-
import {bytesToHex} from '@noble/hashes/utils'
1+
import { schnorr } from '@noble/curves/secp256k1'
2+
import { bytesToHex } from '@noble/hashes/utils'
33

4-
export function generatePrivateKey(): string {
4+
export function generatePrivateKey (): string {
55
return bytesToHex(schnorr.utils.randomPrivateKey())
66
}
77

8-
export function getPublicKey(privateKey: string): string {
8+
export function getPublicKey (privateKey: string): string {
99
return bytesToHex(schnorr.getPublicKey(privateKey))
10-
}
10+
}

src/chat/signature.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import {schnorr} from '@noble/curves/secp256k1'
2-
import {sha256} from '@noble/hashes/sha256'
3-
import {bytesToHex} from '@noble/hashes/utils'
1+
import { schnorr } from '@noble/curves/secp256k1'
2+
import { sha256 } from '@noble/hashes/sha256'
3+
import { bytesToHex } from '@noble/hashes/utils'
44

55
// import {utf8Encoder} from './utils'
6-
import {getPublicKey} from './keys'
6+
import { getPublicKey } from './keys'
77

88
export const utf8Decoder = new TextDecoder('utf-8')
99
export const utf8Encoder = new TextEncoder()
@@ -58,7 +58,7 @@ export type Msg = UnsignedMsg & {
5858
}
5959
} */
6060

61-
export function finishMsg(t: MsgTemplate, privateKey: string): Message {
61+
export function finishMsg (t: MsgTemplate, privateKey: string): Message {
6262
// to update to chat message triples
6363
let message = t as Message
6464
// message.pubkey = getPublicKey(privateKey)
@@ -67,7 +67,7 @@ export function finishMsg(t: MsgTemplate, privateKey: string): Message {
6767
return message
6868
}
6969

70-
export function serializeMsg(msg: UnsignedMsg): string {
70+
export function serializeMsg (msg: UnsignedMsg): string {
7171
// to update to chat messages triples
7272
/* if (!validateMsg(msg))
7373
throw new Error("can't serialize message with wrong or missing properties") */
@@ -82,7 +82,7 @@ export function serializeMsg(msg: UnsignedMsg): string {
8282
])
8383
}
8484

85-
export function getMsgHash(message: UnsignedMsg): string {
85+
export function getMsgHash (message: UnsignedMsg): string {
8686
let msgHash = sha256(utf8Encoder.encode(serializeMsg(message)))
8787
return bytesToHex(msgHash)
8888
}
@@ -109,16 +109,16 @@ const isRecord = (obj: unknown): obj is Record<string, unknown> => obj instanceo
109109
return true
110110
} */
111111

112-
export function verifySignature(message: Message): boolean {
112+
export function verifySignature (message: Message): boolean {
113113
return schnorr.verify(
114114
message.sig,
115-
getMsgHash(message),
115+
getMsgHash(message)
116116
// message.pubkey
117117
)
118118
}
119119

120-
export function signMsg(message: UnsignedMsg, key: string): string {
120+
export function signMsg (message: UnsignedMsg, key: string): string {
121121
return bytesToHex(
122122
schnorr.sign(getMsgHash(message), key)
123123
)
124-
}
124+
}

0 commit comments

Comments
 (0)