fix: type CryptoKeyPair and rename to IGunCryptoKeyPair

This commit is contained in:
bluelovers 2020-02-06 21:40:07 +08:00
parent 273f7fce8d
commit c59e0e95f9
2 changed files with 17 additions and 4 deletions

6
types/chain.d.ts vendored
View File

@ -1,4 +1,4 @@
import { AlwaysDisallowedType, DisallowPrimitives, DisallowArray, AckCallback, ArrayOf, ArrayAsRecord, Saveable } from './types';
import { AlwaysDisallowedType, DisallowPrimitives, DisallowArray, AckCallback, ArrayOf, ArrayAsRecord, Saveable, IGunCryptoKeyPair } from './types';
import { IGunConstructorOptions } from './options';
import { ITSResolvable } from 'ts-type';
export interface IGunChainReference<DataType = Record<string, any>, ReferenceKey = any, IsTop extends 'pre_root' | 'root' | false = false> {
@ -217,7 +217,7 @@ export interface IGunChainReference<DataType = Record<string, any>, ReferenceKey
epub: string;
pub: string;
};
sea: CryptoKeyPair;
sea: IGunCryptoKeyPair;
soul: string;
} | {
err: string;
@ -225,7 +225,7 @@ export interface IGunChainReference<DataType = Record<string, any>, ReferenceKey
/**
* Returns the key pair in the form of an object as below.
*/
pair(): CryptoKeyPair;
pair(): IGunCryptoKeyPair;
/**
* Log out currently authenticated user. Parameters are unused in the current implementation.
* @param opt unused in current implementation.

15
types/types.d.ts vendored
View File

@ -21,4 +21,17 @@ export declare type AckCallback = (ack: {
err: undefined;
ok: string;
}) => void;
export declare type CryptoKeyPair = Record<'pub' | 'priv' | 'epub' | 'epriv', string>;
export declare type IGunCryptoKeyPair = Record<'pub' | 'priv' | 'epub' | 'epriv', string>;
export interface IGunRecordNodeRawBase {
'#': string;
}
export interface IGunRecordNodeRawExtra<DataType> extends IGunRecordNodeRawBase {
'>': Record<keyof DataType, number>;
}
export interface IGunRecordNodeRaw<DataType> {
'_': IGunRecordNodeRawExtra<DataType>;
}
export declare type IGunRecordNode<DataType> = {
[K in keyof DataType]: IGunRecordNodeRawBase;
} & IGunRecordNodeRaw<DataType>;
export declare type IGunRecordData<DataType> = DataType & IGunRecordNodeRaw<DataType>;