()
| 17 | } |
| 18 | |
| 19 | async function main() { |
| 20 | const CLIENT_ID = getFromEnvironment("CLIENT_ID"); |
| 21 | const CLIENT_SECRET = getFromEnvironment("CLIENT_SECRET"); |
| 22 | const VAAS_USER_NAME = getFromEnvironment("VAAS_USER_NAME"); |
| 23 | const VAAS_PASSWORD = getFromEnvironment("VAAS_PASSWORD"); |
| 24 | const SCAN_PATH = getFromEnvironment("SCAN_PATH"); |
| 25 | const TOKEN_URL = getFromEnvironment("TOKEN_URL"); |
| 26 | const VAAS_URL = getFromEnvironment("VAAS_URL"); |
| 27 | |
| 28 | // If you got a username and password from us, you can use the ResourceOwnerPasswordAuthenticator like this |
| 29 | const authenticator = new ResourceOwnerPasswordGrantAuthenticator( |
| 30 | "vaas-customer", |
| 31 | VAAS_USER_NAME, |
| 32 | VAAS_PASSWORD, |
| 33 | TOKEN_URL |
| 34 | ); |
| 35 | |
| 36 | // You may use self registration and create a new username and password for the |
| 37 | // ResourceOwnerPasswordAuthenticator by yourself like the example above on https://vaas.gdata.de/login |
| 38 | |
| 39 | // Else if you got a client id and client secret from us, you can use the ClientCredentialsGrantAuthenticator like this |
| 40 | // const authenticator = new ClientCredentialsGrantAuthenticator( |
| 41 | // CLIENT_ID, |
| 42 | // CLIENT_SECRET, |
| 43 | // TOKEN_URL |
| 44 | // ); |
| 45 | |
| 46 | const vaas = new Vaas(); |
| 47 | const token = await authenticator.getToken() |
| 48 | await vaas.connect(token, VAAS_URL); |
| 49 | |
| 50 | const f = await fs.open(SCAN_PATH, "r"); |
| 51 | |
| 52 | const verdict = await vaas.forFile(await f.readFile()); |
| 53 | console.log(verdict); |
| 54 | f.close(); |
| 55 | vaas.close(); |
| 56 | } |
| 57 | |
| 58 | main().catch((e) => { |
| 59 | console.log(e); |
no test coverage detected