-
Notifications
You must be signed in to change notification settings - Fork 11
/
SchemaRegistryInterface.sol
79 lines (74 loc) · 3.15 KB
/
SchemaRegistryInterface.sol
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
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.20;
import { SchemaRecord } from "./SchemaTypes.sol";
interface SchemaRegistryInterface {
/**
* @dev Event that is sent when a Schema is created
*
* @param schemaId Keccak hash of created schema id
* @param identity Issuer address
*/
event SchemaCreated(bytes32 schemaId, address identity);
/**
* @dev Creates a new Schema.
*
* Once the Schema is created, this function emits a `SchemaCreated` event
* with the new Schema ID and issuer address.
*
* This function can revert with following errors:
* - `SchemaAlreadyExist`: Raised if Schema with provided ID already exist.
* - `IssuerNotFound`: Raised if the associated issuer doesn't exist.
* - `InvalidIssuerId`: Raised if the provided issuer DID is invalid.
* - `IssuerHasBeenDeactivated`: Raised if the associated issuer is not active.
* - `NotIdentityOwner`: Raised when an issuer DID specified in Schema is not owned by sender
*
* @param identity Account address of schema issuer.
* @param id Keccak hash of Schema id to be created.
* @param issuerId DID of Schema issuer.
* @param schema AnonCreds schema JSON as bytes.
*/
function createSchema(address identity, bytes32 id, string calldata issuerId, bytes calldata schema) external;
/**
* @dev Endorse a new Schema (off-chain author signature)..
*
* Once the Schema is created, this function emits a `SchemaCreated` event
* with the new Schema ID and issuer address.
*
* Restrictions:
* - Only senders with either TRUSTEE or ENDORSER or STEWARD role are permitted to create new object;
*
* This function can revert with following errors:
* - `SchemaAlreadyExist`: Raised if Schema with provided ID already exist.
* - `IssuerNotFound`: Raised if the associated issuer doesn't exist.
* - `InvalidIssuerId`: Raised if the provided issuer DID is invalid.
* - `IssuerHasBeenDeactivated`: Raised if the associated issuer is not active.
* - `NotIdentityOwner`: Raised when an issuer DID specified in Schema is not owned by signer
*
* @param identity Account address of schema issuer.
* @param sigV Part of EcDSA signature.
* @param sigR Part of EcDSA signature.
* @param sigS Part of EcDSA signature.
* @param id Keccak hash of Schema id to be created.
* @param issuerId DID of Schema issuer.
* @param schema AnonCreds schema JSON as bytes.
*/
function createSchemaSigned(
address identity,
uint8 sigV,
bytes32 sigR,
bytes32 sigS,
bytes32 id,
string calldata issuerId,
bytes calldata schema
) external;
/**
* @dev Resolve the Schema associated with the given ID.
*
* If no matching Schema is found, the function revert with `SchemaNotFound` error
*
* @param id Keccak hash of Schema id to be resolved.
*
* @return schemaRecord Returns the Schema with Metadata.
*/
function resolveSchema(bytes32 id) external returns (SchemaRecord memory schemaRecord);
}