applesauce-signers 0.0.0-next-20250609184904 → 0.0.0-next-20250610175335
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.
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* Checks if a string is encrypted with NIP-04 or NIP-44
|
|
3
3
|
* @see https://github.com/nostr-protocol/nips/pull/1248#issuecomment-2437731316
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
5
|
+
export { isNIP04Encrypted as isNIP04 } from "applesauce-core/helpers/encryption";
|
|
@@ -2,9 +2,4 @@
|
|
|
2
2
|
* Checks if a string is encrypted with NIP-04 or NIP-44
|
|
3
3
|
* @see https://github.com/nostr-protocol/nips/pull/1248#issuecomment-2437731316
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
6
|
-
const l = ciphertext.length;
|
|
7
|
-
if (l < 28)
|
|
8
|
-
return false;
|
|
9
|
-
return (ciphertext[l - 28] == "?" && ciphertext[l - 27] == "i" && ciphertext[l - 26] == "v" && ciphertext[l - 25] == "=");
|
|
10
|
-
}
|
|
5
|
+
export { isNIP04Encrypted as isNIP04 } from "applesauce-core/helpers/encryption";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isHexKey } from "applesauce-core/helpers";
|
|
1
2
|
/** A signer that only implements getPublicKey and throws on ever other method */
|
|
2
3
|
export class ReadonlySigner {
|
|
3
4
|
pubkey;
|
|
@@ -5,6 +6,8 @@ export class ReadonlySigner {
|
|
|
5
6
|
nip44;
|
|
6
7
|
constructor(pubkey) {
|
|
7
8
|
this.pubkey = pubkey;
|
|
9
|
+
if (!isHexKey(pubkey))
|
|
10
|
+
throw new Error("Invalid public key");
|
|
8
11
|
this.nip04 = {
|
|
9
12
|
encrypt: this.nip04Encrypt.bind(this),
|
|
10
13
|
decrypt: this.nip04Decrypt.bind(this),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "applesauce-signers",
|
|
3
|
-
"version": "0.0.0-next-
|
|
3
|
+
"version": "0.0.0-next-20250610175335",
|
|
4
4
|
"description": "Signer classes for applesauce",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@noble/hashes": "^1.7.1",
|
|
37
37
|
"@noble/secp256k1": "^1.7.1",
|
|
38
38
|
"@scure/base": "^1.2.4",
|
|
39
|
-
"applesauce-core": "0.0.0-next-
|
|
39
|
+
"applesauce-core": "0.0.0-next-20250610175335",
|
|
40
40
|
"debug": "^4.4.0",
|
|
41
41
|
"nanoid": "^5.0.9",
|
|
42
42
|
"nostr-tools": "^2.13"
|