-
Notifications
You must be signed in to change notification settings - Fork 78
/
Copy pathRSAPCD.ts
44 lines (37 loc) · 1005 Bytes
/
RSAPCD.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
import { PCD, StringArgument } from "@pcd/pcd-types";
export const RSAPCDTypeName = "rsa-pcd";
export type RSAPCDArgs = {
privateKey: StringArgument;
signedMessage: StringArgument;
id: StringArgument;
};
export interface RSAPCDClaim {
/**
* Message that was signed by the RSA private key corresponding to
* {@link RSAPCDProof#publicKey}.
*/
message: string;
}
export interface RSAPCDProof {
/**
* RSA public key corresponding to the private key which signed
* {@link RSAPCDClaim#message}.
*/
publicKey: string;
/**
* The signature of {@link RSAPCDClaim#message} with the RSA
* private key corresponding to {@link RSAPCDProof#publicKey}
*/
signature: string;
}
export class RSAPCD implements PCD<RSAPCDClaim, RSAPCDProof> {
type = RSAPCDTypeName;
claim: RSAPCDClaim;
proof: RSAPCDProof;
id: string;
public constructor(id: string, claim: RSAPCDClaim, proof: RSAPCDProof) {
this.id = id;
this.claim = claim;
this.proof = proof;
}
}