@0xpolygonid/js-sdk 1.14.1 → 1.15.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 +0 -4
- package/dist/browser/esm/index.js +3490 -3462
- package/dist/browser/esm/index.js.map +1 -1
- package/dist/browser/umd/index.js +3503 -3475
- package/dist/browser/umd/index.js.map +1 -1
- package/dist/node/cjs/iden3comm/constants.js +3 -1
- package/dist/node/cjs/iden3comm/handlers/credential-proposal.js +11 -8
- package/dist/node/cjs/iden3comm/handlers/message-handler.js +14 -3
- package/dist/node/cjs/iden3comm/packers/zkp.js +23 -16
- package/dist/node/cjs/iden3comm/types/index.js +1 -0
- package/dist/node/cjs/iden3comm/types/models.js +2 -0
- package/dist/node/cjs/identity/identity-wallet.js +3 -0
- package/dist/node/cjs/proof/proof-service.js +16 -12
- package/dist/node/cjs/proof/verifiers/pub-signals-verifier.js +4 -5
- package/dist/node/esm/iden3comm/constants.js +2 -0
- package/dist/node/esm/iden3comm/handlers/credential-proposal.js +7 -4
- package/dist/node/esm/iden3comm/handlers/message-handler.js +14 -3
- package/dist/node/esm/iden3comm/packers/zkp.js +24 -17
- package/dist/node/esm/iden3comm/types/index.js +1 -0
- package/dist/node/esm/iden3comm/types/models.js +1 -0
- package/dist/node/esm/identity/identity-wallet.js +3 -0
- package/dist/node/esm/proof/proof-service.js +18 -14
- package/dist/node/esm/proof/verifiers/pub-signals-verifier.js +4 -5
- package/dist/types/iden3comm/constants.d.ts +2 -0
- package/dist/types/iden3comm/handlers/auth.d.ts +3 -5
- package/dist/types/iden3comm/handlers/message-handler.d.ts +2 -0
- package/dist/types/iden3comm/packers/zkp.d.ts +6 -5
- package/dist/types/iden3comm/types/index.d.ts +1 -0
- package/dist/types/iden3comm/types/models.d.ts +6 -0
- package/dist/types/iden3comm/types/packer.d.ts +2 -1
- package/dist/types/identity/identity-wallet.d.ts +8 -0
- package/dist/types/proof/proof-service.d.ts +2 -2
- package/dist/types/proof/verifiers/pub-signals-verifier.d.ts +1 -1
- package/package.json +1 -1
|
@@ -3,6 +3,7 @@ import { AuthMessageHandlerOptions } from './auth';
|
|
|
3
3
|
import { RevocationStatusMessageHandlerOptions } from './revocation-status';
|
|
4
4
|
import { ContractMessageHandlerOptions } from './contract-request';
|
|
5
5
|
import { PaymentHandlerOptions, PaymentRequestMessageHandlerOptions } from './payment';
|
|
6
|
+
import { DID } from '@iden3/js-iden3-core';
|
|
6
7
|
/**
|
|
7
8
|
* iden3 Protocol message handler interface
|
|
8
9
|
*/
|
|
@@ -79,6 +80,7 @@ export declare class MessageHandler {
|
|
|
79
80
|
* @returns A Promise that resolves to a Uint8Array of the packed response, or null if no response was generated.
|
|
80
81
|
*/
|
|
81
82
|
handleMessage(bytes: Uint8Array, context: AuthMessageHandlerOptions | ContractMessageHandlerOptions | RevocationStatusMessageHandlerOptions | PaymentRequestMessageHandlerOptions | PaymentHandlerOptions | {
|
|
83
|
+
senderDID?: DID;
|
|
82
84
|
[key: string]: unknown;
|
|
83
85
|
}): Promise<Uint8Array | null>;
|
|
84
86
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AuthDataPrepareFunc, BasicMessage, IPacker, ProvingParams, StateVerificationFunc, VerificationParams, ZKPPackerParams } from '../types';
|
|
1
|
+
import { StateVerificationOpts, AuthDataPrepareFunc, BasicMessage, IPacker, ProvingParams, StateVerificationFunc, VerificationParams, ZKPPackerParams } from '../types';
|
|
2
2
|
import { CircuitId } from '../../circuits/index';
|
|
3
3
|
import { DID } from '@iden3/js-iden3-core';
|
|
4
4
|
import { MediaType } from '../constants';
|
|
@@ -45,7 +45,7 @@ export declare class VerificationHandlerFunc {
|
|
|
45
45
|
* @param {Array<string>} pubSignals - signals that must contain user id and state
|
|
46
46
|
* @returns `Promise<boolean>`
|
|
47
47
|
*/
|
|
48
|
-
verify(id: string, pubSignals: Array<string
|
|
48
|
+
verify(id: string, pubSignals: Array<string>, opts?: StateVerificationOpts): Promise<boolean>;
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
51
51
|
* Packer that can pack message to JWZ token,
|
|
@@ -55,14 +55,15 @@ export declare class VerificationHandlerFunc {
|
|
|
55
55
|
* @implements implements IPacker interface
|
|
56
56
|
*/
|
|
57
57
|
export declare class ZKPPacker implements IPacker {
|
|
58
|
-
provingParamsMap: Map<string, ProvingParams>;
|
|
59
|
-
verificationParamsMap: Map<string, VerificationParams>;
|
|
58
|
+
readonly provingParamsMap: Map<string, ProvingParams>;
|
|
59
|
+
readonly verificationParamsMap: Map<string, VerificationParams>;
|
|
60
|
+
private readonly _opts;
|
|
60
61
|
/**
|
|
61
62
|
* Creates an instance of ZKPPacker.
|
|
62
63
|
* @param {Map<string, ProvingParams>} provingParamsMap - string is derived by JSON.parse(ProvingMethodAlg)
|
|
63
64
|
* @param {Map<string, VerificationParams>} verificationParamsMap - string is derived by JSON.parse(ProvingMethodAlg)
|
|
64
65
|
*/
|
|
65
|
-
constructor(provingParamsMap: Map<string, ProvingParams>, verificationParamsMap: Map<string, VerificationParams
|
|
66
|
+
constructor(provingParamsMap: Map<string, ProvingParams>, verificationParamsMap: Map<string, VerificationParams>, _opts?: StateVerificationOpts);
|
|
66
67
|
/**
|
|
67
68
|
* Packs a basic message using the specified parameters.
|
|
68
69
|
* @param msg - The basic message to pack.
|
|
@@ -4,6 +4,7 @@ import { ProvingMethodAlg } from '@iden3/js-jwz';
|
|
|
4
4
|
import { CircuitId } from '../../circuits';
|
|
5
5
|
import { MediaType } from '../constants';
|
|
6
6
|
import { DIDDocument, VerificationMethod } from 'did-resolver';
|
|
7
|
+
import { StateVerificationOpts } from './models';
|
|
7
8
|
/**
|
|
8
9
|
* Protocol message type
|
|
9
10
|
*/
|
|
@@ -67,7 +68,7 @@ export type AuthDataPrepareFunc = (hash: Uint8Array, did: DID, circuitId: Circui
|
|
|
67
68
|
/**
|
|
68
69
|
* signature of state function verifier
|
|
69
70
|
*/
|
|
70
|
-
export type StateVerificationFunc = (id: string, pubSignals: Array<string
|
|
71
|
+
export type StateVerificationFunc = (id: string, pubSignals: Array<string>, opts?: StateVerificationOpts) => Promise<boolean>;
|
|
71
72
|
/**
|
|
72
73
|
* Defines method that must be implemented by any packer
|
|
73
74
|
*
|
|
@@ -87,6 +87,13 @@ export interface IIdentityWallet {
|
|
|
87
87
|
did: DID;
|
|
88
88
|
credential: W3CCredential;
|
|
89
89
|
}>;
|
|
90
|
+
/**
|
|
91
|
+
* Credential wallet getter
|
|
92
|
+
*
|
|
93
|
+
* @returns {ICredentialWallet}
|
|
94
|
+
* @memberof IIdentityWallet
|
|
95
|
+
*/
|
|
96
|
+
get credentialWallet(): ICredentialWallet;
|
|
90
97
|
/**
|
|
91
98
|
* Create Identity based in Ethereum address and it provides an identifier in DID form.
|
|
92
99
|
*
|
|
@@ -361,6 +368,7 @@ export declare class IdentityWallet implements IIdentityWallet {
|
|
|
361
368
|
constructor(_kms: KMS, _storage: IDataStorage, _credentialWallet: ICredentialWallet, _opts?: {
|
|
362
369
|
credentialStatusPublisherRegistry?: CredentialStatusPublisherRegistry | undefined;
|
|
363
370
|
} | undefined);
|
|
371
|
+
get credentialWallet(): ICredentialWallet;
|
|
364
372
|
private getCredentialStatusPublisherRegistry;
|
|
365
373
|
private createAuthCoreClaim;
|
|
366
374
|
private createAuthBJJCredential;
|
|
@@ -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 { JSONObject, ZeroKnowledgeProofRequest, ZeroKnowledgeProofResponse } from '../iden3comm';
|
|
10
|
+
import { StateVerificationOpts, JSONObject, ZeroKnowledgeProofRequest, ZeroKnowledgeProofResponse } from '../iden3comm';
|
|
11
11
|
import { ICircuitStorage, IStateStorage } from '../storage';
|
|
12
12
|
import { ProofGenerationOptions } from './provers/inputs-generator';
|
|
13
13
|
import { VerifyOpts } from './verifiers';
|
|
@@ -139,7 +139,7 @@ export declare class ProofService implements IProofService {
|
|
|
139
139
|
private loadLdContext;
|
|
140
140
|
/** {@inheritdoc IProofService.generateAuthV2Inputs} */
|
|
141
141
|
generateAuthV2Inputs(hash: Uint8Array, did: DID, circuitId: CircuitId): Promise<Uint8Array>;
|
|
142
|
-
verifyState(circuitId: string, pubSignals: string[]): Promise<boolean>;
|
|
142
|
+
verifyState(circuitId: string, pubSignals: string[], opts?: StateVerificationOpts): Promise<boolean>;
|
|
143
143
|
findCredentialByProofQuery(did: DID, query: ProofQuery): Promise<{
|
|
144
144
|
cred: W3CCredential;
|
|
145
145
|
revStatus: RevocationStatus | undefined;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Id } from '@iden3/js-iden3-core';
|
|
2
2
|
import { DocumentLoader } from '@iden3/js-jsonld-merklization';
|
|
3
|
-
import { JSONObject } from '../../iden3comm';
|
|
4
3
|
import { IStateStorage } from '../../storage';
|
|
5
4
|
import { ProofQuery } from '../../verifiable';
|
|
6
5
|
import { BaseConfig } from '../../circuits/common';
|
|
7
6
|
import { VerifyOpts } from './query';
|
|
7
|
+
import { JSONObject } from '../../iden3comm';
|
|
8
8
|
/**
|
|
9
9
|
* Verify Context - params for pub signal verification
|
|
10
10
|
* @type VerifyContext
|