-
Notifications
You must be signed in to change notification settings - Fork 6
/
index.d.ts
63 lines (61 loc) · 2.64 KB
/
index.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
export type PrivateKey = Buffer;
export type PublicSigningKey = Buffer;
export type PrivateSigningKey = Buffer;
export type Signature = Buffer;
export interface PublicKey {
x: Buffer;
y: Buffer;
}
export interface KeyPair {
publicKey: PublicKey;
privateKey: PrivateKey;
}
export interface SigningKeyPair {
publicKey: PublicSigningKey;
privateKey: PrivateSigningKey;
}
export type Plaintext = Buffer;
export interface TransformBlock {
publicKey: PublicKey;
encryptedTempKey: Buffer;
randomTransformPublicKey: PublicKey;
randomTransformEncryptedTempKey: Buffer;
}
export interface EncryptedValue {
ephemeralPublicKey: PublicKey;
encryptedMessage: Buffer;
authHash: Buffer;
transformBlocks: TransformBlock[];
publicSigningKey: PublicSigningKey;
signature: Buffer;
}
export interface TransformKey {
ephemeralPublicKey: PublicKey;
toPublicKey: PublicKey;
encryptedTempKey: Buffer;
hashedTempKey: Buffer;
publicSigningKey: PublicSigningKey;
signature: Buffer;
}
export function augmentPublicKey256(publicKey: PublicKey, otherPublicKey: PublicKey): PublicKey;
export function augmentTransformKey256(transformKey: TransformKey, privateKey: PrivateKey): TransformKey;
export function transformKeyToBytes256(transformKey: TransformKey): Buffer;
export function addPrivateKeys(privateKeyA: PrivateKey, privateKeyB: PrivateKey): PrivateKey;
export function subtractPrivateKeys(privateKeyA: PrivateKey, privateKeyB: PrivateKey): PrivateKey;
export class Api256 {
constructor();
generateKeyPair(): KeyPair;
generateEd25519KeyPair(): SigningKeyPair;
ed25519Sign(privateKey: PrivateSigningKey, message: Buffer): Signature;
ed25519Verify(publicKey: PublicSigningKey, message: Buffer, signature: Signature): boolean;
computeEd25519PublicKey(privateKey: PrivateSigningKey): PublicSigningKey;
generatePlaintext(): Plaintext;
generateTransformKey(fromPrivateKey: PrivateKey, toPublicKey: PublicKey, privateSigningKey: PrivateSigningKey): TransformKey;
computePublicKey(privateKey: PrivateKey): PublicKey;
deriveSymmetricKey(plaintext: Plaintext): Buffer;
encrypt(plaintext: Plaintext, toPublicKey: PublicKey, privateSigningKey: PrivateSigningKey): EncryptedValue;
transform(encryptedValue: EncryptedValue, transformKey: TransformKey, privateSigningKey: PrivateSigningKey): EncryptedValue;
decrypt(encryptedValue: EncryptedValue, privateKey: PrivateKey): Plaintext;
schnorrSign(privateKey: Buffer, publicKey: PublicKey, message: Buffer): Signature;
schnorrVerify(publicKey: PublicKey, augmentedPrivateKey: Buffer | undefined, message: Buffer, signature: Signature): boolean;
}