Git Product home page Git Product logo

Comments (2)

rmbolger avatar rmbolger commented on June 4, 2024

Hi @mcx808, thanks for reaching out. I think you meant Get-PAOrder rather than Get-PACertificate, right? In any case, the reason the timestamps on the order object are strings is partially ACME spec related and partially PowerShell related.

The module's order object is effectively the ACME order object with some module-specific stuff tacked onto it. All timestamps in ACME objects like the expires field on an order use the format described in RFC3339 which is an "Internet profile" of ISO 8601. This is useful because the objects are generally sent as JSON and there's no official way to represent a datetime in JSON. So when I was adding the additional timestamp properties, I wanted to stay consistent with the other fields.

Because I'm reading/writing the order objects from/to disk as JSON, it was convenient to keep them in that same RFC3339 format particularly since the PowerShell 5.1 (and earlier) JSON library doesn't try to auto-convert them to DateTime objects like the JSON library that PowerShell (Core) now uses tries to helpfully do. For example, compare the results of this code between PowerShell 5.1 and any version past 6.0.

'{"mydate":"2023-11-17T06:38:30Z"}' | ConvertFrom-Json | gm

Essentially, it comes down to wanting consistent functionality between PowerShell versions without needing to muddy up the codebase with a bunch of engine-specific code paths. I could theoretically change it in the next major version. But it sort of doesn't make sense to until I can drop PowerShell 5.1 as a supported runtime.

Also, the reason why the timestamps on the output of Get-PACertificate are actual DateTime objects is because that object is being generated directly from the certificate data and never gets written or read from disk as JSON.

from posh-acme.

mcx808 avatar mcx808 commented on June 4, 2024

Hi @rmbolger,

I think you meant Get-PAOrder rather than Get-PACertificate, right?
Yes, sorry my mis-type there.

Thank you for the detailed explanation. Perfectly reasonable to follow the RFC for the ACME order spec, I'll bear in mind to use [datetime](Get-PAOrrder).RenewAfter for that check in my scripts. I'm glad I asked before submitting a PR to change anything.

Thanks!

from posh-acme.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.