oydid 0.2.0 → 0.2.1
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.
- checksums.yaml +4 -4
 - data/VERSION +1 -1
 - data/lib/oydid/basic.rb +5 -1
 - data/lib/oydid.rb +44 -8
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: fd217dec02b21cc0f67b4468ca7512cdc407042f5800ba9321453a40578b0fca
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: dc2456c039c57454dda2586e0791fe5c21ed854973a9223e6900e5414298f0cd
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 960ff5f588095f07401e4eb2c70b29a1e3393fb335f757188cf91ac026c9f066a22f5e660a927cbe6bbc70d9b3524f423dacf1b4fb417945d3bbe2c750cb29d2
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: bae80cb73bb3029a1b157fb85c579ac0d394f713b50b2f3eff6968b0a672528d45ae06969a52b3f13c077b55ab9792fe75630417bf19952f18ce7847b834c66a
         
     | 
    
        data/VERSION
    CHANGED
    
    | 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            0.2. 
     | 
| 
      
 1 
     | 
    
         
            +
            0.2.1
         
     | 
    
        data/lib/oydid/basic.rb
    CHANGED
    
    
    
        data/lib/oydid.rb
    CHANGED
    
    | 
         @@ -205,8 +205,38 @@ class Oydid 
     | 
|
| 
       205 
205 
     | 
    
         
             
                        did_old = did.dup
         
     | 
| 
       206 
206 
     | 
    
         
             
                        did10_old = did10.dup
         
     | 
| 
       207 
207 
     | 
    
         
             
                        log_old = did_info["log"]
         
     | 
| 
       208 
     | 
    
         
            -
                         
     | 
| 
       209 
     | 
    
         
            -
             
     | 
| 
      
 208 
     | 
    
         
            +
                        if options[:old_doc_key].nil?
         
     | 
| 
      
 209 
     | 
    
         
            +
                            if options[:old_doc_enc].nil?
         
     | 
| 
      
 210 
     | 
    
         
            +
                                if options[:old_doc_pwd].nil?
         
     | 
| 
      
 211 
     | 
    
         
            +
                                    privateKey_old = read_private_storage(did10_old + "_private_key.b58")
         
     | 
| 
      
 212 
     | 
    
         
            +
                                else
         
     | 
| 
      
 213 
     | 
    
         
            +
                                    privateKey_old, msg = generate_private_key(options[:old_doc_pwd].to_s, 'ed25519-priv')
         
     | 
| 
      
 214 
     | 
    
         
            +
                                end
         
     | 
| 
      
 215 
     | 
    
         
            +
                            else
         
     | 
| 
      
 216 
     | 
    
         
            +
                                privateKey_old, msg = decode_private_key(options[:old_doc_enc].to_s)
         
     | 
| 
      
 217 
     | 
    
         
            +
                            end
         
     | 
| 
      
 218 
     | 
    
         
            +
                        else
         
     | 
| 
      
 219 
     | 
    
         
            +
                            privateKey_old, msg = read_private_key(options[:old_doc_key].to_s)
         
     | 
| 
      
 220 
     | 
    
         
            +
                        end
         
     | 
| 
      
 221 
     | 
    
         
            +
                        if privateKey_old.nil?
         
     | 
| 
      
 222 
     | 
    
         
            +
                            return [nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, "invalid or missing old private document key"]
         
     | 
| 
      
 223 
     | 
    
         
            +
                        end
         
     | 
| 
      
 224 
     | 
    
         
            +
                        if options[:old_rev_key].nil?
         
     | 
| 
      
 225 
     | 
    
         
            +
                            if options[:old_rev_enc].nil?
         
     | 
| 
      
 226 
     | 
    
         
            +
                                if options[:old_rev_pwd].nil?
         
     | 
| 
      
 227 
     | 
    
         
            +
                                    revocationKey_old = read_private_storage(did10_old + "_revocation_key.b58")
         
     | 
| 
      
 228 
     | 
    
         
            +
                                else
         
     | 
| 
      
 229 
     | 
    
         
            +
                                    revocationKey_old, msg = generate_private_key(options[:old_rev_pwd].to_s, 'ed25519-priv')
         
     | 
| 
      
 230 
     | 
    
         
            +
                                end
         
     | 
| 
      
 231 
     | 
    
         
            +
                            else
         
     | 
| 
      
 232 
     | 
    
         
            +
                                revocationKey_old, msg = decode_private_key(options[:old_rev_enc].to_s)
         
     | 
