-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.ts
44 lines (33 loc) · 1.37 KB
/
test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import { assertEquals } from './deps.ts';
import encrypt from './encrypt/mod.ts';
import decrypt from './decrypt/mod.ts';
import { PasswordCompare, PasswordCreate } from './password/mod.ts';
Deno.test('encrypt decrypt', async () => {
const data = 'hello world';
const secret = 'secret';
const encrypted = await encrypt(data, secret);
const decrypted = await decrypt(encrypted, secret);
assertEquals(decrypted, 'hello world');
});
Deno.test('PasswordCreate and PasswordCompare', async () => {
const secret = 'secret';
const created = await PasswordCreate(secret);
const compared = await PasswordCompare(secret, created);
// console.log(created);
assertEquals(compared, true);
});
// import { Google } from './mod.ts';
// const env = Deno.env.toObject();
// if (!env.key) throw new Error('key required');
// if (!env.project) throw new Error('project required');
// if (!env.bucket) throw new Error('bucket required');
// if (!env.object) throw new Error('object required');
// const bucket = env.bucket;
// const object = env.object;
// const project = env.project;
// const key = JSON.parse(await Deno.readTextFile(env.key));
// const connect = new Google({ key, project });
// const result = await connect.fetch('GET', `https://storage.googleapis.com/storage/v1/b/${bucket}/o/${object}`, {
// alt: 'media'
// });
// console.log(await result.text());