@reclaimprotocol/attestor-core 5.0.5 → 5.0.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/LICENSE +660 -660
- package/browser/resources/attestor-browser.min.mjs +31 -31
- package/lib/avs/client/create-claim-on-avs.d.ts +4 -4
- package/lib/avs/config.d.ts +1 -1
- package/lib/avs/types/index.d.ts +4 -4
- package/lib/avs/utils/contracts.d.ts +3 -3
- package/lib/avs/utils/register.d.ts +1 -1
- package/lib/avs/utils/tasks.d.ts +1 -1
- package/lib/client/create-claim.d.ts +2 -2
- package/lib/client/tunnels/make-rpc-tcp-tunnel.d.ts +2 -2
- package/lib/client/tunnels/make-rpc-tls-tunnel.d.ts +2 -2
- package/lib/client/utils/attestor-pool.d.ts +1 -1
- package/lib/client/utils/client-socket.d.ts +4 -4
- package/lib/client/utils/message-handler.d.ts +2 -2
- package/lib/config/index.d.ts +1 -1
- package/lib/external-rpc/handle-incoming-msg.d.ts +1 -1
- package/lib/external-rpc/index.js +25 -8
- package/lib/external-rpc/jsc-polyfills/1.d.ts +1 -1
- package/lib/external-rpc/jsc-polyfills/index.d.ts +2 -2
- package/lib/external-rpc/setup-browser.d.ts +1 -1
- package/lib/external-rpc/setup-jsc.d.ts +2 -2
- package/lib/external-rpc/types.d.ts +7 -7
- package/lib/external-rpc/utils.d.ts +2 -2
- package/lib/index.js +26 -9
- package/lib/mechain/client/create-claim-on-mechain.d.ts +3 -3
- package/lib/mechain/types/index.d.ts +2 -2
- package/lib/providers/http/index.d.ts +1 -1
- package/lib/providers/http/utils.d.ts +3 -3
- package/lib/providers/index.d.ts +1 -1
- package/lib/scripts/generate-receipt.d.ts +2 -2
- package/lib/scripts/jsc-cli-rpc.d.ts +1 -1
- package/lib/scripts/start-server.d.ts +1 -1
- package/lib/server/handlers/claimTeeBundle.d.ts +1 -1
- package/lib/server/handlers/claimTunnel.d.ts +1 -1
- package/lib/server/handlers/completeClaimOnChain.d.ts +1 -1
- package/lib/server/handlers/createClaimOnChain.d.ts +1 -1
- package/lib/server/handlers/createTaskOnMechain.d.ts +1 -1
- package/lib/server/handlers/createTunnel.d.ts +1 -1
- package/lib/server/handlers/disconnectTunnel.d.ts +1 -1
- package/lib/server/handlers/fetchCertificateBytes.d.ts +1 -1
- package/lib/server/handlers/index.d.ts +1 -1
- package/lib/server/handlers/init.d.ts +1 -1
- package/lib/server/handlers/toprf.d.ts +1 -1
- package/lib/server/socket.d.ts +4 -4
- package/lib/server/tunnels/make-tcp-tunnel.d.ts +3 -3
- package/lib/server/utils/assert-valid-claim-request.d.ts +4 -4
- package/lib/server/utils/gcp-attestation.d.ts +1 -1
- package/lib/server/utils/generics.d.ts +8 -2
- package/lib/server/utils/oprf-raw.d.ts +2 -2
- package/lib/server/utils/process-handshake.d.ts +2 -2
- package/lib/server/utils/tee-oprf-mpc-verification.d.ts +3 -3
- package/lib/server/utils/tee-oprf-verification.d.ts +3 -3
- package/lib/server/utils/tee-transcript-reconstruction.d.ts +3 -3
- package/lib/server/utils/tee-verification.d.ts +3 -3
- package/lib/server/utils/validation.d.ts +1 -1
- package/lib/types/claims.d.ts +6 -6
- package/lib/types/client.d.ts +5 -5
- package/lib/types/general.d.ts +1 -1
- package/lib/types/handlers.d.ts +3 -3
- package/lib/types/providers.d.ts +5 -5
- package/lib/types/rpc.d.ts +2 -2
- package/lib/types/tunnel.d.ts +1 -1
- package/lib/types/zk.d.ts +1 -1
- package/lib/utils/auth.d.ts +2 -2
- package/lib/utils/bgp-listener.d.ts +1 -1
- package/lib/utils/claims.d.ts +3 -3
- package/lib/utils/error.d.ts +1 -1
- package/lib/utils/generics.d.ts +2 -2
- package/lib/utils/http-parser.d.ts +1 -1
- package/lib/utils/logger.d.ts +1 -1
- package/lib/utils/prepare-packets.d.ts +2 -2
- package/lib/utils/redactions.d.ts +1 -1
- package/lib/utils/retries.d.ts +1 -1
- package/lib/utils/signatures/eth.d.ts +1 -1
- package/lib/utils/signatures/index.d.ts +2 -2
- package/lib/utils/socket-base.d.ts +3 -3
- package/lib/utils/zk.d.ts +4 -4
- package/package.json +5 -4
- package/lib/server/tee/acme-http-server.d.ts +0 -13
- package/lib/server/tee/attestation-generate.d.ts +0 -29
- package/lib/server/tee/bootstrap.d.ts +0 -11
- package/lib/server/tee/cert-manager.d.ts +0 -24
- package/lib/server/tee/cloud-logging.d.ts +0 -23
- package/lib/server/tee/secret-loader.d.ts +0 -10
- package/lib/server/tee/secret-manager.d.ts +0 -3
- package/lib/utils/gcp-attestation.d.ts +0 -23
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
* are already trusted because they are included in TEE-signed payloads.
|
|
7
7
|
* This module verifies that both TEEs computed identical outputs.
|
|
8
8
|
*/
|
|
9
|
-
import type { KOutputPayload, TOutputPayload } from '
|
|
10
|
-
import type { OprfVerificationResult } from '
|
|
11
|
-
import type { Logger } from '
|
|
9
|
+
import type { KOutputPayload, TOutputPayload } from '../../proto/tee-bundle.ts';
|
|
10
|
+
import type { OprfVerificationResult } from '../../server/utils/tee-oprf-verification.ts';
|
|
11
|
+
import type { Logger } from '../../types/general.ts';
|
|
12
12
|
/**
|
|
13
13
|
* Verifies OPRF MPC outputs from TEE_K and TEE_T match
|
|
14
14
|
* Returns verified outputs for transcript replacement (same format as ZK OPRF)
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* TEE OPRF Verification and Replacement
|
|
3
3
|
* Verifies OPRF proofs and replaces ranges in reconstructed plaintext
|
|
4
4
|
*/
|
|
5
|
-
import type { OPRFVerificationData } from '
|
|
6
|
-
import type { TeeBundleData } from '
|
|
7
|
-
import type { Logger } from '
|
|
5
|
+
import type { OPRFVerificationData } from '../../proto/tee-bundle.ts';
|
|
6
|
+
import type { TeeBundleData } from '../../server/utils/tee-verification.ts';
|
|
7
|
+
import type { Logger } from '../../types/general.ts';
|
|
8
8
|
export interface OprfVerificationResult {
|
|
9
9
|
position: number;
|
|
10
10
|
length: number;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* TLS Transcript Reconstruction from TEE data
|
|
3
3
|
*/
|
|
4
|
-
import type { CertificateInfo } from '
|
|
5
|
-
import type { TeeBundleData } from '
|
|
6
|
-
import type { Logger } from '
|
|
4
|
+
import type { CertificateInfo } from '../../proto/tee-bundle.ts';
|
|
5
|
+
import type { TeeBundleData } from '../../server/utils/tee-verification.ts';
|
|
6
|
+
import type { Logger } from '../../types/general.ts';
|
|
7
7
|
export interface TeeTranscriptData {
|
|
8
8
|
revealedRequest: Uint8Array;
|
|
9
9
|
reconstructedResponse: Uint8Array;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* TEE Bundle verification utilities
|
|
3
3
|
* Handles validation of TEE verification bundles including attestations and signatures
|
|
4
4
|
*/
|
|
5
|
-
import type { SignedMessage } from '
|
|
6
|
-
import { KOutputPayload, TOutputPayload } from '
|
|
7
|
-
import type { Logger } from '
|
|
5
|
+
import type { SignedMessage } from '../../proto/tee-bundle.ts';
|
|
6
|
+
import { KOutputPayload, TOutputPayload } from '../../proto/tee-bundle.ts';
|
|
7
|
+
import type { Logger } from '../../types/general.ts';
|
|
8
8
|
export interface TeeBundleData {
|
|
9
9
|
teekSigned: SignedMessage;
|
|
10
10
|
teetSigned: SignedMessage;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { ProviderName, ProviderParams } from '
|
|
1
|
+
import type { ProviderName, ProviderParams } from '../../types/index.ts';
|
|
2
2
|
export declare function assertValidateProviderParams<T extends ProviderName>(name: T, params: unknown): asserts params is ProviderParams<T>;
|
package/lib/types/claims.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { ProviderClaimData } from '
|
|
2
|
-
import type { IAttestorClient, IAttestorClientInitParams } from '
|
|
3
|
-
import type { CompleteTLSPacket, Logger } from '
|
|
4
|
-
import type { ProofGenerationStep, ProviderName, ProviderParams, ProviderSecretParams } from '
|
|
5
|
-
import type { Transcript } from '
|
|
6
|
-
import type { PrepareZKProofsBaseOpts } from '
|
|
1
|
+
import type { ProviderClaimData } from '../proto/api.ts';
|
|
2
|
+
import type { IAttestorClient, IAttestorClientInitParams } from '../types/client.ts';
|
|
3
|
+
import type { CompleteTLSPacket, Logger } from '../types/general.ts';
|
|
4
|
+
import type { ProofGenerationStep, ProviderName, ProviderParams, ProviderSecretParams } from '../types/providers.ts';
|
|
5
|
+
import type { Transcript } from '../types/tunnel.ts';
|
|
6
|
+
import type { PrepareZKProofsBaseOpts } from '../types/zk.ts';
|
|
7
7
|
/**
|
|
8
8
|
* Uniquely identifies a claim.
|
|
9
9
|
* Hash of claim info.
|
package/lib/types/client.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { IncomingMessage } from 'http';
|
|
2
2
|
import type { WebSocket as WSWebSocket } from 'ws';
|
|
3
|
-
import type { AuthenticationRequest, InitRequest, InitResponse, RPCMessage, RPCMessages, ServiceSignatureType, TunnelMessage } from '
|
|
4
|
-
import type { BGPListener } from '
|
|
5
|
-
import type { Logger } from '
|
|
6
|
-
import type { RPCEvent, RPCEventMap, RPCEventType, RPCRequestData, RPCResponseData, RPCType } from '
|
|
7
|
-
import type { TCPSocketProperties, Tunnel } from '
|
|
3
|
+
import type { AuthenticationRequest, InitRequest, InitResponse, RPCMessage, RPCMessages, ServiceSignatureType, TunnelMessage } from '../proto/api.ts';
|
|
4
|
+
import type { BGPListener } from '../types/bgp.ts';
|
|
5
|
+
import type { Logger } from '../types/general.ts';
|
|
6
|
+
import type { RPCEvent, RPCEventMap, RPCEventType, RPCRequestData, RPCResponseData, RPCType } from '../types/rpc.ts';
|
|
7
|
+
import type { TCPSocketProperties, Tunnel } from '../types/tunnel.ts';
|
|
8
8
|
/**
|
|
9
9
|
* Any WebSocket implementation -- either the native
|
|
10
10
|
* WebSocket or the WebSocket from the `ws` package.
|
package/lib/types/general.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Logger as TLSLogger, TLSPacketContext, TLSProtocolVersion } from '@reclaimprotocol/tls';
|
|
2
|
-
import type { OPRFRawMarker, TOPRFProofParams } from '
|
|
2
|
+
import type { OPRFRawMarker, TOPRFProofParams } from '../types/zk.ts';
|
|
3
3
|
/**
|
|
4
4
|
* Represents a slice of any array or string
|
|
5
5
|
*/
|
package/lib/types/handlers.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Transaction } from 'elastic-apm-node';
|
|
2
|
-
import type { IAttestorServerSocket } from '
|
|
3
|
-
import type { Logger } from '
|
|
4
|
-
import type { RPCRequestData, RPCResponseData, RPCType } from '
|
|
2
|
+
import type { IAttestorServerSocket } from '../types/client.ts';
|
|
3
|
+
import type { Logger } from '../types/general.ts';
|
|
4
|
+
import type { RPCRequestData, RPCResponseData, RPCType } from '../types/rpc.ts';
|
|
5
5
|
export type RPCHandlerMetadata = {
|
|
6
6
|
logger: Logger;
|
|
7
7
|
tx?: Transaction;
|
package/lib/types/providers.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { TLSConnectionOptions } from '@reclaimprotocol/tls';
|
|
2
|
-
import type { AttestorVersion, ProviderClaimData } from '
|
|
3
|
-
import type { ArraySlice, Logger, RedactedOrHashedArraySlice } from '
|
|
4
|
-
import type { ProvidersConfig } from '
|
|
5
|
-
import type { Awaitable } from '
|
|
6
|
-
import type { Transcript } from '
|
|
2
|
+
import type { AttestorVersion, ProviderClaimData } from '../proto/api.ts';
|
|
3
|
+
import type { ArraySlice, Logger, RedactedOrHashedArraySlice } from '../types/general.ts';
|
|
4
|
+
import type { ProvidersConfig } from '../types/providers.gen.ts';
|
|
5
|
+
import type { Awaitable } from '../types/signatures.ts';
|
|
6
|
+
import type { Transcript } from '../types/tunnel.ts';
|
|
7
7
|
export type AttestorData = {
|
|
8
8
|
id: string;
|
|
9
9
|
url: string;
|
package/lib/types/rpc.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { RPCMessage, TunnelDisconnectEvent, TunnelMessage } from '
|
|
2
|
-
import type { AttestorError } from '
|
|
1
|
+
import type { RPCMessage, TunnelDisconnectEvent, TunnelMessage } from '../proto/api.ts';
|
|
2
|
+
import type { AttestorError } from '../utils/error.ts';
|
|
3
3
|
type ExtractPrefix<T, S extends string> = T extends `${infer _}${S}` ? _ : never;
|
|
4
4
|
export type RPCType = ExtractPrefix<keyof RPCMessage, 'Request'>;
|
|
5
5
|
type RPCRequestType<T extends RPCType> = `${T}Request`;
|
package/lib/types/tunnel.d.ts
CHANGED
package/lib/types/zk.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { EncryptionAlgorithm, OPRFOperator, ZKEngine, ZKOperator } from '@reclaimprotocol/zk-symmetric-crypto';
|
|
2
|
-
import type { TOPRFPayload } from '
|
|
2
|
+
import type { TOPRFPayload } from '../proto/api.ts';
|
|
3
3
|
export type ZKOperators = {
|
|
4
4
|
[E in EncryptionAlgorithm]?: ZKOperator;
|
|
5
5
|
};
|
package/lib/utils/auth.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AuthenticationRequest, ServiceSignatureType } from '
|
|
2
|
-
import { AuthenticatedUserData } from '
|
|
1
|
+
import type { AuthenticationRequest, ServiceSignatureType } from '../proto/api.ts';
|
|
2
|
+
import { AuthenticatedUserData } from '../proto/api.ts';
|
|
3
3
|
export declare function assertValidAuthRequest(request: AuthenticationRequest | undefined, signatureType: ServiceSignatureType): Promise<void>;
|
|
4
4
|
/**
|
|
5
5
|
* Create an authentication request with the given data and private key,
|
package/lib/utils/claims.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ClaimTunnelResponse } from '
|
|
2
|
-
import type { ClaimID, ClaimInfo, CompleteClaimData, ProviderParams } from '
|
|
1
|
+
import { ClaimTunnelResponse } from '../proto/api.ts';
|
|
2
|
+
import type { ClaimID, ClaimInfo, CompleteClaimData, ProviderParams } from '../types/index.ts';
|
|
3
3
|
/**
|
|
4
4
|
* Creates the standard string to sign for a claim.
|
|
5
5
|
* This data is what the attestor will sign when it successfully
|
|
@@ -16,7 +16,7 @@ export declare function createSignDataForClaim(data: CompleteClaimData): string;
|
|
|
16
16
|
* The successful run of this function means that the claim
|
|
17
17
|
* is valid, and the attestor that signed the claim is valid.
|
|
18
18
|
*/
|
|
19
|
-
export declare function assertValidClaimSignatures({ signatures, ...res }: Partial<ClaimTunnelResponse>, metadata?: import("
|
|
19
|
+
export declare function assertValidClaimSignatures({ signatures, ...res }: Partial<ClaimTunnelResponse>, metadata?: import("../proto/api.ts").InitRequest): Promise<void>;
|
|
20
20
|
/**
|
|
21
21
|
* Generates a unique identifier for given claim info
|
|
22
22
|
* @param info
|
package/lib/utils/error.d.ts
CHANGED
package/lib/utils/generics.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CipherSuite, TLSProtocolVersion } from '@reclaimprotocol/tls';
|
|
2
2
|
import { uint8ArrayToBinaryStr } from '@reclaimprotocol/tls';
|
|
3
|
-
import { RPCMessage, RPCMessages } from '
|
|
4
|
-
import type { CompleteTLSPacket, IDecryptedTranscript, IDecryptedTranscriptMessage, ProviderField, RPCEvent, RPCEventMap, RPCEventType, RPCType, Transcript } from '
|
|
3
|
+
import { RPCMessage, RPCMessages } from '../proto/api.ts';
|
|
4
|
+
import type { CompleteTLSPacket, IDecryptedTranscript, IDecryptedTranscriptMessage, ProviderField, RPCEvent, RPCEventMap, RPCEventType, RPCType, Transcript } from '../types/index.ts';
|
|
5
5
|
export { uint8ArrayToBinaryStr };
|
|
6
6
|
/**
|
|
7
7
|
* Decodes a Uint8Array to a UTF-8 string.
|
package/lib/utils/logger.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CipherSuite, TLSPacketContext } from '@reclaimprotocol/tls';
|
|
2
|
-
import type { ClaimTunnelRequest_TranscriptMessage as TranscriptMessage } from '
|
|
3
|
-
import type { CompleteTLSPacket, Logger, MessageRevealInfo, PrepareZKProofsBaseOpts, Transcript } from '
|
|
2
|
+
import type { ClaimTunnelRequest_TranscriptMessage as TranscriptMessage } from '../proto/api.ts';
|
|
3
|
+
import type { CompleteTLSPacket, Logger, MessageRevealInfo, PrepareZKProofsBaseOpts, Transcript } from '../types/index.ts';
|
|
4
4
|
export type PreparePacketsForRevealOpts = {
|
|
5
5
|
cipherSuite: CipherSuite;
|
|
6
6
|
logger: Logger;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ArraySlice, OPRFRawMarker, RedactedOrHashedArraySlice, TOPRFProofParams } from '
|
|
1
|
+
import type { ArraySlice, OPRFRawMarker, RedactedOrHashedArraySlice, TOPRFProofParams } from '../types/index.ts';
|
|
2
2
|
export declare const REDACTION_CHAR = "*";
|
|
3
3
|
export declare const REDACTION_CHAR_CODE: number;
|
|
4
4
|
type SliceWithReveal<T> = {
|
package/lib/utils/retries.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { ServiceSignatureProvider } from '
|
|
1
|
+
import type { ServiceSignatureProvider } from '../../types/index.ts';
|
|
2
2
|
export declare const ETH_SIGNATURE_PROVIDER: ServiceSignatureProvider;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ServiceSignatureType } from '
|
|
2
|
-
import type { ServiceSignatureProvider } from '
|
|
1
|
+
import { ServiceSignatureType } from '../../proto/api.ts';
|
|
2
|
+
import type { ServiceSignatureProvider } from '../../types/index.ts';
|
|
3
3
|
export declare const SIGNATURES: { [key in ServiceSignatureType]: ServiceSignatureProvider; };
|
|
4
4
|
export declare const SelectedServiceSignatureType: 1;
|
|
5
5
|
export declare const SelectedServiceSignature: ServiceSignatureProvider;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { WebSocket as WSWebSocket } from 'ws';
|
|
2
|
-
import type { InitRequest, RPCMessage } from '
|
|
3
|
-
import { RPCMessages } from '
|
|
4
|
-
import type { IAttestorSocket, Logger, RPCEvent, RPCEventMap } from '
|
|
2
|
+
import type { InitRequest, RPCMessage } from '../proto/api.ts';
|
|
3
|
+
import { RPCMessages } from '../proto/api.ts';
|
|
4
|
+
import type { IAttestorSocket, Logger, RPCEvent, RPCEventMap } from '../types/index.ts';
|
|
5
5
|
/**
|
|
6
6
|
* Common AttestorSocket class used on the client & server side as the
|
|
7
7
|
* base for their respective socket implementations.
|
package/lib/utils/zk.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { CipherSuite } from '@reclaimprotocol/tls';
|
|
2
2
|
import type { EncryptionAlgorithm, OPRFOperator, PrivateInput, PublicInput, ZKEngine, ZKOperator } from '@reclaimprotocol/zk-symmetric-crypto';
|
|
3
|
-
import type { MessageReveal_MessageRevealZk as ZKReveal, MessageReveal_TOPRFProof as TOPRFProof, MessageReveal_ZKProof as ZKProof } from '
|
|
4
|
-
import { ZKProofEngine } from '
|
|
5
|
-
import type { CompleteTLSPacket, Logger, OPRFOperators, PrepareZKProofsBaseOpts, TOPRFProofParams, ZKOperators, ZKRevealInfo } from '
|
|
3
|
+
import type { MessageReveal_MessageRevealZk as ZKReveal, MessageReveal_TOPRFProof as TOPRFProof, MessageReveal_ZKProof as ZKProof } from '../proto/api.ts';
|
|
4
|
+
import { ZKProofEngine } from '../proto/api.ts';
|
|
5
|
+
import type { CompleteTLSPacket, Logger, OPRFOperators, PrepareZKProofsBaseOpts, TOPRFProofParams, ZKOperators, ZKRevealInfo } from '../types/index.ts';
|
|
6
6
|
type PrepareZKProofsOpts = {
|
|
7
7
|
logger?: Logger;
|
|
8
8
|
cipherSuite: CipherSuite;
|
|
@@ -62,7 +62,7 @@ export declare function makeZkProofGenerator({ zkOperators, oprfOperators, logge
|
|
|
62
62
|
*/
|
|
63
63
|
export declare function verifyZkPacket({ cipherSuite, ciphertext, zkReveal, zkOperators, oprfOperators, logger, zkEngine, iv, recordNumber, toprfOvershotNullifier, getNextPacket }: ZKVerifyOpts): Promise<{
|
|
64
64
|
redactedPlaintext: Uint8Array<ArrayBuffer>;
|
|
65
|
-
oprfRawMarkers: import("
|
|
65
|
+
oprfRawMarkers: import("../proto/api.ts").MessageReveal_OPRFRawMarker[];
|
|
66
66
|
}>;
|
|
67
67
|
export declare function makeDefaultZkOperator(algorithm: EncryptionAlgorithm, zkEngine: ZKEngine, logger: Logger): ZKOperator;
|
|
68
68
|
export declare function makeDefaultOPRFOperator(algorithm: EncryptionAlgorithm, zkEngine: ZKEngine, logger: Logger): OPRFOperator;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reclaimprotocol/attestor-core",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.7",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"imports": {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
23
|
"scripts": {
|
|
24
|
-
"build": "tsc -p tsconfig.build.json && npm run run:tsc -- src/scripts/build-lib.ts",
|
|
24
|
+
"build": "tsc -p tsconfig.build.json && tsc-alias && npm run run:tsc -- src/scripts/build-lib.ts",
|
|
25
25
|
"build:browser": "sh ./src/scripts/build-browser.sh",
|
|
26
26
|
"run:tsc": "node --experimental-strip-types",
|
|
27
27
|
"start": "npm run run:tsc -- src/scripts/start-server.ts",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"@peculiar/asn1-x509": "^2.6.1",
|
|
86
86
|
"@peculiar/webcrypto": "^1.5.0",
|
|
87
87
|
"@peculiar/x509": "^1.14.3",
|
|
88
|
-
"@reclaimprotocol/tls": "
|
|
88
|
+
"@reclaimprotocol/tls": "^0.1.3",
|
|
89
89
|
"@reclaimprotocol/zk-symmetric-crypto": "^5.1.3",
|
|
90
90
|
"ajv": "^8.18.0",
|
|
91
91
|
"bs58": "^6.0.0",
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
"parse5": "^8.0.0",
|
|
106
106
|
"parse5-htmlparser2-tree-adapter": "^8.0.0",
|
|
107
107
|
"pino": "^9.14.0",
|
|
108
|
-
"re2": "^1.
|
|
108
|
+
"re2": "^1.24.0",
|
|
109
109
|
"serve-static": "^1.16.3",
|
|
110
110
|
"snarkjs": "^0.7.6",
|
|
111
111
|
"ws": "^8.20.0",
|
|
@@ -131,6 +131,7 @@
|
|
|
131
131
|
"json-schema-to-typescript": "^15.0.4",
|
|
132
132
|
"ts-jest": "^29.4.6",
|
|
133
133
|
"ts-proto": "^2.11.6",
|
|
134
|
+
"tsc-alias": "^1.8.17",
|
|
134
135
|
"typechain": "^8.3.2",
|
|
135
136
|
"typescript": "^5.9.3",
|
|
136
137
|
"whatwg-url": "^14.2.0",
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Ephemeral HTTP server that answers ACME HTTP-01 challenges. Started right
|
|
3
|
-
* before an order is placed and stopped as soon as the order is finalized,
|
|
4
|
-
* so the attestor does not keep port 80 bound during normal operation.
|
|
5
|
-
*/
|
|
6
|
-
export declare class AcmeChallengeServer {
|
|
7
|
-
private readonly tokens;
|
|
8
|
-
private server?;
|
|
9
|
-
add(token: string, keyAuthorization: string): void;
|
|
10
|
-
remove(token: string): void;
|
|
11
|
-
start(port: number): Promise<void>;
|
|
12
|
-
stop(): Promise<void>;
|
|
13
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { AttestationReport } from '#src/proto/tee-bundle.ts';
|
|
2
|
-
/**
|
|
3
|
-
* Requests a custom attestation token from the Confidential Space launcher
|
|
4
|
-
* over the unix domain socket. Mirrors reclaim-tee's shared/gcp_attestation.go.
|
|
5
|
-
*/
|
|
6
|
-
export declare function generateAttestationJwt(nonces: string[]): Promise<Uint8Array>;
|
|
7
|
-
export interface AttestationContext {
|
|
8
|
-
attestorAddress: string;
|
|
9
|
-
tlsCertSha256Hex: () => string | undefined;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Starts the background attestation refresh loop. The first attestation is
|
|
13
|
-
* generated synchronously so getCachedAttestationJwt() is ready by the time
|
|
14
|
-
* the server begins handling claims.
|
|
15
|
-
*/
|
|
16
|
-
export declare function startAttestationRefresh(ctx: AttestationContext): Promise<void>;
|
|
17
|
-
export declare function stopAttestationRefresh(): void;
|
|
18
|
-
/**
|
|
19
|
-
* Returns the currently-cached attestation JWT bytes, or undefined if no
|
|
20
|
-
* attestation has been generated yet or the cache has expired without a
|
|
21
|
-
* successful refresh.
|
|
22
|
-
*/
|
|
23
|
-
export declare function getCachedAttestationJwt(): Uint8Array | undefined;
|
|
24
|
-
/**
|
|
25
|
-
* Returns an AttestationReport ready to embed in a claim response, or
|
|
26
|
-
* undefined when no attestation is available (i.e. attestor is not running
|
|
27
|
-
* inside a TEE, or the refresh loop has not produced one yet).
|
|
28
|
-
*/
|
|
29
|
-
export declare function makeClaimAttestation(): AttestationReport | undefined;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Brings the attestor up in TEE mode:
|
|
3
|
-
* 1. Pull signing/OPRF secrets from GCP Secret Manager into process.env.
|
|
4
|
-
* 2. Load (or obtain via ACME) the TLS cert and start the renewal loop.
|
|
5
|
-
* 3. Start the attestation refresh loop, with the public key + cert hash
|
|
6
|
-
* as nonces.
|
|
7
|
-
*
|
|
8
|
-
* Must run before #src/server/index.ts is imported, since modules in that
|
|
9
|
-
* tree read PRIVATE_KEY at module load.
|
|
10
|
-
*/
|
|
11
|
-
export declare function bootstrapTee(): Promise<void>;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import tls from 'tls';
|
|
2
|
-
export interface CertManagerConfig {
|
|
3
|
-
projectId: string;
|
|
4
|
-
domain: string;
|
|
5
|
-
email: string;
|
|
6
|
-
directoryUrl: string;
|
|
7
|
-
httpChallengePort: number;
|
|
8
|
-
}
|
|
9
|
-
export interface ActiveCertificate {
|
|
10
|
-
certPem: string;
|
|
11
|
-
keyPem: string;
|
|
12
|
-
notAfter: Date;
|
|
13
|
-
sha256Hex: string;
|
|
14
|
-
secureContext: tls.SecureContext;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Bootstraps the TLS certificate. Tries Secret Manager first; if absent or
|
|
18
|
-
* expiring within the renewal window, runs ACME against the configured
|
|
19
|
-
* directory URL and persists the result.
|
|
20
|
-
*/
|
|
21
|
-
export declare function bootstrapCertificate(cfg: CertManagerConfig): Promise<ActiveCertificate>;
|
|
22
|
-
export declare function startRenewalLoop(cfg: CertManagerConfig): void;
|
|
23
|
-
export declare function stopRenewalLoop(): void;
|
|
24
|
-
export declare function getActiveCertificate(): ActiveCertificate | undefined;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { LogLevel } from '#src/types/index.ts';
|
|
2
|
-
interface CloudLoggingOptions {
|
|
3
|
-
projectId: string;
|
|
4
|
-
logName: string;
|
|
5
|
-
level?: LogLevel;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Replaces the default pino logger with one that forwards every log line
|
|
9
|
-
* to GCP Cloud Logging under the given log name. Idempotent.
|
|
10
|
-
*
|
|
11
|
-
* Probes the Cloud Logging client first by writing a no-op entry; if
|
|
12
|
-
* authentication or transport fails, leaves the default stdout logger in
|
|
13
|
-
* place rather than crashing the process. On Confidential Space VMs the
|
|
14
|
-
* launcher's `tee-container-log-redirect` ships stdout to Cloud Logging
|
|
15
|
-
* anyway, so the worst case is logs appear under
|
|
16
|
-
* `confidential-space-launcher` rather than the configured `logName`.
|
|
17
|
-
*
|
|
18
|
-
* We also install a process-wide `unhandledRejection` filter that
|
|
19
|
-
* swallows errors originating in `@google-cloud/logging`, since the SDK
|
|
20
|
-
* has internal lazy gRPC init that escapes our local `.catch()`.
|
|
21
|
-
*/
|
|
22
|
-
export declare function installCloudLogging(opts: CloudLoggingOptions): void;
|
|
23
|
-
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Fetches the attestor's signing key and OPRF key material from GCP
|
|
3
|
-
* Secret Manager and writes them into process.env, so that the rest of
|
|
4
|
-
* the server (which reads these via getEnvVariable at module load) sees
|
|
5
|
-
* them as if they had been set in the environment.
|
|
6
|
-
*
|
|
7
|
-
* Must be called before any module that reads PRIVATE_KEY / TOPRF_* is
|
|
8
|
-
* imported, otherwise the reads happen before the values are populated.
|
|
9
|
-
*/
|
|
10
|
-
export declare function loadSecretsIntoEnv(projectId: string): Promise<void>;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export declare function accessLatestSecret(projectId: string, secretId: string): Promise<Uint8Array>;
|
|
2
|
-
export declare function createSecretIfNotExists(projectId: string, secretId: string): Promise<void>;
|
|
3
|
-
export declare function addSecretVersion(projectId: string, secretId: string, payload: Uint8Array): Promise<void>;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GCP attestation validation utilities.
|
|
3
|
-
*
|
|
4
|
-
* Validates JWT attestation tokens from GCP Confidential Computing
|
|
5
|
-
* (Confidential Space). Browser-safe: uses `@peculiar/x509` for chain
|
|
6
|
-
* verification and `globalThis.crypto.subtle` for JWT signature
|
|
7
|
-
* verification. Both are available in Node 19+ and modern browsers.
|
|
8
|
-
*/
|
|
9
|
-
import type { Logger } from '#src/types/general.ts';
|
|
10
|
-
export interface GcpValidationResult {
|
|
11
|
-
isValid: boolean;
|
|
12
|
-
errors: string[];
|
|
13
|
-
ethAddress?: Uint8Array;
|
|
14
|
-
userDataType?: string;
|
|
15
|
-
pcr0?: string;
|
|
16
|
-
envVars?: Record<string, string>;
|
|
17
|
-
}
|
|
18
|
-
export declare function validateGcpAttestationAndExtractKey(attestation: Uint8Array | string, logger?: Logger): Promise<GcpValidationResult>;
|
|
19
|
-
/**
|
|
20
|
-
* Extracts the container image digest from a previously-validated GCP
|
|
21
|
-
* attestation token. Re-validates the JWT before reading.
|
|
22
|
-
*/
|
|
23
|
-
export declare function extractImageDigestFromGCPAttestation(token: Uint8Array | string, logger?: Logger): Promise<string>;
|