oydid 0.6.4 → 0.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/lib/oydid/log.rb +31 -2
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e048d33455d4b2b305d1905b1acea54c0f87f7a871998fa5a294b0669a245112
4
- data.tar.gz: 0ff2fabe31fe7352062e93ef8bce6c74dfa6afd7004db0f53ccfb13912b7e9d5
3
+ metadata.gz: 7cd355cc4bdc04a3d149199467cbbe4263ace619676422c722485fc6d459c83b
4
+ data.tar.gz: 85f8930282e7cbee45997d65a5cca1be2bea78f853cce44152d6b93808e1a923
5
5
  SHA512:
6
- metadata.gz: be4ef04a7f885cf2cbd870126a45fc97ec84444426dca4341102256dddbe17eddd3975e63ccd02687527fb43099cda7b1eba70e655cf5ecee4c64b21499237ca
7
- data.tar.gz: f4c305a56ce2952dc72632d9a3fdc13ee9282eefd40dc8fda65f5233bd8e82409a3ba90a64a4964503cb6ba3825cf89c24143311b6051630148fd21d51ef1a60
6
+ metadata.gz: e04e8cd58b7a29bb9e7dabffffcf613c9459c18ece1254b8cc1ad60b4d19d073276f18bd0f9c36b7cd6786340e1f81fb9be320f8964a182d5b861bfab9d5825f
7
+ data.tar.gz: 370d28f6c8614238b734a9a0dc8410de4007923c6ac7e464190ad36bd82bbba5f28def3e46d05c74d882b5ba5559f11cadf2a4a26b2ea0045ea87acd8a6503bb
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.4
1
+ 0.6.5
data/lib/oydid/log.rb CHANGED
@@ -141,6 +141,7 @@ class Oydid
141
141
  terminate_entries = 0
142
142
  terminate_overall = 0
143
143
  terminate_index = nil
144
+ revoked_terminate_found = false
144
145
  logs.each do |el|
145
146
  if el["op"].to_i == 0 # TERMINATE
146
147
  if dag.vertices[i].successors.length == 0
@@ -154,6 +155,7 @@ class Oydid
154
155
  dag.vertices[i].predecessors.each do |l|
155
156
  if logs[l[:id]]["op"].to_i == 0 # TERMINATE
156
157
  terminate_index = l[:id]
158
+ revoked_terminate_found = true
157
159
  end
158
160
  end
159
161
  end
@@ -161,11 +163,18 @@ class Oydid
161
163
  i += 1
162
164
  end unless logs.nil?
163
165
 
166
+ # NOTE: this is a structural check on the log and must not depend on how
167
+ # verbose the caller wants to be. Suppressing it under :silent returned a
168
+ # DID document for logs that cannot be resolved.
164
169
  if terminate_entries != 1 && !options[:log_complete] && !options[:followAlsoKnownAs]
165
- if options[:silent].nil? || !options[:silent]
170
+ # a revoked DID has no tangling TERMINATE entry (its TERMINATE is
171
+ # followed by the REVOKE record). That is not a broken log: continue
172
+ # so that dag_update can report the revocation - or apply DID
173
+ # Rotation - instead of the unspecific "cannot resolve DID".
174
+ unless terminate_entries == 0 && revoked_terminate_found
166
175
  return [nil, nil, nil, "cannot resolve DID" ]
167
176
  end
168
- end
177
+ end
169
178
 
170
179
  # create actual edges between vertices (but only use last terminate index for delegates)
171
180
  dag = DAG.new
@@ -254,8 +263,14 @@ class Oydid
254
263
  result.uniq
255
264
  end
256
265
 
266
+ # a DID is revoked when the REVOCATION record referenced by the current
267
+ # TERMINATE record has been published and no UPDATE record follows it
268
+ REVOKED_ERROR_CODE = 410
269
+
257
270
  def self.dag_update(currentDID, options)
258
271
  i = 0
272
+ revoked = false
273
+ rotation_performed = false
259
274
  doc_location = options[:doc_location].to_s
260
275
  initial_did = currentDID["did"].to_s.dup
261
276
  initial_did = initial_did.delete_prefix("did:oyd:")
@@ -501,6 +516,12 @@ class Oydid
501
516
  end
502
517
  end
503
518
 
519
+ # the revocation record is published and no UPDATE record
520
+ # builds on it: this DID is revoked. The verdict is only
521
+ # acted upon after the log has been walked completely, so
522
+ # that DID Rotation (handled in the REVOKE entry below) can
523
+ # still take precedence.
524
+ revoked = !update_term_found
504
525
  else
505
526
  if verification_output
506
527
  currentDID["verification"] += "Revocation reference in log record: " + revoc_term.to_s + "\n"
@@ -538,6 +559,7 @@ class Oydid
538
559
  # 2) das new DID reference back original DID
539
560
  currentDID["did"] = rotate_DID
540
561
  currentDID["doc"]["doc"] = rotate_ddoc
562
+ rotation_performed = true
541
563
  if verification_output
542
564
  currentDID["verification"] += "DID rotation to: " + rotate_DID.to_s + "\n"
543
565
  currentDID["verification"] += "✅ original DID (" + did_orig + ") revoked and referenced in alsoKnownAs\n"
@@ -563,6 +585,13 @@ class Oydid
563
585
  end
564
586
  i += 1
565
587
  end unless currentDID["log"].nil?
588
+
589
+ # fail closed: a revoked DID has no resolvable DID Document unless the
590
+ # controller rotated it to another DID via alsoKnownAs
591
+ if revoked && !rotation_performed
592
+ currentDID["error"] = REVOKED_ERROR_CODE
593
+ currentDID["message"] = "revoked"
594
+ end
566
595
  return currentDID
567
596
  end
568
597
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oydid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.4
4
+ version: 0.6.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christoph Fabianek
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2026-06-27 00:00:00.000000000 Z
10
+ date: 2026-08-18 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: simple_dag
@@ -415,7 +415,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
415
415
  requirements:
416
416
  - - ">="
417
417
  - !ruby/object:Gem::Version
418
- version: 3.2.8
418
+ version: 3.0.0
419
419
  required_rubygems_version: !ruby/object:Gem::Requirement
420
420
  requirements:
421
421
  - - ">="