Skip to content

Commit

Permalink
feat: Create common SSI types package
Browse files Browse the repository at this point in the history
  • Loading branch information
nklomp committed Sep 2, 2022
1 parent b4151a9 commit 0fdc372
Show file tree
Hide file tree
Showing 26 changed files with 576 additions and 78 deletions.
1 change: 1 addition & 0 deletions packages/ion-did-provider/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
*/
export { IonDIDProvider } from './ion-did-provider'
export { getDidIonResolver } from './ion-did-resolver'
export * from './types/ion-provider-types'
1 change: 1 addition & 0 deletions packages/ssi-sdk-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
},
"dependencies": {
"@scure/base": "^1.1.1",
"@sphereon/ssi-types": "^0.7.0",
"@veramo/core": "3.1.2-next.84"
},
"devDependencies": {
Expand Down
6 changes: 1 addition & 5 deletions packages/ssi-sdk-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,11 @@ export {
VerifiablePresentationSP,
UnsignedPresentationSP,
VerifiableCredentialSP,
PresentationSubmission,
CredentialProofSP,
CredentialStatusSP,
W3CVerifiableCredentialSP,
W3CVerifiablePresentationSP,
ProofPurpose,
UnsignedCredentialSP,
Descriptor,
IParsedDID,
SignatureTypes,
ProofOptions,
} from './types'
export { SuppliedSigner } from './signers'
16 changes: 8 additions & 8 deletions packages/ssi-sdk-core/src/signers/SuppliedSigner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ export function SuppliedSigner(keyRef: Pick<IKey, 'kid'>, context: IAgentContext
return await context.agent.keyManagerSign({ keyRef: keyRef.kid, algorithm, data: input })
}
}
export declare type Signer = (data: string | Uint8Array) => Promise<EcdsaSignature | string>;
export declare type Signer = (data: string | Uint8Array) => Promise<EcdsaSignature | string>

export declare enum KeyAlgo {
EDDSA = "EdDSA",
RS256 = "RS256",
ES256 = "ES256",
ES256K = "ES256K"
EDDSA = 'EdDSA',
RS256 = 'RS256',
ES256 = 'ES256',
ES256K = 'ES256K',
}
export interface EcdsaSignature {
r: string;
s: string;
recoveryParam?: number | null;
r: string
s: string
recoveryParam?: number | null
}
12 changes: 0 additions & 12 deletions packages/ssi-sdk-core/src/types/IParsedDid.ts

This file was deleted.

3 changes: 1 addition & 2 deletions packages/ssi-sdk-core/src/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export * from './vc-data-models'
export * from './presentation-exchange'
export * from './IParsedDid'
export * from './signatures'
6 changes: 3 additions & 3 deletions packages/ssi-sdk-core/src/types/signatures.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { ProofPurpose, SignatureTypes } from './vc-data-models'
import { IProofPurpose, IProofType } from '@sphereon/ssi-types'

