@keetanetwork/keetanet-client 0.14.13 → 0.16.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/client/builder.d.ts +29 -3
- package/client/index-browser.d.ts +24 -6
- package/client/index-browser.js +3426 -2704
- package/client/index.d.ts +24 -6
- package/client/index.js +1107 -501
- package/config/index.d.ts +3 -0
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/KeetaNetSDK.Client.html +6 -5
- package/docs/classes/KeetaNetSDK.Referenced.Account.html +13 -13
- package/docs/classes/KeetaNetSDK.Referenced.BaseSet.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.BaseVoteBuilder.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.Block.html +33 -30
- package/docs/classes/KeetaNetSDK.Referenced.BlockBuilder.html +2 -1
- package/docs/classes/KeetaNetSDK.Referenced.BlockHash.html +3 -2
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperation.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationCREATE_IDENTIFIER.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationMANAGE_CERTIFICATE.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationMODIFY_PERMISSIONS.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationRECEIVE.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationSEND.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationSET_INFO.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationSET_REP.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationTOKEN_ADMIN_MODIFY_BALANCE.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationTOKEN_ADMIN_SUPPLY.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.Certificate.html +11 -5
- package/docs/classes/KeetaNetSDK.Referenced.CertificateBundle.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.CertificateHash.html +3 -2
- package/docs/classes/KeetaNetSDK.Referenced.ECDSAKeyPair.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1KeyPair.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1PrivateKey.html +4 -2
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1PublicKey.html +4 -2
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1Signature.html +4 -2
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1KeyPair.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1PrivateKey.html +4 -2
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1PublicKey.html +4 -2
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1Signature.html +4 -2
- package/docs/classes/KeetaNetSDK.Referenced.ED25519KeyPair.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ED25519PrivateKey.html +4 -2
- package/docs/classes/KeetaNetSDK.Referenced.ED25519PublicKey.html +4 -2
- package/docs/classes/KeetaNetSDK.Referenced.ED25519Signature.html +4 -2
- package/docs/classes/KeetaNetSDK.Referenced.ExternalKeyPair.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ExternalSet.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.IdempotentKey.html +3 -2
- package/docs/classes/KeetaNetSDK.Referenced.IdentifierKey.html +4 -2
- package/docs/classes/KeetaNetSDK.Referenced.IdentifierKeyPair.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.KeetaNetError.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.KeetaNetErrorBase.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.KeetaNetLedgerError.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.KeetaNetLedgerIdempotentKeyError.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.KeetaNetLedgerVoteError.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.KeyInterface.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.KeyStorage.html +4 -2
- package/docs/classes/KeetaNetSDK.Referenced.Log.html +15 -3
- package/docs/classes/KeetaNetSDK.Referenced.LogTargetConsole.html +3 -2
- package/docs/classes/KeetaNetSDK.Referenced.Node.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.P2PSwitch.html +4 -2
- package/docs/classes/KeetaNetSDK.Referenced.PendingAccount.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.PermissionSetHolder.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.PossiblyExpiredVote.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.PossiblyUnsignedBlock.html +38 -0
- package/docs/classes/KeetaNetSDK.Referenced.SignatureStorage.html +4 -2
- package/docs/classes/KeetaNetSDK.Referenced.Stats.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.StatsPending.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.UnsignedBlock.html +42 -0
- package/docs/classes/KeetaNetSDK.Referenced.UserClientBuilder.html +13 -1
- package/docs/classes/KeetaNetSDK.Referenced.Vote.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.VoteBlockBundle.html +11 -9
- package/docs/classes/KeetaNetSDK.Referenced.VoteBlockHash.html +4 -2
- package/docs/classes/KeetaNetSDK.Referenced.VoteBuilder.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.VoteHash.html +4 -2
- package/docs/classes/KeetaNetSDK.Referenced.VoteLikeBase.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.VoteQuote.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.VoteQuoteBuilder.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.VoteStaple.html +10 -8
- package/docs/classes/KeetaNetSDK.Referenced.VoteStapleHash.html +4 -2
- package/docs/classes/KeetaNetSDK.Referenced.src_lib_utils_buffer.BufferStorage.html +4 -2
- package/docs/classes/KeetaNetSDK.Referenced.src_lib_utils_certificate.CertificateBuilder.html +4 -2
- package/docs/classes/KeetaNetSDK.UserClient.html +19 -11
- package/docs/documents/GETTING-STARTED.html +2 -2
- package/docs/enums/KeetaNetSDK.Referenced.AdjustMethod.html +4 -4
- package/docs/enums/KeetaNetSDK.Referenced.OperationType.html +10 -10
- package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_buffer.DecodeBase32.html +2 -2
- package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_buffer.DecodeBase64URL.html +1 -0
- package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_buffer.EncodeBase64URL.html +1 -0
- package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_conversion.toJSONSerializable.html +1 -1
- package/docs/hierarchy.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.ACLEntry.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.ACLUpdate.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.ASN1ExplicitContextTag.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.ASN1ImplicitContextTag.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.ASN1Object.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BaseExternalKeyPairFunctions.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BaseGenerationConfig.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BaseIdentifierCreateArguments.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperation.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationCREATE_IDENTIFIER.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationMANAGE_CERTIFICATE.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationMODIFY_PERMISSIONS.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationRECEIVE.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationSEND.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationSET_INFO.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationSET_REP.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationTOKEN_ADMIN_MODIFY_BALANCE.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationTOKEN_ADMIN_SUPPLY.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockOperationValidateContext.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockV1Canonical.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockV2Canonical.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.Constructor.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.DisposableTimingHandle.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.ExternalKeyPairFunctionsNoEncryption.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.ExternalKeyPairFunctionsSupportsEncryption.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.IdentifierCreateRequest.html +3 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.InitialConfigSupply.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.InstanceSet.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.KVGenericOptionsType.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.KVSetOptionsType.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.LogTarget.html +3 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.ModifyTokenBalanceEntry.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.MultiSigIdentifierCreateArguments.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.MultisigConfig.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.NodeConfig.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.NumericValueEntry.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.P2PPeerBase.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.P2PPeerListener.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.P2PPeerRepBase.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.PendingOperations.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.PendingOperationsJSON.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.PublicKeyStorage.html +3 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.PublishOptions.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.RequestTokenReceiveEntry.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.TokenNumericEntry.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.UserClientConfig.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.UserClientOptions.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.VoteBundleConstructor.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.VoteStapleJSON.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.WithIsInstance.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.src_config.ValidationConfig.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1BitString.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1Date.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1OID.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1Set.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1String.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1Struct.html +1 -1
- package/docs/modules/KeetaNetSDK.Referenced.html +1 -1
- package/docs/modules/KeetaNetSDK.Referenced.src_lib_utils_buffer.html +1 -1
- package/docs/modules/KeetaNetSDK.Referenced.src_lib_utils_certificate.html +1 -1
- package/docs/types/KeetaNetSDK.Referenced.BlockJSONOptionalSigned.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.BlockV1JSONOptionalSigned.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.BlockV2JSONOptionalSigned.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.CertificateUpdate.html +1 -1
- package/docs/types/KeetaNetSDK.Referenced.IsTuple.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.JSONDepthLimit.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.KeyUsage.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.KeyUsageBits.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.LogTargetConsoleConfig.html +3 -2
- package/docs/types/KeetaNetSDK.Referenced.MultisigSignerFieldJSON.html +1 -1
- package/docs/types/KeetaNetSDK.Referenced.VoteOptions.html +7 -3
- package/docs/types/KeetaNetSDK.Referenced.VoteStapleInputs.html +2 -0
- package/docs/types/KeetaNetSDK.Referenced.VoteStapleOptions.html +9 -0
- package/docs/types/KeetaNetSDK.Referenced.src_config.NetworkConfig.html +1 -1
- package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_certificate.CertificateBundleJSONOutput.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_certificate.CertificateJSONOutput.html +1 -1
- package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_conversion.ToJSONSerializable.html +1 -1
- package/docs/variables/KeetaNetSDK.Referenced.BlockOperationASN1Schema.html +2 -2
- package/docs/variables/KeetaNetSDK.Referenced.allFullErrorCodes.html +1 -1
- package/docs/variables/KeetaNetSDK.Referenced.keyUsageBits.html +1 -0
- package/lib/block/index.d.ts +341 -46
- package/lib/block/operations.d.ts +14 -21
- package/lib/error/block.d.ts +2 -2
- package/lib/error/index.d.ts +1 -1
- package/lib/ledger/common.d.ts +3 -0
- package/lib/ledger/db_spanner_helper.d.ts +1 -1
- package/lib/log/common.d.ts +3 -0
- package/lib/log/index.d.ts +20 -0
- package/lib/log/internal.d.ts +22 -0
- package/lib/log/target_console.d.ts +6 -0
- package/lib/log/target_gcp.d.ts +6 -0
- package/lib/log/target_gcp.js +259 -77
- package/lib/log/target_https.d.ts +28 -0
- package/lib/log/target_https.js +6055 -0
- package/lib/p2p.d.ts +6 -2
- package/lib/utils/buffer.d.ts +8 -2
- package/lib/utils/certificate.d.ts +41 -25
- package/lib/utils/conversion.d.ts +8 -4
- package/lib/utils/external-keys/passkey-prf.d.ts +156 -0
- package/lib/utils/external-keys/passkey-prf.js +391 -0
- package/lib/vote.d.ts +230 -35
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/version.d.ts +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationMANAGE_CERTIFICATESerializable.html +0 -5
- package/docs/types/KeetaNetSDK.Referenced.ExportedJSONOperation.html +0 -1
- package/docs/types/KeetaNetSDK.Referenced.MultisigSignerField.html +0 -1
package/lib/p2p.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import type { JSONSerializable, JSONSerializableObject } from './utils/conversio
|
|
|
6
6
|
import type { DistributiveOmit } from './utils/helper';
|
|
7
7
|
import type { KVStorageProvider } from './kv';
|
|
8
8
|
import type { Representative } from '../config';
|
|
9
|
+
import { VoteStaple } from './vote';
|
|
9
10
|
/**
|
|
10
11
|
* Peer to Peer connection configuration
|
|
11
12
|
*/
|
|
@@ -95,7 +96,7 @@ interface P2PPeerRepBase extends P2PPeerBase {
|
|
|
95
96
|
/**
|
|
96
97
|
* Peering information for a Representative
|
|
97
98
|
*/
|
|
98
|
-
type P2PPeerRep = P2PPeerRepBase & ({
|
|
99
|
+
export type P2PPeerRep = P2PPeerRepBase & ({
|
|
99
100
|
/**
|
|
100
101
|
* Certificate from this peer which confirms its endpoints
|
|
101
102
|
*/
|
|
@@ -327,9 +328,12 @@ export declare class P2PSwitch {
|
|
|
327
328
|
*/
|
|
328
329
|
sendMessage(to: P2PConnection | Account | P2PPeer | null, id: string, type: string, data: any, ttl?: number, exclude?: (string | P2PConnection)[], skipConnectToPeers?: boolean): Promise<boolean>;
|
|
329
330
|
/**
|
|
331
|
+
* Check if any registered filter matches the VoteStaple's touched accounts.
|
|
332
|
+
* Uses the VoteStaple's touchedAccounts getter which may be pre-computed via trustedValues.
|
|
333
|
+
*
|
|
330
334
|
* TODO - make this private after refactoring websockets to handle higher load
|
|
331
335
|
* https://github.com/KeetaNetwork/node/issues/785
|
|
332
336
|
*/
|
|
333
|
-
haveAnyFilter(
|
|
337
|
+
haveAnyFilter(voteStaple: VoteStaple): Promise<boolean>;
|
|
334
338
|
}
|
|
335
339
|
export default P2PSwitch;
|
package/lib/utils/buffer.d.ts
CHANGED
|
@@ -3,13 +3,15 @@ import zlib from 'zlib';
|
|
|
3
3
|
/**
|
|
4
4
|
* RFC 4648 Base32 Decoder
|
|
5
5
|
*/
|
|
6
|
-
export declare function DecodeBase32(data: string, length
|
|
6
|
+
export declare function DecodeBase32(data: string, length?: number): ArrayBuffer;
|
|
7
7
|
/**
|
|
8
8
|
* RFC 4648 Base32 Encoder
|
|
9
9
|
*/
|
|
10
10
|
export declare function EncodeBase32(data: ArrayBuffer): string;
|
|
11
11
|
export declare function DecodeBase64(data: string): ArrayBuffer;
|
|
12
|
+
export declare function DecodeBase64URL(data: string): ArrayBuffer;
|
|
12
13
|
export declare function EncodeBase64(data: ArrayBuffer): string;
|
|
14
|
+
export declare function EncodeBase64URL(data: ArrayBuffer): string;
|
|
13
15
|
export declare function ZlibInflate(data: ArrayBuffer, options?: zlib.ZlibOptions): ArrayBuffer;
|
|
14
16
|
export declare function ZlibDeflate(data: ArrayBuffer, options?: zlib.ZlibOptions): ArrayBuffer;
|
|
15
17
|
export declare function ZlibInflateAsync(data: ArrayBuffer, options?: zlib.ZlibOptions): Promise<ArrayBuffer>;
|
|
@@ -18,11 +20,15 @@ export declare class BufferStorage {
|
|
|
18
20
|
#private;
|
|
19
21
|
readonly storageKind: string;
|
|
20
22
|
static isInstance: (obj: any, strict?: boolean) => obj is BufferStorage;
|
|
21
|
-
|
|
23
|
+
static decodeKey(key: ArrayBuffer | Buffer | string, length?: number): ArrayBuffer;
|
|
24
|
+
static decodeKey(key: bigint, length: number): ArrayBuffer;
|
|
25
|
+
static decodeKey(key: bigint | ArrayBuffer | Buffer | string, length?: number): ArrayBuffer;
|
|
26
|
+
constructor(key: bigint | ArrayBuffer | Buffer | string, length: number);
|
|
22
27
|
get(): ArrayBuffer;
|
|
23
28
|
get length(): number;
|
|
24
29
|
getBuffer(): Buffer;
|
|
25
30
|
toString(encoding?: 'hex' | 'base32' | 'base64'): string;
|
|
31
|
+
toJSON(): string;
|
|
26
32
|
toBigInt(): bigint;
|
|
27
33
|
compare(compareWith: typeof this | undefined | null): boolean;
|
|
28
34
|
compareHexString(compareWith: BufferStorage | string | undefined | null): boolean;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as ASN1 from './asn1';
|
|
2
|
-
import Account
|
|
2
|
+
import Account from '../account';
|
|
3
3
|
import * as HashLib from './hash';
|
|
4
4
|
import { BufferStorage } from './buffer';
|
|
5
|
-
import type
|
|
5
|
+
import { type ToJSONSerializableOptions } from './conversion';
|
|
6
6
|
/**
|
|
7
7
|
* De-normalized mapped Certificate Schema, for use in type annotations since
|
|
8
8
|
* we do not want to expose such a complex type
|
|
@@ -147,6 +147,10 @@ export declare class CertificateBuilder {
|
|
|
147
147
|
* Convert a KeetaNet Account to a Key ID (for Subject Key Identifier)
|
|
148
148
|
*/
|
|
149
149
|
private accountToKeyId;
|
|
150
|
+
/**
|
|
151
|
+
* Set the CA path length
|
|
152
|
+
*/
|
|
153
|
+
protected setCAPathLen(pathLen: bigint | undefined): void;
|
|
150
154
|
/**
|
|
151
155
|
* Produce the extensions to include in this certificate
|
|
152
156
|
*/
|
|
@@ -211,10 +215,11 @@ export declare class CertificateHash extends BufferStorage {
|
|
|
211
215
|
toJSON(): CertificateHashString;
|
|
212
216
|
toString(): CertificateHashString;
|
|
213
217
|
}
|
|
218
|
+
export type CertificateBundleJSONOutput = ReturnType<CertificateBundle['toJSON']>;
|
|
214
219
|
export declare class CertificateBundle {
|
|
215
220
|
#private;
|
|
216
221
|
static isInstance: (obj: any, strict?: boolean) => obj is CertificateBundle;
|
|
217
|
-
constructor(input: CertificateBundle | Certificate[] | ArrayBuffer | Buffer | string | (ConstructorParameters<typeof Certificate>[0])[] | Set<Certificate>);
|
|
222
|
+
constructor(input: CertificateBundle | Certificate[] | ArrayBuffer | Buffer | string | CertificateBundleJSONOutput | (ConstructorParameters<typeof Certificate>[0])[] | Set<Certificate>);
|
|
218
223
|
get bundleSize(): number;
|
|
219
224
|
getDER(): ArrayBuffer;
|
|
220
225
|
getDERBuffer(): Buffer;
|
|
@@ -223,7 +228,12 @@ export declare class CertificateBundle {
|
|
|
223
228
|
certificates: string[];
|
|
224
229
|
};
|
|
225
230
|
}
|
|
226
|
-
|
|
231
|
+
declare const keyUsageBits: readonly ["digitalSignature", "nonRepudiation", "keyEncipherment", "dataEncipherment", "keyAgreement", "keyCertSign", "cRLSign", "encipherOnly", "decipherOnly"];
|
|
232
|
+
type KeyUsageBits = typeof keyUsageBits[number];
|
|
233
|
+
type KeyUsage = {
|
|
234
|
+
[P in KeyUsageBits]?: boolean;
|
|
235
|
+
};
|
|
236
|
+
export type CertificateJSONOutput = ReturnType<Certificate['toJSON']>;
|
|
227
237
|
export declare class Certificate {
|
|
228
238
|
#private;
|
|
229
239
|
/**
|
|
@@ -296,6 +306,10 @@ export declare class Certificate {
|
|
|
296
306
|
ca: boolean,
|
|
297
307
|
pathLenConstraint?: bigint
|
|
298
308
|
];
|
|
309
|
+
/**
|
|
310
|
+
* Defines the purpose of the key
|
|
311
|
+
*/
|
|
312
|
+
keyUsage?: KeyUsage;
|
|
299
313
|
/**
|
|
300
314
|
* Subject Key Identifier
|
|
301
315
|
*/
|
|
@@ -325,7 +339,7 @@ export declare class Certificate {
|
|
|
325
339
|
* Is a certificate object?
|
|
326
340
|
*/
|
|
327
341
|
static isCertificate(value: unknown): value is Certificate;
|
|
328
|
-
constructor(input: Certificate | ArrayBuffer | Buffer | string, options?: CertificateOptions);
|
|
342
|
+
constructor(input: Certificate | CertificateJSONOutput | ArrayBuffer | Buffer | string, options?: CertificateOptions);
|
|
329
343
|
/**
|
|
330
344
|
* Finalize construction of the certificate -- if this method is
|
|
331
345
|
* replaced in a subclass, remember to call it at the end of the
|
|
@@ -352,6 +366,15 @@ export declare class Certificate {
|
|
|
352
366
|
* Verifies that the certificate is was signed by the given account or certificate
|
|
353
367
|
*/
|
|
354
368
|
verify(account: Account | Certificate): boolean;
|
|
369
|
+
/**
|
|
370
|
+
* Verify that a given chain meets the depth requirements
|
|
371
|
+
*/
|
|
372
|
+
protected static verifyChainDepth(chain: Certificate[]): {
|
|
373
|
+
valid: true;
|
|
374
|
+
} | {
|
|
375
|
+
valid: false;
|
|
376
|
+
reason: string;
|
|
377
|
+
};
|
|
355
378
|
/**
|
|
356
379
|
* Asserts provided certificates can construct a valid graph with no loops or orphans, and that all provided certificates can reach the root, or current certificate
|
|
357
380
|
* @param certificates Additional intermediate certificates to verify
|
|
@@ -360,6 +383,7 @@ export declare class Certificate {
|
|
|
360
383
|
/**
|
|
361
384
|
* Verify against a given certificate store
|
|
362
385
|
*/
|
|
386
|
+
verifyChain(store: NonNullable<CertificateOptions['store']>): Certificate[] | null;
|
|
363
387
|
verifyChain(store: NonNullable<CertificateOptions['store']>, _ignore_seenCerts?: Set<Certificate>): Certificate[] | null;
|
|
364
388
|
/**
|
|
365
389
|
* Check if the certificate is valid at a given moment
|
|
@@ -438,31 +462,23 @@ export declare class Certificate {
|
|
|
438
462
|
* Get a JSON representation of the certificate
|
|
439
463
|
*/
|
|
440
464
|
toJSON(options?: ToJSONSerializableOptions, includeChain?: boolean): {
|
|
441
|
-
$binary?: string;
|
|
442
|
-
$chain?:
|
|
443
|
-
serial:
|
|
444
|
-
notBefore:
|
|
445
|
-
notAfter:
|
|
465
|
+
$binary?: string | undefined;
|
|
466
|
+
$chain?: undefined;
|
|
467
|
+
serial: string;
|
|
468
|
+
notBefore: string;
|
|
469
|
+
notAfter: string;
|
|
446
470
|
subject: string;
|
|
447
471
|
issuer: string;
|
|
448
|
-
subjectPublicKey:
|
|
472
|
+
subjectPublicKey: import("../account").Secp256K1PublicKeyString | import("../account").Secp256R1PublicKeyString | import("../account").ED25519PublicKeyString;
|
|
449
473
|
baseExtensions: {
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
basicConstraints?: [ca: boolean, pathLenConstraint?: bigint];
|
|
454
|
-
/**
|
|
455
|
-
* Subject Key Identifier
|
|
456
|
-
*/
|
|
457
|
-
subjectKeyIdentifier?: Buffer;
|
|
458
|
-
/**
|
|
459
|
-
* Authority Key Identifier
|
|
460
|
-
*/
|
|
474
|
+
basicConstraints?: [ca: boolean, pathLenConstraint?: string | undefined] | undefined;
|
|
475
|
+
keyUsage?: KeyUsage | undefined;
|
|
476
|
+
subjectKeyIdentifier?: string | undefined;
|
|
461
477
|
authorityKeyIdentifier?: {
|
|
462
478
|
type: "context";
|
|
463
479
|
value: 0;
|
|
464
|
-
contains:
|
|
465
|
-
};
|
|
480
|
+
contains: string;
|
|
481
|
+
} | undefined;
|
|
466
482
|
} | undefined;
|
|
467
483
|
subjectDN: {
|
|
468
484
|
name: string;
|
|
@@ -472,7 +488,7 @@ export declare class Certificate {
|
|
|
472
488
|
name: string;
|
|
473
489
|
value: string;
|
|
474
490
|
}[];
|
|
475
|
-
$hash:
|
|
491
|
+
$hash: CertificateHashString;
|
|
476
492
|
};
|
|
477
493
|
}
|
|
478
494
|
export {};
|
|
@@ -13,12 +13,16 @@ type AddBinaryIfIncluded<I> = I extends {
|
|
|
13
13
|
} ? Omit<I, '$binary'> & {
|
|
14
14
|
'$binary': NonNullable<BinaryType>;
|
|
15
15
|
} : I;
|
|
16
|
-
|
|
16
|
+
type IsTuple<T> = T extends readonly any[] ? number extends T['length'] ? false : true : false;
|
|
17
|
+
type JSONDepthLimit = [never, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
|
18
|
+
export type ToJSONSerializable<T, Options extends ToJSONSerializableOptions = ToJSONSerializableOptions, Depth extends number = 10> = T extends never ? never : Depth extends never ? never : T extends JSONSerializable ? T : T extends undefined ? undefined : T extends bigint ? string : T extends Date ? string : T extends Buffer | ArrayBuffer ? string : T extends {
|
|
17
19
|
toJSON(): infer U;
|
|
18
|
-
} ? Options['addBinary'] extends true ? ToJSONSerializable<AddBinaryIfIncluded<U>, Options> : ToJSONSerializable<U, Options> : T extends
|
|
19
|
-
[K in keyof T]: ToJSONSerializable<T[K], Options>;
|
|
20
|
+
} ? Options['addBinary'] extends true ? ToJSONSerializable<AddBinaryIfIncluded<U>, Options, JSONDepthLimit[Depth]> : ToJSONSerializable<U, Options, JSONDepthLimit[Depth]> : IsTuple<T> extends true ? {
|
|
21
|
+
[K in keyof T]: ToJSONSerializable<T[K], Options, JSONDepthLimit[Depth]>;
|
|
22
|
+
} : T extends readonly (infer U)[] ? ToJSONSerializable<U, Options, JSONDepthLimit[Depth]>[] : T extends object ? {
|
|
23
|
+
[K in keyof T]: ToJSONSerializable<T[K], Options, JSONDepthLimit[Depth]>;
|
|
20
24
|
} : never;
|
|
21
|
-
export declare function toJSONSerializable<Value, Options extends ToJSONSerializableOptions>(data: Value, opts?: Options): ToJSONSerializable<Value, Options>;
|
|
25
|
+
export declare function toJSONSerializable<Value = never, Options extends ToJSONSerializableOptions = ToJSONSerializableOptions>(data: Value, opts?: Options): ToJSONSerializable<Value, Options>;
|
|
22
26
|
export declare function objectToBuffer(data: any, opts?: ToJSONSerializableOptions): Buffer;
|
|
23
27
|
export declare function parseHexBigIntString(input: string): bigint;
|
|
24
28
|
export {};
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ExternalKeyPair for the Keeta Network which uses the PRF (Pseudo-Random
|
|
3
|
+
* Function) extension of the WebAuthn API to generate a key pair that can be
|
|
4
|
+
* used for signing and verifying messages. The PRF extension allows for the
|
|
5
|
+
* generation of a key pair that is derived from a secret value, which can be
|
|
6
|
+
* used for authentication and encryption purposes. This implementation uses
|
|
7
|
+
* the WebAuthn API to create a new credential with the PRF extension and then
|
|
8
|
+
* extracts the public key from the generated credential.
|
|
9
|
+
*/
|
|
10
|
+
import type * as KeetaNet from '../../../client';
|
|
11
|
+
import type { AccountKeyAlgorithm } from '../../../lib/account';
|
|
12
|
+
type KeetaPasskeyPRFKeyPairPackages = {
|
|
13
|
+
KeetaNet: {
|
|
14
|
+
lib: {
|
|
15
|
+
Account: typeof KeetaNet.lib.Account;
|
|
16
|
+
Utils: {
|
|
17
|
+
Helper: typeof KeetaNet.lib.Utils.Helper;
|
|
18
|
+
Buffer: typeof KeetaNet.lib.Utils.Buffer;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
navigator: {
|
|
23
|
+
credentials: Pick<Navigator['credentials'], 'create' | 'get'>;
|
|
24
|
+
};
|
|
25
|
+
bip39: {
|
|
26
|
+
entropyToMnemonic: (entropy: Uint8Array) => string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
type KeetaPasskeyPRFKeyPairOptions = {
|
|
30
|
+
/**
|
|
31
|
+
* Key type to generate from the PRF output. This is optional and
|
|
32
|
+
* defaults to ECDSA_SECP256K1, but can be set to any supported key
|
|
33
|
+
* type
|
|
34
|
+
*/
|
|
35
|
+
keyType?: AccountKeyAlgorithm;
|
|
36
|
+
/**
|
|
37
|
+
* The index to use for the generated key pair. This is optional and
|
|
38
|
+
* defaults to 0, but can be set to any non-negative integer. The
|
|
39
|
+
* index is used to allow for multiple key pairs to be generated from
|
|
40
|
+
* a single Passkey credential
|
|
41
|
+
*/
|
|
42
|
+
index?: number;
|
|
43
|
+
/**
|
|
44
|
+
* The salt to use for the PRF extension. This is optional and
|
|
45
|
+
* defaults to a fixed value, but can be set to any value. The salt
|
|
46
|
+
* is used to derive the keying material from the passkey.
|
|
47
|
+
*
|
|
48
|
+
* The default salt is the SHA2-256 hash of the UTF-8 bytes of the
|
|
49
|
+
* string "keeta.com/wallet/seed/v1" and should generally be used.
|
|
50
|
+
*/
|
|
51
|
+
salt?: Uint8Array;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Options for looking up an existing Passkey PRF key pair. You can look up
|
|
55
|
+
* a key pair by its key ID, or by its public key string (not supported yet),
|
|
56
|
+
* or you can just look up any key pair (the user will be prompted to select a
|
|
57
|
+
* credential.
|
|
58
|
+
*/
|
|
59
|
+
type KeetaPasskeyPRFKeyPairLookupOptions = KeetaPasskeyPRFKeyPairOptions & ({
|
|
60
|
+
/**
|
|
61
|
+
* Look up by a key ID
|
|
62
|
+
*/
|
|
63
|
+
keyID: string;
|
|
64
|
+
} | {
|
|
65
|
+
/**
|
|
66
|
+
* Look up by a Keeta public key string
|
|
67
|
+
*
|
|
68
|
+
* XXX:TODO
|
|
69
|
+
*/
|
|
70
|
+
publicKeyString: string;
|
|
71
|
+
} | object);
|
|
72
|
+
type KeetaPasskeyPRFKeyPairGenerateOptions = KeetaPasskeyPRFKeyPairOptions & {
|
|
73
|
+
/**
|
|
74
|
+
* "Relying Party" information from WebAuthn, which is used to
|
|
75
|
+
* identify the context in which the credential is being created.
|
|
76
|
+
*/
|
|
77
|
+
rp: {
|
|
78
|
+
/**
|
|
79
|
+
* The name of the relying party, which is a human-readable
|
|
80
|
+
* identifier for the entity that is requesting the credential.
|
|
81
|
+
*
|
|
82
|
+
* This field is optional and defaults to 'Keeta Network' if
|
|
83
|
+
* not provided.
|
|
84
|
+
*/
|
|
85
|
+
name?: string;
|
|
86
|
+
/**
|
|
87
|
+
* The ID of the relying party, which is a unique identifier
|
|
88
|
+
* for the entity that is requesting the credential. This
|
|
89
|
+
* should be a domain name (e.g. "example.com") that
|
|
90
|
+
* identifies the relying party.
|
|
91
|
+
*/
|
|
92
|
+
id: string;
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* "User" information from WebAuthn, which is used to identify the
|
|
96
|
+
* user for whom the credential is being created.
|
|
97
|
+
*/
|
|
98
|
+
user: {
|
|
99
|
+
/**
|
|
100
|
+
* The display name of the user, which is a human-readable
|
|
101
|
+
* identifier for the Passkey credential.
|
|
102
|
+
*/
|
|
103
|
+
displayName: string;
|
|
104
|
+
/**
|
|
105
|
+
* The name of the user, which is a unique identifier for the
|
|
106
|
+
* Passkey credential. This should be a string that uniquely
|
|
107
|
+
* identifies the user.
|
|
108
|
+
*/
|
|
109
|
+
name: string;
|
|
110
|
+
/**
|
|
111
|
+
* The user ID, which is a unique identifier for the Passkey
|
|
112
|
+
* credential on this Relying Party. This should be a byte
|
|
113
|
+
* array that uniquely identifies the user, and is used by the
|
|
114
|
+
* authenticator to associate the credential with the user.
|
|
115
|
+
*
|
|
116
|
+
* This field is optional and will be generated randomly if
|
|
117
|
+
* not provided.
|
|
118
|
+
*
|
|
119
|
+
* Generating a new Passkey with the same user ID will result
|
|
120
|
+
* in the old credential being overwritten, so if you want to
|
|
121
|
+
* have multiple Passkeys for the same user you should not
|
|
122
|
+
* use a duplicate user ID.
|
|
123
|
+
*/
|
|
124
|
+
id?: Uint8Array;
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
interface KeetaPasskeyPRFKeyPair extends InstanceType<typeof KeetaNet.lib.Account.ExternalKeyPair> {
|
|
128
|
+
/**
|
|
129
|
+
* The key ID is a unique identifier for the key pair, which can be
|
|
130
|
+
* used to lookup the key pair without having to search through all
|
|
131
|
+
* existing key or have the user select the credential (and potentially
|
|
132
|
+
* pick the "wrong" credential if they have multiple credentials).
|
|
133
|
+
*
|
|
134
|
+
* The key ID is generated by the authenticator so we cannot control
|
|
135
|
+
* what it is.
|
|
136
|
+
*/
|
|
137
|
+
readonly keyID: string;
|
|
138
|
+
/**
|
|
139
|
+
* Export the private key material for the key pair. This should only
|
|
140
|
+
* be called if you want to export the private key material for backup
|
|
141
|
+
* purposes, and should not be used for regular signing operations.
|
|
142
|
+
*
|
|
143
|
+
* **SECURITY WARNING** This method will expose the private key
|
|
144
|
+
* material for the key pair, which can be used to
|
|
145
|
+
* compromise the security of the key pair.
|
|
146
|
+
*/
|
|
147
|
+
exportPassphrase: () => Promise<string>;
|
|
148
|
+
}
|
|
149
|
+
interface KeetaPasskeyPRFKeyPairClass {
|
|
150
|
+
lookup: (options?: KeetaPasskeyPRFKeyPairLookupOptions) => Promise<KeetaPasskeyPRFKeyPair>;
|
|
151
|
+
generate: (options: KeetaPasskeyPRFKeyPairGenerateOptions) => Promise<KeetaPasskeyPRFKeyPair>;
|
|
152
|
+
}
|
|
153
|
+
export declare function KeetaPasskeyPRFKeyPairFactory(packages: KeetaPasskeyPRFKeyPairPackages, includeTesting: true): Required<KeetaPasskeyPRFKeyPairClass>;
|
|
154
|
+
export declare function KeetaPasskeyPRFKeyPairFactory(packages: KeetaPasskeyPRFKeyPairPackages, includeTesting?: false): Omit<KeetaPasskeyPRFKeyPairClass, '_Testing'>;
|
|
155
|
+
export declare function KeetaPasskeyPRFKeyPairFactory(packages: KeetaPasskeyPRFKeyPairPackages, includeTesting?: boolean): KeetaPasskeyPRFKeyPairClass;
|
|
156
|
+
export {};
|