diff --git a/index.ts b/index.ts index e69de29..92684d3 100644 --- a/index.ts +++ b/index.ts @@ -0,0 +1,4 @@ +export * as JWT from 'jwt' +export * as pwd from 'pwd' +export * as signature from 'signature' +export * as boxes from 'boxes' diff --git a/jwt.ts b/jwt.ts deleted file mode 100644 index e69de29..0000000 diff --git a/pwd.ts b/pwd.ts deleted file mode 100644 index e69de29..0000000 diff --git a/src/boxes/asymmetric.ts b/src/boxes/asymmetric.ts new file mode 100644 index 0000000..98936a1 --- /dev/null +++ b/src/boxes/asymmetric.ts @@ -0,0 +1,24 @@ +import {Result} from 'result' + +export type PubKey = void +export type PrivKey = void + +export class PrivateBox { + public static gen_keypair() : [PrivKey, PubKey] { + throw "todo" + } + + public static encrypt(key: PubKey, data: Uint8Array) : PrivateBox { + throw "todo" + } + public decrypt(key: PrivKey) : Result { + throw "todo" + } + + public toString() : string { + throw "todo" + } + public static fromString(data: string) : Result> { + throw "todo" + } +} diff --git a/src/boxes/index.ts b/src/boxes/index.ts new file mode 100644 index 0000000..5617fbd --- /dev/null +++ b/src/boxes/index.ts @@ -0,0 +1,3 @@ +export {PrivateBox} from './asymmetric' +export {SecretBox} from './symmetric' +export {PwdBox} from './pwd' diff --git a/src/boxes/pwd.ts b/src/boxes/pwd.ts new file mode 100644 index 0000000..7004da8 --- /dev/null +++ b/src/boxes/pwd.ts @@ -0,0 +1,17 @@ +import type {Result} from 'result' + +export class PwdBox { + public static encrypt(pwd: string, data: Uint8Array) : PwdBox { + throw "todo" + } + public decrypt(pwd: string) : Result { + throw "todo" + } + + public toString() : string { + throw "todo" + } + public static fromString(data: string) : Result> { + throw "todo" + } +} diff --git a/src/boxes/symmetric.ts b/src/boxes/symmetric.ts new file mode 100644 index 0000000..d2d0081 --- /dev/null +++ b/src/boxes/symmetric.ts @@ -0,0 +1,23 @@ +import type {Result} from 'result' + +export type Key = void + +export class SecretBox { + public static gen_key() : Key { + throw "todo" + } + + public static encrypt(key: Key, data: Uint8Array) : SecretBox { + throw "todo" + } + public decrypt(key: Key) : Result { + throw "todo" + } + + public toString() : string { + throw "todo" + } + public static fromString(data: string) : Result> { + throw "todo" + } +} diff --git a/src/jwt.ts b/src/jwt.ts new file mode 100644 index 0000000..f6bbf37 --- /dev/null +++ b/src/jwt.ts @@ -0,0 +1,8 @@ +export type JWT = `${string}.${string}.${string}` + +export function create() : JWT { + throw "todo" +} +export function verify() : boolean { + throw "todo" +} diff --git a/src/pwd.ts b/src/pwd.ts new file mode 100644 index 0000000..4e0d313 --- /dev/null +++ b/src/pwd.ts @@ -0,0 +1,6 @@ +export function hash(pwd: string) : string { + throw "todo" +} +export function verify(pwd: string, hash: string) : boolean { + throw "todo" +} diff --git a/src/signature.ts b/src/signature.ts new file mode 100644 index 0000000..0041f8e --- /dev/null +++ b/src/signature.ts @@ -0,0 +1,13 @@ +export type PrivKey = void +export type PubKey = void +export type Signature = string + +export function gen_keypair() : [PrivKey, PubKey] { + throw "todo" +} +export function sign(privkey: PrivKey, message: Uint8Array) : Signature { + throw "todo" +} +export function verify(pubkey: PubKey, message: Uint8Array, signature: Signature) : boolean { + throw "todo" +} diff --git a/symmetric.ts b/symmetric.ts deleted file mode 100644 index e69de29..0000000