-
Notifications
You must be signed in to change notification settings - Fork 182
/
StubWallet.ts
163 lines (161 loc) · 4.95 KB
/
StubWallet.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
/* eslint-disable @typescript-eslint/no-unused-vars */
import type {
IndyProofRequest,
IndyRequestedCredentials,
Schemas,
CredentialDefs,
RevStates,
IndyProof,
IndyCredentialInfo,
DidConfig,
Schema,
CredDefConfig,
CredDef,
CredOffer,
ProofCred,
CredReq,
CredReqMetadata,
CredValues,
Cred,
CredRevocId,
RevocRegDelta,
CredentialId,
WalletRecordOptions,
WalletRecord,
WalletQuery,
LedgerRequest,
} from 'indy-sdk';
import { Wallet } from '../../../wallet/Wallet';
import { UnpackedMessageContext } from '../../../types';
export class StubWallet implements Wallet {
public get walletHandle() {
return 0;
}
public get publicDid() {
return undefined;
}
public init(): Promise<void> {
return Promise.resolve();
}
public close(): Promise<void> {
throw new Error('Method not implemented.');
}
public createProof(
proofRequest: IndyProofRequest,
requestedCredentials: IndyRequestedCredentials,
schemas: Schemas,
credentialDefs: CredentialDefs,
revStates: RevStates
): Promise<IndyProof> {
throw new Error('Method not implemented.');
}
public searchCredentialsForProofRequest(proofRequest: IndyProofRequest): Promise<number> {
throw new Error('Method not implemented.');
}
public getCredential(credentialId: string): Promise<IndyCredentialInfo> {
throw new Error('Method not implemented.');
}
public delete(): Promise<void> {
throw new Error('Method not implemented.');
}
public initPublicDid(didConfig: DidConfig): Promise<void> {
throw new Error('Method not implemented.');
}
public createDid(didConfig?: DidConfig | undefined): Promise<[string, string]> {
throw new Error('Method not implemented.');
}
public createCredentialDefinition(
issuerDid: string,
schema: Schema,
tag: string,
signatureType: string,
config: CredDefConfig
): Promise<[string, CredDef]> {
throw new Error('Method not implemented.');
}
public createCredentialOffer(credDefId: string): Promise<CredOffer> {
return Promise.resolve({
schema_id: 'aaa',
cred_def_id: credDefId,
// Fields below can depend on Cred Def type
nonce: 'nonce',
key_correctness_proof: {},
});
}
public getCredentialsForProofReq(proof: string): Promise<ProofCred> {
throw new Error('Method not implemented');
}
public createCredentialRequest(
proverDid: string,
offer: CredOffer,
credDef: CredDef
): Promise<[CredReq, CredReqMetadata]> {
return Promise.resolve([
{
prover_did: proverDid,
cred_def_id: credDef.id,
blinded_ms: {},
blinded_ms_correctness_proof: {},
nonce: 'nonce',
},
{ cred_req: 'meta-data' },
]);
}
public createCredential(
credOffer: CredOffer,
credReq: CredReq,
credValues: CredValues
): Promise<[Cred, CredRevocId, RevocRegDelta]> {
return Promise.resolve([
{
schema_id: 'schema_id',
cred_def_id: 'cred_def_id',
rev_reg_def_id: 'rev_reg_def_id',
values: {},
signature: 'signature',
signature_correctness_proof: 'signature_correctness_proof',
},
'1',
{},
]);
}
public storeCredential(credentialId: CredentialId): Promise<string> {
return Promise.resolve(credentialId);
}
public pack(payload: Record<string, unknown>, recipientKeys: string[], senderVk: string | null): Promise<JsonWebKey> {
throw new Error('Method not implemented.');
}
public unpack(messagePackage: JsonWebKey): Promise<UnpackedMessageContext> {
throw new Error('Method not implemented.');
}
public sign(data: Buffer, verkey: string): Promise<Buffer> {
throw new Error('Method not implemented.');
}
public verify(signerVerkey: string, data: Buffer, signature: Buffer): Promise<boolean> {
throw new Error('Method not implemented.');
}
public addWalletRecord(type: string, id: string, value: string, tags: Record<string, string>): Promise<void> {
throw new Error('Method not implemented.');
}
public updateWalletRecordValue(type: string, id: string, value: string): Promise<void> {
throw new Error('Method not implemented.');
}
public updateWalletRecordTags(type: string, id: string, tags: Record<string, string>): Promise<void> {
throw new Error('Method not implemented.');
}
public deleteWalletRecord(type: string, id: string): Promise<void> {
throw new Error('Method not implemented.');
}
public getWalletRecord(type: string, id: string, options: WalletRecordOptions): Promise<WalletRecord> {
throw new Error('Method not implemented.');
}
public search(type: string, query: WalletQuery, options: WalletRecordOptions): Promise<AsyncIterable<WalletRecord>> {
throw new Error('Method not implemented.');
}
public signRequest(myDid: string, request: LedgerRequest): Promise<LedgerRequest> {
throw new Error('Method not implemented.');
}
public async generateNonce(): Promise<string> {
throw new Error('Method not implemented');
}
}