Skip to content

Commit

Permalink
reduced crypto suites enum
Browse files Browse the repository at this point in the history
  • Loading branch information
kostysh committed Dec 6, 2021
1 parent dfd3c27 commit cf800a9
Show file tree
Hide file tree
Showing 12 changed files with 86 additions and 228 deletions.
4 changes: 2 additions & 2 deletions docs/org-json.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ A `verificationMethod` is a set of parameters that can be used for the verificat
"verificationMethod": [
{
"id": "did:orgid:0x94b...ad75#key1",
"type": "EcdsaSecp256k1VerificationKey2019",
"type": "EcdsaSecp256k1RecoveryMethod2020",
"controller": "did:orgid:0x94b...ad75",
"publicKeyJwk": {
"crv": "secp256k1",
Expand All @@ -116,7 +116,7 @@ A `verificationMethod` is a set of parameters that can be used for the verificat
}
```

The example above illustrate a definition of the verification method that uses `EcdsaSecp256k1VerificationKey2019` cryptography suite. The public key in this example is represented in a JWK form.
The example above illustrate a definition of the verification method that uses `EcdsaSecp256k1RecoveryMethod2020` cryptography suite. The public key in this example is represented in a JWK form.

The ORGiD SDK supports the generation of various types of key representations but currently, for verification and assetion purposes can be used the following types:

Expand Down
22 changes: 1 addition & 21 deletions examples/legal-entity.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"verificationMethod": [
{
"id": "did:orgid:0x94bf5a57b850a35b4d1d7b59f663ce3a8a76fd9928ef2067cc772fc97fb0ad75#webserver",
"type": "EcdsaSecp256k1VerificationKey2019",
"type": "EcdsaSecp256k1RecoveryMethod2020",
"controller": "did:orgid:0x94bf5a57b850a35b4d1d7b59f663ce3a8a76fd9928ef2067cc772fc97fb0ad75",
"publicKeyPem": "MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAE/7GpAW4+se9gZOFPtwk63ZhV1nX6M0UobMYO6FMAnON6vCbglyOaRzEltugkp6GrM8LZ6is0rMBMAXCvb9FH2g==",
"note": "B2C Webserver Key",
Expand Down Expand Up @@ -55,26 +55,6 @@
}
],
"trustAssertions": [
{
"type": "dns",
"claim": "test.com",
"proof": "TXT"
},
{
"type": "domain",
"claim": "test2.com",
"proof": "http://test2.com/orgid.txt"
},
{
"type": "domain",
"claim": "test3.com",
"proof": "http://test3.com/orgid.txt"
},
{
"type": "social",
"claim": "twitter.com/jack",
"proof": "https://twitter.com/jack/status/123456789/"
},
{
"@context": [
"https://www.w3.org/2018/credentials/v1",
Expand Down
25 changes: 2 additions & 23 deletions examples/org-vc.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"verificationMethod": [
{
"id": "did:orgid:0x94bf5a57b850a35b4d1d7b59f663ce3a8a76fd9928ef2067cc772fc97fb0ad75#webserver",
"type": "EcdsaSecp256k1VerificationKey2019",
"type": "EcdsaSecp256k1RecoveryMethod2020",
"controller": "did:orgid:0x94bf5a57b850a35b4d1d7b59f663ce3a8a76fd9928ef2067cc772fc97fb0ad75",
"publicKeyPem": "MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAE/7GpAW4+se9gZOFPtwk63ZhV1nX6M0UobMYO6FMAnON6vCbglyOaRzEltugkp6GrM8LZ6is0rMBMAXCvb9FH2g==",
"note": "B2C Webserver Key"
Expand Down Expand Up @@ -62,28 +62,7 @@
"description": "Bookings and service payments"
}
],
"trustAssertions": [
{
"type": "domain",
"claim": "test.com",
"proof": "dns"
},
{
"type": "social",
"claim": "twitter.com/jack",
"proof": "https://twitter.com/status/123456789/"
},
{
"type": "social",
"claim": "facebook.com/MyBusinessPage",
"proof": "https://www.facebook.com/MyBusinessPage/photos/a.672157592834538/2030288447021439/"
},
{
"type": "social",
"claim": "instagram.com/myinstagramusername",
"proof": "https://instagram.com/p/123456789/"
}
],
"trustAssertions": [],
"credentials": [
{
"@context": [
Expand Down
27 changes: 3 additions & 24 deletions examples/unit.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"verificationMethod": [
{
"id": "did:orgid:0x94bf5a57b850a35b4d1d7b59f663ce3a8a76fd9928ef2067cc772fc97fb0ad75#webserver",
"type": "EcdsaSecp256k1VerificationKey2019",
"type": "EcdsaSecp256k1RecoveryMethod2020",
"controller": "did:orgid:0x94bf5a57b850a35b4d1d7b59f663ce3a8a76fd9928ef2067cc772fc97fb0ad75",
"publicKeyPem": "MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAE/7GpAW4+se9gZOFPtwk63ZhV1nX6M0UobMYO6FMAnON6vCbglyOaRzEltugkp6GrM8LZ6is0rMBMAXCvb9FH2g==",
"note": "B2C Webserver Key"
Expand Down Expand Up @@ -50,28 +50,7 @@
"description": "Bookings and service payments"
}
],
"trustAssertions": [
{
"type": "domain",
"claim": "test.com",
"proof": "dns"
},
{
"type": "social",
"claim": "twitter.com/jack",
"proof": "https://twitter.com/status/123456789/"
},
{
"type": "social",
"claim": "facebook.com/MyBusinessPage",
"proof": "https://www.facebook.com/MyBusinessPage/photos/a.672157592834538/2030288447021439/"
},
{
"type": "social",
"claim": "instagram.com/myinstagramusername",
"proof": "https://instagram.com/p/123456789/"
}
],
"trustAssertions": [],
"credentials": [
{
"@context": [
Expand Down Expand Up @@ -108,7 +87,7 @@
"did:orgid:4:0x94bf5a57b850a35b4d1d7b59f663ce3a8a76fd9928ef2067cc772fc97fb0ad75#webserver",
{
"id": "did:orgid:1:0x94bf5a57b850a35b4d1d7b59f663ce3a8a76fd9928ef2067cc772fc97fb0ad75#webserver",
"type": "EcdsaSecp256k1VerificationKey2019",
"type": "EcdsaSecp256k1RecoveryMethod2020",
"controller": "did:orgid:0x94bf5a57b850a35b4d1d7b59f663ce3a8a76fd9928ef2067cc772fc97fb0ad75",
"publicKeyPem": "MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAE/7GpAW4+se9gZOFPtwk63ZhV1nX6M0UobMYO6FMAnON6vCbglyOaRzEltugkp6GrM8LZ6is0rMBMAXCvb9FH2g==",
"note": "B2C Webserver Key"
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@windingtree/org.json-schema",
"version": "1.0.0-beta.5",
"version": "1.0.0-beta.6",
"description": "ORG.ID JSON schema for WT protocol",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand All @@ -24,15 +24,15 @@
},
"homepage": "https://github.com/windingtree/org.json-schema#readme",
"devDependencies": {
"@types/node": "16.11.7",
"typescript": "4.4.4",
"ajv": "8.8.0",
"@types/node": "16.11.11",
"typescript": "4.5.2",
"ajv": "8.8.2",
"ajv-formats": "2.1.1",
"chai": "4.3.4",
"js-yaml": "4.1.0",
"json-schema-to-typescript": "10.1.5",
"mocha": "9.1.3",
"eslint": "8.2.0"
"eslint": "8.4.0"
},
"publishConfig": {
"access": "public"
Expand Down
25 changes: 6 additions & 19 deletions src/org.json.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,7 @@ definitions:
description: List of trust assertions (claims with proofs)
type: array
items:
oneOf:
- $ref: '#/definitions/AssertionReference'
allOf:
- $ref: './vc.yaml#/definitions/CredentialReference'
CredentialsReference:
description: List of credentials (provided and signed by third parties)
Expand Down Expand Up @@ -253,11 +252,6 @@ definitions:
Proof of the claim: dns record, text file URI, or link to a post on
facebook, linkedin, etc.
type: string
ProofReference:
description: >-
A linked data proof is comprised of information about the proof,
parameters required to verify it, and the proof value itself.
type: object
VerificationMethodReference:
description: >-
Public keys are used for digital signatures, encryption and other
Expand Down Expand Up @@ -288,7 +282,7 @@ definitions:
example: >-
-----BEGIN PUBLIC KEY-----\nMII8YbF3s8q3c...j8Fk88FsRa3K\n-----END PUBLIC KEY-----\n
publicKeyJwk:
description: Public key in JWT format
description: Public key in JWT format (recommended key format)
$ref: '#/definitions/PublicKeyJwkReference'
publicKeyBase58:
description: Public key in value in Base58 Bitcoin format
Expand All @@ -300,9 +294,9 @@ definitions:
$ref: '#/definitions/VerificationMethodRevocationReference'
example: >-
{
"id": "did:orgid:0x94bf5a57b850a35b4d1d7b59f663ce3a8a76fd9928ef2067cc772fc97fb0ad75#webserver",
"type": "secp256k1",
"controller": "did:orgid:0x94bf5a57b850a35b4d1d7b59f663ce3a8a76fd9928ef2067cc772fc97fb0ad75",
"id": "did:orgid:1:0x94bf5a57b850a35b4d1d7b59f663ce3a8a76fd9928ef2067cc772fc97fb0ad75#key1",
"type": "EcdsaSecp256k1RecoveryMethod2020",
"controller": "did:orgid:1:0x94bf5a57b850a35b4d1d7b59f663ce3a8a76fd9928ef2067cc772fc97fb0ad75",
"publicKeyPem": "MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAE/7GpAW4+se9gZOFPtwk63ZhV1nX6M0UobMYO6FMAnON6vCbglyOaRzEltugkp6GrM8LZ6is0rMBMAXCvb9FH2g==",
"note": "B2C Webserver Key"
}
Expand Down Expand Up @@ -764,8 +758,6 @@ definitions:
pattern: "^([a-zA-Z-0-9]+)@([a-zA-Z-0-9]+):([a-zA-Z-0-9]+)$" # <ACCOUNT_ADDRESS>@<BLOCKCHAIN_TYPE_OR_STANDARD>:<BLOCKCHAIN_ID_ACCORDING_TO_TYPE> https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-10.md
example: >-
0xab16a96d359ec26a11e2c2b3d8f8b8942d5bfcdb@eip155:1
128Lkh3S7CkDTBZ8W7BbpsN3YYizJMp8p6@bip122:000000000019d6689c085ae165831e93
cosmos1t2uflqwqe0fsj0shcfkrvpukewcw40yjj6hdc0@cosmos:cosmoshub-3
SwiftCode:
description: SWIFT/BIC bank code according to ISO 9326
type: string
Expand All @@ -782,12 +774,7 @@ definitions:
description: The cryptographic suite type
type: string
enum:
- JsonWebKey2020 # Common specification of the public key encoded in the JWK format. For details see: https://w3c-ccg.github.io/lds-jws2020/#json-web-key-2020
- EcdsaSecp256k1VerificationKey2019 # Secp256k1 Koblitz public key values MUST either be encoded as a JWK or be encoded as the raw 33-byte public key value in Base58 Bitcoin format using the publicKeyBase58 property.
- Ed25519VerificationKey2018 # Ed25519 public key values MUST either be encoded as a JWK or be encoded as the raw 32-byte public key value in Base58 Bitcoin format using the publicKeyBase58 property.
- RsaVerificationKey2018 # RSA public key values MUST either be encoded as a JWK or be encoded in Privacy Enhanced Mail (PEM) format using the publicKeyPem property
- X25519KeyAgreementKey2019 # Curve25519 (also known as X25519) public key values MUST either be encoded as a JWK or be encoded as the raw 32-byte public key value in Base58 Bitcoin format using the publicKeyBase58 property.
- EcdsaSecp256k1RecoveryMethod2020 # Secp256k1 Koblitz public key values MUST be encoded as Ethereum address (blockchainId property)
- EcdsaSecp256k1RecoveryMethod2020 # Secp256k1 public key: https://w3c-ccg.github.io/ld-cryptosuite-registry/#ecdsasecp256k1recoverymethod2020
CapabilityDelegationReference:
description: >-
The capability delegation is used to specify mechanism that might be used
Expand Down
5 changes: 1 addition & 4 deletions src/vc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ definitions:
type: string
example: LawEnforcement
id:
description: Holder' ORGiD
description: Holder's ORGiD
$ref: './org.json.yaml#/definitions/DIDReference'
VCProofReference:
description: Digital proof that makes the credential tamper-evident
Expand Down Expand Up @@ -122,6 +122,3 @@ definitions:
type: string
enum:
- EcdsaSecp256k1Signature2019 # https://w3c-ccg.github.io/security-vocab/#EcdsaSecp256k1Signature2019
- Ed25519Signature2018 # https://w3c-ccg.github.io/security-vocab/#Ed25519Signature2018
- RsaSignature2018 # https://w3c-ccg.github.io/security-vocab/#RsaSignature2018
- EcdsaSecp256k1RecoverySignature2020 # https://w3c-ccg.github.io/security-vocab/#EcdsaSecp256k1RecoverySignature2020
36 changes: 4 additions & 32 deletions types/org.json/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,11 @@ export type BlockchainAccountId = string;
/**
* The cryptographic signature suite that was used to generate the signature
*/
export type CryptographicSignatureSuiteReference =
| "EcdsaSecp256k1Signature2019"
| "Ed25519Signature2018"
| "RsaSignature2018"
| "EcdsaSecp256k1RecoverySignature2020";
export type CryptographicSignatureSuiteReference = "EcdsaSecp256k1Signature2019";
/**
* List of trust assertions (claims with proofs)
*/
export type TrustAssertionsReference = (AssertionReference | CredentialReference)[];
export type TrustAssertionsReference = CredentialReference[];
/**
* List of credentials (provided and signed by third parties)
*/
Expand Down Expand Up @@ -126,13 +122,7 @@ export interface VerificationMethodReference {
/**
* The cryptographic suite that was used to generate a public key
*/
type:
| "JsonWebKey2020"
| "EcdsaSecp256k1VerificationKey2019"
| "Ed25519VerificationKey2018"
| "RsaVerificationKey2018"
| "X25519KeyAgreementKey2019"
| "EcdsaSecp256k1RecoveryMethod2020";
type: "EcdsaSecp256k1RecoveryMethod2020";
/**
* The DID subject is denoted by the id property. The DID subject is the entity that the DID document (ORG.JSON) is about. That is, it is the entity identified by the DID and described in the DID document.
*/
Expand All @@ -146,7 +136,7 @@ export interface VerificationMethodReference {
*/
publicKeyPem?: string;
/**
* Public key in JWT format
* Public key in JWT format (recommended key format)
*/
publicKeyJwk?: {
[k: string]: unknown;
Expand Down Expand Up @@ -235,24 +225,6 @@ export interface PaymentReference {
iban?: string;
[k: string]: unknown;
}
/**
* Trust assertion
*/
export interface AssertionReference {
/**
* Claim subject. E.g. domain name or social account
*/
claim: string;
/**
* Proof type: (domain|dns|social)
*/
type: "domain" | "dns" | "social";
/**
* Proof of the claim: dns record, text file URI, or link to a post on facebook, linkedin, etc.
*/
proof: string;
[k: string]: unknown;
}
/**
* ORGiD Verifiable Credentials Schema
*/
Expand Down
38 changes: 5 additions & 33 deletions types/orgVc/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,7 @@ export type LinkedMultipleContextReference = LinkedContextReference[];
/**
* The cryptographic signature suite that was used to generate the signature
*/
export type CryptographicSignatureSuiteReference =
| "EcdsaSecp256k1Signature2019"
| "Ed25519Signature2018"
| "RsaSignature2018"
| "EcdsaSecp256k1RecoverySignature2020";
export type CryptographicSignatureSuiteReference = "EcdsaSecp256k1Signature2019";
/**
* Name of the item
*/
Expand Down Expand Up @@ -78,7 +74,7 @@ export type BlockchainAccountId = string;
/**
* List of trust assertions (claims with proofs)
*/
export type TrustAssertionsReference = (AssertionReference | CredentialReference)[];
export type TrustAssertionsReference = CredentialReference[];
/**
* List of credentials (provided and signed by third parties)
*/
Expand Down Expand Up @@ -161,7 +157,7 @@ export interface VCTypedHolderReference {
*/
type: string;
/**
* Holder' ORGiD
* Holder's ORGiD
*/
id: string;
[k: string]: unknown;
Expand Down Expand Up @@ -269,13 +265,7 @@ export interface VerificationMethodReference {
/**
* The cryptographic suite that was used to generate a public key
*/
type:
| "JsonWebKey2020"
| "EcdsaSecp256k1VerificationKey2019"
| "Ed25519VerificationKey2018"
| "RsaVerificationKey2018"
| "X25519KeyAgreementKey2019"
| "EcdsaSecp256k1RecoveryMethod2020";
type: "EcdsaSecp256k1RecoveryMethod2020";
/**
* The DID subject is denoted by the id property. The DID subject is the entity that the DID document (ORG.JSON) is about. That is, it is the entity identified by the DID and described in the DID document.
*/
Expand All @@ -289,7 +279,7 @@ export interface VerificationMethodReference {
*/
publicKeyPem?: string;
/**
* Public key in JWT format
* Public key in JWT format (recommended key format)
*/
publicKeyJwk?: {
[k: string]: unknown;
Expand Down Expand Up @@ -378,24 +368,6 @@ export interface PaymentReference {
iban?: string;
[k: string]: unknown;
}
/**
* Trust assertion
*/
export interface AssertionReference {
/**
* Claim subject. E.g. domain name or social account
*/
claim: string;
/**
* Proof type: (domain|dns|social)
*/
type: "domain" | "dns" | "social";
/**
* Proof of the claim: dns record, text file URI, or link to a post on facebook, linkedin, etc.
*/
proof: string;
[k: string]: unknown;
}
/**
* Legal entity information
*/
Expand Down
Loading

0 comments on commit cf800a9

Please sign in to comment.