@cofhe/sdk 0.7.1 → 0.8.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/CHANGELOG.md +35 -0
- package/acps/acp.ts +10 -1
- package/acps/index.ts +11 -0
- package/acps/onchain-utils.ts +188 -49
- package/acps/registry.ts +73 -0
- package/acps/test/onchainAccessStatus.test.ts +116 -0
- package/acps/types.ts +16 -0
- package/chains/chains/arbitrum.ts +14 -0
- package/chains/chains/ethereum.ts +14 -0
- package/chains/index.ts +5 -1
- package/chains/test/chains.test.ts +24 -3
- package/core/acps.ts +51 -143
- package/core/client.ts +13 -8
- package/core/clientTypes.ts +29 -4
- package/core/config.ts +25 -1
- package/core/consts.ts +14 -2
- package/core/decrypt/verifyDecryptResult.ts +4 -3
- package/core/encrypt/encryptInputsBuilder.ts +6 -0
- package/core/encrypt/zkPackProveVerify.ts +7 -1
- package/core/error.ts +1 -0
- package/core/fetchKeys.ts +2 -2
- package/core/index.ts +9 -1
- package/core/keyStore.ts +23 -10
- package/core/taskManager.ts +48 -0
- package/core/test/acps.test.ts +91 -1
- package/core/test/client.test.ts +41 -0
- package/core/test/config.test.ts +16 -0
- package/core/test/decrypt.test.ts +11 -4
- package/core/test/encryptInputsBuilder.test.ts +1 -1
- package/core/test/fetchKeys.test.ts +23 -2
- package/core/test/keyStore.test.ts +18 -6
- package/core/test/taskManager.test.ts +57 -0
- package/core/types.ts +8 -0
- package/dist/acps.cjs +314 -35
- package/dist/acps.d.cts +251 -4
- package/dist/acps.d.ts +251 -4
- package/dist/acps.js +2 -2
- package/dist/chains.cjs +26 -0
- package/dist/chains.d.cts +45 -1
- package/dist/chains.d.ts +45 -1
- package/dist/chains.js +1 -1
- package/dist/{chunk-43USWPEH.js → chunk-GGI7Y6AW.js} +59 -264
- package/dist/chunk-KSOV5B4B.js +50 -0
- package/dist/{chunk-ESMZCFJY.js → chunk-NMKMCAI3.js} +4 -2
- package/dist/{chunk-Q7CBWGQX.js → chunk-UJYOBHYA.js} +374 -37
- package/dist/{chunk-N6IDQRRU.js → chunk-UKQAJK4N.js} +25 -1
- package/dist/{clientTypes-BN3nbzYM.d.ts → clientTypes-5YPPR16m.d.ts} +77 -14
- package/dist/{clientTypes-CYZjFznO.d.cts → clientTypes-D3aIXmUp.d.cts} +77 -14
- package/dist/core.cjs +271 -136
- package/dist/core.d.cts +29 -8
- package/dist/core.d.ts +29 -8
- package/dist/core.js +4 -4
- package/dist/node.cjs +266 -136
- package/dist/node.d.cts +2 -2
- package/dist/node.d.ts +2 -2
- package/dist/node.js +5 -5
- package/dist/{acp-Wi6isVQI.d.cts → onchain-utils-CUAK8glx.d.cts} +31 -1
- package/dist/{acp-Wi6isVQI.d.ts → onchain-utils-CUAK8glx.d.ts} +31 -1
- package/dist/web.cjs +360 -150
- package/dist/web.d.cts +49 -3
- package/dist/web.d.ts +49 -3
- package/dist/web.js +51 -20
- package/dist/zkProve.worker.cjs +69 -15
- package/dist/zkProve.worker.js +23 -17
- package/node/storage.ts +2 -2
- package/node/test/inherited.test.ts +5 -1
- package/node/test/storage-memory-fallback.test.ts +47 -0
- package/package.json +5 -3
- package/web/index.ts +100 -26
- package/web/test/countingZkProveWorker.ts +31 -0
- package/web/test/inherited.web.test.ts +5 -1
- package/web/test/mainThreadPool.web.test.ts +174 -0
- package/web/test/threadPoolBenchHelper.ts +140 -0
- package/web/test/threadPoolOff.web.test.ts +17 -0
- package/web/test/threadPoolOn.web.test.ts +80 -0
- package/web/test/workerInitRace.web.test.ts +79 -0
- package/web/tfheThreadPool.ts +140 -0
- package/web/workerManager.ts +4 -2
- package/web/zkProve.worker.ts +42 -17
|
@@ -235,6 +235,13 @@ type SharedACP = Expand<Omit<ACPPublic, 'sealingKey' | 'recipientSignature'> & {
|
|
|
235
235
|
name: string;
|
|
236
236
|
type: 'sharing';
|
|
237
237
|
}>;
|
|
238
|
+
/**
|
|
239
|
+
* An ACP on-chain status, as `client.acp.checkAccess` reports it instead of a revert.
|
|
240
|
+
* Without a handle: 'valid' or the reason it is not. With a handle, a valid ACP reports
|
|
241
|
+
* 'allowed', 'out-of-scope' (the ACP scope does not cover the handle) or
|
|
242
|
+
* 'issuer-not-allowed' (the issuer itself may not read the handle, so no ACP of theirs can).
|
|
243
|
+
*/
|
|
244
|
+
type ACPAccessStatus = 'valid' | 'allowed' | 'out-of-scope' | 'issuer-not-allowed' | 'expired' | 'revoked' | 'invalid-issuer-signature' | 'invalid-recipient-signature';
|
|
238
245
|
/**
|
|
239
246
|
* A share read back from the on-chain ACPShareRegistry: the posted payload
|
|
240
247
|
* (SharedACP minus the client-side name/type) plus its registry id.
|
|
@@ -402,6 +409,29 @@ declare const ACPUtils: {
|
|
|
402
409
|
* Check if acp passes the on-chain validation
|
|
403
410
|
*/
|
|
404
411
|
checkValidityOnChain: (acp: ACP, publicClient: PublicClient) => Promise<boolean>;
|
|
412
|
+
/**
|
|
413
|
+
* The acp on-chain status as a value instead of a revert: 'valid' or why not, and given a
|
|
414
|
+
* handle, whether the acp may read it (see `ACPAccessStatus`).
|
|
415
|
+
*/
|
|
416
|
+
checkAccessOnChain: (acp: ACP, publicClient: PublicClient, handle?: bigint | Hex) => Promise<ACPAccessStatus>;
|
|
405
417
|
};
|
|
406
418
|
|
|
407
|
-
|
|
419
|
+
declare const getAclAddress: (publicClient: PublicClient) => Promise<Hex>;
|
|
420
|
+
interface AclServedAddresses {
|
|
421
|
+
defaultRevoker?: Hex;
|
|
422
|
+
shareRegistry?: Hex;
|
|
423
|
+
}
|
|
424
|
+
/** Test hook: forget resolved addresses (e.g. between redeployments on one chainId). */
|
|
425
|
+
declare const clearAclServedAddresses: () => void;
|
|
426
|
+
/**
|
|
427
|
+
* The ACP infrastructure addresses the chain's ACL serves (CoFHEAddressBook ->
|
|
428
|
+
* TaskManager -> acl() -> getters). Zero addresses and pre-upgrade ACLs (getters absent -> revert)
|
|
429
|
+
* resolve to `undefined` — callers fall back to `acp.*` config.
|
|
430
|
+
*
|
|
431
|
+
* Resolutions are cached per chainId. A failure to reach the TaskManager (network
|
|
432
|
+
* error, no CoFHE deployment) is NOT cached, so a transient outage does not pin
|
|
433
|
+
* an empty result for the whole session.
|
|
434
|
+
*/
|
|
435
|
+
declare const getAclServedAddresses: (publicClient: PublicClient, chainId: number) => Promise<AclServedAddresses>;
|
|
436
|
+
|
|
437
|
+
export { type ACP as A, type ACPHashFields as B, type CreateSelfACPOptions as C, type Expand as D, type EIP712Types as E, GenerateSealingKey as G, type ImportSharedACPOptions as I, type RecipientACP as R, type SerializedACP as S, type ValidationResult as V, type ACPPublic as a, type ACPSignaturePrimaryType as b, type EIP712Message as c, type CreateSharingACPOptions as d, type ACPMetadata as e, type SharedACP as f, type IncomingShare as g, type EIP712Domain as h, ACPUtils as i, getAclAddress as j, getAclServedAddresses as k, clearAclServedAddresses as l, type AclServedAddresses as m, type SealingKeyPair as n, type EthEncryptedData as o, type EIP712Type as p, type ACPPrivate as q, type ACPType as r, seal as s, type ACPOf as t, unsealWithPrivateKey as u, type SelfACP as v, type SharingACP as w, ACPScope as x, type ACPScopeOptions as y, type ACPAccessStatus as z };
|
|
@@ -235,6 +235,13 @@ type SharedACP = Expand<Omit<ACPPublic, 'sealingKey' | 'recipientSignature'> & {
|
|
|
235
235
|
name: string;
|
|
236
236
|
type: 'sharing';
|
|
237
237
|
}>;
|
|
238
|
+
/**
|
|
239
|
+
* An ACP on-chain status, as `client.acp.checkAccess` reports it instead of a revert.
|
|
240
|
+
* Without a handle: 'valid' or the reason it is not. With a handle, a valid ACP reports
|
|
241
|
+
* 'allowed', 'out-of-scope' (the ACP scope does not cover the handle) or
|
|
242
|
+
* 'issuer-not-allowed' (the issuer itself may not read the handle, so no ACP of theirs can).
|
|
243
|
+
*/
|
|
244
|
+
type ACPAccessStatus = 'valid' | 'allowed' | 'out-of-scope' | 'issuer-not-allowed' | 'expired' | 'revoked' | 'invalid-issuer-signature' | 'invalid-recipient-signature';
|
|
238
245
|
/**
|
|
239
246
|
* A share read back from the on-chain ACPShareRegistry: the posted payload
|
|
240
247
|
* (SharedACP minus the client-side name/type) plus its registry id.
|
|
@@ -402,6 +409,29 @@ declare const ACPUtils: {
|
|
|
402
409
|
* Check if acp passes the on-chain validation
|
|
403
410
|
*/
|
|
404
411
|
checkValidityOnChain: (acp: ACP, publicClient: PublicClient) => Promise<boolean>;
|
|
412
|
+
/**
|
|
413
|
+
* The acp on-chain status as a value instead of a revert: 'valid' or why not, and given a
|
|
414
|
+
* handle, whether the acp may read it (see `ACPAccessStatus`).
|
|
415
|
+
*/
|
|
416
|
+
checkAccessOnChain: (acp: ACP, publicClient: PublicClient, handle?: bigint | Hex) => Promise<ACPAccessStatus>;
|
|
405
417
|
};
|
|
406
418
|
|
|
407
|
-
|
|
419
|
+
declare const getAclAddress: (publicClient: PublicClient) => Promise<Hex>;
|
|
420
|
+
interface AclServedAddresses {
|
|
421
|
+
defaultRevoker?: Hex;
|
|
422
|
+
shareRegistry?: Hex;
|
|
423
|
+
}
|
|
424
|
+
/** Test hook: forget resolved addresses (e.g. between redeployments on one chainId). */
|
|
425
|
+
declare const clearAclServedAddresses: () => void;
|
|
426
|
+
/**
|
|
427
|
+
* The ACP infrastructure addresses the chain's ACL serves (CoFHEAddressBook ->
|
|
428
|
+
* TaskManager -> acl() -> getters). Zero addresses and pre-upgrade ACLs (getters absent -> revert)
|
|
429
|
+
* resolve to `undefined` — callers fall back to `acp.*` config.
|
|
430
|
+
*
|
|
431
|
+
* Resolutions are cached per chainId. A failure to reach the TaskManager (network
|
|
432
|
+
* error, no CoFHE deployment) is NOT cached, so a transient outage does not pin
|
|
433
|
+
* an empty result for the whole session.
|
|
434
|
+
*/
|
|
435
|
+
declare const getAclServedAddresses: (publicClient: PublicClient, chainId: number) => Promise<AclServedAddresses>;
|
|
436
|
+
|
|
437
|
+
export { type ACP as A, type ACPHashFields as B, type CreateSelfACPOptions as C, type Expand as D, type EIP712Types as E, GenerateSealingKey as G, type ImportSharedACPOptions as I, type RecipientACP as R, type SerializedACP as S, type ValidationResult as V, type ACPPublic as a, type ACPSignaturePrimaryType as b, type EIP712Message as c, type CreateSharingACPOptions as d, type ACPMetadata as e, type SharedACP as f, type IncomingShare as g, type EIP712Domain as h, ACPUtils as i, getAclAddress as j, getAclServedAddresses as k, clearAclServedAddresses as l, type AclServedAddresses as m, type SealingKeyPair as n, type EthEncryptedData as o, type EIP712Type as p, type ACPPrivate as q, type ACPType as r, seal as s, type ACPOf as t, unsealWithPrivateKey as u, type SelfACP as v, type SharingACP as w, ACPScope as x, type ACPScopeOptions as y, type ACPAccessStatus as z };
|