@0xpolygonid/js-sdk 1.28.0 → 1.29.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/README.md +1 -1
- package/dist/browser/esm/index.js +1288 -405
- package/dist/browser/esm/index.js.map +1 -1
- package/dist/browser/umd/index.js +24155 -23269
- package/dist/browser/umd/index.js.map +1 -1
- package/dist/node/cjs/iden3comm/constants.js +3 -1
- package/dist/node/cjs/iden3comm/handlers/common.js +63 -1
- package/dist/node/cjs/iden3comm/handlers/contract-request.js +64 -7
- package/dist/node/cjs/iden3comm/handlers/index.js +1 -0
- package/dist/node/cjs/iden3comm/handlers/problem-report.js +55 -0
- package/dist/node/cjs/iden3comm/types/index.js +1 -0
- package/dist/node/cjs/iden3comm/types/protocol/contract-request.js +6 -0
- package/dist/node/cjs/iden3comm/types/protocol/problem-report.js +2 -0
- package/dist/node/cjs/iden3comm/utils/contract-request.utils.js +16 -1
- package/dist/node/cjs/proof/proof-service.js +26 -0
- package/dist/node/cjs/schema-processor/jsonld/cache.js +15 -0
- package/dist/node/cjs/storage/blockchain/onchain-zkp-verifier.js +107 -16
- package/dist/node/cjs/storage/blockchain/state.js +5 -6
- package/dist/node/cjs/verifiable/constants.js +5 -2
- package/dist/node/esm/iden3comm/constants.js +3 -1
- package/dist/node/esm/iden3comm/handlers/common.js +62 -2
- package/dist/node/esm/iden3comm/handlers/contract-request.js +66 -9
- package/dist/node/esm/iden3comm/handlers/index.js +1 -0
- package/dist/node/esm/iden3comm/handlers/problem-report.js +28 -0
- package/dist/node/esm/iden3comm/types/index.js +1 -0
- package/dist/node/esm/iden3comm/types/protocol/contract-request.js +5 -1
- package/dist/node/esm/iden3comm/types/protocol/problem-report.js +1 -0
- package/dist/node/esm/iden3comm/utils/contract-request.utils.js +14 -1
- package/dist/node/esm/proof/proof-service.js +26 -0
- package/dist/node/esm/schema-processor/jsonld/cache.js +15 -0
- package/dist/node/esm/storage/blockchain/onchain-zkp-verifier.js +107 -16
- package/dist/node/esm/storage/blockchain/state.js +5 -6
- package/dist/node/esm/verifiable/constants.js +5 -2
- package/dist/types/iden3comm/constants.d.ts +1 -0
- package/dist/types/iden3comm/handlers/common.d.ts +16 -1
- package/dist/types/iden3comm/handlers/contract-request.d.ts +3 -1
- package/dist/types/iden3comm/handlers/index.d.ts +1 -0
- package/dist/types/iden3comm/handlers/problem-report.d.ts +17 -0
- package/dist/types/iden3comm/types/index.d.ts +1 -0
- package/dist/types/iden3comm/types/protocol/auth.d.ts +8 -0
- package/dist/types/iden3comm/types/protocol/contract-request.d.ts +12 -0
- package/dist/types/iden3comm/types/protocol/problem-report.d.ts +16 -0
- package/dist/types/iden3comm/utils/contract-request.utils.d.ts +7 -0
- package/dist/types/proof/proof-service.d.ts +14 -2
- package/dist/types/storage/blockchain/onchain-zkp-verifier.d.ts +10 -3
- package/dist/types/storage/interfaces/onchain-zkp-verifier.d.ts +18 -1
- package/dist/types/verifiable/constants.d.ts +3 -0
- package/package.json +3 -2
|
@@ -4,6 +4,7 @@ import { byteEncoder } from '../../utils';
|
|
|
4
4
|
import abi from './abi/State.json';
|
|
5
5
|
import { DID, getChainId, Id } from '@iden3/js-iden3-core';
|
|
6
6
|
import { TransactionService } from '../../blockchain';
|
|
7
|
+
import { prepareZkpProof } from '../../iden3comm/utils';
|
|
7
8
|
export /** @type {EthConnectionConfig} - default configuration for EthConnectionConfig */ const defaultEthConnectionConfig = {
|
|
8
9
|
url: 'http://localhost:8545',
|
|
9
10
|
defaultGasLimit: 600000,
|
|
@@ -73,17 +74,15 @@ export class EthStateStorage {
|
|
|
73
74
|
const { userId, oldUserState, newUserState, isOldStateGenesis } = stateTransitionPubSig;
|
|
74
75
|
const { stateContract, provider } = this.getStateContractAndProviderForId(userId.bigInt());
|
|
75
76
|
const contract = stateContract.connect(signer);
|
|
77
|
+
const preparedZkpProof = prepareZkpProof(proof.proof);
|
|
76
78
|
const payload = [
|
|
77
79
|
userId.bigInt().toString(),
|
|
78
80
|
oldUserState.bigInt().toString(),
|
|
79
81
|
newUserState.bigInt().toString(),
|
|
80
82
|
isOldStateGenesis,
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
[proof.proof.pi_b[1][1], proof.proof.pi_b[1][0]]
|
|
85
|
-
],
|
|
86
|
-
proof.proof.pi_c.slice(0, 2)
|
|
83
|
+
preparedZkpProof.a,
|
|
84
|
+
preparedZkpProof.b,
|
|
85
|
+
preparedZkpProof.c
|
|
87
86
|
];
|
|
88
87
|
const feeData = await provider.getFeeData();
|
|
89
88
|
const maxFeePerGas = defaultEthConnectionConfig.maxFeePerGas
|
|
@@ -20,7 +20,9 @@ export const VerifiableConstants = Object.freeze({
|
|
|
20
20
|
IDEN3_DISPLAY_METHOD: 'https://schema.iden3.io/core/jsonld/displayMethod.jsonld',
|
|
21
21
|
// JSONLDSchemaW3CCredential2018 is a schema for context with VerifiableCredential type
|
|
22
22
|
W3C_CREDENTIAL_2018: 'https://www.w3.org/2018/credentials/v1',
|
|
23
|
-
W3C_VC_DOCUMENT_2018: `{"@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","VerifiableCredential":{"@id":"https://www.w3.org/2018/credentials#VerifiableCredential","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","cred":"https://www.w3.org/2018/credentials#","sec":"https://w3id.org/security#","xsd":"http://www.w3.org/2001/XMLSchema#","credentialSchema":{"@id":"cred:credentialSchema","@type":"@id","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","cred":"https://www.w3.org/2018/credentials#","JsonSchemaValidator2018":"cred:JsonSchemaValidator2018"}},"credentialStatus":{"@id":"cred:credentialStatus","@type":"@id"},"credentialSubject":{"@id":"cred:credentialSubject","@type":"@id"},"evidence":{"@id":"cred:evidence","@type":"@id"},"expirationDate":{"@id":"cred:expirationDate","@type":"xsd:dateTime"},"holder":{"@id":"cred:holder","@type":"@id"},"issued":{"@id":"cred:issued","@type":"xsd:dateTime"},"issuer":{"@id":"cred:issuer","@type":"@id"},"issuanceDate":{"@id":"cred:issuanceDate","@type":"xsd:dateTime"},"proof":{"@id":"sec:proof","@type":"@id","@container":"@graph"},"refreshService":{"@id":"cred:refreshService","@type":"@id","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","cred":"https://www.w3.org/2018/credentials#","ManualRefreshService2018":"cred:ManualRefreshService2018"}},"termsOfUse":{"@id":"cred:termsOfUse","@type":"@id"},"validFrom":{"@id":"cred:validFrom","@type":"xsd:dateTime"},"validUntil":{"@id":"cred:validUntil","@type":"xsd:dateTime"}}},"VerifiablePresentation":{"@id":"https://www.w3.org/2018/credentials#VerifiablePresentation","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","cred":"https://www.w3.org/2018/credentials#","sec":"https://w3id.org/security#","holder":{"@id":"cred:holder","@type":"@id"},"proof":{"@id":"sec:proof","@type":"@id","@container":"@graph"},"verifiableCredential":{"@id":"cred:verifiableCredential","@type":"@id","@container":"@graph"}}},"EcdsaSecp256k1Signature2019":{"@id":"https://w3id.org/security#EcdsaSecp256k1Signature2019","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","xsd":"http://www.w3.org/2001/XMLSchema#","challenge":"sec:challenge","created":{"@id":"http://purl.org/dc/terms/created","@type":"xsd:dateTime"},"domain":"sec:domain","expires":{"@id":"sec:expiration","@type":"xsd:dateTime"},"jws":"sec:jws","nonce":"sec:nonce","proofPurpose":{"@id":"sec:proofPurpose","@type":"@vocab","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","assertionMethod":{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},"authentication":{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"}}},"proofValue":"sec:proofValue","verificationMethod":{"@id":"sec:verificationMethod","@type":"@id"}}},"EcdsaSecp256r1Signature2019":{"@id":"https://w3id.org/security#EcdsaSecp256r1Signature2019","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","xsd":"http://www.w3.org/2001/XMLSchema#","challenge":"sec:challenge","created":{"@id":"http://purl.org/dc/terms/created","@type":"xsd:dateTime"},"domain":"sec:domain","expires":{"@id":"sec:expiration","@type":"xsd:dateTime"},"jws":"sec:jws","nonce":"sec:nonce","proofPurpose":{"@id":"sec:proofPurpose","@type":"@vocab","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","assertionMethod":{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},"authentication":{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"}}},"proofValue":"sec:proofValue","verificationMethod":{"@id":"sec:verificationMethod","@type":"@id"}}},"Ed25519Signature2018":{"@id":"https://w3id.org/security#Ed25519Signature2018","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","xsd":"http://www.w3.org/2001/XMLSchema#","challenge":"sec:challenge","created":{"@id":"http://purl.org/dc/terms/created","@type":"xsd:dateTime"},"domain":"sec:domain","expires":{"@id":"sec:expiration","@type":"xsd:dateTime"},"jws":"sec:jws","nonce":"sec:nonce","proofPurpose":{"@id":"sec:proofPurpose","@type":"@vocab","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","assertionMethod":{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},"authentication":{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"}}},"proofValue":"sec:proofValue","verificationMethod":{"@id":"sec:verificationMethod","@type":"@id"}}},"RsaSignature2018":{"@id":"https://w3id.org/security#RsaSignature2018","@context":{"@version":1.1,"@protected":true,"challenge":"sec:challenge","created":{"@id":"http://purl.org/dc/terms/created","@type":"xsd:dateTime"},"domain":"sec:domain","expires":{"@id":"sec:expiration","@type":"xsd:dateTime"},"jws":"sec:jws","nonce":"sec:nonce","proofPurpose":{"@id":"sec:proofPurpose","@type":"@vocab","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","assertionMethod":{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},"authentication":{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"}}},"proofValue":"sec:proofValue","verificationMethod":{"@id":"sec:verificationMethod","@type":"@id"}}},"proof":{"@id":"https://w3id.org/security#proof","@type":"@id","@container":"@graph"}}}
|
|
23
|
+
W3C_VC_DOCUMENT_2018: `{"@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","VerifiableCredential":{"@id":"https://www.w3.org/2018/credentials#VerifiableCredential","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","cred":"https://www.w3.org/2018/credentials#","sec":"https://w3id.org/security#","xsd":"http://www.w3.org/2001/XMLSchema#","credentialSchema":{"@id":"cred:credentialSchema","@type":"@id","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","cred":"https://www.w3.org/2018/credentials#","JsonSchemaValidator2018":"cred:JsonSchemaValidator2018"}},"credentialStatus":{"@id":"cred:credentialStatus","@type":"@id"},"credentialSubject":{"@id":"cred:credentialSubject","@type":"@id"},"evidence":{"@id":"cred:evidence","@type":"@id"},"expirationDate":{"@id":"cred:expirationDate","@type":"xsd:dateTime"},"holder":{"@id":"cred:holder","@type":"@id"},"issued":{"@id":"cred:issued","@type":"xsd:dateTime"},"issuer":{"@id":"cred:issuer","@type":"@id"},"issuanceDate":{"@id":"cred:issuanceDate","@type":"xsd:dateTime"},"proof":{"@id":"sec:proof","@type":"@id","@container":"@graph"},"refreshService":{"@id":"cred:refreshService","@type":"@id","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","cred":"https://www.w3.org/2018/credentials#","ManualRefreshService2018":"cred:ManualRefreshService2018"}},"termsOfUse":{"@id":"cred:termsOfUse","@type":"@id"},"validFrom":{"@id":"cred:validFrom","@type":"xsd:dateTime"},"validUntil":{"@id":"cred:validUntil","@type":"xsd:dateTime"}}},"VerifiablePresentation":{"@id":"https://www.w3.org/2018/credentials#VerifiablePresentation","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","cred":"https://www.w3.org/2018/credentials#","sec":"https://w3id.org/security#","holder":{"@id":"cred:holder","@type":"@id"},"proof":{"@id":"sec:proof","@type":"@id","@container":"@graph"},"verifiableCredential":{"@id":"cred:verifiableCredential","@type":"@id","@container":"@graph"}}},"EcdsaSecp256k1Signature2019":{"@id":"https://w3id.org/security#EcdsaSecp256k1Signature2019","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","xsd":"http://www.w3.org/2001/XMLSchema#","challenge":"sec:challenge","created":{"@id":"http://purl.org/dc/terms/created","@type":"xsd:dateTime"},"domain":"sec:domain","expires":{"@id":"sec:expiration","@type":"xsd:dateTime"},"jws":"sec:jws","nonce":"sec:nonce","proofPurpose":{"@id":"sec:proofPurpose","@type":"@vocab","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","assertionMethod":{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},"authentication":{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"}}},"proofValue":"sec:proofValue","verificationMethod":{"@id":"sec:verificationMethod","@type":"@id"}}},"EcdsaSecp256r1Signature2019":{"@id":"https://w3id.org/security#EcdsaSecp256r1Signature2019","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","xsd":"http://www.w3.org/2001/XMLSchema#","challenge":"sec:challenge","created":{"@id":"http://purl.org/dc/terms/created","@type":"xsd:dateTime"},"domain":"sec:domain","expires":{"@id":"sec:expiration","@type":"xsd:dateTime"},"jws":"sec:jws","nonce":"sec:nonce","proofPurpose":{"@id":"sec:proofPurpose","@type":"@vocab","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","assertionMethod":{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},"authentication":{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"}}},"proofValue":"sec:proofValue","verificationMethod":{"@id":"sec:verificationMethod","@type":"@id"}}},"Ed25519Signature2018":{"@id":"https://w3id.org/security#Ed25519Signature2018","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","xsd":"http://www.w3.org/2001/XMLSchema#","challenge":"sec:challenge","created":{"@id":"http://purl.org/dc/terms/created","@type":"xsd:dateTime"},"domain":"sec:domain","expires":{"@id":"sec:expiration","@type":"xsd:dateTime"},"jws":"sec:jws","nonce":"sec:nonce","proofPurpose":{"@id":"sec:proofPurpose","@type":"@vocab","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","assertionMethod":{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},"authentication":{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"}}},"proofValue":"sec:proofValue","verificationMethod":{"@id":"sec:verificationMethod","@type":"@id"}}},"RsaSignature2018":{"@id":"https://w3id.org/security#RsaSignature2018","@context":{"@version":1.1,"@protected":true,"challenge":"sec:challenge","created":{"@id":"http://purl.org/dc/terms/created","@type":"xsd:dateTime"},"domain":"sec:domain","expires":{"@id":"sec:expiration","@type":"xsd:dateTime"},"jws":"sec:jws","nonce":"sec:nonce","proofPurpose":{"@id":"sec:proofPurpose","@type":"@vocab","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","assertionMethod":{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},"authentication":{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"}}},"proofValue":"sec:proofValue","verificationMethod":{"@id":"sec:verificationMethod","@type":"@id"}}},"proof":{"@id":"https://w3id.org/security#proof","@type":"@id","@container":"@graph"}}}`,
|
|
24
|
+
IDEN3_PROOFS_DEFINITION_DOCUMENT: `{"@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","Iden3SparseMerkleTreeProof":{"@id":"https://schema.iden3.io/core/jsonld/iden3proofs.jsonld#Iden3SparseMerkleTreeProof","@context":{"@version":1.1,"@protected":true,"@propagate":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","@vocab":"https://schema.iden3.io/core/vocab/Iden3SparseMerkleTreeProof.md#","xsd":"http://www.w3.org/2001/XMLSchema#","mtp":{"@id":"https://schema.iden3.io/core/jsonld/iden3proofs.jsonld#SparseMerkleTreeProof","@type":"SparseMerkleTreeProof"},"coreClaim":{"@id":"coreClaim","@type":"xsd:string"},"issuerData":{"@id":"issuerData","@context":{"@version":1.1,"state":{"@id":"state","@context":{"txId":{"@id":"txId","@type":"xsd:string"},"blockTimestamp":{"@id":"blockTimestamp","@type":"xsd:integer"},"blockNumber":{"@id":"blockNumber","@type":"xsd:integer"},"rootOfRoots":{"@id":"rootOfRoots","@type":"xsd:string"},"claimsTreeRoot":{"@id":"claimsTreeRoot","@type":"xsd:string"},"revocationTreeRoot":{"@id":"revocationTreeRoot","@type":"xsd:string"},"authCoreClaim":{"@id":"authCoreClaim","@type":"xsd:string"},"value":{"@id":"value","@type":"xsd:string"}}}}}}},"SparseMerkleTreeProof":{"@id":"https://schema.iden3.io/core/jsonld/iden3proofs.jsonld#SparseMerkleTreeProof","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","smt-proof-vocab":"https://schema.iden3.io/core/vocab/SparseMerkleTreeProof.md#","xsd":"http://www.w3.org/2001/XMLSchema#","existence":{"@id":"smt-proof-vocab:existence","@type":"xsd:boolean"},"revocationNonce":{"@id":"smt-proof-vocab:revocationNonce","@type":"xsd:number"},"siblings":{"@id":"smt-proof-vocab:siblings","@container":"@list"},"nodeAux":"@nest","hIndex":{"@id":"smt-proof-vocab:hIndex","@nest":"nodeAux","@type":"xsd:string"},"hValue":{"@id":"smt-proof-vocab:hValue","@nest":"nodeAux","@type":"xsd:string"}}},"BJJSignature2021":{"@id":"https://schema.iden3.io/core/jsonld/iden3proofs.jsonld#BJJSignature2021","@context":{"@version":1.1,"@protected":true,"id":"@id","@vocab":"https://schema.iden3.io/core/vocab/BJJSignature2021.md#","@propagate":true,"type":"@type","xsd":"http://www.w3.org/2001/XMLSchema#","coreClaim":{"@id":"coreClaim","@type":"xsd:string"},"issuerData":{"@id":"issuerData","@context":{"@version":1.1,"authCoreClaim":{"@id":"authCoreClaim","@type":"xsd:string"},"mtp":{"@id":"https://schema.iden3.io/core/jsonld/iden3proofs.jsonld#SparseMerkleTreeProof","@type":"SparseMerkleTreeProof"},"revocationStatus":{"@id":"revocationStatus","@type":"@id"},"state":{"@id":"state","@context":{"@version":1.1,"rootOfRoots":{"@id":"rootOfRoots","@type":"xsd:string"},"claimsTreeRoot":{"@id":"claimsTreeRoot","@type":"xsd:string"},"revocationTreeRoot":{"@id":"revocationTreeRoot","@type":"xsd:string"},"value":{"@id":"value","@type":"xsd:string"}}}}},"signature":{"@id":"signature","@type":"https://w3id.org/security#multibase"},"domain":"https://w3id.org/security#domain","creator":{"@id":"creator","@type":"http://www.w3.org/2001/XMLSchema#string"},"challenge":"https://w3id.org/security#challenge","created":{"@id":"created","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},"expires":{"@id":"https://w3id.org/security#expiration","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},"nonce":"https://w3id.org/security#nonce","proofPurpose":{"@id":"https://w3id.org/security#proofPurpose","@type":"@vocab","@context":{"@protected":true,"id":"@id","type":"@type","assertionMethod":{"@id":"https://w3id.org/security#assertionMethod","@type":"@id","@container":"@set"},"authentication":{"@id":"https://w3id.org/security#authenticationMethod","@type":"@id","@container":"@set"},"capabilityInvocation":{"@id":"https://w3id.org/security#capabilityInvocationMethod","@type":"@id","@container":"@set"},"capabilityDelegation":{"@id":"https://w3id.org/security#capabilityDelegationMethod","@type":"@id","@container":"@set"},"keyAgreement":{"@id":"https://w3id.org/security#keyAgreementMethod","@type":"@id","@container":"@set"}}},"proofValue":{"@id":"https://w3id.org/security#proofValue","@type":"https://w3id.org/security#multibase"},"verificationMethod":{"@id":"https://w3id.org/security#verificationMethod","@type":"@id"}}},"Iden3ReverseSparseMerkleTreeProof":{"@id":"https://schema.iden3.io/core/jsonld/iden3proofs.jsonld#Iden3ReverseSparseMerkleTreeProof","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","iden3-reverse-sparse-merkle-tree-proof-vocab":"https://schema.iden3.io/core/vocab/Iden3ReverseSparseMerkleTreeProof.md#","revocationNonce":"iden3-reverse-sparse-merkle-tree-proof-vocab:revocationNonce","statusIssuer":{"@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type"},"@id":"iden3-reverse-sparse-merkle-tree-proof-vocab:statusIssuer"}}},"Iden3commRevocationStatusV1.0":{"@id":"https://schema.iden3.io/core/jsonld/iden3proofs.jsonld#Iden3commRevocationStatusV1.0","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","iden3-comm-revocation-statusV1.0-vocab":"https://schema.iden3.io/core/vocab/Iden3commRevocationStatusV1.0.md#","revocationNonce":"iden3-comm-revocation-statusV1.0-vocab:revocationNonce","statusIssuer":{"@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type"},"@id":"iden3-comm-revocation-statusV1.0-vocab:statusIssuer"}}},"Iden3OnchainSparseMerkleTreeProof2023":{"@id":"https://schema.iden3.io/core/jsonld/iden3proofs.jsonld#Iden3OnchainSparseMerkleTreeProof2023","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","iden3-onchain-sparse-merkle-tree-proof-2023-vocab":"https://schema.iden3.io/core/vocab/Iden3OnchainSparseMerkleTreeProof2023.md#","revocationNonce":"iden3-onchain-sparse-merkle-tree-proof-2023-vocab:revocationNonce","statusIssuer":{"@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type"},"@id":"iden3-onchain-sparse-merkle-tree-proof-2023-vocab:statusIssuer"}}},"JsonSchema2023":"https://www.w3.org/ns/credentials#JsonSchema2023","Iden3RefreshService2023":"https://schema.iden3.io/core/jsonld/iden3proofs.jsonld#Iden3RefreshService2023"}}`,
|
|
25
|
+
IDEN3_DISPLAY_METHOD_DEFINITION_DOCUMENT: `{"@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","displayMethod":{"@id":"https://schema.iden3.io/core/vocab/displayMethod.md#displayMethod","@type":"@id","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","Iden3BasicDisplayMethodV1":"https://schema.iden3.io/core/vocab/displayMethod.md#Iden3BasicDisplayMethodV1"}}}}`
|
|
24
26
|
},
|
|
25
27
|
// JsonSchema2023 JSON schema for verification of Iden3Credential
|
|
26
28
|
JSON_SCHEMA_VALIDATOR: 'JsonSchema2023',
|
|
@@ -35,7 +37,8 @@ export const VerifiableConstants = Object.freeze({
|
|
|
35
37
|
AUTH_BJJ_CREDENTIAL_SCHEMA_JSON_URL: 'https://schema.iden3.io/core/json/auth.json',
|
|
36
38
|
AUTH_BJJ_CREDENTIAL_SCHEMA_JSONLD_URL: 'https://schema.iden3.io/core/jsonld/auth.jsonld',
|
|
37
39
|
AUTH_BJJ_CREDENTIAL_TYPE: 'AuthBJJCredential',
|
|
38
|
-
AUTH_BJJ_CREDENTIAL_SCHEMA_JSON: `{"$schema":"http://json-schema.org/draft-07/schema#","$metadata":{"uris":{"jsonLdContext":"https://schema.iden3.io/core/jsonld/auth.jsonld","jsonSchema":"https://schema.iden3.io/core/json/auth.json"},"serialization":{"indexDataSlotA":"x","indexDataSlotB":"y"}},"type":"object","required":["@context","id","type","issuanceDate","credentialSubject","credentialSchema","credentialStatus","issuer"],"properties":{"@context":{"type":["string","array","object"]},"id":{"type":"string"},"type":{"type":["string","array"],"items":{"type":"string"}},"issuer":{"type":["string","object"],"format":"uri","required":["id"],"properties":{"id":{"type":"string","format":"uri"}}},"issuanceDate":{"type":"string","format":"date-time"},"expirationDate":{"type":"string","format":"date-time"},"credentialSchema":{"type":"object","required":["id","type"],"properties":{"id":{"type":"string","format":"uri"},"type":{"type":"string"}}},"credentialSubject":{"type":"object","required":["x","y"],"properties":{"id":{"title":"Credential Subject ID","type":"string","format":"uri"},"x":{"type":"string"},"y":{"type":"string"}}}}}
|
|
40
|
+
AUTH_BJJ_CREDENTIAL_SCHEMA_JSON: `{"$schema":"http://json-schema.org/draft-07/schema#","$metadata":{"uris":{"jsonLdContext":"https://schema.iden3.io/core/jsonld/auth.jsonld","jsonSchema":"https://schema.iden3.io/core/json/auth.json"},"serialization":{"indexDataSlotA":"x","indexDataSlotB":"y"}},"type":"object","required":["@context","id","type","issuanceDate","credentialSubject","credentialSchema","credentialStatus","issuer"],"properties":{"@context":{"type":["string","array","object"]},"id":{"type":"string"},"type":{"type":["string","array"],"items":{"type":"string"}},"issuer":{"type":["string","object"],"format":"uri","required":["id"],"properties":{"id":{"type":"string","format":"uri"}}},"issuanceDate":{"type":"string","format":"date-time"},"expirationDate":{"type":"string","format":"date-time"},"credentialSchema":{"type":"object","required":["id","type"],"properties":{"id":{"type":"string","format":"uri"},"type":{"type":"string"}}},"credentialSubject":{"type":"object","required":["x","y"],"properties":{"id":{"title":"Credential Subject ID","type":"string","format":"uri"},"x":{"type":"string"},"y":{"type":"string"}}}}}`,
|
|
41
|
+
AUTH_BJJ_CREDENTIAL_SCHEMA_JSONLD: `{"@context":[{"@version":1.1,"@protected":true,"id":"@id","type":"@type","AuthBJJCredential":{"@id":"https://schema.iden3.io/core/jsonld/auth.jsonld#AuthBJJCredential","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","iden3_serialization":"iden3:v1:slotIndexA=x&slotIndexB=y","xsd":"http://www.w3.org/2001/XMLSchema#","auth-vocab":"https://schema.iden3.io/core/vocab/auth.md#","x":{"@id":"auth-vocab:x","@type":"xsd:positiveInteger"},"y":{"@id":"auth-vocab:y","@type":"xsd:positiveInteger"}}},"Iden3StateInfo2023":{"@id":"https://schema.iden3.io/core/jsonld/auth.jsonld#Iden3StateInfo2023","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","xsd":"http://www.w3.org/2001/XMLSchema#","@vocab":"https://schema.iden3.io/core/vocab/state-info.md#","@propagate":true,"stateContractAddress":{"@id":"stateContractAddress","@type":"xsd:string"},"published":{"@id":"published","@type":"xsd:boolean"},"info":{"@id":"info","@type":"@id","@context":{"@protected":true,"id":{"@id":"id","@type":"xsd:string"},"state":{"@id":"state","@type":"xsd:string"},"replacedByState":{"@id":"replacedByState","@type":"xsd:string"},"createdAtTimestamp":{"@id":"createdAtTimestamp","@type":"xsd:string"},"replacedAtTimestamp":{"@id":"replacedAtTimestamp","@type":"xsd:string"},"createdAtBlock":{"@id":"createdAtBlock","@type":"xsd:string"},"replacedAtBlock":{"@id":"replacedAtBlock","@type":"xsd:string"}}},"global":{"@id":"global","@type":"@id","@context":{"@protected":true,"sec":"https://w3id.org/security#","root":{"@id":"root","@type":"xsd:string"},"replacedByRoot":{"@id":"replacedByRoot","@type":"xsd:string"},"createdAtTimestamp":{"@id":"createdAtTimestamp","@type":"xsd:string"},"replacedAtTimestamp":{"@id":"replacedAtTimestamp","@type":"xsd:string"},"createdAtBlock":{"@id":"createdAtBlock","@type":"xsd:string"},"replacedAtBlock":{"@id":"replacedAtBlock","@type":"xsd:string"},"proof":{"@id":"sec:proof","@type":"@id","@container":"@graph"}}}}}}]}`
|
|
39
42
|
}
|
|
40
43
|
});
|
|
41
44
|
/**
|
|
@@ -25,6 +25,7 @@ export declare const PROTOCOL_MESSAGE_TYPE: Readonly<{
|
|
|
25
25
|
PAYMENT_MESSAGE_TYPE: "https://iden3-communication.io/credentials/0.1/payment";
|
|
26
26
|
DISCOVERY_PROTOCOL_QUERIES_MESSAGE_TYPE: "https://didcomm.org/discover-features/2.0/queries";
|
|
27
27
|
DISCOVERY_PROTOCOL_DISCLOSE_MESSAGE_TYPE: "https://didcomm.org/discover-features/2.0/disclose";
|
|
28
|
+
PROBLEM_REPORT_MESSAGE_TYPE: "https://didcomm.org/report-problem/2.0/problem-report";
|
|
28
29
|
}>;
|
|
29
30
|
/**
|
|
30
31
|
* Media types for iden3 comm communication protocol
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BasicMessage, JWSPackerParams, ZeroKnowledgeProofRequest, ZeroKnowledgeProofResponse } from '../types';
|
|
1
|
+
import { AcceptProfile, AuthProofResponse, BasicMessage, JWSPackerParams, ZeroKnowledgeProofRequest, ZeroKnowledgeProofResponse } from '../types';
|
|
2
2
|
import { DID } from '@iden3/js-iden3-core';
|
|
3
3
|
import { IProofService } from '../../proof';
|
|
4
4
|
import { CircuitId } from '../../circuits';
|
|
@@ -21,9 +21,24 @@ export declare const processZeroKnowledgeProofRequests: (to: DID, requests: Zero
|
|
|
21
21
|
ethSigner?: Signer;
|
|
22
22
|
challenge?: bigint;
|
|
23
23
|
}) => Promise<ZeroKnowledgeProofResponse[]>;
|
|
24
|
+
/**
|
|
25
|
+
* Processes auth proof requests.
|
|
26
|
+
*
|
|
27
|
+
* @param to - The identifier of the recipient.
|
|
28
|
+
* @param proofService - The proof service.
|
|
29
|
+
* @param opts - Additional options for processing the requests.
|
|
30
|
+
* @returns A promise that resolves to an auth proof response.
|
|
31
|
+
*/
|
|
32
|
+
export declare const processProofAuth: (to: DID, proofService: IProofService, opts: {
|
|
33
|
+
supportedCircuits: CircuitId[];
|
|
34
|
+
acceptProfile?: AcceptProfile;
|
|
35
|
+
challenge?: bigint;
|
|
36
|
+
skipRevocation?: boolean;
|
|
37
|
+
}) => Promise<AuthProofResponse>;
|
|
24
38
|
/**
|
|
25
39
|
* Verifies that the expires_time field of a message is not in the past. Throws an error if it is.
|
|
26
40
|
*
|
|
27
41
|
* @param message - Basic message to verify.
|
|
28
42
|
*/
|
|
29
43
|
export declare const verifyExpiresTime: (message: BasicMessage) => void;
|
|
44
|
+
export declare const packEthIdentityProof: (did: DID) => string;
|
|
@@ -58,11 +58,13 @@ export declare class ContractRequestHandler extends AbstractMessageHandler imple
|
|
|
58
58
|
* @param {IPackageManager} _packerMgr - package manager to unpack message envelope
|
|
59
59
|
* @param {IProofService} _proofService - proof service to verify zk proofs
|
|
60
60
|
* @param {IOnChainZKPVerifier} _zkpVerifier - zkp verifier to submit response
|
|
61
|
+
* @param {IOnChainVerifierMultiQuery} _verifierMultiQuery - verifier multi-query to submit response
|
|
61
62
|
*
|
|
62
63
|
*/
|
|
63
64
|
constructor(_packerMgr: IPackageManager, _proofService: IProofService, _zkpVerifier: IOnChainZKPVerifier);
|
|
64
65
|
handle(message: BasicMessage, ctx: ContractMessageHandlerOptions): Promise<BasicMessage | null>;
|
|
65
66
|
private handleContractInvoke;
|
|
67
|
+
private getFirstSupportedProfile;
|
|
66
68
|
/**
|
|
67
69
|
* unpacks contract-invoke request
|
|
68
70
|
* @beta
|
|
@@ -75,7 +77,7 @@ export declare class ContractRequestHandler extends AbstractMessageHandler imple
|
|
|
75
77
|
* @private
|
|
76
78
|
* @beta
|
|
77
79
|
* @param {ContractInvokeRequest} request - ContractInvokeRequest
|
|
78
|
-
* @param { Map<string,
|
|
80
|
+
* @param { Map<string, ZeroKnowledgeInvokeResponse>} responses - map tx hash to array of ZeroKnowledgeInvokeResponse
|
|
79
81
|
* @returns `Promise<ContractInvokeResponse>`
|
|
80
82
|
*/
|
|
81
83
|
private createContractInvokeResponse;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ProblemReportMessage } from '../types/protocol/problem-report';
|
|
2
|
+
/**
|
|
3
|
+
* @beta
|
|
4
|
+
* createProblemReportMessage is a function to create didcomm protocol problem report message
|
|
5
|
+
* @param pthid - parent thread id
|
|
6
|
+
* @param code - problem report code
|
|
7
|
+
* @param opts - problem report options
|
|
8
|
+
* @returns `ProblemReportMessage`
|
|
9
|
+
*/
|
|
10
|
+
export declare function createProblemReportMessage(pthid: string, code: string, opts?: {
|
|
11
|
+
comment?: string;
|
|
12
|
+
ack?: string[];
|
|
13
|
+
args?: string[];
|
|
14
|
+
escalate_to?: string;
|
|
15
|
+
from?: string;
|
|
16
|
+
to?: string;
|
|
17
|
+
}): ProblemReportMessage;
|
|
@@ -8,6 +8,7 @@ export * from './protocol/proposal-request';
|
|
|
8
8
|
export * from './protocol/payment';
|
|
9
9
|
export * from './protocol/accept-profile';
|
|
10
10
|
export * from './protocol/discovery-protocol';
|
|
11
|
+
export * from './protocol/problem-report';
|
|
11
12
|
export * from './packer';
|
|
12
13
|
export * from './models';
|
|
13
14
|
export * from './packageManager';
|
|
@@ -5,6 +5,7 @@ import { ProofType } from '../../../verifiable';
|
|
|
5
5
|
import { CircuitId } from '../../../circuits';
|
|
6
6
|
import { DIDDocument as DidResolverDidDocument, VerificationMethod as DidResolverVerificationMethod } from 'did-resolver';
|
|
7
7
|
import { RootInfo, StateInfo } from '../../../storage';
|
|
8
|
+
import { AuthProofResponse } from './contract-request';
|
|
8
9
|
/** AuthorizationResponseMessage is struct the represents iden3message authorization response */
|
|
9
10
|
export type AuthorizationResponseMessage = BasicMessage & {
|
|
10
11
|
body: AuthorizationMessageResponseBody;
|
|
@@ -53,12 +54,19 @@ export type ZeroKnowledgeProofQuery = {
|
|
|
53
54
|
groupId?: number;
|
|
54
55
|
type: string;
|
|
55
56
|
};
|
|
57
|
+
export type ZeroKnowledgeInvokeResponse = {
|
|
58
|
+
responses: ZeroKnowledgeProofResponse[];
|
|
59
|
+
crossChainProofs?: string[];
|
|
60
|
+
authProofs?: AuthProofResponse[];
|
|
61
|
+
};
|
|
56
62
|
/** ZeroKnowledgeProofResponse represents structure of zkp response */
|
|
57
63
|
export type ZeroKnowledgeProofResponse = {
|
|
58
64
|
id: number;
|
|
59
65
|
circuitId: string;
|
|
60
66
|
vp?: VerifiablePresentation;
|
|
61
67
|
} & ZKProof;
|
|
68
|
+
/** ZeroKnowledgeProofAuthResponse represents structure of zkp auth response */
|
|
69
|
+
export type ZeroKnowledgeProofAuthResponse = Omit<ZeroKnowledgeProofResponse, 'id' | 'vp'>;
|
|
62
70
|
/** VerifiablePresentation represents structure of Verifiable Presentation */
|
|
63
71
|
export type VerifiablePresentation = {
|
|
64
72
|
'@context': string | (string | object)[];
|
|
@@ -12,6 +12,7 @@ export type ContractInvokeRequestBody = {
|
|
|
12
12
|
transaction_data: ContractInvokeTransactionData;
|
|
13
13
|
scope: Array<ZeroKnowledgeProofRequest>;
|
|
14
14
|
did_doc?: DIDDocument;
|
|
15
|
+
accept?: string[];
|
|
15
16
|
};
|
|
16
17
|
/** ContractInvokeResponse represents structure of contract invoke response object */
|
|
17
18
|
export type ContractInvokeResponse = BasicMessage & {
|
|
@@ -23,6 +24,8 @@ export type ContractInvokeResponseBody = {
|
|
|
23
24
|
scope: Array<OnChainZeroKnowledgeProofResponse>;
|
|
24
25
|
transaction_data: ContractInvokeTransactionData;
|
|
25
26
|
did_doc?: DIDDocument;
|
|
27
|
+
crossChainProofs?: string[];
|
|
28
|
+
authProofs?: AuthProofResponse[];
|
|
26
29
|
};
|
|
27
30
|
/** OnChainZeroKnowledgeProofResponse represents structure of onchain zero knowledge proof response */
|
|
28
31
|
export type OnChainZeroKnowledgeProofResponse = ZeroKnowledgeProofResponse & {
|
|
@@ -35,3 +38,12 @@ export type ContractInvokeTransactionData = {
|
|
|
35
38
|
chain_id: number;
|
|
36
39
|
network?: string;
|
|
37
40
|
};
|
|
41
|
+
/** AuthProofResponse represents structure of zkp response */
|
|
42
|
+
export type AuthProofResponse = {
|
|
43
|
+
authMethod: AuthMethod;
|
|
44
|
+
proof: string;
|
|
45
|
+
};
|
|
46
|
+
export declare enum AuthMethod {
|
|
47
|
+
AUTHV2 = "authV2",
|
|
48
|
+
ETH_IDENTITY = "ethIdentity"
|
|
49
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PROTOCOL_MESSAGE_TYPE } from '../../constants';
|
|
2
|
+
import { BasicMessage } from '../packer';
|
|
3
|
+
/** ProblemReportMessage is struct for problem report message */
|
|
4
|
+
export type ProblemReportMessage = BasicMessage & {
|
|
5
|
+
body: ProblemReportMessageBody;
|
|
6
|
+
pthid: string;
|
|
7
|
+
ack?: string[];
|
|
8
|
+
type: typeof PROTOCOL_MESSAGE_TYPE.PROBLEM_REPORT_MESSAGE_TYPE;
|
|
9
|
+
};
|
|
10
|
+
/** ProblemReportMessageBody is struct for problem report message body */
|
|
11
|
+
export type ProblemReportMessageBody = {
|
|
12
|
+
code: string;
|
|
13
|
+
comment?: string;
|
|
14
|
+
args?: string[];
|
|
15
|
+
escalate_to?: string;
|
|
16
|
+
};
|
|
@@ -2,6 +2,7 @@ import { CircuitId } from '../../circuits';
|
|
|
2
2
|
import { DID } from '@iden3/js-iden3-core';
|
|
3
3
|
import { IProofService } from '../../proof';
|
|
4
4
|
import { ZeroKnowledgeProofResponse } from '../types';
|
|
5
|
+
import { ProofData } from '@iden3/js-jwz';
|
|
5
6
|
/**
|
|
6
7
|
* @beta
|
|
7
8
|
* Retrieves the request ID from circuit string.
|
|
@@ -18,3 +19,9 @@ export declare function calculateRequestIdForCircuit(circuitId: CircuitId): numb
|
|
|
18
19
|
* @returns A promise that resolves to an array of ZeroKnowledgeProofResponse objects.
|
|
19
20
|
*/
|
|
20
21
|
export declare function prepareAuthV2ZeroKnowledgeResponse(address: string, senderDid: DID, proofService: IProofService): Promise<ZeroKnowledgeProofResponse[]>;
|
|
22
|
+
export declare const packZkpProof: (inputs: string[], a: string[], b: string[][], c: string[]) => string;
|
|
23
|
+
export declare const prepareZkpProof: (proof: ProofData) => {
|
|
24
|
+
a: string[];
|
|
25
|
+
b: string[][];
|
|
26
|
+
c: string[];
|
|
27
|
+
};
|
|
@@ -7,7 +7,7 @@ import { IZKProver } from './provers/prover';
|
|
|
7
7
|
import { Options } from '@iden3/js-jsonld-merklization';
|
|
8
8
|
import { ZKProof } from '@iden3/js-jwz';
|
|
9
9
|
import { Signer } from 'ethers';
|
|
10
|
-
import { StateVerificationOpts, JSONObject, ZeroKnowledgeProofRequest, ZeroKnowledgeProofResponse } from '../iden3comm';
|
|
10
|
+
import { StateVerificationOpts, JSONObject, ZeroKnowledgeProofRequest, ZeroKnowledgeProofResponse, ZeroKnowledgeProofAuthResponse } from '../iden3comm';
|
|
11
11
|
import { ICircuitStorage, IStateStorage } from '../storage';
|
|
12
12
|
import { ProofGenerationOptions } from './provers/inputs-generator';
|
|
13
13
|
import { VerifyOpts } from './verifiers';
|
|
@@ -74,13 +74,23 @@ export interface IProofService {
|
|
|
74
74
|
*/
|
|
75
75
|
generateAuthV2Inputs(hash: Uint8Array, did: DID, circuitId: CircuitId): Promise<Uint8Array>;
|
|
76
76
|
/**
|
|
77
|
-
* generates auth
|
|
77
|
+
* generates auth v2 proof from given identity
|
|
78
78
|
*
|
|
79
79
|
* @param {Uint8Array} hash - challenge that will be signed
|
|
80
80
|
* @param {DID} did - identity that will generate a proof
|
|
81
81
|
* @returns `Promise<ZKProof>`
|
|
82
82
|
*/
|
|
83
83
|
generateAuthV2Proof(hash: Uint8Array, did: DID): Promise<ZKProof>;
|
|
84
|
+
/**
|
|
85
|
+
* Generate auth proof from given identity with generic params
|
|
86
|
+
*
|
|
87
|
+
* @param {CircuitId} circuitId - circuitId for the proof generation
|
|
88
|
+
* @param {DID} identifier - did that will generate proof
|
|
89
|
+
* @param {ProofGenerationOptions} opts - options that will be used for proof generation
|
|
90
|
+
*
|
|
91
|
+
* @returns `Promise<ZeroKnowledgeProofResponse>`
|
|
92
|
+
*/
|
|
93
|
+
generateAuthProof(circuitId: CircuitId, identifier: DID, opts?: ProofGenerationOptions): Promise<ZeroKnowledgeProofAuthResponse>;
|
|
84
94
|
/**
|
|
85
95
|
* state verification function
|
|
86
96
|
*
|
|
@@ -138,6 +148,8 @@ export declare class ProofService implements IProofService {
|
|
|
138
148
|
verifyZKPResponse(proofResp: ZeroKnowledgeProofResponse, opts: ProofVerifyOpts): Promise<VerificationResultMetadata>;
|
|
139
149
|
/** {@inheritdoc IProofService.generateProof} */
|
|
140
150
|
generateProof(proofReq: ZeroKnowledgeProofRequest, identifier: DID, opts?: ProofGenerationOptions): Promise<ZeroKnowledgeProofResponse>;
|
|
151
|
+
/** {@inheritdoc IProofService.generateAuthProof} */
|
|
152
|
+
generateAuthProof(circuitId: CircuitId, identifier: DID, opts?: ProofGenerationOptions): Promise<ZeroKnowledgeProofAuthResponse>;
|
|
141
153
|
/** {@inheritdoc IProofService.transitState} */
|
|
142
154
|
transitState(did: DID, oldTreeState: TreeState, isOldStateGenesis: boolean, stateStorage: IStateStorage, // for compatibility with previous versions we leave this parameter
|
|
143
155
|
ethSigner: Signer): Promise<string>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Signer } from 'ethers';
|
|
2
2
|
import { EthConnectionConfig } from './state';
|
|
3
3
|
import { IOnChainZKPVerifier } from '../interfaces/onchain-zkp-verifier';
|
|
4
|
-
import { ContractInvokeTransactionData, JsonDocumentObjectValue, ZeroKnowledgeProofResponse } from '../../iden3comm';
|
|
4
|
+
import { AuthProofResponse, ContractInvokeTransactionData, JsonDocumentObjectValue, ZeroKnowledgeInvokeResponse, ZeroKnowledgeProofResponse } from '../../iden3comm';
|
|
5
5
|
import { GlobalStateUpdate } from '../entities/state';
|
|
6
6
|
/**
|
|
7
7
|
* Supported function signature for SubmitZKPResponse
|
|
@@ -13,7 +13,8 @@ export declare enum FunctionSignatures {
|
|
|
13
13
|
* uint256[2] calldata a, uint256[2][2] calldata b, uint256[2] calldata c) public
|
|
14
14
|
*/
|
|
15
15
|
SubmitZKPResponseV1 = "b68967e2",
|
|
16
|
-
SubmitZKPResponseV2 = "ade09fcd"
|
|
16
|
+
SubmitZKPResponseV2 = "ade09fcd",
|
|
17
|
+
SubmitResponse = "06c86a91"
|
|
17
18
|
}
|
|
18
19
|
/**
|
|
19
20
|
* OnChainZKPVerifierOptions represents OnChainZKPVerifier options
|
|
@@ -56,10 +57,16 @@ export declare class OnChainZKPVerifier implements IOnChainZKPVerifier {
|
|
|
56
57
|
* {@inheritDoc IOnChainZKPVerifier.submitZKPResponseV2}
|
|
57
58
|
*/
|
|
58
59
|
submitZKPResponseV2(ethSigner: Signer, txData: ContractInvokeTransactionData, zkProofResponses: ZeroKnowledgeProofResponse[]): Promise<Map<string, ZeroKnowledgeProofResponse[]>>;
|
|
60
|
+
/**
|
|
61
|
+
* {@inheritDoc IOnChainVerifierMultiQuery.submitResponse}
|
|
62
|
+
*/
|
|
63
|
+
submitResponse(ethSigner: Signer, txData: ContractInvokeTransactionData, authResponse: AuthProofResponse, responses: ZeroKnowledgeProofResponse[]): Promise<Map<string, ZeroKnowledgeInvokeResponse>>;
|
|
64
|
+
static prepareTxArgsSubmit(resolverUrl: string, txData: ContractInvokeTransactionData, authResponse: AuthProofResponse, responses: ZeroKnowledgeProofResponse[]): Promise<JsonDocumentObjectValue[]>;
|
|
65
|
+
prepareTxArgsSubmit(txData: ContractInvokeTransactionData, authResponse: AuthProofResponse, responses: ZeroKnowledgeProofResponse[]): Promise<JsonDocumentObjectValue[]>;
|
|
59
66
|
private static getCrossChainResolvers;
|
|
60
67
|
static prepareTxArgsSubmitV2(resolverUrl: string, txData: ContractInvokeTransactionData, zkProofResponses: ZeroKnowledgeProofResponse[]): Promise<JsonDocumentObjectValue[]>;
|
|
61
68
|
prepareTxArgsSubmitV2(txData: ContractInvokeTransactionData, zkProofResponses: ZeroKnowledgeProofResponse[]): Promise<JsonDocumentObjectValue[]>;
|
|
62
|
-
private static
|
|
69
|
+
private static _processProof;
|
|
63
70
|
private static packCrossChainProofs;
|
|
64
71
|
static packGlobalStateMsg(msg: GlobalStateUpdate): string;
|
|
65
72
|
private static packIdentityStateMsg;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Signer } from 'ethers';
|
|
2
|
-
import { ContractInvokeTransactionData, JsonDocumentObjectValue, ZeroKnowledgeProofResponse } from '../../iden3comm';
|
|
2
|
+
import { AuthProofResponse, ContractInvokeTransactionData, JsonDocumentObjectValue, ZeroKnowledgeInvokeResponse, ZeroKnowledgeProofResponse } from '../../iden3comm';
|
|
3
3
|
/**
|
|
4
4
|
* Interface that defines methods for ZKP verifier
|
|
5
5
|
*
|
|
@@ -25,6 +25,16 @@ export interface IOnChainZKPVerifier {
|
|
|
25
25
|
* @returns {Promise<Map<string, ZeroKnowledgeProofResponse[]>>} - map of transaction hash - ZeroKnowledgeProofResponse[]
|
|
26
26
|
*/
|
|
27
27
|
submitZKPResponseV2(ethSigner: Signer, txData: ContractInvokeTransactionData, zkProofResponses: ZeroKnowledgeProofResponse[]): Promise<Map<string, ZeroKnowledgeProofResponse[]>>;
|
|
28
|
+
/**
|
|
29
|
+
* Submit Response to OnChainZKPVerifier contract.
|
|
30
|
+
* @beta
|
|
31
|
+
* @param {Signer} ethSigner - tx signer
|
|
32
|
+
* @param {txData} ContractInvokeTransactionData - transaction data
|
|
33
|
+
* @param {AuthProofResponse} authResponse - authResponse
|
|
34
|
+
* @param {ZeroKnowledgeProofMultiQueryResponse[]} responses - singleResponses and groupedResponses
|
|
35
|
+
* @returns {Promise<Map<string, ZeroKnowledgeInvokeResponse>>} - map of transaction hash - ZeroKnowledgeInvokeResponse
|
|
36
|
+
*/
|
|
37
|
+
submitResponse(ethSigner: Signer, txData: ContractInvokeTransactionData, authResponse: AuthProofResponse, responses: ZeroKnowledgeProofResponse[]): Promise<Map<string, ZeroKnowledgeInvokeResponse>>;
|
|
28
38
|
/**
|
|
29
39
|
* Returns tx args for the ZKP verifier contract submission (singe tx args for each response).
|
|
30
40
|
* @param txData
|
|
@@ -37,4 +47,11 @@ export interface IOnChainZKPVerifier {
|
|
|
37
47
|
* @param zkProofResponses
|
|
38
48
|
*/
|
|
39
49
|
prepareTxArgsSubmitV2(txData: ContractInvokeTransactionData, zkProofResponses: ZeroKnowledgeProofResponse[]): Promise<JsonDocumentObjectValue[]>;
|
|
50
|
+
/**
|
|
51
|
+
* Returns args for the verifier multi-query contract submission (single tx args for an array of responses).
|
|
52
|
+
* @param {txData} ContractInvokeTransactionData - transaction data
|
|
53
|
+
* @param {AuthProofResponse} authResponse - authResponse
|
|
54
|
+
* @param {ZeroKnowledgeProofMultiQueryResponse[]} responses - singleResponses and groupedResponses
|
|
55
|
+
*/
|
|
56
|
+
prepareTxArgsSubmit(txData: ContractInvokeTransactionData, authResponse: AuthProofResponse, responses: ZeroKnowledgeProofResponse[]): Promise<JsonDocumentObjectValue[]>;
|
|
40
57
|
}
|
|
@@ -16,6 +16,8 @@ export declare const VerifiableConstants: Readonly<{
|
|
|
16
16
|
IDEN3_DISPLAY_METHOD: string;
|
|
17
17
|
W3C_CREDENTIAL_2018: string;
|
|
18
18
|
W3C_VC_DOCUMENT_2018: string;
|
|
19
|
+
IDEN3_PROOFS_DEFINITION_DOCUMENT: string;
|
|
20
|
+
IDEN3_DISPLAY_METHOD_DEFINITION_DOCUMENT: string;
|
|
19
21
|
};
|
|
20
22
|
JSON_SCHEMA_VALIDATOR: "JsonSchema2023";
|
|
21
23
|
SERVICE_TYPE: {
|
|
@@ -28,6 +30,7 @@ export declare const VerifiableConstants: Readonly<{
|
|
|
28
30
|
AUTH_BJJ_CREDENTIAL_SCHEMA_JSONLD_URL: string;
|
|
29
31
|
AUTH_BJJ_CREDENTIAL_TYPE: string;
|
|
30
32
|
AUTH_BJJ_CREDENTIAL_SCHEMA_JSON: string;
|
|
33
|
+
AUTH_BJJ_CREDENTIAL_SCHEMA_JSONLD: string;
|
|
31
34
|
};
|
|
32
35
|
}>;
|
|
33
36
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xpolygonid/js-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.29.0",
|
|
4
4
|
"description": "SDK to work with Polygon ID",
|
|
5
5
|
"main": "dist/node/cjs/index.js",
|
|
6
6
|
"module": "dist/node/esm/index.js",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"peerDependencies": {
|
|
91
91
|
"@iden3/js-crypto": "1.2.0",
|
|
92
92
|
"@iden3/js-iden3-core": "1.6.0",
|
|
93
|
-
"@iden3/js-jsonld-merklization": "1.5.
|
|
93
|
+
"@iden3/js-jsonld-merklization": "1.5.2",
|
|
94
94
|
"@iden3/js-jwz": "1.9.0",
|
|
95
95
|
"@iden3/js-merkletree": "1.4.0",
|
|
96
96
|
"ffjavascript": "0.3.0",
|
|
@@ -99,6 +99,7 @@
|
|
|
99
99
|
},
|
|
100
100
|
"dependencies": {
|
|
101
101
|
"@iden3/onchain-non-merklized-issuer-base-abi": "^0.0.3",
|
|
102
|
+
"@iden3/universal-verifier-v2-abi": "^2.0.1",
|
|
102
103
|
"@noble/curves": "^1.4.0",
|
|
103
104
|
"ajv": "8.12.0",
|
|
104
105
|
"ajv-formats": "2.1.1",
|