solid-ui 2.4.28-6451e8ad → 2.4.28-6a319caf
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/solid-ui.js +3 -72
- package/dist/solid-ui.js.map +1 -1
- package/dist/solid-ui.min.js +1 -1
- package/dist/solid-ui.min.js.map +1 -1
- package/lib/chat/signature.d.ts +0 -2
- package/lib/chat/signature.d.ts.map +1 -1
- package/lib/chat/signature.js +1 -70
- package/lib/chat/signature.js.map +1 -1
- package/lib/versionInfo.js +2 -2
- package/lib/versionInfo.js.map +1 -1
- package/package.json +3 -1
package/lib/chat/signature.d.ts
CHANGED
|
@@ -4,10 +4,8 @@ export declare const SEC = "https://w3id.org/security#";
|
|
|
4
4
|
export type MsgTemplate = {
|
|
5
5
|
id: string;
|
|
6
6
|
created: string;
|
|
7
|
-
dateDeleted: string;
|
|
8
7
|
content: string;
|
|
9
8
|
maker: string;
|
|
10
|
-
sig: string;
|
|
11
9
|
};
|
|
12
10
|
export type UnsignedMsg = MsgTemplate & {
|
|
13
11
|
pubkey: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signature.d.ts","sourceRoot":"","sources":["../../src/chat/signature.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"signature.d.ts","sourceRoot":"","sources":["../../src/chat/signature.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW,aAA2B,CAAA;AACnD,eAAO,MAAM,WAAW,aAAoB,CAAA;AAE5C,eAAO,MAAM,GAAG,+BAA+B,CAAA;AAE/C,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG;IACtC,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED,MAAM,MAAM,OAAO,GAAG,WAAW,GAAG;IAClC,EAAE,EAAE,MAAM,CAAA;IACV,GAAG,EAAE,MAAM,CAAA;CACZ,CAAA;AAED,wBAAgB,WAAW,IAAK,WAAW,CAO1C;AAED,wBAAgB,YAAY,CAAE,GAAG,EAAE,WAAW,GAAG,MAAM,CAEtD;AAED,wBAAgB,UAAU,CAAE,OAAO,EAAE,WAAW,UAG/C;AAED,wBAAgB,eAAe,CAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAMvF;AAED,wBAAgB,OAAO,CAAE,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAIlE"}
|
package/lib/chat/signature.js
CHANGED
|
@@ -13,96 +13,27 @@ exports.verifySignature = verifySignature;
|
|
|
13
13
|
var _secp256k = require("@noble/curves/secp256k1");
|
|
14
14
|
var _utils = require("@noble/hashes/utils");
|
|
15
15
|
var _sha = require("@noble/hashes/sha256");
|
|
16
|
-
// import {utf8Encoder} from './utils'
|
|
17
|
-
// import { getPublicKey } from './keys'
|
|
18
|
-
|
|
19
16
|
var utf8Decoder = new TextDecoder('utf-8');
|
|
20
17
|
exports.utf8Decoder = utf8Decoder;
|
|
21
18
|
var utf8Encoder = new TextEncoder();
|
|
22
19
|
exports.utf8Encoder = utf8Encoder;
|
|
23
20
|
var SEC = 'https://w3id.org/security#'; // Proof, VerificationMethod
|
|
24
|
-
// export const CERT = 'http://www.w3.org/ns/auth/cert#' // PrivateKey, PublicKey, key
|
|
25
|
-
|
|
26
|
-
/* eslint-disable no-unused-vars */
|
|
27
|
-
/* export enum Kind {
|
|
28
|
-
Metadata = 0,
|
|
29
|
-
Text = 1,
|
|
30
|
-
RecommendRelay = 2,
|
|
31
|
-
Contacts = 3,
|
|
32
|
-
EncryptedDirectMessage = 4,
|
|
33
|
-
EventDeletion = 5,
|
|
34
|
-
Reaction = 7,
|
|
35
|
-
BadgeAward = 8,
|
|
36
|
-
ChannelCreation = 40,
|
|
37
|
-
ChannelMetadata = 41,
|
|
38
|
-
ChannelMessage = 42,
|
|
39
|
-
ChannelHideMessage = 43,
|
|
40
|
-
ChannelMuteUser = 44,
|
|
41
|
-
Report = 1984,
|
|
42
|
-
ZapRequest = 9734,
|
|
43
|
-
Zap = 9735,
|
|
44
|
-
RelayList = 10002,
|
|
45
|
-
ClientAuth = 22242,
|
|
46
|
-
BadgeDefinition = 30008,
|
|
47
|
-
ProfileBadge = 30009,
|
|
48
|
-
Article = 30023
|
|
49
|
-
} */
|
|
50
21
|
exports.SEC = SEC;
|
|
51
22
|
function getBlankMsg() {
|
|
52
23
|
return {
|
|
53
24
|
id: '',
|
|
54
25
|
created: '',
|
|
55
|
-
dateDeleted: '',
|
|
56
|
-
// TODO to remove if not used
|
|
57
26
|
content: '',
|
|
58
|
-
maker: ''
|
|
59
|
-
sig: '' // TODO to remove if not used
|
|
27
|
+
maker: ''
|
|
60
28
|
};
|
|
61
29
|
}
|
|
62
|
-
|
|
63
|
-
/* export function finishMsg (t: MsgTemplate, privateKey: string): Message {
|
|
64
|
-
// to update to chat message triples
|
|
65
|
-
const message = t as Message
|
|
66
|
-
// message.pubkey = getPublicKey(privateKey)
|
|
67
|
-
message.id = getMsgHash(message)
|
|
68
|
-
message.sig = signMsg(message, privateKey)
|
|
69
|
-
return message
|
|
70
|
-
} */
|
|
71
|
-
|
|
72
30
|
function serializeMsg(msg) {
|
|
73
|
-
// to update to chat messages triples
|
|
74
|
-
/* if (!validateMsg(msg))
|
|
75
|
-
throw new Error("can't serialize message with wrong or missing properties") */
|
|
76
|
-
|
|
77
31
|
return JSON.stringify(msg);
|
|
78
32
|
}
|
|
79
33
|
function getMsgHash(message) {
|
|
80
34
|
var msgHash = (0, _sha.sha256)(utf8Encoder.encode(serializeMsg(message)));
|
|
81
35
|
return (0, _utils.bytesToHex)(msgHash);
|
|
82
36
|
}
|
|
83
|
-
|
|
84
|
-
// const isRecord = (obj: unknown): obj is Record<string, unknown> => obj instanceof Object
|
|
85
|
-
|
|
86
|
-
/* export function validateMsg<T> (message: T): message is T & UnsignedMsg {
|
|
87
|
-
if (!isRecord(message)) return false
|
|
88
|
-
if (typeof message.kind !== 'number') return false
|
|
89
|
-
if (typeof message.content !== 'string') return false
|
|
90
|
-
if (typeof message.created_at !== 'number') return false
|
|
91
|
-
if (typeof message.pubkey !== 'string') return false
|
|
92
|
-
if (!message.pubkey.match(/^[a-f0-9]{64}$/)) return false
|
|
93
|
-
|
|
94
|
-
if (!Array.isArray(message.tags)) return false
|
|
95
|
-
for (let i = 0; i < message.tags.length; i++) {
|
|
96
|
-
let tag = message.tags[i]
|
|
97
|
-
if (!Array.isArray(tag)) return false
|
|
98
|
-
for (let j = 0; j < tag.length; j++) {
|
|
99
|
-
if (typeof tag[j] === 'object') return false
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
return true
|
|
104
|
-
} */
|
|
105
|
-
|
|
106
37
|
function verifySignature(sig, message, pubKey) {
|
|
107
38
|
return _secp256k.schnorr.verify(sig, getMsgHash(message), pubKey);
|
|
108
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signature.js","names":["_secp256k","require","_utils","_sha","utf8Decoder","TextDecoder","exports","utf8Encoder","TextEncoder","SEC","getBlankMsg","id","created","
|
|
1
|
+
{"version":3,"file":"signature.js","names":["_secp256k","require","_utils","_sha","utf8Decoder","TextDecoder","exports","utf8Encoder","TextEncoder","SEC","getBlankMsg","id","created","content","maker","serializeMsg","msg","JSON","stringify","getMsgHash","message","msgHash","sha256","encode","bytesToHex","verifySignature","sig","pubKey","schnorr","verify","signMsg","key","sign"],"sources":["../../src/chat/signature.ts"],"sourcesContent":["import { schnorr } from '@noble/curves/secp256k1'\r\nimport { bytesToHex } from '@noble/hashes/utils'\r\nimport { sha256 } from '@noble/hashes/sha256'\r\n\r\nexport const utf8Decoder = new TextDecoder('utf-8')\r\nexport const utf8Encoder = new TextEncoder()\r\n\r\nexport const SEC = 'https://w3id.org/security#' // Proof, VerificationMethod\r\n\r\nexport type MsgTemplate = {\r\n id: string\r\n created: string\r\n content: string\r\n maker: string\r\n}\r\n\r\nexport type UnsignedMsg = MsgTemplate & {\r\n pubkey: string\r\n}\r\n\r\nexport type Message = UnsignedMsg & {\r\n id: string\r\n sig: string\r\n}\r\n\r\nexport function getBlankMsg (): MsgTemplate {\r\n return {\r\n id: '',\r\n created: '',\r\n content: '',\r\n maker: ''\r\n }\r\n}\r\n\r\nexport function serializeMsg (msg: UnsignedMsg): string {\r\n return JSON.stringify(msg)\r\n}\r\n\r\nexport function getMsgHash (message: UnsignedMsg) {\r\n const msgHash = sha256(utf8Encoder.encode(serializeMsg(message)))\r\n return bytesToHex(msgHash)\r\n}\r\n\r\nexport function verifySignature (sig: string, message: Message, pubKey: string): boolean {\r\n return schnorr.verify(\r\n sig,\r\n getMsgHash(message),\r\n pubKey\r\n )\r\n}\r\n\r\nexport function signMsg (message: UnsignedMsg, key: string): string {\r\n return bytesToHex(\r\n schnorr.sign(getMsgHash(message), key)\r\n )\r\n}\r\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AAEO,IAAMG,WAAW,GAAG,IAAIC,WAAW,CAAC,OAAO,CAAC;AAAAC,OAAA,CAAAF,WAAA,GAAAA,WAAA;AAC5C,IAAMG,WAAW,GAAG,IAAIC,WAAW,EAAE;AAAAF,OAAA,CAAAC,WAAA,GAAAA,WAAA;AAErC,IAAME,GAAG,GAAG,4BAA4B,EAAC;AAAAH,OAAA,CAAAG,GAAA,GAAAA,GAAA;AAkBzC,SAASC,WAAWA,CAAA,EAAiB;EAC1C,OAAO;IACLC,EAAE,EAAE,EAAE;IACNC,OAAO,EAAE,EAAE;IACXC,OAAO,EAAE,EAAE;IACXC,KAAK,EAAE;EACT,CAAC;AACH;AAEO,SAASC,YAAYA,CAAEC,GAAgB,EAAU;EACtD,OAAOC,IAAI,CAACC,SAAS,CAACF,GAAG,CAAC;AAC5B;AAEO,SAASG,UAAUA,CAAEC,OAAoB,EAAE;EAChD,IAAMC,OAAO,GAAG,IAAAC,WAAM,EAACf,WAAW,CAACgB,MAAM,CAACR,YAAY,CAACK,OAAO,CAAC,CAAC,CAAC;EACjE,OAAO,IAAAI,iBAAU,EAACH,OAAO,CAAC;AAC5B;AAEO,SAASI,eAAeA,CAAEC,GAAW,EAAEN,OAAgB,EAAEO,MAAc,EAAW;EACvF,OAAOC,iBAAO,CAACC,MAAM,CACnBH,GAAG,EACHP,UAAU,CAACC,OAAO,CAAC,EACnBO,MAAM,CACP;AACH;AAEO,SAASG,OAAOA,CAAEV,OAAoB,EAAEW,GAAW,EAAU;EAClE,OAAO,IAAAP,iBAAU,EACfI,iBAAO,CAACI,IAAI,CAACb,UAAU,CAACC,OAAO,CAAC,EAAEW,GAAG,CAAC,CACvC;AACH"}
|
package/lib/versionInfo.js
CHANGED
|
@@ -5,8 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.versionInfo = void 0;
|
|
7
7
|
var versionInfo = {
|
|
8
|
-
buildTime: '2023-06-
|
|
9
|
-
commit: '
|
|
8
|
+
buildTime: '2023-06-03T23:48:25Z',
|
|
9
|
+
commit: '6a319caf69ef4ecc171a5adcb375dea108d002c2',
|
|
10
10
|
npmInfo: {
|
|
11
11
|
'solid-ui': '2.4.28',
|
|
12
12
|
npm: '8.19.4',
|
package/lib/versionInfo.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"versionInfo.js","names":["versionInfo","buildTime","commit","npmInfo","npm","node","v8","uv","zlib","brotli","ares","modules","nghttp2","napi","llhttp","openssl","cldr","icu","tz","unicode","ngtcp2","nghttp3","exports"],"sources":["../src/versionInfo.ts"],"sourcesContent":["export const versionInfo = {\n buildTime: '2023-06-
|
|
1
|
+
{"version":3,"file":"versionInfo.js","names":["versionInfo","buildTime","commit","npmInfo","npm","node","v8","uv","zlib","brotli","ares","modules","nghttp2","napi","llhttp","openssl","cldr","icu","tz","unicode","ngtcp2","nghttp3","exports"],"sources":["../src/versionInfo.ts"],"sourcesContent":["export const versionInfo = {\n buildTime: '2023-06-03T23:48:25Z',\n commit: '6a319caf69ef4ecc171a5adcb375dea108d002c2',\n npmInfo:\n{\n 'solid-ui': '2.4.28',\n npm: '8.19.4',\n node: '16.20.0',\n v8: '9.4.146.26-node.26',\n uv: '1.43.0',\n zlib: '1.2.11',\n brotli: '1.0.9',\n ares: '1.19.0',\n modules: '93',\n nghttp2: '1.47.0',\n napi: '8',\n llhttp: '6.0.10',\n openssl: '1.1.1t+quic',\n cldr: '41.0',\n icu: '71.1',\n tz: '2022f',\n unicode: '14.0',\n ngtcp2: '0.8.1',\n nghttp3: '0.7.0'\n}\n}\n"],"mappings":";;;;;;AAAO,IAAMA,WAAW,GAAG;EACzBC,SAAS,EAAE,sBAAsB;EACjCC,MAAM,EAAE,0CAA0C;EAClDC,OAAO,EACT;IACE,UAAU,EAAE,QAAQ;IACpBC,GAAG,EAAE,QAAQ;IACbC,IAAI,EAAE,SAAS;IACfC,EAAE,EAAE,oBAAoB;IACxBC,EAAE,EAAE,QAAQ;IACZC,IAAI,EAAE,QAAQ;IACdC,MAAM,EAAE,OAAO;IACfC,IAAI,EAAE,QAAQ;IACdC,OAAO,EAAE,IAAI;IACbC,OAAO,EAAE,QAAQ;IACjBC,IAAI,EAAE,GAAG;IACTC,MAAM,EAAE,QAAQ;IAChBC,OAAO,EAAE,aAAa;IACtBC,IAAI,EAAE,MAAM;IACZC,GAAG,EAAE,MAAM;IACXC,EAAE,EAAE,OAAO;IACXC,OAAO,EAAE,MAAM;IACfC,MAAM,EAAE,OAAO;IACfC,OAAO,EAAE;EACX;AACA,CAAC;AAAAC,OAAA,CAAAtB,WAAA,GAAAA,WAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "solid-ui",
|
|
3
|
-
"version": "2.4.28-
|
|
3
|
+
"version": "2.4.28-6a319caf",
|
|
4
4
|
"description": "UI library for writing Solid read-write-web applications",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
"acorn": "^7.4.1",
|
|
61
61
|
"escape-html": "^1.0.3",
|
|
62
62
|
"eslint-plugin-n": "^15.6.1",
|
|
63
|
+
"fsevents": "*",
|
|
63
64
|
"i": "^0.3.7",
|
|
64
65
|
"mime-types": "^2.1.35",
|
|
65
66
|
"npm": "^8.19.4",
|
|
@@ -109,6 +110,7 @@
|
|
|
109
110
|
"husky": "^7.0.4",
|
|
110
111
|
"isomorphic-fetch": "^3.0.0",
|
|
111
112
|
"jest": "^27.5.1",
|
|
113
|
+
"jest-environment-jsdom": "^27.5.1",
|
|
112
114
|
"jsdom": "^16.7.0",
|
|
113
115
|
"lint-staged": "^12.5.0",
|
|
114
116
|
"nock": "^13.3.0",
|