31
32 app.get("/", async () => {
33 return {
34 id: id,35 title: "👋 Welcome to Crypto Server!",
36 description: "Crypto Server is a Fastify web server that exposes easy consumable REST APIs to perform low-level cryptographic operations.",
37 details: "It supports the following cryptographic operations:\n- Digital Signing,\n- Encryption and Decryption,\n- Key Generation,\n- Key Management,\n- Pseudorandom Number Generation,\n- Signature Verification.\n- Development of this server is hosted by GitHub at the following page. Source code is available to everyone under the standard MIT license.",
52 const revokeKey = await openpgp.revokeKey({
53 date: new Date(), // revocation date
54 key: privateKeyRead, // private key object
55 reasonForRevocation: { flag: flag, string: reason }, // optional, default: 056 });
57
58 console.log(revokeKey);
59 });
60
61 const signOptions: openpgp.SignOptions = {
62 detached: detached,63 message: unsignedMessage,
64 signingKeys: privateKeyRead,
65 };
56 const reformatKeys = await openpgp.reformatKey({
57 privateKey: privateKey,
58 userIDs: [{ name: data.name, email: data.email }],
59 passphrase: passphrase, 60 keyExpirationTime: expiration,
61 date: new Date(),
62 format: "armored",
54 });
55
56 const reformatKeys = await openpgp.reformatKey({
57 privateKey: privateKey, 58 userIDs: [{ name: data.name, email: data.email }],
59 passphrase: passphrase,
60 keyExpirationTime: expiration,
ECMAScript 6 provides a concise form for defining object literal methods and properties. This syntax can make defining complex object literals much cleaner.
Here are a few common examples using the ES5 syntax:
const x = 1, y = 2, z = 3;
// properties
const foo = {
x: x,
y: y,
z: z,
};
// methods
const foo = {
a: function() {},
b: function() {}
};
The ES6 equivalent syntax is::
// properties
const foo = {x, y, z};
// methods
const bar = {
a() { return 1 },
b() { return 2 }
};
NOTE: The shorthand properties are equivalent to function expressions.
Meaning that they do not bind their own this
inside their bodies.
It is still possible to access properties from the object inside a shorthand member function:
const object = {
x: 1,
getX() {
return this.x // valid
}
}
const foo = {
bar: function () { return 1 }
};
const foo = {
bar() { return 1 }
}