Browse Source

Merge pull request #7 from stakwork/signer

Signer
feature/dockerfile-arm v0.8.4
Evan Feenstra 5 years ago
committed by GitHub
parent
commit
711ccd0fd8
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      api/grpc/index.ts
  2. 6
      api/utils/lightning.ts
  3. 6
      dist/api/utils/lightning.js
  4. 2
      dist/api/utils/lightning.js.map

1
api/grpc/index.ts

@ -17,6 +17,7 @@ async function parseAndVerifyPayload(data){
payload = JSON.parse(msg)
if(payload) {
if(!sig) return payload // REMOVE THIS LINE (here for backward compat)
// also remove pub_key from the newmsg and newkeyexchangemsg of helpers.ts
const v = await verifyAscii(msg, sig)
if(v && v.valid && v.pubkey) {
payload.sender = payload.sender||{}

6
api/utils/lightning.ts

@ -133,15 +133,15 @@ const keysend = (opts) => {
})
}
const MAX_MSG_LENGTH = 868 // 1146 - 20 ??? - 104 for sig
const MAX_MSG_LENGTH = 972 // 1146 - 20 ???
async function keysendMessage(opts) {
return new Promise(async function(resolve, reject) {
if(!opts.data || typeof opts.data!=='string') {
return reject('string plz')
}
// SIGN HERE and append sig
// const sig = await signAscii(opts.data)
// opts.data = opts.data + sig
const sig = await signAscii(opts.data)
opts.data = opts.data + sig
if(opts.data.length<MAX_MSG_LENGTH){
try {

6
dist/api/utils/lightning.js

@ -145,7 +145,7 @@ const keysend = (opts) => {
});
});
};
const MAX_MSG_LENGTH = 868; // 1146 - 20 ??? - 104 for sig
const MAX_MSG_LENGTH = 972; // 1146 - 20 ???
function keysendMessage(opts) {
return __awaiter(this, void 0, void 0, function* () {
return new Promise(function (resolve, reject) {
@ -154,8 +154,8 @@ function keysendMessage(opts) {
return reject('string plz');
}
// SIGN HERE and append sig
// const sig = await signAscii(opts.data)
// opts.data = opts.data + sig
const sig = yield signAscii(opts.data);
opts.data = opts.data + sig;
if (opts.data.length < MAX_MSG_LENGTH) {
try {
const res = yield keysend(opts);

2
dist/api/utils/lightning.js.map

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save