Skip to content

Commit 3851e57

Browse files
authored
updated noble/curves dep -Merge pull request #612 from SolidOS/issue611
updated noble/curves dep
2 parents 278075f + 839cfbe commit 3851e57

6 files changed

Lines changed: 26 additions & 26 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
User Interface widgets and utilities for Solid (solid-ui)
66

77
These are HTML5 widgets which connect to a solid store. Building blocks for solid-based apps.
8-
Vanilla JS. Includes large widgets like chat, table, matrix, form fields, and small widgets.
8+
Vanilla JS. Includes large widgets like chat, table, matrix, form fields, and small widgets.
99

1010
See [Solid-Ui Storybook](http://solidos.github.io/solid-ui/examples/storybook/) for UI widgets.
1111
See [Solid-UI API](https://solidos.github.io/solid-ui/docs/api/) for UI functions.

jest.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export default {
1111
'^.+\\.[tj]sx?$': ['babel-jest', { configFile: './babel.config.mjs' }],
1212
},
1313
transformIgnorePatterns: [
14-
'<rootDir>/node_modules/(?!(lit-html|@exodus/bytes|uuid|jsdom|parse5)/)',
14+
'<rootDir>/node_modules/(?!(lit-html|@noble/curves|@noble/hashes|@exodus/bytes|uuid|jsdom|parse5)/)',
1515
],
1616
setupFilesAfterEnv: ['./test/helpers/setup.ts'],
1717
testMatch: ['**/?(*.)+(spec|test).[tj]s?(x)'],

package-lock.json

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@
6565
},
6666
"homepage": "https://github.com/solidos/solid-ui",
6767
"dependencies": {
68-
"@noble/curves": "^1.9.6",
69-
"@noble/hashes": "^1.8.0",
68+
"@noble/curves": "^2.0.1",
69+
"@noble/hashes": "^2.0.1",
7070
"escape-html": "^1.0.3",
7171
"mime-types": "^3.0.2",
7272
"pane-registry": "^3.0.0",

src/chat/keys.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as debug from '../debug'
2-
import { schnorr } from '@noble/curves/secp256k1'
3-
import { bytesToHex } from '@noble/hashes/utils'
2+
import { schnorr } from '@noble/curves/secp256k1.js'
3+
import { bytesToHex, hexToBytes } from '@noble/hashes/utils.js'
44
import ns from '../ns'
55
import { store } from 'solid-logic'
66
import { NamedNode } from 'rdflib'
@@ -9,11 +9,11 @@ import { getExistingPublicKey, pubKeyUrl, privKeyUrl, getExistingPrivateKey } fr
99
import { setAcl, keyContainerAclBody, keyAclBody } from '../utils/keyHelpers/acl'
1010

1111
export function generatePrivateKey (): string {
12-
return bytesToHex(schnorr.utils.randomPrivateKey())
12+
return bytesToHex(schnorr.utils.randomSecretKey())
1313
}
1414

1515
export function generatePublicKey (privateKey: string): string {
16-
return bytesToHex(schnorr.getPublicKey(privateKey))
16+
return bytesToHex(schnorr.getPublicKey(hexToBytes(privateKey)))
1717
}
1818

1919
/**

src/chat/signature.ts

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

55
// import {utf8Encoder} from './utils'
66
// import { getPublicKey } from './keys'
@@ -110,14 +110,14 @@ export function getMsgHash (message: UnsignedMsg) {
110110

111111
export function verifySignature (sig: string, message: Message, pubKey: string): boolean {
112112
return schnorr.verify(
113-
sig,
114-
getMsgHash(message),
115-
pubKey
113+
hexToBytes(sig),
114+
hexToBytes(getMsgHash(message)),
115+
hexToBytes(pubKey)
116116
)
117117
}
118118

119119
export function signMsg (message: UnsignedMsg, key: string): string {
120120
return bytesToHex(
121-
schnorr.sign(getMsgHash(message), key)
121+
schnorr.sign(hexToBytes(getMsgHash(message)), hexToBytes(key))
122122
)
123123
}

0 commit comments

Comments
 (0)