-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathotp-crypto.d.ts
17 lines (17 loc) · 996 Bytes
/
otp-crypto.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
declare module 'otp-crypto' {
interface DataConverter {
strToBytes: (str: string) => Uint8Array;
bytesToStr: (bytes: Uint8Array) => string;
base64ToBytes: (base64: string) => Uint8Array;
bytesToBase64: (bytes: Uint8Array) => string;
}
class OtpCrypto {
static encryptedDataConverter: DataConverter;
static decryptedDataConverter: DataConverter;
static xorByteArrays (messageBytes: Uint8Array, keyBytes: Uint8Array): { resultBytes: Uint8Array, bytesLeft: number, isKeyLongEnough: boolean };
static encrypt (plaintext: string, keyBytes: Uint8Array): { base64Encrypted: string, remainingKey: Uint8Array, bytesUsed: number, bytesLeft: number, isKeyLongEnough: boolean };
static decrypt (base64Encrypted: string, keyBytes: Uint8Array): { plaintextDecrypted: string, remainingKey: Uint8Array, bytesUsed: number, bytesLeft: number, isKeyLongEnough: boolean };
static generateRandomBytes(numberOfBytes: number): Uint8Array;
}
export default OtpCrypto;
}