forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
radius.d.ts
106 lines (87 loc) · 3.16 KB
/
radius.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
// Type definitions for node-radius
// Project: https://github.com/retailnext/node-radius
// Definitions by: Peter Harris <https://github.com/codeanimal>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
declare module "radius" {
/**
* {@link https://github.com/retailnext/node-radius#radiusdecodeargs} for more info.
**/
export function decode(args: DecodeArgsWithSecret): RadiusPacket;
/**
* {@link https://github.com/retailnext/node-radius#radiusdecode_without_secretargs} for more info.
**/
export function decode_without_secret(args: DecodeArgs): RadiusPacket;
/**
* {@link https://github.com/retailnext/node-radius#radiusencodeargs} for more info.
**/
export function encode(args: EncodeArgs): Buffer;
/**
* {@link https://github.com/retailnext/node-radius#radiusencode_responseargs} for more info.
**/
export function encode_response(args: EncodeResponseArgs): Buffer;
/**
* {@link https://github.com/retailnext/node-radius#radiusverify_responseargs} for more info.
**/
export function verify_response(args: VerifyResponseArgs):boolean;
/**
* {@link https://github.com/retailnext/node-radius#radiusadd_dictionarypath} for more info.
*
* @param path Can be either a path to a file or a directory.
**/
export function add_dictionary(path:string): void;
export function unload_dictionaries(): void;
/**
* {@link https://github.com/retailnext/node-radius#radiusdecode_without_secretargs} for more info.
**/
interface DecodeArgs {
packet: Buffer;
}
/**
* {@link https://github.com/retailnext/node-radius#radiusdecodeargs} for more info.
**/
interface DecodeArgsWithSecret extends DecodeArgs {
secret: string;
}
/**
* {@link https://github.com/retailnext/node-radius#radiusencodeargs} for more info.
**/
interface EncodeArgs {
code: string;
secret: string;
identifier?: number;
/**
* This can be an object: { attribute_name: attribute_value, ... },
* an array within an array: [ [ attribute_name, attribute_value ], ... ],
* or if you haven't loaded a dictionary for the attributes: [ [ attribute_id, Buffer ], ... ].
*
* Tag field-attributes can be specified like so: [ [ attribute_name, tag_number, attribute_value ] ... ]
**/
attributes?: any;
add_message_authenticator?: boolean;
}
/**
* {@link https://github.com/retailnext/node-radius#radiusencode_responseargs} for more info.
**/
interface EncodeResponseArgs {
packet: RadiusPacket;
code: string;
secret: string;
attributes?: any;
}
/**
* {@link https://github.com/retailnext/node-radius#radiusverify_responseargs} for more info.
**/
interface VerifyResponseArgs {
request: Buffer;
response: Buffer;
secret: string;
}
interface RadiusPacket {
code: string;
identifier: number;
length: number;
attributes: any;
raw_attributes: Array<Array<any>>
}
}