mirror of
https://github.com/Rolands-Laucis/Socio.git
synced 2026-05-15 14:15:57 -06:00
encrypting and decrypting raw source code
This commit is contained in:
parent
5431d37b33
commit
fc12f68151
2 changed files with 13 additions and 1 deletions
|
|
@ -14,6 +14,13 @@ cd ../demo
|
|||
npm link ../core
|
||||
```
|
||||
|
||||
## TODOs
|
||||
* Backend Life-cycle hooks
|
||||
* Session ID sync with backend webserver sessions
|
||||
* Keyed SQL queries
|
||||
* Better SQL dependency distinguisher on queries
|
||||
* Bundler plugins for securing query strings
|
||||
* Typescript migration
|
||||
|
||||
## Name:
|
||||
"Socio.js" comes from the latin verb "socio", which means to link or associate. Since this lib syncs your frontend and backend. Its also a play on words for "WebSockets" and "IO".
|
||||
|
|
|
|||
|
|
@ -12,8 +12,13 @@ export class Secure{
|
|||
this.iv = te.encode(cipher_iv).slice(0, 16)
|
||||
}
|
||||
|
||||
//sql strings must be in single quotes and have an sql single line comment at the end with the name socio - "--socio"
|
||||
Secure(source_code = '') {
|
||||
|
||||
const sql_string_regex = /'(?<sql>[^']+?)--socio'/i
|
||||
return source_code.split('\n').map(line => {
|
||||
const m = line.match(sql_string_regex)
|
||||
return m?.groups?.sql ? line.replace(sql_string_regex, '\'' + this.EncryptString(m.groups.sql) + '\'') : line
|
||||
}).join('\n')
|
||||
}
|
||||
|
||||
EncryptString(query = '') {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue