Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
User Interface widgets and utilities for Solid (solid-ui)

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

See [Solid-Ui Storybook](http://solidos.github.io/solid-ui/examples/storybook/) for UI widgets.
See [Solid-UI API](https://solidos.github.io/solid-ui/docs/api/) for UI functions.
Expand Down
2 changes: 1 addition & 1 deletion jest.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default {
'^.+\\.[tj]sx?$': ['babel-jest', { configFile: './babel.config.mjs' }],
},
transformIgnorePatterns: [
'<rootDir>/node_modules/(?!(lit-html|@exodus/bytes|uuid|jsdom|parse5)/)',
'<rootDir>/node_modules/(?!(lit-html|@noble/curves|@noble/hashes|@exodus/bytes|uuid|jsdom|parse5)/)',
],
setupFilesAfterEnv: ['./test/helpers/setup.ts'],
testMatch: ['**/?(*.)+(spec|test).[tj]s?(x)'],
Expand Down
22 changes: 11 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@
},
"homepage": "https://github.com/solidos/solid-ui",
"dependencies": {
"@noble/curves": "^1.9.6",
"@noble/hashes": "^1.8.0",
"@noble/curves": "^2.0.1",
"@noble/hashes": "^2.0.1",
"escape-html": "^1.0.3",
"mime-types": "^3.0.2",
"pane-registry": "^3.0.0",
Expand Down
8 changes: 4 additions & 4 deletions src/chat/keys.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as debug from '../debug'
import { schnorr } from '@noble/curves/secp256k1'
import { bytesToHex } from '@noble/hashes/utils'
import { schnorr } from '@noble/curves/secp256k1.js'
import { bytesToHex, hexToBytes } from '@noble/hashes/utils.js'
import ns from '../ns'
import { store } from 'solid-logic'
import { NamedNode } from 'rdflib'
Expand All @@ -9,11 +9,11 @@ import { getExistingPublicKey, pubKeyUrl, privKeyUrl, getExistingPrivateKey } fr
import { setAcl, keyContainerAclBody, keyAclBody } from '../utils/keyHelpers/acl'

export function generatePrivateKey (): string {
return bytesToHex(schnorr.utils.randomPrivateKey())
return bytesToHex(schnorr.utils.randomSecretKey())
}

export function generatePublicKey (privateKey: string): string {
return bytesToHex(schnorr.getPublicKey(privateKey))
return bytesToHex(schnorr.getPublicKey(hexToBytes(privateKey)))
}

/**
Expand Down
14 changes: 7 additions & 7 deletions src/chat/signature.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { schnorr } from '@noble/curves/secp256k1'
import { bytesToHex } from '@noble/hashes/utils'
import { sha256 } from '@noble/hashes/sha256'
import { schnorr } from '@noble/curves/secp256k1.js'
import { bytesToHex, hexToBytes } from '@noble/hashes/utils.js'
import { sha256 } from '@noble/hashes/sha2.js'

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

export function verifySignature (sig: string, message: Message, pubKey: string): boolean {
return schnorr.verify(
sig,
getMsgHash(message),
pubKey
hexToBytes(sig),
hexToBytes(getMsgHash(message)),
hexToBytes(pubKey)
)
}

export function signMsg (message: UnsignedMsg, key: string): string {
return bytesToHex(
schnorr.sign(getMsgHash(message), key)
schnorr.sign(hexToBytes(getMsgHash(message)), hexToBytes(key))
)
}