@wishknish/knishio-client-ts 0.9.6 → 0.9.7
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.cjs +531 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +126 -5
- package/dist/index.d.ts +126 -5
- package/dist/index.iife.js +531 -5
- package/dist/index.iife.js.map +1 -1
- package/dist/index.js +524 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/KnishIOClient.ts +63 -2
- package/src/exception/SecretStorageException.ts +97 -0
- package/src/exception/index.ts +1 -0
- package/src/index.ts +28 -1
- package/src/libraries/secureMemory.ts +121 -0
- package/src/schemas/index.ts +2 -1
- package/src/storage/MemorySecretStorageProvider.ts +156 -0
- package/src/storage/WebCryptoSecretStorageProvider.ts +407 -0
- package/src/storage/index.ts +87 -0
- package/src/types/index.ts +1 -1
- package/src/types/storage.ts +129 -0
- package/src/validation/schemas.ts +3 -1
package/dist/index.d.cts
CHANGED
|
@@ -124,6 +124,42 @@ interface GraphQLClient$1 {
|
|
|
124
124
|
getUri(): string;
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
+
interface SecretStorageMetadata {
|
|
128
|
+
bundleHash: string;
|
|
129
|
+
label?: string;
|
|
130
|
+
createdAt: number;
|
|
131
|
+
hardwareBacked: boolean;
|
|
132
|
+
providerType: string;
|
|
133
|
+
}
|
|
134
|
+
interface EncryptedSecretPayload {
|
|
135
|
+
version: 1;
|
|
136
|
+
ciphertext: string;
|
|
137
|
+
iv: string;
|
|
138
|
+
salt: string;
|
|
139
|
+
tag?: string;
|
|
140
|
+
algorithm: 'AES-GCM' | 'AES-CBC';
|
|
141
|
+
iterations?: number;
|
|
142
|
+
metadata: SecretStorageMetadata;
|
|
143
|
+
}
|
|
144
|
+
interface ISecretStorageProvider {
|
|
145
|
+
readonly providerType: string;
|
|
146
|
+
isHardwareBacked(): boolean;
|
|
147
|
+
isAvailable(): Promise<boolean>;
|
|
148
|
+
storeSecret(bundleHash: string, secret: string, options?: {
|
|
149
|
+
label?: string;
|
|
150
|
+
passphrase?: string;
|
|
151
|
+
}): Promise<void>;
|
|
152
|
+
retrieveSecret(bundleHash: string, options?: {
|
|
153
|
+
passphrase?: string;
|
|
154
|
+
}): Promise<string | null>;
|
|
155
|
+
deleteSecret(bundleHash: string): Promise<boolean>;
|
|
156
|
+
hasSecret(bundleHash: string): Promise<boolean>;
|
|
157
|
+
listSecrets(): Promise<SecretStorageMetadata[]>;
|
|
158
|
+
withSecret<T>(bundleHash: string, fn: (secret: string) => Promise<T> | T, options?: {
|
|
159
|
+
passphrase?: string;
|
|
160
|
+
}): Promise<T>;
|
|
161
|
+
}
|
|
162
|
+
|
|
127
163
|
type WalletAddress = WalletAddressPattern & {
|
|
128
164
|
readonly __brand: 'WalletAddress';
|
|
129
165
|
};
|
|
@@ -1167,6 +1203,7 @@ declare class ResponseRequestAuthorization extends ResponseProposeMolecule {
|
|
|
1167
1203
|
declare class KnishIOClient {
|
|
1168
1204
|
private $__secret;
|
|
1169
1205
|
private $__bundle;
|
|
1206
|
+
private $__secretStorage;
|
|
1170
1207
|
private $__cellSlug;
|
|
1171
1208
|
private $__encrypt;
|
|
1172
1209
|
private $__uris;
|
|
@@ -1193,6 +1230,7 @@ declare class KnishIOClient {
|
|
|
1193
1230
|
serverSdkVersion?: number;
|
|
1194
1231
|
logging?: boolean;
|
|
1195
1232
|
defaultRequestPolicy?: RequestPolicy | null;
|
|
1233
|
+
secretStorage?: ISecretStorageProvider | null;
|
|
1196
1234
|
});
|
|
1197
1235
|
initialize({ uri, cellSlug, socket, client, serverSdkVersion, logging, defaultRequestPolicy }: {
|
|
1198
1236
|
uri: string | string[];
|
|
@@ -1222,6 +1260,11 @@ declare class KnishIOClient {
|
|
|
1222
1260
|
getCellSlug(): string | null;
|
|
1223
1261
|
hasSecret(): boolean;
|
|
1224
1262
|
getSecret(): string;
|
|
1263
|
+
setSecretStorage(storage: ISecretStorageProvider, bundleHash?: string): void;
|
|
1264
|
+
getSecretStorage(): ISecretStorageProvider | null;
|
|
1265
|
+
retrieveSecret(options?: {
|
|
1266
|
+
passphrase?: string;
|
|
1267
|
+
}): Promise<string | null>;
|
|
1225
1268
|
hasBundle(): boolean;
|
|
1226
1269
|
getBundle(): string;
|
|
1227
1270
|
setRemainderWallet(remainderWallet: Wallet): void;
|
|
@@ -1967,6 +2010,13 @@ declare class WalletCredentialException extends BaseException {
|
|
|
1967
2010
|
static bundleMismatch(expected: string, actual: string): WalletCredentialException;
|
|
1968
2011
|
}
|
|
1969
2012
|
|
|
2013
|
+
declare class SecretStorageException extends BaseException {
|
|
2014
|
+
constructor(message?: string, options?: BaseExceptionOptions);
|
|
2015
|
+
static notFound(bundleHash: string): SecretStorageException;
|
|
2016
|
+
static decryptionFailed(reason?: string): SecretStorageException;
|
|
2017
|
+
static unavailable(provider: string, reason?: string): SecretStorageException;
|
|
2018
|
+
}
|
|
2019
|
+
|
|
1970
2020
|
declare class InvalidResponseException extends BaseException {
|
|
1971
2021
|
constructor(message?: string, options?: BaseExceptionOptions);
|
|
1972
2022
|
static malformedJson(error: string): InvalidResponseException;
|
|
@@ -2078,12 +2128,83 @@ declare const EXCEPTION_CODES: {
|
|
|
2078
2128
|
readonly NETWORK_ERROR: "NETWORK_ERROR";
|
|
2079
2129
|
};
|
|
2080
2130
|
|
|
2081
|
-
declare
|
|
2131
|
+
declare class MemorySecretStorageProvider implements ISecretStorageProvider {
|
|
2132
|
+
readonly providerType = "memory";
|
|
2133
|
+
private secrets;
|
|
2134
|
+
isHardwareBacked(): boolean;
|
|
2135
|
+
isAvailable(): Promise<boolean>;
|
|
2136
|
+
storeSecret(bundleHash: string, secret: string, options?: {
|
|
2137
|
+
label?: string;
|
|
2138
|
+
passphrase?: string;
|
|
2139
|
+
}): Promise<void>;
|
|
2140
|
+
retrieveSecret(bundleHash: string): Promise<string | null>;
|
|
2141
|
+
deleteSecret(bundleHash: string): Promise<boolean>;
|
|
2142
|
+
hasSecret(bundleHash: string): Promise<boolean>;
|
|
2143
|
+
listSecrets(): Promise<SecretStorageMetadata[]>;
|
|
2144
|
+
withSecret<T>(bundleHash: string, fn: (secret: string) => Promise<T> | T): Promise<T>;
|
|
2145
|
+
clear(): void;
|
|
2146
|
+
}
|
|
2147
|
+
|
|
2148
|
+
interface IStorageBackend {
|
|
2149
|
+
getItem(key: string): Promise<string | null> | string | null;
|
|
2150
|
+
setItem(key: string, value: string): Promise<void> | void;
|
|
2151
|
+
removeItem(key: string): Promise<boolean | void> | boolean | void;
|
|
2152
|
+
keys(): Promise<string[]> | string[];
|
|
2153
|
+
}
|
|
2154
|
+
declare class MemoryStorageBackend implements IStorageBackend {
|
|
2155
|
+
private store;
|
|
2156
|
+
getItem(key: string): string | null;
|
|
2157
|
+
setItem(key: string, value: string): void;
|
|
2158
|
+
removeItem(key: string): boolean;
|
|
2159
|
+
keys(): string[];
|
|
2160
|
+
}
|
|
2161
|
+
declare class WebCryptoSecretStorageProvider implements ISecretStorageProvider {
|
|
2162
|
+
readonly providerType = "webcrypto-aes-gcm";
|
|
2163
|
+
private backend;
|
|
2164
|
+
private defaultPassphrase?;
|
|
2165
|
+
private hardwareBacked;
|
|
2166
|
+
constructor(options?: {
|
|
2167
|
+
backend?: IStorageBackend;
|
|
2168
|
+
defaultPassphrase?: string;
|
|
2169
|
+
hardwareBacked?: boolean;
|
|
2170
|
+
});
|
|
2171
|
+
isHardwareBacked(): boolean;
|
|
2172
|
+
isAvailable(): Promise<boolean>;
|
|
2173
|
+
private deriveKey;
|
|
2174
|
+
storeSecret(bundleHash: string, secret: string, options?: {
|
|
2175
|
+
label?: string;
|
|
2176
|
+
passphrase?: string;
|
|
2177
|
+
}): Promise<void>;
|
|
2178
|
+
retrieveSecret(bundleHash: string, options?: {
|
|
2179
|
+
passphrase?: string;
|
|
2180
|
+
}): Promise<string | null>;
|
|
2181
|
+
deleteSecret(bundleHash: string): Promise<boolean>;
|
|
2182
|
+
hasSecret(bundleHash: string): Promise<boolean>;
|
|
2183
|
+
listSecrets(): Promise<SecretStorageMetadata[]>;
|
|
2184
|
+
withSecret<T>(bundleHash: string, fn: (secret: string) => Promise<T> | T, options?: {
|
|
2185
|
+
passphrase?: string;
|
|
2186
|
+
}): Promise<T>;
|
|
2187
|
+
}
|
|
2188
|
+
|
|
2189
|
+
interface CreateSecretStorageOptions {
|
|
2190
|
+
type?: 'webcrypto' | 'memory';
|
|
2191
|
+
defaultPassphrase?: string;
|
|
2192
|
+
backend?: IStorageBackend;
|
|
2193
|
+
hardwareBacked?: boolean;
|
|
2194
|
+
}
|
|
2195
|
+
declare function createDefaultSecretStorage(options?: CreateSecretStorageOptions): ISecretStorageProvider;
|
|
2196
|
+
|
|
2197
|
+
declare function zeroizeBytes(buffer: Uint8Array | number[]): void;
|
|
2198
|
+
declare function withSecureBytes<T>(bytes: Uint8Array, fn: (bytes: Uint8Array) => Promise<T> | T): Promise<T>;
|
|
2199
|
+
declare function withSecureString<T>(secret: string, fn: (cleanSecret: string) => Promise<T> | T): Promise<T>;
|
|
2200
|
+
declare function constantTimeCompare(a: Uint8Array | string, b: Uint8Array | string): boolean;
|
|
2201
|
+
|
|
2202
|
+
declare const SDK_VERSION = "0.9.7";
|
|
2082
2203
|
declare const SDK_NAME = "KnishIO-Client-TS";
|
|
2083
2204
|
declare const COMPATIBLE_SERVER_VERSIONS: number[];
|
|
2084
2205
|
declare const SDK_INFO: {
|
|
2085
2206
|
readonly name: "KnishIO-Client-TS";
|
|
2086
|
-
readonly version: "0.9.
|
|
2207
|
+
readonly version: "0.9.7";
|
|
2087
2208
|
readonly description: "TypeScript SDK for Knish.IO post-blockchain distributed ledger";
|
|
2088
2209
|
readonly compatibleServerVersions: number[];
|
|
2089
2210
|
readonly features: readonly ["Post-quantum cryptography (XMSS, ML-KEM768)", "Cross-platform compatibility", "Type-safe APIs", "DAG-based transaction processing", "GraphQL integration", "Real-time subscriptions", "Cellular architecture support"];
|
|
@@ -2111,7 +2232,7 @@ declare const DevUtils: {
|
|
|
2111
2232
|
nodeVersion: string;
|
|
2112
2233
|
environment: string;
|
|
2113
2234
|
name: "KnishIO-Client-TS";
|
|
2114
|
-
version: "0.9.
|
|
2235
|
+
version: "0.9.7";
|
|
2115
2236
|
description: "TypeScript SDK for Knish.IO post-blockchain distributed ledger";
|
|
2116
2237
|
compatibleServerVersions: number[];
|
|
2117
2238
|
features: readonly ["Post-quantum cryptography (XMSS, ML-KEM768)", "Cross-platform compatibility", "Type-safe APIs", "DAG-based transaction processing", "GraphQL integration", "Real-time subscriptions", "Cellular architecture support"];
|
|
@@ -2138,7 +2259,7 @@ declare const KnishIO: {
|
|
|
2138
2259
|
SDK_VERSION: string;
|
|
2139
2260
|
SDK_INFO: {
|
|
2140
2261
|
readonly name: "KnishIO-Client-TS";
|
|
2141
|
-
readonly version: "0.9.
|
|
2262
|
+
readonly version: "0.9.7";
|
|
2142
2263
|
readonly description: "TypeScript SDK for Knish.IO post-blockchain distributed ledger";
|
|
2143
2264
|
readonly compatibleServerVersions: number[];
|
|
2144
2265
|
readonly features: readonly ["Post-quantum cryptography (XMSS, ML-KEM768)", "Cross-platform compatibility", "Type-safe APIs", "DAG-based transaction processing", "GraphQL integration", "Real-time subscriptions", "Cellular architecture support"];
|
|
@@ -2151,4 +2272,4 @@ declare const KnishIO: {
|
|
|
2151
2272
|
};
|
|
2152
2273
|
};
|
|
2153
2274
|
|
|
2154
|
-
export { Atom, AtomIndexException, type AtomIsotope, AtomMeta, type AtomParams, AtomsMissingException, type AuthParams, AuthToken, type BalanceQueryParams, type Base17Hash, BaseException, type BaseResponse, type BundleHash, type BundleHashOptions, COMPATIBLE_SERVER_VERSIONS, CRYPTO_CONSTANTS, type CellSlug, CheckMolecule, type CreateTokenParams, DevUtils, Dot, EXCEPTION_CODES, EXCEPTION_TYPES, EXTENDED_COMPATIBILITY_TEST_VECTORS, type EmbeddingStatusItem, ExceptionFactory, GraphQLClient, type GraphQLError, type GraphQLRequest, type GraphQLResponse, type HexString, InvalidResponseException, type KeyGenerationOptions, KnishIO, KnishIOClient, type KnishIOClientConfig, Meta$1 as Meta, type MetaData, type MetaId, type MetaQueryParams, type MetaType, type MolecularHash, MolecularHashMismatchException, Molecule, type MoleculeParams, Mutation, MutationAppendRequest, MutationCreateMeta, MutationCreateToken, MutationCreateWallet, type MutationOperation, MutationPeering, MutationProposeMolecule, MutationRequestAuthorization, MutationRequestTokens, MutationTransferTokens, PolicyMeta, type Position, type PositionGenerationOptions, Query, QueryAtom, QueryBalance, QueryBatch, QueryContinuId, QueryEmbeddingStatus, QueryMetaType, QueryMetaTypeViaAtom, type QueryOperation, QueryWalletBundle, QueryWalletList, type RequestTokensParams, Response, ResponseAppendRequest, ResponseAtom, ResponseBalance, ResponseContinuId, ResponseCreateMeta, ResponseCreateToken, ResponseCreateWallet, ResponseEmbeddingStatus, ResponseMetaType, ResponseMetaTypeViaAtom, ResponsePeering, ResponseProposeMolecule, ResponseRequestAuthorization, ResponseRequestTokens, ResponseTransferTokens, ResponseWalletBundle, ResponseWalletList, type SDKConfig, SDK_INFO, SDK_NAME, SDK_VERSION, type SHAKE256Options, type SecretGenerationOptions, SignatureMismatchException, type SignatureOptions, type TokenSlug, TokenUnit, TransferBalanceException, type TransferParams, type ValidationResult$1 as ValidationResult, type VerificationOptions, Wallet, type WalletAddress, WalletCredentialException, type WalletParams, type WalletQueryParams, base64ToHex, bufferToHexString, capitalize, charsetBaseConvert, chunkArray, chunkSubstr, configureSDK, convertToBase17, createBundleHash, createMolecularHash, createPosition, createTokenSlug, createWalletAddress, deepCloning, diff, enumerateMolecularHash, generateBatchId, generateBundleHash, generateOTSSignature, generatePosition, generateSecret, generateWalletAddress, generateWalletKey, getSDKConfig, hexStringToBuffer, hexToBase64, intersect, isAtomIsotope, isBundleHash, isHex, isHexString, isMolecularHash, isNumeric, isPosition, isWalletAddress, normalizeMolecularHash, randomString, runCompatibilityTests, runExtendedCompatibilityTests, shake256, toCamelCase, toSnakeCase, truncate, validateBundleHash, validateMolecularHashForSignature, validateOTSSignature, validatePosition, validateSecret, validateWalletAddress, verifyOTSSignature };
|
|
2275
|
+
export { Atom, AtomIndexException, type AtomIsotope, AtomMeta, type AtomParams, AtomsMissingException, type AuthParams, AuthToken, type BalanceQueryParams, type Base17Hash, BaseException, type BaseResponse, type BundleHash, type BundleHashOptions, COMPATIBLE_SERVER_VERSIONS, CRYPTO_CONSTANTS, type CellSlug, CheckMolecule, type CreateSecretStorageOptions, type CreateTokenParams, DevUtils, Dot, EXCEPTION_CODES, EXCEPTION_TYPES, EXTENDED_COMPATIBILITY_TEST_VECTORS, type EmbeddingStatusItem, type EncryptedSecretPayload, ExceptionFactory, GraphQLClient, type GraphQLError, type GraphQLRequest, type GraphQLResponse, type HexString, type ISecretStorageProvider, type IStorageBackend, InvalidResponseException, type KeyGenerationOptions, KnishIO, KnishIOClient, type KnishIOClientConfig, MemorySecretStorageProvider, MemoryStorageBackend, Meta$1 as Meta, type MetaData, type MetaId, type MetaQueryParams, type MetaType, type MolecularHash, MolecularHashMismatchException, Molecule, type MoleculeParams, Mutation, MutationAppendRequest, MutationCreateMeta, MutationCreateToken, MutationCreateWallet, type MutationOperation, MutationPeering, MutationProposeMolecule, MutationRequestAuthorization, MutationRequestTokens, MutationTransferTokens, PolicyMeta, type Position, type PositionGenerationOptions, Query, QueryAtom, QueryBalance, QueryBatch, QueryContinuId, QueryEmbeddingStatus, QueryMetaType, QueryMetaTypeViaAtom, type QueryOperation, QueryWalletBundle, QueryWalletList, type RequestTokensParams, Response, ResponseAppendRequest, ResponseAtom, ResponseBalance, ResponseContinuId, ResponseCreateMeta, ResponseCreateToken, ResponseCreateWallet, ResponseEmbeddingStatus, ResponseMetaType, ResponseMetaTypeViaAtom, ResponsePeering, ResponseProposeMolecule, ResponseRequestAuthorization, ResponseRequestTokens, ResponseTransferTokens, ResponseWalletBundle, ResponseWalletList, type SDKConfig, SDK_INFO, SDK_NAME, SDK_VERSION, type SHAKE256Options, type SecretGenerationOptions, SecretStorageException, type SecretStorageMetadata, SignatureMismatchException, type SignatureOptions, type TokenSlug, TokenUnit, TransferBalanceException, type TransferParams, type ValidationResult$1 as ValidationResult, type VerificationOptions, Wallet, type WalletAddress, WalletCredentialException, type WalletParams, type WalletQueryParams, WebCryptoSecretStorageProvider, base64ToHex, bufferToHexString, capitalize, charsetBaseConvert, chunkArray, chunkSubstr, configureSDK, constantTimeCompare, convertToBase17, createBundleHash, createDefaultSecretStorage, createMolecularHash, createPosition, createTokenSlug, createWalletAddress, deepCloning, diff, enumerateMolecularHash, generateBatchId, generateBundleHash, generateOTSSignature, generatePosition, generateSecret, generateWalletAddress, generateWalletKey, getSDKConfig, hexStringToBuffer, hexToBase64, intersect, isAtomIsotope, isBundleHash, isHex, isHexString, isMolecularHash, isNumeric, isPosition, isWalletAddress, normalizeMolecularHash, randomString, runCompatibilityTests, runExtendedCompatibilityTests, shake256, toCamelCase, toSnakeCase, truncate, validateBundleHash, validateMolecularHashForSignature, validateOTSSignature, validatePosition, validateSecret, validateWalletAddress, verifyOTSSignature, withSecureBytes, withSecureString, zeroizeBytes };
|
package/dist/index.d.ts
CHANGED
|
@@ -124,6 +124,42 @@ interface GraphQLClient$1 {
|
|
|
124
124
|
getUri(): string;
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
+
interface SecretStorageMetadata {
|
|
128
|
+
bundleHash: string;
|
|
129
|
+
label?: string;
|
|
130
|
+
createdAt: number;
|
|
131
|
+
hardwareBacked: boolean;
|
|
132
|
+
providerType: string;
|
|
133
|
+
}
|
|
134
|
+
interface EncryptedSecretPayload {
|
|
135
|
+
version: 1;
|
|
136
|
+
ciphertext: string;
|
|
137
|
+
iv: string;
|
|
138
|
+
salt: string;
|
|
139
|
+
tag?: string;
|
|
140
|
+
algorithm: 'AES-GCM' | 'AES-CBC';
|
|
141
|
+
iterations?: number;
|
|
142
|
+
metadata: SecretStorageMetadata;
|
|
143
|
+
}
|
|
144
|
+
interface ISecretStorageProvider {
|
|
145
|
+
readonly providerType: string;
|
|
146
|
+
isHardwareBacked(): boolean;
|
|
147
|
+
isAvailable(): Promise<boolean>;
|
|
148
|
+
storeSecret(bundleHash: string, secret: string, options?: {
|
|
149
|
+
label?: string;
|
|
150
|
+
passphrase?: string;
|
|
151
|
+
}): Promise<void>;
|
|
152
|
+
retrieveSecret(bundleHash: string, options?: {
|
|
153
|
+
passphrase?: string;
|
|
154
|
+
}): Promise<string | null>;
|
|
155
|
+
deleteSecret(bundleHash: string): Promise<boolean>;
|
|
156
|
+
hasSecret(bundleHash: string): Promise<boolean>;
|
|
157
|
+
listSecrets(): Promise<SecretStorageMetadata[]>;
|
|
158
|
+
withSecret<T>(bundleHash: string, fn: (secret: string) => Promise<T> | T, options?: {
|
|
159
|
+
passphrase?: string;
|
|
160
|
+
}): Promise<T>;
|
|
161
|
+
}
|
|
162
|
+
|
|
127
163
|
type WalletAddress = WalletAddressPattern & {
|
|
128
164
|
readonly __brand: 'WalletAddress';
|
|
129
165
|
};
|
|
@@ -1167,6 +1203,7 @@ declare class ResponseRequestAuthorization extends ResponseProposeMolecule {
|
|
|
1167
1203
|
declare class KnishIOClient {
|
|
1168
1204
|
private $__secret;
|
|
1169
1205
|
private $__bundle;
|
|
1206
|
+
private $__secretStorage;
|
|
1170
1207
|
private $__cellSlug;
|
|
1171
1208
|
private $__encrypt;
|
|
1172
1209
|
private $__uris;
|
|
@@ -1193,6 +1230,7 @@ declare class KnishIOClient {
|
|
|
1193
1230
|
serverSdkVersion?: number;
|
|
1194
1231
|
logging?: boolean;
|
|
1195
1232
|
defaultRequestPolicy?: RequestPolicy | null;
|
|
1233
|
+
secretStorage?: ISecretStorageProvider | null;
|
|
1196
1234
|
});
|
|
1197
1235
|
initialize({ uri, cellSlug, socket, client, serverSdkVersion, logging, defaultRequestPolicy }: {
|
|
1198
1236
|
uri: string | string[];
|
|
@@ -1222,6 +1260,11 @@ declare class KnishIOClient {
|
|
|
1222
1260
|
getCellSlug(): string | null;
|
|
1223
1261
|
hasSecret(): boolean;
|
|
1224
1262
|
getSecret(): string;
|
|
1263
|
+
setSecretStorage(storage: ISecretStorageProvider, bundleHash?: string): void;
|
|
1264
|
+
getSecretStorage(): ISecretStorageProvider | null;
|
|
1265
|
+
retrieveSecret(options?: {
|
|
1266
|
+
passphrase?: string;
|
|
1267
|
+
}): Promise<string | null>;
|
|
1225
1268
|
hasBundle(): boolean;
|
|
1226
1269
|
getBundle(): string;
|
|
1227
1270
|
setRemainderWallet(remainderWallet: Wallet): void;
|
|
@@ -1967,6 +2010,13 @@ declare class WalletCredentialException extends BaseException {
|
|
|
1967
2010
|
static bundleMismatch(expected: string, actual: string): WalletCredentialException;
|
|
1968
2011
|
}
|
|
1969
2012
|
|
|
2013
|
+
declare class SecretStorageException extends BaseException {
|
|
2014
|
+
constructor(message?: string, options?: BaseExceptionOptions);
|
|
2015
|
+
static notFound(bundleHash: string): SecretStorageException;
|
|
2016
|
+
static decryptionFailed(reason?: string): SecretStorageException;
|
|
2017
|
+
static unavailable(provider: string, reason?: string): SecretStorageException;
|
|
2018
|
+
}
|
|
2019
|
+
|
|
1970
2020
|
declare class InvalidResponseException extends BaseException {
|
|
1971
2021
|
constructor(message?: string, options?: BaseExceptionOptions);
|
|
1972
2022
|
static malformedJson(error: string): InvalidResponseException;
|
|
@@ -2078,12 +2128,83 @@ declare const EXCEPTION_CODES: {
|
|
|
2078
2128
|
readonly NETWORK_ERROR: "NETWORK_ERROR";
|
|
2079
2129
|
};
|
|
2080
2130
|
|
|
2081
|
-
declare
|
|
2131
|
+
declare class MemorySecretStorageProvider implements ISecretStorageProvider {
|
|
2132
|
+
readonly providerType = "memory";
|
|
2133
|
+
private secrets;
|
|
2134
|
+
isHardwareBacked(): boolean;
|
|
2135
|
+
isAvailable(): Promise<boolean>;
|
|
2136
|
+
storeSecret(bundleHash: string, secret: string, options?: {
|
|
2137
|
+
label?: string;
|
|
2138
|
+
passphrase?: string;
|
|
2139
|
+
}): Promise<void>;
|
|
2140
|
+
retrieveSecret(bundleHash: string): Promise<string | null>;
|
|
2141
|
+
deleteSecret(bundleHash: string): Promise<boolean>;
|
|
2142
|
+
hasSecret(bundleHash: string): Promise<boolean>;
|
|
2143
|
+
listSecrets(): Promise<SecretStorageMetadata[]>;
|
|
2144
|
+
withSecret<T>(bundleHash: string, fn: (secret: string) => Promise<T> | T): Promise<T>;
|
|
2145
|
+
clear(): void;
|
|
2146
|
+
}
|
|
2147
|
+
|
|
2148
|
+
interface IStorageBackend {
|
|
2149
|
+
getItem(key: string): Promise<string | null> | string | null;
|
|
2150
|
+
setItem(key: string, value: string): Promise<void> | void;
|
|
2151
|
+
removeItem(key: string): Promise<boolean | void> | boolean | void;
|
|
2152
|
+
keys(): Promise<string[]> | string[];
|
|
2153
|
+
}
|
|
2154
|
+
declare class MemoryStorageBackend implements IStorageBackend {
|
|
2155
|
+
private store;
|
|
2156
|
+
getItem(key: string): string | null;
|
|
2157
|
+
setItem(key: string, value: string): void;
|
|
2158
|
+
removeItem(key: string): boolean;
|
|
2159
|
+
keys(): string[];
|
|
2160
|
+
}
|
|
2161
|
+
declare class WebCryptoSecretStorageProvider implements ISecretStorageProvider {
|
|
2162
|
+
readonly providerType = "webcrypto-aes-gcm";
|
|
2163
|
+
private backend;
|
|
2164
|
+
private defaultPassphrase?;
|
|
2165
|
+
private hardwareBacked;
|
|
2166
|
+
constructor(options?: {
|
|
2167
|
+
backend?: IStorageBackend;
|
|
2168
|
+
defaultPassphrase?: string;
|
|
2169
|
+
hardwareBacked?: boolean;
|
|
2170
|
+
});
|
|
2171
|
+
isHardwareBacked(): boolean;
|
|
2172
|
+
isAvailable(): Promise<boolean>;
|
|
2173
|
+
private deriveKey;
|
|
2174
|
+
storeSecret(bundleHash: string, secret: string, options?: {
|
|
2175
|
+
label?: string;
|
|
2176
|
+
passphrase?: string;
|
|
2177
|
+
}): Promise<void>;
|
|
2178
|
+
retrieveSecret(bundleHash: string, options?: {
|
|
2179
|
+
passphrase?: string;
|
|
2180
|
+
}): Promise<string | null>;
|
|
2181
|
+
deleteSecret(bundleHash: string): Promise<boolean>;
|
|
2182
|
+
hasSecret(bundleHash: string): Promise<boolean>;
|
|
2183
|
+
listSecrets(): Promise<SecretStorageMetadata[]>;
|
|
2184
|
+
withSecret<T>(bundleHash: string, fn: (secret: string) => Promise<T> | T, options?: {
|
|
2185
|
+
passphrase?: string;
|
|
2186
|
+
}): Promise<T>;
|
|
2187
|
+
}
|
|
2188
|
+
|
|
2189
|
+
interface CreateSecretStorageOptions {
|
|
2190
|
+
type?: 'webcrypto' | 'memory';
|
|
2191
|
+
defaultPassphrase?: string;
|
|
2192
|
+
backend?: IStorageBackend;
|
|
2193
|
+
hardwareBacked?: boolean;
|
|
2194
|
+
}
|
|
2195
|
+
declare function createDefaultSecretStorage(options?: CreateSecretStorageOptions): ISecretStorageProvider;
|
|
2196
|
+
|
|
2197
|
+
declare function zeroizeBytes(buffer: Uint8Array | number[]): void;
|
|
2198
|
+
declare function withSecureBytes<T>(bytes: Uint8Array, fn: (bytes: Uint8Array) => Promise<T> | T): Promise<T>;
|
|
2199
|
+
declare function withSecureString<T>(secret: string, fn: (cleanSecret: string) => Promise<T> | T): Promise<T>;
|
|
2200
|
+
declare function constantTimeCompare(a: Uint8Array | string, b: Uint8Array | string): boolean;
|
|
2201
|
+
|
|
2202
|
+
declare const SDK_VERSION = "0.9.7";
|
|
2082
2203
|
declare const SDK_NAME = "KnishIO-Client-TS";
|
|
2083
2204
|
declare const COMPATIBLE_SERVER_VERSIONS: number[];
|
|
2084
2205
|
declare const SDK_INFO: {
|
|
2085
2206
|
readonly name: "KnishIO-Client-TS";
|
|
2086
|
-
readonly version: "0.9.
|
|
2207
|
+
readonly version: "0.9.7";
|
|
2087
2208
|
readonly description: "TypeScript SDK for Knish.IO post-blockchain distributed ledger";
|
|
2088
2209
|
readonly compatibleServerVersions: number[];
|
|
2089
2210
|
readonly features: readonly ["Post-quantum cryptography (XMSS, ML-KEM768)", "Cross-platform compatibility", "Type-safe APIs", "DAG-based transaction processing", "GraphQL integration", "Real-time subscriptions", "Cellular architecture support"];
|
|
@@ -2111,7 +2232,7 @@ declare const DevUtils: {
|
|
|
2111
2232
|
nodeVersion: string;
|
|
2112
2233
|
environment: string;
|
|
2113
2234
|
name: "KnishIO-Client-TS";
|
|
2114
|
-
version: "0.9.
|
|
2235
|
+
version: "0.9.7";
|
|
2115
2236
|
description: "TypeScript SDK for Knish.IO post-blockchain distributed ledger";
|
|
2116
2237
|
compatibleServerVersions: number[];
|
|
2117
2238
|
features: readonly ["Post-quantum cryptography (XMSS, ML-KEM768)", "Cross-platform compatibility", "Type-safe APIs", "DAG-based transaction processing", "GraphQL integration", "Real-time subscriptions", "Cellular architecture support"];
|
|
@@ -2138,7 +2259,7 @@ declare const KnishIO: {
|
|
|
2138
2259
|
SDK_VERSION: string;
|
|
2139
2260
|
SDK_INFO: {
|
|
2140
2261
|
readonly name: "KnishIO-Client-TS";
|
|
2141
|
-
readonly version: "0.9.
|
|
2262
|
+
readonly version: "0.9.7";
|
|
2142
2263
|
readonly description: "TypeScript SDK for Knish.IO post-blockchain distributed ledger";
|
|
2143
2264
|
readonly compatibleServerVersions: number[];
|
|
2144
2265
|
readonly features: readonly ["Post-quantum cryptography (XMSS, ML-KEM768)", "Cross-platform compatibility", "Type-safe APIs", "DAG-based transaction processing", "GraphQL integration", "Real-time subscriptions", "Cellular architecture support"];
|
|
@@ -2151,4 +2272,4 @@ declare const KnishIO: {
|
|
|
2151
2272
|
};
|
|
2152
2273
|
};
|
|
2153
2274
|
|
|
2154
|
-
export { Atom, AtomIndexException, type AtomIsotope, AtomMeta, type AtomParams, AtomsMissingException, type AuthParams, AuthToken, type BalanceQueryParams, type Base17Hash, BaseException, type BaseResponse, type BundleHash, type BundleHashOptions, COMPATIBLE_SERVER_VERSIONS, CRYPTO_CONSTANTS, type CellSlug, CheckMolecule, type CreateTokenParams, DevUtils, Dot, EXCEPTION_CODES, EXCEPTION_TYPES, EXTENDED_COMPATIBILITY_TEST_VECTORS, type EmbeddingStatusItem, ExceptionFactory, GraphQLClient, type GraphQLError, type GraphQLRequest, type GraphQLResponse, type HexString, InvalidResponseException, type KeyGenerationOptions, KnishIO, KnishIOClient, type KnishIOClientConfig, Meta$1 as Meta, type MetaData, type MetaId, type MetaQueryParams, type MetaType, type MolecularHash, MolecularHashMismatchException, Molecule, type MoleculeParams, Mutation, MutationAppendRequest, MutationCreateMeta, MutationCreateToken, MutationCreateWallet, type MutationOperation, MutationPeering, MutationProposeMolecule, MutationRequestAuthorization, MutationRequestTokens, MutationTransferTokens, PolicyMeta, type Position, type PositionGenerationOptions, Query, QueryAtom, QueryBalance, QueryBatch, QueryContinuId, QueryEmbeddingStatus, QueryMetaType, QueryMetaTypeViaAtom, type QueryOperation, QueryWalletBundle, QueryWalletList, type RequestTokensParams, Response, ResponseAppendRequest, ResponseAtom, ResponseBalance, ResponseContinuId, ResponseCreateMeta, ResponseCreateToken, ResponseCreateWallet, ResponseEmbeddingStatus, ResponseMetaType, ResponseMetaTypeViaAtom, ResponsePeering, ResponseProposeMolecule, ResponseRequestAuthorization, ResponseRequestTokens, ResponseTransferTokens, ResponseWalletBundle, ResponseWalletList, type SDKConfig, SDK_INFO, SDK_NAME, SDK_VERSION, type SHAKE256Options, type SecretGenerationOptions, SignatureMismatchException, type SignatureOptions, type TokenSlug, TokenUnit, TransferBalanceException, type TransferParams, type ValidationResult$1 as ValidationResult, type VerificationOptions, Wallet, type WalletAddress, WalletCredentialException, type WalletParams, type WalletQueryParams, base64ToHex, bufferToHexString, capitalize, charsetBaseConvert, chunkArray, chunkSubstr, configureSDK, convertToBase17, createBundleHash, createMolecularHash, createPosition, createTokenSlug, createWalletAddress, deepCloning, diff, enumerateMolecularHash, generateBatchId, generateBundleHash, generateOTSSignature, generatePosition, generateSecret, generateWalletAddress, generateWalletKey, getSDKConfig, hexStringToBuffer, hexToBase64, intersect, isAtomIsotope, isBundleHash, isHex, isHexString, isMolecularHash, isNumeric, isPosition, isWalletAddress, normalizeMolecularHash, randomString, runCompatibilityTests, runExtendedCompatibilityTests, shake256, toCamelCase, toSnakeCase, truncate, validateBundleHash, validateMolecularHashForSignature, validateOTSSignature, validatePosition, validateSecret, validateWalletAddress, verifyOTSSignature };
|
|
2275
|
+
export { Atom, AtomIndexException, type AtomIsotope, AtomMeta, type AtomParams, AtomsMissingException, type AuthParams, AuthToken, type BalanceQueryParams, type Base17Hash, BaseException, type BaseResponse, type BundleHash, type BundleHashOptions, COMPATIBLE_SERVER_VERSIONS, CRYPTO_CONSTANTS, type CellSlug, CheckMolecule, type CreateSecretStorageOptions, type CreateTokenParams, DevUtils, Dot, EXCEPTION_CODES, EXCEPTION_TYPES, EXTENDED_COMPATIBILITY_TEST_VECTORS, type EmbeddingStatusItem, type EncryptedSecretPayload, ExceptionFactory, GraphQLClient, type GraphQLError, type GraphQLRequest, type GraphQLResponse, type HexString, type ISecretStorageProvider, type IStorageBackend, InvalidResponseException, type KeyGenerationOptions, KnishIO, KnishIOClient, type KnishIOClientConfig, MemorySecretStorageProvider, MemoryStorageBackend, Meta$1 as Meta, type MetaData, type MetaId, type MetaQueryParams, type MetaType, type MolecularHash, MolecularHashMismatchException, Molecule, type MoleculeParams, Mutation, MutationAppendRequest, MutationCreateMeta, MutationCreateToken, MutationCreateWallet, type MutationOperation, MutationPeering, MutationProposeMolecule, MutationRequestAuthorization, MutationRequestTokens, MutationTransferTokens, PolicyMeta, type Position, type PositionGenerationOptions, Query, QueryAtom, QueryBalance, QueryBatch, QueryContinuId, QueryEmbeddingStatus, QueryMetaType, QueryMetaTypeViaAtom, type QueryOperation, QueryWalletBundle, QueryWalletList, type RequestTokensParams, Response, ResponseAppendRequest, ResponseAtom, ResponseBalance, ResponseContinuId, ResponseCreateMeta, ResponseCreateToken, ResponseCreateWallet, ResponseEmbeddingStatus, ResponseMetaType, ResponseMetaTypeViaAtom, ResponsePeering, ResponseProposeMolecule, ResponseRequestAuthorization, ResponseRequestTokens, ResponseTransferTokens, ResponseWalletBundle, ResponseWalletList, type SDKConfig, SDK_INFO, SDK_NAME, SDK_VERSION, type SHAKE256Options, type SecretGenerationOptions, SecretStorageException, type SecretStorageMetadata, SignatureMismatchException, type SignatureOptions, type TokenSlug, TokenUnit, TransferBalanceException, type TransferParams, type ValidationResult$1 as ValidationResult, type VerificationOptions, Wallet, type WalletAddress, WalletCredentialException, type WalletParams, type WalletQueryParams, WebCryptoSecretStorageProvider, base64ToHex, bufferToHexString, capitalize, charsetBaseConvert, chunkArray, chunkSubstr, configureSDK, constantTimeCompare, convertToBase17, createBundleHash, createDefaultSecretStorage, createMolecularHash, createPosition, createTokenSlug, createWalletAddress, deepCloning, diff, enumerateMolecularHash, generateBatchId, generateBundleHash, generateOTSSignature, generatePosition, generateSecret, generateWalletAddress, generateWalletKey, getSDKConfig, hexStringToBuffer, hexToBase64, intersect, isAtomIsotope, isBundleHash, isHex, isHexString, isMolecularHash, isNumeric, isPosition, isWalletAddress, normalizeMolecularHash, randomString, runCompatibilityTests, runExtendedCompatibilityTests, shake256, toCamelCase, toSnakeCase, truncate, validateBundleHash, validateMolecularHashForSignature, validateOTSSignature, validatePosition, validateSecret, validateWalletAddress, verifyOTSSignature, withSecureBytes, withSecureString, zeroizeBytes };
|