eskdf.d.ts 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. export declare function scrypt(password: string, salt: string): Uint8Array;
  2. export declare function pbkdf2(password: string, salt: string): Uint8Array;
  3. /**
  4. * Derives main seed. Takes a lot of time. Prefer `eskdf` method instead.
  5. */
  6. export declare function deriveMainSeed(username: string, password: string): Uint8Array;
  7. type AccountID = number | string;
  8. type OptsLength = {
  9. keyLength: number;
  10. };
  11. type OptsMod = {
  12. modulus: bigint;
  13. };
  14. type KeyOpts = undefined | OptsLength | OptsMod;
  15. type ESKDF = Promise<Readonly<{
  16. /**
  17. * Derives a child key. Child key will not be associated with any
  18. * other child key because of properties of underlying KDF.
  19. *
  20. * @param protocol - 3-15 character protocol name
  21. * @param accountId - numeric identifier of account
  22. * @param options - `keyLength: 64` or `modulus: 41920438n`
  23. * @example deriveChildKey('aes', 0)
  24. */
  25. deriveChildKey: (protocol: string, accountId: AccountID, options?: KeyOpts) => Uint8Array;
  26. /**
  27. * Deletes the main seed from eskdf instance
  28. */
  29. expire: () => void;
  30. /**
  31. * Account fingerprint
  32. */
  33. fingerprint: string;
  34. }>>;
  35. /**
  36. * ESKDF
  37. * @param username - username, email, or identifier, min: 8 characters, should have enough entropy
  38. * @param password - password, min: 8 characters, should have enough entropy
  39. * @example
  40. * const kdf = await eskdf('example-university', 'beginning-new-example');
  41. * const key = kdf.deriveChildKey('aes', 0);
  42. * console.log(kdf.fingerprint);
  43. * kdf.expire();
  44. */
  45. export declare function eskdf(username: string, password: string): ESKDF;
  46. export {};
  47. //# sourceMappingURL=eskdf.d.ts.map