| 
      
 233 
     | 
    
         
            +
                            end
         
     | 
| 
      
 234 
     | 
    
         
            +
                        else
         
     | 
| 
      
 235 
     | 
    
         
            +
                            revocationKey_old, msg = read_private_key(options[:old_rev_key].to_s)
         
     | 
| 
      
 236 
     | 
    
         
            +
                        end
         
     | 
| 
      
 237 
     | 
    
         
            +
                        if revocationKey_old.nil?
         
     | 
| 
      
 238 
     | 
    
         
            +
                            return [nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, "invalid or missing old private revocation key"]
         
     | 
| 
      
 239 
     | 
    
         
            +
                        end
         
     | 
| 
       210 
240 
     | 
    
         | 
| 
       211 
241 
     | 
    
         
             
                        # key management
         
     | 
| 
       212 
242 
     | 
    
         
             
                        if options[:doc_key].nil?
         
     | 
| 
         @@ -218,13 +248,19 @@ class Oydid 
     | 
|
| 
       218 
248 
     | 
    
         
             
                        else
         
     | 
| 
       219 
249 
     | 
    
         
             
                            privateKey, msg = read_private_key(options[:doc_key].to_s)
         
     | 
| 
       220 
250 
     | 
    
         
             
                        end
         
     | 
| 
       221 
     | 
    
         
            -
                        if options[:rev_key].nil? && options[:rev_pwd].nil?
         
     | 
| 
       222 
     | 
    
         
            -
             
     | 
| 
       223 
     | 
    
         
            -
             
     | 
| 
       224 
     | 
    
         
            -
                         
     | 
| 
      
 251 
     | 
    
         
            +
                        # if options[:rev_key].nil? && options[:rev_pwd].nil? && options[:rev_enc].nil?
         
     | 
| 
      
 252 
     | 
    
         
            +
                        #     revocationLog = read_private_storage(did10 + "_revocation.json")
         
     | 
| 
      
 253 
     | 
    
         
            +
                        #     if revocationLog.nil?
         
     | 
| 
      
 254 
     | 
    
         
            +
                        #         return [nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, "invalid or missing old revocation log"]
         
     | 
| 
      
 255 
     | 
    
         
            +
                        #     end
         
     | 
| 
      
 256 
     | 
    
         
            +
                        # else
         
     | 
| 
       225 
257 
     | 
    
         
             
                            if options[:rev_key].nil?
         
     | 
| 
       226 
258 
     | 
    
         
             
                                if options[:rev_enc].nil?
         
     | 
| 
       227 
     | 
    
         
            -
                                     
     | 
| 
      
 259 
     | 
    
         
            +
                                    if options[:rev_pwd].nil?
         
     | 
| 
      
 260 
     | 
    
         
            +
                                        revocationKey, msg = generate_private_key("", 'ed25519-priv')
         
     | 
| 
      
 261 
     | 
    
         
            +
                                    else
         
     | 
| 
      
 262 
     | 
    
         
            +
                                        revocationKey, msg = generate_private_key(options[:rev_pwd].to_s, 'ed25519-priv')
         
     | 
| 
      
 263 
     | 
    
         
            +
                                    end
         
     | 
| 
       228 
264 
     | 
    
         
             
                                else
         
     | 
| 
       229 
265 
     | 
    
         
             
                                    revocationKey, msg = decode_private_key(options[:rev_enc].to_s)
         
     | 
| 
       230 
266 
     | 
    
         
             
                                end
         
     | 
| 
         @@ -246,7 +282,7 @@ class Oydid 
     | 
|
| 
       246 
282 
     | 
    
         
             
                                "op": 1, # REVOKE
         
     | 
| 
       247 
283 
     | 
    
         
             
                                "doc": subDidHash,
         
     | 
| 
       248 
284 
     | 
    
         
             
                                "sig": signedSubDidHash }.transform_keys(&:to_s).to_json
         
     | 
| 
       249 
     | 
    
         
            -
                        end
         
     | 
| 
      
 285 
     | 
    
         
            +
                        # end
         
     | 
| 
       250 
286 
     | 
    
         
             
                        revoc_log = JSON.parse(revocationLog)
         
     | 
| 
       251 
287 
     | 
    
         
             
                        revoc_log["previous"] = [
         
     | 
| 
       252 
288 
     | 
    
         
             
                            hash(canonical(log_old[did_info["doc_log_id"].to_i])), 
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: oydid
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.2. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.2.1
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Christoph Fabianek
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2022-03- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2022-03-15 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: dag
         
     |