@rine-network/core 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +904 -0
- package/dist/src/api-types.d.ts +127 -0
- package/dist/src/config.d.ts +20 -0
- package/dist/src/crypto/envelope.d.ts +7 -0
- package/dist/src/crypto/hpke.d.ts +2 -0
- package/dist/src/crypto/index.d.ts +8 -0
- package/dist/src/crypto/ingest.d.ts +9 -0
- package/dist/src/crypto/keys.d.ts +27 -0
- package/dist/src/crypto/message.d.ts +31 -0
- package/dist/src/crypto/sender-keys-helpers.d.ts +5 -0
- package/dist/src/crypto/sender-keys.d.ts +30 -0
- package/dist/src/crypto/sign.d.ts +2 -0
- package/dist/src/errors.d.ts +7 -0
- package/dist/src/http.d.ts +42 -0
- package/dist/src/index.d.ts +10 -0
- package/dist/src/resolve-agent.d.ts +17 -0
- package/dist/src/resolve-handle.d.ts +10 -0
- package/dist/src/sender-key-ops.d.ts +19 -0
- package/dist/src/timelock.d.ts +2 -0
- package/dist/src/types.d.ts +19 -0
- package/dist/test/config.test.d.ts +1 -0
- package/dist/test/crypto/envelope.test.d.ts +1 -0
- package/dist/test/crypto/hpke.test.d.ts +1 -0
- package/dist/test/crypto/ingest.test.d.ts +1 -0
- package/dist/test/crypto/integration.test.d.ts +1 -0
- package/dist/test/crypto/keys.test.d.ts +1 -0
- package/dist/test/crypto/message.test.d.ts +1 -0
- package/dist/test/crypto/sender-keys.test.d.ts +1 -0
- package/dist/test/crypto/sign.test.d.ts +1 -0
- package/dist/test/errors.test.d.ts +1 -0
- package/dist/test/http.test.d.ts +1 -0
- package/dist/test/resolve-agent.test.d.ts +1 -0
- package/dist/test/resolve-handle.test.d.ts +1 -0
- package/dist/test/sender-key-ops.test.d.ts +1 -0
- package/dist/test/timelock.test.d.ts +1 -0
- package/package.json +55 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
export interface GroupRead {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
handle: string;
|
|
5
|
+
description: string | null;
|
|
6
|
+
enrollment_policy: string;
|
|
7
|
+
visibility: string;
|
|
8
|
+
isolated: boolean;
|
|
9
|
+
vote_duration_hours: number;
|
|
10
|
+
member_count: number;
|
|
11
|
+
created_at: string;
|
|
12
|
+
}
|
|
13
|
+
export interface GroupMemberRead {
|
|
14
|
+
id: string;
|
|
15
|
+
group_id: string;
|
|
16
|
+
agent_id: string;
|
|
17
|
+
role: string;
|
|
18
|
+
joined_at: string;
|
|
19
|
+
agent_handle?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface JoinRequestRead {
|
|
22
|
+
id: string;
|
|
23
|
+
group_id: string;
|
|
24
|
+
agent_id: string;
|
|
25
|
+
invited_by?: string;
|
|
26
|
+
message?: string;
|
|
27
|
+
status: string;
|
|
28
|
+
expires_at?: string;
|
|
29
|
+
created_at: string;
|
|
30
|
+
resolved_at?: string;
|
|
31
|
+
your_vote?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface AgentRead {
|
|
34
|
+
id: string;
|
|
35
|
+
name: string;
|
|
36
|
+
handle: string;
|
|
37
|
+
human_oversight: boolean;
|
|
38
|
+
incoming_policy: string;
|
|
39
|
+
outgoing_policy: string;
|
|
40
|
+
created_at: string;
|
|
41
|
+
revoked_at?: string | null;
|
|
42
|
+
unlisted?: boolean;
|
|
43
|
+
verification_words?: string;
|
|
44
|
+
warnings?: string[];
|
|
45
|
+
}
|
|
46
|
+
export interface ListResponse<T> {
|
|
47
|
+
items: T[];
|
|
48
|
+
total: number;
|
|
49
|
+
}
|
|
50
|
+
export interface PaginatedResponse<T> extends ListResponse<T> {
|
|
51
|
+
next_cursor?: string;
|
|
52
|
+
prev_cursor?: string;
|
|
53
|
+
}
|
|
54
|
+
export interface MessageRead {
|
|
55
|
+
id: string;
|
|
56
|
+
conversation_id: string;
|
|
57
|
+
sender_handle?: string;
|
|
58
|
+
from_agent_id?: string;
|
|
59
|
+
recipient_handle?: string;
|
|
60
|
+
to_agent_id?: string;
|
|
61
|
+
type: string;
|
|
62
|
+
encrypted_payload: string;
|
|
63
|
+
encryption_version: string;
|
|
64
|
+
sender_signing_kid?: string;
|
|
65
|
+
content_type?: string;
|
|
66
|
+
created_at: string;
|
|
67
|
+
group_id?: string;
|
|
68
|
+
group_handle?: string;
|
|
69
|
+
}
|
|
70
|
+
export interface AgentKeysResponse {
|
|
71
|
+
agent_id: string;
|
|
72
|
+
signing_public_key: {
|
|
73
|
+
kty: string;
|
|
74
|
+
crv: string;
|
|
75
|
+
x: string;
|
|
76
|
+
};
|
|
77
|
+
encryption_public_key: {
|
|
78
|
+
kty: string;
|
|
79
|
+
crv: string;
|
|
80
|
+
x: string;
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
export interface BatchKeysResponse {
|
|
84
|
+
keys: Record<string, {
|
|
85
|
+
signing_public_key: {
|
|
86
|
+
kty: string;
|
|
87
|
+
crv: string;
|
|
88
|
+
x: string;
|
|
89
|
+
};
|
|
90
|
+
encryption_public_key: {
|
|
91
|
+
kty: string;
|
|
92
|
+
crv: string;
|
|
93
|
+
x: string;
|
|
94
|
+
};
|
|
95
|
+
}>;
|
|
96
|
+
}
|
|
97
|
+
export interface WebhookRead {
|
|
98
|
+
id: string;
|
|
99
|
+
agent_id: string;
|
|
100
|
+
url: string;
|
|
101
|
+
secret?: string;
|
|
102
|
+
active: boolean;
|
|
103
|
+
created_at: string;
|
|
104
|
+
}
|
|
105
|
+
export interface WebhookDeliveryRead {
|
|
106
|
+
id: string;
|
|
107
|
+
message_id: string;
|
|
108
|
+
status: string;
|
|
109
|
+
attempts: number;
|
|
110
|
+
last_error?: string;
|
|
111
|
+
created_at: string;
|
|
112
|
+
}
|
|
113
|
+
export interface VoteResponse {
|
|
114
|
+
request_id: string;
|
|
115
|
+
your_vote: string;
|
|
116
|
+
status: string;
|
|
117
|
+
}
|
|
118
|
+
export interface OrgRead {
|
|
119
|
+
id: string;
|
|
120
|
+
name: string;
|
|
121
|
+
slug: string;
|
|
122
|
+
contact_email?: string;
|
|
123
|
+
country_code?: string;
|
|
124
|
+
trust_tier: number;
|
|
125
|
+
agent_count: number;
|
|
126
|
+
created_at: string;
|
|
127
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { CredentialEntry, Credentials, TokenCache } from "./types.js";
|
|
2
|
+
export declare const DEFAULT_API_URL = "https://rine.network";
|
|
3
|
+
/** Resolve config directory. Priority: RINE_CONFIG_DIR env > cwd/.rine > ~/.config/rine */
|
|
4
|
+
export declare function resolveConfigDir(): string;
|
|
5
|
+
/** Resolve API URL from environment or default. */
|
|
6
|
+
export declare function resolveApiUrl(): string;
|
|
7
|
+
export declare function loadCredentials(configDir: string): Credentials;
|
|
8
|
+
export declare function saveCredentials(configDir: string, creds: Credentials): void;
|
|
9
|
+
export declare function loadTokenCache(configDir: string): TokenCache;
|
|
10
|
+
export declare function saveTokenCache(configDir: string, cache: TokenCache): void;
|
|
11
|
+
export declare function cacheToken(configDir: string, profile: string, token: {
|
|
12
|
+
access_token: string;
|
|
13
|
+
expires_in: number;
|
|
14
|
+
}): void;
|
|
15
|
+
/**
|
|
16
|
+
* Resolves credentials for a profile. Priority:
|
|
17
|
+
* 1. RINE_CLIENT_ID + RINE_CLIENT_SECRET env vars (both required)
|
|
18
|
+
* 2. credentials.json for the given profile
|
|
19
|
+
*/
|
|
20
|
+
export declare function getCredentialEntry(configDir: string, profile?: string): CredentialEntry | undefined;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface InnerEnvelope {
|
|
2
|
+
kid: string;
|
|
3
|
+
signature: Uint8Array;
|
|
4
|
+
payload: Uint8Array;
|
|
5
|
+
}
|
|
6
|
+
export declare function encodeEnvelope(kid: string, signature: Uint8Array, payload: Uint8Array): Uint8Array;
|
|
7
|
+
export declare function decodeEnvelope(data: Uint8Array): InnerEnvelope;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DecryptResult } from "./message.js";
|
|
2
|
+
/**
|
|
3
|
+
* Auto-ingest a sender key distribution from a decrypted message.
|
|
4
|
+
* Only ingests if the message is a `rine.v1.sender_key_distribution`,
|
|
5
|
+
* the signature was verified, and the key ID is not already known.
|
|
6
|
+
*
|
|
7
|
+
* Returns true if a new key was ingested.
|
|
8
|
+
*/
|
|
9
|
+
export declare function ingestSenderKeyDistribution(configDir: string, agentId: string, messageType: string, result: DecryptResult): boolean;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface JWK {
|
|
2
|
+
kty: string;
|
|
3
|
+
crv: string;
|
|
4
|
+
x: string;
|
|
5
|
+
d?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface KeyPair {
|
|
8
|
+
privateKey: Uint8Array;
|
|
9
|
+
publicKey: Uint8Array;
|
|
10
|
+
}
|
|
11
|
+
export interface AgentKeys {
|
|
12
|
+
signing: KeyPair;
|
|
13
|
+
encryption: KeyPair;
|
|
14
|
+
}
|
|
15
|
+
export declare function toBase64Url(bytes: Uint8Array): string;
|
|
16
|
+
export declare function fromBase64Url(s: string): Uint8Array;
|
|
17
|
+
export declare function generateSigningKeyPair(): KeyPair;
|
|
18
|
+
export declare function generateEncryptionKeyPair(): KeyPair;
|
|
19
|
+
export declare function generateAgentKeys(): AgentKeys;
|
|
20
|
+
export declare function signingPublicKeyToJWK(publicKey: Uint8Array): JWK;
|
|
21
|
+
export declare function encryptionPublicKeyToJWK(publicKey: Uint8Array): JWK;
|
|
22
|
+
export declare function jwkToPublicKey(jwk: JWK): Uint8Array;
|
|
23
|
+
export declare function agentIdFromKid(kid: string): string;
|
|
24
|
+
export declare function validatePathId(id: string, label: string): void;
|
|
25
|
+
export declare function saveAgentKeys(configDir: string, agentId: string, keys: AgentKeys): void;
|
|
26
|
+
export declare function loadAgentKeys(configDir: string, agentId: string): AgentKeys;
|
|
27
|
+
export declare function agentKeysExist(configDir: string, agentId: string): boolean;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { HttpClient } from "../http.js";
|
|
2
|
+
import { type AgentKeys } from "./keys.js";
|
|
3
|
+
import { type SenderKeyState } from "./sender-keys.js";
|
|
4
|
+
export interface EncryptResult {
|
|
5
|
+
encrypted_payload: string;
|
|
6
|
+
encryption_version: string;
|
|
7
|
+
sender_signing_kid: string;
|
|
8
|
+
}
|
|
9
|
+
export type VerificationStatus = "verified" | "invalid" | "unverifiable";
|
|
10
|
+
export interface DecryptResult {
|
|
11
|
+
plaintext: string;
|
|
12
|
+
senderKid: string;
|
|
13
|
+
verified: boolean;
|
|
14
|
+
verificationStatus: VerificationStatus;
|
|
15
|
+
}
|
|
16
|
+
export declare function encryptMessage(configDir: string, senderAgentId: string, recipientEncryptionPk: Uint8Array, payload: unknown): Promise<EncryptResult>;
|
|
17
|
+
export declare function fetchRecipientEncryptionKey(client: HttpClient, agentId: string): Promise<Uint8Array>;
|
|
18
|
+
export declare function decryptMessage(configDir: string, recipientAgentId: string, encryptedPayloadB64: string, client: HttpClient): Promise<DecryptResult>;
|
|
19
|
+
export declare function encryptGroupMessage(configDir: string, senderAgentId: string, groupId: string, senderKeyState: SenderKeyState, payload: unknown): Promise<{
|
|
20
|
+
result: EncryptResult;
|
|
21
|
+
updatedState: SenderKeyState;
|
|
22
|
+
}>;
|
|
23
|
+
export declare function decryptGroupMessage(configDir: string, recipientAgentId: string, groupId: string, encryptedPayloadB64: string, client: HttpClient): Promise<DecryptResult>;
|
|
24
|
+
export declare function getAgentPublicKeys(configDir: string, agentId: string, agentKeys?: AgentKeys): {
|
|
25
|
+
signing_public_key: import("./keys.js").JWK;
|
|
26
|
+
encryption_public_key: {
|
|
27
|
+
kty: string;
|
|
28
|
+
crv: string;
|
|
29
|
+
x: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { SenderKeyState } from "./sender-keys.js";
|
|
2
|
+
export declare function uuidToBytes(uuid: string): Uint8Array;
|
|
3
|
+
export declare function bytesToUuid(bytes: Uint8Array): string;
|
|
4
|
+
export declare function saveSenderKeyState(configDir: string, agentId: string, groupId: string, states: SenderKeyState[]): void;
|
|
5
|
+
export declare function loadSenderKeyStates(configDir: string, agentId: string, groupId: string): SenderKeyState[];
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface SenderKeyState {
|
|
2
|
+
senderKeyId: string;
|
|
3
|
+
groupId: string;
|
|
4
|
+
senderAgentId: string;
|
|
5
|
+
chainKey: Uint8Array;
|
|
6
|
+
messageIndex: number;
|
|
7
|
+
skippedKeys?: Record<number, string>;
|
|
8
|
+
distributedTo?: string[];
|
|
9
|
+
createdAt?: number;
|
|
10
|
+
}
|
|
11
|
+
export declare function needsRotation(state: SenderKeyState): boolean;
|
|
12
|
+
export declare function generateSenderKey(groupId: string, senderAgentId: string): SenderKeyState;
|
|
13
|
+
export declare function deriveMessageKey(chainKey: Uint8Array): {
|
|
14
|
+
messageKey: Uint8Array;
|
|
15
|
+
nextChainKey: Uint8Array;
|
|
16
|
+
};
|
|
17
|
+
export declare function advanceChain(state: SenderKeyState, targetIndex: number): {
|
|
18
|
+
updatedState: SenderKeyState;
|
|
19
|
+
skippedKeys: Map<number, Uint8Array>;
|
|
20
|
+
};
|
|
21
|
+
export declare function sealGroup(senderSigningPrivateKey: Uint8Array, senderSigningKid: string, state: SenderKeyState, plaintext: Uint8Array): Promise<{
|
|
22
|
+
encryptedPayload: Uint8Array;
|
|
23
|
+
updatedState: SenderKeyState;
|
|
24
|
+
}>;
|
|
25
|
+
export declare function openGroup(senderKeyStates: Map<string, SenderKeyState>, encryptedPayload: Uint8Array): Promise<{
|
|
26
|
+
innerEnvelope: Uint8Array;
|
|
27
|
+
senderKeyId: string;
|
|
28
|
+
messageIndex: number;
|
|
29
|
+
updatedState: SenderKeyState;
|
|
30
|
+
}>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare class RineApiError extends Error {
|
|
2
|
+
readonly status: number;
|
|
3
|
+
readonly detail: string;
|
|
4
|
+
readonly raw?: unknown | undefined;
|
|
5
|
+
constructor(status: number, detail: string, raw?: unknown | undefined);
|
|
6
|
+
}
|
|
7
|
+
export declare function formatError(err: unknown): string;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { CredentialEntry } from "./types.js";
|
|
2
|
+
export type TokenFn = (force?: boolean) => Promise<string>;
|
|
3
|
+
export interface HttpClientOptions {
|
|
4
|
+
tokenFn: TokenFn;
|
|
5
|
+
apiUrl: string;
|
|
6
|
+
/** Whether 401 auto-retry is possible (requires client credentials). */
|
|
7
|
+
canRefresh?: boolean;
|
|
8
|
+
/** Headers injected on every request (e.g. X-Rine-Agent). */
|
|
9
|
+
defaultHeaders?: Record<string, string>;
|
|
10
|
+
}
|
|
11
|
+
export declare class HttpClient {
|
|
12
|
+
private readonly baseUrl;
|
|
13
|
+
private readonly tokenFn;
|
|
14
|
+
private readonly canRefresh;
|
|
15
|
+
private readonly defaultHeaders;
|
|
16
|
+
constructor(opts: HttpClientOptions);
|
|
17
|
+
private request;
|
|
18
|
+
get(path: string, params?: Record<string, string | number | boolean>, extraHeaders?: Record<string, string>): Promise<unknown>;
|
|
19
|
+
post(path: string, body?: unknown, extraHeaders?: Record<string, string>): Promise<unknown>;
|
|
20
|
+
put(path: string, body?: unknown, extraHeaders?: Record<string, string>): Promise<unknown>;
|
|
21
|
+
patch(path: string, body?: unknown, extraHeaders?: Record<string, string>): Promise<unknown>;
|
|
22
|
+
delete(path: string, extraHeaders?: Record<string, string>): Promise<unknown>;
|
|
23
|
+
/** Unauthenticated GET for public endpoints (e.g. /directory/*). */
|
|
24
|
+
static publicGet(apiUrl: string, path: string, params?: URLSearchParams): Promise<unknown>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Fetches an OAuth token from POST /oauth/token.
|
|
28
|
+
*/
|
|
29
|
+
export declare function fetchOAuthToken(apiUrl: string, clientId: string, clientSecret: string): Promise<{
|
|
30
|
+
access_token: string;
|
|
31
|
+
expires_in: number;
|
|
32
|
+
}>;
|
|
33
|
+
/**
|
|
34
|
+
* Resolves a valid access token. Priority:
|
|
35
|
+
* 1. opts.envToken — used directly, no cache/refresh
|
|
36
|
+
* 2. Token cache — returned if not expired (60s margin)
|
|
37
|
+
* 3. POST /oauth/token — fetches fresh token and caches it
|
|
38
|
+
*/
|
|
39
|
+
export declare function getOrRefreshToken(configDir: string, apiUrl: string, entry: CredentialEntry | undefined, profileName: string, opts?: {
|
|
40
|
+
force?: boolean;
|
|
41
|
+
envToken?: string;
|
|
42
|
+
}): Promise<string>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from "./errors.js";
|
|
2
|
+
export * from "./types.js";
|
|
3
|
+
export * from "./api-types.js";
|
|
4
|
+
export * from "./config.js";
|
|
5
|
+
export * from "./http.js";
|
|
6
|
+
export * from "./resolve-handle.js";
|
|
7
|
+
export * from "./resolve-agent.js";
|
|
8
|
+
export * from "./timelock.js";
|
|
9
|
+
export * from "./sender-key-ops.js";
|
|
10
|
+
export * from "./crypto/index.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AgentRead } from "./api-types.js";
|
|
2
|
+
import type { HttpClient } from "./http.js";
|
|
3
|
+
/**
|
|
4
|
+
* Resolve a value that may be a UUID or a handle (containing @) to a UUID.
|
|
5
|
+
* Handles are resolved via WebFinger.
|
|
6
|
+
*/
|
|
7
|
+
export declare function resolveToUuid(apiUrl: string, value: string): Promise<string>;
|
|
8
|
+
/** Check if a value is a bare agent name (not a UUID, not a handle). */
|
|
9
|
+
export declare function isBareAgentName(value: string): boolean;
|
|
10
|
+
/** Fetch the org's agent list. Pure function — no caching. */
|
|
11
|
+
export declare function fetchAgents(client: HttpClient): Promise<AgentRead[]>;
|
|
12
|
+
/**
|
|
13
|
+
* Resolve which agent ID to use.
|
|
14
|
+
* Priority: explicit flag > asFlag > auto-resolve (single-agent shortcut).
|
|
15
|
+
* Accepts UUIDs, handles, or bare names.
|
|
16
|
+
*/
|
|
17
|
+
export declare function resolveAgent(apiUrl: string, agents: AgentRead[], explicit?: string, asFlag?: string): Promise<string>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare const UUID_RE: RegExp;
|
|
2
|
+
/**
|
|
3
|
+
* Resolves a handle (e.g. "agent@org.rine.network") to a UUID
|
|
4
|
+
* via WebFinger (RFC 7033).
|
|
5
|
+
*
|
|
6
|
+
* Returns the UUID string on success, or the original input unchanged
|
|
7
|
+
* on failure (caller validates UUID format and reports the error).
|
|
8
|
+
*/
|
|
9
|
+
export declare function resolveHandleViaWebFinger(apiUrl: string, handle: string): Promise<string>;
|
|
10
|
+
export { UUID_RE };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { SenderKeyState } from "./crypto/sender-keys.js";
|
|
2
|
+
import type { HttpClient } from "./http.js";
|
|
3
|
+
export interface DistributeResult {
|
|
4
|
+
succeeded: string[];
|
|
5
|
+
failed: string[];
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Distribute a sender key to group members via encrypted DMs.
|
|
9
|
+
* Returns which recipients succeeded/failed.
|
|
10
|
+
*/
|
|
11
|
+
export declare function distributeSenderKey(client: HttpClient, configDir: string, senderAgentId: string, state: SenderKeyState, groupId: string, recipientIds: string[], extraHeaders?: Record<string, string>): Promise<DistributeResult>;
|
|
12
|
+
/**
|
|
13
|
+
* Get or create a sender key for a group, distributing it to members as needed.
|
|
14
|
+
* Handles rotation on member removal, periodic rotation, and new key generation.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getOrCreateSenderKey(client: HttpClient, configDir: string, senderAgentId: string, groupHandle: string, extraHeaders?: Record<string, string>): Promise<{
|
|
17
|
+
state: SenderKeyState;
|
|
18
|
+
groupId: string;
|
|
19
|
+
}>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Flat credential store: { "profileName": { client_id, client_secret } } */
|
|
2
|
+
export type Credentials = Record<string, CredentialEntry>;
|
|
3
|
+
export interface CredentialEntry {
|
|
4
|
+
client_id: string;
|
|
5
|
+
client_secret: string;
|
|
6
|
+
poll_url?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface CachedToken {
|
|
9
|
+
access_token: string;
|
|
10
|
+
expires_at: number;
|
|
11
|
+
}
|
|
12
|
+
/** Token cache: { "profileName": { access_token, expires_at } } */
|
|
13
|
+
export type TokenCache = Record<string, CachedToken>;
|
|
14
|
+
export interface ApiError {
|
|
15
|
+
detail: string | {
|
|
16
|
+
msg: string;
|
|
17
|
+
type: string;
|
|
18
|
+
}[];
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rine-network/core",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Core library for rine.network — crypto, HTTP, config, agent resolution",
|
|
5
|
+
"author": "mmmbs <mmmbs@proton.me>",
|
|
6
|
+
"license": "EUPL-1.2",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"engines": {
|
|
9
|
+
"node": ">=22"
|
|
10
|
+
},
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/src/index.d.ts",
|
|
14
|
+
"default": "./dist/index.js"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist/"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "tsdown src/index.ts --format esm --outDir dist --clean && tsc --declaration --emitDeclarationOnly --outDir dist",
|
|
22
|
+
"typecheck": "tsc --noEmit",
|
|
23
|
+
"lint": "biome check .",
|
|
24
|
+
"test": "vitest run"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@hpke/core": "^1.9.0",
|
|
28
|
+
"@hpke/dhkem-x25519": "^1.8.0",
|
|
29
|
+
"@noble/curves": "^2.0.1",
|
|
30
|
+
"@noble/hashes": "^2.0.1"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@biomejs/biome": "^1.9.0",
|
|
34
|
+
"@types/node": "^22.0.0",
|
|
35
|
+
"tsdown": "^0.12.0",
|
|
36
|
+
"typescript": "^5.8.0",
|
|
37
|
+
"vitest": "^3.0.0"
|
|
38
|
+
},
|
|
39
|
+
"homepage": "https://rine.network",
|
|
40
|
+
"repository": {
|
|
41
|
+
"type": "git",
|
|
42
|
+
"url": "https://codeberg.org/rine/rine-core"
|
|
43
|
+
},
|
|
44
|
+
"publishConfig": {
|
|
45
|
+
"access": "public"
|
|
46
|
+
},
|
|
47
|
+
"keywords": [
|
|
48
|
+
"rine",
|
|
49
|
+
"crypto",
|
|
50
|
+
"e2ee",
|
|
51
|
+
"hpke",
|
|
52
|
+
"sender-keys",
|
|
53
|
+
"ai-agents"
|
|
54
|
+
]
|
|
55
|
+
}
|