-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathissueCredential.js
30 lines (29 loc) · 1.56 KB
/
issueCredential.js
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
const collectionId = "a8563cce-7b62-4c1a-a9ae-c909dda236e9"; // Replace with your actual collection ID
const options = {
method: "POST",
headers: {
"X-API-KEY": "sk_staging_AGQCMCiEigeFJttJ3BbSjyBDbaxjMW4DB6kQ9vW2hLVaLKc36QQUWdYZHnhYvfTXS4Y9Y4w7VNke1qRStay1nkqCCK2KDpjHa2RdLx54Sm3qUfFUP4AKq5qXQLZcs5SNsFxohxZqgde8rVnJi9WGsDFVnsdVH8ABeq17m4qkGVTfYXxpyFa4CJ16V9rEUgb9SuWsTeob386JVrvQ5q5XZrrV", // Replace with your actual API key
"Content-Type": "application/json",
},
body: JSON.stringify({
metadata: {
name: "Voter Verification Credential",
image: "ipfs://QmUGeWerAfyKVVdAjaxYdAhK74oJmBvusPdKtNDN3e1bYN", // Optional: A relevant image or icon if you have one // copied the image from the documentation
description: "Credential for verifying voter eligibility."
},
recipient: "polygon:0x6C3b3225759Cbda68F96378A9F0277B4374f9F06", // Replace with the recipient's actual blockchain address email:[email protected]:polygon
credential: {
subject: {
voterID: "Voter123456", // Example Voter ID, replace with actual data
age: "15", // Age as a string
citizenship: "US", // Citizenship, matching your schema requirements
eligibleToVote: false, // This should match the type expected by your schema, boolean
},
expiresAt: "2034-02-02" // Expiration date of the credential
}
}),
};
fetch(`https://staging.crossmint.com/api/unstable/collections/${collectionId}/credentials`, options)
.then((response) => response.json())
.then((response) => console.log(response))
.catch((err) => console.error(err));