@neuraiproject/neurai-message 0.7.0 → 0.7.1
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/LICENSE +1 -1
- package/dist/main.js +27 -0
- package/dist/main.js.map +1 -0
- package/dist/module.js +17 -0
- package/dist/module.js.map +1 -0
- package/dist/types.d.ts +5 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +2 -2
package/LICENSE
CHANGED
package/dist/main.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
var $g5Y9E$bitcoinjsmessage = require("bitcoinjs-message");
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
function $parcel$interopDefault(a) {
|
|
5
|
+
return a && a.__esModule ? a.default : a;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
function $parcel$export(e, n, v, s) {
|
|
9
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
$parcel$export(module.exports, "sign", () => $80bd448eb6ea085b$export$c5552dfdbc7cec71);
|
|
13
|
+
$parcel$export(module.exports, "verifyMessage", () => $80bd448eb6ea085b$export$228d0e772cc158cb);
|
|
14
|
+
|
|
15
|
+
const $80bd448eb6ea085b$var$MESSAGE_PREFIX = "\x16Neurai Signed Message:\n";
|
|
16
|
+
function $80bd448eb6ea085b$export$c5552dfdbc7cec71(message, privateKey, compressed = true) {
|
|
17
|
+
const signature = (0, ($parcel$interopDefault($g5Y9E$bitcoinjsmessage))).sign(message, privateKey, compressed, $80bd448eb6ea085b$var$MESSAGE_PREFIX);
|
|
18
|
+
return signature.toString("base64");
|
|
19
|
+
}
|
|
20
|
+
function $80bd448eb6ea085b$export$228d0e772cc158cb(message, address, signature) {
|
|
21
|
+
const m = Buffer.from(message).toString("ascii");
|
|
22
|
+
const result = (0, ($parcel$interopDefault($g5Y9E$bitcoinjsmessage))).verify(m, address, signature, $80bd448eb6ea085b$var$MESSAGE_PREFIX);
|
|
23
|
+
return result;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=main.js.map
|
package/dist/main.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;AACA,MAAM,uCAAiB;AAGhB,SAAS,0CAAK,OAAe,EAAE,UAAe,EAAE,aAAa,IAAI;IACtE,MAAM,YAAY,CAAA,GAAA,iDAAa,EAAE,IAAI,CACnC,SACA,YACA,YACA;IAGF,OAAO,UAAU,QAAQ,CAAC;AAC5B;AACO,SAAS,0CACd,OAAe,EACf,OAAe,EACf,SAAiB;IAEjB,MAAM,IAAI,OAAO,IAAI,CAAC,SAAS,QAAQ,CAAC;IACxC,MAAM,SAAS,CAAA,GAAA,iDAAa,EAAE,MAAM,CAAC,GAAG,SAAS,WAAW;IAC5D,OAAO;AACT","sources":["index.ts"],"sourcesContent":["import bitcoinMessage from \"bitcoinjs-message\";\nconst MESSAGE_PREFIX = \"\\x16Neurai Signed Message:\\n\";\n\n/** returns a base64 encoded string representation of the signature */\nexport function sign(message: string, privateKey: any, compressed = true) {\n const signature = bitcoinMessage.sign(\n message,\n privateKey,\n compressed,\n MESSAGE_PREFIX\n );\n\n return signature.toString(\"base64\");\n}\nexport function verifyMessage(\n message: string,\n address: string,\n signature: string\n) {\n const m = Buffer.from(message).toString(\"ascii\");\n const result = bitcoinMessage.verify(m, address, signature, MESSAGE_PREFIX);\n return result;\n}\n"],"names":[],"version":3,"file":"main.js.map"}
|
package/dist/module.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import $hCgyA$bitcoinjsmessage from "bitcoinjs-message";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
const $c3f6c693698dc7cd$var$MESSAGE_PREFIX = "\x16Neurai Signed Message:\n";
|
|
5
|
+
function $c3f6c693698dc7cd$export$c5552dfdbc7cec71(message, privateKey, compressed = true) {
|
|
6
|
+
const signature = (0, $hCgyA$bitcoinjsmessage).sign(message, privateKey, compressed, $c3f6c693698dc7cd$var$MESSAGE_PREFIX);
|
|
7
|
+
return signature.toString("base64");
|
|
8
|
+
}
|
|
9
|
+
function $c3f6c693698dc7cd$export$228d0e772cc158cb(message, address, signature) {
|
|
10
|
+
const m = Buffer.from(message).toString("ascii");
|
|
11
|
+
const result = (0, $hCgyA$bitcoinjsmessage).verify(m, address, signature, $c3f6c693698dc7cd$var$MESSAGE_PREFIX);
|
|
12
|
+
return result;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
export {$c3f6c693698dc7cd$export$c5552dfdbc7cec71 as sign, $c3f6c693698dc7cd$export$228d0e772cc158cb as verifyMessage};
|
|
17
|
+
//# sourceMappingURL=module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;AACA,MAAM,uCAAiB;AAGhB,SAAS,0CAAK,OAAe,EAAE,UAAe,EAAE,aAAa,IAAI;IACtE,MAAM,YAAY,CAAA,GAAA,uBAAa,EAAE,IAAI,CACnC,SACA,YACA,YACA;IAGF,OAAO,UAAU,QAAQ,CAAC;AAC5B;AACO,SAAS,0CACd,OAAe,EACf,OAAe,EACf,SAAiB;IAEjB,MAAM,IAAI,OAAO,IAAI,CAAC,SAAS,QAAQ,CAAC;IACxC,MAAM,SAAS,CAAA,GAAA,uBAAa,EAAE,MAAM,CAAC,GAAG,SAAS,WAAW;IAC5D,OAAO;AACT","sources":["index.ts"],"sourcesContent":["import bitcoinMessage from \"bitcoinjs-message\";\nconst MESSAGE_PREFIX = \"\\x16Neurai Signed Message:\\n\";\n\n/** returns a base64 encoded string representation of the signature */\nexport function sign(message: string, privateKey: any, compressed = true) {\n const signature = bitcoinMessage.sign(\n message,\n privateKey,\n compressed,\n MESSAGE_PREFIX\n );\n\n return signature.toString(\"base64\");\n}\nexport function verifyMessage(\n message: string,\n address: string,\n signature: string\n) {\n const m = Buffer.from(message).toString(\"ascii\");\n const result = bitcoinMessage.verify(m, address, signature, MESSAGE_PREFIX);\n return result;\n}\n"],"names":[],"version":3,"file":"module.js.map"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** returns a base64 encoded string representation of the signature */
|
|
2
|
+
export function sign(message: string, privateKey: any, compressed?: boolean): any;
|
|
3
|
+
export function verifyMessage(message: string, address: string, signature: string): any;
|
|
4
|
+
|
|
5
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAGA,sEAAsE;AACtE,qBAAqB,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,UAAO,OASvE;AACD,8BACE,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,OAKlB","sources":["index.ts"],"sourcesContent":["import bitcoinMessage from \"bitcoinjs-message\";\nconst MESSAGE_PREFIX = \"\\x16Neurai Signed Message:\\n\";\n\n/** returns a base64 encoded string representation of the signature */\nexport function sign(message: string, privateKey: any, compressed = true) {\n const signature = bitcoinMessage.sign(\n message,\n privateKey,\n compressed,\n MESSAGE_PREFIX\n );\n\n return signature.toString(\"base64\");\n}\nexport function verifyMessage(\n message: string,\n address: string,\n signature: string\n) {\n const m = Buffer.from(message).toString(\"ascii\");\n const result = bitcoinMessage.verify(m, address, signature, MESSAGE_PREFIX);\n return result;\n}\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neuraiproject/neurai-message",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "Sign and Verify messages in Neurai",
|
|
5
5
|
"source": "index.ts",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"Neurai",
|
|
19
19
|
"XNA"
|
|
20
20
|
],
|
|
21
|
-
"author": "
|
|
21
|
+
"author": "Neuraiproject",
|
|
22
22
|
"license": "ISC",
|
|
23
23
|
"bugs": {
|
|
24
24
|
"url": "https://github.com/neuraiproject/neurai-message/issues"
|