File tree 3 files changed +21
-2
lines changed
3 files changed +21
-2
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " krist" ,
3
- "version" : " 3.5.1 " ,
3
+ "version" : " 3.5.2 " ,
4
4
"description" : " The new Krist node written in TypeScript." ,
5
5
"type" : " module" ,
6
6
"scripts" : {
Original file line number Diff line number Diff line change @@ -69,7 +69,9 @@ export async function verifyAddress(
69
69
return { authed : true , address : newAddress } ;
70
70
}
71
71
72
- if ( address . privatekey ) { // Address exists, auth if the privatekey is equal
72
+ // Address exists, auth if the privatekey is equal, or handle the locked flow if it's locked (even if there's no
73
+ // privatekey set)
74
+ if ( address . privatekey || address . locked ) {
73
75
const authed = ! address . locked && address . privatekey === hash ;
74
76
75
77
if ( authed ) {
Original file line number Diff line number Diff line change 20
20
*/
21
21
22
22
import { expect } from "chai" ;
23
+ import { Address } from "../../src/database/index.js" ;
23
24
import { api } from "../api.js" ;
24
25
import { seed } from "../seed.js" ;
25
26
@@ -56,5 +57,21 @@ describe("v2 routes: login", function() {
56
57
expect ( res ) . to . be . json ;
57
58
expect ( res . body ) . to . deep . include ( { ok : true , authed : true , address : "k8juvewcui" } ) ;
58
59
} ) ;
60
+
61
+ it ( "should error for locked addresses even without a privatekey" , async function ( ) {
62
+ const address = await Address . findOne ( { where : { address : "kwsgj3x184" } } ) ;
63
+ if ( ! address ) throw new Error ( "Address not found" ) ;
64
+
65
+ const oldPrivatekey = address . privatekey ;
66
+ address . privatekey = null ;
67
+ await address . save ( ) ;
68
+
69
+ const res = await api ( ) . post ( "/login" ) . send ( { privatekey : "c" } ) ;
70
+ expect ( res ) . to . be . json ;
71
+ expect ( res . body ) . to . deep . include ( { ok : true , authed : false } ) ;
72
+
73
+ address . privatekey = oldPrivatekey ;
74
+ await address . save ( ) ;
75
+ } ) ;
59
76
} ) ;
60
77
} ) ;
You can’t perform that action at this time.
0 commit comments