write skeleton of functions
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import {Result} from 'result'
|
||||
|
||||
export type PubKey = void
|
||||
export type PrivKey = void
|
||||
|
||||
export class PrivateBox<T> {
|
||||
public static gen_keypair() : [PrivKey, PubKey] {
|
||||
throw "todo"
|
||||
}
|
||||
|
||||
public static encrypt<T>(key: PubKey, data: Uint8Array) : PrivateBox<T> {
|
||||
throw "todo"
|
||||
}
|
||||
public decrypt(key: PrivKey) : Result<Uint8Array> {
|
||||
throw "todo"
|
||||
}
|
||||
|
||||
public toString() : string {
|
||||
throw "todo"
|
||||
}
|
||||
public static fromString<T>(data: string) : Result<PrivateBox<T>> {
|
||||
throw "todo"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export {PrivateBox} from './asymmetric'
|
||||
export {SecretBox} from './symmetric'
|
||||
export {PwdBox} from './pwd'
|
||||
@@ -0,0 +1,17 @@
|
||||
import type {Result} from 'result'
|
||||
|
||||
export class PwdBox<T> {
|
||||
public static encrypt<T>(pwd: string, data: Uint8Array) : PwdBox<T> {
|
||||
throw "todo"
|
||||
}
|
||||
public decrypt(pwd: string) : Result<Uint8Array> {
|
||||
throw "todo"
|
||||
}
|
||||
|
||||
public toString() : string {
|
||||
throw "todo"
|
||||
}
|
||||
public static fromString<T>(data: string) : Result<PwdBox<T>> {
|
||||
throw "todo"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
import type {Result} from 'result'
|
||||
|
||||
export type Key = void
|
||||
|
||||
export class SecretBox<T> {
|
||||
public static gen_key() : Key {
|
||||
throw "todo"
|
||||
}
|
||||
|
||||
public static encrypt<T>(key: Key, data: Uint8Array) : SecretBox<T> {
|
||||
throw "todo"
|
||||
}
|
||||
public decrypt(key: Key) : Result<Uint8Array> {
|
||||
throw "todo"
|
||||
}
|
||||
|
||||
public toString() : string {
|
||||
throw "todo"
|
||||
}
|
||||
public static fromString<T>(data: string) : Result<SecretBox<T>> {
|
||||
throw "todo"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
export type JWT = `${string}.${string}.${string}`
|
||||
|
||||
export function create() : JWT {
|
||||
throw "todo"
|
||||
}
|
||||
export function verify() : boolean {
|
||||
throw "todo"
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
export function hash(pwd: string) : string {
|
||||
throw "todo"
|
||||
}
|
||||
export function verify(pwd: string, hash: string) : boolean {
|
||||
throw "todo"
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
Reference in New Issue
Block a user