@0xpolygonid/js-sdk 1.5.0 → 1.6.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/dist/browser/esm/index.js +1685 -468
- package/dist/browser/esm/index.js.map +1 -1
- package/dist/browser/umd/index.js +1706 -473
- package/dist/browser/umd/index.js.map +1 -1
- package/dist/node/cjs/circuits/atomic-query-mtp-v2-on-chain.js +1 -1
- package/dist/node/cjs/circuits/atomic-query-mtp-v2.js +1 -1
- package/dist/node/cjs/circuits/atomic-query-sig-v2-on-chain.js +2 -2
- package/dist/node/cjs/circuits/atomic-query-sig-v2.js +11 -14
- package/dist/node/cjs/circuits/atomic-query-v3-on-chain.js +320 -0
- package/dist/node/cjs/circuits/atomic-query-v3.js +275 -0
- package/dist/node/cjs/circuits/common.js +5 -7
- package/dist/node/cjs/circuits/comparer.js +57 -2
- package/dist/node/cjs/circuits/index.js +4 -0
- package/dist/node/cjs/circuits/linked-multi-query.js +128 -0
- package/dist/node/cjs/circuits/linked-nullifier.js +57 -0
- package/dist/node/cjs/circuits/models.js +25 -1
- package/dist/node/cjs/credentials/credential-wallet.js +2 -10
- package/dist/node/cjs/credentials/index.js +1 -0
- package/dist/node/cjs/credentials/utils.js +23 -0
- package/dist/node/cjs/iden3comm/handlers/auth.js +49 -8
- package/dist/node/cjs/iden3comm/handlers/contract-request.js +20 -8
- package/dist/node/cjs/proof/common.js +104 -1
- package/dist/node/cjs/proof/inputs-generator.js +393 -0
- package/dist/node/cjs/proof/proof-service.js +105 -372
- package/dist/node/cjs/schema-processor/json/parser.js +7 -0
- package/dist/node/cjs/schema-processor/json/validator.js +1 -0
- package/dist/node/cjs/storage/filters/jsonQuery.js +73 -8
- package/dist/node/cjs/utils/did-helper.js +14 -0
- package/dist/node/cjs/utils/index.js +2 -0
- package/dist/node/cjs/utils/object.js +42 -0
- package/dist/node/cjs/verifiable/presentation.js +34 -33
- package/dist/node/cjs/verifiable/proof.js +2 -0
- package/dist/node/esm/circuits/atomic-query-mtp-v2-on-chain.js +1 -1
- package/dist/node/esm/circuits/atomic-query-mtp-v2.js +1 -1
- package/dist/node/esm/circuits/atomic-query-sig-v2-on-chain.js +2 -2
- package/dist/node/esm/circuits/atomic-query-sig-v2.js +11 -14
- package/dist/node/esm/circuits/atomic-query-v3-on-chain.js +315 -0
- package/dist/node/esm/circuits/atomic-query-v3.js +270 -0
- package/dist/node/esm/circuits/common.js +4 -6
- package/dist/node/esm/circuits/comparer.js +55 -1
- package/dist/node/esm/circuits/index.js +4 -0
- package/dist/node/esm/circuits/linked-multi-query.js +123 -0
- package/dist/node/esm/circuits/linked-nullifier.js +52 -0
- package/dist/node/esm/circuits/models.js +25 -1
- package/dist/node/esm/credentials/credential-wallet.js +2 -10
- package/dist/node/esm/credentials/index.js +1 -0
- package/dist/node/esm/credentials/utils.js +19 -0
- package/dist/node/esm/iden3comm/handlers/auth.js +50 -9
- package/dist/node/esm/iden3comm/handlers/contract-request.js +20 -8
- package/dist/node/esm/proof/common.js +101 -2
- package/dist/node/esm/proof/inputs-generator.js +389 -0
- package/dist/node/esm/proof/proof-service.js +111 -377
- package/dist/node/esm/schema-processor/json/parser.js +7 -0
- package/dist/node/esm/schema-processor/json/validator.js +1 -0
- package/dist/node/esm/storage/filters/jsonQuery.js +74 -9
- package/dist/node/esm/utils/did-helper.js +10 -0
- package/dist/node/esm/utils/index.js +2 -0
- package/dist/node/esm/utils/object.js +38 -0
- package/dist/node/esm/verifiable/presentation.js +30 -29
- package/dist/node/esm/verifiable/proof.js +2 -0
- package/dist/types/circuits/atomic-query-mtp-v2.d.ts +13 -13
- package/dist/types/circuits/atomic-query-v3-on-chain.d.ts +142 -0
- package/dist/types/circuits/atomic-query-v3.d.ts +120 -0
- package/dist/types/circuits/common.d.ts +4 -4
- package/dist/types/circuits/comparer.d.ts +33 -1
- package/dist/types/circuits/index.d.ts +4 -0
- package/dist/types/circuits/linked-multi-query.d.ts +38 -0
- package/dist/types/circuits/linked-nullifier.d.ts +37 -0
- package/dist/types/circuits/models.d.ts +20 -2
- package/dist/types/credentials/index.d.ts +1 -0
- package/dist/types/credentials/utils.d.ts +12 -0
- package/dist/types/iden3comm/types/packer.d.ts +1 -2
- package/dist/types/iden3comm/types/protocol/auth.d.ts +1 -0
- package/dist/types/proof/common.d.ts +34 -3
- package/dist/types/proof/inputs-generator.d.ts +46 -0
- package/dist/types/proof/proof-service.d.ts +14 -25
- package/dist/types/schema-processor/json/parser.d.ts +1 -0
- package/dist/types/storage/filters/jsonQuery.d.ts +1 -1
- package/dist/types/utils/did-helper.d.ts +6 -0
- package/dist/types/utils/index.d.ts +2 -0
- package/dist/types/utils/object.d.ts +12 -0
- package/dist/types/verifiable/presentation.d.ts +6 -10
- package/package.json +3 -3
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Claim } from '@iden3/js-iden3-core';
|
|
2
|
+
import { BaseConfig } from './common';
|
|
3
|
+
import { Query } from './models';
|
|
4
|
+
/**
|
|
5
|
+
* LinkedMultiQuery circuit representation
|
|
6
|
+
* Inputs and public signals declaration, marshalling and parsing
|
|
7
|
+
*
|
|
8
|
+
* @beta
|
|
9
|
+
* @class LinkedMultiQueryInputs
|
|
10
|
+
*/
|
|
11
|
+
export declare class LinkedMultiQueryInputs extends BaseConfig {
|
|
12
|
+
linkNonce: bigint;
|
|
13
|
+
claim: Claim;
|
|
14
|
+
query: Query[];
|
|
15
|
+
queryLength: number;
|
|
16
|
+
inputsMarshal(): Uint8Array;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* public signals
|
|
20
|
+
*
|
|
21
|
+
* @beta
|
|
22
|
+
* @class LinkedMultiQueryPubSignals
|
|
23
|
+
*/
|
|
24
|
+
export declare class LinkedMultiQueryPubSignals {
|
|
25
|
+
linkID: bigint;
|
|
26
|
+
merklized: number;
|
|
27
|
+
operatorOutput: bigint[];
|
|
28
|
+
circuitQueryHash: bigint[];
|
|
29
|
+
enabled: boolean[];
|
|
30
|
+
/**
|
|
31
|
+
* PubSignalsUnmarshal unmarshal linkedMultiQuery.circom public inputs to LinkedMultiQueryPubSignals
|
|
32
|
+
*
|
|
33
|
+
* @beta
|
|
34
|
+
* @param {Uint8Array} data
|
|
35
|
+
* @returns LinkedMultiQueryPubSignals
|
|
36
|
+
*/
|
|
37
|
+
pubSignalsUnmarshal(data: Uint8Array, queryLength: number): LinkedMultiQueryPubSignals;
|
|
38
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Claim, Id } from '@iden3/js-iden3-core';
|
|
2
|
+
/**
|
|
3
|
+
* LinkedNullifier circuit representation
|
|
4
|
+
* Inputs and public signals declaration, marshalling and parsing
|
|
5
|
+
*
|
|
6
|
+
* @beta
|
|
7
|
+
* @class LinkedNullifierInputs
|
|
8
|
+
*/
|
|
9
|
+
export declare class LinkedNullifierInputs {
|
|
10
|
+
linkNonce: bigint;
|
|
11
|
+
issuerClaim: Claim;
|
|
12
|
+
id: Id;
|
|
13
|
+
claimSubjectProfileNonce: bigint;
|
|
14
|
+
verifierID?: Id;
|
|
15
|
+
nullifierSessionID: bigint;
|
|
16
|
+
inputsMarshal(): Uint8Array;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* public signals
|
|
20
|
+
*
|
|
21
|
+
* @beta
|
|
22
|
+
* @class LinkedNullifierPubSignals
|
|
23
|
+
*/
|
|
24
|
+
export declare class LinkedNullifierPubSignals {
|
|
25
|
+
nullifier: bigint;
|
|
26
|
+
linkID: bigint;
|
|
27
|
+
verifierID: Id;
|
|
28
|
+
nullifierSessionID: bigint;
|
|
29
|
+
/**
|
|
30
|
+
* PubSignalsUnmarshal unmarshal nullifier.circom public inputs to LinkedNullifierPubSignals
|
|
31
|
+
*
|
|
32
|
+
* @beta
|
|
33
|
+
* @param {Uint8Array} data
|
|
34
|
+
* @returns LinkedNullifierPubSignals
|
|
35
|
+
*/
|
|
36
|
+
pubSignalsUnmarshal(data: Uint8Array): LinkedNullifierPubSignals;
|
|
37
|
+
}
|
|
@@ -52,7 +52,23 @@ export declare enum CircuitId {
|
|
|
52
52
|
AtomicQueryMTPV2 = "credentialAtomicQueryMTPV2",
|
|
53
53
|
AtomicQueryMTPV2OnChain = "credentialAtomicQueryMTPV2OnChain",
|
|
54
54
|
AtomicQuerySigV2 = "credentialAtomicQuerySigV2",
|
|
55
|
-
AtomicQuerySigV2OnChain = "credentialAtomicQuerySigV2OnChain"
|
|
55
|
+
AtomicQuerySigV2OnChain = "credentialAtomicQuerySigV2OnChain",
|
|
56
|
+
/**
|
|
57
|
+
* @beta
|
|
58
|
+
*/
|
|
59
|
+
AtomicQueryV3 = "credentialAtomicQueryV3-beta.0",
|
|
60
|
+
/**
|
|
61
|
+
* @beta
|
|
62
|
+
*/
|
|
63
|
+
AtomicQueryV3OnChain = "credentialAtomicQueryV3OnChain-beta.0",
|
|
64
|
+
/**
|
|
65
|
+
* @beta
|
|
66
|
+
*/
|
|
67
|
+
LinkedNullifier = "linkedNullifier-beta.0",
|
|
68
|
+
/**
|
|
69
|
+
* @beta
|
|
70
|
+
*/
|
|
71
|
+
LinkedMultiQuery10 = "linkedMultiQuery10-beta.0"
|
|
56
72
|
}
|
|
57
73
|
/**
|
|
58
74
|
* Claim structure for circuit inputs
|
|
@@ -147,7 +163,9 @@ export declare enum CircuitError {
|
|
|
147
163
|
EmptyId = "empty Id",
|
|
148
164
|
EmptyChallenge = "empty challenge",
|
|
149
165
|
EmptyGISTProof = "empty GIST merkle tree proof",
|
|
150
|
-
|
|
166
|
+
EmptyTreeState = "empty tree state",
|
|
167
|
+
EmptyRequestID = "empty request ID",
|
|
168
|
+
InvalidProofType = "invalid proof type"
|
|
151
169
|
}
|
|
152
170
|
/**
|
|
153
171
|
* ValueProof represents a Merkle Proof for a value stored as MT
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DID } from '@iden3/js-iden3-core';
|
|
2
|
+
import { W3CCredential } from '../verifiable';
|
|
3
|
+
/**
|
|
4
|
+
* Retrieves the user DID from a given credential.
|
|
5
|
+
* If the credential does not have a credentialSubject.id property, the issuer DID is returned.
|
|
6
|
+
* If the credentialSubject.id is not a string, an error is thrown.
|
|
7
|
+
* @param issuerDID The DID of the issuer.
|
|
8
|
+
* @param credential The credential object.
|
|
9
|
+
* @returns The user DID parsed from the credential.
|
|
10
|
+
* @throws Error if the credentialSubject.id is not a string.
|
|
11
|
+
*/
|
|
12
|
+
export declare const getUserDIDFromCredential: (issuerDID: DID, credential: W3CCredential) => DID;
|
|
@@ -12,7 +12,7 @@ export type ProtocolMessage = string;
|
|
|
12
12
|
/**
|
|
13
13
|
* JSONValue
|
|
14
14
|
*/
|
|
15
|
-
type JSONValue = string | number | boolean | object | Array<object>;
|
|
15
|
+
export type JSONValue = string | number | boolean | object | Array<object>;
|
|
16
16
|
/**
|
|
17
17
|
* JSON object
|
|
18
18
|
*/
|
|
@@ -93,4 +93,3 @@ export type ProvingParams = {
|
|
|
93
93
|
provingKey: Uint8Array;
|
|
94
94
|
wasm: Uint8Array;
|
|
95
95
|
};
|
|
96
|
-
export {};
|
|
@@ -1,13 +1,27 @@
|
|
|
1
|
-
import { ClaimNonRevStatus, GISTProof } from '../circuits';
|
|
1
|
+
import { ClaimNonRevStatus, GISTProof, Operators } from '../circuits';
|
|
2
2
|
import { StateProof } from '../storage/entities/state';
|
|
3
|
-
import { RevocationStatus } from '../verifiable';
|
|
3
|
+
import { MerkleTreeProofWithTreeState, RevocationStatus, W3CCredential } from '../verifiable';
|
|
4
|
+
import { Options, Path } from '@iden3/js-jsonld-merklization';
|
|
5
|
+
import { JSONObject } from '../iden3comm';
|
|
6
|
+
import { Claim } from '@iden3/js-iden3-core';
|
|
7
|
+
export type PreparedCredential = {
|
|
8
|
+
credential: W3CCredential;
|
|
9
|
+
credentialCoreClaim: Claim;
|
|
10
|
+
revStatus?: RevocationStatus;
|
|
11
|
+
};
|
|
12
|
+
export type PreparedAuthBJJCredential = {
|
|
13
|
+
credential: W3CCredential;
|
|
14
|
+
incProof: MerkleTreeProofWithTreeState;
|
|
15
|
+
nonRevProof: MerkleTreeProofWithTreeState;
|
|
16
|
+
coreClaim: Claim;
|
|
17
|
+
};
|
|
4
18
|
/**
|
|
5
19
|
* converts verifiable RevocationStatus model to circuits structure
|
|
6
20
|
*
|
|
7
21
|
* @param {RevocationStatus} - credential.status of the verifiable credential
|
|
8
22
|
* @returns {ClaimNonRevStatus}
|
|
9
23
|
*/
|
|
10
|
-
export declare const toClaimNonRevStatus: (s
|
|
24
|
+
export declare const toClaimNonRevStatus: (s?: RevocationStatus) => ClaimNonRevStatus;
|
|
11
25
|
/**
|
|
12
26
|
* converts state info from smart contract to gist proof
|
|
13
27
|
*
|
|
@@ -15,3 +29,20 @@ export declare const toClaimNonRevStatus: (s: RevocationStatus) => ClaimNonRevSt
|
|
|
15
29
|
* @returns {GISTProof}
|
|
16
30
|
*/
|
|
17
31
|
export declare const toGISTProof: (smtProof: StateProof) => GISTProof;
|
|
32
|
+
export type PropertyQuery = {
|
|
33
|
+
fieldName: string;
|
|
34
|
+
operator: Operators;
|
|
35
|
+
operatorValue?: unknown;
|
|
36
|
+
};
|
|
37
|
+
export type QueryMetadata = PropertyQuery & {
|
|
38
|
+
slotIndex: number;
|
|
39
|
+
values: bigint[];
|
|
40
|
+
path: Path;
|
|
41
|
+
claimPathKey: bigint;
|
|
42
|
+
datatype: string;
|
|
43
|
+
merklizedSchema: boolean;
|
|
44
|
+
};
|
|
45
|
+
export declare const parseCredentialSubject: (credentialSubject?: JSONObject) => PropertyQuery[];
|
|
46
|
+
export declare const parseQueryMetadata: (propertyQuery: PropertyQuery, ldContextJSON: string, credentialType: string, options: Options) => Promise<QueryMetadata>;
|
|
47
|
+
export declare const parseQueriesMetadata: (credentialType: string, ldContextJSON: string, credentialSubject: JSONObject, options: Options) => Promise<QueryMetadata[]>;
|
|
48
|
+
export declare const transformQueryValueToBigInts: (value: unknown, ldType: string) => Promise<bigint[]>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { DID } from '@iden3/js-iden3-core';
|
|
2
|
+
import { RevocationStatus, W3CCredential } from '../verifiable';
|
|
3
|
+
import { ZeroKnowledgeProofRequest } from '../iden3comm';
|
|
4
|
+
import { CircuitClaim, Query, TreeState } from '../circuits';
|
|
5
|
+
import { PreparedAuthBJJCredential, PreparedCredential } from './common';
|
|
6
|
+
import { IIdentityWallet } from '../identity';
|
|
7
|
+
import { IStateStorage } from '../storage';
|
|
8
|
+
import { ICredentialWallet } from '../credentials';
|
|
9
|
+
export type DIDProfileMetadata = {
|
|
10
|
+
authProfileNonce: number;
|
|
11
|
+
credentialSubjectProfileNonce: number;
|
|
12
|
+
};
|
|
13
|
+
export type ProofGenerationOptions = {
|
|
14
|
+
skipRevocation: boolean;
|
|
15
|
+
challenge?: bigint;
|
|
16
|
+
credential?: W3CCredential;
|
|
17
|
+
credentialRevocationStatus?: RevocationStatus;
|
|
18
|
+
verifierDid?: DID;
|
|
19
|
+
linkNonce?: bigint;
|
|
20
|
+
};
|
|
21
|
+
export type ProofInputsParams = ProofGenerationOptions & DIDProfileMetadata;
|
|
22
|
+
type InputContext = {
|
|
23
|
+
preparedCredential: PreparedCredential;
|
|
24
|
+
identifier: DID;
|
|
25
|
+
proofReq: ZeroKnowledgeProofRequest;
|
|
26
|
+
params: ProofInputsParams;
|
|
27
|
+
circuitQueries: Query[];
|
|
28
|
+
};
|
|
29
|
+
export declare class InputGenerator {
|
|
30
|
+
private readonly _identityWallet;
|
|
31
|
+
private readonly _credentialWallet;
|
|
32
|
+
private readonly _stateStorage;
|
|
33
|
+
constructor(_identityWallet: IIdentityWallet, _credentialWallet: ICredentialWallet, _stateStorage: IStateStorage);
|
|
34
|
+
generateInputs(ctx: InputContext): Promise<Uint8Array>;
|
|
35
|
+
newCircuitClaimData(preparedCredential: PreparedCredential): Promise<CircuitClaim>;
|
|
36
|
+
prepareAuthBJJCredential(did: DID, treeStateInfo?: TreeState): Promise<PreparedAuthBJJCredential>;
|
|
37
|
+
private credentialAtomicQueryMTPV2PrepareInputs;
|
|
38
|
+
private credentialAtomicQueryMTPV2OnChainPrepareInputs;
|
|
39
|
+
private credentialAtomicQuerySigV2PrepareInputs;
|
|
40
|
+
private credentialAtomicQuerySigV2OnChainPrepareInputs;
|
|
41
|
+
private credentialAtomicQueryV3PrepareInputs;
|
|
42
|
+
private credentialAtomicQueryV3OnChainPrepareInputs;
|
|
43
|
+
private linkedNullifierPrepareInputs;
|
|
44
|
+
linkedMultiQuery10PrepareInputs: ({ preparedCredential, proofReq, params, circuitQueries }: InputContext) => Promise<Uint8Array>;
|
|
45
|
+
}
|
|
46
|
+
export {};
|
|
@@ -1,30 +1,21 @@
|
|
|
1
|
-
import { Signature } from '@iden3/js-crypto';
|
|
2
1
|
import { DID } from '@iden3/js-iden3-core';
|
|
3
2
|
import { CircuitId, Query, TreeState } from '../circuits';
|
|
4
3
|
import { ICredentialWallet } from '../credentials';
|
|
5
4
|
import { IIdentityWallet } from '../identity';
|
|
6
|
-
import { W3CCredential } from '../verifiable';
|
|
5
|
+
import { ProofQuery, RevocationStatus, W3CCredential } from '../verifiable';
|
|
7
6
|
import { IZKProver } from './prover';
|
|
8
7
|
import { Options } from '@iden3/js-jsonld-merklization';
|
|
9
8
|
import { ZKProof } from '@iden3/js-jwz';
|
|
10
9
|
import { Signer } from 'ethers';
|
|
11
10
|
import { ZeroKnowledgeProofRequest, ZeroKnowledgeProofResponse } from '../iden3comm';
|
|
12
11
|
import { ICircuitStorage, IStateStorage } from '../storage';
|
|
12
|
+
import { ProofGenerationOptions } from './inputs-generator';
|
|
13
13
|
export interface QueryWithFieldName {
|
|
14
14
|
query: Query;
|
|
15
15
|
fieldName: string;
|
|
16
16
|
rawValue?: unknown;
|
|
17
17
|
isSelectiveDisclosure?: boolean;
|
|
18
18
|
}
|
|
19
|
-
export interface ProofGenerationOptions {
|
|
20
|
-
skipRevocation: boolean;
|
|
21
|
-
challenge?: bigint;
|
|
22
|
-
credential?: W3CCredential;
|
|
23
|
-
}
|
|
24
|
-
export interface DIDProfileMetadata {
|
|
25
|
-
authProfileNonce: number;
|
|
26
|
-
credentialSubjectProfileNonce: number;
|
|
27
|
-
}
|
|
28
19
|
/**
|
|
29
20
|
* List of options to customize ProofService
|
|
30
21
|
*/
|
|
@@ -82,6 +73,12 @@ export interface IProofService {
|
|
|
82
73
|
* @returns `{Promise<string>}` - transaction hash is returned
|
|
83
74
|
*/
|
|
84
75
|
transitState(did: DID, oldTreeState: TreeState, isOldStateGenesis: boolean, stateStorage: IStateStorage, ethSigner: Signer): Promise<string>;
|
|
76
|
+
findCredentialByProofQuery(did: DID, query: ProofQuery, opts?: {
|
|
77
|
+
skipClaimRevocationCheck: boolean;
|
|
78
|
+
}): Promise<{
|
|
79
|
+
cred: W3CCredential;
|
|
80
|
+
revStatus: RevocationStatus | undefined;
|
|
81
|
+
}>;
|
|
85
82
|
}
|
|
86
83
|
/**
|
|
87
84
|
* Proof service is an implementation of IProofService
|
|
@@ -97,6 +94,7 @@ export declare class ProofService implements IProofService {
|
|
|
97
94
|
private readonly _stateStorage;
|
|
98
95
|
private readonly _prover;
|
|
99
96
|
private readonly _ldOptions;
|
|
97
|
+
private readonly _inputsGenerator;
|
|
100
98
|
/**
|
|
101
99
|
* Creates an instance of ProofService.
|
|
102
100
|
* @param {IIdentityWallet} _identityWallet - identity wallet
|
|
@@ -111,23 +109,14 @@ export declare class ProofService implements IProofService {
|
|
|
111
109
|
generateProof(proofReq: ZeroKnowledgeProofRequest, identifier: DID, opts?: ProofGenerationOptions): Promise<ZeroKnowledgeProofResponse>;
|
|
112
110
|
/** {@inheritdoc IProofService.transitState} */
|
|
113
111
|
transitState(did: DID, oldTreeState: TreeState, isOldStateGenesis: boolean, stateStorage: IStateStorage, ethSigner: Signer): Promise<string>;
|
|
114
|
-
private getPreparedCredential;
|
|
115
|
-
private prepareAuthBJJCredential;
|
|
116
112
|
private generateInputs;
|
|
117
|
-
private generateMTPV2Inputs;
|
|
118
|
-
private generateMTPV2OnChainInputs;
|
|
119
|
-
private generateQuerySigV2Inputs;
|
|
120
|
-
private generateQuerySigV2OnChainInputs;
|
|
121
|
-
private newCircuitClaimData;
|
|
122
113
|
private toCircuitsQuery;
|
|
123
|
-
private
|
|
124
|
-
private prepareNonMerklizedQuery;
|
|
125
|
-
private loadLdContextFromJSONSchema;
|
|
126
|
-
private parseRequest;
|
|
127
|
-
transformQueryValueToBigInts(value: unknown, ldType: string): Promise<bigint[]>;
|
|
114
|
+
private loadLdContext;
|
|
128
115
|
/** {@inheritdoc IProofService.generateAuthV2Inputs} */
|
|
129
116
|
generateAuthV2Inputs(hash: Uint8Array, did: DID, circuitId: CircuitId): Promise<Uint8Array>;
|
|
130
117
|
verifyState(circuitId: string, pubSignals: Array<string>): Promise<boolean>;
|
|
131
|
-
|
|
118
|
+
findCredentialByProofQuery(did: DID, query: ProofQuery): Promise<{
|
|
119
|
+
cred: W3CCredential;
|
|
120
|
+
revStatus: RevocationStatus | undefined;
|
|
121
|
+
}>;
|
|
132
122
|
}
|
|
133
|
-
export declare const bJJSignatureFromHexString: (sigHex: string) => Promise<Signature>;
|
|
@@ -85,6 +85,7 @@ export declare class Parser {
|
|
|
85
85
|
static parseClaim(credential: W3CCredential, opts?: CoreClaimOptions): Promise<CoreClaim>;
|
|
86
86
|
static findCredentialType(mz: Merklizer): string;
|
|
87
87
|
static getSerializationAttr(credential: W3CCredential, opts: Options, tp: string): Promise<string>;
|
|
88
|
+
static getSerializationAttrFromContext(context: object, opts: Options, tp: string): Promise<string>;
|
|
88
89
|
static getSerializationAttrFromParsedContext(ldCtx: {
|
|
89
90
|
mappings: Map<string, Record<string, unknown>>;
|
|
90
91
|
}, tp: string): Promise<string>;
|
|
@@ -9,7 +9,7 @@ export declare enum SearchError {
|
|
|
9
9
|
NotDefinedComparator = "not defined comparator"
|
|
10
10
|
}
|
|
11
11
|
/** allowed operators to search */
|
|
12
|
-
export type FilterOperatorMethod = '$noop' | '$eq' | '$in' | '$nin' | '$gt' | '$lt' | '$ne';
|
|
12
|
+
export type FilterOperatorMethod = '$noop' | '$eq' | '$in' | '$nin' | '$gt' | '$lt' | '$ne' | '$gte' | '$lte' | '$sd';
|
|
13
13
|
/** filter function type */
|
|
14
14
|
export type FilterOperatorFunction = (a: any, b: any) => boolean;
|
|
15
15
|
/**
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Merges two objects together, prioritizing the properties of the second object.
|
|
3
|
+
* If a property exists in both objects, the value from the second object will be used.
|
|
4
|
+
* @param credSubject - The first object to merge.
|
|
5
|
+
* @param otherCredSubject - The second object to merge.
|
|
6
|
+
* @returns A new object with the merged properties.
|
|
7
|
+
*/
|
|
8
|
+
type obj = {
|
|
9
|
+
[k: string]: unknown;
|
|
10
|
+
};
|
|
11
|
+
export declare function mergeObjects(credSubject: obj, otherCredSubject: obj): obj;
|
|
12
|
+
export {};
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Options, Path } from '@iden3/js-jsonld-merklization';
|
|
2
2
|
import { W3CCredential } from './credential';
|
|
3
|
-
import {
|
|
3
|
+
import { QueryMetadata } from '../proof';
|
|
4
|
+
import { JSONObject } from '../iden3comm';
|
|
4
5
|
export declare const stringByPath: (obj: {
|
|
5
6
|
[key: string]: unknown;
|
|
6
7
|
}, path: string) => string;
|
|
7
|
-
export declare const
|
|
8
|
-
export declare const
|
|
9
|
-
export declare const
|
|
10
|
-
vp: object;
|
|
11
|
-
mzValue: MtValue;
|
|
12
|
-
dataType: string;
|
|
13
|
-
hasher: Hasher;
|
|
14
|
-
}>;
|
|
8
|
+
export declare const buildFieldPath: (ldSchema: string, contextType: string, field: string, opts?: Options) => Promise<Path>;
|
|
9
|
+
export declare const findValue: (fieldName: string, credential: W3CCredential) => JSONObject;
|
|
10
|
+
export declare const createVerifiablePresentation: (context: string, tp: string, credential: W3CCredential, queries: QueryMetadata[]) => object;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xpolygonid/js-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.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",
|
|
@@ -86,9 +86,9 @@
|
|
|
86
86
|
},
|
|
87
87
|
"peerDependencies": {
|
|
88
88
|
"@iden3/js-crypto": "1.0.3",
|
|
89
|
-
"@iden3/js-iden3-core": "1.2.
|
|
89
|
+
"@iden3/js-iden3-core": "1.2.1",
|
|
90
90
|
"@iden3/js-jsonld-merklization": "1.1.2",
|
|
91
|
-
"@iden3/js-jwz": "1.2.
|
|
91
|
+
"@iden3/js-jwz": "1.2.1",
|
|
92
92
|
"@iden3/js-merkletree": "1.1.2",
|
|
93
93
|
"ffjavascript": "0.2.62",
|
|
94
94
|
"snarkjs": "0.7.2",
|