Skip to content

Commit

Permalink
Merge pull request #11 from MichaelFraser99/readme
Browse files Browse the repository at this point in the history
updated readme
  • Loading branch information
MichaelFraser99 authored Dec 22, 2023
2 parents df3d246 + a25d917 commit 986ebb3
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,25 @@ type Disclosure struct {
```
This object represents a single disclosure in a SD-JWT. The EncodedValue property returns the disclosure string as provided in the original sd jwt

```go
func NewFromObject(key string, value any, salt *string) (*Disclosure, error)
```
NewFromObject creates a Disclosure object for the provided key/value pair and optional salt. If no salt provided, a new salt value of 128 bytes is generated

```go
func NewFromArrayElement(element any, salt *string) (*Disclosure, error)
```
NewFromArrayElement creates a Disclosure object for the provided array element and optional salt. If no salt provided, a new salt value of 128 bytes is generated

```go
func NewFromDisclosure(disclosure string) (*Disclosure, error)
```
Salt returns the salt of the disclosure
NewFromDisclosure creates a Disclosure object from the provided encoded disclosure string

```go
func (d *Disclosure) Hash(hash hash.Hash)
```
Hash returns the digest bytes of the current disclosure using the provided hash

### SdJwt
```go
Expand Down Expand Up @@ -96,6 +112,14 @@ match an included digest
4. The SD-JWT has a disclosure that is malformed for the use (e.g. doesn't contain a claim
name for a non-array digest)

### Usage
For an example e2e flow of an SD Jwt see the e2e_test
Contains examples of:
- creating an SD Jwt as an issuer
- receiving the SD Jwt as a holder
- re-issuing the SD Jwt as a holder with a subset of disclosures
- receiving the SD Jwt as a consumer

### Errors
This package defines the following errors:
- InvalidToken - The provided token is malformed in some way
Expand Down

0 comments on commit 986ebb3

Please sign in to comment.