forked from IronCoreLabs/recrypt-wasm-binding
-
Notifications
You must be signed in to change notification settings - Fork 0
/
recrypt_wasm_binding.d.ts
68 lines (68 loc) · 3.08 KB
/
recrypt_wasm_binding.d.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
export type PrivateKey = Uint8Array;
export type PublicSigningKey = Uint8Array;
export type PrivateSigningKey = Uint8Array;
export type Signature = Uint8Array;
export type Plaintext = Uint8Array;
export interface PublicKey {
x: Uint8Array;
y: Uint8Array;
}
export interface KeyPair {
publicKey: PublicKey;
privateKey: PrivateKey;
}
export interface SigningKeyPair {
publicKey: PublicSigningKey;
privateKey: PrivateSigningKey;
}
export interface TransformBlock {
publicKey: PublicKey;
encryptedTempKey: Uint8Array;
randomTransformPublicKey: PublicKey;
randomTransformEncryptedTempKey: Uint8Array;
}
export interface EncryptedValue {
ephemeralPublicKey: PublicKey;
encryptedMessage: Uint8Array;
authHash: Uint8Array;
transformBlocks: TransformBlock[];
publicSigningKey: PublicSigningKey;
signature: Uint8Array;
}
export interface TransformKey {
ephemeralPublicKey: PublicKey;
toPublicKey: PublicKey;
encryptedTempKey: Uint8Array;
hashedTempKey: Uint8Array;
publicSigningKey: PublicSigningKey;
signature: Uint8Array;
}
export class Api256 {
constructor();
generateKeyPair(): KeyPair;
generateEd25519KeyPair(): SigningKeyPair;
ed25519Sign(signingPrivateKey: Uint8Array, message: Uint8Array): Signature;
ed25519Verify(signingPublicKey: Uint8Array, message: Uint8Array, signature: Uint8Array): boolean;
computeEd25519PublicKey(signingPrivateKey: Uint8Array): PublicSigningKey;
generatePlaintext(): Plaintext;
generateTransformKey(fromPrivateKey: PrivateKey, toPublicKey: PublicKey, privateSigningKey: PrivateSigningKey): TransformKey;
computePublicKey(privateKey: PrivateKey): PublicKey;
hash256(hashableBytes: Uint8Array): Uint8Array;
deriveSymmetricKey(plaintext: Plaintext): Uint8Array;
encrypt(plaintext: Plaintext, toPublicKey: PublicKey, privateSigningKey: PrivateSigningKey): EncryptedValue;
transform(encryptedValue: EncryptedValue, transformKey: TransformKey, privateSigningKey: PrivateSigningKey): EncryptedValue;
decrypt(encryptedValue: EncryptedValue, privateKey: PrivateKey): Plaintext;
schnorrSign(privateKey: Uint8Array, publicKey: PublicKey, message: Uint8Array): Signature;
schnorrVerify(publicKey: PublicKey, augmentedPrivateKey: Uint8Array | undefined, message: Uint8Array, signature: Signature): boolean;
}
export class EncryptedSearch {
constructor();
generateHashesForString(s: string, salt: Uint8Array, partitionId?: string): Uint32Array;
generateHashesForStringWithPadding(s: string, salt: Uint8Array, partitionId?: string): Uint32Array;
static transliterateString(s: string): string;
}
export function transformKeyToBytes256(transformKey: TransformKey): Uint8Array;
export function augmentTransformKey256(transformKey: TransformKey, privateKey: PrivateKey): TransformKey;
export function augmentPublicKey256(currentPublicKey: PublicKey, otherPublicKey: PublicKey): PublicKey;
export function addPrivateKeys(privateKeyA: Uint8Array, privateKeyB: Uint8Array): Uint8Array;
export function subtractPrivateKeys(privateKeyA: Uint8Array, privateKeyB: Uint8Array): Uint8Array;