Skip to content
This repository was archived by the owner on Mar 8, 2023. It is now read-only.

Commit 19a5267

Browse files
committed
decrypt, encrypt, secret
1 parent 4120e4f commit 19a5267

19 files changed

+1511
-653
lines changed

dist/Channel.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,11 @@ declare class Channel {
132132
/**
133133
*
134134
*/
135-
static getOurSecretChannelId(pub: any, pair: any): Promise<string | undefined>;
135+
static getOurSecretChannelId(pub: any, pair: any): Promise<string | ArrayBuffer>;
136136
/**
137137
*
138138
*/
139-
static getTheirSecretChannelId(pub: any, pair: any): Promise<string | undefined>;
139+
static getTheirSecretChannelId(pub: any, pair: any): Promise<string | ArrayBuffer>;
140140
/**
141141
* Calls back with Channels that you have initiated or written to.
142142
* @param {Object} keypair Key keypair that the gun instance is authenticated with

dist/Key.d.ts

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
1-
declare class Key {
2-
static getActiveKey(datadir?: string, keyfile?: string, fs?: any): Promise<any>;
3-
static getDefault(datadir?: string, keyfile?: string): Promise<any>;
4-
static getActivePub(datadir?: string, keyfile?: string): Promise<any>;
5-
static setActiveKey(key: any, save: boolean | undefined, datadir: string | undefined, keyfile: string | undefined, fs: any): void;
6-
static toString(key: any): string;
7-
static getId(key: any): any;
8-
static fromString(str: string): any;
9-
static generate(): Promise<{
1+
/// <reference types="node" />
2+
declare const _default: {
3+
getActiveKey(datadir?: string, keyfile?: string, fs?: any): Promise<any>;
4+
getDefault(datadir?: string, keyfile?: string): Promise<any>;
5+
getActivePub(datadir?: string, keyfile?: string): Promise<any>;
6+
setActiveKey(key: any, save: boolean | undefined, datadir: string | undefined, keyfile: string | undefined, fs: any): void;
7+
toString(key: any): string;
8+
getId(key: any): any;
9+
fromString(str: string): any;
10+
generate(): Promise<{
1011
pub: any;
1112
priv: any;
1213
epub: any;
1314
epriv: any;
1415
} | undefined>;
15-
private static keyToJwk;
16-
static sign(data: any, pair: any, cb?: Function, opt?: any): Promise<any>;
17-
static verify(data: any, pair: any, cb?: Function, opt?: any): Promise<any>;
18-
static secret(_pub: any, _pair: any): Promise<string>;
19-
static encrypt(_data: any, _pair: any, _cb?: Function, _opt?: {}): Promise<string>;
20-
static decrypt(_data: any, _pair: any, _cb?: Function, _opt?: {}): Promise<string>;
21-
}
22-
export default Key;
16+
keyToJwk(key: any): JsonWebKey;
17+
sign(data: any, pair: any, cb?: Function | undefined, opt?: any): Promise<any>;
18+
verify(data: any, pair: any, cb?: Function | undefined, opt?: any): Promise<any>;
19+
secret(key: any, pair: any): Promise<string | undefined>;
20+
aeskey(key: any, salt?: Buffer | undefined): Promise<CryptoKey>;
21+
random(len: number): Buffer;
22+
encrypt(data: any, pair: any, cb?: Function | undefined, opt?: any): Promise<any>;
23+
decrypt(data: any, pair: any, cb?: Function | undefined, opt?: any): Promise<string>;
24+
};
25+
export default _default;

dist/db/Node.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ export default class Node extends Actor {
3636
user(pub: string | undefined): Node;
3737
auth(key: any): void;
3838
doCallbacks: (data: NodeData, key: string) => void;
39-
put(value: any): void;
39+
put(value: any): Promise<void>;
40+
private signIfNeeded;
4041
private addParentNodes;
4142
private request;
4243
once(callback?: Function | null): Promise<any>;

dist/index.d.ts

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/// <reference types="node" />
12
import local from './local';
23
import global from './global';
34
import publicState from './public';
@@ -6,7 +7,6 @@ import privateState from './private';
67
import SignedMessage from './SignedMessage';
78
import Channel from './Channel';
89
import Node from './db/Node';
9-
import Key from './Key';
1010
declare const _default: {
1111
local: typeof local;
1212
global: typeof global;
@@ -15,7 +15,7 @@ declare const _default: {
1515
private: typeof privateState;
1616
static: {
1717
get(hash: string, callback: Function): Promise<unknown>;
18-
put(value: any): Promise<string | undefined>;
18+
put(value: any): Promise<string | ArrayBuffer>;
1919
};
2020
electron: Node | null;
2121
peers: {
@@ -89,7 +89,7 @@ declare const _default: {
8989
};
9090
util: {
9191
gunOnceDefined: (node: any) => Promise<unknown>;
92-
getHash(str: string, format?: string): Promise<string | undefined>;
92+
getHash(data: any, format?: string): Promise<string | ArrayBuffer>;
9393
capitalize(s: string): string;
9494
generateName(): string;
9595
base64ToHex(str: string): string;
@@ -130,6 +130,28 @@ declare const _default: {
130130
SignedMessage: typeof SignedMessage;
131131
Channel: typeof Channel;
132132
Node: typeof Node;
133-
Key: typeof Key;
133+
Key: {
134+
getActiveKey(datadir?: string, keyfile?: string, fs?: any): Promise<any>;
135+
getDefault(datadir?: string, keyfile?: string): Promise<any>;
136+
getActivePub(datadir?: string, keyfile?: string): Promise<any>;
137+
setActiveKey(key: any, save: boolean | undefined, datadir: string | undefined, keyfile: string | undefined, fs: any): void;
138+
toString(key: any): string;
139+
getId(key: any): any;
140+
fromString(str: string): any;
141+
generate(): Promise<{
142+
pub: any;
143+
priv: any;
144+
epub: any;
145+
epriv: any;
146+
} | undefined>;
147+
keyToJwk(key: any): JsonWebKey;
148+
sign(data: any, pair: any, cb?: Function | undefined, opt?: any): Promise<any>;
149+
verify(data: any, pair: any, cb?: Function | undefined, opt?: any): Promise<any>;
150+
secret(key: any, pair: any): Promise<string | undefined>;
151+
aeskey(key: any, salt?: Buffer | undefined): Promise<CryptoKey>;
152+
random(len: number): Buffer;
153+
encrypt(data: any, pair: any, cb?: Function | undefined, opt?: any): Promise<any>;
154+
decrypt(data: any, pair: any, cb?: Function | undefined, opt?: any): Promise<any>;
155+
};
134156
};
135157
export default _default;

0 commit comments

Comments
 (0)