applesauce-signers 3.1.0 → 4.0.0
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.
|
@@ -169,6 +169,7 @@ export class SerialPortSigner {
|
|
|
169
169
|
const sharedSecret = hexToBytes(sharedSecretStr);
|
|
170
170
|
let iv = Uint8Array.from(randomBytes(16));
|
|
171
171
|
let plaintext = utf8Encoder.encode(text);
|
|
172
|
+
// @ts-ignore
|
|
172
173
|
let cryptoKey = await crypto.subtle.importKey("raw", sharedSecret, { name: "AES-CBC" }, false, ["encrypt"]);
|
|
173
174
|
let ciphertext = await crypto.subtle.encrypt({ name: "AES-CBC", iv }, cryptoKey, plaintext);
|
|
174
175
|
let ctb64 = base64.encode(new Uint8Array(ciphertext));
|
|
@@ -179,9 +180,11 @@ export class SerialPortSigner {
|
|
|
179
180
|
let [ctb64, ivb64] = data.split("?iv=");
|
|
180
181
|
const sharedSecretStr = await this.callMethodOnDevice(SerialPortSigner.METHOD_SHARED_SECRET, [xOnlyToXY(pubkey)]);
|
|
181
182
|
const sharedSecret = hexToBytes(sharedSecretStr);
|
|
183
|
+
// @ts-ignore
|
|
182
184
|
let cryptoKey = await crypto.subtle.importKey("raw", sharedSecret, { name: "AES-CBC" }, false, ["decrypt"]);
|
|
183
185
|
let ciphertext = base64.decode(ctb64);
|
|
184
186
|
let iv = base64.decode(ivb64);
|
|
187
|
+
// @ts-ignore
|
|
185
188
|
let plaintext = await crypto.subtle.decrypt({ name: "AES-CBC", iv }, cryptoKey, ciphertext);
|
|
186
189
|
let text = utf8Decoder.decode(plaintext);
|
|
187
190
|
return text;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "applesauce-signers",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "Signer classes for applesauce",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -14,8 +14,7 @@
|
|
|
14
14
|
"author": "hzrd149",
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"files": [
|
|
17
|
-
"dist"
|
|
18
|
-
"applesauce"
|
|
17
|
+
"dist"
|
|
19
18
|
],
|
|
20
19
|
"exports": {
|
|
21
20
|
".": {
|
|
@@ -32,21 +31,32 @@
|
|
|
32
31
|
"import": "./dist/signers/*.js",
|
|
33
32
|
"require": "./dist/signers/*.js",
|
|
34
33
|
"types": "./dist/signers/*.d.ts"
|
|
34
|
+
},
|
|
35
|
+
"./helpers": {
|
|
36
|
+
"import": "./dist/helpers/index.js",
|
|
37
|
+
"require": "./dist/helpers/index.js",
|
|
38
|
+
"types": "./dist/helpers/index.d.ts"
|
|
39
|
+
},
|
|
40
|
+
"./helpers/*": {
|
|
41
|
+
"import": "./dist/helpers/*.js",
|
|
42
|
+
"require": "./dist/helpers/*.js",
|
|
43
|
+
"types": "./dist/helpers/*.d.ts"
|
|
35
44
|
}
|
|
36
45
|
},
|
|
37
46
|
"dependencies": {
|
|
38
47
|
"@noble/hashes": "^1.7.1",
|
|
39
48
|
"@noble/secp256k1": "^1.7.1",
|
|
40
49
|
"@scure/base": "^1.2.4",
|
|
41
|
-
"applesauce-core": "^
|
|
50
|
+
"applesauce-core": "^4.0.0",
|
|
42
51
|
"debug": "^4.4.0",
|
|
43
52
|
"nanoid": "^5.0.9",
|
|
44
|
-
"nostr-tools": "~2.
|
|
53
|
+
"nostr-tools": "~2.17",
|
|
45
54
|
"rxjs": "^7.8.2"
|
|
46
55
|
},
|
|
47
56
|
"devDependencies": {
|
|
48
57
|
"@types/debug": "^4.1.12",
|
|
49
58
|
"@types/dom-serial": "^1.0.6",
|
|
59
|
+
"rimraf": "^6.0.1",
|
|
50
60
|
"typescript": "^5.8.3",
|
|
51
61
|
"vitest": "^3.1.3",
|
|
52
62
|
"vitest-websocket-mock": "^0.5.0"
|
|
@@ -56,6 +66,7 @@
|
|
|
56
66
|
"url": "lightning:nostrudel@geyser.fund"
|
|
57
67
|
},
|
|
58
68
|
"scripts": {
|
|
69
|
+
"prebuild": "rimraf dist",
|
|
59
70
|
"build": "tsc",
|
|
60
71
|
"watch:build": "tsc --watch > /dev/null",
|
|
61
72
|
"test": "vitest run --passWithNoTests",
|