export interface ProofOptions {
/**
* The signature type. For instance RsaSignature2018
*/
type?: SignatureTypes | string
type?: IProofType | string

/**
* Type supports selective disclosure?
Expand All @@ -24,7 +24,7 @@ export interface ProofOptions {
/**
* The purpose of this proof, for instance assertionMethod or authentication, see https://www.w3.org/TR/vc-data-model/#proofs-signatures-0
*/
proofPurpose?: ProofPurpose | string
proofPurpose?: IProofPurpose | string

/**
* The ISO8601 date-time string for creation. You can update the Proof value later in the callback. If not supplied the current date/time will be used
Expand Down
30 changes: 4 additions & 26 deletions packages/ssi-sdk-core/src/types/vc-data-models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,12 @@ import {
ProofType,
CredentialStatus,
} from '@veramo/core'
import { PresentationSubmission } from './presentation-exchange'

import { IProofPurpose, IProofType, PresentationSubmission } from '@sphereon/ssi-types'

export type W3CVerifiablePresentationSP = VerifiablePresentation | VerifiablePresentationSP | CompactJWT
export type W3CVerifiableCredentialSP = VerifiableCredential | VerifiableCredentialSP | CompactJWT

export enum SignatureTypes {
Ed25519Signature2018 = 'Ed25519Signature2018',
Ed25519Signature2020 = 'Ed25519Signature2020',
EcdsaSecp256k1Signature2019 = 'EcdsaSecp256k1Signature2019',
EcdsaSecp256k1RecoverySignature2020 = 'EcdsaSecp256k1RecoverySignature2020',
JsonWebSignature2020 = 'JsonWebSignature2020',
RsaSignature2018 = 'RsaSignature2018',
GpgSignature2020 = 'GpgSignature2020',
JcsEd25519Signature2020 = 'JcsEd25519Signature2020',
BbsBlsSignatureProof2020 = 'BbsBlsSignatureProof2020',
BbsBlsBoundSignatureProof2020 = 'BbsBlsBoundSignatureProof2020',
}

export enum ProofPurpose {
verificationMethod = 'verificationMethod',
assertionMethod = 'assertionMethod',
authentication = 'authentication',
keyAgreement = 'keyAgreement',
contractAgreement = 'contactAgreement',
capabilityInvocation = 'capabilityInvocation',
capabilityDelegation = 'capabilityDelegation',
}

export interface CredentialStatusSP extends CredentialStatus {
id: string
type: string
Expand All @@ -56,9 +34,9 @@ export interface CredentialStatusSP extends CredentialStatus {
}*/

export interface CredentialProofSP extends ProofType {
type: string | SignatureTypes // The proof type
type: string | IProofType // The proof type
created: string // The ISO8601 date-time string for creation
proofPurpose: ProofPurpose | string // The specific intent for the proof
proofPurpose: IProofPurpose | string // The specific intent for the proof
verificationMethod: string // A set of parameters required to independently verify the proof
challenge?: string // A challenge to protect against replay attacks
domain?: string // A string restricting the (usage of a) proof to the domain and protects against replay attacks
Expand Down
2 changes: 1 addition & 1 deletion packages/ssi-sdk-core/src/utils/dids.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IParsedDID } from '../types'
import { IParsedDID } from '@sphereon/ssi-types'

export const parseDid = (did: string): IParsedDID => {
const parsedDid = parse(did)
Expand Down
3 changes: 2 additions & 1 deletion packages/ssi-sdk-core/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"compilerOptions": {
"rootDir": "src",
"outDir": "dist"
}
},
"references": [{ "path": "../ssi-types" }]
}
49 changes: 49 additions & 0 deletions packages/ssi-types/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Change Log

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [0.7.0](https://github.com/Sphereon-OpenSource/ssi-sdk/compare/v0.6.0...v0.7.0) (2022-08-05)

**Note:** Version bump only for package @sphereon/ssi-sdk-core

# [0.6.0](https://github.com/Sphereon-OpenSource/ssi-sdk/compare/v0.5.1...v0.6.0) (2022-07-01)

**Note:** Version bump only for package @sphereon/ssi-sdk-core

# [0.5.0](https://github.com/Sphereon-OpenSource/ssi-sdk/compare/v0.4.0...v0.5.0) (2022-02-23)

**Note:** Version bump only for package @sphereon/ssi-sdk-core

# [0.4.0](https://github.com/Sphereon-OpenSource/ssi-sdk/compare/v0.3.4...v0.4.0) (2022-02-11)

**Note:** Version bump only for package @sphereon/ssi-sdk-core

## [0.3.4](https://github.com/Sphereon-OpenSource/ssi-sdk/compare/v0.3.3...v0.3.4) (2022-02-11)

**Note:** Version bump only for package @sphereon/ssi-sdk-core

## [0.3.1](https://github.com/Sphereon-OpenSource/ssi-sdk/compare/v0.3.0...v0.3.1) (2022-01-28)

**Note:** Version bump only for package @sphereon/ssi-sdk-core

# [0.3.0](https://github.com/Sphereon-OpenSource/ssi-sdk/compare/v0.2.0...v0.3.0) (2022-01-16)

**Note:** Version bump only for package @sphereon/ssi-sdk-core

# [0.2.0](https://github.com/Sphereon-OpenSource/ssi-sdk/compare/v0.1.0...v0.2.0) (2021-12-16)

### Bug Fixes

- Multibase encoding didn't include the prefix char ([1be44b7](https://github.com/Sphereon-OpenSource/ssi-sdk/commit/1be44b7f281b82370a59a321f25057bee34d58de))

### Features

- Add JSON-LD Credential and Presentation handling/sign support that is compatible with React-Native ([995f55e](https://github.com/Sphereon-OpenSource/ssi-sdk/commit/995f55efd5237e3fbd76e6569e09ee3bbcbb686c))

# 0.1.0 (2021-11-26)

### Features

- Add ssi-sdk core module ([42a5b65](https://github.com/Sphereon-OpenSource/ssi-sdk/commit/42a5b65fa3795284fc16b06d2a36c4bf4ea87668))
- Add workspace/lerna files and structures ([2c2b112](https://github.com/Sphereon-OpenSource/ssi-sdk/commit/2c2b11244c2e5e3d2d1b1db76af3d86ec300bc72))
Loading

0 comments on commit 0fdc372

Please sign in to comment.